Adding protection against booking the same branch twice in the background subtraction...
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 18:35:45 +0000 (18:35 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Apr 2011 18:35:45 +0000 (18:35 +0000)
JETAN/AliAnalysisTaskJetBackgroundSubtract.cxx
JETAN/AliAnalysisTaskJetCluster.cxx

index 37d27b4..8f7a183 100644 (file)
@@ -141,6 +141,11 @@ Bool_t AliAnalysisTaskJetBackgroundSubtract::Notify()
     TString newName(ostr->GetString().Data());
     newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
     TClonesArray* jarrayOut = 0;      
+    if(newName.CompareTo(ostr->GetString())==0){
+      Printf("%s:%d Input and output branch would have the same name, skipping %s ",(char*)__FILE__,__LINE__,ostr->GetString().Data());
+      continue;
+    }
+
     if(!jarrayOut&&fAODOut){
       jarrayOut = (TClonesArray*)(fAODOut->FindListObject(newName.Data()));
     }
@@ -203,10 +208,16 @@ void AliAnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects()
       continue;
     }
 
+
     // add a new branch to the output for the background subtracted jets take the names from
     // the input jets and replace the background flag names
     TClonesArray *tca = new TClonesArray("AliAODJet", 0);
     newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
+    if(newName.CompareTo(ostr->GetString())==0){
+      Printf("%s:%d Input and output branch would have the same name, skipping: %s ",(char*)__FILE__,__LINE__,ostr->GetString().Data());
+      continue;
+    }
+
     if(fDebug){
       Printf("%s:%d created branch \n %s from \n %s",(char*)__FILE__,__LINE__,newName.Data(),
             ostr->GetString().Data());
index baaf32e..5831287 100644 (file)
@@ -918,7 +918,7 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
       if(tmpPt<0)tmpPt = 0; // avoid negative weights...
       
       fh1PtJetsRecIn->Fill(tmpPt);
-      // Fill Spectra with constituents
+      // Fill Spectra with constituentsemacs
       const vector<fastjet::PseudoJet> &constituents = clustSeq.constituents(sortedJets[j]);
 
       fh1NConstRec->Fill(constituents.size());
@@ -1314,7 +1314,7 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
        }
      }
    }   
-
    if(select){
      static AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
      fh1CentralitySelect->Fill(cent);
@@ -1322,8 +1322,12 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
      aodH->SetFillAOD(kTRUE);
    }
  }
- if (fDebug > 10)Printf("%s:%d Rec Jets %d",(char*)__FILE__,__LINE__,fTCAJetsOut->GetEntriesFast());
- if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__);
+ if (fDebug > 2){
+   if(fTCAJetsOut)Printf("%s:%d Rec Jets %d",(char*)__FILE__,__LINE__,fTCAJetsOut->GetEntriesFast());
+   if(fTCAJetsOutRan)Printf("%s:%d Rec Jets Ran %d",(char*)__FILE__,__LINE__,fTCAJetsOutRan->GetEntriesFast());
+   if(fTCARandomConesOut)Printf("%s:%d RC %d",(char*)__FILE__,__LINE__,fTCARandomConesOut->GetEntriesFast());
+   if(fTCARandomConesOutRan)Printf("%s:%d RC Ran %d",(char*)__FILE__,__LINE__,fTCARandomConesOutRan->GetEntriesFast());
+ }
  PostData(1, fHistList);
 }