Some additions and fixes for centrality
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Nov 2010 17:04:39 +0000 (17:04 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Nov 2010 17:04:39 +0000 (17:04 +0000)
PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
PWG4/JetTasks/AliAnalysisTaskJetServices.h
PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
PWG4/macros/AddTaskJets.C
PWG4/macros/AnalysisTrainPWG4Jets.C

index 9da19d7..4b7b9c2 100644 (file)
@@ -68,6 +68,7 @@
 ClassImp(AliAnalysisTaskJetServices)
 
 AliAODHeader*  AliAnalysisTaskJetServices::fgAODHeader = NULL;
+TClonesArray*   AliAnalysisTaskJetServices::fgAODVertices = NULL;
 
 AliAnalysisTaskJetServices::AliAnalysisTaskJetServices(): AliAnalysisTaskSE(),
   fUseAODInput(kFALSE),
@@ -267,6 +268,12 @@ void AliAnalysisTaskJetServices::UserCreateOutputObjects()
      if (fDebug > 1) AliInfo("Replicating header");
      fgAODHeader = new AliAODHeader;
      AddAODBranch("AliAODHeader",&fgAODHeader,fNonStdFile.Data());
+     /*
+     if (fDebug > 1) AliInfo("Replicating vertices");
+     fgAODVertices = new TClonesArray("AliAODVertex",2);
+     fgAODVertices->SetName("vertices");
+     AddAODBranch("AliAODHeader",&fgAODVertices,fNonStdFile.Data());
+     */
   }
 }
 
@@ -355,8 +362,10 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
   Bool_t aodEventSelected = IsEventSelected(aod);
 
   Bool_t physicsSelection = ((fInputHandler->IsEventSelected())&fPhysicsSelectionFlag);
-  if(aodH&&physicsSelection&&fFilterAODCollisions){
-    aodH->SetFillAOD(kTRUE);
+  if(aodH&&physicsSelection&&fFilterAODCollisions&&fgAODHeader){
+    if(fgAODHeader->GetCentrality()<=80){
+      aodH->SetFillAOD(kTRUE);
+    }
   }
 
 
@@ -503,10 +512,21 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     if (fgAODHeader){
       *fgAODHeader =  *(dynamic_cast<AliAODHeader*>(aod->GetHeader()));
     }
+    if(fgAODVertices){
+      Printf("%p",fgAODVertices);
+      Printf("%p",fgAODVertices->At(0));
+      fgAODVertices->Delete();
+      TClonesArray &vertices = *fgAODVertices;
+
+      const AliAODVertex *vtxAOD = aod->GetPrimaryVertex();
+      AliAODVertex *primary = new (&vertices[0]) AliAODVertex();
+      primary->SetName(vtxAOD->GetName());
+      primary->SetTitle(vtxAOD->GetTitle());
+    }
   }
   
   PostData(1, fHistList);
-  }
+}
 
 Bool_t AliAnalysisTaskJetServices::IsEventSelected(const AliESDEvent* esd){
   if(!esd)return kFALSE;
@@ -514,6 +534,13 @@ Bool_t AliAnalysisTaskJetServices::IsEventSelected(const AliESDEvent* esd){
   return IsVertexIn(vtx); // vertex in calls vertex valid
 }
 
+AliAnalysisTaskJetServices::~AliAnalysisTaskJetServices(){
+  if(fgAODVertices){
+    fgAODVertices->Delete();
+    delete fgAODVertices;
+  }
+}
+
 
 Bool_t AliAnalysisTaskJetServices::IsEventSelected(const AliAODEvent* aod) const {
   if(!aod)return kFALSE;
index cf1d4fa..43a6686 100644 (file)
@@ -24,6 +24,7 @@ class AliCFManager;
 class AliTriggerAnalysis;
 
 class TList;
+class TClonesArray;
 class TChain;
 class TH1F;
 class TH2F;
@@ -37,7 +38,7 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
  public:
     AliAnalysisTaskJetServices();
     AliAnalysisTaskJetServices(const char* name);
-    virtual ~AliAnalysisTaskJetServices() {;}
+    virtual ~AliAnalysisTaskJetServices();
     // Implementation of interface methods
     virtual void UserCreateOutputObjects();
     virtual void Init();
@@ -128,8 +129,8 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
 
         // Provisions for replication
     static AliAODHeader*    fgAODHeader;        //! Header for replication
-
-    ClassDef(AliAnalysisTaskJetServices,11)
+    static TClonesArray*  fgAODVertices;        //! primary vertex for replication
+    ClassDef(AliAnalysisTaskJetServices,12)
 };
  
 #endif
index f1776f8..a7d534f 100644 (file)
@@ -708,6 +708,7 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
      
      
      Float_t pthardest=0.;
+     
      if(nJets!=0){
   
        Float_t bkg1=evBkg->GetBackground(0);
@@ -729,7 +730,7 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
        fh1Area2->Fill(area2);
        fh1Area3->Fill(area3);
        
-       
+       Int_t iSubJetCounter = 0;
        for(Int_t k=0;k<nJets;k++){
         AliAODJet *jet = dynamic_cast<AliAODJet*>(aodRecJets->At(k));
         fh1Ptjet->Fill(jet->Pt());
@@ -760,17 +761,20 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
         if(fFillCorrBkg==1) ptsub=ptsub1;
         if(fFillCorrBkg==2) ptsub=ptsub2;
         if(fFillCorrBkg==3) ptsub=ptsub3;
-        Float_t subphi=jet->Phi();
-        Float_t subtheta=jet->Theta();
-        Float_t subpz = ptsub/TMath::Tan(subtheta);
-        Float_t subpx=ptsub*TMath::Cos(subphi);
-        Float_t subpy=ptsub * TMath::Sin(subphi);
-        Float_t subp  = TMath::Sqrt(ptsub*ptsub+subpz*subpz);
-        if(k<kMaxJets){
-          genJets[k].SetPxPyPzE(subpx,subpy,subpz,subp);
-          nGenJets = k+1;
+        if(ptsub>0){// avoid unphysical jets pT
+          Float_t subphi=jet->Phi();
+          Float_t subtheta=jet->Theta();
+          Float_t subpz = ptsub/TMath::Tan(subtheta);
+          Float_t subpx=ptsub*TMath::Cos(subphi);
+          Float_t subpy=ptsub * TMath::Sin(subphi);
+          Float_t subp  = TMath::Sqrt(ptsub*ptsub+subpz*subpz);
+          if(k<kMaxJets){// only store the jets which are assoicated to anohter one
+            genJets[iSubJetCounter].SetPxPyPzE(subpx,subpy,subpz,subp);
+            iSubJetCounter++;
+          }
         }
        }
+       nGenJets = iSubJetCounter;
        fh2Rhovspthardest1->Fill(pthardest,bkg1);
        fh2Rhovspthardest2->Fill(pthardest,bkg2);
        fh2Rhovspthardest3->Fill(pthardest,bkg3); 
@@ -1091,8 +1095,8 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
       for(int it = 0;it<genParticles.GetEntries();++it){
        AliVParticle *part = (AliVParticle*)genParticles.At(it);
        Float_t deltaR = genJets[ig].DeltaR(part);
-       fh1TmpRho->Fill(deltaR,part->Pt()/ptGen);
-       if(deltaR<radiusGen){
+       if(ptGen>0)fh1TmpRho->Fill(deltaR,part->Pt()/ptGen);
+       if(deltaR<radiusGen&&ptGen>0){
          Float_t z = part->Pt()/ptGen;
          Float_t lnz =  -1.*TMath::Log(z);
          fh2FragGen[ig]->Fill(z,ptGen,eventW);
@@ -1157,7 +1161,8 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
       if(deltaPhi<(-1.*TMath::Pi()))deltaPhi = deltaPhi + 2.*TMath::Pi();      
       deltaPhi = TMath::Abs(deltaPhi);
       fh2DijetDeltaPhiPt->Fill(deltaPhi,ptRec1);      
-      Float_t asym = (ptRec1-ptRec)/(ptRec1+ptRec);
+      Float_t asym = 9999;
+      if((ptRec1+ptRec)>0)asym = (ptRec1-ptRec)/(ptRec1+ptRec);
       fh2DijetAsymPt->Fill(asym,ptRec1);
       fh2DijetDeltaPhiDeltaEta->Fill(deltaPhi,etaRec1-etaRec);
       fh2DijetPt2vsPt1->Fill(ptRec1,ptRec);        
@@ -1233,10 +1238,10 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
        }
 
        Float_t deltaR = recJets[ir].DeltaR(part);
-       fh1TmpRho->Fill(deltaR,part->Pt()/ptRec);
+       if(ptRec>0)fh1TmpRho->Fill(deltaR,part->Pt()/ptRec);
 
 
-       if(deltaR<radiusRec){
+       if(deltaR<radiusRec&&ptRec>0){
          Float_t z = part->Pt()/ptRec;
          if(z>zLeading)zLeading=z;
          Float_t lnz =  -1.*TMath::Log(z);
index e3b3fef..25d4cd2 100644 (file)
@@ -172,7 +172,7 @@ AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf, Float_t radius,UInt_t f
    jetana->SetConfigFile("");\r
    jetana->SetDebugLevel(2);\r
    if(TMath::Abs((radius-0.4))< 0.02&&c_jf.Contains("fastjet")){\r
-     jetana->SetFilterPt(20.);\r
+     //     jetana->SetFilterPt(20.);\r
    }\r
 \r
 \r
@@ -259,7 +259,7 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){
     jh->SetMinJetPt(5);                      // Ptmin of jets (GeV)\r
 \r
     //do you want to subtract BG (0 = no, 1 = yes)\r
-    jh->SetBGMode(0);\r
+    jh->SetBGMode(0); // if 1 set also the radius for the background determination..\r
 \r
     //for background\r
     jh->SetRapRange( -0.9, 0.9);              // rapidity range for subtracting background must be < ghostmaxrap-0.95*R\r
index 8e1d028..f3c7017 100644 (file)
@@ -459,7 +459,8 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
 
        taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data()); 
        taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1,kDeltaAODJetName.Data());
-
+       taskCl->SetJetTriggerPtCut(999);// hard coded values in tha task, only flag 
+       taskCl->SetBackgroundBranch("jeteventbackground_clustersAOD_KT04");
        if(kUseAODMC){
         taskCl = AddTaskJetCluster("AODMC","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.6,0,1,kDeltaAODJetName.Data()); // this one is for the background jets
         taskCl = AddTaskJetCluster("AODMC2","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.6,0,1,kDeltaAODJetName.Data()); // this one is for the background jets