]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TDPMjet/TDPMjet.cxx
In AliMUONClusterInfo:
[u/mrichter/AliRoot.git] / TDPMjet / TDPMjet.cxx
index b96eb5489461b0264537a8cdd91ee3b249104e32..a0ea803ad2aa6a05492d36baf6f075ce7592d855 100644 (file)
@@ -39,8 +39,9 @@
 #include "TDPMjet.h"
 //*KEEP,DPMCOMMON.
 #include "DPMcommon.h"
-//*KEEP,TParticle,T=C++.
+//*KEEP,TParticle,T=C++
 #include "TParticle.h"
+#include "TClonesArray.h"
 //*KEND.
 
 //*KEEP,TROOT.
@@ -57,6 +58,7 @@
 # define dt_rndmst dt_rndmst_
 # define dt_rndmin dt_rndmin_
 # define dt_rndmou dt_rndmou_
+# define dpmjet_openinp dpmjet_openinp_
 # define type_of_call
 #else
 # define dt_dtuini DT_DTUINI
@@ -68,6 +70,7 @@
 # define dt_rndmst DT_RNDMST
 # define dt_rndmin DT_RNDMIN
 # define dt_rndmou DT_RNDMOU
+# define dpmjet_openinp DPMJET_OPENINP
 # define type_of_call _stdcall
 #endif
 
@@ -83,6 +86,7 @@ extern "C" void   type_of_call dt_rndm(Int_t &);
 extern "C" void   type_of_call dt_rndmst(Int_t &, Int_t &, Int_t &, Int_t &);
 extern "C" void   type_of_call dt_rndmin(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
 extern "C" void   type_of_call dt_rndmou(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &);
+extern "C" void   type_of_call dpmjet_openinp();
 
 #else
 
@@ -90,25 +94,50 @@ extern "C" void   type_of_call dt_rndmou(Int_t &, Int_t &, Int_t &, Int_t &, Int
 
 ClassImp(TDPMjet)
 
-//______________________________________________________________________________
-TDPMjet::TDPMjet() : TGenerator("dpmjet","dpmjet")
-{
-
-}
 
 //______________________________________________________________________________
-TDPMjet::TDPMjet(Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82, 
-       Double_t Epn=2700., Double_t CMEn=5400.) 
-       : TGenerator("dpmjet","dpmjet")
+    TDPMjet::TDPMjet() : 
+       TGenerator("dpmjet","dpmjet"),
+       fNEvent(0),
+       fIp(0),
+       fIpz(0),
+       fIt(0),
+       fItz(0),
+       fEpn(0.),
+       fPpn(0.),
+       fCMEn(0.),
+       fIdp(0),
+       fBmin(0.),
+       fBmax(0.),
+       fFCentr(0),
+       fPi0Decay(0),
+       fDecayAll(0),
+       fProcess(kDpmMb)
+{
+// Default Constructor
+}
+
+//______________________________________________________________________________
+TDPMjet::TDPMjet(DpmProcess_t  iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208, Int_t Itz=82, 
+                Double_t Epn=2700., Double_t CMEn=5400.) 
+    : TGenerator("dpmjet","dpmjet"),
+      fNEvent(0),
+      fIp(Ip),
+      fIpz(Ipz),
+      fIt(It),
+      fItz(Itz),
+      fEpn(Epn),
+      fPpn(0.),
+      fCMEn(CMEn),
+      fIdp(0),
+      fBmin(0.),
+      fBmax(0.),
+      fFCentr(0),
+      fPi0Decay(0),
+      fDecayAll(0),
+      fProcess(iproc)
 {  
-   fNEvent = 0;
-   fIp     = Ip;
-   fIpz    = Ipz;
-   fIt     = It;
-   fItz    = Itz;
-   fEpn    = Epn;
-   fCMEn   = CMEn;
-   fIdp    = 0;
+    printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
 }
 
 
@@ -141,8 +170,8 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
      } 
   }
   printf("\n TDPMjet: DPMJET stack contains %d particles", numpart);
-  printf("\n TDPMjet: Final not decayed particles: %d", numStabpart);
-  printf("\n TDPMjet: Total energy: %f GeV          \n", entot);
+  // printf("\n TDPMjet: Final not decayed particles: %d",    numStabpart);
+  //printf("\n TDPMjet: Total energy: %f GeV          \n",   entot);
   Int_t nump = 0;
   
   if(!strcmp(option,"") || !strcmp(option,"Final")){
@@ -152,7 +181,6 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
           //
           //  Use the common block values for the TParticle constructor
           //
-          //printf("   DTEVT1.isthkk[i]=1 -> i = %d, nump = %d\n",i,nump);
              new(Particles[nump]) TParticle(
                  DTEVT1.idhkk[i],
                  DTEVT1.isthkk[i],
@@ -182,9 +210,6 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
             
          if(iParent >= 0){
              TParticle *mother = (TParticle*) (Particles.UncheckedAt(iParent));
-              //printf("       i = %d, iParent = %d ", i, iParent);
-             //mother->Print();
-             //printf("\n");
              mother->SetLastDaughter(i);
              if(mother->GetFirstDaughter() == -1) mother->SetFirstDaughter(i);
          } 
@@ -193,10 +218,11 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
          // --- DPMJET -> idres = mass #, idxres = charge
          if(DTEVT1.idhkk[i] == 80000) 
              DTEVT1.idhkk[i] = 10000*DTEVT2.idxres[i]+10*DTEVT2.idres[i];
+/*
          if(DTEVT2.idxres[i] != 0) 
              printf("\n        pc#%d -> A = %d, Z = %d -> PDGcode = %d\n",
                     i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]);
-         
+*/       
          new(Particles[i]) TParticle(
              DTEVT1.idhkk[i],
              DTEVT1.isthkk[i],
@@ -224,20 +250,88 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
 //______________________________________________________________________________
 void TDPMjet::Initialize()
 {
-//********************************************************************************
-//*Calls DT_DTUINI with the either default parameters or the ones set by the user*
-//********************************************************************************
+//
+//  Write standard DPMJET input cards 
+//
+    FILE* out = fopen("dpmjet.inp","w");
+//  Projectile and Target definition 
+    if (fIp == 1 && fIpz ==1) {
+       fprintf(out, "PROJPAR                                                               PROTON\n");
+    } else if (fIp == 1 && fIpz == -1) {
+       fprintf(out, "PROJPAR                                                               APROTON\n");
+    } else {
+       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.);
+    }
+    
+    if (fIt == 1 && fItz ==1) {
+       fprintf(out, "TARPAR                                                                PROTON\n");
+    } else if (fIt == 1 && fItz == -1) {
+       fprintf(out, "TARPAR                                                                APROTON\n");
+    } else {
+       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.);
+    }
+
+//  Beam energy and crossing-angle
+    fprintf(out, "BEAM      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.);
+//  Centrality
+    if (fIp > 1. && fIt > 1) 
+       fprintf(out, "CENTRAL   %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.);
+//  Particle decays
+    if (fPi0Decay) 
+       fprintf(out, "PARDECAY  %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.);    
 
-//   printf("\n-------------------------------------------\n");
-//   printf("\n                TDPMjet initialized with:\n\n");
-//   printf(" Projectile       -> A = %d, Z = %d \n",fIp, fIpz);
-//   printf(" Target           -> A = %d, Z = %d \n",fIt, fItz);
-//   printf(" Proj. LAB E      -> E = %f GeV \n",fEpn);
-//   printf(" CM energy        -> Ecm = %f GeV \n",fCMEn);
-//   printf("\n-------------------------------------------\n");
+    
+//
+//  PHOJET specific
+    fprintf(out, "PHOINPUT\n");
+    fprintf(out, "DEBUG      0 0 0 \n");
+
+    if (fProcess == kDpmMb) {
+       fprintf(out, "PROCESS           1 0 1 1 1 1 1 1\n");
+    } else if (fProcess == kDpmMbNonDiffr) {
+       fprintf(out, "PROCESS           1 0 1 0 0 0 0 1\n");
+    } else if (fProcess == kDpmDiffr) {
+       fprintf(out, "PROCESS           0 0 0 1 1 1 1 0\n");
+    }else if (fProcess == kDpmSingleDiffr) {
+        fprintf(out, "PROCESS           0 0 0 0 1 1 0 0\n");
+    }else if (fProcess == kDpmDoubleDiffr) {
+        fprintf(out, "PROCESS           0 0 0 0 0 0 1 0\n");
+    } else if (fProcess == kDpmCentralDiffr){
+        fprintf(out, "PROCESS           0 0 0 1 0 0 0 0\n");
+    }
+    
+    Int_t iPDG[19] = 
+       {
+//          K0s   pi0  lam   sig+  sig-  tet0
+       310,  111, 3122, 3222, 3112, 3322,
+//          tet- om-    D+      D0     Ds+
+       3312, 3334,  411,  421,  431,
+//          etac lamc+ sigc++ sigc+ sigc0 Ksic+
+        441, 4122, 4222, 4212, 4112, 4232,
+//         Ksic0 sig0 
+       4132, 3212
+       };
+    
+    
+    Int_t iON = (fDecayAll) ? 1:0;
+    for (Int_t i = 0; i < 19; i++) {
+       fprintf(out, "LUND-DECAY%5d %5d\n",  iPDG[i], iON);    
+    }
+       
+    fprintf(out, "LUND-MSTJ %5d %5d\n",   22, 1);    
+
+    fprintf(out, "ENDINPUT\n");
+//
+//  START card
+    fprintf(out, "START            1.0       0.0\n");
+    fprintf(out, "STOP\n");
+    fclose(out);
+    dpmjet_openinp();
 
-   Int_t iemu = 0; // No emulsion (default)
-   Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
+//
+//  Call DPMJET initialisation
+    Int_t iemu = 0; // No emulsion (default)
+    Dt_Dtuini(1, fEpn, fIp, fIpz, fIt, fItz, fIdp, iemu);
 
 }
 
@@ -248,18 +342,11 @@ void TDPMjet::GenerateEvent()
    // Generates one event;
    fNEvent++;
    DTEVNO.nevent=fNEvent;
-   //printf("\n        fNEvent = %d\n",fNEvent);
    Int_t kkmat=-1;
    Float_t Elab = fEpn;
    Int_t irej=0;
    Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
    if(irej!=0) return;
-   //
-   Int_t imode=2000;
-   Double_t weight=1.;
-   Pho_Phist(imode, weight);
-   Dt_Dtuout();
-   
 }
 //______________________________________________________________________________
 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar, 
@@ -268,14 +355,14 @@ void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar,
   // Call dmpjet routine DT_DTUINI passing the parameters 
   // in a way accepted by Fortran routines                                
      
-   
-   /*printf("\n-------------------------------------------\n");
+
+   printf("\n-------------------------------------------\n");
    printf("\n          Dt_Dtuini called with:\n\n");
    printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
    printf(" Target     -> A = %d, Z = %d \n",ntmass, ntchar);
    printf(" Proj. LAB E        -> E = %f GeV \n",epn);
    printf(" nevts = %d, idp = %d, iemu = %d \n",nevts,idp,iemu);
-   printf("\n-------------------------------------------\n");*/
+   printf("\n-------------------------------------------\n");
 
    dt_dtuini(nevts, epn, npmass, npchar, ntmass, ntchar, idp, iemu);
     
@@ -287,17 +374,7 @@ void TDPMjet::Dt_Kkinc(int npmass, int npchar, int ntmass, int ntchar,
 {
   // Call dmpjet routine DT_KKINC passing the parameters 
   // in a way accepted by Fortran routines                                
-  
-   /*printf("\n-------------------------------------------\n");
-   printf("\n          Dt_Kkinc called with:\n\n");
-   printf(" Projectile -> A = %d, Z = %d \n",npmass, npchar);
-   printf(" Target     -> A = %d, Z = %d \n",ntmass, ntchar);
-   printf(" LAB Energy -> E = %f GeV \n",elab);
-   printf(" idp = %d,  kkmat = %d, irej = %d \n",idp,kkmat,irej);
-   printf("\n-------------------------------------------\n");*/
-
   dt_kkinc(npmass, npchar, ntmass, ntchar, idp, elab, kkmat, irej);
-
 }
 
 //______________________________________________________________________________
@@ -436,7 +513,11 @@ Int_t TDPMjet::GetTargSpectators() const
 {
        return DTGLCP.nwtbac;
 }
-
+//______________________________________________________________________________
+Int_t TDPMjet::GetProcessCode() const
+{
+               return POPRCS.iproce;
+}
 //______________________________________________________________________________
 void TDPMjet::Dt_Rndm(int idummy)
 {