]>
Commit | Line | Data |
---|---|---|
6788af99 | 1 | // ------------------------------------------------------------------------- |
2 | // Object to handle AOD Track cuts for the DiHadronPID analysis. Should | |
3 | // inherit from: ?TObject or TNamed?, so that it can be written to a file. | |
4 | // | |
5 | // Still open question: should this object hold multiple track cuts, or | |
6 | // should the analysis hold a TObjArray, with all the track cuts? | |
7 | // ------------------------------------------------------------------------- | |
8 | // Author: Misha Veldhoen (misha.veldhoen@cern.ch) | |
9 | ||
10 | #include <iostream> | |
11 | ||
12 | #include "TMath.h" | |
13 | #include "TH1F.h" | |
14 | #include "TH2F.h" | |
15 | #include "TH3F.h" | |
16 | #include "TNamed.h" | |
17 | #include "TFormula.h" | |
18 | #include "TIterator.h" | |
19 | ||
20 | // AOD includes. | |
21 | #include "AliAODTrack.h" | |
22 | #include "AliAODEvent.h" | |
23 | #include "AliAODVertex.h" | |
24 | #include "AliAODMCParticle.h" | |
25 | ||
26 | // PID includes. | |
27 | #include "AliPID.h" | |
28 | #include "AliPIDResponse.h" | |
29 | #include "AliTPCPIDResponse.h" | |
30 | ||
31 | #include "AliTrackDiHadronPID.h" | |
32 | ||
33 | #include "AliAODTrackCutsDiHadronPID.h" | |
34 | ||
35 | using namespace std; | |
36 | ||
37 | ClassImp(AliAODTrackCutsDiHadronPID); | |
38 | ||
39 | // ------------------------------------------------------------------------- | |
40 | AliAODTrackCutsDiHadronPID::AliAODTrackCutsDiHadronPID(): | |
41 | TNamed(), | |
42 | fMinPt(0.), | |
43 | fMaxPt(10.), | |
44 | fFilterMask(0), | |
45 | fMaxEta(-999.), | |
46 | fMaxRapidity(-999.), | |
47 | fDemandedFlags(0), | |
48 | fMinSPDHitsForPtDeptDCAcut(0), | |
49 | fPtDeptDCAxyCutFormula(0x0), | |
50 | fDCAzCut(999.), | |
51 | fIsMC(kFALSE), | |
52 | fTestFilterMask(kFALSE), | |
53 | fTestMaxEta(kFALSE), | |
54 | fTestMaxRapidity(kFALSE), | |
55 | fTestFlags(kFALSE), | |
56 | fTestTOFmismatch(kFALSE), | |
57 | fTestPtDeptDCAcut(kFALSE), | |
58 | fDataTrackQAHistos(0x0), | |
59 | fPrimRecMCTrackQAHistos(0x0), | |
60 | fPrimGenMCTrackQAHistos(0x0), | |
61 | fSecRecMCTrackQAHistos(0x0), | |
62 | fSecGenMCTrackQAHistos(0x0), | |
63 | fDebug(0) | |
64 | ||
65 | { | |
66 | ||
67 | // | |
68 | // Default constructor | |
69 | // | |
70 | ||
71 | // Q: When an object is loaded from a TFile, then the default constructor is called. | |
72 | // I am assuming that the valiables initialized here are overwritten by the values | |
73 | // which were stored in the file, except for the data members which have an | |
74 | // exclamation mark in the header file. -> Check this! | |
75 | ||
76 | cout<<"AliAODTrackCutsDiHadronPID Default Constructor Called."<<endl; | |
77 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
78 | ||
79 | for (Int_t iHistoName = 0; iHistoName < 12; iHistoName++) { | |
80 | ||
81 | // Initialize the data histograms. | |
82 | if (iHistoName < 3) { | |
83 | fHistDataPt[iHistoName] = 0x0; | |
84 | fHistDataNTracks[iHistoName] = 0x0; | |
85 | fNTracks[iHistoName] = 0; | |
86 | ||
87 | // DCA histograms. | |
88 | fHistDataDCAxy[iHistoName] = 0x0; | |
89 | fHistDataDCAz[iHistoName] = 0x0; | |
90 | ||
91 | // Initialize PID histograms. | |
92 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
93 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
94 | fHistDataPID[iHistoName][iSpecies][iPtClass] = 0x0; | |
95 | fHistTOFMismatch[iHistoName][iSpecies][iPtClass] = 0x0; | |
96 | } | |
97 | } | |
98 | } | |
99 | // Initialize data DCA for one sigma. | |
100 | fHistDataDCAxyOneSigma[iHistoName] = 0x0; | |
101 | ||
102 | // Initialize MC histograms. | |
103 | fHistPrimGenMCPt[iHistoName] = 0x0; | |
104 | fHistPrimRecMCPt[iHistoName] = 0x0; | |
105 | fHistPrimRecNTracks[iHistoName] = 0x0; | |
106 | ||
107 | fHistSecGenMCPt[iHistoName] = 0x0; | |
108 | fHistSecRecMCPt[iHistoName] = 0x0; | |
109 | ||
110 | // Initialze MC DCA histograms | |
111 | fHistPrimRecMCDCA[iHistoName] = 0x0; | |
112 | fHistSecRecMCDCAMat[iHistoName] = 0x0; | |
113 | fHistSecRecMCDCAWeak[iHistoName] = 0x0; | |
114 | ||
115 | // Initialize other stuff. | |
116 | fHistRequested[iHistoName] = kFALSE; | |
117 | f3DSpectraEnabeled[iHistoName] = kFALSE; | |
118 | fPIDHistosEnabeled[iHistoName] = kFALSE; | |
119 | } | |
120 | ||
121 | // TODO: It would be a bit neater to initialize all values to zero | |
122 | // instead of the default values... | |
123 | InitializeDefaultHistoNamesAndAxes(); | |
124 | ||
125 | } | |
126 | ||
127 | // ------------------------------------------------------------------------- | |
128 | AliAODTrackCutsDiHadronPID::AliAODTrackCutsDiHadronPID(const char* name): | |
129 | TNamed(name,"AOD Track Cuts"), | |
130 | fMinPt(0.), | |
131 | fMaxPt(10.), | |
132 | fFilterMask(0), | |
133 | fMaxEta(-999.), | |
134 | fMaxRapidity(-999.), | |
135 | fDemandedFlags(0), | |
136 | fMinSPDHitsForPtDeptDCAcut(0), | |
137 | fPtDeptDCAxyCutFormula(0x0), | |
138 | fDCAzCut(999.), | |
139 | fIsMC(kFALSE), | |
140 | fTestFilterMask(kFALSE), | |
141 | fTestMaxEta(kFALSE), | |
142 | fTestMaxRapidity(kFALSE), | |
143 | fTestFlags(kFALSE), | |
144 | fTestTOFmismatch(kFALSE), | |
145 | fTestPtDeptDCAcut(kFALSE), | |
146 | fDataTrackQAHistos(0x0), | |
147 | fPrimRecMCTrackQAHistos(0x0), | |
148 | fPrimGenMCTrackQAHistos(0x0), | |
149 | fSecRecMCTrackQAHistos(0x0), | |
150 | fSecGenMCTrackQAHistos(0x0), | |
151 | fDebug(0) | |
152 | ||
153 | { | |
154 | ||
155 | // | |
156 | // Named constructor | |
157 | // | |
158 | ||
159 | cout<<"AliAODTrackCutsDiHadronPID Named Constructor Called."<<endl; | |
160 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
161 | ||
162 | for (Int_t iHistoName = 0; iHistoName < 12; iHistoName++) { | |
163 | ||
164 | // Initialize the data histograms. | |
165 | if (iHistoName < 3) { | |
166 | fHistDataPt[iHistoName] = 0x0; | |
167 | fHistDataNTracks[iHistoName] = 0x0; | |
168 | fNTracks[iHistoName] = 0; | |
169 | ||
170 | // DCA histograms. | |
171 | fHistDataDCAxy[iHistoName] = 0x0; | |
172 | fHistDataDCAz[iHistoName] = 0x0; | |
173 | ||
174 | // Initialize PID histograms. | |
175 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
176 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
177 | fHistDataPID[iHistoName][iSpecies][iPtClass] = 0x0; | |
178 | fHistTOFMismatch[iHistoName][iSpecies][iPtClass] = 0x0; | |
179 | } | |
180 | } | |
181 | } | |
182 | // Initialize data DCA for one sigma. | |
183 | fHistDataDCAxyOneSigma[iHistoName] = 0x0; | |
184 | ||
185 | // Initialize MC histograms. | |
186 | fHistPrimGenMCPt[iHistoName] = 0x0; | |
187 | fHistPrimRecMCPt[iHistoName] = 0x0; | |
188 | fHistPrimRecNTracks[iHistoName] = 0x0; | |
189 | ||
190 | fHistSecGenMCPt[iHistoName] = 0x0; | |
191 | fHistSecRecMCPt[iHistoName] = 0x0; | |
192 | ||
193 | // Initialze MC DCA histograms | |
194 | fHistPrimRecMCDCA[iHistoName] = 0x0; | |
195 | fHistSecRecMCDCAMat[iHistoName] = 0x0; | |
196 | fHistSecRecMCDCAWeak[iHistoName] = 0x0; | |
197 | ||
198 | // Initialize other stuff. | |
199 | fHistRequested[iHistoName] = kFALSE; | |
200 | f3DSpectraEnabeled[iHistoName] = kFALSE; | |
201 | fPIDHistosEnabeled[iHistoName] = kFALSE; | |
202 | } | |
203 | ||
204 | InitializeDefaultHistoNamesAndAxes(); | |
205 | ||
206 | } | |
207 | ||
208 | // ------------------------------------------------------------------------- | |
209 | void AliAODTrackCutsDiHadronPID::InitializeDefaultHistoNamesAndAxes() { | |
210 | ||
211 | // Initializes the histogram name conventions and the ranges of all the histograms | |
212 | // by their default values. This method should only be called by the | |
213 | // (default) constructor. | |
214 | ||
215 | // TODO: User should be able to change these standard values at initialization. | |
216 | // TODO: User should be able to retrieve all these variables with appropriate Getters. | |
217 | ||
218 | cout<<"AliAODTrackCutsDiHadronPID - Initializing Default Histogram Names and axes..."<<endl; | |
219 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
220 | ||
221 | // Setting the Pt axis for all histograms except the PID and Mismatch histograms. | |
222 | Double_t ptaxis[47] = {0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00, | |
223 | 1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0, | |
224 | 3.2,3.4,3.6,3.8,4.0,4.2,4.4,4.6,4.8,5.0}; | |
225 | for (Int_t iPtBins = 0; iPtBins < 47; iPtBins++) {fPtAxis[iPtBins] = ptaxis[iPtBins];} | |
226 | fNPtBins = 46; | |
227 | ||
228 | // Setting the pt range of the five PID histogram pt classes. | |
229 | Double_t ptboundarypid[6] = {0.5,0.7,1.0,1.7,3.0,5.0}; | |
230 | for (Int_t iPtBoundary = 0; iPtBoundary < 6; iPtBoundary++) {fPtBoundaryPID[iPtBoundary] = ptboundarypid[iPtBoundary];} | |
231 | ||
232 | // Setting the number of bins in pt for the five PID histogram pt classes. | |
233 | Int_t nptbinspid[5] = {8,6,14,13,10}; | |
234 | for (Int_t iPtBins = 0; iPtBins < 5; iPtBins++) {fNPtBinsPID[iPtBins] = nptbinspid[iPtBins];} | |
235 | ||
236 | // Setting the TOF axes for the PID histograms. | |
237 | Double_t toflowerbound[5][3] = {{-2000.,-6000.,-10000.},{-2000.,-4000.,-10000.},{-1000.,-2000.,-5000.},{-1000.,-1000.,-2500.},{-500.,-500.,-1000.}}; | |
238 | Double_t tofupperbound[5][3] = {{10000.,10000.,6000.},{10000.,8000.,6000.},{6000.,6000.,6000.},{6000.,6000.,6000.},{4000.,4000.,6000.}}; | |
239 | Int_t tofbins[5][3] = {{120,160,160},{120,120,160},{140,140,165},{140,140,170},{90,90,140}}; | |
240 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
241 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
242 | fTOFLowerBound[iPtClass][iSpecies] = toflowerbound[iPtClass][iSpecies]; | |
243 | fTOFUpperBound[iPtClass][iSpecies] = tofupperbound[iPtClass][iSpecies]; | |
244 | fTOFbins[iPtClass][iSpecies] = tofbins[iPtClass][iSpecies]; | |
245 | } | |
246 | } | |
247 | ||
248 | // Setting the TPC axes for the PID histograms. | |
249 | Double_t tpclowerbound[5][3] = {{-20.,-50.,-100.},{-20.,-30.,-80.},{-25.,-25.,-45.},{-25.,-25.,-45.},{-25.,-20.,-20.}}; | |
250 | Double_t tpcupperbound[5][3] = {{60.,30.,20.},{60.,40.,20.},{50.,50.,25.},{45.,45.,25.},{25.,30.,30.}}; // Check highest pT bin boundaries for K,p | |
251 | Int_t tpcbins[5][3] = {{80,80,120},{80,70,100},{75,75,70},{70,70,70},{50,50,50}}; | |
252 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
253 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
254 | fTPCLowerBound[iPtClass][iSpecies] = tpclowerbound[iPtClass][iSpecies]; | |
255 | fTPCUpperBound[iPtClass][iSpecies] = tpcupperbound[iPtClass][iSpecies]; | |
256 | fTPCbins[iPtClass][iSpecies] = tpcbins[iPtClass][iSpecies]; | |
257 | } | |
258 | } | |
259 | ||
260 | // Names for the 12 (species,charge) combinations considered. | |
261 | const char* histoname[12] = {"AllCharged","Pos","Neg","AllPion","PosPion","NegPion","AllKaon","PosKaon","NegKaon","AllProton","PosProton","NegProton"}; | |
262 | const char* histolatex[12] = {"ch","ch^{+}","ch^{-}","#pi^{+/-}","#pi^{+}","#pi^{-}","K^{+/-}","K^{+}","K^{-}","p/#bar{p}","p","#bar{p}"}; | |
263 | for (Int_t iHistoName = 0; iHistoName < 12; iHistoName++) { | |
264 | fHistoName[iHistoName] = histoname[iHistoName]; | |
265 | fHistoLatex[iHistoName] = histolatex[iHistoName]; | |
266 | } | |
267 | ||
268 | // Names of the 3 species considered. | |
269 | const char* particlename[3] = {"Pion","Kaon","Proton"}; | |
270 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {fParticleName[iSpecies] = particlename[iSpecies];} | |
271 | ||
272 | // Names of the 5 pt classes considered for the PID histograms. | |
273 | const char* ptclassname[5] = {"VeryLowPt","LowPt","MedPt","MedHighPt","HighPt"}; | |
274 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) {fPtClassName[iPtClass] = ptclassname[iPtClass];} | |
275 | ||
276 | } | |
277 | ||
278 | // ------------------------------------------------------------------------- | |
279 | AliAODTrackCutsDiHadronPID::~AliAODTrackCutsDiHadronPID() { | |
280 | ||
281 | // | |
282 | // Destructor | |
283 | // | |
284 | ||
285 | cout<<"AliAODTrackCutsDiHadronPID Destructor Called."<<endl; | |
286 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
287 | ||
288 | if (fDataTrackQAHistos) delete fDataTrackQAHistos; | |
289 | fDataTrackQAHistos = 0x0; | |
290 | if (fPrimRecMCTrackQAHistos) delete fPrimRecMCTrackQAHistos; | |
291 | fPrimRecMCTrackQAHistos = 0x0; | |
292 | if (fPrimGenMCTrackQAHistos) delete fPrimGenMCTrackQAHistos; | |
293 | fPrimGenMCTrackQAHistos = 0x0; | |
294 | if (fSecRecMCTrackQAHistos) delete fSecRecMCTrackQAHistos; | |
295 | fSecRecMCTrackQAHistos = 0x0; | |
296 | if (fSecGenMCTrackQAHistos) delete fSecGenMCTrackQAHistos; | |
297 | fSecGenMCTrackQAHistos = 0x0; | |
298 | ||
299 | } | |
300 | ||
301 | // ------------------------------------------------------------------------- | |
302 | Long64_t AliAODTrackCutsDiHadronPID::Merge(TCollection* list) { | |
303 | ||
304 | // | |
305 | // Merger. | |
306 | // | |
307 | ||
308 | cout<<"AliAODTrackCutsDiHadronPID Merger Called."<<endl; | |
309 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
310 | ||
311 | Bool_t HistosOK = kTRUE; | |
312 | ||
313 | if (fIsMC) { | |
314 | if (!fPrimGenMCTrackQAHistos||!fSecGenMCTrackQAHistos||!fPrimRecMCTrackQAHistos||!fSecRecMCTrackQAHistos) {HistosOK = kFALSE;} | |
315 | } else { | |
316 | if (!fDataTrackQAHistos) {HistosOK = kFALSE;} | |
317 | } | |
318 | ||
319 | if (!HistosOK) { | |
320 | cout<<"AliAODTrackCutsDiHadronPID::Merge() - Warning, current object's histograms are missing... Generating."<<endl; | |
321 | CreateHistos(); | |
322 | } | |
323 | ||
324 | if (!list) { | |
325 | //cout<<"No list available..."<<endl; | |
326 | return 0; | |
327 | } | |
328 | if (list->IsEmpty()) { | |
329 | //cout<<"List is empty..."<<endl; | |
330 | return 1; | |
331 | } | |
332 | ||
333 | //Int_t NEntries = list->GetEntries(); | |
334 | //cout<<"Supplied list has "<<NEntries<<" entries."<<endl; | |
335 | ||
336 | TIterator* iter = list->MakeIterator(); | |
337 | TObject* obj; | |
338 | ||
339 | // List of collections | |
340 | TList collection_fDataTrackQAHistos; | |
341 | TList collection_fPrimRecMCTrackQAHistos; | |
342 | TList collection_fPrimGenMCTrackQAHistos; | |
343 | TList collection_fSecRecMCTrackQAHistos; | |
344 | TList collection_fSecGenMCTrackQAHistos; | |
345 | ||
346 | Int_t count = 0; | |
347 | ||
348 | while ((obj = iter->Next())) { | |
349 | AliAODTrackCutsDiHadronPID* entry = dynamic_cast<AliAODTrackCutsDiHadronPID*> (obj); | |
350 | if (entry == 0) continue; | |
351 | ||
352 | // Check if the object to be merged really has the same name! (FIXME!) | |
353 | ||
354 | // Getting the lists from obj. | |
355 | TList* list_fDataTrackQAHistos = entry->GetListOfDataQAHistos(); | |
356 | TList* list_fPrimRecMCTrackQAHistos = entry->GetListOfPrimRecMCTrackQAHistos(); | |
357 | TList* list_fPrimGenMCTrackQAHistos = entry->GetListOfPrimGenMCTrackQAHistos(); | |
358 | TList* list_fSecRecMCTrackQAHistos = entry->GetListOfSecRecMCTrackQAHistos(); | |
359 | TList* list_fSecGenMCTrackQAHistos = entry->GetListOfSecGenMCTrackQAHistos(); | |
360 | ||
361 | // Adding the retrieved lists to the collection. | |
362 | if (list_fDataTrackQAHistos) collection_fDataTrackQAHistos.Add(list_fDataTrackQAHistos); | |
363 | if (list_fPrimRecMCTrackQAHistos) collection_fPrimRecMCTrackQAHistos.Add(list_fPrimRecMCTrackQAHistos); | |
364 | if (list_fPrimGenMCTrackQAHistos) collection_fPrimGenMCTrackQAHistos.Add(list_fPrimGenMCTrackQAHistos); | |
365 | if (list_fSecRecMCTrackQAHistos) collection_fSecRecMCTrackQAHistos.Add(list_fSecRecMCTrackQAHistos); | |
366 | if (list_fSecGenMCTrackQAHistos) collection_fSecGenMCTrackQAHistos.Add(list_fSecGenMCTrackQAHistos); | |
367 | ||
368 | //cout<<"Entries intermediate list Data: "<<collection_fDataTrackQAHistos.GetEntries()<<endl; | |
369 | //cout<<"Entries intermediate list RecMC: "<<collection_fPrimRecMCTrackQAHistos.GetEntries()<<endl; | |
370 | ||
371 | count++; | |
372 | } | |
373 | ||
374 | // Merging. Note that we require the original list to exist. | |
375 | // * Assume that if the collection happens to be empty, then nothing will happen. | |
376 | // |-> This of course leads to some problems, since if the first file does not | |
377 | // | have such a list, then the merged file will have no results... | |
378 | // | IDEA: if fDataTrackQAHistos does not exist, then create a new one. (TO DO) | |
379 | // * All other variables are taken from the original object. | |
380 | if (fDataTrackQAHistos) fDataTrackQAHistos->Merge(&collection_fDataTrackQAHistos); | |
381 | if (fPrimRecMCTrackQAHistos) fPrimRecMCTrackQAHistos->Merge(&collection_fPrimRecMCTrackQAHistos); | |
382 | if (fPrimGenMCTrackQAHistos) fPrimGenMCTrackQAHistos->Merge(&collection_fPrimGenMCTrackQAHistos); | |
383 | if (fSecRecMCTrackQAHistos) fSecRecMCTrackQAHistos->Merge(&collection_fSecRecMCTrackQAHistos); | |
384 | if (fSecGenMCTrackQAHistos) fSecGenMCTrackQAHistos->Merge(&collection_fSecGenMCTrackQAHistos); | |
385 | ||
386 | delete iter; | |
387 | ||
388 | return count+1; | |
389 | ||
390 | } | |
391 | ||
392 | // ------------------------------------------------------------------------- | |
393 | void AliAODTrackCutsDiHadronPID::PrintCuts() {} | |
394 | ||
395 | // ------------------------------------------------------------------------- | |
396 | void AliAODTrackCutsDiHadronPID::CreateHistos() { | |
397 | ||
398 | // Function should be called by the UserCreateOutput() function of the | |
399 | // analysis task. This function then generates all the histograms that | |
400 | // were requested locally on the workernode. Even if case that the | |
401 | // histograms are not filled, it is imperative that they are still | |
402 | // created, and in the same order, otherwise problems with merging will | |
403 | // arise. | |
404 | ||
405 | // TODO: In principle it should never happen that if this method is called, | |
406 | // that the lists of QA histograms already exist, so this may become a fatal error | |
407 | // instead of a warning. | |
408 | ||
409 | cout<<"AliAODTrackCutsDiHadronPID - Creating histograms for cuts: "<<fName<<endl; | |
410 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
411 | ||
412 | if (fIsMC) { | |
413 | ||
414 | if (!fPrimGenMCTrackQAHistos) { | |
415 | cout<<"AliAODTrackCutsDiHadronPID - Creating Prim. Gen. MC Track QA TList..."<<endl; | |
416 | fPrimGenMCTrackQAHistos = new TList(); | |
417 | fPrimGenMCTrackQAHistos->SetName("PrimGenMCTrackQAHistos"); | |
418 | fPrimGenMCTrackQAHistos->SetOwner(kTRUE); | |
419 | } else {cout<<"AliAODTrackCutsDiHadronPID - Warning, Prim. Gen. MC Track QA TList was already created..."<<endl;} | |
420 | ||
421 | if (!fSecGenMCTrackQAHistos) { | |
422 | cout<<"AliAODTrackCutsDiHadronPID - Creating Sec. Gen. MC Track QA TList..."<<endl; | |
423 | fSecGenMCTrackQAHistos = new TList(); | |
424 | fSecGenMCTrackQAHistos->SetName("SecGenMCTrackQAHistos"); | |
425 | fSecGenMCTrackQAHistos->SetOwner(kTRUE); | |
426 | for (Int_t iHistoClass = 0; iHistoClass < 12; iHistoClass++) {if (fHistRequested[iHistoClass]) {InitializeGenMCHistos(iHistoClass);}} | |
427 | } else {cout<<"AliAODTrackCutsDiHadronPID - Warning, Sec. Gen. MC Track QA TList was already created..."<<endl;} | |
428 | ||
429 | if (!fPrimRecMCTrackQAHistos) { | |
430 | cout<<"AliAODTrackCutsDiHadronPID - Creating Prim. Rec. MC Track QA TList..."<<endl; | |
431 | fPrimRecMCTrackQAHistos = new TList(); | |
432 | fPrimRecMCTrackQAHistos->SetName("PrimRecMCTrackQAHistos"); | |
433 | fPrimRecMCTrackQAHistos->SetOwner(kTRUE); | |
434 | } else {cout<<"AliAODTrackCutsDiHadronPID - Warning, Prim. Rec. MC Track QA TList was already created..."<<endl;} | |
435 | ||
436 | if (!fSecRecMCTrackQAHistos) { | |
437 | cout<<"AliAODTrackCutsDiHadronPID - Creating Sec. Rec. MC Track QA TList..."<<endl; | |
438 | fSecRecMCTrackQAHistos = new TList(); | |
439 | fSecRecMCTrackQAHistos->SetName("SecRecMCTrackQAHistos"); | |
440 | fSecRecMCTrackQAHistos->SetOwner(kTRUE); | |
441 | for (Int_t iHistoClass = 0; iHistoClass < 12; iHistoClass++) { | |
442 | if (fHistRequested[iHistoClass]) { | |
443 | InitializeRecMCHistos(iHistoClass); | |
444 | } | |
445 | } | |
446 | } else {cout<<"AliAODTrackCutsDiHadronPID - Warning, Sec. Rec. MC Track QA TList was already created..."<<endl;} | |
447 | ||
448 | } else { | |
449 | ||
450 | if (!fDataTrackQAHistos) { | |
451 | cout<<"AliAODTrackCutsDiHadronPID - Creating Data Track QA TList..."<<endl; | |
452 | fDataTrackQAHistos = new TList(); | |
453 | fDataTrackQAHistos->SetName("DataTrackQAHistos"); | |
454 | fDataTrackQAHistos->SetOwner(kTRUE); | |
455 | for (Int_t iHistoClass = 0; iHistoClass < 12; iHistoClass++) { | |
456 | fHistDataDCAxyOneSigma[iHistoClass] = InitializeDCASpectrum("fHistDataDCAxyOneSigma",iHistoClass); | |
457 | fDataTrackQAHistos->Add(fHistDataDCAxyOneSigma[iHistoClass]); | |
458 | if (fHistRequested[iHistoClass]) { if (iHistoClass < 3) {InitializeDataHistos(iHistoClass);}} | |
459 | } | |
460 | } else {cout<<"AliAODTrackCutsDiHadronPID - Warning, Data QA TList was already created..."<<endl;} | |
461 | ||
462 | } | |
463 | } | |
464 | ||
465 | // ------------------------------------------------------------------------- | |
466 | void AliAODTrackCutsDiHadronPID::StartNewEvent() { | |
467 | ||
468 | // FIXME: This method is now only suited for Data (3 histo classes only.) | |
469 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
470 | ||
471 | // Resetting the counters. | |
472 | for (Int_t iHistoClass = 0; iHistoClass < 3; iHistoClass++) { | |
473 | fNTracks[iHistoClass] = 0; | |
474 | } | |
475 | } | |
476 | ||
477 | // ------------------------------------------------------------------------- | |
478 | void AliAODTrackCutsDiHadronPID::EventIsDone(Bool_t IsMC) { | |
479 | ||
480 | // FIXME: This method is now only suited for Data (3 histo classes only.) | |
481 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
482 | ||
483 | // Fill NTracks histos. | |
484 | ||
485 | for (Int_t iHistoClass = 0; iHistoClass < 3; iHistoClass++) { | |
486 | ||
487 | if (fHistRequested[iHistoClass]) { | |
488 | ||
489 | if (IsMC) { | |
490 | // THE FOLLOWING SHOULD NEVER HAPPEN. | |
491 | //if (!fHistPrimRecMCPt[iHistoClass]) InitializeRecMCHistos(iHistoClass); | |
492 | fHistPrimRecNTracks[iHistoClass]->Fill(fNTracks[iHistoClass]); | |
493 | } else { | |
494 | // THE FOLLOWING SHOULD NEVER HAPPEN. | |
495 | //if (!fHistDataPt[iHistoClass]) InitializeDataHistos(iHistoClass); | |
496 | fHistDataNTracks[iHistoClass]->Fill(fNTracks[iHistoClass]); | |
497 | } | |
498 | } | |
499 | } | |
500 | } | |
501 | ||
502 | // ------------------------------------------------------------------------- | |
503 | Bool_t AliAODTrackCutsDiHadronPID::IsSelectedData(AliTrackDiHadronPID* track, Double_t randomhittime) { | |
504 | ||
505 | // | |
506 | // Checks performed on a data track. | |
507 | // | |
508 | ||
509 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
510 | ||
511 | if (!track) return kFALSE; | |
512 | ||
513 | if (!fDataTrackQAHistos) {cout<<"AliAODTrackCutsDiHadronPID - Histograms were not created, you should have called CreateHistos()..."<<endl;} | |
514 | ||
515 | // Check the track cuts (NB. check function return kTRUE if track is accepted.) | |
516 | if (!CheckPt(track->Pt())) return kFALSE; | |
517 | if (!CheckMaxEta(track->Eta())) return kFALSE; | |
518 | if (!CheckFilterMask(track->GetFilterMap())) return kFALSE; | |
519 | if (!CheckFlags(track->GetFlags())) return kFALSE; | |
520 | if (!CheckTOFmismatch(track->IsTOFmismatch())) return kFALSE; | |
521 | ||
522 | Int_t NSPDhits = 0; | |
523 | if (track->HasPointOnITSLayer(0)) NSPDhits++; | |
524 | if (track->HasPointOnITSLayer(1)) NSPDhits++; | |
525 | if (!CheckPtDeptDCACut(track->GetZAtDCA(),track->GetXYAtDCA(),track->Pt(),NSPDhits)) return kFALSE; | |
526 | ||
527 | // Track has passed the cuts, fill QA histograms. | |
528 | for (Int_t iHistoClass = 0; iHistoClass < 3; iHistoClass++) { | |
529 | ||
530 | if (fHistRequested[iHistoClass]) { | |
531 | ||
532 | // Check the charge (could be neater). | |
533 | if ((iHistoClass == 0) && (track->Charge() == 0)) continue; | |
534 | if ((iHistoClass == 1) && (track->Charge() <= 0)) continue; | |
535 | if ((iHistoClass == 2) && (track->Charge() >= 0)) continue; | |
536 | ||
537 | FillDataHistos(iHistoClass, track); | |
538 | ||
539 | // Ignore if random hit is < -1.e20. | |
540 | if (randomhittime > -1.e20) FillTOFMismatchHistos(iHistoClass,track,randomhittime); | |
541 | ||
542 | fNTracks[iHistoClass]++; | |
543 | ||
544 | } | |
545 | } | |
546 | ||
547 | // Track Has Passed. | |
548 | return kTRUE; | |
549 | ||
550 | } | |
551 | ||
552 | // ------------------------------------------------------------------------- | |
553 | Bool_t AliAODTrackCutsDiHadronPID::IsSelectedGeneratedMC(AliAODMCParticle* particle) { | |
554 | ||
555 | // | |
556 | // Checks performed on a generated MC particle. | |
557 | // | |
558 | ||
559 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
560 | ||
561 | // PDG codes for particles: | |
562 | // pi+ 211, K+ 321, p 2212 | |
563 | ||
564 | if (!particle) return kFALSE; | |
565 | ||
566 | if (!fPrimGenMCTrackQAHistos||!fSecGenMCTrackQAHistos) {cout<<"AliAODTrackCutsDiHadronPID - Histograms were not created, you should have called CreateHistos()..."<<endl;} | |
567 | ||
568 | // Check the track cuts. | |
569 | if (!CheckPt(particle->Pt())) return kFALSE; | |
570 | if (!CheckMaxEta(particle->Eta())) return kFALSE; | |
571 | if (!CheckRapidity(particle->Y())) return kFALSE; // NEW: rapidity cut. (not done on data) | |
572 | ||
573 | // NOT YET IMPLEMENTED! - Histoclasses for specific particles. | |
574 | for (Int_t iHistoClass = 0; iHistoClass < 12; iHistoClass++) { | |
575 | ||
576 | if (fHistRequested[iHistoClass]) { | |
577 | ||
578 | // Check the charge (could be neater). | |
579 | if ((iHistoClass == 0) && (particle->Charge() == 0)) continue; | |
580 | if ((iHistoClass == 1) && (particle->Charge() <= 0)) continue; | |
581 | if ((iHistoClass == 2) && (particle->Charge() >= 0)) continue; | |
582 | if ((iHistoClass == 3) && (TMath::Abs(particle->GetPdgCode()) != 211)) continue; | |
583 | if ((iHistoClass == 4) && (particle->GetPdgCode()) != 211) continue; | |
584 | if ((iHistoClass == 5) && (particle->GetPdgCode()) != -211) continue; | |
585 | if ((iHistoClass == 6) && (TMath::Abs(particle->GetPdgCode()) != 321)) continue; | |
586 | if ((iHistoClass == 7) && (particle->GetPdgCode()) != 321) continue; | |
587 | if ((iHistoClass == 8) && (particle->GetPdgCode()) != -321) continue; | |
588 | if ((iHistoClass == 9) && (TMath::Abs(particle->GetPdgCode()) != 2212)) continue; | |
589 | if ((iHistoClass == 10) && (particle->GetPdgCode()) != 2212) continue; | |
590 | if ((iHistoClass == 11) && (particle->GetPdgCode()) != -2212) continue; | |
591 | ||
592 | // Secondary specification not set. | |
593 | //cout<<"Charge: "<<particle->Charge()<<" PDG code: "<<particle->GetPdgCode()<<endl; | |
594 | //cout<<particle->IsPhysicalPrimary()<<" "<<particle->IsSecondaryFromWeakDecay()<<" "<<particle->IsSecondaryFromMaterial()<<endl; | |
595 | ||
596 | // These two functions are not implemented... | |
597 | if (particle->IsSecondaryFromWeakDecay()) cout<<"Secondary From Weak Decay!"<<endl; | |
598 | if (particle->IsSecondaryFromMaterial()) cout<<"Secondary From Material!"<<endl; | |
599 | ||
600 | FillGenMCHistos(iHistoClass, particle); | |
601 | ||
602 | } | |
603 | } | |
604 | ||
605 | // Particle has Passed. | |
606 | return kTRUE; | |
607 | ||
608 | } | |
609 | ||
610 | // ------------------------------------------------------------------------- | |
611 | Bool_t AliAODTrackCutsDiHadronPID::IsSelectedReconstructedMC(AliTrackDiHadronPID* track) { | |
612 | ||
613 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
614 | ||
615 | if (!track) return kFALSE; | |
616 | ||
617 | if (!fPrimRecMCTrackQAHistos||!fSecRecMCTrackQAHistos) {cout<<"AliAODTrackCutsDiHadronPID - Histograms were not created, you should have called CreateHistos()..."<<endl;} | |
618 | ||
619 | // Check the track cuts. | |
620 | if (!CheckPt(track->MCPt())) return kFALSE; // Kinematic cuts are done on the MC particles | |
621 | if (!CheckMaxEta(track->MCEta())) return kFALSE; // and not on the data. | |
622 | if (!CheckRapidity(track->MCY())) return kFALSE; // NEW: rapidity cut. | |
623 | if (!CheckFilterMask(track->GetFilterMap())) return kFALSE; | |
624 | if (!CheckFlags(track->GetFlags())) return kFALSE; | |
625 | ||
626 | Int_t NSPDhits = 0; | |
627 | if (track->HasPointOnITSLayer(0)) NSPDhits++; | |
628 | if (track->HasPointOnITSLayer(1)) NSPDhits++; | |
629 | if (!CheckPtDeptDCACut(track->GetZAtDCA(),track->GetXYAtDCA(),track->Pt(),NSPDhits)) return kFALSE; | |
630 | ||
631 | // Track has passed the cuts, fill QA histograms. | |
632 | for (Int_t iHistoClass = 0; iHistoClass < 12; iHistoClass++) { | |
633 | ||
634 | if (fHistRequested[iHistoClass]) { | |
635 | ||
636 | // Check the charge (could be neater). | |
637 | if ((iHistoClass == 0) && (track->Charge() == 0)) continue; | |
638 | if ((iHistoClass == 1) && (track->Charge() <= 0)) continue; | |
639 | if ((iHistoClass == 2) && (track->Charge() >= 0)) continue; | |
640 | if ((iHistoClass == 3) && (TMath::Abs(track->GetPdgCode()) != 211)) continue; | |
641 | if ((iHistoClass == 4) && (track->GetPdgCode()) != 211) continue; | |
642 | if ((iHistoClass == 5) && (track->GetPdgCode()) != -211) continue; | |
643 | if ((iHistoClass == 6) && (TMath::Abs(track->GetPdgCode()) != 321)) continue; | |
644 | if ((iHistoClass == 7) && (track->GetPdgCode()) != 321) continue; | |
645 | if ((iHistoClass == 8) && (track->GetPdgCode()) != -321) continue; | |
646 | if ((iHistoClass == 9) && (TMath::Abs(track->GetPdgCode()) != 2212)) continue; | |
647 | if ((iHistoClass == 10) && (track->GetPdgCode()) != 2212) continue; | |
648 | if ((iHistoClass == 11) && (track->GetPdgCode()) != -2212) continue; | |
649 | ||
650 | FillRecMCHistos(iHistoClass, track); | |
651 | ||
652 | fNTracks[iHistoClass]++; | |
653 | } | |
654 | } | |
655 | ||
656 | // Track Has Passed. | |
657 | return kTRUE; | |
658 | ||
659 | } | |
660 | ||
661 | // ------------------------------------------------------------------------- | |
662 | Bool_t AliAODTrackCutsDiHadronPID::FillDataHistos(Int_t histoclass, AliTrackDiHadronPID* track) { | |
663 | ||
664 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
665 | ||
666 | // Fill the histograms. | |
667 | fHistDataPt[histoclass]->Fill(track->Pt()); | |
668 | ||
669 | // Fill DCA histograms. | |
670 | fHistDataDCAxy[histoclass]->Fill(track->GetXYAtDCA()); | |
671 | fHistDataDCAz[histoclass]->Fill(track->GetZAtDCA()); | |
672 | ||
673 | // Fill DCA_{xy} one sigma histograms. | |
674 | Int_t checkSum = 0; | |
675 | // histoclass = 0: all charges; histoclass = 1: positive; histoclass = 2: negative; | |
676 | if (TMath::Sqrt(track->GetNumberOfSigmasTOF(0) * track->GetNumberOfSigmasTOF(0) + | |
677 | track->GetNumberOfSigmasTPC(0) * track->GetNumberOfSigmasTPC(0)) < 1.) { | |
678 | fHistDataDCAxyOneSigma[0 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // All species. | |
679 | fHistDataDCAxyOneSigma[3 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // Pions. | |
680 | // checkSum++; cout<<"Pion found: nSigTOF: "<<track->GetNumberOfSigmasTOF(0)<<"; nSigTPC: "<<track->GetNumberOfSigmasTPC(0)<<endl; | |
681 | } | |
682 | if (TMath::Sqrt(track->GetNumberOfSigmasTOF(1) * track->GetNumberOfSigmasTOF(1) + | |
683 | track->GetNumberOfSigmasTPC(1) * track->GetNumberOfSigmasTPC(1)) < 1.) { | |
684 | fHistDataDCAxyOneSigma[0 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // All species. | |
685 | fHistDataDCAxyOneSigma[6 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // Kaons. | |
686 | // checkSum++; cout<<"Kaon found: nSigTOF: "<<track->GetNumberOfSigmasTOF(1)<<"; nSigTPC: "<<track->GetNumberOfSigmasTPC(1)<<endl; | |
687 | } | |
688 | if (TMath::Sqrt(track->GetNumberOfSigmasTOF(2) * track->GetNumberOfSigmasTOF(2) + | |
689 | track->GetNumberOfSigmasTPC(2) * track->GetNumberOfSigmasTPC(2)) < 1.) { | |
690 | fHistDataDCAxyOneSigma[0 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // All species. | |
691 | fHistDataDCAxyOneSigma[9 + histoclass]->Fill(track->Pt(),track->GetXYAtDCA()); // Protons. | |
692 | // checkSum++; cout<<"Proton found: nSigTOF: "<<track->GetNumberOfSigmasTOF(2)<<"; nSigTPC: "<<track->GetNumberOfSigmasTPC(2)<<endl; | |
693 | } | |
694 | ||
695 | // check for double identification (or triple..) | |
696 | if(checkSum > 1) {AliError("More than one particle identified for the same track!"); } | |
697 | ||
698 | // Fill PID histos. | |
699 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
700 | ||
701 | // Note that a possible Y cut is only done on the PID cuts! | |
702 | if (!CheckRapidity(track->Y(iSpecies))) continue; | |
703 | ||
704 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
705 | fHistDataPID[histoclass][iSpecies][iPtClass]->Fill(track->Pt(),track->GetTOFsignalMinusExpected(iSpecies),track->GetTPCsignalMinusExpected(iSpecies)); | |
706 | } | |
707 | } | |
708 | ||
709 | return kTRUE; | |
710 | ||
711 | } | |
712 | ||
713 | // ------------------------------------------------------------------------- | |
714 | Bool_t AliAODTrackCutsDiHadronPID::FillTOFMismatchHistos(Int_t histoclass, AliTrackDiHadronPID* track, Double_t randomhittime) { | |
715 | ||
716 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
717 | ||
718 | // Fill TOF mismatch. | |
719 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
720 | ||
721 | // Note that a possible Y cut is only done on the PID cuts! | |
722 | if (!CheckRapidity(track->Y(iSpecies))) continue; | |
723 | ||
724 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
725 | fHistTOFMismatch[histoclass][iSpecies][iPtClass]->Fill(track->Pt(),randomhittime - track->GetTOFsignalExpected(iSpecies)); | |
726 | } | |
727 | } | |
728 | ||
729 | return kTRUE; | |
730 | ||
731 | } | |
732 | ||
733 | // ------------------------------------------------------------------------- | |
734 | Bool_t AliAODTrackCutsDiHadronPID::FillGenMCHistos(Int_t histoclass, AliAODMCParticle* particle) { | |
735 | ||
736 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
737 | ||
738 | // Fill the histograms. | |
739 | if (particle->IsPhysicalPrimary()) { | |
740 | fHistPrimGenMCPt[histoclass]->Fill(particle->Pt()); | |
741 | } else { | |
742 | fHistSecGenMCPt[histoclass]->Fill(particle->Pt()); | |
743 | } | |
744 | ||
745 | return kTRUE; | |
746 | ||
747 | } | |
748 | ||
749 | // ------------------------------------------------------------------------- | |
750 | Bool_t AliAODTrackCutsDiHadronPID::FillRecMCHistos(Int_t histoclass, AliTrackDiHadronPID* track) { | |
751 | ||
752 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
753 | ||
754 | // Fill the Pt histograms. | |
755 | if (track->IsPhysicalPrimary()) { | |
756 | fHistPrimRecMCPt[histoclass]->Fill(track->Pt()); | |
757 | } else { | |
758 | fHistSecRecMCPt[histoclass]->Fill(track->Pt()); | |
759 | } | |
760 | ||
761 | // Fill the DCA histograms. | |
762 | if (track->IsPhysicalPrimary()) { | |
763 | fHistPrimRecMCDCA[histoclass]->Fill(track->Pt(), track->GetXYAtDCA()); | |
764 | } | |
765 | if (track->IsSecondaryFromMaterial()) { | |
766 | fHistSecRecMCDCAMat[histoclass]->Fill(track->Pt(), track->GetXYAtDCA()); | |
767 | } | |
768 | if (track->IsSecondaryFromWeakDecay()) { | |
769 | fHistSecRecMCDCAWeak[histoclass]->Fill(track->Pt(), track->GetXYAtDCA()); | |
770 | } | |
771 | ||
772 | return kTRUE; | |
773 | ||
774 | } | |
775 | ||
776 | // ------------------------------------------------------------------------- | |
777 | Bool_t AliAODTrackCutsDiHadronPID::InitializeDataHistos(Int_t histoclass) { | |
778 | ||
779 | cout<<"AliAODTrackCutsDiHadronPID - Creating Data Histograms of Class "<<histoclass<<endl; | |
780 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
781 | ||
782 | // Add the Pt spectra. | |
783 | fHistDataPt[histoclass] = InitializePtSpectrum("fHistDataPt",histoclass); | |
784 | fDataTrackQAHistos->Add(fHistDataPt[histoclass]); | |
785 | ||
786 | // Add the NTrack histograms. | |
787 | fHistDataNTracks[histoclass] = InitializeNTracksHisto("fHistDataNTracks",histoclass); | |
788 | fDataTrackQAHistos->Add(fHistDataNTracks[histoclass]); | |
789 | ||
790 | // Add the DCA histograms. | |
791 | fHistDataDCAxy[histoclass] = InitializeDCAxyHisto("fHistDCAxy",histoclass); | |
792 | fDataTrackQAHistos->Add(fHistDataDCAxy[histoclass]); | |
793 | fHistDataDCAz[histoclass] = InitializeDCAzHisto("fHistDCAz",histoclass); | |
794 | fDataTrackQAHistos->Add(fHistDataDCAz[histoclass]); | |
795 | ||
796 | // Add the PID histograms. (FIXME shoudl be able to turn the creation of these histos off.) | |
797 | for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) { | |
798 | for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) { | |
799 | fHistDataPID[histoclass][iSpecies][iPtClass] = InitializePIDHisto("fHistDataPID",histoclass,iSpecies,iPtClass); | |
800 | fDataTrackQAHistos->Add(fHistDataPID[histoclass][iSpecies][iPtClass]); | |
801 | fHistTOFMismatch[histoclass][iSpecies][iPtClass] = InitializeTOFMismatchHisto("fHistTOFMismatch",histoclass,iSpecies,iPtClass); | |
802 | fDataTrackQAHistos->Add(fHistTOFMismatch[histoclass][iSpecies][iPtClass]); | |
803 | } | |
804 | } | |
805 | ||
806 | return kTRUE; | |
807 | ||
808 | } | |
809 | ||
810 | // ------------------------------------------------------------------------- | |
811 | Bool_t AliAODTrackCutsDiHadronPID::InitializeGenMCHistos(Int_t histoclass) { | |
812 | ||
813 | cout<<"AliAODTrackCutsDiHadronPID - Creating Generated MC Histograms of Class "<<histoclass<<endl; | |
814 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
815 | ||
816 | // Primary Particles. | |
817 | fHistPrimGenMCPt[histoclass] = InitializePtSpectrum("fHistPrimGenMCPt",histoclass); | |
818 | fPrimGenMCTrackQAHistos->Add(fHistPrimGenMCPt[histoclass]); | |
819 | ||
820 | // Secondary Particles. | |
821 | fHistSecGenMCPt[histoclass] = InitializePtSpectrum("fHistSecGenMCPt",histoclass); | |
822 | fSecGenMCTrackQAHistos->Add(fHistSecGenMCPt[histoclass]); | |
823 | ||
824 | return kTRUE; | |
825 | ||
826 | } | |
827 | ||
828 | // ------------------------------------------------------------------------- | |
829 | Bool_t AliAODTrackCutsDiHadronPID::InitializeRecMCHistos(Int_t histoclass) { | |
830 | ||
831 | cout<<"AliAODTrackCutsDiHadronPID - Creating Reconstructed MC Histograms of Class "<<histoclass<<endl; | |
832 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
833 | ||
834 | // Primary Particles. | |
835 | fHistPrimRecMCPt[histoclass] = InitializePtSpectrum("fHistPrimRecMCPt",histoclass); | |
836 | fPrimRecMCTrackQAHistos->Add(fHistPrimRecMCPt[histoclass]); | |
837 | ||
838 | fHistPrimRecNTracks[histoclass] = InitializeNTracksHisto("fHistPrimRecNTracks",histoclass); | |
839 | fPrimRecMCTrackQAHistos->Add(fHistPrimRecNTracks[histoclass]); | |
840 | ||
841 | fHistPrimRecMCDCA[histoclass] = InitializeDCASpectrum("fHistPrimRecDCA",histoclass); | |
842 | fPrimRecMCTrackQAHistos->Add(fHistPrimRecMCDCA[histoclass]); | |
843 | ||
844 | // Secondary Particles. | |
845 | fHistSecRecMCPt[histoclass] = InitializePtSpectrum("fHistSecRecMCPt",histoclass); | |
846 | fSecRecMCTrackQAHistos->Add(fHistSecRecMCPt[histoclass]); | |
847 | ||
848 | fHistSecRecMCDCAMat[histoclass] = InitializeDCASpectrum("fHistSecRecDCAMat",histoclass); | |
849 | fSecRecMCTrackQAHistos->Add(fHistSecRecMCDCAMat[histoclass]); | |
850 | ||
851 | fHistSecRecMCDCAWeak[histoclass] = InitializeDCASpectrum("fHistSecRecDCAWeak",histoclass); | |
852 | fSecRecMCTrackQAHistos->Add(fHistSecRecMCDCAWeak[histoclass]); | |
853 | ||
854 | return kTRUE; | |
855 | ||
856 | } | |
857 | ||
858 | // ------------------------------------------------------------------------- | |
859 | TH1F* AliAODTrackCutsDiHadronPID::InitializePtSpectrum(const char* name, Int_t histoclass) { | |
860 | ||
861 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
862 | ||
863 | TH1F* hout = new TH1F(Form("%s%s",name,fHistoName[histoclass].Data()), | |
864 | Form("p_{T} Spectrum (%s);p_{T} (GeV/c);Count",fHistoName[histoclass].Data()),fNPtBins,fPtAxis); | |
865 | ||
866 | hout->SetDirectory(0); | |
867 | ||
868 | return hout; | |
869 | ||
870 | } | |
871 | ||
872 | // ------------------------------------------------------------------------- | |
873 | TH2F* AliAODTrackCutsDiHadronPID::InitializeDCASpectrum(const char* name, Int_t histoclass){ | |
874 | ||
875 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
876 | ||
877 | TH2F* hout = new TH2F(Form("%s%s",name,fHistoName[histoclass].Data()), | |
878 | Form("DCA_{xy} (%s); p_{T} (GeV/c); DCA_{xy} (cm)",fHistoName[histoclass].Data()), | |
879 | fNPtBins,fPtAxis, | |
880 | 300,-3.,3.); | |
881 | ||
882 | hout->SetDirectory(0); | |
883 | ||
884 | return hout; | |
885 | ||
886 | } | |
887 | ||
888 | // ------------------------------------------------------------------------- | |
889 | TH1F* AliAODTrackCutsDiHadronPID::InitializeNTracksHisto(const char* name, Int_t histoclass) { | |
890 | ||
891 | TH1F* hout = new TH1F(Form("%s%s",name,fHistoName[histoclass].Data()), | |
892 | Form("Number of Accepted Tracks (%s);N%s;Count",fHistoName[histoclass].Data(),fHistoLatex[histoclass].Data()), | |
893 | 100,0,4000); | |
894 | ||
895 | hout->SetDirectory(0); | |
896 | ||
897 | return hout; | |
898 | ||
899 | } | |
900 | ||
901 | // ------------------------------------------------------------------------- | |
902 | TH1F* AliAODTrackCutsDiHadronPID::InitializeDCAxyHisto(const char* name, Int_t histoclass) { | |
903 | ||
904 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
905 | ||
906 | TH1F* hout = new TH1F(Form("%s%s",name,fHistoName[histoclass].Data()), | |
907 | Form("DCAxy (%s);DCAxy (cm);Count",fHistoName[histoclass].Data()),300,-15.,15.); | |
908 | ||
909 | hout->SetDirectory(0); | |
910 | ||
911 | return hout; | |
912 | ||
913 | } | |
914 | ||
915 | // ------------------------------------------------------------------------- | |
916 | TH1F* AliAODTrackCutsDiHadronPID::InitializeDCAzHisto(const char* name, Int_t histoclass) { | |
917 | ||
918 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
919 | ||
920 | TH1F* hout = new TH1F(Form("%s%s",name,fHistoName[histoclass].Data()), | |
921 | Form("DCAz (%s);DCAz (cm);Count",fHistoName[histoclass].Data()),300,-15.,15.); | |
922 | ||
923 | hout->SetDirectory(0); | |
924 | ||
925 | return hout; | |
926 | ||
927 | } | |
928 | ||
929 | // ------------------------------------------------------------------------- | |
930 | TH3F* AliAODTrackCutsDiHadronPID::InitializeAcceptanceHisto(const char* /*name*/, Int_t /*histoclass*/) { | |
931 | ||
932 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
933 | return 0x0; | |
934 | ||
935 | } | |
936 | ||
937 | // ------------------------------------------------------------------------- | |
938 | TH3F* AliAODTrackCutsDiHadronPID::InitializePIDHisto(const char* name, Int_t histoclass, Int_t expspecies, Int_t ptclass) { | |
939 | ||
940 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
941 | ||
942 | TH3F* hout = new TH3F(Form("%s%s%s%s",name,fHistoName[histoclass].Data(),fParticleName[expspecies].Data(),fPtClassName[ptclass].Data()), | |
943 | Form("PID %s (Exp: %s);p_{T} (GeV/c);#Delta t (ms);dE/dx (a.u.)",fHistoName[histoclass].Data(),fParticleName[expspecies].Data()), | |
944 | fNPtBinsPID[ptclass],fPtBoundaryPID[ptclass],fPtBoundaryPID[ptclass+1], | |
945 | fTOFbins[ptclass][expspecies],fTOFLowerBound[ptclass][expspecies],fTOFUpperBound[ptclass][expspecies], | |
946 | fTPCbins[ptclass][expspecies],fTPCLowerBound[ptclass][expspecies],fTPCUpperBound[ptclass][expspecies]); | |
947 | ||
948 | hout->SetDirectory(0); | |
949 | ||
950 | return hout; | |
951 | ||
952 | } | |
953 | ||
954 | // ------------------------------------------------------------------------- | |
955 | TH2F* AliAODTrackCutsDiHadronPID::InitializeTOFMismatchHisto(const char* name, Int_t histoclass, Int_t expspecies, Int_t ptclass) { | |
956 | ||
957 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
958 | ||
959 | TH2F* hout = new TH2F(Form("%s%s%s%s",name,fHistoName[histoclass].Data(),fParticleName[expspecies].Data(),fPtClassName[ptclass].Data()), | |
960 | Form("TOF Mismatch %s (Exp: %s);p_{T} (GeV/c);#Delta t (ms)",fHistoName[histoclass].Data(),fParticleName[expspecies].Data()), | |
961 | fNPtBinsPID[ptclass],fPtBoundaryPID[ptclass],fPtBoundaryPID[ptclass+1], | |
962 | fTOFbins[ptclass][expspecies],fTOFLowerBound[ptclass][expspecies],fTOFUpperBound[ptclass][expspecies]); | |
963 | ||
964 | hout->SetDirectory(0); | |
965 | ||
966 | return hout; | |
967 | ||
968 | } | |
969 | ||
970 | // ------------------------------------------------------------------------- | |
971 | TH1F* AliAODTrackCutsDiHadronPID::GetHistDataTOFProjection(Int_t charge, Int_t species, Int_t ptbin) { | |
972 | ||
973 | // Returns a projection in TOF of the data histogram. | |
974 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
975 | ||
976 | Int_t ptclass = GetPtClass(ptbin); | |
977 | if (ptclass == -1) return 0x0; | |
978 | Int_t bininptclass = GetBinInPtClass(ptbin); | |
979 | ||
980 | // Retrieve original the 3D histogram. | |
981 | TH3F* htmp = (TH3F*)GetHistData(Form("fHistDataPID%s%s%s",fHistoName[charge].Data(),fParticleName[species].Data(),fPtClassName[ptclass].Data())); | |
982 | ||
983 | // Make the projection. | |
984 | TH1F* htmp_proj = (TH1F*)htmp->ProjectionY(Form("TOFprojection_%i_%i_%i",charge,species,ptbin),bininptclass,bininptclass); | |
985 | ||
986 | // Some settings of the output histogram. | |
987 | htmp_proj->SetDirectory(0); | |
988 | htmp_proj->SetTitle(Form("%5.3f < p_{T} < %5.3f",GetPtMinPID(ptbin),GetPtMaxPID(ptbin))); | |
989 | htmp_proj->Sumw2(); | |
990 | ||
991 | return htmp_proj; | |
992 | ||
993 | } | |
994 | ||
995 | // ------------------------------------------------------------------------- | |
996 | TH1F* AliAODTrackCutsDiHadronPID::GetHistDataTOFMismatch(Int_t charge, Int_t species, Int_t ptbin) { | |
997 | ||
998 | // Returns a projection in TOF of the mismatch histogram. | |
999 | if (fDebug) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;} | |
1000 | ||
1001 | Int_t ptclass = GetPtClass(ptbin); | |
1002 | if (ptclass == -1) return 0x0; | |
1003 | Int_t bininptclass = GetBinInPtClass(ptbin); | |
1004 | ||
1005 | // Retrieve the original 2D histogram. | |
1006 | TH2F* htmp = (TH2F*)GetHistData(Form("fHistTOFMismatch%s%s%s",fHistoName[charge].Data(),fParticleName[species].Data(),fPtClassName[ptclass].Data())); | |
1007 | ||
1008 | // Make the projection. | |
1009 | TH1F* htmp_proj = (TH1F*)htmp->ProjectionY(Form("TOFprojectionsMismatch_%i_%i_%i",charge,species,ptbin),bininptclass,bininptclass); | |
1010 | ||
1011 | // Some settings of the output histogram. | |
1012 | htmp_proj->SetDirectory(0); | |
1013 | htmp_proj->SetTitle(Form("%5.3f < p_{T} < %5.3f",GetPtMinPID(ptbin),GetPtMaxPID(ptbin))); | |
1014 | htmp_proj->Sumw2(); | |
1015 | ||
1016 | return htmp_proj; | |
1017 | ||
1018 | } |