27 , fDensityFunction(nullptr)
38 LOG(info) <<
"FairEvtGenGenerator: Opening input file " << fileName;
39 if ((fInputFile = fopen(fFileName,
"r")) ==
nullptr)
43 Fatal(
"FairEvtGenGenerator",
"Cannot open input file.");
55 , fDensityFunction(DensityFunction)
57 LOG(info) <<
"FairEvtGenGenerator: Opening input file " << fileName;
58 if ((fInputFile = fopen(fFileName,
"r")) ==
nullptr) {
59 LOG(fatal) <<
"Cannot open input file.";
65 delete fDensityFunction;
76 LOG(info) <<
"FairEvtGenGenerator: Input file not open!";
81 Int_t ntracks = 0, eventID = 0, ncols = 0;
84 Int_t nLine = 0, pdgID = 0, nDecay = 0, nM1 = -1, nM2 = -1, nDF = -1, nDL = -1;
85 Float_t fPx = 0., fPy = 0., fPz = 0., fE = 0.;
86 Float_t fVx = 0., fVy = 0., fVz = 0., fT = 0.;
93 ncols = fscanf(fInputFile,
"%d\t%d", &eventID, &ntracks);
95 if (ncols && ntracks > 0) {
99 for (Int_t ii = 0; ii < 15; ii++) {
100 ncols += fscanf(fInputFile,
"%s", buffer);
105 for (Int_t ll = 0; ll < ntracks; ll++) {
106 ncols += fscanf(fInputFile,
107 "%d %d %d %d %d %d %d %g %f %f %f %f %f %f %f",
127 max_nr = std::max(max_nr, nDF);
128 max_nr = std::max(max_nr, nDL);
129 if ((nDF == -1) && (nDL == -1)) {
135 Double_t
fX,
fY,
fZ, radius;
136 radius = gRandom->Gaus(0, fRsigma);
137 gRandom->Circle(fX, fY, radius);
143 fZ = fDensityFunction->GetRandom();
147 primGen->
AddTrack(pdgID, fPx, fPy, fPz, fVx, fVy, fVz);
151 LOG(info) <<
"FairEvtGenGenerator: End of input file reached ";
157 if (feof(fInputFile)) {
158 LOG(info) <<
"FairEvtGenGenerator: End of input file reached ";
172 void FairEvtGenGenerator::CloseInput()
177 LOG(info) <<
"FairEvtGenGenerator: Closing input file " << fFileName;
183 fInputFile =
nullptr;
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
ClassImp(FairEventBuilder)
virtual ~FairEvtGenGenerator()
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)