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");
271 fprintf(out, "ENDINPUT\n");
274 fprintf(out, "START 1.0 0.0\n");
275 fprintf(out, "STOP\n");
278 // Call DPMJET initialisation
279 Int_t iemu = 0; // No emulsion (default)
280 Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
285 //______________________________________________________________________________
286 void TDPMjet::GenerateEvent()
288 // Generates one event;
290 DTEVNO.nevent=fNEvent;
294 Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
297 //______________________________________________________________________________
298 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
299 int ntmass, int ntchar, int idp, int iemu)
301 // Call dmpjet routine DT_DTUINI passing the parameters
302 // in a way accepted by Fortran routines
305 printf("\n-------------------------------------------\n");
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);
311 printf("\n-------------------------------------------\n");
313 dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
317 //______________________________________________________________________________
318 void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
319 int idp, double elab, int kkmat, int irej)
321 // Call dmpjet routine DT_KKINC passing the parameters
322 // in a way accepted by Fortran routines
323 dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
326 //______________________________________________________________________________
327 void TDPMjet::Pho_Phist(int imode, double weight)
329 // Call dmpjet routine PHO_PHIST passing the parameters
330 // in a way accepted by Fortran routines
332 pho_phist(imode,weight);
336 //______________________________________________________________________________
337 void TDPMjet::Dt_Dtuout()
339 // Call dmpjet routine DT_DTUOT passing the parameters
340 // in a way accepted by Fortran routines
346 //______________________________________________________________________________
347 Int_t TDPMjet::GetEvNum() const
349 return DTEVT1.nevhkk;
351 //______________________________________________________________________________
352 Int_t TDPMjet::GetEntriesNum() const
356 //______________________________________________________________________________
357 Int_t TDPMjet::GetNumStablePc() const
359 Int_t NumStablePc = 0;
360 for(Int_t i=0; i<DTEVT1.nhkk; i++){
361 if(DTEVT1.isthkk[i] == 1) NumStablePc++;
366 //______________________________________________________________________________
367 Float_t TDPMjet::GetTotEnergy() const
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)
377 //______________________________________________________________________________
378 Int_t TDPMjet::GetStatusCode(Int_t evnum) const
380 return DTEVT1.isthkk[evnum];
382 //______________________________________________________________________________
383 Int_t TDPMjet::GetPDGCode(Int_t evnum) const
385 return DTEVT1.idhkk[evnum];
387 //______________________________________________________________________________
388 Double_t TDPMjet::Getpx(Int_t evnum) const
390 return DTEVT1.phkk[evnum][0];
392 //______________________________________________________________________________
393 Double_t TDPMjet::Getpy(Int_t evnum) const
395 return DTEVT1.phkk[evnum][1];
397 //______________________________________________________________________________
398 Double_t TDPMjet::Getpz(Int_t evnum) const
400 return DTEVT1.phkk[evnum][2];
402 //______________________________________________________________________________
403 Double_t TDPMjet::GetEnergy(Int_t evnum) const
405 return DTEVT1.phkk[evnum][3];
407 //______________________________________________________________________________
408 Double_t TDPMjet::GetMass(Int_t evnum) const
410 return DTEVT1.phkk[evnum][4];
412 //______________________________________________________________________________
413 Int_t TDPMjet::GetFragmentA(Int_t evnum) const
415 return DTEVT2.idres[evnum];
417 //______________________________________________________________________________
418 Int_t TDPMjet::GetFragmentZ(Int_t evnum) const
420 return DTEVT2.idxres[evnum];
422 //______________________________________________________________________________
423 Double_t TDPMjet::GetXSFrac() const
425 return DTIMPA.xsfrac;
427 //______________________________________________________________________________
428 Double_t TDPMjet::GetBImpac() const
430 return DTGLCP.bimpac;
432 //______________________________________________________________________________
433 Double_t TDPMjet::GetProjRadius() const
437 //______________________________________________________________________________
438 Double_t TDPMjet::GetTargRadius() const
442 //______________________________________________________________________________
443 Int_t TDPMjet::GetProjWounded() const
445 return DTGLCP.nwasam;
447 //______________________________________________________________________________
448 Int_t TDPMjet::GetTargWounded() const
450 return DTGLCP.nwbsam;
452 //______________________________________________________________________________
453 Int_t TDPMjet::GetProjSpectators() const
455 return DTGLCP.nwtaac;
457 //______________________________________________________________________________
458 Int_t TDPMjet::GetTargSpectators() const
460 return DTGLCP.nwtbac;
463 //______________________________________________________________________________
464 void TDPMjet::Dt_Rndm(int idummy)
469 //______________________________________________________________________________
470 void TDPMjet::Dt_Rndmst(int na1, int na2, int na3, int nb1)
472 dt_rndmst(na1, na2, na3, nb1);
475 //______________________________________________________________________________
476 void TDPMjet::Dt_Rndmin(int u, int c, int cd, int cm, int i, int j)
478 dt_rndmin(u, c, cd, cm, i, j);
481 //______________________________________________________________________________
482 void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
484 dt_rndmou(u, c, cd, cm, i, j);