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