]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TDPMjet/TDPMjet.cxx
Adding Domenico Colella as responsible for SPD part in TRI pp
[u/mrichter/AliRoot.git] / TDPMjet / TDPMjet.cxx
index 5fc49427dd1a20f68f2faa06bfabaec7a29e20dd..536e15bcff7ebe302e52b829903f25ff6f3b83a3 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,8 @@
 # define dt_rndmst dt_rndmst_
 # define dt_rndmin dt_rndmin_
 # define dt_rndmou dt_rndmou_
+# define dpmjet_openinp dpmjet_openinp_
+# define dt_evtout dt_evtout_
 # define type_of_call
 #else
 # define dt_dtuini DT_DTUINI
 # define dt_rndmst DT_RNDMST
 # define dt_rndmin DT_RNDMIN
 # define dt_rndmou DT_RNDMOU
+# define dt_evtout DT_EVTOUT_
+# define dpmjet_openinp DPMJET_OPENINP
 # define type_of_call _stdcall
 #endif
 
+
 #ifndef WIN32
 extern "C" void   type_of_call dt_dtuini(Int_t & , Double_t &, Int_t & , Int_t &, 
                        Int_t &, Int_t &, Int_t &, Int_t &);
@@ -79,10 +85,12 @@ extern "C" void   type_of_call dt_kkinc(Int_t &, Int_t &, Int_t &, Int_t &,
                                    Int_t &, Double_t &, Int_t &, Int_t &);
 extern "C" void   type_of_call pho_phist(Int_t &, Double_t &);
 extern "C" void   type_of_call dt_dtuout();
+extern "C" int    type_of_call dt_evtout(const Int_t &);
 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
 
@@ -107,7 +115,9 @@ ClassImp(TDPMjet)
        fBmax(0.),
        fFCentr(0),
        fPi0Decay(0),
-       fProcess(kDpmMb)
+       fDecayAll(0),
+       fProcess(kDpmMb),
+       fFragmentation(kFALSE)
 {
 // Default Constructor
 }
@@ -122,13 +132,16 @@ TDPMjet::TDPMjet(DpmProcess_t  iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208,
       fIt(It),
       fItz(Itz),
       fEpn(Epn),
+      fPpn(0.),
       fCMEn(CMEn),
       fIdp(0),
       fBmin(0.),
       fBmax(0.),
       fFCentr(0),
       fPi0Decay(0),
-      fProcess(iproc)
+      fDecayAll(0),
+      fProcess(iproc),
+      fFragmentation(kFALSE)
 {  
     printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
 }
@@ -162,9 +175,6 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
        entot += DTEVT1.phkk[i][3]; // PHKK[i][3] <-> PHKK(4,i)
      } 
   }
-  //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);
   Int_t nump = 0;
   
   if(!strcmp(option,"") || !strcmp(option,"Final")){
@@ -216,6 +226,17 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
              printf("\n        pc#%d -> A = %d, Z = %d -> PDGcode = %d\n",
                     i,DTEVT2.idres[i],DTEVT2.idxres[i],DTEVT1.idhkk[i]);
 */       
+/*
+         printf("%5d %5d %5d %5d %13.3f %13.3f %13.3f %13.3f \n", i,
+                DTEVT1.idhkk[i],
+                DTEVT1.isthkk[i],
+                iParent,  
+                DTEVT1.phkk[i][0],
+                DTEVT1.phkk[i][1],
+                DTEVT1.phkk[i][2],
+                DTEVT1.phkk[i][3]
+                );
+*/
          new(Particles[i]) TParticle(
              DTEVT1.idhkk[i],
              DTEVT1.isthkk[i],
@@ -236,6 +257,7 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
       } // Particle loop  
   }
   return nump;
+  
 }
 
 
@@ -246,17 +268,52 @@ void TDPMjet::Initialize()
 //
 //  Write standard DPMJET input cards 
 //
+    if(fFragmentation) printf("\tTDPMJet fragmentation/evaporation applied\n");
+
     FILE* out = fopen("dpmjet.inp","w");
 //  Projectile and Target definition 
-    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.);
-    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.);
+    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.);
+    fprintf(out, "CMENERGY      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fCMEn, 0., 0., 0., 0., 0.);      
+    if(fIt == 1 && fIp ==1){ 
+      fprintf(out, "BEAM      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.); //p-p
+    }
+    else if(fIp > 1 || fIt > 1){ 
+      if(fIp>1 && fIt>1) fprintf(out, "BEAM      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",fEpn, fEpn, 0., 0., 0., 0.);//A-A
+      else if(fIp==1 && fIt>1){ // proton towards A side (directed z>0)
+        fprintf(out, "BEAM      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", fEpn,fEpn*fItz/fIt, 0., 0., 0., 0.);//pA
+       printf("\n  TDPMjet::Initialize() -> p-A: projectile (p) energy =  %10.1f, CMS energy = %10.1f\n\n",fEpn,fCMEn);
+      }
+      else if(fIt==1 && fIp>1){ // proton towards C side (directed z<0)
+        fprintf(out, "BEAM      %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", fEpn, fEpn*fIp/fIpz, 0., 0., 0., 0.);//A-p
+       printf("\n  TDPMjet::Initialize() -> A-p: projectile (A) energy =  %10.1f, CMS energy = %10.1f\n\n",fEpn,fCMEn);
+      }
+    }
 //  Centrality
-    fprintf(out, "CENTRAL   %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-1., fBmin, fBmax, 0., 0., 0.);
+    if((fIp > 1 || fIt > 1) && fFragmentation)
+       fprintf(out, "CENTRAL   %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n",-2., fBmin, fBmax, 0., 0., 0.);
+    else if((fIp > 1 || fIt > 1) && !fFragmentation)
+       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.);    
+       fprintf(out, "PARDECAY  %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", 2., 0., 0., 0., 0., 0.);    
+
+    
 //
 //  PHOJET specific
     fprintf(out, "PHOINPUT\n");
@@ -265,21 +322,45 @@ void TDPMjet::Initialize()
     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 1 0 0 0 1\n");
+       fprintf(out, "PROCESS           1 0 1 0 0 0 0 1\n");
     } else if (fProcess == kDpmDiffr) {
-       fprintf(out, "PROCESS           0 0 0 0 1 1 1 0\n");
+       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[18] = 
+       {
+//          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
+       };
+    
+    
+    Int_t iON = (fDecayAll) ? 1:0;
+    for (Int_t i = 0; i < 8; 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();
+
 //
 //  Call DPMJET initialisation
     Int_t iemu = 0; // No emulsion (default)
@@ -298,7 +379,6 @@ void TDPMjet::GenerateEvent()
    Float_t Elab = fEpn;
    Int_t irej=0;
    Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
-   if(irej!=0) return;
 }
 //______________________________________________________________________________
 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar, 
@@ -455,17 +535,22 @@ Int_t TDPMjet::GetTargWounded() const
 {
        return DTGLCP.nwbsam;
 }
+
 //______________________________________________________________________________
-Int_t TDPMjet::GetProjSpectators() const
+Int_t TDPMjet::GetProjParticipants() const
 {
        return DTGLCP.nwtaac;
 }
 //______________________________________________________________________________
-Int_t TDPMjet::GetTargSpectators() const
+Int_t TDPMjet::GetTargParticipants() const
 {
        return DTGLCP.nwtbac;
 }
-
+//______________________________________________________________________________
+Int_t TDPMjet::GetProcessCode() const
+{
+               return POPRCS.iproce;
+}
 //______________________________________________________________________________
 void TDPMjet::Dt_Rndm(int idummy)
 {
@@ -490,3 +575,9 @@ void TDPMjet::Dt_Rndmou(int u, int c, int cd, int cm, int i, int j)
        dt_rndmou(u, c, cd, cm, i, j);
 }
 
+
+Int_t TDPMjet::NHEP()                      const {return POEVT1.nhep;}
+Int_t TDPMjet::ISTHEP(Int_t i)             const {return POEVT1.isthep[i];}
+Int_t TDPMjet::IDHEP(Int_t i)              const {return POEVT1.idhep[i];}
+Double_t TDPMjet::PHEP(Int_t i, Int_t j)   const {return POEVT1.phep[i][j];}
+