corrected event selection for AODs
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Nov 2010 19:59:47 +0000 (19:59 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 27 Nov 2010 19:59:47 +0000 (19:59 +0000)
PWG4/JetTasks/AliAnalysisTaskJetServices.cxx
PWG4/JetTasks/AliAnalysisTaskJetServices.h
PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
PWG4/macros/AnalysisTrainPWG4Jets.C

index 4b7b9c2..38cfd1c 100644 (file)
@@ -326,7 +326,12 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     }
     esd = dynamic_cast<AliESDEvent*>(InputEvent());
   }
-  
+  if(aod&&fDebug>2){
+    aod->Print();
+    Printf("Vertices %d",aod->GetNumberOfVertices());
+    Printf("tracks %d",aod->GetNumberOfTracks());
+    Printf("jets %d",aod->GetNJets());
+  }
   fSelectionInfoESD |= kNoEventCut;
   fEventCutInfoESD |= kNoEventCut;
 
@@ -407,7 +412,7 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     AliAnalysisHelperJetTasks::EventClass(kTRUE,iCl);
     Bool_t cand = physicsSelection;
 
-    Printf("%s:%d %d %d %d Icl %d",(char*)__FILE__,__LINE__,esdVtxValid,esdVtxIn,cand,iCl);
+    if(fDebug)Printf("%s:%d %d %d %d Icl %d",(char*)__FILE__,__LINE__,esdVtxValid,esdVtxIn,cand,iCl);
 
     if(cand){
       fh2ESDTriggerCount->Fill(0.,kSelectedALICE); 
@@ -441,38 +446,45 @@ void AliAnalysisTaskJetServices::UserExec(Option_t */*option*/)
     }
   }
 
+
+
   if(aod){
     const AliAODVertex *vtxAOD = aod->GetPrimaryVertex();
     aodVtxValid = IsVertexValid(vtxAOD);
     aodVtxIn = IsVertexIn(vtxAOD);
-
-    for(int it = AliAnalysisHelperJetTasks::kAcceptAll;it < AliAnalysisHelperJetTasks::kTrigger;it++){
-      Bool_t aodTrig = kFALSE;
-      aodTrig = AliAnalysisHelperJetTasks::IsTriggerFired(aod,(AliAnalysisHelperJetTasks::Trigger)it);
-      Bool_t cand = aod->GetHeader()->GetOfflineTrigger()&AliVEvent::kMB;
-      if(aodTrig)fh2TriggerCount->Fill(it,kAllTriggered);
-      if(aodVtxValid){
-       Float_t zvtx = vtxAOD->GetZ();
-       if(aodTrig){
-         fh2TriggerCount->Fill(it,kTriggeredVertex);
-         fh2TriggerVtx->Fill(kTriggeredVertex*(it+1),zvtx);
-       }
-       if(cand&&aodEventSelected){
-         fh2TriggerCount->Fill(it,kSelected);
-       }
-       if(aodTrig&&aodEventSelected){
-         fh2TriggerVtx->Fill(kTriggeredVertexIn*(it+1),zvtx);
-         fh2TriggerCount->Fill(it,kTriggeredVertexIn);
-       }
-       if(cand){
-         fh2TriggerCount->Fill(it,kSelectedALICEVertexValid);
-         fh2TriggerVtx->Fill(kSelectedALICEVertexValid*(it+1),zvtx);
-         if(aodEventSelected){
-           fh2TriggerCount->Fill(it,kSelectedALICEVertexIn);
-           fh2TriggerVtx->Fill(kSelectedALICEVertexIn*(it+1),zvtx);
-         }
-       }
+    Float_t zvtx = vtxAOD->GetZ();
+    Int_t  iCl = GetEventClass(aod);
+    AliAnalysisHelperJetTasks::EventClass(kTRUE,iCl);
+    Bool_t cand = aod->GetHeader()->GetOfflineTrigger()&fPhysicsSelectionFlag;
+    if(fDebug)Printf("%s:%d AOD selection %d %d",(char*)__FILE__,__LINE__,cand,aod->GetHeader()->GetOfflineTrigger());
+    if(cand){
+      fh2TriggerCount->Fill(0.,kSelectedALICE); 
+      fh2TriggerCount->Fill(iCl,kSelectedALICE); 
+      fh2TriggerVtx->Fill(kSelectedALICE*(iCl+1),zvtx);
+    }
+    if(aodVtxValid){
+      fh2TriggerCount->Fill(0.,kTriggeredVertex);
+      fh2TriggerCount->Fill(iCl,kTriggeredVertex);
+      fh2TriggerVtx->Fill(iCl,zvtx);
+      if(aodVtxIn){
+       fh2TriggerCount->Fill(0.,kTriggeredVertexIn);
+       fh2TriggerCount->Fill(iCl,kTriggeredVertexIn);
+       fh2TriggerVtx->Fill(kTriggeredVertexIn*(iCl+1),zvtx);
       }
+      if(cand){
+       fh2TriggerCount->Fill(0.,kSelectedALICEVertexValid);
+       fh2TriggerCount->Fill(iCl,kSelectedALICEVertexValid);
+       fh2TriggerVtx->Fill(kSelectedALICEVertexValid*(iCl+1),zvtx);
+      }
+    }
+    if(cand&&aodVtxIn){
+      fh2TriggerCount->Fill(0.,kSelectedALICEVertexIn);
+      fh2TriggerCount->Fill(iCl,kSelectedALICEVertexIn);
+      fh2TriggerVtx->Fill(kSelectedALICEVertexIn*(iCl+1),zvtx);
+      fh2TriggerVtx->Fill(kSelected*(iCl+1),zvtx);
+      fh2TriggerCount->Fill(iCl,kSelected);
+      fh2TriggerCount->Fill(0.,kSelected);
+      if(fUseAODInput)AliAnalysisHelperJetTasks::Selected(kTRUE,kTRUE);// select this event
     }
   }
 
@@ -734,6 +746,19 @@ Int_t AliAnalysisTaskJetServices::GetEventClass(AliESDEvent *esd){
 
 }
 
+
+Int_t AliAnalysisTaskJetServices::GetEventClass(AliAODEvent *aod){
+
+  Float_t cent = aod->GetHeader()->GetCentrality();
+
+  if(cent>50)return 4;
+  if(cent>30)return 3;
+  if(cent>10)return 2;
+  return 1;
+
+}
+
+
 void AliAnalysisTaskJetServices::Terminate(Option_t */*option*/)
 {
   // Terminate analysis
index 43a6686..1c70aea 100644 (file)
@@ -72,6 +72,7 @@ class AliAnalysisTaskJetServices : public AliAnalysisTaskSE
     Bool_t IsVertexIn(const AliESDVertex *vtx);
     Bool_t IsVertexIn(const AliAODVertex *vtx) const;
     Int_t GetEventClass(AliESDEvent *esd);
+    Int_t GetEventClass(AliAODEvent *aod);
 
     enum { kAllTriggered = 0,kTriggeredVertex,kTriggeredVertexIn,kSelectedALICE,kSelectedALICEVertexValid,kSelectedALICEVertexIn,kSelected,kConstraints};
 
index a7d534f..069d963 100644 (file)
@@ -1189,7 +1189,7 @@ void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
     container[2] = phiRec;
     containerPhiZ[0] = ptRec;
     containerPhiZ[1] = phiRec;
-    if(ptRec>30.&&fDebug>0){
+    if(ptRec>30.&&fDebug>2){
       // need to cast to int, otherwise the printf overwrites
       Printf("Jet found in Event %d with p_T, %E",(int)Entry(),ptRec);
       Printf("%s read event, %d",fInputHandler->GetTree()->GetCurrentFile()->GetName(),(int)fInputHandler->GetTree()->GetTree()->GetReadEntry());
index f3c7017..3315c1c 100644 (file)
@@ -301,8 +301,8 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
    // AOD input handler
       AliAODInputHandler *aodH = new AliAODInputHandler();
       mgr->SetInputEventHandler(aodH);
-      if (iPWG4JetTasks) aodH->AddFriend(Form("deltas/%s",kDeltaAODJetName.Data()));
-      if (iPWG4PartCorr) aodH->AddFriend(Form("deltas/%s"kDeltaAODJetName.Data()));
+      //      if (iPWG4JetTasks) aodH->AddFriend(Form("deltas/%s",kDeltaAODJetName.Data()));
+      //      if (iPWG4PartCorr) aodH->AddFriend(Form("deltas/%s"kDeltaAODJetName.Data()));
    } else {   
    // ESD input handler
       AliESDInputHandler *esdHandler = new AliESDInputHandler();
@@ -442,14 +442,22 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
    if(iPWG4Cluster){
      gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetCluster.C");
      AliAnalysisTaskJetCluster *taskCl = 0;
+     Float_t fCenUp = 0;
+     Float_t fCenLo = 0;
+     if(kIsPbPb){
+       fCenLo = 0;
+       fCenUp = 80;
+     }
      if(iPWG4Cluster&1){
 
        if(kIsPbPb){
         taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.2,0,1, kDeltaAODJetName.Data()); // this one is for the background random jets
         taskCl->SetBackgroundCalc(kTRUE);       
         taskCl->SetGhostEtamax(0.9);
+        taskCl->SetCentralityCut(fCenLo,fCenUp);
         taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data()); // this one is for the background random jets
         taskCl->SetBackgroundCalc(kTRUE);
+        taskCl->SetCentralityCut(fCenLo,fCenUp);
         taskCl->SetGhostEtamax(0.9);
        }
        else{
@@ -458,9 +466,12 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
        }
 
        taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data()); 
+       taskCl->SetCentralityCut(fCenLo,fCenUp);
        taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1,kDeltaAODJetName.Data());
+       taskCl->SetCentralityCut(fCenLo,fCenUp);
        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
@@ -574,6 +585,9 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if(kIsPbPb){
        taskjetServ->SetFilterAODCollisions(kTRUE);
      }
+     if(iAODanalysis){
+       taskjetServ->SetAODInput(kTRUE);
+     }
    }
 
    if(iPWG4JetSpectrum){
@@ -591,7 +605,15 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
      if(iPWG4JetSpectrum&1){
        // add the dfault jet finders with R = 0.4 
        UInt_t iSelection = 0xfffff; 
-       taskJetSpectrum = AddTaskJetSpectrum2Delta(kHighPtFilterMask,kUseAODMC,iPhysicsSelectionFlag,iSelection,0,kTRUE,cBack.Data());  // bug fixed 10.11.10
+       
+       //  taskJetSpectrum = AddTaskJetSpectrum2Delta(kHighPtFilterMask,kUseAODMC,iPhysicsSelectionFlag,iSelection,0,kTRUE,cBack.Data());  // bug fixed 10.11.10
+       taskJetSpectrum = AddTaskJetSpectrum2("clustersAOD_ANTIKT04","",cBack.Data(),kHighPtFilterMask,iPhysicsSelectionFlag,0,kTRUE,1);
+       if(iAODanalysis){
+        taskJetSpectrum->SetDebugLevel(1);
+        taskJetSpectrum->SetAODJetInput(kTRUE);
+        taskJetSpectrum->SetAODTrackInput(kTRUE);
+        taskJetSpectrum->SetUseGlobalSelection(kFALSE);
+       }
      }
      if(iPWG4JetSpectrum&2){
        if(kIsMC){
@@ -1618,10 +1640,16 @@ AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode)
 
      // just use run numbers, negatives will be excluded
      while(in1>>iRun){
-       if(iRun>= kGridOffsetRunFromList&&(nRun<kGridMaxRunsFromList)){
+       if(iRun>=0){
+        if(iRun>=0&&nRun>=kGridOffsetRunFromList&&(nRun<kGridMaxRunsFromList)){
           Printf("AnalysisTrainPWG4Jets Adding run number from File %s", Form(kGridRunPattern.Data(),iRun));
           plugin->AddRunNumber(Form(kGridRunPattern.Data(),iRun));
-          nRun++;
+
+        }
+        else{
+          Printf("AnalysisTrainPWG4Jets Skipping run number from File %d", iRun);
+        }
+        nRun++; 
        }
        else{
         Printf("AnalysisTrainPWG4Jets Skipping run number from File %d", iRun);