]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
bug fix in merging
authormchojnac <Marek.Chojnacki@cern.ch>
Fri, 21 Nov 2014 18:25:40 +0000 (19:25 +0100)
committermchojnac <Marek.Chojnacki@cern.ch>
Fri, 21 Nov 2014 18:26:42 +0000 (19:26 +0100)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.cxx

index 4a9c90b38b6cec1acb3953faed7da79b08a3f689..d8cf5fc4f05018d169e293cfc5a8ccff6926262e 100644 (file)
@@ -612,64 +612,90 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
     if (entry == 0) 
       continue;
 
-    TH1I * histo = entry->GetHistoCuts();      
-    collections.Add(histo);
+    TH1I * histo = entry->GetHistoCuts(); 
+    if(histo)    
+       collections.Add(histo);
     TH1F * histo_histoVtxBefSel = entry->GetHistoVtxBefSel();      
-    collections_histoVtxBefSel.Add(histo_histoVtxBefSel);
+    if(histo_histoVtxBefSel)
+       collections_histoVtxBefSel.Add(histo_histoVtxBefSel);
     TH1F * histo_histoVtxAftSel = entry->GetHistoVtxAftSel();      
-    collections_histoVtxAftSel.Add(histo_histoVtxAftSel);
-    TH1F * histo_histoEtaBefSel = entry->GetHistoEtaBefSel();      
-    collections_histoEtaBefSel.Add(histo_histoEtaBefSel);
-    TH1F * histo_histoEtaAftSel = entry->GetHistoEtaAftSel();      
-    collections_histoEtaAftSel.Add(histo_histoEtaAftSel);
-    TH1F * histo_histoNChAftSel = entry->GetHistoNChAftSel();      
-    collections_histoNChAftSel.Add(histo_histoNChAftSel);
+    if(histo_histoVtxAftSel)
+       collections_histoVtxAftSel.Add(histo_histoVtxAftSel);
+    TH1F * histo_histoEtaBefSel = entry->GetHistoEtaBefSel(); 
+    if(histo_histoEtaBefSel)        
+       collections_histoEtaBefSel.Add(histo_histoEtaBefSel);
+    TH1F * histo_histoEtaAftSel = entry->GetHistoEtaAftSel();
+    if(histo_histoEtaAftSel)         
+       collections_histoEtaAftSel.Add(histo_histoEtaAftSel);
+    TH1F * histo_histoNChAftSel = entry->GetHistoNChAftSel();
+    if(histo_histoNChAftSel)         
+       collections_histoNChAftSel.Add(histo_histoNChAftSel);
     // TH1F * histo_histoQVectorPos = entry->GetHistoQVectorPos();      
     // collections_histoQVectorPos.Add(histo_histoQVectorPos);
     // TH1F * histo_histoQVectorNeg = entry->GetHistoQVectorNeg();      
-    // collections_histoQVectorNeg.Add(histo_histoQVectorNeg);
-    TH1F * histo_histoQVector = entry->GetHistoQVector();      
-    collections_histoQVector.Add(histo_histoQVector);
+    // collections_histoQVectorNeg.Add(histo_histoQVectorNeg); 
+    TH1F * histo_histoQVector = entry->GetHistoQVector();     
+    if(histo_histoQVector)      
+       collections_histoQVector.Add(histo_histoQVector);
     TH1F * histo_histoEP = entry->GetHistoEP();      
-    collections_histoEP.Add(histo_histoEP);
+    if(histo_histoEP) 
+       collections_histoEP.Add(histo_histoEP);
     TH1F* histo_histoVtxAftSelwithoutZvertexCut=entry->GetHistoVtxAftSelwithoutZvertexCut();
-    collections_histoVtxAftSelwithoutZvertexCut.Add(histo_histoVtxAftSelwithoutZvertexCut);
+     if(histo_histoVtxAftSelwithoutZvertexCut)
+       collections_histoVtxAftSelwithoutZvertexCut.Add(histo_histoVtxAftSelwithoutZvertexCut);
     TH1F* histo_histoVtxalltriggerEventswithMCz=entry->GetHistoVtxGenerated();
-    collections_histoVtxalltriggerEventswithMCz.Add(histo_histoVtxalltriggerEventswithMCz);
+     if(histo_histoVtxalltriggerEventswithMCz)
+       collections_histoVtxalltriggerEventswithMCz.Add(histo_histoVtxalltriggerEventswithMCz);
     
    TH1F* histo_histoVtxAftSelwithoutZvertexCutusingMCz=entry->GetHistoVtxAftSelwithoutZvertexCutusingMCz();
-    collections_histoVtxAftSelwithoutZvertexCutusingMCz.Add(histo_histoVtxAftSelwithoutZvertexCutusingMCz);    
+     if(histo_histoVtxAftSelwithoutZvertexCutusingMCz) 
+       collections_histoVtxAftSelwithoutZvertexCutusingMCz.Add(histo_histoVtxAftSelwithoutZvertexCutusingMCz); 
     
     TH1F* histo_histoRunNumbers=entry->GetHistoRunNumbers();
-    collections_histoRunNumbers.Add(histo_histoRunNumbers);
+    if(histo_histoRunNumbers)
+       collections_histoRunNumbers.Add(histo_histoRunNumbers);
  
    TH2F* histo_histoCentrality=entry->GetHistoCentrality();
-  collections_histoCentrality.Add(histo_histoCentrality);              
+  if(histo_histoCentrality)
+        collections_histoCentrality.Add(histo_histoCentrality);                
 
 TH2F* histo_histoMultiplicty=entry->GetHistoMultiplicty();
-  collections_histoMultiplicty.Add(histo_histoMultiplicty);
+  if(histo_histoMultiplicty)
+       collections_histoMultiplicty.Add(histo_histoMultiplicty);
 
 
     count++;
   }
-  
-  fHistoCuts->Merge(&collections);
-  fHistoVtxBefSel->Merge(&collections_histoVtxBefSel);
-  fHistoVtxAftSel->Merge(&collections_histoVtxAftSel);
-  fHistoEtaBefSel->Merge(&collections_histoEtaBefSel);
-  fHistoEtaAftSel->Merge(&collections_histoEtaAftSel);
-  fHistoNChAftSel->Merge(&collections_histoNChAftSel);
+  if(fHistoCuts)
+       fHistoCuts->Merge(&collections);
+  if(fHistoVtxBefSel)
+       fHistoVtxBefSel->Merge(&collections_histoVtxBefSel);
+  if(fHistoVtxAftSel)
+       fHistoVtxAftSel->Merge(&collections_histoVtxAftSel);
+  if(fHistoEtaBefSel)
+        fHistoEtaBefSel->Merge(&collections_histoEtaBefSel);
+  if(fHistoEtaAftSel)
+       fHistoEtaAftSel->Merge(&collections_histoEtaAftSel);
+  if(fHistoNChAftSel)
+       fHistoNChAftSel->Merge(&collections_histoNChAftSel);
   // fHistoQVectorPos->Merge(&collections_histoQVectorPos);
   // fHistoQVectorNeg->Merge(&collections_histoQVectorNeg);
-  fHistoQVector->Merge(&collections_histoQVector);
-  fHistoEP->Merge(&collections_histoEP);
-
-  fHistoVtxAftSelwithoutZvertexCut->Merge(&collections_histoVtxAftSelwithoutZvertexCut);
-  fHistoVtxalltriggerEventswithMCz->Merge(&collections_histoVtxalltriggerEventswithMCz);
-  fHistoVtxAftSelwithoutZvertexCutusingMCz->Merge(&collections_histoVtxAftSelwithoutZvertexCutusingMCz);
-  fHistoRunNumbers->Merge(&collections_histoRunNumbers);
-  fHistoCentrality->Merge(&collections_histoCentrality);
-  fHistoMultiplicty->Merge(&collections_histoMultiplicty);
+  if(fHistoQVector)
+        fHistoQVector->Merge(&collections_histoQVector);
+  if(fHistoEP)
+       fHistoEP->Merge(&collections_histoEP);
+  if(fHistoVtxAftSelwithoutZvertexCut)
+       fHistoVtxAftSelwithoutZvertexCut->Merge(&collections_histoVtxAftSelwithoutZvertexCut);
+  if(fHistoVtxalltriggerEventswithMCz)
+        fHistoVtxalltriggerEventswithMCz->Merge(&collections_histoVtxalltriggerEventswithMCz);
+  if(fHistoVtxAftSelwithoutZvertexCutusingMCz) 
+       fHistoVtxAftSelwithoutZvertexCutusingMCz->Merge(&collections_histoVtxAftSelwithoutZvertexCutusingMCz);
+  if(fHistoRunNumbers)
+       fHistoRunNumbers->Merge(&collections_histoRunNumbers);
+  if(fHistoCentrality)
+        fHistoCentrality->Merge(&collections_histoCentrality);
+  if(fHistoMultiplicty)
+       fHistoMultiplicty->Merge(&collections_histoMultiplicty);
 
 
   delete iter;
index 89cde772639b1c65fae79dde70ea31b5c2b4f8ff..1b03364e89a1ca6cd8c3b66264414596a0914c41 100644 (file)
@@ -493,38 +493,55 @@ Long64_t AliSpectraBothTrackCuts::Merge(TCollection* list)
     if (entry == 0) 
       continue;
     
-    TH1I * histo = entry->GetHistoCuts();      
-    collections.Add(histo);
-    TH1F * histoNSelectedPos = entry->GetHistoNSelectedPos();      
-    collections_histoNSelectedPos.Add(histoNSelectedPos);
+    TH1I * histo = entry->GetHistoCuts();   
+    if(histo)     
+       collections.Add(histo);
+    TH1F * histoNSelectedPos = entry->GetHistoNSelectedPos();
+    if(histoNSelectedPos)            
+       collections_histoNSelectedPos.Add(histoNSelectedPos);
     TH1F * histoNSelectedNeg = entry->GetHistoNSelectedNeg();      
-    collections_histoNSelectedNeg.Add(histoNSelectedNeg);
-    TH1F * histoNMatchedPos = entry->GetHistoNMatchedPos();      
-    collections_histoNMatchedPos.Add(histoNMatchedPos);
+    if(histoNSelectedNeg)
+       collections_histoNSelectedNeg.Add(histoNSelectedNeg);
+    TH1F * histoNMatchedPos = entry->GetHistoNMatchedPos();  
+    if(histoNMatchedPos)           
+       collections_histoNMatchedPos.Add(histoNMatchedPos);
     TH1F * histoNMatchedNeg = entry->GetHistoNMatchedNeg();      
-    collections_histoNMatchedNeg.Add(histoNMatchedNeg);
+    if(histoNMatchedNeg)
+       collections_histoNMatchedNeg.Add(histoNMatchedNeg);
     TH2F * histoEtaPhiHighPt = entry->GetHistoEtaPhiHighPt();      
-    collections_histoEtaPhiHighPt.Add(histoEtaPhiHighPt);
-    TH3F* histoDCAzQA=entry->GetHistoDCAzQA();         
-    collections_histoDCAzQA.Add(histoDCAzQA);
-     TH3F* histoNclustersQA=entry->GetHistoNclustersQA();      
-    collections_histoNclustersQA.Add(histoNclustersQA);
+    if(histoEtaPhiHighPt)
+       collections_histoEtaPhiHighPt.Add(histoEtaPhiHighPt);
+    TH3F* histoDCAzQA=entry->GetHistoDCAzQA();
+    if(histoDCAzQA)            
+       collections_histoDCAzQA.Add(histoDCAzQA);
+    TH3F* histoNclustersQA=entry->GetHistoNclustersQA();       
+    if(histoNclustersQA)
+       collections_histoNclustersQA.Add(histoNclustersQA);
     TH3F* histochi2perNDFQA=entry->GetHistochi2perNDFQA();     
-    collections_histochi2perNDFQA.Add(histochi2perNDFQA);
+    if(histochi2perNDFQA)
+       collections_histochi2perNDFQA.Add(histochi2perNDFQA);
        
 
 
     count++;
   }
-  
-  fHistoCuts->Merge(&collections);
-  fHistoNSelectedPos->Merge(&collections_histoNSelectedPos);
-  fHistoNSelectedNeg->Merge(&collections_histoNSelectedNeg);
-  fHistoNMatchedPos->Merge(&collections_histoNMatchedPos);
-  fHistoNMatchedNeg->Merge(&collections_histoNMatchedNeg);
-  fHistoEtaPhiHighPt->Merge(&collections_histoEtaPhiHighPt);
-  fHistoDCAzQA->Merge(&collections_histoDCAzQA);
-  fHistoNclustersQA->Merge(&collections_histoNclustersQA);
+  if(fHistoCuts)        
+       fHistoCuts->Merge(&collections);
+  if(fHistoNSelectedPos)
+       fHistoNSelectedPos->Merge(&collections_histoNSelectedPos);
+  if(fHistoNSelectedNeg)
+       fHistoNSelectedNeg->Merge(&collections_histoNSelectedNeg);
+  if(fHistoNMatchedPos)
+       fHistoNMatchedPos->Merge(&collections_histoNMatchedPos);
+  if(fHistoNMatchedNeg)
+       fHistoNMatchedNeg->Merge(&collections_histoNMatchedNeg);
+  if(fHistoEtaPhiHighPt)
+       fHistoEtaPhiHighPt->Merge(&collections_histoEtaPhiHighPt);
+  if(fHistoDCAzQA)
+        fHistoDCAzQA->Merge(&collections_histoDCAzQA);
+  if(fHistoNclustersQA)
+       fHistoNclustersQA->Merge(&collections_histoNclustersQA);
+  if(fHistochi2perNDFQA)
   fHistochi2perNDFQA->Merge(&collections_histochi2perNDFQA);
 
   delete iter;