7 #include "TClonesArray.h"
9 #include "TLorentzVector.h"
12 #include "TParticle.h"
14 #include "FairPrimaryGenerator.h"
29 FairGenerator(), iEvent(0), fFileName(
""), fInputRootFile(), fInputTree(),
30 fInputAsciiFile(), fRPx(), fRPy(), fRPz(), fRVx(), fRVy(), fRVz(),
31 fRPdg(), fRDF(), fRDL(), fRNTrk(0), fFileType(kFALSE), fGasmode(0),
40 FairGenerator(), iEvent(0), fFileName(fileName), fInputRootFile(), fInputTree(),
41 fInputAsciiFile(), fRPx(), fRPy(), fRPz(), fRVx(), fRVy(), fRVz(),
42 fRPdg(), fRDF(), fRDL(), fRNTrk(0), fFileType(kFALSE), fGasmode(0),
50 FairGenerator(), iEvent(0), fFileName(fileName), fInputRootFile(), fInputTree(),
51 fInputAsciiFile(), fRPx(), fRPy(), fRPz(), fRVx(), fRVy(), fRVz(),
52 fRPdg(), fRDF(), fRDL(), fRNTrk(0), fFileType(kFALSE), fGasmode(1),
79 cout <<
"-I PndEvtGenGenerator: Opening input file " <<
fFileName.Data() << endl;
101 Fatal(
"PndEvtGenGenerator",
"Cannot open ROOT input file.");
105 Fatal(
"PndEvtGenGenerator",
"Incompatible ROOT input file!");
114 Fatal(
"PndEvtGenGenerator",
"Cannot open ASCII input file.");
160 cout <<
"-E PndEvtGenGenerator: Input ASCII file not open!" << endl;
168 cout <<
"-E PndEvtGenGenerator: Input ROOT file not open!" << endl;
185 cout <<
"-E PndEvtGenGenerator: No more events in input file!" << endl;
212 radius = gRandom->Gaus(0,
fRsigma);
213 gRandom->Circle(fX, fY, radius);
238 Int_t ntracks = 0, eventID = 0, ncols = 0;
241 Int_t nLine = 0, pdgID = 0, nDecay = 0, nM1 = -1, nM2 = -1, nDF = -1, nDL = -1;
242 Double_t fPx = 0., fPy = 0., fPz = 0., fE = 0.;
243 Double_t fVx = 0., fVy = 0., fVz = 0.,
fT = 0.;
252 if (ncols && ntracks>0)
256 for (Int_t ii=0; ii<15; ii++) {
262 for (Int_t ll=0; ll<ntracks; ll++)
264 ncols = fscanf(
fInputAsciiFile,
"%d %d %d %d %d %d %d %lf %lf %lf %lf %lf %lf %lf %lf",
265 &nLine, &pdgID, &nDecay, &nM1, &nM2, &nDF, &nDL, &fPx, &fPy, &fPz, &fE, &
fT, &fVx, &fVy, &fVz);
266 max_nr =
max(max_nr, nDF);
267 max_nr =
max(max_nr, nDL);
268 if ((nDF==-1) && (nDL==-1))
279 radius = gRandom->Gaus(0,
fRsigma);
280 gRandom->Circle(fX, fY, radius);
292 primGen->AddTrack(pdgID, fPx, fPy, fPz, fVx, fVy, fVz);
299 cout <<
"-I FairEvtGenGenerator: End of input file reached " << endl;
308 cout <<
"-I FairEvtGenGenerator: End of input file reached " << endl;
331 cout <<
"-I PndEvtGenGenerator: Closing ASCII input file " <<
fFileName.Data() << endl;
342 cout <<
"-I PndEvtGenGenerator: Closing ROOT input file " <<
fFileName.Data() << endl;
Bool_t ReadRootEvent(FairPrimaryGenerator *primGen)
virtual ~PndEvtGenGenerator()
int fGasmode
0: ASCII, 1:ROOT
Int_t fRNTrk
Number of daughters.
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
FairPrimaryGenerator * primGen
TFile * fInputRootFile
Input file name.
Double_t * fRVx
Momentum of particle.
FILE * fInputAsciiFile
Pointer to input tree.
double fRsigma
Gas mode (vertex smearing)
TString fFileName
Event number.
TF1 * fDensityFunction
sigma for vertex smearing
TTree * fInputTree
Pointer to input file.
Bool_t fFileType
number of particles in event
Int_t * fRDF
PDG code of particle.
Bool_t SetBranchAddresses()
Bool_t ReadAsciiEvent(FairPrimaryGenerator *primGen)
Int_t * fRPdg
Start Vertex of particle.
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)