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_
64 # define dt_dtuini DT_DTUINI
65 # define dt_getemu DT_GETEMU
66 # define dt_kkinc DT_KKINC
67 # define pho_phist PHO_PHIST
68 # define dt_dtuout DT_DTUOUT
69 # define dt_rndm DT_RNDM
70 # define dt_rndmst DT_RNDMST
71 # define dt_rndmin DT_RNDMIN
72 # define dt_rndmou DT_RNDMOU
73 # define dpmjet_openinp DPMJET_OPENINP
74 # define type_of_call _stdcall
78 extern "C" void type_of_call dt_dtuini(Int_t & , Double_t &, Int_t & , Int_t &,
79 Int_t &, Int_t &, Int_t &, Int_t &);
80 extern "C" double type_of_call dt_getemu(Int_t &, Int_t &, Int_t &, Int_t &);
81 extern "C" void type_of_call dt_kkinc(Int_t &, Int_t &, Int_t &, Int_t &,
82 Int_t &, Double_t &, Int_t &, Int_t &);
83 extern "C" void type_of_call pho_phist(Int_t &, Double_t &);
84 extern "C" void type_of_call dt_dtuout();
85 extern "C" void type_of_call dt_rndm(Int_t &);
86 extern "C" void type_of_call dt_rndmst(Int_t &, Int_t &, Int_t &, Int_t &);
87 extern "C" void type_of_call dt_rndmin(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
88 extern "C" void type_of_call dt_rndmou(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
89 extern "C" void type_of_call dpmjet_openinp();
98 //______________________________________________________________________________
100 TGenerator("dpmjet","dpmjet"),
117 // Default Constructor
120 //______________________________________________________________________________
121 TDPMjet::TDPMjet(DpmProcess_t iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82,
122 Double_t Epn=2700., Double_t CMEn=5400.)
123 : TGenerator("dpmjet","dpmjet"),
140 printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
144 //______________________________________________________________________________
145 Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
148 // Default primary creation method. It reads the /HEPEVT/ common block which
149 // has been filled by the GenerateEvent method. If the event generator does
150 // not use the HEPEVT common block, This routine has to be overloaded by
152 // The function loops on the generated particles and store them in
153 // the TClonesArray pointed by the argument particles.
154 // The default action is to store only the stable particles
155 // This can be demanded explicitly by setting the option = "Final"
156 // If the option = "All", all the particles are stored.
158 if(particles==0) return 0;
159 TClonesArray &Particles = *particles;
161 Int_t numpart = 0; // Total number of produced particles
162 Int_t numStabpart = 0; // Total number of produced stable particles
163 Double_t entot = 0; // Total energy in final state (from stable particles)
165 numpart = DTEVT1.nhkk;
166 for(Int_t i=0; i<numpart; i++){
167 if(DTEVT1.isthkk[i]==1 || DTEVT1.isthkk[i]==-1 || DTEVT1.isthkk[i]==1001){
169 entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
172 printf("\n TDPMjet: DPMJET stack contains %d particles", numpart);
173 // printf("\n TDPMjet: Final not decayed particles: %d", numStabpart);
174 //printf("\n TDPMjet: Total energy: %f GeV \n", entot);
177 if(!strcmp(option,"") || !strcmp(option,"Final")){
178 for (Int_t i=0; i < numpart; i++) {
180 if (DTEVT1.isthkk[i] == 1) {
182 // Use the common block values for the TParticle constructor
184 new(Particles[nump]) TParticle(
204 else if(!strcmp(option,"All")){
206 for (Int_t i=0; i <= numpart; i++){
208 // DTEVT1.JMOHKK[i][0] pointer to the entry of the 1st mother of entry i
209 Int_t iParent = DTEVT1.jmohkk[i][0] - 1;
212 TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
213 mother->SetLastDaughter(i);
214 if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i);
216 // --- PDGcode for residual nuclei (idhkk=80000)
217 // --- 10000*Z + 10*A
218 // --- DPMJET -> idres = mass #, idxres = charge
219 if(DTEVT1.idhkk[i] == 80000)
220 DTEVT1.idhkk[i] = 10000*DTEVT2.idxres[i]+10*DTEVT2.idres[i];
222 if(DTEVT2.idxres[i] != 0)
223 printf("\n pc#%d -> A = %d, Z = %d -> PDGcode = %d\n",
224 i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]);
226 new(Particles[i]) TParticle(
249 //====================== access to dpmjet subroutines =========================
250 //______________________________________________________________________________
251 void TDPMjet::Initialize()
254 // Write standard DPMJET input cards
256 FILE* out = fopen("dpmjet.inp","w");
257 // Projectile and Target definition
258 if (fIp == 1 && fIpz ==1) {
259 fprintf(out, "PROJPAR PROTON\n");
260 } else if (fIp == 1 && fIpz == -1) {
261 fprintf(out, "PROJPAR APROTON\n");
263 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.);
266 if (fIt == 1 && fItz ==1) {
267 fprintf(out, "TARPAR PROTON\n");
268 } else if (fIt == 1 && fItz == -1) {
269 fprintf(out, "TARPAR APROTON\n");
271 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.);
274 // Beam energy and crossing-angle
275 fprintf(out, "BEAM %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.);
277 if (fIp > 1. && fIt > 1)
278 fprintf(out, "CENTRAL %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.);
281 fprintf(out, "PARDECAY %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.);
286 fprintf(out, "PHOINPUT\n");
287 fprintf(out, "DEBUG 0 0 0 \n");
289 if (fProcess == kDpmMb) {
290 fprintf(out, "PROCESS 1 0 1 1 1 1 1 1\n");
291 } else if (fProcess == kDpmMbNonDiffr) {
292 fprintf(out, "PROCESS 1 0 1 0 0 0 0 1\n");
293 } else if (fProcess == kDpmDiffr) {
294 fprintf(out, "PROCESS 0 0 0 1 1 1 1 0\n");
295 }else if (fProcess == kDpmSingleDiffr) {
296 fprintf(out, "PROCESS 0 0 0 0 1 1 0 0\n");
297 }else if (fProcess == kDpmDoubleDiffr) {
298 fprintf(out, "PROCESS 0 0 0 0 0 0 1 0\n");
299 } else if (fProcess == kDpmCentralDiffr){
300 fprintf(out, "PROCESS 0 0 0 1 0 0 0 0\n");
305 // K0s pi0 lam sig+ sig- tet0
306 310, 111, 3122, 3222, 3112, 3322,
307 // tet- om- D+ D0 Ds+
308 3312, 3334, 411, 421, 431,
309 // etac lamc+ sigc++ sigc+ sigc0 Ksic+
310 441, 4122, 4222, 4212, 4112, 4232,
316 Int_t iON = (fDecayAll) ? 1:0;
317 for (Int_t i = 0; i < 19; i++) {
318 fprintf(out, "LUND-DECAY%5d %5d\n", iPDG[i], iON);
321 fprintf(out, "LUND-MSTJ %5d %5d\n", 22, 1);
323 fprintf(out, "ENDINPUT\n");
326 fprintf(out, "START 1.0 0.0\n");
327 fprintf(out, "STOP\n");
332 // Call DPMJET initialisation
333 Int_t iemu = 0; // No emulsion (default)
334 Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
339 //______________________________________________________________________________
340 void TDPMjet::GenerateEvent()
342 // Generates one event;
344 DTEVNO.nevent=fNEvent;
348 Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
351 //______________________________________________________________________________
352 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
353 int ntmass, int ntchar, int idp, int iemu)
355 // Call dmpjet routine DT_DTUINI passing the parameters
356 // in a way accepted by Fortran routines
359 printf("\n-------------------------------------------\n");
360 printf("\n Dt_Dtuini called with:\n\n");
361 printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
362 printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar);
363 printf(" Proj. LAB E -> E = %f GeV \n",epn);
364 printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu);
365 printf("\n-------------------------------------------\n");
367 dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
371 //______________________________________________________________________________
372 void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
373 int idp, double elab, int kkmat, int irej)
375 // Call dmpjet routine DT_KKINC passing the parameters
376 // in a way accepted by Fortran routines
377 dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
380 //______________________________________________________________________________
381 void TDPMjet::Pho_Phist(int imode, double weight)
383 // Call dmpjet routine PHO_PHIST passing the parameters
384 // in a way accepted by Fortran routines
386 pho_phist(imode,weight);
390 //______________________________________________________________________________
391 void TDPMjet::Dt_Dtuout()
393 // Call dmpjet routine DT_DTUOT passing the parameters
394 // in a way accepted by Fortran routines
400 //______________________________________________________________________________
401 Int_t TDPMjet::GetEvNum() const
403 return DTEVT1.nevhkk;
405 //______________________________________________________________________________
406 Int_t TDPMjet::GetEntriesNum() const
410 //______________________________________________________________________________
411 Int_t TDPMjet::GetNumStablePc() const
413 Int_t NumStablePc = 0;
414 for(Int_t i=0; i<DTEVT1.nhkk; i++){
415 if(DTEVT1.isthkk[i] == 1) NumStablePc++;
420 //______________________________________________________________________________
421 Float_t TDPMjet::GetTotEnergy() const
423 Float_t TotEnergy = 0.;
424 for(Int_t i=0; i<DTEVT1.nhkk; i++){
425 if(DTEVT1.isthkk[i] == 1)
426 TotEnergy += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
431 //______________________________________________________________________________
432 Int_t TDPMjet::GetStatusCode(Int_t evnum) const
434 return DTEVT1.isthkk[evnum];
436 //______________________________________________________________________________
437 Int_t TDPMjet::GetPDGCode(Int_t evnum) const
439 return DTEVT1.idhkk[evnum];
441 //______________________________________________________________________________
442 Double_t TDPMjet::Getpx(Int_t evnum) const
444 return DTEVT1.phkk[evnum][0];
446 //______________________________________________________________________________
447 Double_t TDPMjet::Getpy(Int_t evnum) const
449 return DTEVT1.phkk[evnum][1];
451 //______________________________________________________________________________
452 Double_t TDPMjet::Getpz(Int_t evnum) const
454 return DTEVT1.phkk[evnum][2];
456 //______________________________________________________________________________
457 Double_t TDPMjet::GetEnergy(Int_t evnum) const
459 return DTEVT1.phkk[evnum][3];
461 //______________________________________________________________________________
462 Double_t TDPMjet::GetMass(Int_t evnum) const
464 return DTEVT1.phkk[evnum][4];
466 //______________________________________________________________________________
467 Int_t TDPMjet::GetFragmentA(Int_t evnum) const
469 return DTEVT2.idres[evnum];
471 //______________________________________________________________________________
472 Int_t TDPMjet::GetFragmentZ(Int_t evnum) const
474 return DTEVT2.idxres[evnum];
476 //______________________________________________________________________________
477 Double_t TDPMjet::GetXSFrac() const
479 return DTIMPA.xsfrac;
481 //______________________________________________________________________________
482 Double_t TDPMjet::GetBImpac() const
484 return DTGLCP.bimpac;
486 //______________________________________________________________________________
487 Double_t TDPMjet::GetProjRadius() const
491 //______________________________________________________________________________
492 Double_t TDPMjet::GetTargRadius() const
496 //______________________________________________________________________________
497 Int_t TDPMjet::GetProjWounded() const
499 return DTGLCP.nwasam;
501 //______________________________________________________________________________
502 Int_t TDPMjet::GetTargWounded() const
504 return DTGLCP.nwbsam;
506 //______________________________________________________________________________
507 Int_t TDPMjet::GetProjSpectators() const
509 return DTGLCP.nwtaac;
511 //______________________________________________________________________________
512 Int_t TDPMjet::GetTargSpectators() const
514 return DTGLCP.nwtbac;
516 //______________________________________________________________________________
517 Int_t TDPMjet::GetProcessCode() const
519 return POPRCS.iproce;
521 //______________________________________________________________________________
522 void TDPMjet::Dt_Rndm(int idummy)
527 //______________________________________________________________________________
528 void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1)
530 dt_rndmst(na1, na2, na3, nb1);
533 //______________________________________________________________________________
534 void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j)
536 dt_rndmin(u, c, cd, cm, i, j);
539 //______________________________________________________________________________
540 void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
542 dt_rndmou(u, c, cd, cm, i, j);