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