8#include "OTFEventGenerator.h"
10#include <TDatabasePDG.h>
12#include <TLorentzVector.h>
14#include <TParticlePDG.h>
18#include "DataManager.h"
26 void EventGenerator::GenerateEvent() {
27 Int_t shift = fMcEvent->GetNTracks();
28 fCurrrentMult = fFixedMultiplicity;
29 if (fMultiplicity) fCurrrentMult = fMultiplicity->GetRandom();
30 for (
int i = 0; i < fCurrrentMult; i++) {
32 fSpectras->GetRandom2(y, pt);
33 Double_t mt = TMath::Sqrt(pt * pt + fMass * fMass);
34 Double_t phi = gRandom->Uniform(-TMath::Pi(), TMath::Pi());
35 Double_t px = pt * TMath::Cos(phi);
36 Double_t py = pt * TMath::Sin(phi);
37 Double_t pz = mt * TMath::SinH(y);
41 p.SetXYZM(px, py, pz, fMass);
44 TLorentzVector xr(gRandom->Gaus(0, 1), gRandom->Gaus(0, 1), gRandom->Gaus(0), 0);
46 fMcEvent->AddTrack(tr);
49 px = px + gRandom->Gaus(0, fSmear) * px;
50 py = py + gRandom->Gaus(0, fSmear) * py;
51 pz = pz + gRandom->Gaus(0, fSmear) * pz;
52 Double_t e = TMath::Sqrt(px * px + py * py + pz * pz + fMass * fMass);
53 rtr.SetMom(px, py, pz, e);
55 rtr.SetCharge(fCharge);
56 rtr.SetMcIndex(i + shift);
57 fRecoEvent->AddTrack(rtr);
61 EventGenerator::EventGenerator() {}
64 TH2D* copy = (TH2D*) h.Clone();
65 TDatabasePDG* pdg = TDatabasePDG::Instance();
66 TParticlePDG* part = pdg->GetParticle(pid);
67 if (part ==
nullptr) {
71 copy->SetDirectory(
nullptr);
75 fCharge = part->Charge() * 3;
79 if (fMultiplicity)
delete fMultiplicity;
80 fMultiplicity = (TH1D*) h.Clone();
81 fMultiplicity->SetDirectory(
nullptr);
85 fFixedMultiplicity = mult;
86 if (fMultiplicity)
delete fMultiplicity;
87 fMultiplicity =
nullptr;
90 Bool_t EventGenerator::Init() {
91 if (fSpectras ==
nullptr)
return kFALSE;
95 EventGenerator::~EventGenerator() {
96 if (fSpectras)
delete fSpectras;
97 if (fMultiplicity)
delete fMultiplicity;
void SetSpiecies(const TH2D &h, Int_t pid)
void SetFixMult(Int_t mult)
void SetMultHisto(TH1D &h)
static void PrintInfo(TString text, Hal::EInfo status)