]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/SPECTRA/AliProtonAnalysis.h
Including time.h
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysis.h
index 24670abb86f83ab3e029b26441ac11584adeaa90..e53b457e94572e40af24b44d05b214e5c44c2cc5 100644 (file)
 
 #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;
@@ -32,32 +32,55 @@ class AliESDtrack;
 class AliExternalTrackParam;
 class AliStack;
 class AliESDVertex;
+class AliProtonAnalysisBase;
 
 class AliProtonAnalysis : public TObject {
  public:
+  enum {
+    kStepSurvived        = 0,
+    kStepIsPrimary       = 1,
+    kStepIdentified      = 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 SetEtaMode() {fAnalysisEtaMode = kTRUE;}
+  void SetBaseAnalysis(AliProtonAnalysisBase * const baseAnalysis) {
+    fProtonAnalysisBase = baseAnalysis;}
+  AliProtonAnalysisBase *GetProtonAnalysisBaseObject() const {
+    return fProtonAnalysisBase;}
 
-  void UseTPCOnly() {fUseTPCOnly = kTRUE;}
-  void UseHybridTPC() {fUseHybridTPC = kTRUE;}
-  
   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, 
               const AliESDVertex *vertex);
   void Analyze(AliAODEvent *fAOD);
   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();
@@ -66,111 +89,59 @@ class AliProtonAnalysis : public TObject {
   TH1D *GetAntiProtonCorrectedYHistogram();
   TH1D *GetProtonCorrectedPtHistogram();
   TH1D *GetAntiProtonCorrectedPtHistogram();
-  
+
+  TH1F *GetEventStatistics() {return fHistEventStats;}
+
+  TList *GetYRatioHistogramsInPtBins();
   TH1D *GetYRatioHistogram();
-  TH1D *GetYRatioCorrectedHistogram(TH2D *gCorrectionMapProtons,
-                                   TH2D *gCorrectionMapAntiProtons);
+  TH1D *GetYRatioCorrectedHistogram();
   TH1D *GetPtRatioHistogram();
-  TH1D *GetPtRatioCorrectedHistogram(TH2D *gCorrectionMapProtons,
-                                    TH2D *gCorrectionMapAntiProtons);
+  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    SetPointOnITSLayer1() {fPointOnITSLayer1Flag = kTRUE;}
-  void    SetPointOnITSLayer2() {fPointOnITSLayer2Flag = kTRUE;}
-  void    SetPointOnITSLayer3() {fPointOnITSLayer3Flag = kTRUE;}
-  void    SetPointOnITSLayer4() {fPointOnITSLayer4Flag = kTRUE;}
-  void    SetPointOnITSLayer5() {fPointOnITSLayer5Flag = kTRUE;}
-  void    SetPointOnITSLayer6() {fPointOnITSLayer6Flag = kTRUE;}
-  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    SetMaxDCAXY(Double_t maxDCAXY) {
-    fMaxDCAXY = maxDCAXY;
-    fMaxDCAXYFlag = kTRUE;
-  }
-  void    SetMaxDCAXYTPC(Double_t maxDCAXY) {
-    fMaxDCAXYTPC = maxDCAXY;
-    fMaxDCAXYTPCFlag = kTRUE;
-  }
-  void    SetMaxDCAZ(Double_t maxDCAZ) {
-    fMaxDCAZ = maxDCAZ;
-    fMaxDCAZFlag = kTRUE;
-  }
-  void    SetMaxDCAZTPC(Double_t maxDCAZ) {
-    fMaxDCAZTPC = maxDCAZ;
-    fMaxDCAZTPCFlag = kTRUE;
-  }
-  void    SetMaxConstrainChi2(Double_t maxConstrainChi2) {
-    fMaxConstrainChi2 = maxConstrainChi2;
-    fMaxConstrainChi2Flag = kTRUE;
-  }
-  void    SetITSRefit() {fITSRefitFlag = kTRUE;}
-  void    SetTPCRefit() {fTPCRefitFlag = kTRUE;}
-  void    SetESDpid() {fESDpidFlag = kTRUE;}
-  void    SetTPCpid() {fTPCpidFlag = kTRUE;}
-
-  //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 SetCorrectionMapForTracking(const char* filename);
+  TH2D *GetCorrectionMapForTrackingProtons() {
+    return fHistYPtCorrectionForTrackingProtons;}
+  TH2D *GetCorrectionMapForTrackingAntiProtons() {
+    return fHistYPtCorrectionForTrackingAntiProtons;}
+
+
+  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);}
@@ -180,64 +151,24 @@ class AliProtonAnalysis : public TObject {
  private:
   AliProtonAnalysis(const AliProtonAnalysis&); // Not implemented
   AliProtonAnalysis& operator=(const AliProtonAnalysis&); // Not implemented
-
-  Bool_t   IsAccepted(AliESDEvent *esd,
-                     const AliESDVertex *vertex, 
-                     AliESDtrack *track);
-  Bool_t   IsInPhaseSpace(AliESDtrack *track);
-
-  Float_t  GetSigmaToVertex(AliESDtrack* esdTrack); 
-  Double_t Rapidity(Double_t Px, Double_t Py, Double_t Pz);
   
-  Bool_t fAnalysisEtaMode; //run the analysis in eta or y
+  AliProtonAnalysisBase *fProtonAnalysisBase;//base analysis object
 
-  Int_t fNBinsY; //number of bins in y
-  Float_t fMinY, fMaxY; //min & max value of y
+  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
-  Double_t fMaxDCAXY, fMaxDCAXYTPC; //max DCA xy
-  Double_t fMaxDCAZ, fMaxDCAZTPC; //max DCA z
-  Double_t fMaxConstrainChi2; //max constrain chi2 - vertex
-  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 fMaxDCAXYFlag, fMaxDCAXYTPCFlag; //shows if this cut is used or not
-  Bool_t fMaxDCAZFlag, fMaxDCAZTPCFlag; //shows if this cut is used or not
-  Bool_t fMaxConstrainChi2Flag; //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
-  Bool_t fPointOnITSLayer1Flag, fPointOnITSLayer2Flag; //shows if this cut is used or not
-  Bool_t fPointOnITSLayer3Flag, fPointOnITSLayer4Flag; //shows if this cut is used or not
-  Bool_t fPointOnITSLayer5Flag, fPointOnITSLayer6Flag; //shows if this cut is used or not
+  Double_t fMinPt, fMaxPt; //min & max value of pT
   
-  //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
-  Bool_t fUseHybridTPC; //kTRUE if TPC info is used for momentum - PID and ITS for vertex & points
-
   //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 
@@ -250,8 +181,32 @@ 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 *fHistYPtCorrectionForTrackingProtons;//correction factors for the tracking efficiency (protons)
+  TH2D *fHistYPtCorrectionForTrackingAntiProtons;//correction factors for the tracking efficiency (antiprotons)
+  Bool_t fCorrectForTrackingFlag;//correct for the tracking 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
+
+  ClassDef(AliProtonAnalysis,1);
 };
 
 #endif