]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TDPMjet/TDPMjet.cxx
Protection for memory leak
[u/mrichter/AliRoot.git] / TDPMjet / TDPMjet.cxx
index 2fef2bbb08172901e5af289ce9b68626aa4f92b2..536e15bcff7ebe302e52b829903f25ff6f3b83a3 100644 (file)
@@ -116,7 +116,8 @@ ClassImp(TDPMjet)
        fFCentr(0),
        fPi0Decay(0),
        fDecayAll(0),
-       fProcess(kDpmMb)
+       fProcess(kDpmMb),
+       fFragmentation(kFALSE)
 {
 // Default Constructor
 }
@@ -139,7 +140,8 @@ TDPMjet::TDPMjet(DpmProcess_t  iproc, Int_t Ip=208, Int_t Ipz=82, Int_t It=208,
       fFCentr(0),
       fPi0Decay(0),
       fDecayAll(0),
-      fProcess(iproc)
+      fProcess(iproc),
+      fFragmentation(kFALSE)
 {  
     printf("TDPMJet Constructor %d %d %d %d \n", Ip, Ipz, It, Itz);
 }
@@ -173,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")){
@@ -258,6 +257,7 @@ Int_t TDPMjet::ImportParticles(TClonesArray *particles, Option_t *option)
       } // Particle loop  
   }
   return nump;
+  
 }
 
 
@@ -268,6 +268,8 @@ 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 
     if (fIp == 1 && fIpz ==1) {
@@ -287,9 +289,25 @@ void TDPMjet::Initialize()
     }
 
 //  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
-    if (fIp > 1. && fIt > 1) 
+    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) 
@@ -361,8 +379,6 @@ void TDPMjet::GenerateEvent()
    Float_t Elab = fEpn;
    Int_t irej=0;
    Dt_Kkinc(fIp, fIpz, fIt, fItz, fIdp, Elab, kkmat, irej);
-//   dt_evtout(4);
-   if(irej!=0) return;
 }
 //______________________________________________________________________________
 void TDPMjet::Dt_Dtuini(int nevts, double epn, int npmass, int npchar, 
@@ -519,13 +535,14 @@ 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;
 }
@@ -558,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];}
+