handle reference tracks correctly for background subtraction and randomized events
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Feb 2011 20:53:58 +0000 (20:53 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Feb 2011 20:53:58 +0000 (20:53 +0000)
JETAN/AliAnalysisTaskJetBackgroundSubtract.cxx
JETAN/AliAnalysisTaskJetCluster.cxx

index 89c6128..a280562 100644 (file)
@@ -493,26 +493,15 @@ void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
          if(i==0){fh2ShiftEtaLeading->Fill(jet->Eta(),newJet->Eta());
           fh2ShiftPhiLeading->Fill(jet->Phi(),newJet->Phi());}}
 
-
+       // set the references 
        newJet->GetRefTracks()->Clear();
+       TRefArray *refs = jet->GetRefTracks();
+       for(Int_t ir=0;ir<refs->GetEntriesFast();ir++){
+         AliVParticle *vp = dynamic_cast<AliVParticle*>(refs->At(ir));
+         if(vp)newJet->AddTrack(vp);
+       }
       }
-
-
-
-
-
-
     }
-
-
-
-    // subtract the background
-    
-
-    // remove jets??
-
-    // sort jets...
-
   }
   PostData(1, fHistList);
 }
index a482d71..7cf425e 100644 (file)
@@ -333,16 +333,17 @@ void AliAnalysisTaskJetCluster::UserCreateOutputObjects()
       // Create a new branch for jets...
       //  -> cleared in the UserExec....
       // here we can also have the case that the brnaches are written to a separate file
-
+      
       fTCAJetsOut = new TClonesArray("AliAODJet", 0);
       fTCAJetsOut->SetName(fNonStdBranch.Data());
       AddAODBranch("TClonesArray",&fTCAJetsOut,fNonStdFile.Data());
-
+      
    
+      
       fTCAJetsOutRan = new TClonesArray("AliAODJet", 0);
       fTCAJetsOutRan->SetName(Form("%s_%s",fNonStdBranch.Data(),"random"));
       AddAODBranch("TClonesArray",&fTCAJetsOutRan,fNonStdFile.Data());
-
+      
       if(fUseBackgroundCalc){
        if(!AODEvent()->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),fNonStdBranch.Data()))){
          fAODJetBackgroundOut = new AliAODJetEventBackground();
@@ -896,13 +897,12 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
       
       if(tmpPt>fJetOutputMinPt&&fTCAJetsOut){// cut on the non-background subtracted...
        aodOutJet =  new ((*fTCAJetsOut)[nAodOutJets++]) AliAODJet(tmpRec);
+       aodOutJet->GetRefTracks()->Clear();
        Double_t area1 = clustSeq.area(sortedJets[j]);
        aodOutJet->SetEffArea(area1,0);
         fastjet::PseudoJet vecarea=clustSeq.area_4vector(sortedJets[j]);  
         vecareab.SetPxPyPzE(vecarea.px(),vecarea.py(),vecarea.pz(),vecarea.e());     
        aodOutJet->SetVectorAreaCharged(&vecareab);
-
-
       }
 
 
@@ -924,16 +924,16 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
       fh2PtNchN->Fill(nCh,tmpPt,constituents.size());
       fh2NConstPt->Fill(tmpPt,constituents.size());
       // loop over constiutents and fill spectrum
-    
-     for(unsigned int ic = 0; ic < constituents.size();ic++){
-       AliVParticle *part = (AliVParticle*)recParticles.At(constituents[ic].user_index());
-       fh1PtJetConstRec->Fill(part->Pt());
-       if(aodOutJet){
-        aodOutJet->AddTrack(fRef->At(constituents[ic].user_index()));
-       }
-       if(j==0)fh1PtJetConstLeadingRec->Fill(part->Pt());
-     }
-     
+   
+      for(unsigned int ic = 0; ic < constituents.size();ic++){
+       AliVParticle *part = (AliVParticle*)recParticles.At(constituents[ic].user_index());
+       fh1PtJetConstRec->Fill(part->Pt());
+       if(aodOutJet){
+         aodOutJet->AddTrack(fRef->At(constituents[ic].user_index()));
+       }
+       if(j==0)fh1PtJetConstLeadingRec->Fill(part->Pt());
+      }
+      
      // correlation
      Float_t tmpPhi =  tmpRec.Phi();
      Float_t tmpEta =  tmpRec.Eta();
@@ -1250,7 +1250,7 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
      if(tmpPt>fJetOutputMinPt&&fTCAJetsOutRan){
        aodOutJetRan =  new ((*fTCAJetsOutRan)[nAodOutJetsRan++]) AliAODJet(tmpRec);
        Double_t arearan=clustSeqRan.area(sortedJetsRan[j]);
-       
+       aodOutJetRan->GetRefTracks()->Clear();
        aodOutJetRan->SetEffArea(arearan,0);
        fastjet::PseudoJet vecarearan=clustSeqRan.area_4vector(sortedJetsRan[j]);  
        vecarearanb.SetPxPyPzE(vecarearan.px(),vecarearan.py(),vecarearan.pz(),vecarearan.e());
@@ -1258,20 +1258,6 @@ void AliAnalysisTaskJetCluster::UserExec(Option_t */*option*/)
 
      }
 
-
-
-     
-     for(unsigned int ic = 0; ic < constituents.size();ic++){
-       // AliVParticle *part = (AliVParticle*)recParticles.At(constituents[ic].user_index());
-       // fh1PtJetConstRec->Fill(part->Pt());
-       if(aodOutJetRan){
-        aodOutJetRan->AddTrack(fRef->At(constituents[ic].user_index()));
-       }
-     }
-      
-
-
-
       // correlation
       Float_t tmpPhi =  tmpRec.Phi();
       if(tmpPhi<0)tmpPhi+=TMath::Pi()*2.;