2 /*************************************************************************
3 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
4 * All rights reserved. *
6 * For the licensing terms see $ROOTSYS/LICENSE. *
7 * For the list of contributors see $ROOTSYS/README/CREDITS. *
8 *************************************************************************/
11 //* +-------------------------------------------------------------+
17 //* | S. Roesler+), R. Engel#), J. Ranft*) |
19 //* | +) CERN, TIS-RP |
20 //* | CH-1211 Geneva 23, Switzerland |
21 //* | Email: Stefan.Roesler@cern.ch |
23 //* | #) University of Delaware, BRI |
24 //* | Newark, DE 19716, USA |
26 //* | *) University of Siegen, Dept. of Physics |
27 //* | D-57068 Siegen, Germany |
30 //* | http://home.cern.ch/sroesler/dpmjet3.html |
33 //* | Monte Carlo models used for event generation: |
34 //* | PHOJET 1.12, JETSET 7.4 and LEPTO 6.5.1 |
36 //* +-------------------------------------------------------------+
41 #include "DPMcommon.h"
42 //*KEEP,TParticle,T=C++
43 #include "TParticle.h"
44 #include "TClonesArray.h"
52 # define dt_dtuini dt_dtuini_
53 # define dt_getemu de_getemu_
54 # define dt_kkinc dt_kkinc_
55 # define pho_phist pho_phist_
56 # define dt_dtuout dt_dtuout_
57 # define dt_rndm dt_rndm_
58 # define dt_rndmst dt_rndmst_
59 # define dt_rndmin dt_rndmin_
60 # define dt_rndmou dt_rndmou_
61 # define dpmjet_openinp dpmjet_openinp_
62 # define dt_evtout dt_evtout_
65 # define dt_dtuini DT_DTUINI
66 # define dt_getemu DT_GETEMU
67 # define dt_kkinc DT_KKINC
68 # define pho_phist PHO_PHIST
69 # define dt_dtuout DT_DTUOUT
70 # define dt_rndm DT_RNDM
71 # define dt_rndmst DT_RNDMST
72 # define dt_rndmin DT_RNDMIN
73 # define dt_rndmou DT_RNDMOU
74 # define dt_evtout DT_EVTOUT_
75 # define dpmjet_openinp DPMJET_OPENINP
76 # define type_of_call _stdcall
81 extern "C" void type_of_call dt_dtuini(Int_t & , Double_t &, Int_t & , Int_t &,
82 Int_t &, Int_t &, Int_t &, Int_t &);
83 extern "C" double type_of_call dt_getemu(Int_t &, Int_t &, Int_t &, Int_t &);
84 extern "C" void type_of_call dt_kkinc(Int_t &, Int_t &, Int_t &, Int_t &,
85 Int_t &, Double_t &, Int_t &, Int_t &);
86 extern "C" void type_of_call pho_phist(Int_t &, Double_t &);
87 extern "C" void type_of_call dt_dtuout();
88 extern "C" int type_of_call dt_evtout(const Int_t &);
89 extern "C" void type_of_call dt_rndm(Int_t &);
90 extern "C" void type_of_call dt_rndmst(Int_t &, Int_t &, Int_t &, Int_t &);
91 extern "C" void type_of_call dt_rndmin(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
92 extern "C" void type_of_call dt_rndmou(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
93 extern "C" void type_of_call dpmjet_openinp();
102 //______________________________________________________________________________
104 TGenerator("dpmjet","dpmjet"),
121 // Default Constructor
124 //______________________________________________________________________________
125 TDPMjet::TDPMjet(DpmProcess_t iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82,
126 Double_t Epn=2700., Double_t CMEn=5400.)
127 : TGenerator("dpmjet","dpmjet"),
144 printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
148 //______________________________________________________________________________
149 Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
152 // Default primary creation method. It reads the /HEPEVT/ common block which
153 // has been filled by the GenerateEvent method. If the event generator does
154 // not use the HEPEVT common block, This routine has to be overloaded by
156 // The function loops on the generated particles and store them in
157 // the TClonesArray pointed by the argument particles.
158 // The default action is to store only the stable particles
159 // This can be demanded explicitly by setting the option = "Final"
160 // If the option = "All", all the particles are stored.
162 if(particles==0) return 0;
163 TClonesArray &Particles = *particles;
165 Int_t numpart = 0; // Total number of produced particles
166 Int_t numStabpart = 0; // Total number of produced stable particles
167 Double_t entot = 0; // Total energy in final state (from stable particles)
169 numpart = DTEVT1.nhkk;
170 for(Int_t i=0; i<numpart; i++){
171 if(DTEVT1.isthkk[i]==1 || DTEVT1.isthkk[i]==-1 || DTEVT1.isthkk[i]==1001){
173 entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
176 printf("\n TDPMjet: DPMJET stack contains %d particles", numpart);
177 // printf("\n TDPMjet: Final not decayed particles: %d", numStabpart);
178 //printf("\n TDPMjet: Total energy: %f GeV \n", entot);
181 if(!strcmp(option,"") || !strcmp(option,"Final")){
182 for (Int_t i=0; i < numpart; i++) {
184 if (DTEVT1.isthkk[i] == 1) {
186 // Use the common block values for the TParticle constructor
188 new(Particles[nump]) TParticle(
208 else if(!strcmp(option,"All")){
210 for (Int_t i=0; i <= numpart; i++){
212 // DTEVT1.JMOHKK[i][0] pointer to the entry of the 1st mother of entry i
213 Int_t iParent = DTEVT1.jmohkk[i][0] - 1;
216 TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
217 mother->SetLastDaughter(i);
218 if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i);
220 // --- PDGcode for residual nuclei (idhkk=80000)
221 // --- 10000*Z + 10*A
222 // --- DPMJET -> idres = mass #, idxres = charge
223 if(DTEVT1.idhkk[i] == 80000)
224 DTEVT1.idhkk[i] = 10000*DTEVT2.idxres[i]+10*DTEVT2.idres[i];
226 if(DTEVT2.idxres[i] != 0)
227 printf("\n pc#%d -> A = %d, Z = %d -> PDGcode = %d\n",
228 i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]);
231 printf("%5d %5d %5d %5d %13.3f %13.3f %13.3f %13.3f \n", i,
241 new(Particles[i]) TParticle(
264 //====================== access to dpmjet subroutines =========================
265 //______________________________________________________________________________
266 void TDPMjet::Initialize()
269 // Write standard DPMJET input cards
271 FILE* out = fopen("dpmjet.inp","w");
272 // Projectile and Target definition
273 if (fIp == 1 && fIpz ==1) {
274 fprintf(out, "PROJPAR PROTON\n");
275 } else if (fIp == 1 && fIpz == -1) {
276 fprintf(out, "PROJPAR APROTON\n");
278 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.);
281 if (fIt == 1 && fItz ==1) {
282 fprintf(out, "TARPAR PROTON\n");
283 } else if (fIt == 1 && fItz == -1) {
284 fprintf(out, "TARPAR APROTON\n");
286 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.);
289 // Beam energy and crossing-angle
290 fprintf(out, "BEAM %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.);
292 if (fIp > 1. && fIt > 1)
293 fprintf(out, "CENTRAL %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.);
296 fprintf(out, "PARDECAY %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.);
301 fprintf(out, "PHOINPUT\n");
302 fprintf(out, "DEBUG 0 0 0 \n");
304 if (fProcess == kDpmMb) {
305 fprintf(out, "PROCESS 1 0 1 1 1 1 1 1\n");
306 } else if (fProcess == kDpmMbNonDiffr) {
307 fprintf(out, "PROCESS 1 0 1 0 0 0 0 1\n");
308 } else if (fProcess == kDpmDiffr) {
309 fprintf(out, "PROCESS 0 0 0 1 1 1 1 0\n");
310 }else if (fProcess == kDpmSingleDiffr) {
311 fprintf(out, "PROCESS 0 0 0 0 1 1 0 0\n");
312 }else if (fProcess == kDpmDoubleDiffr) {
313 fprintf(out, "PROCESS 0 0 0 0 0 0 1 0\n");
314 } else if (fProcess == kDpmCentralDiffr){
315 fprintf(out, "PROCESS 0 0 0 1 0 0 0 0\n");
320 // K0s pi0 lam sig+ sig- tet0
321 310, 111, 3122, 3222, 3112, 3322,
322 // tet- om- D+ D0 Ds+
323 3312, 3334, 411, 421, 431,
324 // etac lamc+ sigc++ sigc+ sigc0 Ksic+
325 441, 4122, 4222, 4212, 4112, 4232,
331 Int_t iON = (fDecayAll) ? 1:0;
332 for (Int_t i = 0; i < 8; i++) {
333 fprintf(out, "LUND-DECAY%5d %5d\n", iPDG[i], iON);
336 fprintf(out, "LUND-MSTJ %5d %5d\n", 22, 1);
338 fprintf(out, "ENDINPUT\n");
341 fprintf(out, "START 1.0 0.0\n");
342 fprintf(out, "STOP\n");
347 // Call DPMJET initialisation
348 Int_t iemu = 0; // No emulsion (default)
349 Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
354 //______________________________________________________________________________
355 void TDPMjet::GenerateEvent()
357 // Generates one event;
359 DTEVNO.nevent=fNEvent;
363 Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
367 //______________________________________________________________________________
368 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
369 int ntmass, int ntchar, int idp, int iemu)
371 // Call dmpjet routine DT_DTUINI passing the parameters
372 // in a way accepted by Fortran routines
375 printf("\n-------------------------------------------\n");
376 printf("\n Dt_Dtuini called with:\n\n");
377 printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
378 printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar);
379 printf(" Proj. LAB E -> E = %f GeV \n",epn);
380 printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu);
381 printf("\n-------------------------------------------\n");
383 dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
387 //______________________________________________________________________________
388 void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
389 int idp, double elab, int kkmat, int irej)
391 // Call dmpjet routine DT_KKINC passing the parameters
392 // in a way accepted by Fortran routines
393 dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
396 //______________________________________________________________________________
397 void TDPMjet::Pho_Phist(int imode, double weight)
399 // Call dmpjet routine PHO_PHIST passing the parameters
400 // in a way accepted by Fortran routines
402 pho_phist(imode,weight);
406 //______________________________________________________________________________
407 void TDPMjet::Dt_Dtuout()
409 // Call dmpjet routine DT_DTUOT passing the parameters
410 // in a way accepted by Fortran routines
416 //______________________________________________________________________________
417 Int_t TDPMjet::GetEvNum() const
419 return DTEVT1.nevhkk;
421 //______________________________________________________________________________
422 Int_t TDPMjet::GetEntriesNum() const
426 //______________________________________________________________________________
427 Int_t TDPMjet::GetNumStablePc() const
429 Int_t NumStablePc = 0;
430 for(Int_t i=0; i<DTEVT1.nhkk; i++){
431 if(DTEVT1.isthkk[i] == 1) NumStablePc++;
436 //______________________________________________________________________________
437 Float_t TDPMjet::GetTotEnergy() const
439 Float_t TotEnergy = 0.;
440 for(Int_t i=0; i<DTEVT1.nhkk; i++){
441 if(DTEVT1.isthkk[i] == 1)
442 TotEnergy += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
447 //______________________________________________________________________________
448 Int_t TDPMjet::GetStatusCode(Int_t evnum) const
450 return DTEVT1.isthkk[evnum];
452 //______________________________________________________________________________
453 Int_t TDPMjet::GetPDGCode(Int_t evnum) const
455 return DTEVT1.idhkk[evnum];
457 //______________________________________________________________________________
458 Double_t TDPMjet::Getpx(Int_t evnum) const
460 return DTEVT1.phkk[evnum][0];
462 //______________________________________________________________________________
463 Double_t TDPMjet::Getpy(Int_t evnum) const
465 return DTEVT1.phkk[evnum][1];
467 //______________________________________________________________________________
468 Double_t TDPMjet::Getpz(Int_t evnum) const
470 return DTEVT1.phkk[evnum][2];
472 //______________________________________________________________________________
473 Double_t TDPMjet::GetEnergy(Int_t evnum) const
475 return DTEVT1.phkk[evnum][3];
477 //______________________________________________________________________________
478 Double_t TDPMjet::GetMass(Int_t evnum) const
480 return DTEVT1.phkk[evnum][4];
482 //______________________________________________________________________________
483 Int_t TDPMjet::GetFragmentA(Int_t evnum) const
485 return DTEVT2.idres[evnum];
487 //______________________________________________________________________________
488 Int_t TDPMjet::GetFragmentZ(Int_t evnum) const
490 return DTEVT2.idxres[evnum];
492 //______________________________________________________________________________
493 Double_t TDPMjet::GetXSFrac() const
495 return DTIMPA.xsfrac;
497 //______________________________________________________________________________
498 Double_t TDPMjet::GetBImpac() const
500 return DTGLCP.bimpac;
502 //______________________________________________________________________________
503 Double_t TDPMjet::GetProjRadius() const
507 //______________________________________________________________________________
508 Double_t TDPMjet::GetTargRadius() const
512 //______________________________________________________________________________
513 Int_t TDPMjet::GetProjWounded() const
515 return DTGLCP.nwasam;
517 //______________________________________________________________________________
518 Int_t TDPMjet::GetTargWounded() const
520 return DTGLCP.nwbsam;
522 //______________________________________________________________________________
523 Int_t TDPMjet::GetProjSpectators() const
525 return DTGLCP.nwtaac;
527 //______________________________________________________________________________
528 Int_t TDPMjet::GetTargSpectators() const
530 return DTGLCP.nwtbac;
532 //______________________________________________________________________________
533 Int_t TDPMjet::GetProcessCode() const
535 return POPRCS.iproce;
537 //______________________________________________________________________________
538 void TDPMjet::Dt_Rndm(int idummy)
543 //______________________________________________________________________________
544 void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1)
546 dt_rndmst(na1, na2, na3, nb1);
549 //______________________________________________________________________________
550 void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j)
552 dt_rndmin(u, c, cd, cm, i, j);
555 //______________________________________________________________________________
556 void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
558 dt_rndmou(u, c, cd, cm, i, j);