- Make sure that all cuts are taken into account independent of process flags.
[u/mrichter/AliRoot.git] / TDPMjet / AliGenDPMjet.cxx
index 4e9cfc908ae07045919322f951355c2d5a6e0529..5902af61040985c5c867ea3df5f15ec589b1684d 100644 (file)
@@ -33,7 +33,7 @@
 #include "AliGenDPMjetEventHeader.h"
 #include "AliPythia.h"
 #include "AliRun.h"
-
+#include "AliDpmJetRndm.h"
 
  ClassImp(AliGenDPMjet)
 
@@ -45,6 +45,7 @@ AliGenDPMjet::AliGenDPMjet()
 // Constructor
     fParticles = 0;
     fDPMjet = 0;
+    AliDpmJetRndm::SetDpmJetRandom(GetRandom());
 }
 
 
@@ -71,18 +72,21 @@ AliGenDPMjet::AliGenDPMjet(Int_t npart)
     fSelectAll  =  0;
     fFlavor     =  0;
     fSpectators =  1;
-    fEventVertex.Set(3);
+    fVertex.Set(3);
         
     fParticles = new TClonesArray("TParticle",10000);    
 
     // Set random number generator   
-    if (!sRandom) sRandom = fRandom;
     fDPMjet = 0;
     // Instance AliPythia
     AliPythia::Instance(); 
-            
+    AliDpmJetRndm::SetDpmJetRandom(GetRandom());
 }
 
+AliGenDPMjet::AliGenDPMjet(const AliGenDPMjet &/*Dpmjet*/)
+:AliGenMC()
+{
+}
 
 //______________________________________________________________________________
 AliGenDPMjet::~AliGenDPMjet()
@@ -100,7 +104,7 @@ void AliGenDPMjet::Init()
     SetMC(new TDPMjet(fAProjectile, fZProjectile, fATarget, fZTarget, 
                      fBeamEn,fEnergyCMS));
 
-    fDPMjet=(TDPMjet*) fgMCEvGen;
+    fDPMjet=(TDPMjet*) fMCEvGen;
     //
     // **** Flag to force central production
     // fICentr=1. central production forced 
@@ -108,6 +112,8 @@ 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);
+    
     fDPMjet->SetfFCentr(fICentr);  
     fDPMjet->SetbRange(fMinImpactParam,fMaxImpactParam); 
     
@@ -189,9 +195,9 @@ void AliGenDPMjet::Generate()
 //      Get event vertex
       
       //TParticle *iparticle = (TParticle*) fParticles->At(0);
-      fEventVertex[0] = origin0[0];
-      fEventVertex[1] = origin0[1];    
-      fEventVertex[2] = origin0[2];
+      fVertex[0] = origin0[0];
+      fVertex[1] = origin0[1]; 
+      fVertex[2] = origin0[2];
       //for(int jj=0; jj<3; jj++) printf("     fEventVertex[%d] = %f\n",jj,fEventVertex[jj]);
       
 //      First select parent particles
@@ -267,7 +273,7 @@ void AliGenDPMjet::Generate()
       for (i = 0; i<np; i++) {
          TParticle *  iparticle = (TParticle *) fParticles->At(i);
          Bool_t  hasMother   = (iparticle->GetFirstMother()>=0);
-         Bool_t  hasDaughter = (iparticle->GetFirstDaughter()>=0);
+//       Bool_t  hasDaughter = (iparticle->GetFirstDaughter()>=0);
 
          if (pSelected[i]) {
              
@@ -316,7 +322,7 @@ void AliGenDPMjet::Generate()
                 kf==5301 || kf==5303 || kf==5401 || kf==5403 || kf==5503) 
                 tFlag=kFALSE;
 */           
-             SetTrack(tFlag,imo,kf,p,origin,polar,tof,kPNoProcess,nt, 1., ks);
+             PushTrack(tFlag,imo,kf,p,origin,polar,tof,kPNoProcess,nt, 1., ks);
              KeepTrack(nt);
              newPos[i] = nt;
          } // if selected
@@ -537,14 +543,14 @@ void AliGenDPMjet::MakeHeader()
 // Bookkeeping for kinematic bias
     ((AliGenDPMjetEventHeader*) header)->SetTrials(fTrials);
 // Event Vertex
-    header->SetPrimaryVertex(fEventVertex);
+    header->SetPrimaryVertex(fVertex);
     gAlice->SetGenEventHeader(header);    
 }
 
 
 
 //______________________________________________________________________________
-AliGenDPMjet& AliGenDPMjet::operator=(const  AliGenDPMjet& rhs)
+AliGenDPMjet& AliGenDPMjet::operator=(const  AliGenDPMjet& /*rhs*/)
 {
 // Assignment operator
     return *this;
@@ -553,36 +559,3 @@ AliGenDPMjet& AliGenDPMjet::operator=(const  AliGenDPMjet& rhs)
 
 
 //______________________________________________________________________________
-#ifndef WIN32
-# define dt_rndm_dpmjet   dt_rndm_dpmjet_
-# define dt_rndmst_dpmjet dt_rndmst_dpmjet_
-# define dt_rndmin_dpmjet dt_rndmin_dpmjet_
-# define dt_rndmou_dpmjet dt_rndmou_dpmjet_
-# define type_of_call
-#else
-# define dt_rndm_dpmjet   DT_RNDM_DPMJET
-# define dt_rndmst_dpmjet DT_RNDMST_DPMJET
-# define dt_rndmin_dpmjet DT_RNDMIN_DPMJET
-# define dt_rndmou_dpmjet DT_RNDMOU_DPMJET
-# define type_of_call _stdcall
-#endif
-
-
-extern "C" {
-  void type_of_call dt_rndmst_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &)
-  {printf("Dummy version of dt_rndmst reached\n");}
-
-  void type_of_call dt_rndmin_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
-  {printf("Dummy version of dt_rndmin reached\n");}
-
-  void type_of_call dt_rndmou_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
-  {printf("Dummy version of dt_rndmou reached\n");}
-
-  Double_t type_of_call dt_rndm_dpmjet(Int_t &) 
-  {
-      Float_t r;
-      do r = sRandom->Rndm(); while(0 >= r || r >= 1);
-      return r;
-  }
-}
-