6 #include "TDatabasePDG.h"
7 #include "TParticlePDG.h"
27 fTargetZ (new Double_t[1]),
30 fVertex(TVector3(0.,0.,0.)),
32 fSmearVertexZ(kFALSE),
33 fSmearGausVertexZ(kFALSE),
34 fSmearVertexXY(kFALSE),
36 fGenList(new TObjArray()),
37 fListIter(fGenList->MakeIterator()),
62 fTargetZ (new Double_t[1]),
65 fVertex(TVector3(0.,0.,0.)),
67 fSmearVertexZ(kFALSE),
68 fSmearGausVertexZ(kFALSE),
69 fSmearVertexXY(kFALSE),
71 fGenList(new TObjArray()),
72 fListIter(fGenList->MakeIterator()),
90 for(Int_t i=0; i<
fGenList->GetEntries(); i++ ) {
92 if(gen) { gen->
Init(); }
125 Fatal(
"GenerateEvent",
"No MCEventHeader branch");
143 if ( ! gen ) {
return kFALSE; }
144 const char* genName = gen->GetName();
183 Double_t pz, Double_t vx, Double_t vy,
184 Double_t vz, Int_t parent,Bool_t wanttracking,Double_t
e)
193 if ( pdgid == 311 || pdgid == -311 ) {
194 Double_t test = gRandom->Uniform(0.,1.);
195 if (test >= 0.5) { pdgid = 310; }
196 else { pdgid = 130; }
200 TDatabasePDG* pdgBase = TDatabasePDG::Instance();
202 Fatal(
"FairPrimaryGenerator",
203 "No TDatabasePDG instantiated");
205 TParticlePDG* pdgPart = pdgBase->GetParticle(pdgid);
208 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: PDG code " << pdgid <<
" not found in database.\033[0m " << endl;
209 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: Discarding particle \033[0m " << endl;
210 cerr <<
"\033[5m\033[31m -E FairPrimaryGenerator: now MC Index is corrupted \033[0m " << endl;
213 cout <<
"\033[5m\033[31m -W FairPrimaryGenerator: PDG code " << pdgid <<
" not found in database. This warning can be savely ignored.\033[0m " << endl;
219 Double_t
mass = pdgBase->GetParticle(pdgid)->Mass();
220 e = TMath::Sqrt( px*px + py*py + pz*pz + mass*mass );
224 Int_t doTracking = 0;
225 if(
fdoTracking && wanttracking) { doTracking = 1 ; }
226 Int_t dummyparent = -1;
232 Double_t weight = 1.;
237 fStack->
PushTrack(doTracking, dummyparent, pdgid, px, py, pz, e, vx, vy, vz,
238 tof, polx, poly, polz, kPPrimary, ntr, weight, status, parent);
248 Double_t sigmaX, Double_t sigmaY)
280 fTargetZ =
new Double_t[nroftargets];
281 for (Int_t i=0; i<nroftargets; i++) {
333 fTimeProb=
new TF1(
"TimeProb.", form.Data(), 0., mean*10);
344 cout <<
" \033[5m\033[31m -E FairPrimaryGenerator: invalid time function, Event time is not SET \033[0m " << endl;