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