correcting baryon mass subtraction for visible energy in MC
[u/mrichter/AliRoot.git] / JETAN / AliJetAODReader.cxx
index 9dad22b..21256b4 100644 (file)
@@ -60,7 +60,6 @@ AliJetAODReader::AliJetAODReader():
     fGrid2(0),
     fGrid3(0),
     fGrid4(0),
-    fPtCut(0),
     fApplyElectronCorrection(kFALSE),
     fApplyMIPCorrection(kTRUE),
     fApplyFractionHadronicCorrection(kFALSE),
@@ -120,9 +119,7 @@ void AliJetAODReader::OpenInputFiles()
        if (a>=naod) continue;
        
        if (strstr(name,pattern)){
-          char path[256];
-          sprintf(path,"%s/%s/aod.root",dirName,name);
-          fChain->AddFile(path);
+          fChain->AddFile(Form("%s/%s/aod.root",dirName,name));
           a++;
        }
    }
@@ -234,7 +231,10 @@ Bool_t AliJetAODReader::FillMomentumArrayMC(){
 
     
 
-    if (mcTrack == 0) new(fRef) TRefArray(TProcessID::GetProcessWithUID(track));
+    if (mcTrack == 0){
+      fRef->Delete(); // make sure to delete before placement new...
+      new(fRef) TRefArray(TProcessID::GetProcessWithUID(track));
+    }
     new ((*fMomentumArray)[mcTrack]) TLorentzVector(p3,p3.Mag());
     sflag[mcTrack] = 1;
     cflag[mcTrack] = ( pt > ptMin ) ? 1: 0;
@@ -261,16 +261,14 @@ Bool_t AliJetAODReader::FillMomentumArray()
   fRef->Clear();
   fDebug = fReaderHeader->GetDebug();
 
-  if(((AliJetAODReaderHeader*)fReaderHeader)->GetReadAODMC()){
-    return FillMomentumArrayMC();
-  }
-  
-
-  
   if (!fAOD) {
       return kFALSE;
   }
-  
+
+  if(((AliJetAODReaderHeader*)fReaderHeader)->GetReadAODMC()){
+    return FillMomentumArrayMC();
+  }
+   
   // get number of tracks in event (for the loop)
   Int_t nt = fAOD->GetNTracks();
   if(fDebug>0)printf("AOD tracks: %5d \t", nt);