]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Select events within a given centrality bin, move centrality code from AliAnaPartCorr...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 22 Jan 2011 12:36:38 +0000 (12:36 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 22 Jan 2011 12:36:38 +0000 (12:36 +0000)
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h
PWG4/PartCorrBase/AliCaloTrackReader.cxx
PWG4/PartCorrBase/AliCaloTrackReader.h

index 21af4f2f63d0463bba951441bed117b3afa849aa..4c6556fc0c6176a97c5a517e3d781692bf57c09d 100755 (executable)
@@ -53,7 +53,6 @@ ClassImp(AliAnaPartCorrBaseClass)
     fOutputAODBranch(0x0), fNewAOD(kFALSE),
     fOutputAODName(""), fOutputAODClassName(""),
     fAODObjArrayName(""), fAddToHistogramsName(""),
-    fCentralityClass("V0M"),fCentralityOpt(10),
     fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fMCUtils(0x0), fNMS(0x0),
     fCaloUtils(0x0),
     fHistoPtBins(0),   fHistoPtMax(0.),   fHistoPtMin(0.),
@@ -363,23 +362,6 @@ Int_t AliAnaPartCorrBaseClass::GetEventNumber() const {
        return fReader->GetEventNumber() ; 
 }
 
-//__________________________________________________
-Int_t AliAnaPartCorrBaseClass::GetEventCentrality() const {
-  //Return current event centrality
-  
-  if(GetCentrality()){
-    if(fCentralityOpt==100)     return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass);
-    else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass); 
-    else if(fCentralityOpt==5)  return GetCentrality()->GetCentralityClass5(fCentralityClass);
-    else {
-      printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 5, 10 or 100\n",fCentralityOpt);
-      return 0;
-    } 
-  }
-  else return 0;
-  
-}
-
        
 //__________________________________________________
 AliStack *  AliAnaPartCorrBaseClass::GetMCStack() const {
index e15e90e7150f5ecae5dfee4d8eb7f5f2e953ddf0..2308cb8ab81f30184eaf24ae0a22a53e48a9a97b 100755 (executable)
@@ -87,12 +87,8 @@ public:
          return fCaloUtils->GetModuleNumber(cluster);}
        
   //Centrality
-  AliCentrality* GetCentrality() const  { return fReader->GetCentrality() ;}
-  void SetCentralityClass(TString name)    { fCentralityClass   = name       ;}
-  void SetCentralityOpt(Int_t opt)         { fCentralityOpt     = opt        ;}
-  TString GetCentralityClass()     const   { return fCentralityClass         ;}
-  Int_t   GetCentralityPercent()   const   { return fCentralityOpt           ;}
-  Int_t   GetEventCentrality()     const ;
+  AliCentrality* GetCentrality()      const  { return fReader->GetCentrality()      ;}
+  Int_t          GetEventCentrality() const  { return fReader->GetEventCentrality() ;}
  
   virtual void Terminate(TList * /*outputList*/) {;}
        
@@ -323,9 +319,6 @@ private:
   TString       fAODObjArrayName ;   //  Name of ref array kept in a TList in AliAODParticleCorrelation with clusters or track references.
   TString       fAddToHistogramsName;//  Add this string to histograms name
   
-  TString       fCentralityClass;    // Name of selected centrality class     
-  Int_t         fCentralityOpt;      // Option for the returned value of the centrality, possible options 5, 10, 100
-  
   //Analysis helper classes access pointers
   AliCaloPID               * fCaloPID; //! PID calculation
   AliFiducialCut           * fFidCut;  //! Acceptance cuts
@@ -360,7 +353,7 @@ private:
   Int_t   fHistoTrMMax   ;  // Maximum value of track multiplicity histogram range
   Int_t   fHistoTrMMin   ;  // Minimum value of track multiplicity histogram range
   
-  ClassDef(AliAnaPartCorrBaseClass,14)
+  ClassDef(AliAnaPartCorrBaseClass,15)
 } ;
 
 
index 8363f07a285a36bdf967c822f1c418128c94c8b4..097f1c92f1d9bfcb4b684395d2cd4e550b37ac31 100755 (executable)
@@ -69,7 +69,9 @@ ClassImp(AliCaloTrackReader)
     fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0), 
     fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL), 
     fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),fCaloFilterPatch(kFALSE),
-    fEMCALClustersListName(""),fZvtxCut(0.)
+    fEMCALClustersListName(""),fZvtxCut(0.),
+    fCentralityClass("V0M"),fCentralityOpt(10)
+
 {
   //Ctor
   
@@ -328,6 +330,9 @@ void AliCaloTrackReader::InitParameters()
 
   fZvtxCut   = 10.;
   
+  //Centrality
+  fCentralityBin[0]=fCentralityBin[1]=-1;
+  
 }
 
 //________________________________________________________________
@@ -363,7 +368,11 @@ void AliCaloTrackReader::Print(const Option_t * opt) const
        
   printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
   printf("Delta AOD File Name =     %s\n", fDeltaAODFileName.Data()) ;
+  if(GetCentrality())
+    printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
+
   printf("    \n") ;
+  
 } 
 
 //___________________________________________________
@@ -432,6 +441,13 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre
 //    
 //  }
        
+  //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 && fCentralityOpt==100){
+    Int_t cen = GetEventCentrality();
+    if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
+  }
+  
   //Fill Vertex array
   
   FillVertexArray();
@@ -508,6 +524,23 @@ void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
   }
 }
 
+//__________________________________________________
+Int_t AliCaloTrackReader::GetEventCentrality() const {
+  //Return current event centrality
+  
+  if(GetCentrality()){
+    if(fCentralityOpt==100)     return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass);
+    else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass); 
+    else if(fCentralityOpt==5)  return GetCentrality()->GetCentralityClass5(fCentralityClass);
+    else {
+      printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 5, 10 or 100\n",fCentralityOpt);
+      return 0;
+    } 
+  }
+  else return 0;
+  
+}
+
 //____________________________________________________________________________
 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const {
   //Return vertex position to be used for single event analysis
index f3804bab58d4eb7f7d624741b0ce05f4cd7c59e8..fb41c93d4757dd53b246d131727fd1d197a4904c 100755 (executable)
@@ -229,9 +229,16 @@ public:
   void SwitchOffCaloFilterPatch() {fCaloFilterPatch = kFALSE ; }
   Bool_t IsCaloFilterPatchOn()    {if(fDataType == kAOD) { return fCaloFilterPatch ; } 
                                    else                  { return kFALSE ; } }
-  
-  virtual AliCentrality* GetCentrality() const {return 0x0;}
-
+  //Centrality
+  virtual AliCentrality* GetCentrality() const {return 0x0;} //Actual method to recover the pointer is in the ESD/AODReader
+  void SetCentralityClass(TString name)    { fCentralityClass   = name       ;}
+  void SetCentralityOpt(Int_t opt)         { fCentralityOpt     = opt        ;}
+  TString GetCentralityClass()      const  { return fCentralityClass         ;}
+  Int_t   GetCentralityOpt()        const  { return fCentralityOpt           ;}
+  Int_t   GetEventCentrality()      const ;
+  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;  if(min>=0 && max > 0) fCentralityOpt = 100; }
+  Float_t GetCentralityBin(Int_t i) const  { if(i < 0 || i > 1) return 0 ; else return fCentralityBin[i] ; }
   
   //MC reader methods:
   
@@ -320,8 +327,13 @@ public:
   Bool_t           fCaloFilterPatch;    // CaloFilter patch
   TString          fEMCALClustersListName; //Alternative list of clusters produced elsewhere and not from InputEvent
   Float_t          fZvtxCut ;             // Cut on vertex position  
-
-  ClassDef(AliCaloTrackReader,22)
+  
+  //Centrality
+  TString          fCentralityClass;    // Name of selected centrality class     
+  Int_t            fCentralityOpt;      // Option for the returned value of the centrality, possible options 5, 10, 100
+  Int_t            fCentralityBin[2];   // Minimum and maximum value of the centrality for the analysis
+  
+  ClassDef(AliCaloTrackReader,23)
 } ;