]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/macros/PID/THnSparseDefinitions.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGJE / macros / PID / THnSparseDefinitions.h
1 #ifndef THNSPARSEDEFINITIONS_H
2 #define THNSPARSEDEFINITIONS_H
3
4 #include "TCanvas.h"
5 #include "THnSparse.h"
6 #include "TPaveText.h"
7 #include "TString.h"
8 #include "AliPID.h"
9
10 #define NEW_AXES
11
12 #ifdef NEW_AXES
13   enum axesTHnSparseEta {
14     kMCpid = 0,
15     kSelectSpecies,
16     kPtpcInner,
17     kMultiplicity,
18     kDeltaPrime,
19     kEta
20   };
21 #else
22   enum axesTHnSparseEta {
23     kMCpid = 0,
24     kSelectSpecies,
25     kPtpcInner,
26     kPt,
27     kDeDx,
28     kMultiplicity,//kDelta,
29     kDeltaPrime,
30     kEta
31   };
32 #endif
33
34 enum axesTHnSparsePID {
35   kPidMCpid = 0,
36   kPidSelectSpecies,
37   kPidPt,
38   //OLD kPidDelta,
39   kPidDeltaPrime,
40   kPidCentrality,
41   kPidJetPt,
42   kPidZ,
43   kPidXi
44 };
45
46 /*OLD with TOF, p_TPC_Inner and p_vertex
47 enum axesTHnSparsePID {
48   kPidMCpid = 0,
49   kPidSelectSpecies,
50   kPidPtpcInner,
51   kPidPt,
52   kPidPvertex,
53   kPidDelta,
54   kPidDeltaPrime,
55   kPidDeltaTOF
56 };//*/
57
58 enum axesTHnSparsePIDgen {
59   kPidGenMCpid = 0,
60   kPidGenSelectSpecies,
61   kPidGenPt,
62   //OLD kPidGenDelta,
63   kPidGenDeltaPrime,
64   kPidGenCentrality,
65   kPidGenJetPt,
66   kPidGenZ,
67   kPidGenXi
68 };
69
70 enum axesTHnSparsePIDgenYield {
71   kPidGenYieldMCpid = 0,
72   kPidGenYieldPt = 1,
73   kPidGenYieldCentrality = 2,
74   kPidGenYieldJetPt = 3,
75   kPidGenYieldZ = 4,
76   kPidGenYieldXi = 5,
77   kPidGenYieldNumAxes = 6 
78 };
79
80 enum MCpid  {
81   kEl = 1,
82   kKa = 2,
83   kMu = 3,
84   kPi = 4,
85   kPr = 5,
86   kMuPlusPi = 10
87 };
88
89 enum PIDtype { 
90   kMCid = 0, 
91   kTPCid = 1, 
92   kV0idNoTOF = 2, 
93   kTPCandTOFid = 3,
94   kV0idPlusTOFaccepted = 4,
95   kV0idPlusTOFrejected = 5  
96 };
97
98 enum efficiencyAxes {
99   kEffMCID = 0, 
100   kEffTrackPt = 1, 
101   kEffTrackEta = 2, 
102   kEffTrackCharge = 3, 
103   kEffCentrality = 4, 
104   kEffJetPt = 5,
105   kEffNumAxes = 6 
106 };
107   
108 enum EffSteps {
109   kStepGenWithGenCuts = 0, 
110   kStepRecWithGenCuts = 1, 
111   kStepRecWithGenCutsMeasuredObs = 2,
112   kStepRecWithRecCutsMeasuredObs = 3, 
113   kStepRecWithRecCutsMeasuredObsPrimaries = 4,
114   kStepRecWithRecCutsMeasuredObsStrangenessScaled = 5,
115   kNumSteps = 6
116 };
117
118 enum chargeMode {
119   kNegCharge = -1,
120   kAllCharged = 0,
121   kPosCharge = 1
122 };
123
124 const TString partShortName[9] = { "El", "Ka", "Mu", "Pi", "Pr", "V0plusTOFel", "V0el", "V0pi", "V0pr" };
125
126 ///*
127 //coarser binning at high pT and in general coarser binning to get reasonable weighting for regularisation
128 const Int_t nPtBins = 52;
129 const Double_t binsPt[nPtBins+1] = {0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
130              0.5, 0.55, 0.6, 0.65, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4,
131              1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4,
132              3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0,
133              9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0,
134              27.0, 35.0, 50.0 };
135 //*/
136              
137 /*
138 //coarser binning at high pT and, in addition, coarser binning around crossings for PbPb 2.76 ATeV FINAL version
139 const Int_t nPtBins = 50;
140 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
141              0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.95, 1.1,
142              1.3, 1.4, 1.8, 2.2, 2.6, 3.0, 3.2, 3.4, 3.6, 3.8, 
143              4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 
144              11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0, 
145              50.0 };
146 */
147
148
149
150 /*
151 //coarser binning at high pT and, in addition, coarser binning around crossings for pPb 5.023 ATeV FINAL version
152 const Int_t nPtBins = 52;
153 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
154              0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95,
155              1.0, 1.1, 1.2, 1.3, 1.4, 1.8, 2.2, 2.6, 3.0, 3.2, 
156              3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 
157              8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0,
158              22.0, 30.0, 50.0 };
159 */
160
161 /*
162 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 7 TeV FINAL version
163 const Int_t nPtBins = 47;
164 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
165              0.5, 0.55, 0.6,  0.65, 0.7, 0.75, 0.8, 1.2, 1.4, 1.6,
166              1.8, 2.0, 2.6, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5,
167              5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 
168              13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 26.0, 50.0 };
169 */
170 /*
171 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 7 TeV VERY NEW version
172 const Int_t nPtBins = 46;
173 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
174              0.5, 0.55, 0.6,  0.65, 0.7, 0.75, 0.8, 1.2, 1.6,
175              2.0, 2.5, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0,
176              5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
177              14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0, 50.0 };
178 */
179 /*
180 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 7 TeV NEW version
181 const Int_t nPtBins = 47;
182 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
183              0.5, 0.55, 0.6,  0.65, 0.7, 0.75, 0.9, 1.2, 1.4, 1.6,
184              2.0, 2.5, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0,
185              5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0,
186              14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0, 50.0 };
187 */
188 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 7 TeV
189 /*
190 const Int_t nPtBins = 50;
191 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
192              0.5, 0.55, 0.6,  0.65, 0.7, 0.75, 0.9, 1.1, 1.2, 1.3,
193              1.4, 1.6, 1.8, 2.0, 2.9, 3.0, 3.2, 3.4, 3.6, 3.8,
194              4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0,
195              11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0,
196              50.0 };
197 */
198 /*
199 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 2.76 TeV FINAL version
200 const Int_t nPtBins = 45;
201 const Double_t binsPt[nPtBins+1] = {0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
202              0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 1.05,  
203              1.2, 1.3, 1.4, 1.8, 2.9, 3.4, 3.6, 3.8, 4.0, 4.5, 
204              5.0, 5.5, 6.0, 6.5, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 
205              13.0, 14.0, 15.0, 16.0, 20.0, 50.0 };
206 */
207 /*
208 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 2.76 TeV NEW version
209 const Int_t nPtBins = 49;
210 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
211              0.5,  0.55, 0.6,  0.65, 0.7,  0.75, 0.8,  0.85, 0.9,
212              1.05,  1.2,  1.3 , 1.4,  1.7,  2.4, 3.2 , 3.4 , 3.6,  3.8 ,
213              4.0,  4.5 , 5.0,  5.5 , 6.0,  6.5 , 7.0,  8.0 , 9.0,  10.0,
214              11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0,
215              50.0 };
216 */
217 /*
218 // Coarser binning at high pT and, in addition, coarser binning around crossings for pp 2.76 TeV
219 const Int_t nPtBins = 50;
220 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
221              0.5,  0.55, 0.6,  0.65, 0.7,  0.75, 0.8,  0.85, 0.9,  0.95,
222              1.0,  1.1 , 1.2,  1.3 , 1.4, 1.8,  2.4, 3.2,  3.6,  3.8 ,
223              4.0,  4.5 , 5.0,  5.5 , 6.0,  6.5 , 7.0,  8.0 , 9.0,  10.0,
224              11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0,
225              50.0 };
226 */
227
228 /*
229 //coarser binning at high pT
230 const Int_t nPtBins = 60;
231 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
232              0.5,  0.55, 0.6,  0.65, 0.7,  0.75, 0.8,  0.85, 0.9,  0.95,
233              1.0,  1.1 , 1.2,  1.3 , 1.4,  1.5 , 1.6,  1.7 , 1.8,  1.9 ,
234              2.0,  2.2 , 2.4,  2.6 , 2.8,  3.0 , 3.2,  3.4 , 3.6,  3.8 ,
235              4.0,  4.5 , 5.0,  5.5 , 6.0,  6.5 , 7.0,  8.0 , 9.0,  10.0,
236              11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 22.0, 27.0, 35.0,
237              50.0 };
238 */
239              
240 /* OLD default as used in PID-Task to create THnSparses
241 const Int_t nPtBins = 68;
242 const Double_t binsPt[nPtBins+1] = {0. ,  0.05, 0.1,  0.15, 0.2,  0.25, 0.3,  0.35, 0.4,  0.45,
243                                0.5,  0.55, 0.6,  0.65, 0.7,  0.75, 0.8,  0.85, 0.9,  0.95,
244                                1.0,  1.1 , 1.2,  1.3 , 1.4,  1.5 , 1.6,  1.7 , 1.8,  1.9 ,
245                                2.0,  2.2 , 2.4,  2.6 , 2.8,  3.0 , 3.2,  3.4 , 3.6,  3.8 ,
246                                4.0,  4.5 , 5.0,  5.5 , 6.0,  6.5 , 7.0,  8.0 , 9.0,  10.0,
247                                11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 18.0, 20.0, 22.0, 24.0,
248                                26.0, 28.0, 30.0, 32.0, 34.0, 36.0, 40.0, 45.0, 50.0 };
249 */
250              
251 const Int_t nDeDxBins = 19;
252 const Double_t binsDeDx[nDeDxBins+1] = {50., 52., 54., 56., 58., 60., 65., 70., 75., 80., 
253                                         85., 90., 100., 120., 160., 200., 250., 300., 400., 600. };            
254 /*                             
255 const Int_t nDeDxBins = 35;
256 const Double_t binsDeDx[nDeDxBins+1] = {50., 51., 52., 53., 54., 55., 56., 57., 58., 59.,
257              60., 62., 64., 66., 68., 70., 72., 74., 76., 78.,
258              80., 85., 90., 95., 100., 120., 140., 160., 180., 200.,
259              250., 300., 350., 400., 500, 650.};*/
260
261 //____________________________________________________________________________________________________________________
262 Int_t getLineColor(Int_t ID) {
263   switch (ID) {
264     case kEl:
265       // El
266       return kMagenta;
267     case kKa:
268       // Ka
269       return kGreen;
270     case kMu:
271       // Mu
272       return kOrange -3;
273     case kPi:
274       // Pi
275       return kRed;
276     case kPr:
277       // Pr
278       return kBlue;
279     case kMuPlusPi:
280       // Muons plus pions
281       return kCyan;
282     default:
283       return 0;
284   }
285   
286   return 0;
287 }
288
289
290 //____________________________________________________________________________________________________________________
291 Int_t getLineColorAliPID(Int_t ID) {
292   switch (ID) {
293     case AliPID::kElectron:
294       // El
295       return kMagenta;
296     case AliPID::kKaon:
297       // Ka
298       return kGreen;
299     case AliPID::kMuon:
300       // Mu
301       return kOrange - 3;
302     case AliPID::kPion:
303       // Pi
304       return kRed;
305     case AliPID::kProton:
306       // Pr
307       return kBlue;
308     default:
309       return 0;
310   }
311   
312   return 0;
313 }
314
315
316 //____________________________________________________________________________________________________________________
317 void ClearTitleFromHistoInCanvas(TCanvas* c, Int_t padNum = -1)
318 {
319   // Remove the title from a histogram plotted in the canvase without 
320   // removing the title from the histogram itself.
321   // If padNum is >= 0, this method will be applied to the corresponding
322   // pad number
323   
324   c->Update();    // Update in order to have access to the title in the following
325
326   TPaveText* paveTextTitle = (padNum >= 0) ? (TPaveText*)c->GetPad(padNum)->FindObject("title") : (TPaveText*)c->FindObject("title");
327   if (paveTextTitle) 
328     paveTextTitle->Clear();
329 }
330
331
332 //____________________________________________________________________________________________________________________
333 Int_t GetAxisByTitle(const THnSparse* h, TString title)
334 {
335   if (!h)
336     return -1;
337   
338   for (Int_t iDim = 0; iDim < h->GetNdimensions(); iDim++) {
339     if (!title.CompareTo(h->GetAxis(iDim)->GetTitle()))
340       return iDim;
341   }
342
343   return -1;
344 }
345
346 #endif