93 cout <<
"-E MpdUrqmdGenerator: Input file not open! " << endl;
99 cout <<
"-E- MpdUrqmdGenerator::ReadEvent: "
100 <<
"No PrimaryGenerator!" << endl;
105 int evnr = 0, ntracks = 0, aProj = 0, zProj = 0, aTarg = 0, zTarg = 0;
106 float b = 0., ekin = 0.;
108 int ityp = 0, i3 = 0, ichg = 0, pid = 0;
109 float ppx = 0., ppy = 0., ppz = 0.,
m = 0.;
114 gzgets(fInputFile, read, 200);
116 fgets(read, 200, fInputFile);
118 Int_t urqmdVersion = 0;
119 sscanf(read,
"UQMD version: %d 1000 %d output_file 14", &urqmdVersion, &urqmdVersion);
120 cout <<
"URQMD VERSION USED = " << urqmdVersion << endl;
122 if (gzeof(fInputFile)) {
123 cout <<
"-I MpdUrqmdGenerator : End of input file reached." << endl;
126 if ( feof(fInputFile) ) {
127 cout <<
"-I MpdUrqmdGenerator : End of input file reached." << endl;
133 if (read[0] !=
'U') {
134 cout <<
"-E MpdUrqmdGenerator: Wrong event header" << endl;
140 gzgets(fInputFile, read, 200);
141 sscanf(read,
"projectile: (mass, char) %d %d target: (mass, char) %d %d",
142 &aProj, &zProj, &aTarg, &zTarg);
143 gzgets(fInputFile, read, 200);
144 gzgets(fInputFile, read, 36);
145 gzgets(fInputFile, read, 200);
146 sscanf(read,
"%f", &b);
147 gzgets(fInputFile, read, 39);
148 gzgets(fInputFile, read, 200);
149 sscanf(read,
"%e", &ekin);
150 gzgets(fInputFile, read, 7);
151 gzgets(fInputFile, read, 200);
152 sscanf(read,
"%d", &evnr);
154 for (Int_t iline = 0; iline < ((urqmdVersion == 30400) ? 11 : 8); iline++)
155 gzgets(fInputFile, read, 200);
157 gzgets(fInputFile, read, 200);
158 sscanf(read,
"%d", &ntracks);
159 gzgets(fInputFile, read, 200);
161 fgets(read, 26, fInputFile);
162 fscanf(fInputFile,
"%d", &aProj);
163 fscanf(fInputFile,
"%d", &zProj);
164 fgets(read, 25, fInputFile);
165 fscanf(fInputFile,
"%d", &aTarg);
166 fscanf(fInputFile,
"%d", &zTarg);
167 fgets(read, 200, fInputFile);
168 fgets(read, 200, fInputFile);
169 fgets(read, 36, fInputFile);
170 fscanf(fInputFile,
"%f", &b);
171 fgets(read, 200, fInputFile);
172 fgets(read, 39, fInputFile);
173 fscanf(fInputFile,
"%e", &ekin);
174 fgets(read, 200, fInputFile);
175 fgets(read, 7, fInputFile);
176 fscanf(fInputFile,
"%d", &evnr);
177 fgets(read, 200, fInputFile);
178 for (
int iline=0; iline<8; iline++) { fgets(read, 200,fInputFile); }
179 fscanf(fInputFile,
"%d", &ntracks);
180 fgets(read, 200, fInputFile);
181 fgets(read, 200, fInputFile);
185 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
186 TParticlePDG* kProton = pdgDB->GetParticle(2212);
192 Double_t gammaCM = TMath::Sqrt(1. / (1. - betaCM * betaCM));
194 cout <<
"-I MpdUrqmdGenerator: Event " << evnr <<
", b = " << b
195 <<
" fm, multiplicity " << ntracks <<
", ekin: " << ekin << endl;
200 if (fEventPlaneSet) {
201 phi = gRandom->Uniform(fPhiMin, fPhiMax);
205 FairMCEventHeader*
event = primGen->GetEvent();
206 if (event && (!event->IsSet())) {
207 event->SetEventID(evnr);
209 event->MarkSet(kTRUE);
215 for (
int itrack = 0; itrack < ntracks; itrack++) {
219 gzgets(fInputFile, read, 81);
220 gzgets(fInputFile, read, 200);
221 sscanf(read,
"%e %e %e %e %d %d %d", &ppx, &ppy, &ppz, &
m, &ityp, &i3, &ichg);
223 fgets(read, 81, fInputFile);
224 fscanf(fInputFile,
"%e", &ppx);
225 fscanf(fInputFile,
"%e", &ppy);
226 fscanf(fInputFile,
"%e", &ppz);
227 fscanf(fInputFile,
"%e", &
m);
228 fscanf(fInputFile,
"%d", &ityp);
229 fscanf(fInputFile,
"%d", &i3);
230 fscanf(fInputFile,
"%d", &ichg);
231 fgets(read, 200, fInputFile);
236 pid = 1000 * (ichg + 2) + ityp;
238 pid = -1000 * (ichg + 2) + ityp;
242 if (fParticleTable.find(pid) == fParticleTable.end()) {
243 cout <<
"-W MpdUrqmdGenerator: PID " << ityp <<
" charge "
244 << ichg <<
" not found in table (" << pid <<
")" << endl;
247 Int_t pdgID = fParticleTable[pid];
250 Double_t mass = Double_t(
m);
251 Double_t px = Double_t(ppx);
252 Double_t py = Double_t(ppy);
253 Double_t pz = Double_t(ppz);
254 Double_t e =
sqrt(mass * mass + px * px + py * py + pz * pz);
256 pz = gammaCM * (pz + betaCM * e);
257 Double_t ee =
sqrt(mass * mass + px * px + py * py + pz * pz);
259 if (fEventPlaneSet) {
260 Double_t pt = Sqrt(px * px + py * py);
261 Double_t azim = ATan2(py, px);
275 primGen->AddTrack(pdgID, px, py, pz, fX, fY, fZ);
291 for (Int_t ii = 0; ii < count; ii++) {
294 cout <<
"-E MpdUrqmdGenerator: Input file not open! " << endl;
299 int evnr = 0, ntracks = 0, aProj = 0, zProj = 0, aTarg = 0, zTarg = 0;
300 float b = 0., ekin = 0.;
305 gzgets(fInputFile, read, 200);
307 fgets(read, 200, fInputFile);
309 Int_t urqmdVersion = 0;
310 sscanf(read,
"UQMD version: %d 1000 %d output_file 14", &urqmdVersion, &urqmdVersion);
311 cout <<
"URQMD VERSION USED = " << urqmdVersion << endl;
314 if (gzeof(fInputFile)) {
315 cout <<
"-I MpdUrqmdGenerator : End of input file reached." << endl;
318 if ( feof(fInputFile) ) {
319 cout <<
"-I MpdUrqmdGenerator : End of input file reached." << endl;
325 if (read[0] !=
'U') {
326 cout <<
"-E MpdUrqmdGenerator: Wrong event header" << endl;
332 gzgets(fInputFile, read, 200);
333 sscanf(read,
"projectile: (mass, char) %d %d target: (mass, char) %d %d",
334 &aProj, &zProj, &aTarg, &zTarg);
335 gzgets(fInputFile, read, 200);
336 gzgets(fInputFile, read, 36);
337 gzgets(fInputFile, read, 200);
338 sscanf(read,
"%f", &b);
339 gzgets(fInputFile, read, 39);
340 gzgets(fInputFile, read, 200);
341 sscanf(read,
"%e", &ekin);
342 gzgets(fInputFile, read, 7);
343 gzgets(fInputFile, read, 200);
344 sscanf(read,
"%d", &evnr);
346 for (Int_t iline = 0; iline < ((urqmdVersion == 30400) ? 11 : 8); iline++)
347 gzgets(fInputFile, read, 200);
349 gzgets(fInputFile, read, 200);
350 sscanf(read,
"%d", &ntracks);
351 gzgets(fInputFile, read, 200);
353 fgets(read, 26, fInputFile);
354 fscanf(fInputFile,
"%d", &aProj);
355 fscanf(fInputFile,
"%d", &zProj);
356 fgets(read, 25, fInputFile);
357 fscanf(fInputFile,
"%d", &aTarg);
358 fscanf(fInputFile,
"%d", &zTarg);
359 fgets(read, 200, fInputFile);
360 fgets(read, 200, fInputFile);
361 fgets(read, 36, fInputFile);
362 fscanf(fInputFile,
"%f", &b);
363 fgets(read, 200, fInputFile);
364 fgets(read, 39, fInputFile);
365 fscanf(fInputFile,
"%e", &ekin);
366 fgets(read, 200, fInputFile);
367 fgets(read, 7, fInputFile);
368 fscanf(fInputFile,
"%d", &evnr);
369 fgets(read, 200, fInputFile);
370 for (
int iline=0; iline<8; iline++) { fgets(read, 200,fInputFile); }
371 fscanf(fInputFile,
"%d", &ntracks);
372 fgets(read, 200, fInputFile);
373 fgets(read, 200, fInputFile);
376 cout <<
"-I MpdUrqmdGenerator: Event " << evnr <<
" skipped!" << endl;
379 for (
int itrack = 0; itrack < ntracks; itrack++) {
383 gzgets(fInputFile, read, 200);
385 fgets(read, 81, fInputFile);
386 fgets(read, 200, fInputFile);