]>
Commit | Line | Data |
---|---|---|
1a52e0ed | 1 | //*KEEP,CopyRight,T=C. |
2 | /************************************************************************* | |
3 | * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * | |
4 | * All rights reserved. * | |
5 | * * | |
6 | * For the licensing terms see $ROOTSYS/LICENSE. * | |
7 | * For the list of contributors see $ROOTSYS/README/CREDITS. * | |
8 | *************************************************************************/ | |
9 | //*KEND. | |
10 | ||
11 | //* +-------------------------------------------------------------+ | |
12 | //* | | | |
13 | //* | | | |
14 | //* | DPMJET 3.0 | | |
15 | //* | | | |
16 | //* | | | |
17 | //* | S. Roesler+), R. Engel#), J. Ranft*) | | |
18 | //* | | | |
19 | //* | +) CERN, TIS-RP | | |
20 | //* | CH-1211 Geneva 23, Switzerland | | |
21 | //* | Email: Stefan.Roesler@cern.ch | | |
22 | //* | | | |
23 | //* | #) University of Delaware, BRI | | |
24 | //* | Newark, DE 19716, USA | | |
25 | //* | | | |
26 | //* | *) University of Siegen, Dept. of Physics | | |
27 | //* | D-57068 Siegen, Germany | | |
28 | //* | | | |
29 | //* | | | |
30 | //* | http://home.cern.ch/sroesler/dpmjet3.html | | |
31 | //* | | | |
32 | //* | | | |
33 | //* | Monte Carlo models used for event generation: | | |
34 | //* | PHOJET 1.12, JETSET 7.4 and LEPTO 6.5.1 | | |
35 | //* | | | |
36 | //* +-------------------------------------------------------------+ | |
37 | ||
38 | //*KEEP,TDPMjet. | |
39 | #include "TDPMjet.h" | |
40 | //*KEEP,DPMCOMMON. | |
41 | #include "DPMcommon.h" | |
42 | //*KEEP,TParticle,T=C++. | |
43 | #include "TParticle.h" | |
44 | //*KEND. | |
45 | ||
46 | //*KEEP,TROOT. | |
47 | #include "TROOT.h" | |
48 | //*KEND. | |
49 | ||
50 | #ifndef WIN32 | |
51 | # define dt_dtuini dt_dtuini_ | |
52 | # define dt_getemu de_getemu_ | |
53 | # define dt_kkinc dt_kkinc_ | |
54 | # define pho_phist pho_phist_ | |
55 | # define dt_dtuout dt_dtuout_ | |
56 | # define dt_rndm dt_rndm_ | |
57 | # define dt_rndmst dt_rndmst_ | |
58 | # define dt_rndmin dt_rndmin_ | |
59 | # define dt_rndmou dt_rndmou_ | |
60 | # define type_of_call | |
61 | #else | |
62 | # define dt_dtuini DT_DTUINI | |
63 | # define dt_getemu DT_GETEMU | |
64 | # define dt_kkinc DT_KKINC | |
65 | # define pho_phist PHO_PHIST | |
66 | # define dt_dtuout DT_DTUOUT | |
67 | # define dt_rndm DT_RNDM | |
68 | # define dt_rndmst DT_RNDMST | |
69 | # define dt_rndmin DT_RNDMIN | |
70 | # define dt_rndmou DT_RNDMOU | |
71 | # define type_of_call _stdcall | |
72 | #endif | |
73 | ||
74 | #ifndef WIN32 | |
75 | extern "C" void type_of_call dt_dtuini(Int_t & , Double_t &, Int_t & , Int_t &, | |
76 | Int_t &, Int_t &, Int_t &, Int_t &); | |
77 | extern "C" double type_of_call dt_getemu(Int_t &, Int_t &, Int_t &, Int_t &); | |
78 | extern "C" void type_of_call dt_kkinc(Int_t &, Int_t &, Int_t &, Int_t &, | |
79 | Int_t &, Double_t &, Int_t &, Int_t &); | |
80 | extern "C" void type_of_call pho_phist(Int_t &, Double_t &); | |
81 | extern "C" void type_of_call dt_dtuout(); | |
82 | extern "C" void type_of_call dt_rndm(Int_t &); | |
83 | extern "C" void type_of_call dt_rndmst(Int_t &, Int_t &, Int_t &, Int_t &); | |
84 | extern "C" void type_of_call dt_rndmin(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &); | |
85 | extern "C" void type_of_call dt_rndmou(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &); | |
86 | ||
87 | #else | |
88 | ||
89 | #endif | |
90 | ||
91 | ClassImp(TDPMjet) | |
92 | ||
f97d4a8e | 93 | |
1a52e0ed | 94 | //______________________________________________________________________________ |
f97d4a8e | 95 | TDPMjet::TDPMjet() : |
96 | TGenerator("dpmjet","dpmjet"), | |
97 | fNEvent(0), | |
98 | fIp(0), | |
99 | fIpz(0), | |
100 | fIt(0), | |
101 | fItz(0), | |
102 | fEpn(0.), | |
103 | fPpn(0.), | |
104 | fCMEn(0.), | |
105 | fIdp(0), | |
106 | fBmin(0.), | |
107 | fBmax(0.), | |
108 | fFCentr(0), | |
109 | fPi0Decay(0), | |
110 | fProcess(kDpmMb) | |
1a52e0ed | 111 | { |
f97d4a8e | 112 | // Default Constructor |
1a52e0ed | 113 | } |
114 | ||
115 | //______________________________________________________________________________ | |
d38751f5 | 116 | TDPMjet::TDPMjet(DpmProcess_t iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82, |
f97d4a8e | 117 | Double_t Epn=2700., Double_t CMEn=5400.) |
118 | : TGenerator("dpmjet","dpmjet"), | |
119 | fNEvent(0), | |
120 | fIp(Ip), | |
121 | fIpz(Ipz), | |
122 | fIt(It), | |
123 | fItz(Itz), | |
124 | fEpn(Epn), | |
125 | fCMEn(CMEn), | |
126 | fIdp(0), | |
127 | fBmin(0.), | |
128 | fBmax(0.), | |
129 | fFCentr(0), | |
130 | fPi0Decay(0), | |
131 | fProcess(iproc) | |
1a52e0ed | 132 | { |
d38751f5 | 133 | printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz); |
1a52e0ed | 134 | } |
135 | ||
136 | ||
137 | //______________________________________________________________________________ | |
138 | Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option) | |
139 | { | |
140 | // | |
141 | // Default primary creation method. It reads the /HEPEVT/ common block which | |
142 | // has been filled by the GenerateEvent method. If the event generator does | |
143 | // not use the HEPEVT common block, This routine has to be overloaded by | |
144 | // the subclasses. | |
145 | // The function loops on the generated particles and store them in | |
146 | // the TClonesArray pointed by the argument particles. | |
147 | // The default action is to store only the stable particles | |
148 | // This can be demanded explicitly by setting the option = "Final" | |
149 | // If the option = "All", all the particles are stored. | |
150 | // | |
151 | if(particles==0) return 0; | |
152 | TClonesArray &Particles = *particles; | |
153 | Particles.Clear(); | |
154 | Int_t numpart = 0; // Total number of produced particles | |
155 | Int_t numStabpart = 0; // Total number of produced stable particles | |
156 | Double_t entot = 0; // Total energy in final state (from stable particles) | |
157 | ||
158 | numpart = DTEVT1.nhkk; | |
159 | for(Int_t i=0; i<numpart; i++){ | |
160 | if(DTEVT1.isthkk[i]==1 || DTEVT1.isthkk[i]==-1 || DTEVT1.isthkk[i]==1001){ | |
161 | numStabpart++; | |
162 | entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i) | |
163 | } | |
164 | } | |
d38751f5 | 165 | //printf("\n TDPMjet: DPMJET stack contains %d particles", numpart); |
166 | // printf("\n TDPMjet: Final not decayed particles: %d", numStabpart); | |
167 | //printf("\n TDPMjet: Total energy: %f GeV \n", entot); | |
1a52e0ed | 168 | Int_t nump = 0; |
169 | ||
170 | if(!strcmp(option,"") || !strcmp(option,"Final")){ | |
171 | for (Int_t i=0; i < numpart; i++) { | |
172 | ||
173 | if (DTEVT1.isthkk[i] == 1) { | |
174 | // | |
175 | // Use the common block values for the TParticle constructor | |
176 | // | |
1a52e0ed | 177 | new(Particles[nump]) TParticle( |
178 | DTEVT1.idhkk[i], | |
179 | DTEVT1.isthkk[i], | |
180 | -1, | |
181 | -1, | |
182 | -1, | |
183 | -1, | |
184 | DTEVT1.phkk[i][0], | |
185 | DTEVT1.phkk[i][1], | |
186 | DTEVT1.phkk[i][2], | |
187 | DTEVT1.phkk[i][3], | |
188 | ||
189 | DTEVT1.vhkk[i][0], | |
190 | DTEVT1.vhkk[i][1], | |
191 | DTEVT1.vhkk[i][2], | |
192 | DTEVT1.vhkk[i][3]); | |
193 | nump++; | |
194 | } | |
195 | } | |
196 | } | |
197 | else if(!strcmp(option,"All")){ | |
198 | nump = numpart; | |
199 | for (Int_t i=0; i <= numpart; i++){ | |
200 | ||
201 | // DTEVT1.JMOHKK[i][0] pointer to the entry of the 1st mother of entry i | |
202 | Int_t iParent = DTEVT1.jmohkk[i][0] - 1; | |
203 | ||
204 | if(iParent >= 0){ | |
205 | TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent)); | |
1a52e0ed | 206 | mother->SetLastDaughter(i); |
207 | if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i); | |
208 | } | |
209 | // --- PDGcode for residual nuclei (idhkk=80000) | |
210 | // --- 10000*Z + 10*A | |
211 | // --- DPMJET -> idres = mass #, idxres = charge | |
212 | if(DTEVT1.idhkk[i] == 80000) | |
213 | DTEVT1.idhkk[i] = 10000*DTEVT2.idxres[i]+10*DTEVT2.idres[i]; | |
d38751f5 | 214 | /* |
1a52e0ed | 215 | if(DTEVT2.idxres[i] != 0) |
216 | printf("\n pc#%d -> A = %d, Z = %d -> PDGcode = %d\n", | |
217 | i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]); | |
d38751f5 | 218 | */ |
1a52e0ed | 219 | new(Particles[i]) TParticle( |
220 | DTEVT1.idhkk[i], | |
221 | DTEVT1.isthkk[i], | |
222 | iParent, | |
223 | -1, | |
224 | -1, | |
225 | -1, | |
226 | ||
227 | DTEVT1.phkk[i][0], | |
228 | DTEVT1.phkk[i][1], | |
229 | DTEVT1.phkk[i][2], | |
230 | DTEVT1.phkk[i][3], | |
231 | ||
232 | DTEVT1.vhkk[i][0], | |
233 | DTEVT1.vhkk[i][1], | |
234 | DTEVT1.vhkk[i][2], | |
235 | DTEVT1.vhkk[i][3]); | |
1a52e0ed | 236 | } // Particle loop |
237 | } | |
238 | return nump; | |
239 | } | |
240 | ||
241 | ||
242 | //====================== access to dpmjet subroutines ========================= | |
243 | //______________________________________________________________________________ | |
244 | void TDPMjet::Initialize() | |
245 | { | |
d38751f5 | 246 | // |
247 | // Write standard DPMJET input cards | |
248 | // | |
249 | FILE* out = fopen("dpmjet.inp","w"); | |
250 | // Projectile and Target definition | |
251 | fprintf(out, "PROJPAR %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", (Float_t) fIp, (Float_t) fIpz, 0., 0., 0., 0.); | |
252 | fprintf(out, "TARPAR %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", (Float_t) fIt, (Float_t) fItz, 0., 0., 0., 0.); | |
253 | // Beam energy and crossing-angle | |
254 | fprintf(out, "BEAM %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.); | |
255 | // Centrality | |
256 | fprintf(out, "CENTRAL %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.); | |
f97d4a8e | 257 | // Particle decays |
258 | if (fPi0Decay) | |
259 | fprintf(out, "PARDECAY %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.); | |
d38751f5 | 260 | // |
261 | // PHOJET specific | |
262 | fprintf(out, "PHOINPUT\n"); | |
263 | fprintf(out, "DEBUG 0 0 0 \n"); | |
264 | ||
265 | if (fProcess == kDpmMb) { | |
266 | fprintf(out, "PROCESS 1 0 1 1 1 1 1 1\n"); | |
267 | } else if (fProcess == kDpmMbNonDiffr) { | |
268 | fprintf(out, "PROCESS 1 0 1 1 0 0 0 1\n"); | |
269 | } | |
270 | ||
271 | fprintf(out, "ENDINPUT\n"); | |
272 | // | |
273 | // START card | |
274 | fprintf(out, "START 1.0 0.0\n"); | |
275 | fprintf(out, "STOP\n"); | |
276 | fclose(out); | |
277 | // | |
278 | // Call DPMJET initialisation | |
279 | Int_t iemu = 0; // No emulsion (default) | |
280 | Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu); | |
1a52e0ed | 281 | |
282 | } | |
283 | ||
284 | ||
285 | //______________________________________________________________________________ | |
286 | void TDPMjet::GenerateEvent() | |
287 | { | |
288 | // Generates one event; | |
289 | fNEvent++; | |
290 | DTEVNO.nevent=fNEvent; | |
1a52e0ed | 291 | Int_t kkmat=-1; |
292 | Float_t Elab = fEpn; | |
293 | Int_t irej=0; | |
294 | Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej); | |
295 | if(irej!=0) return; | |
1a52e0ed | 296 | } |
297 | //______________________________________________________________________________ | |
298 | void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar, | |
299 | int ntmass, int ntchar, int idp, int iemu) | |
300 | { | |
301 | // Call dmpjet routine DT_DTUINI passing the parameters | |
302 | // in a way accepted by Fortran routines | |
303 | ||
d38751f5 | 304 | |
305 | printf("\n-------------------------------------------\n"); | |
1a52e0ed | 306 | printf("\n Dt_Dtuini called with:\n\n"); |
307 | printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar); | |
308 | printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar); | |
309 | printf(" Proj. LAB E -> E = %f GeV \n",epn); | |
310 | printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu); | |
d38751f5 | 311 | printf("\n-------------------------------------------\n"); |
1a52e0ed | 312 | |
313 | dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu); | |
314 | ||
315 | } | |
316 | ||
317 | //______________________________________________________________________________ | |
318 | void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar, | |
319 | int idp, double elab, int kkmat, int irej) | |
320 | { | |
321 | // Call dmpjet routine DT_KKINC passing the parameters | |
322 | // in a way accepted by Fortran routines | |
1a52e0ed | 323 | dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej); |
1a52e0ed | 324 | } |
325 | ||
326 | //______________________________________________________________________________ | |
327 | void TDPMjet::Pho_Phist(int imode, double weight) | |
328 | { | |
329 | // Call dmpjet routine PHO_PHIST passing the parameters | |
330 | // in a way accepted by Fortran routines | |
331 | ||
332 | pho_phist(imode,weight); | |
333 | ||
334 | } | |
335 | ||
336 | //______________________________________________________________________________ | |
337 | void TDPMjet::Dt_Dtuout() | |
338 | { | |
339 | // Call dmpjet routine DT_DTUOT passing the parameters | |
340 | // in a way accepted by Fortran routines | |
341 | ||
342 | dt_dtuout(); | |
343 | ||
344 | } | |
345 | ||
346 | //______________________________________________________________________________ | |
347 | Int_t TDPMjet::GetEvNum() const | |
348 | { | |
349 | return DTEVT1.nevhkk; | |
350 | } | |
351 | //______________________________________________________________________________ | |
352 | Int_t TDPMjet::GetEntriesNum() const | |
353 | { | |
354 | return DTEVT1.nhkk; | |
355 | } | |
356 | //______________________________________________________________________________ | |
357 | Int_t TDPMjet::GetNumStablePc() const | |
358 | { | |
359 | Int_t NumStablePc = 0; | |
360 | for(Int_t i=0; i<DTEVT1.nhkk; i++){ | |
361 | if(DTEVT1.isthkk[i] == 1) NumStablePc++; | |
362 | } | |
363 | return NumStablePc; | |
364 | } | |
365 | ||
366 | //______________________________________________________________________________ | |
367 | Float_t TDPMjet::GetTotEnergy() const | |
368 | { | |
369 | Float_t TotEnergy = 0.; | |
370 | for(Int_t i=0; i<DTEVT1.nhkk; i++){ | |
371 | if(DTEVT1.isthkk[i] == 1) | |
372 | TotEnergy += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i) | |
373 | } | |
374 | return TotEnergy; | |
375 | } | |
376 | ||
377 | //______________________________________________________________________________ | |
378 | Int_t TDPMjet::GetStatusCode(Int_t evnum) const | |
379 | { | |
380 | return DTEVT1.isthkk[evnum]; | |
381 | } | |
382 | //______________________________________________________________________________ | |
383 | Int_t TDPMjet::GetPDGCode(Int_t evnum) const | |
384 | { | |
385 | return DTEVT1.idhkk[evnum]; | |
386 | } | |
387 | //______________________________________________________________________________ | |
388 | Double_t TDPMjet::Getpx(Int_t evnum) const | |
389 | { | |
390 | return DTEVT1.phkk[evnum][0]; | |
391 | } | |
392 | //______________________________________________________________________________ | |
393 | Double_t TDPMjet::Getpy(Int_t evnum) const | |
394 | { | |
395 | return DTEVT1.phkk[evnum][1]; | |
396 | } | |
397 | //______________________________________________________________________________ | |
398 | Double_t TDPMjet::Getpz(Int_t evnum) const | |
399 | { | |
400 | return DTEVT1.phkk[evnum][2]; | |
401 | } | |
402 | //______________________________________________________________________________ | |
403 | Double_t TDPMjet::GetEnergy(Int_t evnum) const | |
404 | { | |
405 | return DTEVT1.phkk[evnum][3]; | |
406 | } | |
407 | //______________________________________________________________________________ | |
408 | Double_t TDPMjet::GetMass(Int_t evnum) const | |
409 | { | |
410 | return DTEVT1.phkk[evnum][4]; | |
411 | } | |
412 | //______________________________________________________________________________ | |
413 | Int_t TDPMjet::GetFragmentA(Int_t evnum) const | |
414 | { | |
415 | return DTEVT2.idres[evnum]; | |
416 | } | |
417 | //______________________________________________________________________________ | |
418 | Int_t TDPMjet::GetFragmentZ(Int_t evnum) const | |
419 | { | |
420 | return DTEVT2.idxres[evnum]; | |
421 | } | |
422 | //______________________________________________________________________________ | |
423 | Double_t TDPMjet::GetXSFrac() const | |
424 | { | |
425 | return DTIMPA.xsfrac; | |
426 | } | |
427 | //______________________________________________________________________________ | |
428 | Double_t TDPMjet::GetBImpac() const | |
429 | { | |
430 | return DTGLCP.bimpac; | |
431 | } | |
432 | //______________________________________________________________________________ | |
433 | Double_t TDPMjet::GetProjRadius() const | |
434 | { | |
435 | return DTGLCP.rproj; | |
436 | } | |
437 | //______________________________________________________________________________ | |
438 | Double_t TDPMjet::GetTargRadius() const | |
439 | { | |
440 | return DTGLCP.rtarg; | |
441 | } | |
442 | //______________________________________________________________________________ | |
443 | Int_t TDPMjet::GetProjWounded() const | |
444 | { | |
445 | return DTGLCP.nwasam; | |
446 | } | |
447 | //______________________________________________________________________________ | |
448 | Int_t TDPMjet::GetTargWounded() const | |
449 | { | |
450 | return DTGLCP.nwbsam; | |
451 | } | |
452 | //______________________________________________________________________________ | |
453 | Int_t TDPMjet::GetProjSpectators() const | |
454 | { | |
455 | return DTGLCP.nwtaac; | |
456 | } | |
457 | //______________________________________________________________________________ | |
458 | Int_t TDPMjet::GetTargSpectators() const | |
459 | { | |
460 | return DTGLCP.nwtbac; | |
461 | } | |
462 | ||
463 | //______________________________________________________________________________ | |
464 | void TDPMjet::Dt_Rndm(int idummy) | |
465 | { | |
466 | dt_rndm(idummy); | |
467 | } | |
468 | ||
469 | //______________________________________________________________________________ | |
470 | void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1) | |
471 | { | |
472 | dt_rndmst(na1, na2, na3, nb1); | |
473 | } | |
474 | ||
475 | //______________________________________________________________________________ | |
476 | void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j) | |
477 | { | |
478 | dt_rndmin(u, c, cd, cm, i, j); | |
479 | } | |
480 | ||
481 | //______________________________________________________________________________ | |
482 | void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j) | |
483 | { | |
484 | dt_rndmou(u, c, cd, cm, i, j); | |
485 | } | |
486 |