]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PYTHIA6/AliGenPythia.cxx
Corrected declaration
[u/mrichter/AliRoot.git] / PYTHIA6 / AliGenPythia.cxx
index 619fe7e20b5f409db731ab050efd461d379ca53a..79827a074ad630e77d9c8ae0873f3c01c769233d 100644 (file)
@@ -556,9 +556,9 @@ void AliGenPythia::Generate()
     if (!fPythia) fPythia=(AliPythia*) fMCEvGen;
     fDecayer->ForceDecay();
 
-    Float_t polar[3]   =   {0,0,0};
-    Float_t origin[3]  =   {0,0,0};
-    Float_t p[4];
+    Double_t polar[3]   =   {0,0,0};
+    Double_t origin[3]  =   {0,0,0};
+    Double_t p[4];
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
 //
@@ -895,9 +895,9 @@ Int_t  AliGenPythia::GenerateMB()
 //
     Int_t i, kf, nt, iparent;
     Int_t nc = 0;
-    Float_t p[4];
-    Float_t polar[3]   =   {0,0,0};
-    Float_t origin[3]  =   {0,0,0};
+    Double_t p[4];
+    Double_t polar[3]   =   {0,0,0};
+    Double_t origin[3]  =   {0,0,0};
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
     
@@ -944,8 +944,10 @@ Int_t  AliGenPythia::GenerateMB()
            }
        }
       }
-      if(!ok)
-       return 0;
+      if(!ok) {
+         delete[] pParent;
+         return 0;
+      }
     }
 
     // Select beauty jets with electron in EMCAL
@@ -969,8 +971,11 @@ Int_t  AliGenPythia::GenerateMB()
            ok =kTRUE;
        }
       }
-      if(!ok)
+      if(!ok) {
+       delete[] pParent;
        return 0;
+      }
+      
       AliDebug(5,Form("Found an electron jet (pt,eta,phi) = (%f,%f,%f)",pt,eta,phi));
     }
     // Check for minimum multiplicity
@@ -1035,8 +1040,10 @@ Int_t  AliGenPythia::GenerateMB()
       if(!okd && iphcand != -1) // execute rotation in phi 
           RotatePhi(iphcand,okd);
       
-      if(!okd)
-       return 0;
+      if(!okd) {
+         delete [] pParent;
+         return 0;
+      }
     }
     
     if (fTriggerParticle) {
@@ -1065,6 +1072,7 @@ Int_t  AliGenPythia::GenerateMB()
       TParticle *mother;
       Bool_t  theQ=kFALSE,theQbar=kFALSE,inYcut=kFALSE;
       Bool_t  theChild=kFALSE;
+      Bool_t  triggered=kFALSE;
       Float_t y;  
       Int_t   pdg,mpdg,mpdgUpperFamily;
       for(i=0; i<np; i++) {
@@ -1076,6 +1084,9 @@ Int_t  AliGenPythia::GenerateMB()
                             (partCheck->Energy()-partCheck->Pz()+1.e-13));
          if(y>fYMin && y<fYMax) inYcut=kTRUE;
        }
+       if(fTriggerParticle) {
+         if(TMath::Abs(pdg)==fTriggerParticle) triggered=kTRUE;
+       }
        if(fCutOnChild && TMath::Abs(pdg) == fPdgCodeParticleforAcceptanceCut) {
          Int_t mi = partCheck->GetFirstMother() - 1;
          if(mi<0) continue;
@@ -1098,6 +1109,10 @@ Int_t  AliGenPythia::GenerateMB()
        delete[] pParent;
        return 0;       
       }
+      if(fTriggerParticle && !triggered) { // particle requested is not produced
+       delete[] pParent;
+       return 0;       
+      }
 
     }
 
@@ -1308,7 +1323,7 @@ void AliGenPythia::MakeHeader()
     fHeader = 0x0;
 }
 
-Bool_t AliGenPythia::CheckTrigger(TParticle* jet1, TParticle* jet2)
+Bool_t AliGenPythia::CheckTrigger(const TParticle* jet1, const TParticle* jet2)
 {
 // Check the kinematic trigger condition
 //
@@ -1441,7 +1456,7 @@ void  AliGenPythia::LoadEvent(AliStack* stack, Int_t flag, Int_t reHadr)
   }
 }
 
-void  AliGenPythia::LoadEvent(TObjArray* stack, Int_t flag, Int_t reHadr)
+void  AliGenPythia::LoadEvent(const TObjArray* stack, Int_t flag, Int_t reHadr)
 {
   //
   // Load event into Pythia Common Block
@@ -1460,17 +1475,19 @@ void  AliGenPythia::LoadEvent(TObjArray* stack, Int_t flag, Int_t reHadr)
   
   for (Int_t part = 0; part < npart; part++) {
     TParticle *mPart = dynamic_cast<TParticle *>(stack->At(part));
+    if (!mPart) continue;
+    
     Int_t kf     =  mPart->GetPdgCode();
     Int_t ks     =  mPart->GetStatusCode();
     Int_t idf    =  mPart->GetFirstDaughter();
     Int_t idl    =  mPart->GetLastDaughter();
     
     if (reHadr) {
-           if (ks == 11 || ks == 12) {
-        ks  -= 10;
-        idf  = -1;
-        idl  = -1;
-           }
+       if (ks == 11 || ks == 12) {
+           ks  -= 10;
+           idf  = -1;
+           idl  = -1;
+       }
     }
     
     Float_t px = mPart->Px();
@@ -1593,7 +1610,7 @@ void AliGenPythia::GetSubEventTime()
   return;
 }
 
-Bool_t AliGenPythia::IsInEMCAL(Float_t phi, Float_t eta)
+Bool_t AliGenPythia::IsInEMCAL(Float_t phi, Float_t eta) const
 {
   // Is particle in EMCAL acceptance? 
   // phi in degrees, etamin=-etamax
@@ -1604,7 +1621,7 @@ Bool_t AliGenPythia::IsInEMCAL(Float_t phi, Float_t eta)
     return kFALSE;
 }
 
-Bool_t AliGenPythia::IsInPHOS(Float_t phi, Float_t eta)
+Bool_t AliGenPythia::IsInPHOS(Float_t phi, Float_t eta) const
 {
   // Is particle in PHOS acceptance? 
   // Acceptance slightly larger considered.