adding AliPPVsMultUtils to event cuts
authormchojnac <Marek.Chojnacki@cern.ch>
Thu, 9 Oct 2014 13:28:34 +0000 (15:28 +0200)
committermchojnac <Marek.Chojnacki@cern.ch>
Thu, 9 Oct 2014 13:30:24 +0000 (15:30 +0200)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.h

index b24bb0e..d68e958 100644 (file)
@@ -36,7 +36,8 @@
 #include "AliAnalysisDataContainer.h"
 #include "AliSpectraBothEventCuts.h"
 #include "AliSpectraBothTrackCuts.h"
-#include "AliAnalysisUtils.h"  
+#include "AliAnalysisUtils.h"
+#include "AliPPVsMultUtils.h"  
 //#include "AliSpectraBothHistoManager.h"
 #include <iostream>
 
@@ -46,10 +47,10 @@ ClassImp(AliSpectraBothEventCuts)
 
 AliSpectraBothEventCuts::AliSpectraBothEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0),fAODEvent(AliSpectraBothTrackCuts::kAODobject), fTrackBits(0),fIsMC(0),fCentEstimator(""), fUseCentPatchAOD049(0), fUseSDDPatchforLHC11a(kDoNotCheckforSDD),fTriggerSettings(AliVEvent::kMB),fTrackCuts(0),
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0),fMaxChi2perNDFforVertex(0),
-fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),
+fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),fUseAliPPVsMultUtils(false),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVector(0)
 ,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),
-fHistoCentrality(0),fHistoMultiplicty(0),fAnalysisUtils(0)
+fHistoCentrality(0),fHistoMultiplicty(0),fAnalysisUtils(0),fAliPPVsMultUtils(0)
 
 {
   // Constructori
@@ -119,6 +120,8 @@ AliSpectraBothEventCuts::~AliSpectraBothEventCuts()
                delete fHistoMultiplicty;
        if(fAnalysisUtils)
                delete fAnalysisUtils;
+       if(fAliPPVsMultUtils)
+               delete fAliPPVsMultUtils;
 
 }
 //______________________________________________________
@@ -162,7 +165,7 @@ void AliSpectraBothEventCuts::InitHisto()
                fHistoCentrality = new TH2F("fHistoCentrality", "centrality",2,0,2,100,0.0,100);
 
        if(!fHistoMultiplicty)
-               fHistoMultiplicty= new TH2F("fHistoMultiplicty", "multiplicty estimator",2,0,2,100,0.0,100);
+               fHistoMultiplicty= new TH2F("fHistoMultiplicty", "multiplicty estimator",2,0,2,155,-4.5,150.5);
 
        TH1::AddDirectory(oldStatus);           
 }
@@ -231,48 +234,53 @@ Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCu
   if(vertex)
        fHistoVtxBefSel->Fill(vertex->GetZ());
   fIsSelected =kFALSE;
-  if(CheckVtx() && CheckCentralityCut() && CheckMultiplicityCut())
-   { //selection on vertex and Centrality
+  if(CheckVtx())
+   { //selection on vertex
 
     fIsSelected=kTRUE;
   }
   if(fIsSelected&&vertex)
- {
-      fHistoVtxAftSelwithoutZvertexCut->Fill(vertex->GetZ());
-      if(isMC)
-          fHistoVtxAftSelwithoutZvertexCutusingMCz->Fill(mcZ); 
-     if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
-     {
+  {
+       fHistoVtxAftSelwithoutZvertexCut->Fill(vertex->GetZ());
+       if(isMC)
+               fHistoVtxAftSelwithoutZvertexCutusingMCz->Fill(mcZ);    
+       if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
+       {
                fHistoCuts->Fill(kAcceptedEvents);
                fIsSelected=kTRUE;
                fHistoVtxAftSel->Fill(vertex->GetZ());
-     }
-    else       
-    {
+       }
+       else    
+       {
                fIsSelected=kFALSE;
-    }  
+       }       
   }
-
   if(fIsSelected)
-       fIsSelected=CheckQVectorCut(); 
+  {
+       if( CheckCentralityCut() && CheckMultiplicityCut() && CheckQVectorCut())
+               fIsSelected=kTRUE;
+  }    
 
 
 
   Int_t Nch=0;
-  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
-    AliVTrack* track =dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
+  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) 
+  {
+        AliVTrack* track =dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
    /* if(fAODEvent==AliSpectraBothTrackCuts::kESDobject)
                track=dynamic_cast<AliVTrack*>(esdevent->GetTrack(iTracks));
      else if (fAODEvent==AliSpectraBothTrackCuts::kAODobject)
                track=dynamic_cast<AliVTrack*>(aodevent->GetTrack(iTracks));
      else return false;*/
      
-    if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
-    fHistoEtaBefSel->Fill(track->Eta());
-    if(fIsSelected){
-      fHistoEtaAftSel->Fill(track->Eta());
-      Nch++;
-    }
+        if (!fTrackCuts->IsSelected(track,kFALSE)) 
+               continue;
+       fHistoEtaBefSel->Fill(track->Eta());
+        if(fIsSelected)
+       {
+               fHistoEtaAftSel->Fill(track->Eta());
+               Nch++;
+       }
   }
   if(fIsSelected)
        fHistoNChAftSel->Fill(Nch);
@@ -323,10 +331,22 @@ Bool_t AliSpectraBothEventCuts::CheckVtx()
 Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
 {
   // Check centrality cut
-  if ( fCentralityCutMax<0.0  &&  fCentralityCutMin<0.0 )  return kTRUE;   
-  Double_t cent=0;
-  if(!fUseCentPatchAOD049)cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentEstimator.Data());
-  else cent=ApplyCentralityPatchAOD049();
+ if ( fCentralityCutMax<0.0  &&  fCentralityCutMin<0.0 )  
+       return kTRUE;
+  Double_t cent=0;     
+  if(fUseAliPPVsMultUtils)
+  {
+       if(!fAliPPVsMultUtils)
+               fAliPPVsMultUtils=new AliPPVsMultUtils();
+       cent=fAliPPVsMultUtils->GetMultiplicityPercentile(fAOD,fCentEstimator.Data());
+  }    
+  else
+  {
+       if(!fUseCentPatchAOD049)
+               cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentEstimator.Data());
+       else 
+               cent=ApplyCentralityPatchAOD049();
+  }    
   fHistoCentrality->Fill(0.5,cent);    
   if ( (cent <= fCentralityCutMax)  &&  (cent >= fCentralityCutMin) )  
   {
index 7aad558..14e39a3 100644 (file)
@@ -20,6 +20,7 @@ class AliSpectraBothTrackCuts;
 #include "TNamed.h"
 #include "AliSpectraBothTrackCuts.h"
 #include "AliAnalysisUtils.h"  
+#include "AliPPVsMultUtils.h"  
 
 class AliSpectraBothEventCuts : public TNamed
 {
@@ -39,9 +40,9 @@ enum {kDoNotCheckforSDD=0,kwithSDD,kwithoutSDD};
   // Constructors
  AliSpectraBothEventCuts() : TNamed(), fAOD(0),fAODEvent(AliSpectraBothTrackCuts::kAODobject),fTrackBits(0), fIsMC(0), fCentEstimator(""), fUseCentPatchAOD049(0),fUseSDDPatchforLHC11a(kDoNotCheckforSDD),fTriggerSettings(AliVEvent::kMB),fTrackCuts(0),
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), 
-fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0), fMaxChi2perNDFforVertex(0),fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),
+fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0), fMaxChi2perNDFforVertex(0),fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),fUseAliPPVsMultUtils(false),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),
-fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),fHistoCentrality(0),fHistoMultiplicty(0),fAnalysisUtils(0)
+fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),fHistoCentrality(0),fHistoMultiplicty(0),fAnalysisUtils(0),fAliPPVsMultUtils(0)
 
 {}
   AliSpectraBothEventCuts(const char *name);
@@ -81,7 +82,8 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   void SetRunNumberRange(Int_t min,Int_t max); 
   void SetEtaRangeforMultiplictyCut(Float_t eta) {fetarangeofmultiplicitycut=eta;}
   void  SetAnalysisUtils(AliAnalysisUtils* inAnalysisUtils){fAnalysisUtils=inAnalysisUtils;}
-  
+  void SetUseAliPPVsMultUtils(Bool_t flag){fUseAliPPVsMultUtils=flag;} 
   UInt_t GetTrackType()  const    { return fTrackBits;}
   TH1I * GetHistoCuts()         {  return fHistoCuts; }
   TH1F * GetHistoVtxBefSel()         {  return fHistoVtxBefSel; }
@@ -114,7 +116,7 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   Float_t  GetMultiplicityCutMax()  const {  return fMultiplicityCutMax; }
   Float_t GetMaxChi2perNDFforVertex() const {return fMaxChi2perNDFforVertex;}
    AliAnalysisUtils* GetAnalysisUtils() const {return fAnalysisUtils; }
-
+Bool_t GetUseAliPPVsMultUtils() const {return fUseAliPPVsMultUtils;} 
 
   void InitHisto();    
   void   PrintCuts();
@@ -154,7 +156,8 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   Float_t        fMaxChi2perNDFforVertex; // maximum value of Chi2perNDF of vertex
   Int_t           fMinRun;                //minmum run number                   
   Int_t          fMaxRun;                //maximum run number   
-  Float_t         fetarangeofmultiplicitycut; // eta range fot multipilicty cut        
+  Float_t         fetarangeofmultiplicitycut; // eta range fot multipilicty cut 
+  Bool_t         fUseAliPPVsMultUtils;   // use  AliPPVsMultUtils for centrailty                       
   TH1I            *fHistoCuts;        // Cuts statistics
   TH1F            *fHistoVtxBefSel;        // Vtx distr before event selection         
   TH1F            *fHistoVtxAftSel;        // Vtx distr after event selection
@@ -172,12 +175,12 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCu
   TH2F                   *fHistoCentrality; // centrality histogram
   TH2F                   *fHistoMultiplicty; // multiplicty histogram
   AliAnalysisUtils *fAnalysisUtils;// Analysis Utils which have pile-up cut
-
+  AliPPVsMultUtils  *fAliPPVsMultUtils; //AliPPVsMultUtils class for centrailty
 
   AliSpectraBothEventCuts(const AliSpectraBothEventCuts&);
   AliSpectraBothEventCuts& operator=(const AliSpectraBothEventCuts&);
   
-  ClassDef(AliSpectraBothEventCuts, 10);
+  ClassDef(AliSpectraBothEventCuts, 11);
   
 };
 #endif