]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add possibility to clusterize only within a centrality bin
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Jun 2012 11:40:47 +0000 (11:40 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Jun 2012 11:40:47 +0000 (11:40 +0000)
PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALClusterize.h
PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C

index ec452e7e47f485dfb7b969818cfaf6a4e57e84e2..578770b2c0a129e4f532a8945bb77d6b67e6af83 100644 (file)
@@ -81,9 +81,10 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize(const char *name)
 , fCellMatchdEta(),       fCellMatchdPhi()
 , fMaxEvent(0),           fDoTrackMatching(kFALSE)
 , fSelectCell(kFALSE),    fSelectCellMinE(0),         fSelectCellMinFrac(0)
-, fRemoveLEDEvents(kTRUE), fRemoveExoticEvents(kFALSE)
+, fRemoveLEDEvents(kTRUE),fRemoveExoticEvents(kFALSE)
 , fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("") 
-, fOADBSet(kFALSE),       fAccessOADB(kTRUE),         fOADBFilePath("")           
+, fOADBSet(kFALSE),       fAccessOADB(kTRUE),         fOADBFilePath("")
+, fCentralityClass("")
 {
   // Constructor
   
@@ -97,6 +98,7 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize(const char *name)
     fCellMatchdPhi[j]    = -999;
   }  
   
+  fCentralityBin[0] = fCentralityBin[1]=-1;
   
 }
 
@@ -119,10 +121,10 @@ AliAnalysisTaskEMCALClusterize::AliAnalysisTaskEMCALClusterize()
 , fCellMatchdEta(),         fCellMatchdPhi()
 , fMaxEvent(0),             fDoTrackMatching(kFALSE)
 , fSelectCell(kFALSE),      fSelectCellMinE(0),         fSelectCellMinFrac(0)
-, fRemoveLEDEvents(kTRUE), fRemoveExoticEvents(kFALSE)
+, fRemoveLEDEvents(kTRUE),  fRemoveExoticEvents(kFALSE)
 , fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("")
-, fOADBSet(kFALSE),         fAccessOADB(kTRUE),        fOADBFilePath("")           
-
+, fOADBSet(kFALSE),         fAccessOADB(kTRUE),        fOADBFilePath("")
+, fCentralityClass("")           
 {
   // Constructor
   
@@ -970,6 +972,10 @@ void AliAnalysisTaskEMCALClusterize::Init()
   if(fSelectCellMinE    <= 0) fSelectCellMinE    = 0.005;     
   if(fSelectCellMinFrac <= 0) fSelectCellMinFrac = 0.001;
   
+  //Centrality
+  if(fCentralityClass  == "") fCentralityClass  = "V0M";
+  fCentralityBin[0] = fCentralityBin[1]=-1;
+  
   if (fOCDBpath            == "") fOCDBpath            = "raw://" ;
   if (fOutputAODBranchName == "") fOutputAODBranchName = "newEMCALClusters" ;
   
@@ -990,6 +996,9 @@ void AliAnalysisTaskEMCALClusterize::Init()
     fDoTrackMatching  = clus->fDoTrackMatching;
     fOutputAODBranchName = clus->fOutputAODBranchName;
     for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = clus->fGeomMatrix[i] ;
+    fCentralityClass  = clus->fCentralityClass;
+    fCentralityBin[0] = clus->fCentralityBin[0];
+    fCentralityBin[1] = clus->fCentralityBin[1];
   }
   
   // Init geometry, I do not like much to do it like this ...
@@ -1477,12 +1486,20 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   //Remove the contents of AOD branch output list set in the previous event 
   fOutputAODBranch->Clear("C");
 
+  LoadBranches();
+  
+  //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
+  //If we need a centrality bin, we select only those events in the corresponding bin.
+  if( GetCentrality() && fCentralityBin[0] >= 0 && fCentralityBin[1] >= 0 )
+  {
+    Int_t cen = GetEventCentrality();
+    if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return ; //reject events out of bin.
+  }  
+  
   // intermediate array with new clusters : init the array only once or clear from previous event
   if(!fCaloClusterArr) fCaloClusterArr    = new TObjArray(10000);
   else                 fCaloClusterArr->Delete();//Clear("C"); it leaks?
 
-  LoadBranches();
-  
   //Get the event, do some checks and settings
   CheckAndGetEvent() ;
   
index 740acf4e36af0bb7ee98c6173f83fa3833fa4564..c1c9add3a0020ccff543a50f29c6e40a1000f827 100644 (file)
@@ -9,6 +9,8 @@
 class TTree;
 class TClonesArray;
 
+#include "AliCentrality.h";
+
 //EMCAL
 class AliEMCALGeometry;
 class AliEMCALCalibData;
@@ -60,7 +62,6 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
   void           SetImportGeometryFromFile(Bool_t  im, 
                                            TString pa = "")     { fImportGeometryFromFile = im ; 
                                                                   fImportGeometryFilePath = pa ; }    
-  
   //AOD methods
   void           SetAODBranchName(TString &name)                { fOutputAODBranchName = name  ; }
   void           FillAODFile(Bool_t yesno)                      { fFillAODFile         = yesno ; }
@@ -106,6 +107,18 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
     
   void           SetOADBFilePath(TString path)                  { fOADBFilePath      = path    ; }
   
+  // Centrality selection
+  
+  AliCentrality* GetCentrality()                                { return InputEvent()->GetCentrality() ; } //Look in AOD reader, different there
+  void     SetCentralityClass(TString name)                     { fCentralityClass   = name            ; }
+  TString  GetCentralityClass()                           const { return fCentralityClass              ; }
+  Int_t    GetEventCentrality()                                 { if(GetCentrality()) return GetCentrality()->GetCentralityPercentile(fCentralityClass) ;
+                                                                  else                return -1        ; }
+  void     SetCentralityBin(Int_t min, Int_t max) //Set the centrality bin to select the event. If used, then need to get percentile
+                                                                { fCentralityBin[0]=min ; fCentralityBin[1]=max ; }
+  Float_t  GetCentralityBin(Int_t i)                      const { if(i < 0 || i > 1) return -1 ; 
+                                                                  else               return fCentralityBin[i]   ; }
+  
  private:
     
   virtual void   FillCaloClusterInEvent();
@@ -175,10 +188,15 @@ class AliAnalysisTaskEMCALClusterize : public AliAnalysisTaskSE {
   Bool_t                 fAccessOADB ;             // Get calibration from OADB for EMCAL
   TString                fOADBFilePath ;           // Default path $ALICE_ROOT/OADB/EMCAL, if needed change
     
+  //Centrality
+  TString                fCentralityClass;         // Name of selected centrality class     
+  Int_t                  fCentralityBin[2];        // Minimum and maximum value of the centrality for the analysis
+  
+  
   AliAnalysisTaskEMCALClusterize(           const AliAnalysisTaskEMCALClusterize&); // not implemented
   AliAnalysisTaskEMCALClusterize& operator=(const AliAnalysisTaskEMCALClusterize&); // not implemented
 
-  ClassDef(AliAnalysisTaskEMCALClusterize, 21);
+  ClassDef(AliAnalysisTaskEMCALClusterize, 22);
 
 };
 
index c2eda382892eacd4530562f8a59da0726d2436f5..aad7705d91697bb8a7cf072fafbfd8bd225e5e0b 100644 (file)
@@ -1,26 +1,28 @@
 // $Id$
 
 AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
-  TString & arrayName,
-  const Bool_t  bFillAOD   = kFALSE,                                                
-  const Int_t   bMC        = kFALSE,
-  const Bool_t  exotic     = kTRUE,
-  const TString name       = "V1Unfold", 
-  const TString trigger    = "", 
-  const Bool_t  tm         = kTRUE, 
-  const Int_t   minEcell   = 50,
-  const Int_t   minEseed   = 100,
-  const Int_t   maxDeltaT  = 250,
-  const Int_t   timeWindow = 1000,
-  const Int_t   minEUnf    = 15, 
-  const Int_t   minFrac    = 1,
-  const Bool_t  bRecalE    = kTRUE,
-  const Bool_t  bBad       = kTRUE,
-  const Bool_t  bRecalT    = kTRUE,
-  const Bool_t  bNonLine   = kFALSE,
-  const Int_t   nRowDiff   = 1,
-  const Int_t   nColDiff   = 1
-)
+                                                       TString & arrayName,
+                                                       const Bool_t  bFillAOD   = kFALSE,                                                
+                                                       const Int_t   bMC        = kFALSE,
+                                                       const Bool_t  exotic     = kTRUE,
+                                                       const TString name       = "V1Unfold", 
+                                                       const TString trigger    = "", 
+                                                       const Bool_t  tm         = kTRUE, 
+                                                       const Int_t   minEcell   = 50,
+                                                       const Int_t   minEseed   = 100,
+                                                       const Int_t   maxDeltaT  = 250,
+                                                       const Int_t   timeWindow = 1000,
+                                                       const Int_t   minEUnf    = 15, 
+                                                       const Int_t   minFrac    = 1,
+                                                       const Bool_t  bRecalE    = kTRUE,
+                                                       const Bool_t  bBad       = kTRUE,
+                                                       const Bool_t  bRecalT    = kTRUE,
+                                                       const Bool_t  bNonLine   = kFALSE,
+                                                       const Int_t   minCen     = -1,
+                                                       const Int_t   maxCen     = -1,
+                                                       const Int_t   nRowDiff   = 1,
+                                                       const Int_t   nColDiff   = 1
+                                                       )
 {  
   // Get the pointer to the existing analysis manager via the static access method.
   //==============================================================================
@@ -41,15 +43,27 @@ AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
   
   printf("Passed Settings : mc %d, exo %d, name %s, trigger %s, tm %d\n",bMC,exotic,name.Data(),trigger.Data(),tm);
   printf("                  Ecell %d, Eseed %d, dT %d, wT %d, minUnf %d, minFrac %d \n",minEcell, minEseed,maxDeltaT,timeWindow,minEUnf,minFrac);
-  printf("                  recalE %d, bad %d, recalT %d, nonlin %d, rowDiff %d, colDiff %d \n",bRecalE,bBad,bRecalT,bNonLine,nRowDiff,nColDiff);
+  printf("                  recalE %d, bad %d, recalT %d, nonlin %d, minCen %d, maxCen %d, rowDiff %d, colDiff %d \n",bRecalE,bBad,bRecalT,bNonLine,minCen,maxCen,nRowDiff,nColDiff);
 
+  // Create name of task and AOD branch depending on different settings
+  
+  if(name.Contains("NxN")) arrayName = Form("%dx%d_Ecell%d_Eseed%d_DT%d_WT%d",2*nRowDiff+1,2*nColDiff+1,minEcell,minEseed,maxDeltaT,timeWindow);
+  else                     arrayName = Form(   "%s_Ecell%d_Eseed%d_DT%d_WT%d",              name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
+  
+  if(minCen != -1 && maxCen != -1)
+    arrayName+=Form("_Cen%d_%d",minCen,maxCen);
+
+  printf("Created Branch Name: \n",arrayName.Data());
+  
+  
   //-------------------------------------------------------
   // Init the task and do settings
   //-------------------------------------------------------
 
-  AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s_Ecell%d_Eseed%d_DT%d_WT%d",
-                                                                                       name.Data(),minEcell,minEseed,maxDeltaT,timeWindow));
+  AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s",arrayName.Data()));
 
+  clusterize->SetAODBranchName(arrayName);
+  
   //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
 
   // Some general settings to create AOD file in case we want to keep it
@@ -232,14 +246,7 @@ AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
   }
   
   // Set clusters branch name, make sure the analysis after this one reads this name
-  
-  if(name.Contains("NxN")) arrayName = Form("%dx%d_Ecell%d_Eseed%d_DT%d_WT%d",2*nRowDiff+1,2*nColDiff+1,minEcell,minEseed,maxDeltaT,timeWindow);
-  else                     arrayName = Form(   "%s_Ecell%d_Eseed%d_DT%d_WT%d",              name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
-  
-  clusterize->SetAODBranchName(arrayName);
-  
-  printf("Created Branch Name: \n",arrayName.Data());
-  
+    
   //-------------------------------------------------------
   // Final settings, pass to manager and set the containers
   //-------------------------------------------------------