]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 1 | ////////////////////////////////////////////////////// |
2 | // | |
3 | // PID performance checker of the TRD | |
4 | // | |
5 | // Performs checks of ESD information for TRD-PID and recalculate PID based on OCDB information | |
6 | // Also provides performance plots on detector based on the PID information - for the moment only | |
7 | // MC source is used but V0 is also possible. Here is a list of detector performance checks | |
8 | // - Integrated dE/dx per chamber | |
9 | // - <PH> as function of time bin and local radial position | |
10 | // - number of clusters/tracklet | |
11 | // - number of tracklets/track | |
12 | // | |
13 | // Author : Alex Wilk <wilka@uni-muenster.de> | |
14 | // Alex Bercuci <A.Bercuci@gsi.de> | |
15 | // Markus Fasel <M.Fasel@gsi.de> | |
16 | // | |
17 | /////////////////////////////////////////////////////// | |
18 | ||
19 | #include "TAxis.h" | |
20 | #include "TROOT.h" | |
21 | #include "TPDGCode.h" | |
22 | #include "TCanvas.h" | |
23 | #include "TF1.h" | |
24 | #include "TH1F.h" | |
25 | #include "TH1D.h" | |
26 | #include "TH2F.h" | |
27 | #include "TProfile.h" | |
28 | #include "TProfile2D.h" | |
29 | #include "TGraph.h" | |
30 | #include "TGraphErrors.h" | |
31 | #include "TLegend.h" | |
32 | ||
33 | #include <TClonesArray.h> | |
34 | #include <TObjArray.h> | |
35 | #include <TList.h> | |
36 | ||
37 | #include "AliESDEvent.h" | |
38 | #include "AliESDInputHandler.h" | |
39 | #include "AliTrackReference.h" | |
40 | ||
41 | #include "AliAnalysisTask.h" | |
42 | ||
43 | #include "AliTRDtrackerV1.h" | |
44 | #include "AliTRDtrackV1.h" | |
45 | #include "AliTRDcluster.h" | |
46 | #include "AliTRDReconstructor.h" | |
47 | #include "AliCDBManager.h" | |
48 | #include "AliTRDpidUtil.h" | |
49 | ||
2e6aa247 | 50 | #include "Cal/AliTRDCalPID.h" |
51 | #include "Cal/AliTRDCalPIDNN.h" | |
1ee39b3a | 52 | #include "AliTRDcheckPID.h" |
53 | #include "info/AliTRDtrackInfo.h" | |
b91fdd71 | 54 | #include "info/AliTRDpidInfo.h" |
1ee39b3a | 55 | |
2e6aa247 | 56 | Char_t const * AliTRDcheckPID::fgMethod[3] = {"LQ", "NN", "ESD"}; |
57 | ||
1ee39b3a | 58 | ClassImp(AliTRDcheckPID) |
59 | ||
60 | //________________________________________________________________________ | |
61 | AliTRDcheckPID::AliTRDcheckPID() | |
f2e89a4c | 62 | :AliTRDrecoTask() |
f8f46e4d | 63 | ,fReconstructor(NULL) |
64 | ,fUtil(NULL) | |
65 | ,fGraph(NULL) | |
66 | ,fPID(NULL) | |
67 | ,fMomentumAxis(NULL) | |
68 | ,fMinNTracklets(AliTRDgeometry::kNlayer) | |
69 | ,fMaxNTracklets(AliTRDgeometry::kNlayer) | |
70 | { | |
71 | // | |
72 | // Default constructor | |
73 | // | |
f2e89a4c | 74 | SetNameTitle("checkPID", "Check TRD PID"); |
f8f46e4d | 75 | } |
76 | ||
f2e89a4c | 77 | //________________________________________________________________________ |
f8f46e4d | 78 | AliTRDcheckPID::AliTRDcheckPID(char* name ) |
f2e89a4c | 79 | :AliTRDrecoTask(name, "Check TRD PID") |
b91fdd71 | 80 | ,fReconstructor(NULL) |
81 | ,fUtil(NULL) | |
82 | ,fGraph(NULL) | |
83 | ,fPID(NULL) | |
84 | ,fMomentumAxis(NULL) | |
1ee39b3a | 85 | ,fMinNTracklets(AliTRDgeometry::kNlayer) |
86 | ,fMaxNTracklets(AliTRDgeometry::kNlayer) | |
87 | { | |
88 | // | |
89 | // Default constructor | |
90 | // | |
91 | ||
92 | fReconstructor = new AliTRDReconstructor(); | |
93 | fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam()); | |
94 | ||
95 | // Initialize momentum axis with default values | |
96 | Double_t defaultMomenta[AliTRDCalPID::kNMom+1]; | |
97 | for(Int_t imom = 0; imom < AliTRDCalPID::kNMom+1; imom++) | |
98 | defaultMomenta[imom] = AliTRDCalPID::GetMomentumBinning(imom); | |
99 | SetMomentumBinning(AliTRDCalPID::kNMom, defaultMomenta); | |
100 | ||
2e6aa247 | 101 | memset(fEfficiency, 0, AliPID::kSPECIES*sizeof(TObjArray*)); |
102 | ||
1ee39b3a | 103 | fUtil = new AliTRDpidUtil(); |
104 | InitFunctorList(); | |
f8f46e4d | 105 | |
106 | DefineOutput(2, TObjArray::Class()); | |
107 | ||
1ee39b3a | 108 | } |
109 | ||
110 | ||
111 | //________________________________________________________________________ | |
112 | AliTRDcheckPID::~AliTRDcheckPID() | |
113 | { | |
b91fdd71 | 114 | if(fPID){fPID->Delete(); delete fPID;} |
115 | if(fGraph){fGraph->Delete(); delete fGraph;} | |
116 | if(fReconstructor) delete fReconstructor; | |
117 | if(fUtil) delete fUtil; | |
1ee39b3a | 118 | } |
119 | ||
120 | ||
121 | //________________________________________________________________________ | |
f8f46e4d | 122 | void AliTRDcheckPID::UserCreateOutputObjects() |
1ee39b3a | 123 | { |
124 | // Create histograms | |
125 | // Called once | |
126 | ||
f8f46e4d | 127 | OpenFile(1, "RECREATE"); |
1ee39b3a | 128 | fContainer = Histos(); |
b91fdd71 | 129 | |
130 | fPID = new TObjArray(); | |
131 | fPID->SetOwner(kTRUE); | |
132 | } | |
133 | ||
134 | //________________________________________________________ | |
f8f46e4d | 135 | void AliTRDcheckPID::UserExec(Option_t *opt) |
b91fdd71 | 136 | { |
137 | // | |
138 | // Execution part | |
139 | // | |
140 | ||
141 | fPID->Delete(); | |
142 | ||
b4414720 | 143 | AliTRDrecoTask::UserExec(opt); |
b91fdd71 | 144 | |
f8f46e4d | 145 | PostData(2, fPID); |
1ee39b3a | 146 | } |
147 | ||
148 | ||
149 | //_______________________________________________________ | |
150 | TObjArray * AliTRDcheckPID::Histos(){ | |
151 | ||
152 | // | |
153 | // Create QA histograms | |
154 | // | |
155 | if(fContainer) return fContainer; | |
156 | ||
157 | Int_t xBins = AliPID::kSPECIES*fMomentumAxis->GetNbins(); | |
158 | fContainer = new TObjArray(); fContainer->Expand(kNPlots); | |
159 | ||
160 | const Float_t epsilon = 1./(2*(AliTRDpidUtil::kBins-1)); // get nice histos with bin center at 0 and 1 | |
b91fdd71 | 161 | TH1 *h = NULL; |
1ee39b3a | 162 | |
2e6aa247 | 163 | const Int_t kNmethodsPID=Int_t(sizeof(fgMethod)/sizeof(Char_t*)); |
164 | // histos with posterior probabilities for all particle species | |
165 | for(Int_t is=AliPID::kSPECIES; is--;){ | |
166 | fEfficiency[is] = new TObjArray(kNmethodsPID); | |
167 | fEfficiency[is]->SetOwner(); | |
168 | fEfficiency[is]->SetName(Form("Eff_%s", AliPID::ParticleShortName(is))); | |
169 | fContainer->AddAt(fEfficiency[is], is?kEfficiencyMu+is-1:kEfficiency); | |
170 | for(Int_t im=kNmethodsPID; im--;){ | |
171 | if(!(h = (TH2F*)gROOT->FindObject(Form("PID_%s_%s", fgMethod[im], AliPID::ParticleShortName(is))))) { | |
172 | h = new TH2F(Form("PID_%s_%s", fgMethod[im], AliPID::ParticleShortName(is)), "", xBins, -0.5, xBins - 0.5, | |
173 | AliTRDpidUtil::kBins, 0.-epsilon, 1.+epsilon); | |
174 | } else h->Reset(); | |
175 | fEfficiency[is]->AddAt(h, im); | |
176 | } | |
177 | } | |
1ee39b3a | 178 | |
179 | // histos of the dE/dx distribution for all 5 particle species and 11 momenta | |
180 | if(!(h = (TH2F*)gROOT->FindObject("dEdx"))){ | |
181 | h = new TH2F("dEdx", "", | |
182 | xBins, -0.5, xBins - 0.5, | |
2e6aa247 | 183 | 200, 0, 15); |
184 | // 200, 0, 10000); | |
1ee39b3a | 185 | } else h->Reset(); |
186 | fContainer->AddAt(h, kdEdx); | |
187 | ||
188 | // histos of the dE/dx slices for all 5 particle species and 11 momenta | |
189 | if(!(h = (TH2F*)gROOT->FindObject("dEdxSlice"))){ | |
190 | h = new TH2F("dEdxSlice", "", | |
191 | xBins*AliTRDpidUtil::kLQslices, -0.5, xBins*AliTRDpidUtil::kLQslices - 0.5, | |
192 | 200, 0, 5000); | |
193 | } else h->Reset(); | |
194 | fContainer->AddAt(h, kdEdxSlice); | |
195 | ||
196 | // histos of the pulse height distribution for all 5 particle species and 11 momenta | |
197 | TObjArray *fPH = new TObjArray(2); | |
198 | fPH->SetOwner(); fPH->SetName("PH"); | |
199 | fContainer->AddAt(fPH, kPH); | |
200 | if(!(h = (TProfile2D*)gROOT->FindObject("PHT"))){ | |
201 | h = new TProfile2D("PHT", "", | |
202 | xBins, -0.5, xBins - 0.5, | |
203 | AliTRDtrackerV1::GetNTimeBins(), -0.5, AliTRDtrackerV1::GetNTimeBins() - 0.5); | |
204 | } else h->Reset(); | |
205 | fPH->AddAt(h, 0); | |
206 | if(!(h = (TProfile2D*)gROOT->FindObject("PHX"))){ | |
207 | h = new TProfile2D("PHX", "", | |
208 | xBins, -0.5, xBins - 0.5, | |
209 | AliTRDtrackerV1::GetNTimeBins(), 0., .5*AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght()); | |
210 | } else h->Reset(); | |
211 | fPH->AddAt(h, 1); | |
212 | ||
213 | // histos of the number of clusters distribution for all 5 particle species and 11 momenta | |
214 | if(!(h = (TH2F*)gROOT->FindObject("NClus"))){ | |
215 | h = new TH2F("NClus", "", | |
216 | xBins, -0.5, xBins - 0.5, | |
217 | 50, -0.5, 49.5); | |
218 | } else h->Reset(); | |
219 | fContainer->AddAt(h, kNClus); | |
220 | ||
221 | ||
222 | // momentum distributions - absolute and in momentum bins | |
223 | if(!(h = (TH1F*)gROOT->FindObject("hMom"))){ | |
224 | h = new TH1F("hMom", "momentum distribution", fMomentumAxis->GetNbins(), fMomentumAxis->GetXmin(), fMomentumAxis->GetXmax()); | |
225 | } else h->Reset(); | |
226 | fContainer->AddAt(h, kMomentum); | |
227 | ||
228 | if(!(h = (TH1F*)gROOT->FindObject("hMomBin"))){ | |
229 | h = new TH1F("hMomBin", "momentum distribution in momentum bins", fMomentumAxis->GetNbins(), fMomentumAxis->GetXmin(), fMomentumAxis->GetXmax()); | |
230 | } else h->Reset(); | |
231 | fContainer->AddAt(h, kMomentumBin); | |
232 | ||
233 | // Number of tracklets per track | |
234 | if(!(h = (TH2F*)gROOT->FindObject("nTracklets"))){ | |
235 | h = new TH2F("nTracklets", "", | |
236 | xBins, -0.5, xBins - 0.5, | |
237 | AliTRDgeometry::kNlayer, 0.5, AliTRDgeometry::kNlayer+.5); | |
238 | } else h->Reset(); | |
239 | fContainer->AddAt(h, kNTracklets); | |
240 | ||
241 | return fContainer; | |
242 | } | |
243 | ||
244 | ||
245 | //________________________________________________________________________ | |
246 | Bool_t AliTRDcheckPID::CheckTrackQuality(const AliTRDtrackV1* track) const | |
247 | { | |
248 | // | |
249 | // Check if the track is ok for PID | |
250 | // | |
251 | ||
252 | Int_t ntracklets = track->GetNumberOfTracklets(); | |
253 | if(ntracklets >= fMinNTracklets && ntracklets <= fMaxNTracklets) return 1; | |
254 | // if(!fESD) | |
255 | // return 0; | |
256 | ||
257 | return 0; | |
258 | } | |
259 | ||
260 | //________________________________________________________________________ | |
261 | Int_t AliTRDcheckPID::CalcPDG(AliTRDtrackV1* track) | |
262 | { | |
263 | // Documentation to come | |
264 | ||
265 | track -> SetReconstructor(fReconstructor); | |
266 | (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(); | |
267 | track -> CookPID(); | |
268 | ||
269 | if(track -> GetPID(AliPID::kElectron) > track -> GetPID(AliPID::kMuon) + track -> GetPID(AliPID::kPion) + track -> GetPID(AliPID::kKaon) + track -> GetPID(AliPID::kProton)){ | |
270 | return kElectron; | |
271 | } | |
272 | else if(track -> GetPID(kProton) > track -> GetPID(AliPID::kPion) && track -> GetPID(AliPID::kProton) > track -> GetPID(AliPID::kKaon) && track -> GetPID(AliPID::kProton) > track -> GetPID(AliPID::kMuon)){ | |
273 | return kProton; | |
274 | } | |
275 | else if(track -> GetPID(AliPID::kKaon) > track -> GetPID(AliPID::kMuon) && track -> GetPID(AliPID::kKaon) > track -> GetPID(AliPID::kPion)){ | |
276 | return kKPlus; | |
277 | } | |
278 | else if(track -> GetPID(AliPID::kMuon) > track -> GetPID(AliPID::kPion)){ | |
279 | return kMuonPlus; | |
280 | } | |
281 | else{ | |
282 | return kPiPlus; | |
283 | } | |
284 | } | |
285 | ||
286 | ||
287 | //_______________________________________________________ | |
288 | TH1 *AliTRDcheckPID::PlotLQ(const AliTRDtrackV1 *track) | |
289 | { | |
290 | // | |
291 | // Plot the probabilities for electrons using 2-dim LQ | |
292 | // | |
293 | ||
294 | if(!fkESD){ | |
f232df0d | 295 | AliDebug(2, "No ESD info available."); |
2e6aa247 | 296 | return NULL; |
1ee39b3a | 297 | } |
298 | ||
299 | if(track) fkTrack = track; | |
300 | if(!fkTrack){ | |
f232df0d | 301 | AliDebug(2, "No Track defined."); |
2e6aa247 | 302 | return NULL; |
1ee39b3a | 303 | } |
304 | ||
305 | ULong_t status; | |
306 | status = fkESD -> GetStatus(); | |
2e6aa247 | 307 | if(!(status&AliESDtrack::kTRDin)) return NULL; |
1ee39b3a | 308 | |
2e6aa247 | 309 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 310 | |
311 | AliTRDtrackV1 cTrack(*fkTrack); | |
312 | cTrack.SetReconstructor(fReconstructor); | |
313 | ||
314 | Int_t pdg = 0; | |
315 | Float_t momentum = 0.; | |
316 | ||
317 | if(fkMC){ | |
318 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
319 | pdg = fkMC->GetPDG(); | |
320 | } else{ | |
321 | //AliWarning("No MC info available!"); | |
322 | momentum = cTrack.GetMomentum(0); | |
323 | pdg = CalcPDG(&cTrack); | |
324 | } | |
2e6aa247 | 325 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 326 | |
327 | (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(kFALSE); | |
328 | cTrack.CookPID(); | |
2e6aa247 | 329 | if(cTrack.GetNumberOfTrackletsPID() < fMinNTracklets) return NULL; |
1ee39b3a | 330 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); |
2e6aa247 | 331 | |
332 | TH2F *hPIDLQ(NULL); | |
333 | TObjArray *eff(NULL); | |
334 | for(Int_t is=AliPID::kSPECIES; is--;){ | |
335 | if(!(eff = dynamic_cast<TObjArray *>(fContainer->At(is?kEfficiencyMu+is-1:kEfficiency)))){ | |
336 | AliWarning("No Histogram List defined."); | |
337 | return NULL; | |
338 | } | |
339 | if(!(hPIDLQ = dynamic_cast<TH2F *>(eff->At(AliTRDpidUtil::kLQ)))){ | |
340 | AliWarning("No Histogram defined."); | |
341 | return NULL; | |
342 | } | |
343 | ||
344 | hPIDLQ -> Fill(FindBin(species, momentum), cTrack.GetPID(is)); | |
345 | } | |
1ee39b3a | 346 | return hPIDLQ; |
347 | } | |
348 | ||
349 | ||
2e6aa247 | 350 | |
351 | ||
1ee39b3a | 352 | //_______________________________________________________ |
353 | TH1 *AliTRDcheckPID::PlotNN(const AliTRDtrackV1 *track) | |
354 | { | |
355 | // | |
356 | // Plot the probabilities for electrons using 2-dim LQ | |
357 | // | |
358 | ||
359 | if(!fkESD){ | |
f232df0d | 360 | AliDebug(2, "No ESD info available."); |
2e6aa247 | 361 | return NULL; |
1ee39b3a | 362 | } |
363 | ||
364 | if(track) fkTrack = track; | |
365 | if(!fkTrack){ | |
f232df0d | 366 | AliDebug(2, "No Track defined."); |
2e6aa247 | 367 | return NULL; |
1ee39b3a | 368 | } |
369 | ||
370 | ULong_t status; | |
371 | status = fkESD -> GetStatus(); | |
2e6aa247 | 372 | if(!(status&AliESDtrack::kTRDin)) return NULL; |
1ee39b3a | 373 | |
2e6aa247 | 374 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 375 | |
1ee39b3a | 376 | AliTRDtrackV1 cTrack(*fkTrack); |
377 | cTrack.SetReconstructor(fReconstructor); | |
378 | ||
379 | Int_t pdg = 0; | |
380 | Float_t momentum = 0.; | |
381 | if(fkMC){ | |
382 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
383 | pdg = fkMC->GetPDG(); | |
384 | } else { | |
385 | //AliWarning("No MC info available!"); | |
386 | momentum = cTrack.GetMomentum(0); | |
387 | pdg = CalcPDG(&cTrack); | |
388 | } | |
2e6aa247 | 389 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 390 | |
391 | (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(); | |
392 | cTrack.CookPID(); | |
2e6aa247 | 393 | if(cTrack.GetNumberOfTrackletsPID() < fMinNTracklets) return NULL; |
1ee39b3a | 394 | |
395 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); | |
2e6aa247 | 396 | |
397 | ||
398 | TH2F *hPIDNN(NULL); | |
399 | TObjArray *eff(NULL); | |
400 | for(Int_t is=AliPID::kSPECIES; is--;){ | |
401 | if(!(eff = dynamic_cast<TObjArray *>(fContainer->At(is?kEfficiencyMu+is-1:kEfficiency)))){ | |
402 | AliWarning("No Histogram List defined."); | |
403 | return NULL; | |
404 | } | |
405 | if(!(hPIDNN = dynamic_cast<TH2F *>(eff->At(AliTRDpidUtil::kNN)))){ | |
406 | AliWarning("No Histogram defined."); | |
407 | return NULL; | |
408 | } | |
409 | ||
410 | hPIDNN->Fill(FindBin(species, momentum), cTrack.GetPID(is)); | |
411 | } | |
1ee39b3a | 412 | return hPIDNN; |
413 | } | |
414 | ||
415 | ||
2e6aa247 | 416 | |
1ee39b3a | 417 | //_______________________________________________________ |
418 | TH1 *AliTRDcheckPID::PlotESD(const AliTRDtrackV1 *track) | |
419 | { | |
420 | // | |
421 | // Plot the probabilities for electrons using 2-dim LQ | |
422 | // | |
423 | ||
424 | if(!fkESD){ | |
f232df0d | 425 | AliDebug(2, "No ESD info available."); |
2e6aa247 | 426 | return NULL; |
1ee39b3a | 427 | } |
428 | ||
429 | if(track) fkTrack = track; | |
430 | if(!fkTrack){ | |
f232df0d | 431 | AliDebug(2, "No Track defined."); |
2e6aa247 | 432 | return NULL; |
1ee39b3a | 433 | } |
434 | ||
435 | ULong_t status; | |
436 | status = fkESD -> GetStatus(); | |
2e6aa247 | 437 | if(!(status&AliESDtrack::kTRDin)) return NULL; |
1ee39b3a | 438 | |
2e6aa247 | 439 | if(!CheckTrackQuality(fkTrack)) return NULL; |
440 | if(fkTrack->GetNumberOfTrackletsPID() < fMinNTracklets) return NULL; | |
1ee39b3a | 441 | |
1ee39b3a | 442 | Int_t pdg = 0; |
443 | Float_t momentum = 0.; | |
444 | if(fkMC){ | |
445 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
446 | pdg = fkMC->GetPDG(); | |
447 | } else { | |
448 | //AliWarning("No MC info available!"); | |
449 | AliTRDtrackV1 cTrack(*fkTrack); | |
450 | cTrack.SetReconstructor(fReconstructor); | |
451 | momentum = cTrack.GetMomentum(0); | |
452 | pdg = CalcPDG(&cTrack); | |
453 | } | |
2e6aa247 | 454 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 455 | |
1ee39b3a | 456 | const Double32_t *pidESD = fkESD->GetResponseIter(); |
457 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); | |
2e6aa247 | 458 | |
459 | TH2F *hPID(NULL); | |
460 | TObjArray *eff(NULL); | |
461 | for(Int_t is=AliPID::kSPECIES; is--;){ | |
462 | if(!(eff = dynamic_cast<TObjArray *>(fContainer->At(is?kEfficiencyMu+is-1:kEfficiency)))){ | |
463 | AliWarning("No Histogram List defined."); | |
464 | return NULL; | |
465 | } | |
466 | if(!(hPID = dynamic_cast<TH2F *>(eff->At(AliTRDpidUtil::kESD)))){ | |
467 | AliWarning("No Histogram defined."); | |
468 | return NULL; | |
469 | } | |
b91fdd71 | 470 | |
471 | AliTRDpidInfo *pid = new AliTRDpidInfo(); | |
472 | fPID->Add(pid); | |
2e6aa247 | 473 | hPID->Fill(FindBin(species, momentum), pidESD[is]); |
474 | } | |
475 | return hPID; | |
1ee39b3a | 476 | } |
477 | ||
478 | ||
2e6aa247 | 479 | |
1ee39b3a | 480 | //_______________________________________________________ |
481 | TH1 *AliTRDcheckPID::PlotdEdx(const AliTRDtrackV1 *track) | |
482 | { | |
483 | // | |
484 | // Plot the probabilities for electrons using 2-dim LQ | |
485 | // | |
486 | ||
487 | if(track) fkTrack = track; | |
488 | if(!fkTrack){ | |
f232df0d | 489 | AliDebug(2, "No Track defined."); |
2e6aa247 | 490 | return NULL; |
1ee39b3a | 491 | } |
492 | ||
2e6aa247 | 493 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 494 | |
495 | TH2F *hdEdx; | |
496 | if(!(hdEdx = dynamic_cast<TH2F *>(fContainer->At(kdEdx)))){ | |
497 | AliWarning("No Histogram defined."); | |
2e6aa247 | 498 | return NULL; |
1ee39b3a | 499 | } |
500 | ||
501 | AliTRDtrackV1 cTrack(*fkTrack); | |
502 | cTrack.SetReconstructor(fReconstructor); | |
503 | Int_t pdg = 0; | |
504 | Float_t momentum = 0.; | |
505 | if(fkMC){ | |
506 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
507 | pdg = fkMC->GetPDG(); | |
508 | } else { | |
509 | //AliWarning("No MC info available!"); | |
510 | momentum = cTrack.GetMomentum(0); | |
511 | pdg = CalcPDG(&cTrack); | |
512 | } | |
513 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); | |
2e6aa247 | 514 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 515 | |
2e6aa247 | 516 | (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(kTRUE); |
517 | // (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(kFALSE); | |
1ee39b3a | 518 | Float_t sumdEdx = 0; |
519 | Int_t iBin = FindBin(species, momentum); | |
b91fdd71 | 520 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 521 | for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ |
522 | sumdEdx = 0; | |
523 | tracklet = cTrack.GetTracklet(iChamb); | |
524 | if(!tracklet) continue; | |
2e6aa247 | 525 | tracklet -> CookdEdx(AliTRDpidUtil::kNNslices); |
526 | for(Int_t i = AliTRDpidUtil::kNNslices; i--;) sumdEdx += tracklet->GetdEdx()[i]; | |
527 | // tracklet -> CookdEdx(AliTRDpidUtil::kLQslices); | |
528 | // for(Int_t i = 3; i--;) sumdEdx += tracklet->GetdEdx()[i]; | |
529 | sumdEdx /= AliTRDCalPIDNN::kMLPscale; | |
1ee39b3a | 530 | hdEdx -> Fill(iBin, sumdEdx); |
531 | } | |
532 | return hdEdx; | |
533 | } | |
534 | ||
535 | ||
536 | //_______________________________________________________ | |
537 | TH1 *AliTRDcheckPID::PlotdEdxSlice(const AliTRDtrackV1 *track) | |
538 | { | |
539 | // | |
540 | // Plot the probabilities for electrons using 2-dim LQ | |
541 | // | |
542 | ||
543 | if(track) fkTrack = track; | |
544 | if(!fkTrack){ | |
f232df0d | 545 | AliDebug(2, "No Track defined."); |
2e6aa247 | 546 | return NULL; |
1ee39b3a | 547 | } |
548 | ||
2e6aa247 | 549 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 550 | |
551 | TH2F *hdEdxSlice; | |
552 | if(!(hdEdxSlice = dynamic_cast<TH2F *>(fContainer->At(kdEdxSlice)))){ | |
553 | AliWarning("No Histogram defined."); | |
2e6aa247 | 554 | return NULL; |
1ee39b3a | 555 | } |
556 | ||
557 | AliTRDtrackV1 cTrack(*fkTrack); | |
558 | cTrack.SetReconstructor(fReconstructor); | |
559 | Int_t pdg = 0; | |
560 | Float_t momentum = 0.; | |
561 | if(fkMC){ | |
562 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
563 | pdg = fkMC->GetPDG(); | |
564 | } else { | |
565 | //AliWarning("No MC info available!"); | |
566 | momentum = cTrack.GetMomentum(0); | |
567 | pdg = CalcPDG(&cTrack); | |
568 | } | |
2e6aa247 | 569 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 570 | |
571 | (const_cast<AliTRDrecoParam*>(fReconstructor->GetRecoParam()))->SetPIDNeuralNetwork(kFALSE); | |
572 | Int_t iMomBin = fMomentumAxis->FindBin(momentum); | |
573 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); | |
574 | Float_t *fdEdx; | |
b91fdd71 | 575 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 576 | for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ |
577 | tracklet = cTrack.GetTracklet(iChamb); | |
578 | if(!tracklet) continue; | |
579 | tracklet -> CookdEdx(AliTRDpidUtil::kLQslices); | |
580 | fdEdx = const_cast<Float_t *>(tracklet->GetdEdx()); | |
581 | for(Int_t iSlice = 0; iSlice < AliTRDpidUtil::kLQslices; iSlice++){ | |
582 | hdEdxSlice -> Fill(species * fMomentumAxis->GetNbins() * AliTRDpidUtil::kLQslices + (iMomBin-1) * AliTRDpidUtil::kLQslices + iSlice, fdEdx[iSlice]); | |
583 | } | |
584 | } | |
585 | ||
586 | return hdEdxSlice; | |
587 | } | |
588 | ||
589 | ||
590 | //_______________________________________________________ | |
591 | TH1 *AliTRDcheckPID::PlotPH(const AliTRDtrackV1 *track) | |
592 | { | |
593 | // | |
594 | // Plot the probabilities for electrons using 2-dim LQ | |
595 | // | |
596 | ||
597 | if(track) fkTrack = track; | |
598 | if(!fkTrack){ | |
f232df0d | 599 | AliDebug(2, "No Track defined."); |
2e6aa247 | 600 | return NULL; |
1ee39b3a | 601 | } |
602 | ||
2e6aa247 | 603 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 604 | |
b91fdd71 | 605 | TObjArray *arr = NULL; |
1ee39b3a | 606 | TProfile2D *hPHX, *hPHT; |
607 | if(!(arr = dynamic_cast<TObjArray *>(fContainer->At(kPH)))){ | |
608 | AliWarning("No Histogram defined."); | |
2e6aa247 | 609 | return NULL; |
1ee39b3a | 610 | } |
611 | hPHT = (TProfile2D*)arr->At(0); | |
612 | hPHX = (TProfile2D*)arr->At(1); | |
613 | ||
614 | Int_t pdg = 0; | |
615 | Float_t momentum = 0.; | |
616 | if(fkMC){ | |
617 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
618 | pdg = fkMC->GetPDG(); | |
619 | } else { | |
620 | //AliWarning("No MC info available!"); | |
621 | AliTRDtrackV1 cTrack(*fkTrack); | |
622 | cTrack.SetReconstructor(fReconstructor); | |
623 | momentum = cTrack.GetMomentum(0); | |
624 | pdg = CalcPDG(&cTrack); | |
625 | } | |
2e6aa247 | 626 | if(!IsInRange(momentum)) return NULL;; |
1ee39b3a | 627 | |
b91fdd71 | 628 | AliTRDseedV1 *tracklet = NULL; |
629 | AliTRDcluster *cluster = NULL; | |
1ee39b3a | 630 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); |
631 | Int_t iBin = FindBin(species, momentum); | |
632 | for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ | |
633 | tracklet = fkTrack->GetTracklet(iChamb); | |
634 | if(!tracklet) continue; | |
635 | Float_t x0 = tracklet->GetX0(); | |
636 | for(Int_t ic = 0; ic < AliTRDtrackerV1::GetNTimeBins(); ic++){ | |
637 | if(!(cluster = tracklet->GetClusters(ic))) continue; | |
638 | hPHT -> Fill(iBin, cluster->GetLocalTimeBin(), TMath::Abs(cluster->GetQ())); | |
639 | hPHX -> Fill(iBin, x0 - cluster->GetX(), tracklet->GetdQdl(ic)); | |
640 | } | |
641 | } | |
642 | return hPHT; | |
643 | } | |
644 | ||
645 | ||
646 | //_______________________________________________________ | |
647 | TH1 *AliTRDcheckPID::PlotNClus(const AliTRDtrackV1 *track) | |
648 | { | |
649 | // | |
650 | // Plot the probabilities for electrons using 2-dim LQ | |
651 | // | |
652 | ||
653 | if(track) fkTrack = track; | |
654 | if(!fkTrack){ | |
f232df0d | 655 | AliDebug(2, "No Track defined."); |
2e6aa247 | 656 | return NULL; |
1ee39b3a | 657 | } |
658 | ||
2e6aa247 | 659 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 660 | |
661 | TH2F *hNClus; | |
662 | if(!(hNClus = dynamic_cast<TH2F *>(fContainer->At(kNClus)))){ | |
663 | AliWarning("No Histogram defined."); | |
2e6aa247 | 664 | return NULL; |
1ee39b3a | 665 | } |
666 | ||
667 | ||
668 | Int_t pdg = 0; | |
669 | Float_t momentum = 0.; | |
670 | if(fkMC){ | |
671 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
672 | pdg = fkMC->GetPDG(); | |
673 | } else { | |
674 | //AliWarning("No MC info available!"); | |
675 | AliTRDtrackV1 cTrack(*fkTrack); | |
676 | cTrack.SetReconstructor(fReconstructor); | |
677 | momentum = cTrack.GetMomentum(0); | |
678 | pdg = CalcPDG(&cTrack); | |
679 | } | |
2e6aa247 | 680 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 681 | |
682 | Int_t species = AliTRDpidUtil::AliTRDpidUtil::Pdg2Pid(pdg); | |
683 | Int_t iBin = FindBin(species, momentum); | |
b91fdd71 | 684 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 685 | for(Int_t iChamb = 0; iChamb < AliTRDgeometry::kNlayer; iChamb++){ |
686 | tracklet = fkTrack->GetTracklet(iChamb); | |
687 | if(!tracklet) continue; | |
688 | hNClus -> Fill(iBin, tracklet->GetN()); | |
689 | } | |
690 | ||
691 | return hNClus; | |
692 | } | |
693 | ||
694 | //_______________________________________________________ | |
695 | TH1 *AliTRDcheckPID::PlotNTracklets(const AliTRDtrackV1 *track) | |
696 | { | |
697 | // | |
698 | // Plot the probabilities for electrons using 2-dim LQ | |
699 | // | |
700 | ||
701 | if(track) fkTrack = track; | |
702 | if(!fkTrack){ | |
f232df0d | 703 | AliDebug(2, "No Track defined."); |
2e6aa247 | 704 | return NULL; |
1ee39b3a | 705 | } |
706 | ||
707 | TH2F *hTracklets; | |
708 | if(!(hTracklets = dynamic_cast<TH2F *>(fContainer->At(kNTracklets)))){ | |
709 | AliWarning("No Histogram defined."); | |
2e6aa247 | 710 | return NULL; |
1ee39b3a | 711 | } |
712 | ||
713 | AliTRDtrackV1 cTrack(*fkTrack); | |
714 | cTrack.SetReconstructor(fReconstructor); | |
715 | Int_t pdg = 0; | |
716 | Float_t momentum = 0.; | |
717 | if(fkMC){ | |
718 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
719 | pdg = fkMC->GetPDG(); | |
720 | } else { | |
721 | //AliWarning("No MC info available!"); | |
722 | momentum = cTrack.GetMomentum(0); | |
723 | pdg = CalcPDG(&cTrack); | |
724 | } | |
725 | Int_t species = AliTRDpidUtil::Pdg2Pid(pdg); | |
2e6aa247 | 726 | if(!IsInRange(momentum)) return NULL; |
1ee39b3a | 727 | |
728 | Int_t iBin = FindBin(species, momentum); | |
729 | hTracklets -> Fill(iBin, cTrack.GetNumberOfTracklets()); | |
730 | return hTracklets; | |
731 | } | |
732 | ||
733 | //_______________________________________________________ | |
734 | TH1 *AliTRDcheckPID::PlotMom(const AliTRDtrackV1 *track) | |
735 | { | |
736 | // | |
737 | // Plot the probabilities for electrons using 2-dim LQ | |
738 | // | |
739 | ||
740 | if(track) fkTrack = track; | |
741 | if(!fkTrack){ | |
f232df0d | 742 | AliDebug(2, "No Track defined."); |
2e6aa247 | 743 | return NULL; |
1ee39b3a | 744 | } |
745 | ||
2e6aa247 | 746 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 747 | |
748 | TH1F *hMom; | |
749 | if(!(hMom = dynamic_cast<TH1F *>(fContainer->At(kMomentum)))){ | |
750 | AliWarning("No Histogram defined."); | |
2e6aa247 | 751 | return NULL; |
1ee39b3a | 752 | } |
753 | ||
754 | ||
755 | Int_t pdg = 0; | |
756 | Float_t momentum = 0.; | |
757 | if(fkMC){ | |
758 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
759 | pdg = fkMC->GetPDG(); | |
760 | } else { | |
761 | //AliWarning("No MC info available!"); | |
762 | AliTRDtrackV1 cTrack(*fkTrack); | |
763 | cTrack.SetReconstructor(fReconstructor); | |
764 | momentum = cTrack.GetMomentum(0); | |
765 | pdg = CalcPDG(&cTrack); | |
766 | } | |
767 | if(IsInRange(momentum)) hMom -> Fill(momentum); | |
768 | return hMom; | |
769 | } | |
770 | ||
771 | ||
772 | //_______________________________________________________ | |
773 | TH1 *AliTRDcheckPID::PlotMomBin(const AliTRDtrackV1 *track) | |
774 | { | |
775 | // | |
776 | // Plot the probabilities for electrons using 2-dim LQ | |
777 | // | |
778 | ||
779 | if(track) fkTrack = track; | |
780 | if(!fkTrack){ | |
f232df0d | 781 | AliDebug(2, "No Track defined."); |
2e6aa247 | 782 | return NULL; |
1ee39b3a | 783 | } |
784 | ||
2e6aa247 | 785 | if(!CheckTrackQuality(fkTrack)) return NULL; |
1ee39b3a | 786 | |
787 | TH1F *hMomBin; | |
788 | if(!(hMomBin = dynamic_cast<TH1F *>(fContainer->At(kMomentumBin)))){ | |
789 | AliWarning("No Histogram defined."); | |
2e6aa247 | 790 | return NULL; |
1ee39b3a | 791 | } |
792 | ||
793 | ||
794 | Int_t pdg = 0; | |
795 | Float_t momentum = 0.; | |
796 | ||
797 | if(fkMC){ | |
798 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
799 | pdg = fkMC->GetPDG(); | |
800 | } else { | |
801 | //AliWarning("No MC info available!"); | |
802 | AliTRDtrackV1 cTrack(*fkTrack); | |
803 | cTrack.SetReconstructor(fReconstructor); | |
804 | momentum = cTrack.GetMomentum(0); | |
805 | } | |
806 | if(IsInRange(momentum)) hMomBin -> Fill(fMomentumAxis->FindBin(momentum)); | |
807 | return hMomBin; | |
808 | } | |
809 | ||
810 | ||
811 | //________________________________________________________ | |
812 | Bool_t AliTRDcheckPID::GetRefFigure(Int_t ifig) | |
813 | { | |
814 | // Steering function to retrieve performance plots | |
815 | ||
816 | Bool_t kFIRST = kTRUE; | |
b91fdd71 | 817 | TGraphErrors *g = NULL; |
818 | TAxis *ax = NULL; | |
819 | TObjArray *arr = NULL; | |
820 | TH1 *h1 = NULL, *h=NULL; | |
821 | TH2 *h2 = NULL; | |
822 | TList *content = NULL; | |
1ee39b3a | 823 | switch(ifig){ |
824 | case kEfficiency:{ | |
825 | gPad->Divide(2, 1, 1.e-5, 1.e-5); | |
826 | TList *l=gPad->GetListOfPrimitives(); | |
827 | TVirtualPad *pad = ((TVirtualPad*)l->At(0));pad->cd(); | |
828 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
829 | ||
2e6aa247 | 830 | TLegend *legEff = new TLegend(.64, .84, .98, .98); |
831 | legEff->SetBorderSize(1);legEff->SetTextSize(0.03255879); | |
1ee39b3a | 832 | legEff->SetFillColor(0); |
833 | h=new TH1S("hEff", "", 1, .5, 11.); | |
834 | h->SetLineColor(1);h->SetLineWidth(1); | |
835 | ax = h->GetXaxis(); | |
836 | ax->SetTitle("p [GeV/c]"); | |
837 | ax->SetRangeUser(.5, 11.); | |
838 | ax->SetMoreLogLabels(); | |
839 | ax = h->GetYaxis(); | |
840 | ax->SetTitle("#epsilon_{#pi} [%]"); | |
841 | ax->CenterTitle(); | |
842 | ax->SetRangeUser(1.e-2, 10.); | |
843 | h->Draw(); | |
2e6aa247 | 844 | content = (TList *)fGraph->FindObject(Form("Eff_%s", AliTRDCalPID::GetPartName(AliPID::kPion))); |
1ee39b3a | 845 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kLQ))) break; |
846 | if(!g->GetN()) break; | |
2e6aa247 | 847 | legEff->SetHeader("PID Method [PION]"); |
1ee39b3a | 848 | g->Draw("pc"); legEff->AddEntry(g, "LQ 2D", "pl"); |
849 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kNN))) break; | |
850 | g->Draw("pc"); legEff->AddEntry(g, "NN", "pl"); | |
851 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kESD))) break; | |
852 | g->Draw("p"); legEff->AddEntry(g, "ESD", "pl"); | |
853 | legEff->Draw(); | |
854 | gPad->SetLogy(); | |
855 | gPad->SetLogx(); | |
856 | gPad->SetGridy(); | |
857 | gPad->SetGridx(); | |
858 | ||
2e6aa247 | 859 | |
1ee39b3a | 860 | pad = ((TVirtualPad*)l->At(1));pad->cd(); |
861 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
862 | h=new TH1S("hThr", "", 1, .5, 11.); | |
863 | h->SetLineColor(1);h->SetLineWidth(1); | |
864 | ax = h->GetXaxis(); | |
865 | ax->SetTitle("p [GeV/c]"); | |
866 | ax->SetMoreLogLabels(); | |
867 | ax = h->GetYaxis(); | |
868 | ax->SetTitle("Threshold [%]"); | |
869 | ax->SetRangeUser(5.e-2, 1.); | |
870 | h->Draw(); | |
2e6aa247 | 871 | content = (TList *)fGraph->FindObject("Thres"); |
1ee39b3a | 872 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kLQ))) break; |
873 | if(!g->GetN()) break; | |
874 | g->Draw("pc"); | |
875 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kNN))) break; | |
876 | g->Draw("pc"); | |
877 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kESD))) break; | |
878 | g->Draw("p"); | |
879 | gPad->SetLogx(); | |
880 | gPad->SetGridy(); | |
881 | gPad->SetGridx(); | |
882 | return kTRUE; | |
883 | } | |
2e6aa247 | 884 | case kEfficiencyKa:{ |
885 | gPad->Divide(2, 1, 1.e-5, 1.e-5); | |
886 | TList *l=gPad->GetListOfPrimitives(); | |
887 | TVirtualPad *pad = ((TVirtualPad*)l->At(0));pad->cd(); | |
888 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
889 | ||
890 | TLegend *legEff = new TLegend(.64, .84, .98, .98); | |
891 | legEff->SetBorderSize(1);legEff->SetTextSize(0.03255879); | |
892 | legEff->SetFillColor(0); | |
893 | h = (TH1S*)gROOT->FindObject("hEff"); | |
894 | h=(TH1S*)h->Clone("hEff_K"); | |
895 | h->SetYTitle("#epsilon_{K} [%]"); | |
896 | h->GetYaxis()->SetRangeUser(1.e-2, 1.e2); | |
897 | h->Draw(); | |
898 | content = (TList *)fGraph->FindObject(Form("Eff_%s", AliTRDCalPID::GetPartName(AliPID::kKaon))); | |
899 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kLQ))) break; | |
900 | if(!g->GetN()) break; | |
901 | legEff->SetHeader("PID Method [KAON]"); | |
902 | g->Draw("pc"); legEff->AddEntry(g, "LQ 2D", "pl"); | |
903 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kNN))) break; | |
904 | g->Draw("pc"); legEff->AddEntry(g, "NN", "pl"); | |
905 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kESD))) break; | |
906 | g->Draw("p"); legEff->AddEntry(g, "ESD", "pl"); | |
907 | legEff->Draw(); | |
908 | gPad->SetLogy(); | |
909 | gPad->SetLogx(); | |
910 | gPad->SetGridy(); | |
911 | gPad->SetGridx(); | |
912 | ||
913 | TLegend *legEff2 = new TLegend(.64, .84, .98, .98); | |
914 | legEff2->SetBorderSize(1);legEff2->SetTextSize(0.03255879); | |
915 | legEff2->SetFillColor(0); | |
916 | pad = ((TVirtualPad*)l->At(1));pad->cd(); | |
917 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
918 | h=(TH1S*)h->Clone("hEff_p"); | |
919 | h->SetYTitle("#epsilon_{p} [%]"); | |
920 | h->GetYaxis()->SetRangeUser(1.e-2, 1.e2); | |
921 | h->Draw(); | |
922 | content = (TList *)fGraph->FindObject(Form("Eff_%s", AliTRDCalPID::GetPartName(AliPID::kProton))); | |
923 | if(!(g = (TGraphErrors*)content->At(AliTRDpidUtil::kLQ))) break; | |
924 | if(!g->GetN()) break; | |
925 | legEff2->SetHeader("PID Method [PROTON]"); | |
926 | g->Draw("pc"); legEff2->AddEntry(g, "LQ 2D", "pl"); | |
927 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kNN))) break; | |
928 | g->Draw("pc"); legEff2->AddEntry(g, "NN", "pl"); | |
929 | if(! (g = (TGraphErrors*)content->At(AliTRDpidUtil::kESD))) break; | |
930 | g->Draw("p"); legEff2->AddEntry(g, "ESD", "pl"); | |
931 | legEff2->Draw(); | |
932 | gPad->SetLogy(); | |
933 | gPad->SetLogx(); | |
934 | gPad->SetGridy(); | |
935 | gPad->SetGridx(); | |
936 | return kTRUE; | |
937 | } | |
1ee39b3a | 938 | case kdEdx:{ |
939 | // save 2.0 GeV projection as reference | |
940 | TLegend *legdEdx = new TLegend(.7, .7, .98, .98); | |
941 | legdEdx->SetBorderSize(1); | |
942 | kFIRST = kTRUE; | |
943 | if(!(h2 = (TH2F*)(fContainer->At(kdEdx)))) break; | |
944 | legdEdx->SetHeader("Particle Species"); | |
945 | gPad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
946 | for(Int_t is = AliPID::kSPECIES-1; is>=0; is--){ | |
947 | Int_t bin = FindBin(is, 2.); | |
948 | h1 = h2->ProjectionY(Form("px%d", is), bin, bin); | |
949 | if(!h1->GetEntries()) continue; | |
950 | h1->Scale(1./h1->Integral()); | |
951 | h1->SetLineColor(AliTRDCalPID::GetPartColor(is)); | |
952 | if(kFIRST){ | |
953 | h1->GetXaxis()->SetTitle("dE/dx (a.u.)"); | |
954 | h1->GetYaxis()->SetTitle("<Entries>"); | |
955 | } | |
956 | h = (TH1F*)h1->DrawClone(kFIRST ? "c" : "samec"); | |
957 | legdEdx->AddEntry(h, Form("%s", AliTRDCalPID::GetPartName(is)), "l"); | |
958 | kFIRST = kFALSE; | |
959 | } | |
960 | if(kFIRST) break; | |
961 | legdEdx->Draw(); | |
962 | gPad->SetLogy(); | |
963 | gPad->SetLogx(0); | |
964 | gPad->SetGridy(); | |
965 | gPad->SetGridx(); | |
966 | return kTRUE; | |
967 | } | |
968 | case kdEdxSlice: | |
969 | break; | |
970 | case kPH:{ | |
971 | gPad->Divide(2, 1, 1.e-5, 1.e-5); | |
972 | TList *l=gPad->GetListOfPrimitives(); | |
973 | ||
974 | // save 2.0 GeV projection as reference | |
975 | TLegend *legPH = new TLegend(.4, .7, .68, .98); | |
976 | legPH->SetBorderSize(1);legPH->SetFillColor(0); | |
977 | legPH->SetHeader("Particle Species"); | |
978 | if(!(arr = (TObjArray*)(fContainer->At(kPH)))) break; | |
979 | if(!(h2 = (TProfile2D*)(arr->At(0)))) break; | |
980 | ||
981 | TVirtualPad *pad = ((TVirtualPad*)l->At(0));pad->cd(); | |
982 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
983 | kFIRST = kTRUE; | |
984 | for(Int_t is=0; is<AliPID::kSPECIES; is++){ | |
985 | Int_t bin = FindBin(is, 2.); | |
986 | h1 = h2->ProjectionY(Form("pyt%d", is), bin, bin); | |
987 | if(!h1->GetEntries()) continue; | |
988 | h1->SetMarkerStyle(24); | |
989 | h1->SetMarkerColor(AliTRDCalPID::GetPartColor(is)); | |
990 | h1->SetLineColor(AliTRDCalPID::GetPartColor(is)); | |
991 | if(kFIRST){ | |
992 | h1->GetXaxis()->SetTitle("t_{drift} [100*ns]"); | |
993 | h1->GetYaxis()->SetTitle("<dQ/dt> [a.u.]"); | |
994 | } | |
995 | h = (TH1F*)h1->DrawClone(kFIRST ? "c" : "samec"); | |
996 | legPH->AddEntry(h, Form("%s", AliTRDCalPID::GetPartName(is)), "pl"); | |
997 | kFIRST = kFALSE; | |
998 | } | |
999 | ||
1000 | pad = ((TVirtualPad*)l->At(1));pad->cd(); | |
1001 | pad->SetMargin(0.1, 0.01, 0.1, 0.01); | |
1002 | if(!(h2 = (TProfile2D*)(arr->At(1)))) break; | |
1003 | kFIRST = kTRUE; | |
1004 | for(Int_t is=0; is<AliPID::kSPECIES; is++){ | |
1005 | Int_t bin = FindBin(is, 2.); | |
1006 | h1 = h2->ProjectionY(Form("pyx%d", is), bin, bin); | |
1007 | if(!h1->GetEntries()) continue; | |
1008 | h1->SetMarkerStyle(24); | |
1009 | h1->SetMarkerColor(AliTRDCalPID::GetPartColor(is)); | |
1010 | h1->SetLineColor(AliTRDCalPID::GetPartColor(is)); | |
1011 | if(kFIRST){ | |
1012 | h1->GetXaxis()->SetTitle("x_{drift} [cm]"); | |
1013 | h1->GetYaxis()->SetTitle("<dQ/dl> [a.u./cm]"); | |
1014 | } | |
1015 | h = (TH1F*)h1->DrawClone(kFIRST ? "c" : "samec"); | |
1016 | kFIRST = kFALSE; | |
1017 | } | |
1018 | ||
1019 | if(kFIRST) break; | |
1020 | legPH->Draw(); | |
1021 | gPad->SetLogy(0); | |
1022 | gPad->SetLogx(0); | |
1023 | gPad->SetGridy(); | |
1024 | gPad->SetGridx(); | |
1025 | return kTRUE; | |
1026 | } | |
1027 | case kNClus:{ | |
1028 | // save 2.0 GeV projection as reference | |
1029 | TLegend *legNClus = new TLegend(.13, .7, .4, .98); | |
1030 | legNClus->SetBorderSize(1); | |
1031 | legNClus->SetFillColor(0); | |
1032 | ||
1033 | kFIRST = kTRUE; | |
1034 | if(!(h2 = (TH2F*)(fContainer->At(kNClus)))) break; | |
1035 | legNClus->SetHeader("Particle Species"); | |
1036 | for(Int_t is=0; is<AliPID::kSPECIES; is++){ | |
1037 | Int_t bin = FindBin(is, 2.); | |
1038 | h1 = h2->ProjectionY(Form("pyNClus%d", is), bin, bin); | |
1039 | if(!h1->GetEntries()) continue; | |
1040 | h1->Scale(100./h1->Integral()); | |
1041 | //h1->SetMarkerStyle(24); | |
1042 | //h1->SetMarkerColor(AliTRDCalPID::GetPartColor(is)); | |
1043 | h1->SetLineColor(AliTRDCalPID::GetPartColor(is)); | |
1044 | if(kFIRST){ | |
1045 | h1->GetXaxis()->SetTitle("N^{cl}/tracklet"); | |
1046 | h1->GetYaxis()->SetTitle("Prob. [%]"); | |
1047 | h = (TH1F*)h1->DrawClone("c"); | |
1048 | h->SetMaximum(55.); | |
1049 | h->GetXaxis()->SetRangeUser(0., 35.); | |
1050 | kFIRST = kFALSE; | |
1051 | } else h = (TH1F*)h1->DrawClone("samec"); | |
1052 | ||
1053 | legNClus->AddEntry(h, Form("%s", AliTRDCalPID::GetPartName(is)), "l"); | |
1054 | } | |
1055 | if(kFIRST) break; | |
1056 | legNClus->Draw(); | |
1057 | gPad->SetLogy(0); | |
1058 | gPad->SetLogx(0); | |
1059 | gPad->SetGridy(); | |
1060 | gPad->SetGridx(); | |
1061 | return kTRUE; | |
1062 | } | |
1063 | case kMomentum: | |
1064 | case kMomentumBin: | |
1065 | break; | |
1066 | case kNTracklets:{ | |
1067 | TLegend *legNClus = new TLegend(.4, .7, .68, .98); | |
1068 | legNClus->SetBorderSize(1); | |
1069 | kFIRST = kTRUE; | |
1070 | if(!(h2 = (TH2F*)(fContainer->At(kNTracklets)))) break; | |
1071 | legNClus->SetHeader("Particle Species"); | |
1072 | for(Int_t is=0; is<AliPID::kSPECIES; is++){ | |
1073 | Int_t bin = FindBin(is, 2.); | |
1074 | h1 = h2->ProjectionY(Form("pyNTracklets%d", is), bin, bin); | |
1075 | if(!h1->GetEntries()) continue; | |
1076 | h1->Scale(100./h1->Integral()); | |
1077 | //h1->SetMarkerStyle(24); | |
1078 | //h1->SetMarkerColor(AliTRDCalPID::GetPartColor(is)); | |
1079 | h1->SetLineColor(AliTRDCalPID::GetPartColor(is)); | |
1080 | if(kFIRST){ | |
1081 | h1->GetXaxis()->SetTitle("N^{trklt}/track"); | |
1082 | h1->GetXaxis()->SetRangeUser(1.,6.); | |
1083 | h1->GetYaxis()->SetTitle("Prob. [%]"); | |
1084 | } | |
1085 | h = (TH1F*)h1->DrawClone(kFIRST ? "c" : "samec"); | |
1086 | legNClus->AddEntry(h, Form("%s", AliTRDCalPID::GetPartName(is)), "l"); | |
1087 | kFIRST = kFALSE; | |
1088 | } | |
1089 | if(kFIRST) break; | |
1090 | legNClus->Draw(); | |
1091 | gPad->SetLogy(0); | |
1092 | gPad->SetLogx(0); | |
1093 | gPad->SetGridy(); | |
1094 | gPad->SetGridx(); | |
1095 | return kTRUE; | |
1096 | } | |
1097 | } | |
1098 | AliInfo(Form("Reference plot [%d] missing result", ifig)); | |
1099 | return kFALSE; | |
1100 | } | |
1101 | ||
1102 | //________________________________________________________________________ | |
1103 | Bool_t AliTRDcheckPID::PostProcess() | |
1104 | { | |
1105 | // Draw result to the screen | |
1106 | // Called once at the end of the query | |
1107 | ||
1108 | if (!fContainer) { | |
1109 | Printf("ERROR: list not available"); | |
1110 | return kFALSE; | |
1111 | } | |
2e6aa247 | 1112 | |
1113 | TObjArray *eff(NULL); | |
1ee39b3a | 1114 | if(!fGraph){ |
2e6aa247 | 1115 | fGraph = new TObjArray(2*AliPID::kSPECIES); |
1ee39b3a | 1116 | fGraph->SetOwner(); |
2e6aa247 | 1117 | |
1118 | if(!(eff = dynamic_cast<TObjArray *>(fContainer->At(kEfficiency)))){ | |
1119 | AliError("Efficiency container for Electrons missing."); | |
1120 | return kFALSE; | |
1121 | } | |
1122 | EvaluateEfficiency(eff, fGraph, AliPID::kPion, 0.9); | |
1123 | EvaluateEfficiency(eff, fGraph, AliPID::kKaon, 0.9); | |
1124 | EvaluateEfficiency(eff, fGraph, AliPID::kProton, 0.9); | |
1ee39b3a | 1125 | } |
2e6aa247 | 1126 | fNRefFigures = 12; |
1ee39b3a | 1127 | return kTRUE; |
1128 | } | |
1129 | ||
1130 | //________________________________________________________________________ | |
2e6aa247 | 1131 | void AliTRDcheckPID::EvaluateEfficiency(TObjArray * const histoContainer, TObjArray *results, Int_t species, Float_t electronEfficiency){ |
1ee39b3a | 1132 | // Process PID information for pion efficiency |
1133 | ||
1134 | fUtil->SetElectronEfficiency(electronEfficiency); | |
1135 | ||
2e6aa247 | 1136 | |
1137 | const Int_t kNmethodsPID=Int_t(sizeof(fgMethod)/sizeof(Char_t*)); | |
1138 | Color_t colors[kNmethodsPID] = {kBlue, kGreen+2, kRed}; | |
1139 | Int_t markerStyle[kNmethodsPID] = {7, 7, 24}; | |
1ee39b3a | 1140 | // efficiency graphs |
2e6aa247 | 1141 | TGraphErrors *g(NULL); |
1142 | TObjArray *eff = new TObjArray(kNmethodsPID); eff->SetOwner(); eff->SetName(Form("Eff_%s", AliTRDCalPID::GetPartName(species))); | |
1143 | results->AddAt(eff, species); | |
1144 | for(Int_t iMethod = 0; iMethod < kNmethodsPID; iMethod++){ | |
1145 | eff->AddAt(g = new TGraphErrors(), iMethod); | |
1146 | g->SetName(Form("%s", fgMethod[iMethod])); | |
1ee39b3a | 1147 | g->SetLineColor(colors[iMethod]); |
1148 | g->SetMarkerColor(colors[iMethod]); | |
1149 | g->SetMarkerStyle(markerStyle[iMethod]); | |
1150 | } | |
1151 | ||
2e6aa247 | 1152 | // Threshold graphs if not already |
1153 | TObjArray *thres(NULL); | |
1154 | if(!(results->At(AliPID::kSPECIES))){ | |
1155 | thres = new TObjArray(kNmethodsPID); thres->SetOwner(); | |
1156 | thres->SetName("Thres"); | |
1157 | results->AddAt(thres, AliPID::kSPECIES); | |
1158 | for(Int_t iMethod = 0; iMethod < kNmethodsPID; iMethod++){ | |
1159 | thres->AddAt(g = new TGraphErrors(), iMethod); | |
1160 | g->SetName(Form("%s", fgMethod[iMethod])); | |
1161 | g->SetLineColor(colors[iMethod]); | |
1162 | g->SetMarkerColor(colors[iMethod]); | |
1163 | g->SetMarkerStyle(markerStyle[iMethod]); | |
1164 | } | |
1ee39b3a | 1165 | } |
1ee39b3a | 1166 | |
2e6aa247 | 1167 | TH2F *hPtr[kNmethodsPID]={ |
1168 | (TH2F*)histoContainer->At(AliTRDpidUtil::kLQ), | |
1169 | (TH2F*)histoContainer->At(AliTRDpidUtil::kNN), | |
1170 | (TH2F*)histoContainer->At(AliTRDpidUtil::kESD) | |
1171 | }; | |
1ee39b3a | 1172 | for(Int_t iMom = 0; iMom < fMomentumAxis->GetNbins(); iMom++){ |
2e6aa247 | 1173 | Float_t mom(fMomentumAxis->GetBinCenter(iMom+1)); |
1ee39b3a | 1174 | |
2e6aa247 | 1175 | Int_t binEl(fMomentumAxis->GetNbins() * AliPID::kElectron + iMom + 1), |
1176 | binXX(fMomentumAxis->GetNbins() * species + iMom + 1); | |
1177 | ||
1178 | for(Int_t iMethod = 0; iMethod < kNmethodsPID; iMethod++){ | |
1179 | // Calculate the Species Efficiency at electronEfficiency% electron efficiency for each Method | |
1180 | ||
1181 | TH1D *histo1 = hPtr[iMethod] -> ProjectionY(Form("%s_el", fgMethod[iMethod]), binEl, binEl); | |
1182 | TH1D *histo2 = hPtr[iMethod] -> ProjectionY(Form("%s_%s", fgMethod[iMethod], AliTRDCalPID::GetPartName(species)), binXX, binXX); | |
1ee39b3a | 1183 | |
1184 | if(!fUtil->CalculatePionEffi(histo1, histo2)) continue; | |
1185 | ||
2e6aa247 | 1186 | g=(TGraphErrors*)eff->At(iMethod); |
1187 | g->SetPoint(iMom, mom, 1.e2*fUtil->GetPionEfficiency()); | |
1188 | g->SetPointError(iMom, 0., 1.e2*fUtil->GetError()); | |
1189 | AliDebug(2, Form("%s Efficiency for %s is : %f +/- %f", AliTRDCalPID::GetPartName(species), fgMethod[iMethod], fUtil->GetPionEfficiency(), fUtil->GetError())); | |
1190 | ||
1191 | if(!thres) continue; | |
1192 | g=(TGraphErrors*)thres->At(iMethod); | |
1193 | g->SetPoint(iMom, mom, fUtil->GetThreshold()); | |
1194 | g->SetPointError(iMom, 0., 0.); | |
1ee39b3a | 1195 | } |
1196 | } | |
1197 | } |