]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - JETAN/AliAnalysisTaskJetBackgroundSubtract.cxx
AliMixInputHandlerInfo : BeginEvent function for each input handler after fChain...
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskJetBackgroundSubtract.cxx
index 5a36e6405bbe4ea30c0e63626e2898054574d904..2838a8d450bf7f3a27597620c3c075be7b9cb5ce 100644 (file)
@@ -168,6 +168,9 @@ void AliAnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects()
   // Connect the AOD
 
   if (fDebug > 1) printf("AnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects() \n");
+
+
+
   if(fNonStdFile.Length()!=0){
     
     // case that we have an AOD extension we need to fetch the jets from the extended output
@@ -211,6 +214,7 @@ void AliAnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects()
 
   if(!fHistList)fHistList = new TList();
   fHistList->SetOwner();
+  PostData(1, fHistList); // post data in any case once
 
   for(int iJB = 0;iJB<fJBArray->GetEntries();iJB++){
     TObjString *ostr = (TObjString*)fJBArray->At(iJB);
@@ -222,7 +226,7 @@ void AliAnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects()
       continue;
     }
     newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
-    TH2F *hTmp = new TH2F(Form("h2PtInPtOut_%d",iJB),Form(";%s p_{T}; %s p_{T}",oldName.Data(),newName.Data()),200,0,200.,200,0.,200.);
+    TH2F *hTmp = new TH2F(Form("h2PtInPtOut_%d",iJB),Form(";%s p_{T}; %s p_{T}",oldName.Data(),newName.Data()),200,0,200.,400,-200.,200.);
     fHistList->Add(hTmp);
   }
 
@@ -406,8 +410,8 @@ void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
        }
        if(ptSub<0){
          // optionally rescale it and keep??
-         bAdd = RescaleJetMomentum(&tmpNewJet,0.1);
-         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),0.1);
+         bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
+         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
        }
        else{
          bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
@@ -424,8 +428,8 @@ void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
          Printf("%s:%d Jet %d %3.3f %3.3f %3.3f %3.3f",(char*)__FILE__,__LINE__,i,jet->Pt(),ptSub,background,rho);}
        if(ptSub<0){
          // optionally rescale it and keep??
-         bAdd = RescaleJetMomentum(&tmpNewJet,0.1);
-         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),0.1);
+         bAdd = false;// RescaleJetMomentum(&tmpNewJet,0.1);
+         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
        }
        else{
          bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
@@ -442,8 +446,8 @@ void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
        if(fDebug>2){   Printf("%s:%d Jet %d %3.3f %3.3f %3.3f %3.3f",(char*)__FILE__,__LINE__,i,jet->Pt(),ptSub,background,rho);}
        if(ptSub<0){
          // optionally rescale it and keep??
-         bAdd = RescaleJetMomentum(&tmpNewJet,0.1);
-         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),0.1);
+         bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
+         if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
        }
        else{
          bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
@@ -462,8 +466,8 @@ void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
         if((backgroundv.E()>jet->E())&&(backgroundv.Pt()>jet->Pt())){
        
           // optionally rescale it and keep??
-          bAdd = RescaleJetMomentum(&tmpNewJet,0.1);
-          if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),0.1);
+          bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
+          if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),jet->Pt()-backgroundv.Pt());
         }
         else{
           bAdd = RescaleJet4vector(&tmpNewJet,backgroundv);
@@ -489,28 +493,19 @@ 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);
+    if(jarrayOut)jarrayOut->Sort();
+   }
+   
+   PostData(1, fHistList);
 }
 
 void AliAnalysisTaskJetBackgroundSubtract::Terminate(Option_t */*option*/)