]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/SPECTRA/AliProtonAnalysis.h
Proper normalization for the net-protons
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysis.h
index ca38e2535d1b1801dccd139a8aeff8567f924b01..4f94c77363aaa82108f6f8e64e943ccaf8e21e72 100644 (file)
 //                       Class AliProtonAnalysis
 //   This is the class for the baryon (proton) analysis
 //
-//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//    Origin: Panos Christakoglou | Panos.Christakoglou@cern.ch
 //-------------------------------------------------------------------------
 
 #include "TObject.h"
 #include "TH1I.h"
-#include "TList.h"
-
-#include "AliPID.h"
 
 class TF1;
 class TH2D;
 class TH1F;
+class TList;
 
+//#include "AliPID.h"
+class AliPID;
 #include "AliCFContainer.h"
 class AliCFDataGrid;
 class AliAODEvent;
@@ -31,28 +31,56 @@ class AliESDEvent;
 class AliESDtrack;
 class AliExternalTrackParam;
 class AliStack;
+class AliESDVertex;
+class AliProtonAnalysisBase;
 
 class AliProtonAnalysis : public TObject {
  public:
+  enum {
+    kStepIdentified      = 0,
+    kStepIsPrimary       = 1,
+    kStepSurvived        = 2,
+    kStepInPhaseSpace    = 3,
+    kNSteps = 4
+  };
   AliProtonAnalysis();
   AliProtonAnalysis(Int_t nbinsY, Float_t fLowY, Float_t fHighY,
                    Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt);
+  AliProtonAnalysis(Int_t nbinsY, Double_t *gY,
+                   Int_t nbinsPt, Double_t *gPt);
   virtual ~AliProtonAnalysis();
 
-  void UseTPCOnly() {fUseTPCOnly = kTRUE;}
-  
+  void SetBaseAnalysis(AliProtonAnalysisBase * const baseAnalysis) {
+    fProtonAnalysisBase = baseAnalysis;}
+  AliProtonAnalysisBase *GetProtonAnalysisBaseObject() const {
+    return fProtonAnalysisBase;}
+
   void InitAnalysisHistograms(Int_t nbinsY, Float_t fLowY, Float_t fHighY,
                              Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt);
+  void InitAnalysisHistograms(Int_t nbinsY, Double_t *gY,
+                             Int_t nbinsPt, Double_t *gPt);
   Bool_t ReadFromFile(const char* filename);
-  void Analyze(AliESDEvent *fESD);
+  void Analyze(AliESDEvent *fESD, 
+              const AliESDVertex *vertex);
   void Analyze(AliAODEvent *fAOD);
-  void Analyze(AliStack *stack);
+  void Analyze(AliStack *stack, Bool_t iInclusive);
   
-  AliCFContainer *GetProtonContainer() {return fProtonContainer;}
-  AliCFContainer *GetAntiProtonContainer() {return fAntiProtonContainer;}
-
-  TH2D *GetProtonYPtHistogram() {return fHistYPtProtons;}
-  TH2D *GetAntiProtonYPtHistogram() {return fHistYPtAntiProtons;}
+  //QA for real data
+  void InitQA();
+  void FillQA(AliESDEvent *esd,
+             const AliESDVertex *vertex, 
+             AliESDtrack* track);
+  TList *GetQAList() {return fGlobalQAList;}
+
+  AliCFContainer *GetProtonContainer() const {return fProtonContainer;}
+  AliCFContainer *GetAntiProtonContainer() const {return fAntiProtonContainer;}
+
+  TH2D *GetProtonYPtHistogram() const {return fHistYPtProtons;}
+  TH2D *GetAntiProtonYPtHistogram() const {return fHistYPtAntiProtons;}
+  TH2D *GetProtonYPtCorrectedHistogram() const {
+    return fHistYPtProtonsCorrected;}
+  TH2D *GetAntiProtonCorrectedYPtHistogram() const {
+    return fHistYPtAntiProtonsCorrected;}
   TH1D *GetProtonYHistogram();
   TH1D *GetAntiProtonYHistogram();
   TH1D *GetProtonPtHistogram();
@@ -61,89 +89,48 @@ class AliProtonAnalysis : public TObject {
   TH1D *GetAntiProtonCorrectedYHistogram();
   TH1D *GetProtonCorrectedPtHistogram();
   TH1D *GetAntiProtonCorrectedPtHistogram();
-  
+
+  TH1F *GetEventStatistics() {return fHistEventStats;}
+
+  TList *GetYRatioHistogramsInPtBins();
   TH1D *GetYRatioHistogram();
+  TH1D *GetYRatioCorrectedHistogram();
   TH1D *GetPtRatioHistogram();
+  TH1D *GetPtRatioCorrectedHistogram();
   TH1D *GetYAsymmetryHistogram();
   TH1D *GetPtAsymmetryHistogram();
+  TH2D *GetProtonsAbsorptionMaps() {return fHistEfficiencyYPtProtons;}
+  TH2D *GetAntiProtonsAbsorptionMaps() {return fHistEfficiencyYPtAntiProtons;}
 
-  TH1I *GetEventHistogram() {return fHistEvents;}
+  TH1I *GetEventHistogram() const {return fHistEvents;}
 
-  Int_t   GetNumberOfAnalyzedEvents() {return (Int_t)fHistEvents->GetEntries();} 
+  Int_t   GetNumberOfAnalyzedEvents() {return (Int_t)fHistEventStats->GetBinContent(5);}
   Bool_t  PrintMean(TH1 *hist, Double_t edge);
   Bool_t  PrintYields(TH1 *hist, Double_t edge); 
 
-  //Cut functions
-  void    SetMinITSClusters(Int_t minITSClusters) {
-    fMinITSClusters = minITSClusters;
-    fMinITSClustersFlag = kTRUE;
-  }
-  void    SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
-    fMaxChi2PerITSCluster = maxChi2PerITSCluster;
-    fMaxChi2PerITSClusterFlag = kTRUE;
-  }
-  void    SetMinTPCClusters(Int_t minTPCClusters) {
-    fMinTPCClusters = minTPCClusters;
-    fMinTPCClustersFlag = kTRUE;
-  }
-  void    SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
-    fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
-    fMaxChi2PerTPCClusterFlag = kTRUE;
-  }
-  void    SetMaxCov11(Double_t maxCov11) {
-    fMaxCov11 = maxCov11; fMaxCov11Flag = kTRUE;}
-  void    SetMaxCov22(Double_t maxCov22) {
-    fMaxCov22 = maxCov22; fMaxCov22Flag = kTRUE;}
-  void    SetMaxCov33(Double_t maxCov33) {
-    fMaxCov33 = maxCov33; fMaxCov33Flag = kTRUE;}
-  void    SetMaxCov44(Double_t maxCov44) {
-    fMaxCov44 = maxCov44; fMaxCov44Flag = kTRUE;}
-  void    SetMaxCov55(Double_t maxCov55) {
-    fMaxCov55 = maxCov55; fMaxCov55Flag = kTRUE;}
-  void    SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
-    fMaxSigmaToVertex = maxSigmaToVertex;
-    fMaxSigmaToVertexFlag = kTRUE;
-  }
-  void    SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
-    fMaxSigmaToVertexTPC = maxSigmaToVertex;
-    fMaxSigmaToVertexTPCFlag = kTRUE;
-  }
-  void    SetITSRefit() {fITSRefitFlag = kTRUE;}
-  void    SetTPCRefit() {fTPCRefitFlag = kTRUE;}
-  void    SetESDpid() {fESDpidFlag = kTRUE;}
-  void    SetTPCpid() {fTPCpidFlag = kTRUE;}
-
-  //QA histograms
-  void SetQAOn();
-  void SetQAYPtBins(Int_t nbinsY, Double_t minY, Double_t maxY,
-                   Int_t nbinsPt, Double_t minPt, Double_t maxPt);
-  void InitQA();
-  void RunQA(AliStack *stack, AliESDEvent *esd);
-  TList *GetGlobalQAList() {return fGlobalQAList;}
-
-  //Prior probabilities
-  void SetPriorProbabilities(Double_t *partFrac) {
-    for(Int_t i = 0; i < AliPID::kSPECIESN; i++) fPartFrac[i] = partFrac[i];} 
-  void SetPriorProbabilityFunctions(TF1 *felectron, TF1 *fmuon, TF1 *fpion, TF1 *fkaon, TF1 *fproton) {
-    fFunctionProbabilityFlag = kTRUE;
-    fElectronFunction = felectron; 
-    fMuonFunction = fmuon; 
-    fPionFunction = fpion;
-    fKaonFunction = fkaon;
-    fProtonFunction = fproton;
-  } 
-  Double_t GetParticleFraction(Int_t i, Double_t p);
-
   //interface to the correction framework
+  void Correct();
   void Correct(Int_t step);
   Bool_t ReadCorrectionContainer(const char* filename);
-  TList *GetCorrectionListProtons2D() {return fCorrectionListProtons2D;} 
-  TList *GetEfficiencyListProtons1D() {return fEfficiencyListProtons1D;} 
-  TList *GetCorrectionListProtons1D() {return fCorrectionListProtons1D;} 
-  TList *GetCorrectionListAntiProtons2D() {return fCorrectionListAntiProtons2D;} 
-  TList *GetEfficiencyListAntiProtons1D() {return fEfficiencyListAntiProtons1D;} 
-  TList *GetCorrectionListAntiProtons1D() {return fCorrectionListAntiProtons1D;} 
-  
+  void SetCorrectionMapForFeedDown(const char* filename);
+  TH2D *GetCorrectionMapForFeedDownProtons() {
+    return fHistYPtCorrectionForFeedDownProtons;}
+  TH2D *GetCorrectionMapForFeedDownAntiProtons() {
+    return fHistYPtCorrectionForFeedDownAntiProtons;}
+  void SetCorrectionMapForCuts(const char* filename);
+  TH2D *GetCorrectionMapForCutsProtons() {
+    return fHistYPtCorrectionForCutsProtons;}
+  TH2D *GetCorrectionMapForCutsAntiProtons() {
+    return fHistYPtCorrectionForCutsAntiProtons;}
+  void SetCorrectionMapForSecondaries(const char* filename);
+  TH2D *GetCorrectionMapForSecondaries() {
+    return fHistYPtCorrectionForSecondaries;}
+  void SetCorrectionMapForCrossSection(const char* filename);
+  TH2D *GetProtonsCorrectionMapForCrossSection() {
+    return fHistCorrectionForCrossSectionYPtProtons;}
+  TH2D *GetAntiProtonsCorrectionMapForCrossSection() {
+    return fHistCorrectionForCrossSectionYPtAntiProtons;}
+
   //iStep=0->MC - iStep=1->Acceptance - iStep=2->Reconstruction - iStep=3->PID
   TH1D  *GetUncorrectedProtonYHistogram(Int_t iStep) {return fProtonContainer->ShowProjection(0, iStep);}
   TH1D  *GetUncorrectedProtonPtHistogram(Int_t iStep) {return fProtonContainer->ShowProjection(1, iStep);}
@@ -153,62 +140,24 @@ class AliProtonAnalysis : public TObject {
  private:
   AliProtonAnalysis(const AliProtonAnalysis&); // Not implemented
   AliProtonAnalysis& operator=(const AliProtonAnalysis&); // Not implemented
-
-  Bool_t   IsAccepted(AliESDtrack *track);
-  void     FillQA(AliESDtrack *track, AliStack *stack);
-  Float_t  GetSigmaToVertex(AliESDtrack* esdTrack); 
-  Double_t Rapidity(Double_t Px, Double_t Py, Double_t Pz);
   
-  Int_t fNBinsY; //number of bins in y
-  Float_t fMinY, fMaxY; //min & max value of y
+  AliProtonAnalysisBase *fProtonAnalysisBase;//base analysis object
+
+  Int_t fNBinsY; //number of bins in y or eta
+  Double_t fMinY, fMaxY; //min & max value of y or eta
   Int_t fNBinsPt;  //number of bins in pT
-  Float_t fMinPt, fMaxPt; //min & max value of pT
-  
-  //cuts
-  Int_t fMinTPCClusters, fMinITSClusters; //min TPC & ITS clusters
-  Double_t fMaxChi2PerTPCCluster, fMaxChi2PerITSCluster; //max chi2 per TPC & ITS cluster
-  Double_t fMaxCov11, fMaxCov22, fMaxCov33, fMaxCov44, fMaxCov55; //max values of cov. matrix
-  Double_t fMaxSigmaToVertex; //max sigma to vertex cut
-  Double_t fMaxSigmaToVertexTPC; //max sigma to vertex cut
-  Bool_t fMinTPCClustersFlag, fMinITSClustersFlag; //shows if this cut is used or not
-  Bool_t fMaxChi2PerTPCClusterFlag, fMaxChi2PerITSClusterFlag; //shows if this cut is used or not
-  Bool_t fMaxCov11Flag, fMaxCov22Flag, fMaxCov33Flag, fMaxCov44Flag, fMaxCov55Flag; //shows if this cut is used or not
-  Bool_t fMaxSigmaToVertexFlag; //shows if this cut is used or not
-  Bool_t fMaxSigmaToVertexTPCFlag; //shows if this cut is used or not
-  Bool_t fITSRefitFlag, fTPCRefitFlag; //shows if this cut is used or not
-  Bool_t fESDpidFlag, fTPCpidFlag; //shows if this cut is used or not
+  Double_t fMinPt, fMaxPt; //min & max value of pT
   
-  //QA histograms
-  //Bool_t fQAHistograms; //Boolean to activate the QA histograms
-  TList *fGlobalQAList; //TList storing the directories for the QA histograms
-  TList *fQA2DList; //TList storing the accepted primary/secondary (anti)protons
-  TList *fQAPrimaryProtonsAcceptedList; //list of the QA histos for accepted primary protons
-  TList *fQAPrimaryProtonsRejectedList; //list of the QA histos for rejected primary protons
-  TList *fQASecondaryProtonsAcceptedList; //list of the QA histos for accepted secondary protons
-  TList *fQASecondaryProtonsRejectedList; //list of the QA histos for rejected secondary protons
-  TList *fQAPrimaryAntiProtonsAcceptedList; //list of the QA histos for accepted primary antiprotons
-  TList *fQAPrimaryAntiProtonsRejectedList; //list of the QA histos for rejected primary antiprotons
-  TList *fQASecondaryAntiProtonsAcceptedList; //list of the QA histos for accepted secondary antiprotons
-  TList *fQASecondaryAntiProtonsRejectedList; //list of the QA histos for rejected secondary antiprotons
-
-  //pid
-  Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
-  Double_t fPartFrac[10]; //prior probabilities
-  TF1  *fElectronFunction; //momentum dependence of the prior probs
-  TF1  *fMuonFunction; //momentum dependence of the prior probs
-  TF1  *fPionFunction; //momentum dependence of the prior probs
-  TF1  *fKaonFunction; //momentum dependence of the prior probs
-  TF1  *fProtonFunction; //momentum dependence of the prior probs
-
-  //Detectors
-  Bool_t fUseTPCOnly; //kTRUE if TPC only information is used
-
   //Analysis containers
   AliCFContainer *fProtonContainer; //container for protons
   AliCFContainer *fAntiProtonContainer; //container for antiprotons
   TH1I *fHistEvents; //event counter
   TH2D *fHistYPtProtons; //Y-Pt of Protons
   TH2D *fHistYPtAntiProtons; // Y-Pt of Antiprotons
+  TH2D *fHistYPtProtonsCorrected; //Y-Pt of Protons (corrected)
+  TH2D *fHistYPtAntiProtonsCorrected; // Y-Pt of Antiprotons (corrected)
+  TH1F *fHistEventStats;//Event statistics
+  TList *fYRatioInPtBinsList;//TList of the eta dependent ratios for each pT bin
 
   //Corrections
   TList *fEffGridListProtons; //list for the efficiency grid - protons 
@@ -221,8 +170,30 @@ class AliProtonAnalysis : public TObject {
   TList *fCorrectionListAntiProtons1D; //list for the 1d corrections 
   AliCFDataGrid *fCorrectProtons; //corrected data grid for protons
   AliCFDataGrid *fCorrectAntiProtons; //corrected data grid for antiprotons
-
-  ClassDef(AliProtonAnalysis,0);
+  TH2D *fHistEfficiencyYPtProtons;//efficiency 2D for the corrections - protons
+  TH2D *fHistEfficiencyYPtAntiProtons;//efficiency 2D for the corrections - antiprotons
+  TH2D *fHistCorrectionForCrossSectionYPtProtons;//correction for the proper cross-section - 2D protons
+  TH2D *fHistCorrectionForCrossSectionYPtAntiProtons;//correction for the proper cross-section - 2D antiprotons
+  Bool_t fHistCorrectionForCrossSectionFlag;//correct for cross-section
+  TH2D *fHistYPtCorrectionForCutsProtons;//correction factors for the cut efficiency (protons)
+  TH2D *fHistYPtCorrectionForCutsAntiProtons;//correction factors for the cut efficiency (antiprotons)
+  Bool_t fCorrectForCutsFlag;//correct for the cut efficiency
+  TH2D *fHistYPtCorrectionForFeedDownProtons;//correction factors for the feed-down contamination (protons)
+  TH2D *fHistYPtCorrectionForFeedDownAntiProtons;//correction factors for the feed-down contamination (antiprotons)
+  Bool_t fCorrectForFeedDownFlag;//correct for cut efficiency
+  TH2D *fHistYPtCorrectionForSecondaries;//correction factors for the background protons
+  Bool_t fCorrectForSecondariesFlag;//correct for secondaries
+
+  //QA lists
+  TList *fGlobalQAList; //global list
+  TList *fQA2DList; //QA 2D list
+  TList *fQAProtonsAcceptedList; //accepted protons
+  TList *fQAProtonsRejectedList; //rejected protons
+  TList *fQAAntiProtonsAcceptedList; //accepted antiprotons
+  TList *fQAAntiProtonsRejectedList; //rejected antiprotons
+  Bool_t fInitQAFlag;//Init flag
+
+  ClassDef(AliProtonAnalysis,1);
 };
 
 #endif