]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TDPMjet/AliGenDPMjet.cxx
Major update of the CMake compilation:
[u/mrichter/AliRoot.git] / TDPMjet / AliGenDPMjet.cxx
index 8e58a55825eef152e56733166bb42621cb6ea4e8..1d513ac723cf7860af5922c463e902c166a6736b 100644 (file)
@@ -44,7 +44,6 @@ ClassImp(AliGenDPMjet)
 AliGenDPMjet::AliGenDPMjet()
     :AliGenMC(), 
      fBeamEn(2750.),
-     fEnergyCMS(5500.),
      fMinImpactParam(0.),
      fMaxImpactParam(5.),
      fICentr(0),
@@ -55,14 +54,15 @@ AliGenDPMjet::AliGenDPMjet()
      fSpecn(0),
      fSpecp(0),
      fDPMjet(0),
-     fParticles(0),
      fNoGammas(0),
      fLHC(0),
      fPi0Decay(0),
+     fDecayAll(0),
      fGenImpPar(0.),
      fProcess(kDpmMb)
 {
 // Constructor
+    fEnergyCMS = 5500.;
     AliDpmJetRndm::SetDpmJetRandom(GetRandom());
 }
 
@@ -71,7 +71,6 @@ AliGenDPMjet::AliGenDPMjet()
 AliGenDPMjet::AliGenDPMjet(Int_t npart)
     :AliGenMC(npart),
      fBeamEn(2750.),
-     fEnergyCMS(5500.),
      fMinImpactParam(0.),
      fMaxImpactParam(5.),
      fICentr(0),
@@ -82,15 +81,16 @@ AliGenDPMjet::AliGenDPMjet(Int_t npart)
      fSpecn(0),
      fSpecp(0),
      fDPMjet(0),
-     fParticles(new TClonesArray("TParticle",10000)),
      fNoGammas(0),
      fLHC(0),
      fPi0Decay(0),
+     fDecayAll(0),
      fGenImpPar(0.),
      fProcess(kDpmMb)
 {
 // Default PbPb collisions at 5. 5 TeV
 //
+    fEnergyCMS = 5500.;
     fName = "DPMJET";
     fTitle= "Particle Generator using DPMJET";
     SetTarget();
@@ -102,7 +102,6 @@ AliGenDPMjet::AliGenDPMjet(Int_t npart)
 AliGenDPMjet::AliGenDPMjet(const AliGenDPMjet &/*Dpmjet*/)
     :AliGenMC(),
      fBeamEn(2750.),
-     fEnergyCMS(5500.),
      fMinImpactParam(0.),
      fMaxImpactParam(5.),
      fICentr(0),
@@ -113,21 +112,21 @@ AliGenDPMjet::AliGenDPMjet(const AliGenDPMjet &/*Dpmjet*/)
      fSpecn(0),
      fSpecp(0),
      fDPMjet(0),
-     fParticles(0),
      fNoGammas(0),
      fLHC(0),
      fPi0Decay(0),
+     fDecayAll(0),
      fGenImpPar(0.),
      fProcess(kDpmMb)
 {
     // Dummy copy constructor
+    fEnergyCMS = 5500.;
 }
 
 //______________________________________________________________________________
 AliGenDPMjet::~AliGenDPMjet()
 {
 // Destructor
-    delete fParticles;
 }
 //______________________________________________________________________________
 void AliGenDPMjet::Init()
@@ -145,11 +144,12 @@ void AliGenDPMjet::Init()
     // fICentr<-99 -> fraction of x-sec. = XSFRAC                
     // fICentr=-1. -> evaporation/fzc suppressed                 
     // fICentr<-1. -> evaporation/fzc suppressed                 
-    if (fAProjectile == 1 && fZProjectile == 1) fDPMjet->SetfIdp(1);
+    if (fAProjectile == 1 && TMath::Abs(fZProjectile == 1)) fDPMjet->SetfIdp(1);
     
     fDPMjet->SetfFCentr(fICentr);  
     fDPMjet->SetbRange(fMinImpactParam, fMaxImpactParam); 
     fDPMjet->SetPi0Decay(fPi0Decay);
+    fDPMjet->SetDecayAll(fDecayAll);
 //
 //  Initialize DPMjet  
 //    
@@ -164,7 +164,6 @@ void AliGenDPMjet::Generate()
 
   Float_t polar[3]    =   {0,0,0};
   Float_t origin[3]   =   {0,0,0};
-  Float_t origin0[3]  =   {0,0,0};
   Float_t p[3];
   Float_t tof;
 
@@ -188,13 +187,13 @@ void AliGenDPMjet::Generate()
       fDPMjet->GenerateEvent();
       fTrials++;
 
-      fDPMjet->ImportParticles(fParticles,"All");      
+      fDPMjet->ImportParticles(&fParticles,"All");      
       if (fLHC) Boost();
 
       // Temporaneo
       fGenImpPar = fDPMjet->GetBImpac();
       
-      Int_t np = fParticles->GetEntriesFast();
+      Int_t np = fParticles.GetEntriesFast();
       printf("\n **************************************************%d\n",np);
       Int_t nc=0;
       if (np==0) continue;
@@ -207,16 +206,10 @@ void AliGenDPMjet::Generate()
          pSelected[i] = 0;
       }
       
-//      Get event vertex
-      
-      fVertex[0] = origin0[0];
-      fVertex[1] = origin0[1]; 
-      fVertex[2] = origin0[2];
-      
 //      First select parent particles
 
       for (i = 0; i<np; i++) {
-         TParticle *iparticle = (TParticle *) fParticles->At(i);
+         TParticle *iparticle = (TParticle *) fParticles.At(i);
 
 // Is this a parent particle ?
 
@@ -226,7 +219,7 @@ void AliGenDPMjet::Generate()
          Bool_t  hasSelectedDaughters =  kFALSE;
          
          kf = iparticle->GetPdgCode();
-         if (kf == 92) continue;
+         if (kf == 92 || kf == 99999) continue;
          ks = iparticle->GetStatusCode();
 // No initial state partons
           if (ks==21) continue;
@@ -248,7 +241,7 @@ void AliGenDPMjet::Generate()
 
 
       for (i=0; i<np; i++) {
-         TParticle *iparticle = (TParticle *) fParticles->At(i);
+         TParticle *iparticle = (TParticle *) fParticles.At(i);
 
 // Is this a final state particle ?
 
@@ -282,7 +275,7 @@ void AliGenDPMjet::Generate()
 // Write particles to stack
 
       for (i = 0; i<np; i++) {
-         TParticle *  iparticle = (TParticle *) fParticles->At(i);
+         TParticle *  iparticle = (TParticle *) fParticles.At(i);
          Bool_t  hasMother   = (iparticle->GetFirstMother()>=0);
          if (pSelected[i]) {
              
@@ -302,12 +295,11 @@ void AliGenDPMjet::Generate()
              TParticle* mother = 0;
              if (hasMother) {
                  imo = iparticle->GetFirstMother();
-                 mother = (TParticle *) fParticles->At(imo);
-                 imo = (mother->GetPdgCode() != 92) ? newPos[imo] : -1;
+                 mother = (TParticle *) fParticles.At(imo);
+                 imo = (mother->GetPdgCode() != 92 && mother->GetPdgCode() != 99999) ? newPos[imo] : -1;
              } // if has mother   
 
              Bool_t tFlag = (fTrackIt && (ks == 1));
-             
              PushTrack(tFlag,imo,kf,p,origin,polar,tof,kPNoProcess,nt, 1., ks);
              KeepTrack(nt);
              newPos[i] = nt;
@@ -342,7 +334,7 @@ Bool_t AliGenDPMjet::DaughtersSelection(TParticle* iparticle)
        imin = iparticle->GetFirstDaughter();
        imax = iparticle->GetLastDaughter();       
        for (i = imin; i <= imax; i++){
-           TParticle *  jparticle = (TParticle *) fParticles->At(i);   
+           TParticle *  jparticle = (TParticle *) fParticles.At(i);    
            Int_t ip = jparticle->GetPdgCode();
            if (KinematicSelection(jparticle,0)&&SelectFlavor(ip)) {
                selected=kTRUE; break;
@@ -409,7 +401,7 @@ void AliGenDPMjet::MakeHeader()
 // Event Vertex
     header->SetPrimaryVertex(fVertex);
     gAlice->SetGenEventHeader(header);    
- AddHeader(header);
   AddHeader(header);
 }
 
 void AliGenDPMjet::AddHeader(AliGenEventHeader* header)
@@ -418,7 +410,7 @@ void AliGenDPMjet::AddHeader(AliGenEventHeader* header)
     if (fContainer) {
         fContainer->AddHeader(header);
     } else {
-        AliRunLoader::GetRunLoader()->GetHeader()->SetGenEventHeader(header);
+        AliRunLoader::Instance()->GetHeader()->SetGenEventHeader(header);
     }
 }
 
@@ -431,5 +423,12 @@ AliGenDPMjet& AliGenDPMjet::operator=(const  AliGenDPMjet& /*rhs*/)
 }
 
 
+void AliGenDPMjet::FinishRun()
+{
+    // Print run statistics
+    fDPMjet->Dt_Dtuout();
+}
+
+    
 
 //______________________________________________________________________________