changes from Misha
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / AliAnalysisTaskDiHadronPID.h
1 // ----------------------------------------------------------------------------\r
2 // AliAnalysisTaskDiHadronPID.h\r
3 // ----------------------------------------------------------------------------\r
4 // Author: Misha Veldhoen (misha.veldhoen@cern.ch)\r
5 // Last Rev.: Apr. 12th 2012. (v 8.00)\r
6 // ----------------------------------------------------------------------------\r
7 \r
8 #ifndef ALIANALYSISTASKDIHADRONPID_H\r
9 #define ALIANALYSISTASKDIHADRONPID_H\r
10 \r
11 #include <iostream>\r
12 #include "AliAnalysisTaskSE.h"\r
13 #include "THnSparse.h"\r
14 #include "TMath.h"\r
15 \r
16 using namespace std;\r
17 \r
18 class TH1F;\r
19 class TH2F;\r
20 class TH3F;\r
21 class TList;\r
22 class TObjArray;\r
23 class TString;\r
24 \r
25 class AliAODTrack;\r
26 class AliAODEvent;\r
27 class AliAODVertex;\r
28 \r
29 class AliPIDResponse;\r
30 \r
31 class AliAnalysisTaskDiHadronPID: public AliAnalysisTaskSE {\r
32 \r
33 public:\r
34         // Required functions.\r
35         AliAnalysisTaskDiHadronPID();\r
36         AliAnalysisTaskDiHadronPID(const char *name);\r
37         virtual ~AliAnalysisTaskDiHadronPID();\r
38         \r
39         virtual void UserCreateOutputObjects();\r
40         virtual void UserExec(Option_t *option);\r
41         virtual void Terminate(Option_t *);\r
42     \r
43     // Setters\r
44     void SetVerbose(Int_t verbose) {fVerbose=verbose;}\r
45     void SetPrintBufferSize(Bool_t printbuffersize=kTRUE) {fPrintBufferSize=printbuffersize;}\r
46     void SetCalculateMixedEvents(Bool_t mixedevents=kTRUE) {fCalculateMixedEvents=mixedevents;}\r
47     void SetBeamType(TString beamtype) {\r
48                 if ((beamtype!="pp")&&(beamtype!="PbPb")) {\r
49                         cout<<"SetBeamType -> Beamtype must be pp or PbPb"<<endl;\r
50                         return;\r
51                 }\r
52                 fBeamType=beamtype;\r
53         }\r
54     \r
55         void SetMaxEta(Double_t maxeta) {\r
56                 if (TMath::Abs(maxeta)>0.9) {\r
57                         cout<<"SetMaxEta -> |eta| must be < 0.9"<<endl;\r
58                         return;\r
59                 }\r
60         fMaxEta = maxeta;\r
61         }\r
62     \r
63     void SetMaxPlotEta(Double_t maxploteta) {\r
64                 if (TMath::Abs(maxploteta)>1.0) {\r
65                         cout<<"SetMaxPlotEta -> |eta| must be < 1.0"<<endl;\r
66                         return;\r
67                 }\r
68         fMaxPlotEta = maxploteta;\r
69         }\r
70     \r
71     void SetMaxPt(Double_t maxpt) {\r
72         if (maxpt<5.) {\r
73             cout<<"SetMaxPt -> Maximum pT must be > 5.0 GeV/c."<<endl;\r
74             return;\r
75         }\r
76         fMaxPt = maxpt;\r
77     }\r
78     \r
79     void SetNEtaBins(Int_t netabins) {\r
80         if (netabins<1||netabins>72) {\r
81             cout<<"SetNEtaBins -> Number of bins must be between 1 and 72"<<endl;\r
82             return;\r
83         }\r
84         fNEtaBins = netabins;\r
85     }\r
86     \r
87     void SetNPhiBins(Int_t nphibins) {\r
88         if (nphibins<1||nphibins>72) {\r
89             cout<<"SetNPhiBins -> Number of bins must be between 1 and 72"<<endl;\r
90             return;\r
91         }\r
92         fNPhiBins = nphibins;\r
93 \r
94     }\r
95     \r
96     void SetVertexZMixedEvents(Double_t vertexzmixedevents) {\r
97         if (vertexzmixedevents<0.||vertexzmixedevents>10.) {\r
98             cout<<"SetVertexZMixedEvents -> must be 0 < z < 10"<<endl;\r
99             return;\r
100         } \r
101         fVertexZMixedEvents=vertexzmixedevents;\r
102     } \r
103     \r
104     void SetZoomed(Bool_t zoomed=kTRUE) {fZoomed=zoomed;}\r
105         void SetDoDCACut(Bool_t dodcacut=kTRUE) {fDoDCACut=dodcacut;}\r
106     void SetDoITSCut(Bool_t doitscut=kTRUE) {fDoITSCut=doitscut;}\r
107     void SetDemandNoMismatch(Bool_t demandnomismatch=kTRUE) {fDemandNoMismatch=demandnomismatch;}\r
108     void SetTrigBufferMaxSize(Int_t trigbuffermaxsize) {\r
109         if (trigbuffermaxsize<10||trigbuffermaxsize>25000) {\r
110             cout<<"SetTrigBufferMaxSize -> Max buffer size must be between 10 and 25000."<<endl;\r
111             return;\r
112         }\r
113         fTrigBufferMaxSize=trigbuffermaxsize;\r
114     }\r
115     \r
116     void SetCentralityCut(Double_t centralitycutmax, Double_t centralitycutmin) {\r
117         if (centralitycutmax<0.) {\r
118             cout<<"SetCentralityCut -> Centrality cannot be lower than 0."<<endl;\r
119             return;\r
120         }\r
121         if (centralitycutmin<centralitycutmax) {\r
122             cout<<"SetCentralityCut -> Maximum centrality needs to be smaller than the minimum centrality. (It's confusing I know)"<<endl;\r
123             return;\r
124         }\r
125         if (centralitycutmin>100.) {\r
126             cout<<"SetCentralityCut -> Minimum centrality cannot exceed 100%."<<endl;\r
127             return;\r
128         }\r
129         fCentralityCutMax=centralitycutmax;\r
130         fCentralityCutMin=centralitycutmin;\r
131     \r
132     }\r
133         \r
134     // Getters\r
135     Bool_t GetVerbose() {return fVerbose;}\r
136     Bool_t GetPrintBufferSize() {return fPrintBufferSize;}\r
137     Bool_t GetCalculateMixedEvents() {return fCalculateMixedEvents;}\r
138     TString GetBeamType() {return fBeamType;}\r
139     Double_t GetMaxEta() {return fMaxEta;}\r
140     Double_t GetMaxPlotEta() {return fMaxPlotEta;}\r
141     Double_t GetMaxPt() {return fMaxPt;}\r
142     Int_t GetNEtaBins() {return fNEtaBins;}\r
143     Int_t GetNPhiBins() {return fNPhiBins;}\r
144     Double_t GetVertexZMixedEvents() {return fVertexZMixedEvents;}\r
145     Bool_t GetZoomed() {return fZoomed;}\r
146     Bool_t GetDoDCACut() {return fDoDCACut;}\r
147     Bool_t GetDoITSCut() {return fDoITSCut;}\r
148     Bool_t GetDemandNoMismatch() {return fDemandNoMismatch;}\r
149         Int_t GetTrigBufferMaxSize() {return fTrigBufferMaxSize;}\r
150     Double_t GetCentralityCutMax() {return fCentralityCutMax;}\r
151     Double_t GetCentralityCutMin() {return fCentralityCutMin;}\r
152     \r
153 private:\r
154         // Private Functions.   \r
155         AliAnalysisTaskDiHadronPID(const AliAnalysisTaskDiHadronPID&); // NOT IMPLEMENTED.\r
156         AliAnalysisTaskDiHadronPID& operator=(const AliAnalysisTaskDiHadronPID&); // NOT IMPLEMENTED.\r
157 \r
158     void FillGlobalTracksArray();\r
159         AliAODTrack* GetGlobalTrack(AliAODTrack* track);\r
160     \r
161         Bool_t SelectEvent(AliAODVertex *vertex);\r
162     Int_t ClassifyTrack(AliAODTrack* track);\r
163 \r
164         Double_t PhiRange(Double_t DPhi);\r
165         \r
166 private:\r
167         // PID object.\r
168         AliPIDResponse          *fPIDResponse;              //! PID Response Handler.\r
169         \r
170         // Event and Track related objects.\r
171         AliAODEvent                     *fAODEvent;                 //! The AOD Event.\r
172         AliAODHeader            *fAODHeader;                //! The AOD Header.\r
173         AliAODVertex            *fAODVertex;                //! The AOD Vertex.\r
174         \r
175         AliAODTrack                     *fAODTrack;                 //! Current AOD Track.\r
176 \r
177         TObjArray                       *fGlobalTracks;              //! Partner Tracks.\r
178         \r
179         // HISTOGRAMS.\r
180 \r
181         // Event QA plots.\r
182         TH1F                        *fCentrality;               //! Centrality Histogram.\r
183         TH1F                        *fVertexZ;                  //! Vertex Z position.\r
184 \r
185     // Track QA plots.\r
186     TH2F                *fDCA;                      //! DCA XY vs Z before DCA cut.\r
187     TH2F                *fDCAZoomed;                //!\r
188     TH2F                *fDCAZoomedTwice;           //!\r
189     TH2F                *fDCACut;                   //! DCA XY vs Z after DCA cut (if performed!).\r
190     TH2F                *fDCAZoomedCut;             //!\r
191     TH2F                *fDCAZoomedTwiceCut;        //!\r
192     \r
193     TH1F                *fITSHits;                  //! 3 bins, [no hits in first 2 layers, 1 hit, 2 hits]\r
194     \r
195     TH1F                *fTrackCutsCount;           //! Counts of used tracks after cuts\r
196     TH2F                *fTrackCutsPt;              //! pT spectrum after cuts.\r
197     TH2F                *fTrackCutsEta;             //! eta spectrum after cuts.\r
198     TH2F                *fTrackCutsPhi;             //! phi spectrum after cuts.\r
199     \r
200     TH1F                *fEtaSpectrumTrig;          //! eta spectrum of triggers (pT > 5.0 tracks, trigger track cuts.)\r
201     TH2F                *fEtaSpectrumAssoc;         //! eta spectrum of associateds as a function of pT\r
202     TH2F                *fPhiSpectrumAssoc;         //! phi spectrum of associateds as a function of pT\r
203 \r
204         // PID QA plots.\r
205         TH2F                            *fTPCnSigmaProton;          //! TPC nSigma plot for Protons.\r
206         TH2F                            *fTOFnSigmaProton;          //! TOF nSigma plot for Protons.\r
207         TH2F                            *fTPCnSigmaPion;            //! TPC nSigma plot for Pions.\r
208         TH2F                            *fTOFnSigmaPion;            //! TOF nSigma plot for Pions.      \r
209         TH2F                            *fTPCnSigmaKaon;            //! TPC nSigma plot for Kaons.\r
210         TH2F                            *fTOFnSigmaKaon;            //! TOF nSigma plot for Kaons.\r
211         \r
212         TH3F                            *fTPCSignal;                            //! TPC signal (pt,eta).\r
213         TH3F                            *fTOFSignal;                            //! TOF signal (pt,eta).\r
214         \r
215         // Di-Hadron Correlations with TPC and TOF signals.\r
216         THnSparseF                      *fDiHadronTPCTOF[3][10];        //! Di-Hadron correlations with both TPC and TOF signal.\r
217 \r
218     // Mixed Events.\r
219     TH3F                                *fMixedEvents;              //! Mixed Events, associated track cuts.\r
220     \r
221         // List of Histograms.\r
222         TList                       *fHistoList;                //! List of Histograms.\r
223         \r
224         // Analysis Task Configuration Variables.\r
225     Bool_t              fCalculateMixedEvents;      // \r
226         TString                         fBeamType;                                      // pp or PbPb\r
227         Double_t                        fMaxEta;                    // Q: Do we need to take extra care of the binning?\r
228     Double_t            fMaxPlotEta;                //\r
229     Double_t            fMaxPt;                     //\r
230     Int_t               fNEtaBins;                  // Number of bins in eta\r
231     Int_t               fNPhiBins;                  // Number of bins in phi\r
232     Double_t            fVertexZMixedEvents;        // Events with a vertex z difference smaller than \r
233                                                     // this number (standard 2cm) will be mixed.\r
234     \r
235     Double_t            fCentralityCutMax;          // Maximum centrality (standard 0%)\r
236     Double_t            fCentralityCutMin;          // Minimum centrality (standard 10%)\r
237     Bool_t              fZoomed;                    //\r
238     Bool_t              fDoITSCut;                  // Cut the tracks with not at least one SPD hit.\r
239         Bool_t              fDoDCACut;                  // Perform a DCA cut to get rid of secondaries.\r
240     Bool_t              fDemandNoMismatch;          // \r
241     \r
242     Int_t               fTrackCutLabelNumbers[8];   // Track Cut labels.\r
243     \r
244     // Level of verbal output.\r
245     //  0 -> No output.\r
246     //  1 -> Only error messages.\r
247     //  2 -> Information about output creation (beginning of the job)\r
248     //  3 -> Event information.\r
249     //  4 -> Track information.\r
250     Int_t               fVerbose;                   //\r
251     Bool_t              fPrintBufferSize;           //\r
252 \r
253     // Trigger buffer.\r
254     Double_t            fTrigBuffer[25000][4];      //!\r
255         Int_t               fTrigBufferIndex;           //!\r
256     Int_t               fTrigBufferSize;            //!\r
257         Int_t                           fTrigBufferMaxSize;                     //!\r
258     \r
259     \r
260         ClassDef(AliAnalysisTaskDiHadronPID,1);\r
261         \r
262 };\r
263 \r
264 #endif\r
265 \r