]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonAnalysis.h
Moving to alicecaf + addition of the DCA in the QA
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysis.h
1 #ifndef ALIPROTONANALYSIS_H
2 #define ALIPROTONANALYSIS_H
3
4 /*  See cxx source for full Copyright notice */
5
6
7 /* $Id$ */
8
9 //-------------------------------------------------------------------------
10 //                       Class AliProtonAnalysis
11 //   This is the class for the baryon (proton) analysis
12 //
13 //    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
14 //-------------------------------------------------------------------------
15
16 #include "TObject.h"
17 #include "TH1I.h"
18 #include "TList.h"
19
20 #include "AliPID.h"
21
22 class TF1;
23 class TH2D;
24 class TH1F;
25
26 #include "AliCFContainer.h"
27 class AliCFDataGrid;
28 class AliAODEvent;
29 class AliAODtrack;
30 class AliESDEvent;
31 class AliESDtrack;
32 class AliExternalTrackParam;
33 class AliStack;
34
35 class AliProtonAnalysis : public TObject {
36  public:
37   AliProtonAnalysis();
38   AliProtonAnalysis(Int_t nbinsY, Float_t fLowY, Float_t fHighY,
39                     Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt);
40   virtual ~AliProtonAnalysis();
41
42   void UseTPCOnly() {fUseTPCOnly = kTRUE;}
43   
44   void InitAnalysisHistograms(Int_t nbinsY, Float_t fLowY, Float_t fHighY,
45                               Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt);
46   Bool_t ReadFromFile(const char* filename);
47   void Analyze(AliESDEvent *fESD);
48   void Analyze(AliAODEvent *fAOD);
49   void Analyze(AliStack *stack);
50   
51   AliCFContainer *GetProtonContainer() {return fProtonContainer;}
52   AliCFContainer *GetAntiProtonContainer() {return fAntiProtonContainer;}
53
54   TH2D *GetProtonYPtHistogram() {return fHistYPtProtons;}
55   TH2D *GetAntiProtonYPtHistogram() {return fHistYPtAntiProtons;}
56   TH1D *GetProtonYHistogram();
57   TH1D *GetAntiProtonYHistogram();
58   TH1D *GetProtonPtHistogram();
59   TH1D *GetAntiProtonPtHistogram();
60   TH1D *GetProtonCorrectedYHistogram();
61   TH1D *GetAntiProtonCorrectedYHistogram();
62   TH1D *GetProtonCorrectedPtHistogram();
63   TH1D *GetAntiProtonCorrectedPtHistogram();
64   
65   TH1D *GetYRatioHistogram();
66   TH1D *GetPtRatioHistogram();
67   TH1D *GetYAsymmetryHistogram();
68   TH1D *GetPtAsymmetryHistogram();
69
70   TH1I *GetEventHistogram() {return fHistEvents;}
71
72   Int_t   GetNumberOfAnalyzedEvents() {return (Int_t)fHistEvents->GetEntries();} 
73   Bool_t  PrintMean(TH1 *hist, Double_t edge);
74   Bool_t  PrintYields(TH1 *hist, Double_t edge); 
75
76   //Cut functions
77   void    SetMinITSClusters(Int_t minITSClusters) {
78     fMinITSClusters = minITSClusters;
79     fMinITSClustersFlag = kTRUE;
80   }
81   void    SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
82     fMaxChi2PerITSCluster = maxChi2PerITSCluster;
83     fMaxChi2PerITSClusterFlag = kTRUE;
84   }
85   void    SetMinTPCClusters(Int_t minTPCClusters) {
86     fMinTPCClusters = minTPCClusters;
87     fMinTPCClustersFlag = kTRUE;
88   }
89   void    SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
90     fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
91     fMaxChi2PerTPCClusterFlag = kTRUE;
92   }
93   void    SetMaxCov11(Double_t maxCov11) {
94     fMaxCov11 = maxCov11; fMaxCov11Flag = kTRUE;}
95   void    SetMaxCov22(Double_t maxCov22) {
96     fMaxCov22 = maxCov22; fMaxCov22Flag = kTRUE;}
97   void    SetMaxCov33(Double_t maxCov33) {
98     fMaxCov33 = maxCov33; fMaxCov33Flag = kTRUE;}
99   void    SetMaxCov44(Double_t maxCov44) {
100     fMaxCov44 = maxCov44; fMaxCov44Flag = kTRUE;}
101   void    SetMaxCov55(Double_t maxCov55) {
102     fMaxCov55 = maxCov55; fMaxCov55Flag = kTRUE;}
103   void    SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
104     fMaxSigmaToVertex = maxSigmaToVertex;
105     fMaxSigmaToVertexFlag = kTRUE;
106   }
107   void    SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
108     fMaxSigmaToVertexTPC = maxSigmaToVertex;
109     fMaxSigmaToVertexTPCFlag = kTRUE;
110   }
111   void    SetMaxDCAXY(Double_t maxDCAXY) {
112     fMaxDCAXY = maxDCAXY;
113     fMaxDCAXYFlag = kTRUE;
114   }
115   void    SetMaxDCAXYTPC(Double_t maxDCAXY) {
116     fMaxDCAXYTPC = maxDCAXY;
117     fMaxDCAXYTPCFlag = kTRUE;
118   }
119   void    SetMaxDCAZ(Double_t maxDCAZ) {
120     fMaxDCAZ = maxDCAZ;
121     fMaxDCAZFlag = kTRUE;
122   }
123   void    SetMaxDCAZTPC(Double_t maxDCAZ) {
124     fMaxDCAZTPC = maxDCAZ;
125     fMaxDCAZTPCFlag = kTRUE;
126   }
127   void    SetMaxConstrainChi2(Double_t maxConstrainChi2) {
128     fMaxConstrainChi2 = maxConstrainChi2;
129     fMaxConstrainChi2Flag = kTRUE;
130   }
131   void    SetITSRefit() {fITSRefitFlag = kTRUE;}
132   void    SetTPCRefit() {fTPCRefitFlag = kTRUE;}
133   void    SetESDpid() {fESDpidFlag = kTRUE;}
134   void    SetTPCpid() {fTPCpidFlag = kTRUE;}
135
136   //QA histograms
137   void SetQAOn();
138   void SetQAYPtBins(Int_t nbinsY, Double_t minY, Double_t maxY,
139                     Int_t nbinsPt, Double_t minPt, Double_t maxPt);
140   void InitQA();
141   void RunQA(AliStack *stack, AliESDEvent *esd);
142   TList *GetGlobalQAList() {return fGlobalQAList;}
143
144   //Prior probabilities
145   void SetPriorProbabilities(Double_t *partFrac) {
146     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) fPartFrac[i] = partFrac[i];} 
147   void SetPriorProbabilityFunctions(TF1 *felectron, TF1 *fmuon, TF1 *fpion, TF1 *fkaon, TF1 *fproton) {
148     fFunctionProbabilityFlag = kTRUE;
149     fElectronFunction = felectron; 
150     fMuonFunction = fmuon; 
151     fPionFunction = fpion;
152     fKaonFunction = fkaon;
153     fProtonFunction = fproton;
154   } 
155   Double_t GetParticleFraction(Int_t i, Double_t p);
156
157   //interface to the correction framework
158   void Correct(Int_t step);
159   Bool_t ReadCorrectionContainer(const char* filename);
160   TList *GetCorrectionListProtons2D() {return fCorrectionListProtons2D;} 
161   TList *GetEfficiencyListProtons1D() {return fEfficiencyListProtons1D;} 
162   TList *GetCorrectionListProtons1D() {return fCorrectionListProtons1D;} 
163   TList *GetCorrectionListAntiProtons2D() {return fCorrectionListAntiProtons2D;} 
164   TList *GetEfficiencyListAntiProtons1D() {return fEfficiencyListAntiProtons1D;} 
165   TList *GetCorrectionListAntiProtons1D() {return fCorrectionListAntiProtons1D;} 
166   
167   //iStep=0->MC - iStep=1->Acceptance - iStep=2->Reconstruction - iStep=3->PID
168   TH1D  *GetUncorrectedProtonYHistogram(Int_t iStep) {return fProtonContainer->ShowProjection(0, iStep);}
169   TH1D  *GetUncorrectedProtonPtHistogram(Int_t iStep) {return fProtonContainer->ShowProjection(1, iStep);}
170   TH1D  *GetUncorrectedAntiProtonYHistogram(Int_t iStep) {return fAntiProtonContainer->ShowProjection(0, iStep);}
171   TH1D  *GetUncorrectedAntiProtonPtHistogram(Int_t iStep) {return fAntiProtonContainer->ShowProjection(1, iStep);}
172
173  private:
174   AliProtonAnalysis(const AliProtonAnalysis&); // Not implemented
175   AliProtonAnalysis& operator=(const AliProtonAnalysis&); // Not implemented
176
177   Bool_t   IsAccepted(AliESDtrack *track);
178   void     FillQA(AliESDtrack *track, AliStack *stack);
179   Float_t  GetSigmaToVertex(AliESDtrack* esdTrack); 
180   Double_t Rapidity(Double_t Px, Double_t Py, Double_t Pz);
181   
182   Int_t fNBinsY; //number of bins in y
183   Float_t fMinY, fMaxY; //min & max value of y
184   Int_t fNBinsPt;  //number of bins in pT
185   Float_t fMinPt, fMaxPt; //min & max value of pT
186   
187   //cuts
188   Int_t fMinTPCClusters, fMinITSClusters; //min TPC & ITS clusters
189   Double_t fMaxChi2PerTPCCluster, fMaxChi2PerITSCluster; //max chi2 per TPC & ITS cluster
190   Double_t fMaxCov11, fMaxCov22, fMaxCov33, fMaxCov44, fMaxCov55; //max values of cov. matrix
191   Double_t fMaxSigmaToVertex; //max sigma to vertex cut
192   Double_t fMaxSigmaToVertexTPC; //max sigma to vertex cut
193   Double_t fMaxDCAXY, fMaxDCAXYTPC; //max DCA xy
194   Double_t fMaxDCAZ, fMaxDCAZTPC; //max DCA z
195   Double_t fMaxConstrainChi2; //max constrain chi2 - vertex
196   Bool_t fMinTPCClustersFlag, fMinITSClustersFlag; //shows if this cut is used or not
197   Bool_t fMaxChi2PerTPCClusterFlag, fMaxChi2PerITSClusterFlag; //shows if this cut is used or not
198   Bool_t fMaxCov11Flag, fMaxCov22Flag, fMaxCov33Flag, fMaxCov44Flag, fMaxCov55Flag; //shows if this cut is used or not
199   Bool_t fMaxSigmaToVertexFlag; //shows if this cut is used or not
200   Bool_t fMaxSigmaToVertexTPCFlag; //shows if this cut is used or not
201   Bool_t fMaxDCAXYFlag, fMaxDCAXYTPCFlag; //shows if this cut is used or not
202   Bool_t fMaxDCAZFlag, fMaxDCAZTPCFlag; //shows if this cut is used or not
203   Bool_t fMaxConstrainChi2Flag; //shows if this cut is used or not
204   Bool_t fITSRefitFlag, fTPCRefitFlag; //shows if this cut is used or not
205   Bool_t fESDpidFlag, fTPCpidFlag; //shows if this cut is used or not
206   
207   //QA histograms
208   //Bool_t fQAHistograms; //Boolean to activate the QA histograms
209   TList *fGlobalQAList; //TList storing the directories for the QA histograms
210   TList *fQA2DList; //TList storing the accepted primary/secondary (anti)protons
211   TList *fQAPrimaryProtonsAcceptedList; //list of the QA histos for accepted primary protons
212   TList *fQAPrimaryProtonsRejectedList; //list of the QA histos for rejected primary protons
213   TList *fQASecondaryProtonsAcceptedList; //list of the QA histos for accepted secondary protons
214   TList *fQASecondaryProtonsRejectedList; //list of the QA histos for rejected secondary protons
215   TList *fQAPrimaryAntiProtonsAcceptedList; //list of the QA histos for accepted primary antiprotons
216   TList *fQAPrimaryAntiProtonsRejectedList; //list of the QA histos for rejected primary antiprotons
217   TList *fQASecondaryAntiProtonsAcceptedList; //list of the QA histos for accepted secondary antiprotons
218   TList *fQASecondaryAntiProtonsRejectedList; //list of the QA histos for rejected secondary antiprotons
219
220   //pid
221   Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
222   Double_t fPartFrac[10]; //prior probabilities
223   TF1  *fElectronFunction; //momentum dependence of the prior probs
224   TF1  *fMuonFunction; //momentum dependence of the prior probs
225   TF1  *fPionFunction; //momentum dependence of the prior probs
226   TF1  *fKaonFunction; //momentum dependence of the prior probs
227   TF1  *fProtonFunction; //momentum dependence of the prior probs
228
229   //Detectors
230   Bool_t fUseTPCOnly; //kTRUE if TPC only information is used
231
232   //Analysis containers
233   AliCFContainer *fProtonContainer; //container for protons
234   AliCFContainer *fAntiProtonContainer; //container for antiprotons
235   TH1I *fHistEvents; //event counter
236   TH2D *fHistYPtProtons; //Y-Pt of Protons
237   TH2D *fHistYPtAntiProtons; // Y-Pt of Antiprotons
238
239   //Corrections
240   TList *fEffGridListProtons; //list for the efficiency grid - protons 
241   TList *fCorrectionListProtons2D; //list for the 2d corrections 
242   TList *fEfficiencyListProtons1D; //list for the 1d efficiencies
243   TList *fCorrectionListProtons1D; //list for the 1d corrections 
244   TList *fEffGridListAntiProtons; //list for the efficiency grid - antiprotons 
245   TList *fCorrectionListAntiProtons2D; //list for the 2d corrections 
246   TList *fEfficiencyListAntiProtons1D; //list for the 1d efficiencies
247   TList *fCorrectionListAntiProtons1D; //list for the 1d corrections 
248   AliCFDataGrid *fCorrectProtons; //corrected data grid for protons
249   AliCFDataGrid *fCorrectAntiProtons; //corrected data grid for antiprotons
250
251   ClassDef(AliProtonAnalysis,0);
252 };
253
254 #endif