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"
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_
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
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 &);
93 //______________________________________________________________________________
94 TDPMjet::TDPMjet() : TGenerator("dpmjet","dpmjet")
99 //______________________________________________________________________________
100 TDPMjet::TDPMjet(Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82,
101 Double_t Epn=2700., Double_t CMEn=5400.)
102 : TGenerator("dpmjet","dpmjet")
115 //______________________________________________________________________________
116 Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
119 // Default primary creation method. It reads the /HEPEVT/ common block which
120 // has been filled by the GenerateEvent method. If the event generator does
121 // not use the HEPEVT common block, This routine has to be overloaded by
123 // The function loops on the generated particles and store them in
124 // the TClonesArray pointed by the argument particles.
125 // The default action is to store only the stable particles
126 // This can be demanded explicitly by setting the option = "Final"
127 // If the option = "All", all the particles are stored.
129 if(particles==0) return 0;
130 TClonesArray &Particles = *particles;
132 Int_t numpart = 0; // Total number of produced particles
133 Int_t numStabpart = 0; // Total number of produced stable particles
134 Double_t entot = 0; // Total energy in final state (from stable particles)
136 numpart = DTEVT1.nhkk;
137 for(Int_t i=0; i<numpart; i++){
138 if(DTEVT1.isthkk[i]==1 || DTEVT1.isthkk[i]==-1 || DTEVT1.isthkk[i]==1001){
140 entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
143 printf("\n TDPMjet: DPMJET stack contains %d particles", numpart);
144 printf("\n TDPMjet: Final not decayed particles: %d", numStabpart);
145 printf("\n TDPMjet: Total energy: %f GeV \n", entot);
148 if(!strcmp(option,"") || !strcmp(option,"Final")){
149 for (Int_t i=0; i < numpart; i++) {
151 if (DTEVT1.isthkk[i] == 1) {
153 // Use the common block values for the TParticle constructor
155 //printf(" DTEVT1.isthkk[i]=1 -> i = %d, nump = %d\n",i,nump);
156 new(Particles[nump]) TParticle(
176 else if(!strcmp(option,"All")){
178 for (Int_t i=0; i <= numpart; i++){
180 // DTEVT1.JMOHKK[i][0] pointer to the entry of the 1st mother of entry i
181 Int_t iParent = DTEVT1.jmohkk[i][0] - 1;
184 TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
185 //printf(" i = %d, iParent = %d ", i, iParent);
188 mother->SetLastDaughter(i);
189 if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i);
191 // --- PDGcode for residual nuclei (idhkk=80000)
192 // --- 10000*Z + 10*A
193 // --- DPMJET -> idres = mass #, idxres = charge
194 if(DTEVT1.idhkk[i] == 80000)
195 DTEVT1.idhkk[i] = 10000*DTEVT2.idxres[i]+10*DTEVT2.idres[i];
196 if(DTEVT2.idxres[i] != 0)
197 printf("\n pc#%d -> A = %d, Z = %d -> PDGcode = %d\n",
198 i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]);
200 new(Particles[i]) TParticle(
223 //====================== access to dpmjet subroutines =========================
224 //______________________________________________________________________________
225 void TDPMjet::Initialize()
227 //********************************************************************************
228 //*Calls DT_DTUINI with the either default parameters or the ones set by the user*
229 //********************************************************************************
231 // printf("\n-------------------------------------------\n");
232 // printf("\n TDPMjet initialized with:\n\n");
233 // printf(" Projectile -> A = %d, Z = %d \n",fIp, fIpz);
234 // printf(" Target -> A = %d, Z = %d \n",fIt, fItz);
235 // printf(" Proj. LAB E -> E = %f GeV \n",fEpn);
236 // printf(" CM energy -> Ecm = %f GeV \n",fCMEn);
237 // printf("\n-------------------------------------------\n");
239 Int_t iemu = 0; // No emulsion (default)
240 Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
245 //______________________________________________________________________________
246 void TDPMjet::GenerateEvent()
248 // Generates one event;
250 DTEVNO.nevent=fNEvent;
251 //printf("\n fNEvent = %d\n",fNEvent);
255 Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
260 Pho_Phist(imode, weight);
264 //______________________________________________________________________________
265 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
266 int ntmass, int ntchar, int idp, int iemu)
268 // Call dmpjet routine DT_DTUINI passing the parameters
269 // in a way accepted by Fortran routines
272 /*printf("\n-------------------------------------------\n");
273 printf("\n Dt_Dtuini called with:\n\n");
274 printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
275 printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar);
276 printf(" Proj. LAB E -> E = %f GeV \n",epn);
277 printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu);
278 printf("\n-------------------------------------------\n");*/
280 dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
284 //______________________________________________________________________________
285 void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
286 int idp, double elab, int kkmat, int irej)
288 // Call dmpjet routine DT_KKINC passing the parameters
289 // in a way accepted by Fortran routines
291 /*printf("\n-------------------------------------------\n");
292 printf("\n Dt_Kkinc called with:\n\n");
293 printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
294 printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar);
295 printf(" LAB Energy -> E = %f GeV \n",elab);
296 printf(" idp = %d, kkmat = %d, irej = %d \n",idp,kkmat,irej);
297 printf("\n-------------------------------------------\n");*/
299 dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
303 //______________________________________________________________________________
304 void TDPMjet::Pho_Phist(int imode, double weight)
306 // Call dmpjet routine PHO_PHIST passing the parameters
307 // in a way accepted by Fortran routines
309 pho_phist(imode,weight);
313 //______________________________________________________________________________
314 void TDPMjet::Dt_Dtuout()
316 // Call dmpjet routine DT_DTUOT passing the parameters
317 // in a way accepted by Fortran routines
323 //______________________________________________________________________________
324 Int_t TDPMjet::GetEvNum() const
326 return DTEVT1.nevhkk;
328 //______________________________________________________________________________
329 Int_t TDPMjet::GetEntriesNum() const
333 //______________________________________________________________________________
334 Int_t TDPMjet::GetNumStablePc() const
336 Int_t NumStablePc = 0;
337 for(Int_t i=0; i<DTEVT1.nhkk; i++){
338 if(DTEVT1.isthkk[i] == 1) NumStablePc++;
343 //______________________________________________________________________________
344 Float_t TDPMjet::GetTotEnergy() const
346 Float_t TotEnergy = 0.;
347 for(Int_t i=0; i<DTEVT1.nhkk; i++){
348 if(DTEVT1.isthkk[i] == 1)
349 TotEnergy += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
354 //______________________________________________________________________________
355 Int_t TDPMjet::GetStatusCode(Int_t evnum) const
357 return DTEVT1.isthkk[evnum];
359 //______________________________________________________________________________
360 Int_t TDPMjet::GetPDGCode(Int_t evnum) const
362 return DTEVT1.idhkk[evnum];
364 //______________________________________________________________________________
365 Double_t TDPMjet::Getpx(Int_t evnum) const
367 return DTEVT1.phkk[evnum][0];
369 //______________________________________________________________________________
370 Double_t TDPMjet::Getpy(Int_t evnum) const
372 return DTEVT1.phkk[evnum][1];
374 //______________________________________________________________________________
375 Double_t TDPMjet::Getpz(Int_t evnum) const
377 return DTEVT1.phkk[evnum][2];
379 //______________________________________________________________________________
380 Double_t TDPMjet::GetEnergy(Int_t evnum) const
382 return DTEVT1.phkk[evnum][3];
384 //______________________________________________________________________________
385 Double_t TDPMjet::GetMass(Int_t evnum) const
387 return DTEVT1.phkk[evnum][4];
389 //______________________________________________________________________________
390 Int_t TDPMjet::GetFragmentA(Int_t evnum) const
392 return DTEVT2.idres[evnum];
394 //______________________________________________________________________________
395 Int_t TDPMjet::GetFragmentZ(Int_t evnum) const
397 return DTEVT2.idxres[evnum];
399 //______________________________________________________________________________
400 Double_t TDPMjet::GetXSFrac() const
402 return DTIMPA.xsfrac;
404 //______________________________________________________________________________
405 Double_t TDPMjet::GetBImpac() const
407 return DTGLCP.bimpac;
409 //______________________________________________________________________________
410 Double_t TDPMjet::GetProjRadius() const
414 //______________________________________________________________________________
415 Double_t TDPMjet::GetTargRadius() const
419 //______________________________________________________________________________
420 Int_t TDPMjet::GetProjWounded() const
422 return DTGLCP.nwasam;
424 //______________________________________________________________________________
425 Int_t TDPMjet::GetTargWounded() const
427 return DTGLCP.nwbsam;
429 //______________________________________________________________________________
430 Int_t TDPMjet::GetProjSpectators() const
432 return DTGLCP.nwtaac;
434 //______________________________________________________________________________
435 Int_t TDPMjet::GetTargSpectators() const
437 return DTGLCP.nwtbac;
440 //______________________________________________________________________________
441 void TDPMjet::Dt_Rndm(int idummy)
446 //______________________________________________________________________________
447 void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1)
449 dt_rndmst(na1, na2, na3, nb1);
452 //______________________________________________________________________________
453 void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j)
455 dt_rndmin(u, c, cd, cm, i, j);
458 //______________________________________________________________________________
459 void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
461 dt_rndmou(u, c, cd, cm, i, j);