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 &);
94 //______________________________________________________________________________
96 TGenerator("dpmjet","dpmjet"),
112 // Default Constructor
115 //______________________________________________________________________________
116 TDPMjet::TDPMjet(DpmProcess_t iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82,
117 Double_t Epn=2700., Double_t CMEn=5400.)
118 : TGenerator("dpmjet","dpmjet"),
133 printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
137 //______________________________________________________________________________
138 Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
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
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.
151 if(particles==0) return 0;
152 TClonesArray &Particles = *particles;
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)
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){
162 entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
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);
170 if(!strcmp(option,"") || !strcmp(option,"Final")){
171 for (Int_t i=0; i < numpart; i++) {
173 if (DTEVT1.isthkk[i] == 1) {
175 // Use the common block values for the TParticle constructor
177 new(Particles[nump]) TParticle(
197 else if(!strcmp(option,"All")){
199 for (Int_t i=0; i <= numpart; i++){
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;
205 TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
206 mother->SetLastDaughter(i);
207 if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i);
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];
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]);
219 new(Particles[i]) TParticle(
242 //====================== access to dpmjet subroutines =========================
243 //______________________________________________________________________________
244 void TDPMjet::Initialize()
247 // Write standard DPMJET input cards
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.);
256 fprintf(out, "CENTRAL %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.);
259 fprintf(out, "PARDECAY %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.);
262 fprintf(out, "PHOINPUT\n");
263 fprintf(out, "DEBUG 0 0 0 \n");
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 } else if (fProcess == kDpmDiffr) {
270 fprintf(out, "PROCESS 0 0 0 0 1 1 1 0\n");
271 }else if (fProcess == kDpmSingleDiffr) {
272 fprintf(out, "PROCESS 0 0 0 0 1 1 0 0\n");
273 }else if (fProcess == kDpmDoubleDiffr) {
274 fprintf(out, "PROCESS 0 0 0 0 0 0 1 0\n");
277 fprintf(out, "ENDINPUT\n");
280 fprintf(out, "START 1.0 0.0\n");
281 fprintf(out, "STOP\n");
284 // Call DPMJET initialisation
285 Int_t iemu = 0; // No emulsion (default)
286 Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
291 //______________________________________________________________________________
292 void TDPMjet::GenerateEvent()
294 // Generates one event;
296 DTEVNO.nevent=fNEvent;
300 Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
303 //______________________________________________________________________________
304 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
305 int ntmass, int ntchar, int idp, int iemu)
307 // Call dmpjet routine DT_DTUINI passing the parameters
308 // in a way accepted by Fortran routines
311 printf("\n-------------------------------------------\n");
312 printf("\n Dt_Dtuini called with:\n\n");
313 printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
314 printf(" Target -> A = %d, Z = %d \n",ntmass, ntchar);
315 printf(" Proj. LAB E -> E = %f GeV \n",epn);
316 printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu);
317 printf("\n-------------------------------------------\n");
319 dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
323 //______________________________________________________________________________
324 void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
325 int idp, double elab, int kkmat, int irej)
327 // Call dmpjet routine DT_KKINC passing the parameters
328 // in a way accepted by Fortran routines
329 dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
332 //______________________________________________________________________________
333 void TDPMjet::Pho_Phist(int imode, double weight)
335 // Call dmpjet routine PHO_PHIST passing the parameters
336 // in a way accepted by Fortran routines
338 pho_phist(imode,weight);
342 //______________________________________________________________________________
343 void TDPMjet::Dt_Dtuout()
345 // Call dmpjet routine DT_DTUOT passing the parameters
346 // in a way accepted by Fortran routines
352 //______________________________________________________________________________
353 Int_t TDPMjet::GetEvNum() const
355 return DTEVT1.nevhkk;
357 //______________________________________________________________________________
358 Int_t TDPMjet::GetEntriesNum() const
362 //______________________________________________________________________________
363 Int_t TDPMjet::GetNumStablePc() const
365 Int_t NumStablePc = 0;
366 for(Int_t i=0; i<DTEVT1.nhkk; i++){
367 if(DTEVT1.isthkk[i] == 1) NumStablePc++;
372 //______________________________________________________________________________
373 Float_t TDPMjet::GetTotEnergy() const
375 Float_t TotEnergy = 0.;
376 for(Int_t i=0; i<DTEVT1.nhkk; i++){
377 if(DTEVT1.isthkk[i] == 1)
378 TotEnergy += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
383 //______________________________________________________________________________
384 Int_t TDPMjet::GetStatusCode(Int_t evnum) const
386 return DTEVT1.isthkk[evnum];
388 //______________________________________________________________________________
389 Int_t TDPMjet::GetPDGCode(Int_t evnum) const
391 return DTEVT1.idhkk[evnum];
393 //______________________________________________________________________________
394 Double_t TDPMjet::Getpx(Int_t evnum) const
396 return DTEVT1.phkk[evnum][0];
398 //______________________________________________________________________________
399 Double_t TDPMjet::Getpy(Int_t evnum) const
401 return DTEVT1.phkk[evnum][1];
403 //______________________________________________________________________________
404 Double_t TDPMjet::Getpz(Int_t evnum) const
406 return DTEVT1.phkk[evnum][2];
408 //______________________________________________________________________________
409 Double_t TDPMjet::GetEnergy(Int_t evnum) const
411 return DTEVT1.phkk[evnum][3];
413 //______________________________________________________________________________
414 Double_t TDPMjet::GetMass(Int_t evnum) const
416 return DTEVT1.phkk[evnum][4];
418 //______________________________________________________________________________
419 Int_t TDPMjet::GetFragmentA(Int_t evnum) const
421 return DTEVT2.idres[evnum];
423 //______________________________________________________________________________
424 Int_t TDPMjet::GetFragmentZ(Int_t evnum) const
426 return DTEVT2.idxres[evnum];
428 //______________________________________________________________________________
429 Double_t TDPMjet::GetXSFrac() const
431 return DTIMPA.xsfrac;
433 //______________________________________________________________________________
434 Double_t TDPMjet::GetBImpac() const
436 return DTGLCP.bimpac;
438 //______________________________________________________________________________
439 Double_t TDPMjet::GetProjRadius() const
443 //______________________________________________________________________________
444 Double_t TDPMjet::GetTargRadius() const
448 //______________________________________________________________________________
449 Int_t TDPMjet::GetProjWounded() const
451 return DTGLCP.nwasam;
453 //______________________________________________________________________________
454 Int_t TDPMjet::GetTargWounded() const
456 return DTGLCP.nwbsam;
458 //______________________________________________________________________________
459 Int_t TDPMjet::GetProjSpectators() const
461 return DTGLCP.nwtaac;
463 //______________________________________________________________________________
464 Int_t TDPMjet::GetTargSpectators() const
466 return DTGLCP.nwtbac;
468 //______________________________________________________________________________
469 Int_t TDPMjet::GetProcessCode() const
471 return POPRCS.iproce;
473 //______________________________________________________________________________
474 void TDPMjet::Dt_Rndm(int idummy)
479 //______________________________________________________________________________
480 void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1)
482 dt_rndmst(na1, na2, na3, nb1);
485 //______________________________________________________________________________
486 void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j)
488 dt_rndmin(u, c, cd, cm, i, j);
491 //______________________________________________________________________________
492 void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
494 dt_rndmou(u, c, cd, cm, i, j);