16 #include <TDatabasePDG.h>
17 #include <TIterator.h>
20 #include <TParticlePDG.h>
40 , fBeamAngleSigmaX(0.)
41 , fBeamAngleSigmaY(0.)
42 , fBeamDirection(TVector3(0., 0., 1.))
46 , fTargetZ(new Double_t[1])
49 , fVertex(TVector3(0., 0., 0.))
51 , fSmearVertexZ(kFALSE)
52 , fSmearGausVertexZ(kFALSE)
53 , fSmearVertexXY(kFALSE)
54 , fSmearGausVertexXY(kFALSE)
58 , fGenList(new TObjArray())
59 , fListIter(fGenList->MakeIterator())
80 , fBeamDirection(TVector3(0., 0., 1.))
84 , fTargetZ(new Double_t[1])
87 , fVertex(TVector3(0., 0., 0.))
89 , fSmearVertexZ(kFALSE)
90 , fSmearGausVertexZ(kFALSE)
91 , fSmearVertexXY(kFALSE)
92 , fSmearGausVertexXY(kFALSE)
96 , fGenList(new TObjArray())
97 , fListIter(fGenList->MakeIterator())
108 , fBeamX0(rhs.fBeamX0)
109 , fBeamY0(rhs.fBeamY0)
110 , fBeamSigmaX(rhs.fBeamSigmaX)
111 , fBeamSigmaY(rhs.fBeamSigmaY)
112 , fBeamAngleX0(rhs.fBeamAngleX0)
113 , fBeamAngleY0(rhs.fBeamAngleY0)
114 , fBeamAngleX(rhs.fBeamAngleX)
115 , fBeamAngleY(rhs.fBeamAngleY)
116 , fBeamAngleSigmaX(rhs.fBeamAngleSigmaX)
117 , fBeamAngleSigmaY(rhs.fBeamAngleSigmaY)
118 , fBeamDirection(rhs.fBeamDirection)
119 , fPhiMin(rhs.fPhiMin)
120 , fPhiMax(rhs.fPhiMax)
122 , fTargetZ(new Double_t[1])
123 , fNrTargets(rhs.fNrTargets)
124 , fTargetDz(rhs.fTargetDz)
125 , fVertex(rhs.fVertex)
126 , fNTracks(rhs.fNTracks)
127 , fSmearVertexZ(rhs.fSmearVertexZ)
128 , fSmearGausVertexZ(rhs.fSmearGausVertexZ)
129 , fSmearVertexXY(rhs.fSmearVertexXY)
130 , fSmearGausVertexXY(rhs.fSmearGausVertexXY)
131 , fBeamAngle(rhs.fBeamAngle)
132 , fEventPlane(rhs.fEventPlane)
134 , fGenList(new TObjArray())
135 , fListIter(fGenList->MakeIterator())
137 , fdoTracking(rhs.fdoTracking)
138 , fMCIndexOffset(rhs.fMCIndexOffset)
139 , fEventNr(rhs.fEventNr)
147 for (Int_t i = 0; i <
fGenList->GetEntries(); i++) {
171 TNamed::operator=(rhs);
216 LOG(fatal) <<
"No MCEventHeader branch!";
252 const char *genName = gen->GetName();
256 LOG(error) <<
"ReadEvent failed for generator " << genName;
301 TVector3 mom(px_raw, py_raw, pz_raw);
317 if (pdgid == 311 || pdgid == -311) {
318 Double_t test = gRandom->Uniform(0., 1.);
328 TDatabasePDG *pdgBase = TDatabasePDG::Instance();
330 Fatal(
"FairPrimaryGenerator",
"No TDatabasePDG instantiated");
332 TParticlePDG *pdgPart = pdgBase->GetParticle(pdgid);
335 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: PDG code " << pdgid
336 <<
" not found in database.\033[0m " << endl;
337 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: Discarding particle "
340 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: now MC Index is "
345 cout <<
"\033[5m\033[31m -W FairPrimaryGenerator: PDG code " << pdgid
346 <<
" not found in database. This warning can be savely "
354 Double_t mass = pdgBase->GetParticle(pdgid)->Mass();
355 e = TMath::Sqrt(mom.Mag2() + mass * mass);
359 Int_t doTracking = 0;
363 Int_t dummyparent = -1;
401 for (Int_t i = 0; i <
fGenList->GetEntries(); i++) {
408 return newPrimaryGenerator;
420 Double_t beamAngleY0,
421 Double_t beamAngleSigmaX,
422 Double_t beamAngleSigmaY)
452 fTargetZ =
new Double_t[nroftargets];
453 for (Int_t i = 0; i < nroftargets; i++) {
467 Int_t Target =
static_cast<Int_t
>(gRandom->Uniform(
fNrTargets));
496 fVertex = TVector3(vx, vy, vz);
virtual void MakeBeamAngle()
void SmearVertexXY(Bool_t flag)
virtual FairGenerator * CloneGenerator() const
void AddGenerator(FairGenerator *generator)
ClassImp(FairEventBuilder)
virtual void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondparentID)=0
void SetTarget(Double_t targetZ, Double_t targetDz)
virtual FairPrimaryGenerator * ClonePrimaryGenerator() const
void SetEventPlane(Double_t phiMin, Double_t phiMax)
void SmearGausVertexZ(Bool_t flag)
FairPrimaryGenerator & operator=(const FairPrimaryGenerator &)
void SetBeamAngle(Double_t beamAngleX0, Double_t beamAngleY0, Double_t beamAngleSigmaX, Double_t beamAngleSigmaY)
virtual void AddTrack(Int_t pdgid, Double_t px, Double_t py, Double_t pz, Double_t vx, Double_t vy, Double_t vz, Int_t parent=-1, Bool_t wanttracking=true, Double_t e=-9e9, Double_t tof=0., Double_t weight=0., TMCProcess proc=kPPrimary)
void SetBeam(Double_t beamX0, Double_t beamY0, Double_t beamSigmaX, Double_t beamSigmaY)
virtual Bool_t GenerateEvent(FairGenericStack *pStack)
void SmearVertexZ(Bool_t flag)
Bool_t fSmearGausVertexXY
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)=0
FairGenericStack * fStack
FairMCEventHeader * fEvent
void SetMultTarget(Int_t nroftargets, Double_t *targetZ, Double_t targetDz)
virtual ~FairPrimaryGenerator()
Double_t fBeamAngleSigmaX
Double_t fBeamAngleSigmaY
void SmearGausVertexXY(Bool_t flag)
virtual void MakeVertex()