]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 1 | //////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // // | |
4 | // Basic checks for tracking and detector performance // | |
5 | // | |
6 | // For the moment (15.10.2009) the following checks are implemented // | |
7 | // - Number of clusters/track | |
8 | // - Number of clusters/tracklet | |
9 | // - Number of tracklets/track from different sources (Barrel, StandAlone) | |
10 | // - Number of findable tracklets | |
11 | // - Number of tracks per event and TRD sector | |
12 | // - <PH> | |
13 | // - Chi2 distribution for tracks | |
14 | // - Charge distribution per cluster and tracklet | |
15 | // - Number of events and tracks per trigger source | |
16 | // - Trigger purity | |
17 | // - Track and Tracklet propagation status | |
18 | // | |
19 | // Authors: // | |
20 | // Anton Andronic <A.Andronic@gsi.de> // | |
21 | // Alexandru Bercuci <A.Bercuci@gsi.de> // | |
22 | // Markus Fasel <M.Fasel@gsi.de> // | |
23 | // // | |
24 | //////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | #include <TAxis.h> | |
27 | #include <TCanvas.h> | |
28 | #include <TFile.h> | |
29 | #include <TH1F.h> | |
30 | #include <TH1I.h> | |
a5d9fe6f | 31 | #include <TH2F.h> |
1ee39b3a | 32 | #include <TF1.h> |
33 | #include <TGaxis.h> | |
34 | #include <TGraph.h> | |
147c3968 | 35 | #include <TGraphErrors.h> |
1ee39b3a | 36 | #include <TLegend.h> |
3907f080 | 37 | #include <TLinearFitter.h> |
1ee39b3a | 38 | #include <TMath.h> |
39 | #include <TMap.h> | |
44fd53ca | 40 | #include <TProfile2D.h> |
1ee39b3a | 41 | #include <TObjArray.h> |
42 | #include <TObject.h> | |
43 | #include <TObjString.h> | |
44 | ||
45 | #include <TPad.h> | |
46 | #include <TProfile.h> | |
47 | #include <TProfile2D.h> | |
48 | #include <TROOT.h> | |
f8f46e4d | 49 | #include <TChain.h> |
1ee39b3a | 50 | |
51 | #include "AliLog.h" | |
52 | #include "AliTRDcluster.h" | |
53 | #include "AliESDHeader.h" | |
54 | #include "AliESDRun.h" | |
55 | #include "AliESDtrack.h" | |
a5d9fe6f | 56 | #include "AliExternalTrackParam.h" |
1ee39b3a | 57 | #include "AliTRDgeometry.h" |
58 | #include "AliTRDpadPlane.h" | |
59 | #include "AliTRDSimParam.h" | |
60 | #include "AliTRDseedV1.h" | |
61 | #include "AliTRDtrackV1.h" | |
62 | #include "AliTRDtrackerV1.h" | |
63 | #include "AliTRDReconstructor.h" | |
64 | #include "AliTrackReference.h" | |
65 | #include "AliTrackPointArray.h" | |
66 | #include "AliTracker.h" | |
67 | #include "TTreeStream.h" | |
68 | ||
69 | #include "info/AliTRDtrackInfo.h" | |
70 | #include "info/AliTRDeventInfo.h" | |
71 | #include "AliTRDcheckDET.h" | |
72 | ||
73 | #include <cstdio> | |
74 | #include <iostream> | |
75 | ||
76 | ClassImp(AliTRDcheckDET) | |
77 | ||
78 | //_______________________________________________________ | |
79 | AliTRDcheckDET::AliTRDcheckDET(): | |
f2e89a4c | 80 | AliTRDrecoTask() |
db99a57a | 81 | ,fEventInfo(NULL) |
82 | ,fTriggerNames(NULL) | |
83 | ,fReconstructor(NULL) | |
84 | ,fGeo(NULL) | |
c732f879 | 85 | ,fFlags(0) |
1ee39b3a | 86 | { |
87 | // | |
88 | // Default constructor | |
89 | // | |
4fa7d600 | 90 | SetNameTitle("TRDcheckDET", "Basic TRD data checker"); |
f8f46e4d | 91 | } |
92 | ||
705f8b0a | 93 | //_______________________________________________________ |
f8f46e4d | 94 | AliTRDcheckDET::AliTRDcheckDET(char* name): |
95 | AliTRDrecoTask(name, "Basic TRD data checker") | |
db99a57a | 96 | ,fEventInfo(NULL) |
97 | ,fTriggerNames(NULL) | |
98 | ,fReconstructor(NULL) | |
99 | ,fGeo(NULL) | |
f8f46e4d | 100 | ,fFlags(0) |
101 | { | |
102 | // | |
103 | // Default constructor | |
104 | // | |
105 | DefineInput(2, AliTRDeventInfo::Class()); | |
106 | ||
1ee39b3a | 107 | fReconstructor = new AliTRDReconstructor; |
108 | fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam()); | |
109 | fGeo = new AliTRDgeometry; | |
110 | InitFunctorList(); | |
111 | } | |
112 | ||
f8f46e4d | 113 | |
1ee39b3a | 114 | //_______________________________________________________ |
115 | AliTRDcheckDET::~AliTRDcheckDET(){ | |
116 | // | |
117 | // Destructor | |
118 | // | |
119 | if(fTriggerNames) delete fTriggerNames; | |
120 | delete fReconstructor; | |
121 | delete fGeo; | |
122 | } | |
123 | ||
1ee39b3a | 124 | //_______________________________________________________ |
f8f46e4d | 125 | void AliTRDcheckDET::UserCreateOutputObjects(){ |
1ee39b3a | 126 | // |
127 | // Create Output Objects | |
128 | // | |
068e2c00 | 129 | AliTRDrecoTask::UserCreateOutputObjects(); |
1ee39b3a | 130 | if(!fTriggerNames) fTriggerNames = new TMap(); |
131 | } | |
132 | ||
133 | //_______________________________________________________ | |
f8f46e4d | 134 | void AliTRDcheckDET::UserExec(Option_t *opt){ |
1ee39b3a | 135 | // |
136 | // Execution function | |
137 | // Filling TRD quality histos | |
138 | // | |
5935a6da | 139 | |
140 | fEventInfo = dynamic_cast<AliTRDeventInfo *>(GetInputData(2)); | |
fe1d1beb | 141 | AliDebug(2, Form("EventInfo[%p] Header[%p]", (void*)fEventInfo, (void*)(fEventInfo?fEventInfo->GetEventHeader():NULL))); |
142 | ||
b4414720 | 143 | AliTRDrecoTask::UserExec(opt); |
1ee39b3a | 144 | Int_t nTracks = 0; // Count the number of tracks per event |
145 | Int_t triggermask = fEventInfo->GetEventHeader()->GetTriggerMask(); | |
146 | TString triggername = fEventInfo->GetRunInfo()->GetFiredTriggerClasses(triggermask); | |
147 | AliDebug(6, Form("Trigger cluster: %d, Trigger class: %s\n", triggermask, triggername.Data())); | |
148 | dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger))->Fill(triggermask); | |
149 | for(Int_t iti = 0; iti < fTracks->GetEntriesFast(); iti++){ | |
150 | if(!fTracks->UncheckedAt(iti)) continue; | |
151 | AliTRDtrackInfo *fTrackInfo = dynamic_cast<AliTRDtrackInfo *>(fTracks->UncheckedAt(iti)); | |
152 | if(!fTrackInfo->GetTrack()) continue; | |
153 | nTracks++; | |
154 | } | |
f8f46e4d | 155 | |
1ee39b3a | 156 | if(nTracks){ |
157 | dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks))->Fill(triggermask); | |
158 | dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNtracksEvent))->Fill(nTracks); | |
159 | } | |
160 | if(triggermask <= 20 && !fTriggerNames->FindObject(Form("%d", triggermask))){ | |
161 | fTriggerNames->Add(new TObjString(Form("%d", triggermask)), new TObjString(triggername)); | |
162 | // also set the label for both histograms | |
163 | TH1 *histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks)); | |
164 | histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername); | |
165 | histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger)); | |
166 | histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername); | |
167 | } | |
1ee39b3a | 168 | } |
169 | ||
170 | ||
171 | //_______________________________________________________ | |
172 | Bool_t AliTRDcheckDET::PostProcess(){ | |
173 | // | |
174 | // Do Postprocessing (for the moment set the number of Reference histograms) | |
175 | // | |
176 | ||
db99a57a | 177 | TH1 * h = NULL; |
1ee39b3a | 178 | |
179 | // Calculate of the trigger clusters purity | |
180 | h = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTrigger")); | |
181 | TH1F *h1 = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTriggerTracks")); | |
182 | h1->Divide(h); | |
183 | Float_t purities[20], val = 0; | |
184 | TString triggernames[20]; | |
185 | Int_t nTriggerClasses = 0; | |
186 | for(Int_t ibin = 1; ibin <= h->GetNbinsX(); ibin++){ | |
187 | if((val = h1->GetBinContent(ibin))){ | |
188 | purities[nTriggerClasses] = val; | |
189 | triggernames[nTriggerClasses] = h1->GetXaxis()->GetBinLabel(ibin); | |
190 | nTriggerClasses++; | |
191 | } | |
192 | } | |
193 | h = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kTriggerPurity)); | |
194 | TAxis *ax = h->GetXaxis(); | |
195 | for(Int_t itrg = 0; itrg < nTriggerClasses; itrg++){ | |
196 | h->Fill(itrg, purities[itrg]); | |
197 | ax->SetBinLabel(itrg+1, triggernames[itrg].Data()); | |
198 | } | |
199 | ax->SetRangeUser(-0.5, nTriggerClasses+.5); | |
200 | h->GetYaxis()->SetRangeUser(0,1); | |
201 | ||
202 | // track status | |
203 | h=dynamic_cast<TH1F*>(fContainer->At(kTrackStatus)); | |
204 | Float_t ok = h->GetBinContent(1); | |
205 | Int_t nerr = h->GetNbinsX(); | |
206 | for(Int_t ierr=nerr; ierr--;){ | |
c13a533b | 207 | h->SetBinContent(ierr+1, ok>0.?1.e2*h->GetBinContent(ierr+1)/ok:0.); |
1ee39b3a | 208 | } |
209 | h->SetBinContent(1, 0.); | |
210 | ||
211 | // tracklet status | |
f8f46e4d | 212 | |
1ee39b3a | 213 | TObjArray *arr = dynamic_cast<TObjArray*>(fContainer->UncheckedAt(kTrackletStatus)); |
214 | for(Int_t ily = AliTRDgeometry::kNlayer; ily--;){ | |
215 | h=dynamic_cast<TH1F*>(arr->At(ily)); | |
216 | Float_t okB = h->GetBinContent(1); | |
217 | Int_t nerrB = h->GetNbinsX(); | |
218 | for(Int_t ierr=nerrB; ierr--;){ | |
c13a533b | 219 | h->SetBinContent(ierr+1, okB>0.?1.e2*h->GetBinContent(ierr+1)/okB:0.); |
1ee39b3a | 220 | } |
221 | h->SetBinContent(1, 0.); | |
222 | } | |
223 | ||
0c76cfa4 | 224 | fNRefFigures = 17; |
1ee39b3a | 225 | |
226 | return kTRUE; | |
227 | } | |
228 | ||
b795b480 | 229 | //_______________________________________________________ |
230 | void AliTRDcheckDET::MakeSummary(){ | |
231 | // | |
232 | // Create summary plots for TRD check DET | |
233 | // This function creates 2 summary plots: | |
234 | // - General Quantities | |
235 | // - PHS | |
236 | // The function will reuse GetRefFigure | |
237 | // | |
238 | ||
239 | TCanvas *cOut = new TCanvas(Form("summary%s1", GetName()), Form("Summary 1 for task %s", GetName()), 1024, 768); | |
240 | cOut->Divide(3,3); | |
241 | ||
242 | // Create figures using GetRefFigure | |
243 | cOut->cd(1); GetRefFigure(kFigNtracksEvent); | |
244 | cOut->cd(2); GetRefFigure(kFigNtracksSector); | |
245 | cOut->cd(3); GetRefFigure(kFigNclustersTrack); | |
246 | cOut->cd(4); GetRefFigure(kFigNclustersTracklet); | |
247 | cOut->cd(5); GetRefFigure(kFigNtrackletsTrack); | |
248 | cOut->cd(6); GetRefFigure(kFigNTrackletsP); | |
249 | cOut->cd(7); GetRefFigure(kFigChargeCluster); | |
250 | cOut->cd(8); GetRefFigure(kFigChargeTracklet); | |
251 | cOut->SaveAs(Form("TRDsummary%s1.gif", GetName())); | |
252 | delete cOut; | |
253 | ||
254 | // Second Plot: PHS | |
255 | cOut = new TCanvas(Form("summary%s2", GetName()), Form("Summary 2 for task %s", GetName()), 1024, 512); | |
256 | cOut->cd(); GetRefFigure(kFigPH); | |
257 | cOut->SaveAs(Form("TRDsummary%s2.gif", GetName())); | |
258 | delete cOut; | |
44fd53ca | 259 | |
260 | // Third Plot: Mean Number of clusters as function of eta, phi and layer | |
261 | cOut = new TCanvas(Form("summary%s3", GetName()), Form("Summary 3 for task %s", GetName()), 1024, 768); | |
262 | cOut->cd(); MakePlotMeanClustersLayer(); | |
263 | cOut->SaveAs(Form("TRDsummary%s3.gif", GetName())); | |
264 | delete cOut; | |
265 | ||
b795b480 | 266 | } |
267 | ||
1ee39b3a | 268 | //_______________________________________________________ |
269 | Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){ | |
270 | // | |
271 | // Setting Reference Figures | |
272 | // | |
273 | gPad->SetLogy(0); | |
274 | gPad->SetLogx(0); | |
db99a57a | 275 | TH1 *h = NULL; TObjArray *arr=NULL; |
276 | TLegend *leg = NULL; | |
1ee39b3a | 277 | Bool_t kFIRST(1); |
278 | switch(ifig){ | |
0c76cfa4 | 279 | case kFigNclustersTrack: |
1ee39b3a | 280 | (h=(TH1F*)fContainer->FindObject("hNcls"))->Draw("pl"); |
281 | PutTrendValue("NClustersTrack", h->GetMean()); | |
282 | PutTrendValue("NClustersTrackRMS", h->GetRMS()); | |
283 | return kTRUE; | |
0c76cfa4 | 284 | case kFigNclustersTracklet: |
1ee39b3a | 285 | (h =(TH1F*)fContainer->FindObject("hNclTls"))->Draw("pc"); |
286 | PutTrendValue("NClustersTracklet", h->GetMean()); | |
287 | PutTrendValue("NClustersTrackletRMS", h->GetRMS()); | |
288 | return kTRUE; | |
0c76cfa4 | 289 | case kFigNtrackletsTrack: |
1ee39b3a | 290 | h=MakePlotNTracklets(); |
08c8e4e8 | 291 | if(h){ |
292 | PutTrendValue("NTrackletsTrack", h->GetMean()); | |
293 | PutTrendValue("NTrackletsTrackRMS", h->GetRMS()); | |
294 | } | |
1ee39b3a | 295 | return kTRUE; |
0c76cfa4 | 296 | case kFigNTrackletsP: |
297 | MakePlotnTrackletsVsP(); | |
298 | return kTRUE; | |
299 | case kFigNtrackletsCross: | |
1ee39b3a | 300 | h = (TH1F*)fContainer->FindObject("hNtlsCross"); |
301 | if(!MakeBarPlot(h, kRed)) break; | |
302 | PutTrendValue("NTrackletsCross", h->GetMean()); | |
303 | PutTrendValue("NTrackletsCrossRMS", h->GetRMS()); | |
304 | return kTRUE; | |
0c76cfa4 | 305 | case kFigNtrackletsFindable: |
1ee39b3a | 306 | h = (TH1F*)fContainer->FindObject("hNtlsFindable"); |
307 | if(!MakeBarPlot(h, kGreen)) break; | |
308 | PutTrendValue("NTrackletsFindable", h->GetMean()); | |
309 | PutTrendValue("NTrackletsFindableRMS", h->GetRMS()); | |
310 | return kTRUE; | |
0c76cfa4 | 311 | case kFigNtracksEvent: |
1ee39b3a | 312 | (h = (TH1F*)fContainer->FindObject("hNtrks"))->Draw("pl"); |
313 | PutTrendValue("NTracksEvent", h->GetMean()); | |
314 | PutTrendValue("NTracksEventRMS", h->GetRMS()); | |
315 | return kTRUE; | |
0c76cfa4 | 316 | case kFigNtracksSector: |
1ee39b3a | 317 | h = (TH1F*)fContainer->FindObject("hNtrksSector"); |
318 | if(!MakeBarPlot(h, kGreen)) break; | |
319 | PutTrendValue("NTracksSector", h->Integral()/h->GetNbinsX()); | |
320 | return kTRUE; | |
0c76cfa4 | 321 | case kFigTrackStatus: |
1ee39b3a | 322 | if(!(h=(TH1F *)fContainer->FindObject("hTrackStatus"))) break; |
323 | h->GetXaxis()->SetRangeUser(0.5, -1); | |
324 | h->GetYaxis()->CenterTitle(); | |
325 | h->Draw("c"); | |
326 | PutTrendValue("TrackStatus", h->Integral()); | |
327 | gPad->SetLogy(0); | |
328 | return kTRUE; | |
0c76cfa4 | 329 | case kFigTrackletStatus: |
1ee39b3a | 330 | if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))) break; |
147c3968 | 331 | leg = new TLegend(.68, .7, .97, .97); |
332 | leg->SetBorderSize(0);leg->SetFillStyle(0); | |
1ee39b3a | 333 | leg->SetHeader("TRD layer"); |
147c3968 | 334 | for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){ |
1ee39b3a | 335 | if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue; |
336 | if(kFIRST){ | |
147c3968 | 337 | h->Draw("pl"); |
1ee39b3a | 338 | h->GetXaxis()->SetRangeUser(0.5, -1); |
339 | h->GetYaxis()->CenterTitle(); | |
340 | kFIRST = kFALSE; | |
147c3968 | 341 | } else h->Draw("samepl"); |
342 | leg->AddEntry(h, Form("ly = %d", ily), "l"); | |
1ee39b3a | 343 | PutTrendValue(Form("TrackletStatus%d", ily), h->Integral()); |
344 | } | |
345 | leg->Draw(); | |
346 | gPad->SetLogy(0); | |
347 | return kTRUE; | |
0c76cfa4 | 348 | case kFigChi2: |
b795b480 | 349 | return kTRUE; |
1ee39b3a | 350 | MakePlotChi2(); |
351 | return kTRUE; | |
0c76cfa4 | 352 | case kFigPH: |
94f7dff7 | 353 | gPad->SetMargin(0.125, 0.015, 0.1, 0.1); |
1ee39b3a | 354 | MakePlotPulseHeight(); |
355 | gPad->SetLogy(0); | |
356 | return kTRUE; | |
0c76cfa4 | 357 | case kFigChargeCluster: |
1ee39b3a | 358 | (h = (TH1F*)fContainer->FindObject("hQcl"))->Draw("c"); |
359 | gPad->SetLogy(1); | |
360 | PutTrendValue("ChargeCluster", h->GetMaximumBin()); | |
361 | PutTrendValue("ChargeClusterRMS", h->GetRMS()); | |
362 | return kTRUE; | |
0c76cfa4 | 363 | case kFigChargeTracklet: |
1ee39b3a | 364 | (h=(TH1F*)fContainer->FindObject("hQtrklt"))->Draw("c"); |
365 | PutTrendValue("ChargeTracklet", h->GetMaximumBin()); | |
366 | PutTrendValue("ChargeTrackletRMS", h->GetRMS()); | |
367 | return kTRUE; | |
0c76cfa4 | 368 | case kFigNeventsTrigger: |
1ee39b3a | 369 | ((TH1F*)fContainer->FindObject("hEventsTrigger"))->Draw(""); |
370 | return kTRUE; | |
0c76cfa4 | 371 | case kFigNeventsTriggerTracks: |
1ee39b3a | 372 | ((TH1F*)fContainer->FindObject("hEventsTriggerTracks"))->Draw(""); |
373 | return kTRUE; | |
0c76cfa4 | 374 | case kFigTriggerPurity: |
1ee39b3a | 375 | if(!MakeBarPlot((TH1F*)fContainer->FindObject("hTriggerPurity"), kGreen)) break; |
376 | break; | |
377 | default: | |
378 | break; | |
379 | } | |
380 | AliInfo(Form("Reference plot [%d] missing result", ifig)); | |
381 | return kFALSE; | |
382 | } | |
383 | ||
384 | //_______________________________________________________ | |
385 | TObjArray *AliTRDcheckDET::Histos(){ | |
386 | // | |
387 | // Create QA histograms | |
388 | // | |
f8f46e4d | 389 | |
1ee39b3a | 390 | if(fContainer) return fContainer; |
391 | ||
392 | fContainer = new TObjArray(20); | |
393 | //fContainer->SetOwner(kTRUE); | |
394 | ||
395 | // Register Histograms | |
396 | TH1 * h = NULL; | |
397 | TAxis *ax = NULL; | |
398 | if(!(h = (TH1F *)gROOT->FindObject("hNcls"))){ | |
399 | h = new TH1F("hNcls", "N_{clusters} / track", 181, -0.5, 180.5); | |
400 | h->GetXaxis()->SetTitle("N_{clusters}"); | |
401 | h->GetYaxis()->SetTitle("Entries"); | |
402 | } else h->Reset(); | |
403 | fContainer->AddAt(h, kNclustersTrack); | |
404 | ||
44fd53ca | 405 | TObjArray *arr = new TObjArray(AliTRDgeometry::kNlayer); |
406 | arr->SetOwner(kTRUE); arr->SetName("clusters"); | |
407 | fContainer->AddAt(arr, kNclustersLayer); | |
408 | for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){ | |
409 | if(!(h = (TProfile2D *)gROOT->FindObject(Form("hNcl%d", ily)))){ | |
410 | h = new TProfile2D(Form("hNcl%d", ily), Form("Mean Number of clusters in Layer %d", ily), 100, -1.0, 1.0, 50, -1.1*TMath::Pi(), 1.1*TMath::Pi()); | |
411 | h->GetXaxis()->SetTitle("#eta"); | |
412 | h->GetYaxis()->SetTitle("#phi"); | |
413 | } else h->Reset(); | |
414 | arr->AddAt(h, ily); | |
415 | } | |
416 | ||
1ee39b3a | 417 | if(!(h = (TH1F *)gROOT->FindObject("hNclTls"))){ |
418 | h = new TH1F("hNclTls","N_{clusters} / tracklet", 51, -0.5, 50.5); | |
419 | h->GetXaxis()->SetTitle("N_{clusters}"); | |
420 | h->GetYaxis()->SetTitle("Entries"); | |
421 | } else h->Reset(); | |
422 | fContainer->AddAt(h, kNclustersTracklet); | |
423 | ||
424 | if(!(h = (TH1F *)gROOT->FindObject("hNtls"))){ | |
425 | h = new TH1F("hNtls", "N_{tracklets} / track", AliTRDgeometry::kNlayer, 0.5, 6.5); | |
426 | h->GetXaxis()->SetTitle("N^{tracklet}"); | |
427 | h->GetYaxis()->SetTitle("freq. [%]"); | |
428 | } else h->Reset(); | |
429 | fContainer->AddAt(h, kNtrackletsTrack); | |
430 | ||
431 | if(!(h = (TH1F *)gROOT->FindObject("htlsSTA"))){ | |
432 | h = new TH1F("hNtlsSTA", "N_{tracklets} / track (Stand Alone)", AliTRDgeometry::kNlayer, 0.5, 6.5); | |
433 | h->GetXaxis()->SetTitle("N^{tracklet}"); | |
434 | h->GetYaxis()->SetTitle("freq. [%]"); | |
435 | } | |
436 | fContainer->AddAt(h, kNtrackletsSTA); | |
437 | ||
a5d9fe6f | 438 | // Binning for momentum dependent tracklet Plots |
de791ef5 | 439 | const Int_t kNp(30); |
440 | Float_t P=0.2; | |
147c3968 | 441 | Float_t binsP[kNp+1], binsTrklt[AliTRDgeometry::kNlayer+1]; |
d239caab | 442 | for(Int_t i=0;i<kNp+1; i++,P+=(TMath::Exp(i*i*.001)-1.)) binsP[i]=P; |
147c3968 | 443 | for(Int_t il = 0; il <= AliTRDgeometry::kNlayer; il++) binsTrklt[il] = 0.5 + il; |
1ee39b3a | 444 | if(!(h = (TH1F *)gROOT->FindObject("htlsBAR"))){ |
a5d9fe6f | 445 | // Make tracklets for barrel tracks momentum dependent (if we do not exceed min and max values) |
147c3968 | 446 | h = new TH2F("hNtlsBAR", |
447 | "N_{tracklets} / track;p [GeV/c];N^{tracklet};freq. [%]", | |
448 | kNp, binsP, AliTRDgeometry::kNlayer, binsTrklt); | |
1ee39b3a | 449 | } |
450 | fContainer->AddAt(h, kNtrackletsBAR); | |
451 | ||
452 | // | |
453 | if(!(h = (TH1F *)gROOT->FindObject("hNtlsCross"))){ | |
454 | h = new TH1F("hNtlsCross", "N_{tracklets}^{cross} / track", 7, -0.5, 6.5); | |
455 | h->GetXaxis()->SetTitle("n_{row cross}"); | |
456 | h->GetYaxis()->SetTitle("freq. [%]"); | |
457 | } else h->Reset(); | |
458 | fContainer->AddAt(h, kNtrackletsCross); | |
459 | ||
460 | if(!(h = (TH1F *)gROOT->FindObject("hNtlsFindable"))){ | |
461 | h = new TH1F("hNtlsFindable", "Found/Findable Tracklets" , 101, -0.005, 1.005); | |
462 | h->GetXaxis()->SetTitle("r [a.u]"); | |
463 | h->GetYaxis()->SetTitle("Entries"); | |
464 | } else h->Reset(); | |
465 | fContainer->AddAt(h, kNtrackletsFindable); | |
466 | ||
467 | if(!(h = (TH1F *)gROOT->FindObject("hNtrks"))){ | |
468 | h = new TH1F("hNtrks", "N_{tracks} / event", 100, 0, 100); | |
469 | h->GetXaxis()->SetTitle("N_{tracks}"); | |
470 | h->GetYaxis()->SetTitle("Entries"); | |
471 | } else h->Reset(); | |
472 | fContainer->AddAt(h, kNtracksEvent); | |
473 | ||
474 | if(!(h = (TH1F *)gROOT->FindObject("hNtrksSector"))){ | |
475 | h = new TH1F("hNtrksSector", "N_{tracks} / sector", AliTRDgeometry::kNsector, -0.5, 17.5); | |
476 | h->GetXaxis()->SetTitle("sector"); | |
477 | h->GetYaxis()->SetTitle("freq. [%]"); | |
478 | } else h->Reset(); | |
479 | fContainer->AddAt(h, kNtracksSector); | |
480 | ||
481 | if(!(h = (TH1F*)gROOT->FindObject("hTrackStatus"))){ | |
482 | const Int_t nerr = 7; | |
483 | h = new TH1F("hTrackStatus", "Track Status", nerr, -0.5, nerr-0.5); | |
484 | const Char_t *label[nerr] = {"OK", "PROL", "PROP", "AJST", "SNP", "TINI", "UPDT"}; | |
485 | ax = h->GetXaxis(); | |
486 | for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]); | |
487 | h->SetYTitle("Relative Error to Good [%]"); | |
488 | } | |
489 | fContainer->AddAt(h, kTrackStatus); | |
490 | ||
44fd53ca | 491 | arr = new TObjArray(AliTRDgeometry::kNlayer); |
1ee39b3a | 492 | arr->SetOwner(kTRUE); arr->SetName("TrackletStatus"); |
493 | fContainer->AddAt(arr, kTrackletStatus); | |
494 | for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){ | |
495 | if(!(h = (TH1F *)gROOT->FindObject(Form("hTrackletStatus%d", ily)))){ | |
496 | const Int_t nerr = 8; | |
497 | h = new TH1F(Form("hTrackletStatus%d", ily), "Tracklet status", nerr, -0.5, nerr-0.5); | |
498 | h->SetLineColor(ily+1); | |
499 | const Char_t *label[nerr] = {"OK", "Geom", "Bound", "NoCl", "NoAttach", "NoClTr", "NoFit", "Chi2"}; | |
500 | ax = h->GetXaxis(); | |
501 | for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]); | |
502 | h->SetYTitle("Relative Error to Good [%]"); | |
503 | } else h->Reset(); | |
504 | arr->AddAt(h, ily); | |
505 | } | |
506 | ||
507 | // <PH> histos | |
c0a6ac06 | 508 | arr = new TObjArray(3); |
1ee39b3a | 509 | arr->SetOwner(kTRUE); arr->SetName("<PH>"); |
510 | fContainer->AddAt(arr, kPH); | |
511 | if(!(h = (TH1F *)gROOT->FindObject("hPHt"))){ | |
512 | h = new TProfile("hPHt", "<PH>", 31, -0.5, 30.5); | |
513 | h->GetXaxis()->SetTitle("Time / 100ns"); | |
514 | h->GetYaxis()->SetTitle("<PH> [a.u]"); | |
515 | } else h->Reset(); | |
516 | arr->AddAt(h, 0); | |
517 | if(!(h = (TH1F *)gROOT->FindObject("hPHx"))) | |
518 | h = new TProfile("hPHx", "<PH>", 31, -0.08, 4.88); | |
519 | else h->Reset(); | |
520 | arr->AddAt(h, 1); | |
c0a6ac06 | 521 | if(!(h = (TH2F *)gROOT->FindObject("hPH2D"))){ |
522 | h = new TH2F("hPH2D", "Charge Distribution / time", 31, -0.5, 30.5, 100, 0, 1024); | |
523 | h->GetXaxis()->SetTitle("Time / 100ns"); | |
524 | h->GetYaxis()->SetTitle("Charge / a.u."); | |
525 | } else h->Reset(); | |
526 | arr->AddAt(h, 2); | |
1ee39b3a | 527 | |
528 | // Chi2 histos | |
529 | if(!(h = (TH2S*)gROOT->FindObject("hChi2"))){ | |
530 | h = new TH2S("hChi2", "#chi^{2} per track", AliTRDgeometry::kNlayer, .5, AliTRDgeometry::kNlayer+.5, 100, 0, 50); | |
531 | h->SetXTitle("ndf"); | |
532 | h->SetYTitle("#chi^{2}/ndf"); | |
533 | h->SetZTitle("entries"); | |
534 | } else h->Reset(); | |
535 | fContainer->AddAt(h, kChi2); | |
536 | ||
537 | if(!(h = (TH1F *)gROOT->FindObject("hQcl"))){ | |
538 | h = new TH1F("hQcl", "Q_{cluster}", 200, 0, 1200); | |
539 | h->GetXaxis()->SetTitle("Q_{cluster} [a.u.]"); | |
540 | h->GetYaxis()->SetTitle("Entries"); | |
541 | }else h->Reset(); | |
542 | fContainer->AddAt(h, kChargeCluster); | |
543 | ||
544 | if(!(h = (TH1F *)gROOT->FindObject("hQtrklt"))){ | |
545 | h = new TH1F("hQtrklt", "Q_{tracklet}", 6000, 0, 6000); | |
546 | h->GetXaxis()->SetTitle("Q_{tracklet} [a.u.]"); | |
547 | h->GetYaxis()->SetTitle("Entries"); | |
548 | }else h->Reset(); | |
549 | fContainer->AddAt(h, kChargeTracklet); | |
550 | ||
551 | ||
552 | if(!(h = (TH1F *)gROOT->FindObject("hEventsTrigger"))) | |
553 | h = new TH1F("hEventsTrigger", "Trigger Class", 100, 0, 100); | |
554 | else h->Reset(); | |
f8f46e4d | 555 | printf("Histos Adding \n"); |
556 | ||
1ee39b3a | 557 | fContainer->AddAt(h, kNeventsTrigger); |
558 | ||
559 | if(!(h = (TH1F *)gROOT->FindObject("hEventsTriggerTracks"))) | |
560 | h = new TH1F("hEventsTriggerTracks", "Trigger Class (Tracks)", 100, 0, 100); | |
561 | else h->Reset(); | |
562 | fContainer->AddAt(h, kNeventsTriggerTracks); | |
563 | ||
564 | if(!(h = (TH1F *)gROOT->FindObject("hTriggerPurity"))){ | |
565 | h = new TH1F("hTriggerPurity", "Trigger Purity", 10, -0.5, 9.5); | |
566 | h->GetXaxis()->SetTitle("Trigger Cluster"); | |
567 | h->GetYaxis()->SetTitle("freq."); | |
568 | } else h->Reset(); | |
569 | fContainer->AddAt(h, kTriggerPurity); | |
570 | ||
571 | return fContainer; | |
572 | } | |
573 | ||
574 | /* | |
575 | * Plotting Functions | |
576 | */ | |
577 | ||
578 | //_______________________________________________________ | |
579 | TH1 *AliTRDcheckDET::PlotTrackStatus(const AliTRDtrackV1 *track) | |
580 | { | |
581 | // | |
582 | // Plot the track propagation status. The following errors are defined (see AliTRDtrackV1::ETRDtrackError) | |
583 | // PROL - track prolongation failure | |
584 | // PROP - track propagation failure | |
585 | // AJST - crossing sectors failure | |
586 | // SNP - too large bending | |
587 | // TINI - tracklet initialization failure | |
588 | // UPDT - track position/covariance update failure | |
589 | // | |
590 | // Performance plot looks as below: | |
591 | //Begin_Html | |
592 | //<img src="TRD/trackStatus.gif"> | |
593 | //End_Html | |
594 | // | |
595 | if(track) fkTrack = track; | |
596 | if(!fkTrack){ | |
4e7a049c | 597 | AliDebug(4, "No Track defined."); |
db99a57a | 598 | return NULL; |
1ee39b3a | 599 | } |
db99a57a | 600 | TH1 *h = NULL; |
1ee39b3a | 601 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kTrackStatus)))){ |
602 | AliWarning("No Histogram defined."); | |
db99a57a | 603 | return NULL; |
1ee39b3a | 604 | } |
605 | h->Fill(fkTrack->GetStatusTRD()); | |
606 | return h; | |
607 | } | |
608 | ||
609 | //_______________________________________________________ | |
610 | TH1 *AliTRDcheckDET::PlotTrackletStatus(const AliTRDtrackV1 *track) | |
611 | { | |
612 | // | |
613 | // Plot the tracklet propagation status. The following errors are defined for tracklet (see AliTRDtrackV1::ETRDlayerError) | |
614 | // Geom - | |
615 | // Bound - tracklet too close to chamber walls | |
616 | // NoCl - no clusters in the track roads | |
617 | // NoAttach - fail to attach clusters | |
618 | // NoClTr - fail to use clusters for fit | |
619 | // NoFit - tracklet fit failled | |
620 | // Chi2 - chi2 tracklet-track over threshold | |
621 | // | |
622 | // Performance plot looks as below: | |
623 | //Begin_Html | |
624 | //<img src="TRD/trackletStatus.gif"> | |
625 | //End_Html | |
626 | // | |
627 | if(track) fkTrack = track; | |
628 | if(!fkTrack){ | |
4e7a049c | 629 | AliDebug(4, "No Track defined."); |
db99a57a | 630 | return NULL; |
1ee39b3a | 631 | } |
db99a57a | 632 | TObjArray *arr =NULL; |
1ee39b3a | 633 | if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))){ |
634 | AliWarning("Histograms not defined."); | |
db99a57a | 635 | return NULL; |
1ee39b3a | 636 | } |
637 | ||
db99a57a | 638 | TH1 *h = NULL; |
1ee39b3a | 639 | for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){ |
640 | if(!(h = dynamic_cast<TH1F*>(arr->At(ily)))){ | |
641 | AliWarning(Form("Missing histo for layer %d.", ily)); | |
642 | continue; | |
643 | } | |
644 | h->Fill(fkTrack->GetStatusTRD(ily)); | |
645 | } | |
646 | return h; | |
647 | } | |
648 | ||
649 | //_______________________________________________________ | |
650 | TH1 *AliTRDcheckDET::PlotNClustersTracklet(const AliTRDtrackV1 *track){ | |
651 | // | |
652 | // Plot the mean number of clusters per tracklet | |
653 | // | |
654 | if(track) fkTrack = track; | |
655 | if(!fkTrack){ | |
4e7a049c | 656 | AliDebug(4, "No Track defined."); |
db99a57a | 657 | return NULL; |
1ee39b3a | 658 | } |
44fd53ca | 659 | AliExternalTrackParam *par = fkTrack->GetTrackIn() ? fkTrack->GetTrackIn() : fkTrack->GetTrackOut(); |
db99a57a | 660 | TH1 *h = NULL; |
44fd53ca | 661 | TProfile2D *hlayer = NULL; |
662 | Double_t eta = 0., phi = 0.; | |
1ee39b3a | 663 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTracklet)))){ |
664 | AliWarning("No Histogram defined."); | |
db99a57a | 665 | return NULL; |
1ee39b3a | 666 | } |
db99a57a | 667 | AliTRDseedV1 *tracklet = NULL; |
44fd53ca | 668 | TObjArray *histosLayer = dynamic_cast<TObjArray *>(fContainer->At(kNclustersLayer)); |
669 | if(!histosLayer){ | |
670 | AliWarning("No Histograms for single layer defined"); | |
671 | } | |
1ee39b3a | 672 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
673 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue; | |
674 | h->Fill(tracklet->GetN2()); | |
44fd53ca | 675 | if(histosLayer && par){ |
676 | if((hlayer = dynamic_cast<TProfile2D *>(histosLayer->At(itl)))){ | |
677 | GetEtaPhiAt(par, tracklet->GetX0(), eta, phi); | |
678 | hlayer->Fill(eta, phi, tracklet->GetN2()); | |
679 | } | |
680 | } | |
1ee39b3a | 681 | } |
682 | return h; | |
683 | } | |
684 | ||
685 | //_______________________________________________________ | |
686 | TH1 *AliTRDcheckDET::PlotNClustersTrack(const AliTRDtrackV1 *track){ | |
687 | // | |
688 | // Plot the number of clusters in one track | |
689 | // | |
690 | if(track) fkTrack = track; | |
691 | if(!fkTrack){ | |
4e7a049c | 692 | AliDebug(4, "No Track defined."); |
db99a57a | 693 | return NULL; |
1ee39b3a | 694 | } |
db99a57a | 695 | TH1 *h = NULL; |
1ee39b3a | 696 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTrack)))){ |
697 | AliWarning("No Histogram defined."); | |
db99a57a | 698 | return NULL; |
1ee39b3a | 699 | } |
700 | ||
701 | Int_t nclusters = 0; | |
db99a57a | 702 | AliTRDseedV1 *tracklet = NULL; |
a310e49b | 703 | AliExternalTrackParam *par = fkTrack->GetTrackOut() ? fkTrack->GetTrackOut() : fkTrack->GetTrackIn(); |
9653acd3 | 704 | if(!par) return NULL; |
0c76cfa4 | 705 | Double_t momentumRec = par->P(); |
1ee39b3a | 706 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
707 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue; | |
fc2ec42c | 708 | Int_t n(tracklet->GetN()); |
709 | nclusters += n; | |
1ee39b3a | 710 | if(DebugLevel() > 2){ |
711 | Int_t crossing = Int_t(tracklet->IsRowCross()); | |
712 | Int_t detector = tracklet->GetDetector(); | |
713 | Float_t theta = TMath::ATan(tracklet->GetZref(1)); | |
714 | Float_t phi = TMath::ATan(tracklet->GetYref(1)); | |
0c76cfa4 | 715 | Float_t momentumMC = 0.; |
1ee39b3a | 716 | Int_t pdg = 0; |
717 | Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0; | |
718 | UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0; | |
719 | if(fkMC){ | |
0c76cfa4 | 720 | if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P(); |
1ee39b3a | 721 | pdg = fkMC->GetPDG(); |
722 | } | |
723 | (*DebugStream()) << "NClustersTrack" | |
724 | << "Detector=" << detector | |
725 | << "crossing=" << crossing | |
0c76cfa4 | 726 | << "momentumMC="<< momentumMC |
727 | << "momentumRec=" << momentumRec | |
1ee39b3a | 728 | << "pdg=" << pdg |
729 | << "theta=" << theta | |
730 | << "phi=" << phi | |
731 | << "kinkIndex=" << kinkIndex | |
732 | << "TPCncls=" << nclsTPC | |
fc2ec42c | 733 | << "TRDncls=" << n |
1ee39b3a | 734 | << "\n"; |
735 | } | |
736 | } | |
737 | h->Fill(nclusters); | |
738 | return h; | |
739 | } | |
740 | ||
741 | ||
742 | //_______________________________________________________ | |
743 | TH1 *AliTRDcheckDET::PlotNTrackletsTrack(const AliTRDtrackV1 *track){ | |
744 | // | |
745 | // Plot the number of tracklets | |
746 | // | |
747 | if(track) fkTrack = track; | |
748 | if(!fkTrack){ | |
4e7a049c | 749 | AliDebug(4, "No Track defined."); |
db99a57a | 750 | return NULL; |
1ee39b3a | 751 | } |
a5d9fe6f | 752 | TH1 *h = NULL, *hSta = NULL; TH2 *hBarrel = NULL; |
1ee39b3a | 753 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsTrack)))){ |
754 | AliWarning("No Histogram defined."); | |
db99a57a | 755 | return NULL; |
1ee39b3a | 756 | } |
757 | Int_t nTracklets = fkTrack->GetNumberOfTracklets(); | |
758 | h->Fill(nTracklets); | |
759 | if(!fkESD) return h; | |
760 | Int_t status = fkESD->GetStatus(); | |
a5d9fe6f | 761 | |
1ee39b3a | 762 | /* printf("in/out/refit/pid: TRD[%d|%d|%d|%d]\n", status &AliESDtrack::kTRDin ? 1 : 0, status &AliESDtrack::kTRDout ? 1 : 0, status &AliESDtrack::kTRDrefit ? 1 : 0, status &AliESDtrack::kTRDpid ? 1 : 0);*/ |
a5d9fe6f | 763 | Double_t p = 0.; |
0c76cfa4 | 764 | Int_t method = -1; // to distinguish between stand alone and full barrel tracks in the debugging |
1ee39b3a | 765 | if((status & AliESDtrack::kTRDin) != 0){ |
0c76cfa4 | 766 | method = 1; |
a5d9fe6f | 767 | // Full Barrel Track: Save momentum dependence |
768 | if(!(hBarrel = dynamic_cast<TH2F *>(fContainer->At(kNtrackletsBAR)))){ | |
1ee39b3a | 769 | AliWarning("Method: Barrel. Histogram not processed!"); |
147c3968 | 770 | return NULL; |
a5d9fe6f | 771 | } |
147c3968 | 772 | AliExternalTrackParam *par(fkTrack->GetTrackIn()); |
773 | if(!par){ | |
774 | AliError("Input track params missing"); | |
775 | return NULL; | |
776 | } | |
b795b480 | 777 | p = par->P(); // p needed later in the debug streaming |
778 | hBarrel->Fill(p, nTracklets); | |
1ee39b3a | 779 | } else { |
a5d9fe6f | 780 | // Stand alone Track: momentum dependence not usefull |
0c76cfa4 | 781 | method = 0; |
a5d9fe6f | 782 | if(!(hSta = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsSTA)))) { |
1ee39b3a | 783 | AliWarning("Method: StandAlone. Histogram not processed!"); |
147c3968 | 784 | return NULL; |
a5d9fe6f | 785 | } |
147c3968 | 786 | hSta->Fill(nTracklets); |
1ee39b3a | 787 | } |
1ee39b3a | 788 | |
0c76cfa4 | 789 | if(DebugLevel() > 2){ |
790 | AliTRDseedV1 *tracklet = NULL; | |
b795b480 | 791 | Int_t sector = -1, stack = -1, detector; |
0c76cfa4 | 792 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
793 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue; | |
b795b480 | 794 | detector = tracklet->GetDetector(); |
795 | sector = fGeo->GetSector(detector); | |
796 | stack = fGeo->GetStack(detector); | |
0c76cfa4 | 797 | break; |
798 | } | |
799 | (*DebugStream()) << "NTrackletsTrack" | |
800 | << "Sector=" << sector | |
b795b480 | 801 | << "Stack=" << stack |
0c76cfa4 | 802 | << "NTracklets=" << nTracklets |
803 | << "Method=" << method | |
804 | << "p=" << p | |
805 | << "\n"; | |
806 | } | |
1ee39b3a | 807 | if(DebugLevel() > 3){ |
b795b480 | 808 | AliTRDseedV1 *tracklet = NULL; |
809 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ | |
810 | if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){ | |
0c76cfa4 | 811 | (*DebugStream()) << "NTrackletsLayer" |
b795b480 | 812 | << "Layer=" << il |
813 | << "p=" << p | |
814 | << "\n"; | |
a5d9fe6f | 815 | } |
1ee39b3a | 816 | } |
817 | } | |
818 | return h; | |
819 | } | |
820 | ||
821 | ||
822 | //_______________________________________________________ | |
823 | TH1 *AliTRDcheckDET::PlotNTrackletsRowCross(const AliTRDtrackV1 *track){ | |
824 | // | |
825 | // Plot the number of tracklets | |
826 | // | |
827 | if(track) fkTrack = track; | |
828 | if(!fkTrack){ | |
4e7a049c | 829 | AliDebug(4, "No Track defined."); |
db99a57a | 830 | return NULL; |
1ee39b3a | 831 | } |
db99a57a | 832 | TH1 *h = NULL; |
1ee39b3a | 833 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsCross)))){ |
834 | AliWarning("No Histogram defined."); | |
db99a57a | 835 | return NULL; |
1ee39b3a | 836 | } |
837 | ||
838 | Int_t ncross = 0; | |
db99a57a | 839 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 840 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ |
841 | if(!(tracklet = fkTrack->GetTracklet(il)) || !tracklet->IsOK()) continue; | |
842 | ||
843 | if(tracklet->IsRowCross()) ncross++; | |
844 | } | |
845 | h->Fill(ncross); | |
846 | return h; | |
847 | } | |
848 | ||
849 | //_______________________________________________________ | |
850 | TH1 *AliTRDcheckDET::PlotFindableTracklets(const AliTRDtrackV1 *track){ | |
851 | // | |
852 | // Plots the ratio of number of tracklets vs. | |
853 | // number of findable tracklets | |
854 | // | |
855 | // Findable tracklets are defined as track prolongation | |
856 | // to layer i does not hit the dead area +- epsilon | |
857 | // | |
858 | // In order to check whether tracklet hist active area in Layer i, | |
859 | // the track is refitted and the fitted position + an uncertainty | |
860 | // range is compared to the chamber border (also with a different | |
861 | // uncertainty) | |
862 | // | |
863 | // For the track fit two cases are distinguished: | |
864 | // If the track is a stand alone track (defined by the status bit | |
865 | // encoding, then the track is fitted with the tilted Rieman model | |
866 | // Otherwise the track is fitted with the Kalman fitter in two steps: | |
867 | // Since the track parameters are give at the outer point, we first | |
868 | // fit in direction inwards. Afterwards we fit again in direction outwards | |
869 | // to extrapolate the track to layers which are not reached by the track | |
870 | // For the Kalman model, the radial track points have to be shifted by | |
871 | // a distance epsilon in the direction that we want to fit | |
872 | // | |
873 | const Float_t epsilon = 0.01; // dead area tolerance | |
874 | const Float_t epsilonR = 1; // shift in radial direction of the anode wire position (Kalman filter only) | |
875 | const Float_t deltaY = 0.7; // Tolerance in the track position in y-direction | |
876 | const Float_t deltaZ = 7.0; // Tolerance in the track position in z-direction (Padlength) | |
877 | Double_t xAnode[AliTRDgeometry::kNlayer] = {300.2, 312.8, 325.4, 338.0, 350.6, 363.2}; // Take the default X0 | |
878 | ||
879 | if(track) fkTrack = track; | |
880 | if(!fkTrack){ | |
4e7a049c | 881 | AliDebug(4, "No Track defined."); |
db99a57a | 882 | return NULL; |
1ee39b3a | 883 | } |
db99a57a | 884 | TH1 *h = NULL; |
1ee39b3a | 885 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsFindable)))){ |
886 | AliWarning("No Histogram defined."); | |
db99a57a | 887 | return NULL; |
1ee39b3a | 888 | } |
889 | Int_t nFound = 0, nFindable = 0; | |
890 | Int_t stack = -1; | |
891 | Double_t ymin = 0., ymax = 0., zmin = 0., zmax = 0.; | |
892 | Double_t y = 0., z = 0.; | |
db99a57a | 893 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 894 | AliTRDpadPlane *pp; |
895 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ | |
896 | if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){ | |
897 | tracklet->SetReconstructor(fReconstructor); | |
898 | nFound++; | |
899 | } | |
900 | } | |
901 | // 2 Different cases: | |
902 | // 1st stand alone: here we cannot propagate, but be can do a Tilted Rieman Fit | |
903 | // 2nd barrel track: here we propagate the track to the layers | |
904 | AliTrackPoint points[6]; | |
905 | Float_t xyz[3]; | |
906 | memset(xyz, 0, sizeof(Float_t) * 3); | |
907 | if(((fkESD->GetStatus() & AliESDtrack::kTRDout) > 0) && !((fkESD->GetStatus() & AliESDtrack::kTRDin) > 0)){ | |
908 | // stand alone track | |
909 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ | |
910 | xyz[0] = xAnode[il]; | |
911 | points[il].SetXYZ(xyz); | |
912 | } | |
db99a57a | 913 | AliTRDtrackerV1::FitRiemanTilt(const_cast<AliTRDtrackV1 *>(fkTrack), NULL, kTRUE, 6, points); |
1ee39b3a | 914 | } else { |
915 | // barrel track | |
916 | // | |
917 | // 2 Steps: | |
918 | // -> Kalman inwards | |
919 | // -> Kalman outwards | |
920 | AliTRDtrackV1 copyTrack(*fkTrack); // Do Kalman on a (non-constant) copy of the track | |
921 | AliTrackPoint pointsInward[6], pointsOutward[6]; | |
922 | for(Int_t il = AliTRDgeometry::kNlayer; il--;){ | |
923 | // In order to avoid complications in the Kalman filter if the track points have the same radial | |
924 | // position like the tracklets, we have to shift the radial postion of the anode wire by epsilon | |
925 | // in the direction we want to go | |
926 | // The track points have to be in reverse order for the Kalman Filter inwards | |
927 | xyz[0] = xAnode[AliTRDgeometry::kNlayer - il - 1] - epsilonR; | |
928 | pointsInward[il].SetXYZ(xyz); | |
929 | xyz[0] = xAnode[il] + epsilonR; | |
930 | pointsOutward[il].SetXYZ(xyz); | |
931 | } | |
932 | /*for(Int_t ipt = 0; ipt < AliTRDgeometry::kNlayer; ipt++) | |
933 | printf("%d. X = %f\n", ipt, points[ipt].GetX());*/ | |
934 | // Kalman inwards | |
db99a57a | 935 | AliTRDtrackerV1::FitKalman(©Track, NULL, kFALSE, 6, pointsInward); |
1ee39b3a | 936 | memcpy(points, pointsInward, sizeof(AliTrackPoint) * 6); // Preliminary store the inward results in the Array points |
937 | // Kalman outwards | |
db99a57a | 938 | AliTRDtrackerV1::FitKalman(©Track, NULL, kTRUE, 6, pointsInward); |
1ee39b3a | 939 | memcpy(points, pointsOutward, sizeof(AliTrackPoint) * AliTRDgeometry::kNlayer); |
940 | } | |
941 | for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){ | |
942 | y = points[il].GetY(); | |
943 | z = points[il].GetZ(); | |
944 | if((stack = fGeo->GetStack(z, il)) < 0) continue; // Not findable | |
945 | pp = fGeo->GetPadPlane(il, stack); | |
946 | ymin = pp->GetCol0() + epsilon; | |
947 | ymax = pp->GetColEnd() - epsilon; | |
948 | zmin = pp->GetRowEnd() + epsilon; | |
949 | zmax = pp->GetRow0() - epsilon; | |
950 | // ignore y-crossing (material) | |
951 | if((z + deltaZ > zmin && z - deltaZ < zmax) && (y + deltaY > ymin && y - deltaY < ymax)) nFindable++; | |
952 | if(DebugLevel() > 3){ | |
953 | Double_t posTracklet[2] = {tracklet ? tracklet->GetYfit(0) : 0, tracklet ? tracklet->GetZfit(0) : 0}; | |
954 | Int_t hasTracklet = tracklet ? 1 : 0; | |
955 | (*DebugStream()) << "FindableTracklets" | |
956 | << "layer=" << il | |
957 | << "ytracklet=" << posTracklet[0] | |
958 | << "ytrack=" << y | |
959 | << "ztracklet=" << posTracklet[1] | |
960 | << "ztrack=" << z | |
961 | << "tracklet=" << hasTracklet | |
962 | << "\n"; | |
963 | } | |
964 | } | |
965 | ||
966 | h->Fill(nFindable > 0 ? TMath::Min(nFound/static_cast<Double_t>(nFindable), 1.) : 1); | |
967 | AliDebug(2, Form("Findable[Found]: %d[%d|%f]", nFindable, nFound, nFound/static_cast<Float_t>(nFindable > 0 ? nFindable : 1))); | |
968 | return h; | |
969 | } | |
970 | ||
971 | ||
972 | //_______________________________________________________ | |
973 | TH1 *AliTRDcheckDET::PlotChi2(const AliTRDtrackV1 *track){ | |
974 | // | |
975 | // Plot the chi2 of the track | |
976 | // | |
977 | if(track) fkTrack = track; | |
978 | if(!fkTrack){ | |
4e7a049c | 979 | AliDebug(4, "No Track defined."); |
db99a57a | 980 | return NULL; |
1ee39b3a | 981 | } |
db99a57a | 982 | TH1 *h = NULL; |
1ee39b3a | 983 | if(!(h = dynamic_cast<TH2S*>(fContainer->At(kChi2)))) { |
984 | AliWarning("No Histogram defined."); | |
db99a57a | 985 | return NULL; |
1ee39b3a | 986 | } |
987 | Int_t n = fkTrack->GetNumberOfTracklets(); | |
db99a57a | 988 | if(!n) return NULL; |
1ee39b3a | 989 | |
990 | h->Fill(n, fkTrack->GetChi2()/n); | |
991 | return h; | |
992 | } | |
993 | ||
994 | ||
995 | //_______________________________________________________ | |
996 | TH1 *AliTRDcheckDET::PlotPHt(const AliTRDtrackV1 *track){ | |
997 | // | |
998 | // Plot the average pulse height | |
999 | // | |
4e7a049c | 1000 | if(track) fkTrack = track; |
1001 | if(!fkTrack){ | |
1002 | AliDebug(4, "No Track defined."); | |
db99a57a | 1003 | return NULL; |
1ee39b3a | 1004 | } |
c0a6ac06 | 1005 | TProfile *h = NULL; TH2F *phs2D = NULL; |
1ee39b3a | 1006 | if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(0)))){ |
1007 | AliWarning("No Histogram defined."); | |
db99a57a | 1008 | return NULL; |
1ee39b3a | 1009 | } |
c0a6ac06 | 1010 | if(!(phs2D = dynamic_cast<TH2F *>(((TObjArray*)(fContainer->At(kPH)))->At(2)))){ |
1011 | AliWarning("2D Pulse Height histogram not defined. Histogramm cannot be filled"); | |
1012 | } | |
db99a57a | 1013 | AliTRDseedV1 *tracklet = NULL; |
1014 | AliTRDcluster *c = NULL; | |
1ee39b3a | 1015 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
1016 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue; | |
1017 | Int_t crossing = Int_t(tracklet->IsRowCross()); | |
1018 | Int_t detector = tracklet->GetDetector(); | |
1019 | tracklet->ResetClusterIter(); | |
1020 | while((c = tracklet->NextCluster())){ | |
c732f879 | 1021 | if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue; |
1ee39b3a | 1022 | Int_t localtime = c->GetLocalTimeBin(); |
1023 | Double_t absoluteCharge = TMath::Abs(c->GetQ()); | |
1024 | h->Fill(localtime, absoluteCharge); | |
c0a6ac06 | 1025 | phs2D->Fill(localtime, absoluteCharge); |
1ee39b3a | 1026 | if(DebugLevel() > 3){ |
b795b480 | 1027 | Int_t inChamber = c->IsInChamber() ? 1 : 0; |
1ee39b3a | 1028 | Double_t distance[2]; |
1029 | GetDistanceToTracklet(distance, tracklet, c); | |
1030 | Float_t theta = TMath::ATan(tracklet->GetZref(1)); | |
1031 | Float_t phi = TMath::ATan(tracklet->GetYref(1)); | |
b795b480 | 1032 | AliExternalTrackParam *trdPar = fkTrack->GetTrackIn(); |
1033 | Float_t momentumMC = 0, momentumRec = trdPar ? trdPar->P() : track->P(); // prefer Track Low | |
1ee39b3a | 1034 | Int_t pdg = 0; |
1035 | Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0; | |
1036 | UShort_t TPCncls = fkESD ? fkESD->GetTPCncls() : 0; | |
1037 | if(fkMC){ | |
b795b480 | 1038 | if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P(); |
1ee39b3a | 1039 | pdg = fkMC->GetPDG(); |
1040 | } | |
1041 | (*DebugStream()) << "PHt" | |
1042 | << "Detector=" << detector | |
1043 | << "crossing=" << crossing | |
b795b480 | 1044 | << "inChamber=" << inChamber |
1ee39b3a | 1045 | << "Timebin=" << localtime |
1046 | << "Charge=" << absoluteCharge | |
b795b480 | 1047 | << "momentumMC=" << momentumMC |
1048 | << "momentumRec=" << momentumRec | |
1ee39b3a | 1049 | << "pdg=" << pdg |
1050 | << "theta=" << theta | |
1051 | << "phi=" << phi | |
1052 | << "kinkIndex=" << kinkIndex | |
1053 | << "TPCncls=" << TPCncls | |
1054 | << "dy=" << distance[0] | |
1055 | << "dz=" << distance[1] | |
1056 | << "c.=" << c | |
1057 | << "\n"; | |
1058 | } | |
1059 | } | |
1060 | } | |
1061 | return h; | |
1062 | } | |
1063 | ||
1064 | //_______________________________________________________ | |
1065 | TH1 *AliTRDcheckDET::PlotPHx(const AliTRDtrackV1 *track){ | |
1066 | // | |
1067 | // Plots the average pulse height vs the distance from the anode wire | |
1068 | // (plus const anode wire offset) | |
1069 | // | |
4e7a049c | 1070 | if(track) fkTrack = track; |
1071 | if(!fkTrack){ | |
1072 | AliDebug(4, "No Track defined."); | |
1073 | return NULL; | |
1ee39b3a | 1074 | } |
db99a57a | 1075 | TProfile *h = NULL; |
1ee39b3a | 1076 | if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(1)))){ |
1077 | AliWarning("No Histogram defined."); | |
db99a57a | 1078 | return NULL; |
1ee39b3a | 1079 | } |
4e7a049c | 1080 | AliTRDseedV1 *tracklet(NULL); |
1081 | AliTRDcluster *c(NULL); | |
749e9d16 | 1082 | Double_t xd(0.), dqdl(0.); |
1083 | TVectorD vq(AliTRDseedV1::kNtb), vxd(AliTRDseedV1::kNtb), vdqdl(AliTRDseedV1::kNtb); | |
1ee39b3a | 1084 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
1085 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue; | |
749e9d16 | 1086 | Int_t det(tracklet->GetDetector()); |
1087 | Bool_t rc(tracklet->IsRowCross()); | |
4e7a049c | 1088 | for(Int_t ic(0); ic<AliTRDseedV1::kNtb; ic++){ |
1089 | Bool_t kFIRST(kFALSE); | |
1090 | if(!(c = tracklet->GetClusters(ic))){ | |
1091 | if(!(c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) continue; | |
1092 | } else kFIRST=kTRUE; | |
c732f879 | 1093 | if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue; |
4e7a049c | 1094 | xd = tracklet->GetX0() - c->GetX(); vxd[ic] = xd; |
1095 | dqdl=tracklet->GetdQdl(ic); vdqdl[ic] = dqdl; | |
1096 | vq[ic]=c->GetQ(); | |
1097 | if(kFIRST && (c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) vq[ic]+=c->GetQ(); | |
749e9d16 | 1098 | h->Fill(xd, dqdl); |
1099 | } | |
1100 | if(DebugLevel() > 3){ | |
749e9d16 | 1101 | (*DebugStream()) << "PHx" |
1102 | << "det=" << det | |
1103 | << "rc=" << rc | |
1104 | << "xd=" << &vxd | |
1105 | << "q=" << &vq | |
1106 | << "dqdl=" << &vdqdl | |
1107 | << "\n"; | |
1ee39b3a | 1108 | } |
1109 | } | |
1110 | return h; | |
1111 | } | |
1112 | ||
1113 | //_______________________________________________________ | |
1114 | TH1 *AliTRDcheckDET::PlotChargeCluster(const AliTRDtrackV1 *track){ | |
1115 | // | |
1116 | // Plot the cluster charge | |
1117 | // | |
1118 | if(track) fkTrack = track; | |
1119 | if(!fkTrack){ | |
4e7a049c | 1120 | AliDebug(4, "No Track defined."); |
db99a57a | 1121 | return NULL; |
1ee39b3a | 1122 | } |
db99a57a | 1123 | TH1 *h = NULL; |
1ee39b3a | 1124 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeCluster)))){ |
1125 | AliWarning("No Histogram defined."); | |
db99a57a | 1126 | return NULL; |
1ee39b3a | 1127 | } |
db99a57a | 1128 | AliTRDseedV1 *tracklet = NULL; |
1129 | AliTRDcluster *c = NULL; | |
1ee39b3a | 1130 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ |
1131 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue; | |
4e7a049c | 1132 | for(Int_t ic(0); ic < AliTRDseedV1::kNtb; ic++){ |
1133 | Bool_t kFIRST(kFALSE); | |
1134 | if(!(c = tracklet->GetClusters(ic))) { | |
1135 | if(!(c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) continue; | |
1136 | } else kFIRST = kTRUE; | |
1137 | Float_t q(c->GetQ()); | |
1138 | if(kFIRST && (c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) q+=c->GetQ(); | |
1139 | h->Fill(q); | |
1ee39b3a | 1140 | } |
1141 | } | |
1142 | return h; | |
1143 | } | |
1144 | ||
1145 | //_______________________________________________________ | |
1146 | TH1 *AliTRDcheckDET::PlotChargeTracklet(const AliTRDtrackV1 *track){ | |
1147 | // | |
1148 | // Plot the charge deposit per chamber | |
1149 | // | |
1150 | if(track) fkTrack = track; | |
1151 | if(!fkTrack){ | |
4e7a049c | 1152 | AliDebug(4, "No Track defined."); |
db99a57a | 1153 | return NULL; |
1ee39b3a | 1154 | } |
db99a57a | 1155 | TH1 *h = NULL; |
1ee39b3a | 1156 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeTracklet)))){ |
1157 | AliWarning("No Histogram defined."); | |
db99a57a | 1158 | return NULL; |
1ee39b3a | 1159 | } |
db99a57a | 1160 | AliTRDseedV1 *tracklet = NULL; |
1161 | AliTRDcluster *c = NULL; | |
1ee39b3a | 1162 | Double_t qTot = 0; |
1163 | Int_t nTracklets =fkTrack->GetNumberOfTracklets(); | |
8428f55d | 1164 | for(Int_t itl(0); itl < AliTRDgeometry::kNlayer; itl++){ |
1ee39b3a | 1165 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue; |
1166 | qTot = 0.; | |
1167 | for(Int_t ic = AliTRDseedV1::kNclusters; ic--;){ | |
1168 | if(!(c = tracklet->GetClusters(ic))) continue; | |
1169 | qTot += TMath::Abs(c->GetQ()); | |
1170 | } | |
1171 | h->Fill(qTot); | |
1172 | if(DebugLevel() > 3){ | |
1173 | Int_t crossing = (Int_t)tracklet->IsRowCross(); | |
1174 | Int_t detector = tracklet->GetDetector(); | |
1175 | Float_t theta = TMath::ATan(tracklet->GetZfit(1)); | |
1176 | Float_t phi = TMath::ATan(tracklet->GetYfit(1)); | |
1177 | Float_t momentum = 0.; | |
1178 | Int_t pdg = 0; | |
1179 | Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0; | |
1180 | UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0; | |
1181 | if(fkMC){ | |
1182 | if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P(); | |
1183 | pdg = fkMC->GetPDG(); | |
1184 | } | |
1185 | (*DebugStream()) << "ChargeTracklet" | |
1186 | << "Detector=" << detector | |
1187 | << "crossing=" << crossing | |
1188 | << "momentum=" << momentum | |
1189 | << "nTracklets="<< nTracklets | |
1190 | << "pdg=" << pdg | |
1191 | << "theta=" << theta | |
1192 | << "phi=" << phi | |
1193 | << "kinkIndex=" << kinkIndex | |
1194 | << "TPCncls=" << nclsTPC | |
1195 | << "QT=" << qTot | |
1196 | << "\n"; | |
1197 | } | |
1198 | } | |
1199 | return h; | |
1200 | } | |
1201 | ||
1202 | //_______________________________________________________ | |
1203 | TH1 *AliTRDcheckDET::PlotNTracksSector(const AliTRDtrackV1 *track){ | |
1204 | // | |
1205 | // Plot the number of tracks per Sector | |
1206 | // | |
1207 | if(track) fkTrack = track; | |
1208 | if(!fkTrack){ | |
4e7a049c | 1209 | AliDebug(4, "No Track defined."); |
db99a57a | 1210 | return NULL; |
1ee39b3a | 1211 | } |
db99a57a | 1212 | TH1 *h = NULL; |
1ee39b3a | 1213 | if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtracksSector)))){ |
1214 | AliWarning("No Histogram defined."); | |
db99a57a | 1215 | return NULL; |
1ee39b3a | 1216 | } |
1217 | ||
1218 | // TODO we should compare with | |
1219 | // sector = Int_t(track->GetAlpha() / AliTRDgeometry::GetAlpha()); | |
1220 | ||
db99a57a | 1221 | AliTRDseedV1 *tracklet = NULL; |
1ee39b3a | 1222 | Int_t sector = -1; |
1223 | for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){ | |
1224 | if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue; | |
1225 | sector = static_cast<Int_t>(tracklet->GetDetector()/AliTRDgeometry::kNdets); | |
1226 | break; | |
1227 | } | |
1228 | h->Fill(sector); | |
1229 | return h; | |
1230 | } | |
1231 | ||
1232 | ||
1233 | //________________________________________________________ | |
1234 | void AliTRDcheckDET::SetRecoParam(AliTRDrecoParam *r) | |
1235 | { | |
1236 | ||
1237 | fReconstructor->SetRecoParam(r); | |
1238 | } | |
1239 | ||
1240 | //________________________________________________________ | |
1241 | void AliTRDcheckDET::GetDistanceToTracklet(Double_t *dist, AliTRDseedV1 * const tracklet, AliTRDcluster * const c) | |
1242 | { | |
1243 | Float_t x = c->GetX(); | |
1244 | dist[0] = c->GetY() - tracklet->GetYat(x); | |
1245 | dist[1] = c->GetZ() - tracklet->GetZat(x); | |
1246 | } | |
1247 | ||
44fd53ca | 1248 | //________________________________________________________ |
1249 | void AliTRDcheckDET::GetEtaPhiAt(AliExternalTrackParam *track, Double_t x, Double_t &eta, Double_t &phi){ | |
1250 | // | |
1251 | // Get phi and eta at a given radial position | |
1252 | // | |
1253 | AliExternalTrackParam workpar(*track); | |
1254 | ||
1255 | Double_t posLocal[3]; | |
1256 | Bool_t sucPos = workpar.GetXYZAt(x, fEventInfo->GetRunInfo()->GetMagneticField(), posLocal); | |
1257 | Double_t sagPhi = sucPos ? TMath::ATan2(posLocal[1], posLocal[0]) : 0.; | |
1258 | phi = sagPhi; | |
1259 | eta = workpar.Eta(); | |
1260 | } | |
1261 | ||
1ee39b3a | 1262 | |
1263 | //_______________________________________________________ | |
1264 | TH1* AliTRDcheckDET::MakePlotChi2() | |
1265 | { | |
1266 | // Plot chi2/track normalized to number of degree of freedom | |
1267 | // (tracklets) and compare with the theoretical distribution. | |
1268 | // | |
1269 | // Alex Bercuci <A.Bercuci@gsi.de> | |
1270 | ||
c0a6ac06 | 1271 | return NULL; |
1272 | ||
1ee39b3a | 1273 | TH2S *h2 = (TH2S*)fContainer->At(kChi2); |
1274 | TF1 f("fChi2", "[0]*pow(x, [1]-1)*exp(-0.5*x)", 0., 50.); | |
c0a6ac06 | 1275 | f.SetParLimits(1,1, 1e100); |
1ee39b3a | 1276 | TLegend *leg = new TLegend(.7,.7,.95,.95); |
1277 | leg->SetBorderSize(1); leg->SetHeader("Tracklets per Track"); | |
db99a57a | 1278 | TH1D *h1 = NULL; |
1ee39b3a | 1279 | Bool_t kFIRST = kTRUE; |
1280 | for(Int_t il=1; il<=h2->GetNbinsX(); il++){ | |
1281 | h1 = h2->ProjectionY(Form("pyChi2%d", il), il, il); | |
1282 | if(h1->Integral()<50) continue; | |
1283 | h1->Scale(1./h1->Integral()); | |
1284 | h1->SetMarkerStyle(7);h1->SetMarkerColor(il); | |
1285 | h1->SetLineColor(il);h1->SetLineStyle(2); | |
1286 | f.SetParameter(1, .5*il);f.SetLineColor(il); | |
1287 | h1->Fit(&f, "QW+", kFIRST ? "pc": "pcsame"); | |
1288 | leg->AddEntry(h1, Form("%d", il), "l"); | |
1289 | if(kFIRST){ | |
1290 | h1->GetXaxis()->SetRangeUser(0., 25.); | |
1291 | } | |
1292 | kFIRST = kFALSE; | |
1293 | } | |
1294 | leg->Draw(); | |
1295 | gPad->SetLogy(); | |
1296 | return h1; | |
1297 | } | |
1298 | ||
1299 | ||
1300 | //________________________________________________________ | |
1301 | TH1* AliTRDcheckDET::MakePlotNTracklets(){ | |
1302 | // | |
1303 | // Make nice bar plot of the number of tracklets in each method | |
1304 | // | |
a5d9fe6f | 1305 | TH2F *tmp = (TH2F *)fContainer->FindObject("hNtlsBAR"); |
1306 | TH1D *hBAR = tmp->ProjectionY(); | |
1ee39b3a | 1307 | TH1F *hSTA = (TH1F *)fContainer->FindObject("hNtlsSTA"); |
1308 | TH1F *hCON = (TH1F *)fContainer->FindObject("hNtls"); | |
1309 | TLegend *leg = new TLegend(0.13, 0.75, 0.39, 0.89); | |
1310 | leg->SetBorderSize(1); | |
1311 | leg->SetFillColor(0); | |
1312 | ||
1313 | Float_t scale = hCON->Integral(); | |
08c8e4e8 | 1314 | if(scale) hCON->Scale(100./scale); |
1ee39b3a | 1315 | hCON->SetFillColor(kRed);hCON->SetLineColor(kRed); |
1316 | hCON->SetBarWidth(0.2); | |
1317 | hCON->SetBarOffset(0.6); | |
1318 | hCON->SetStats(kFALSE); | |
1319 | hCON->GetYaxis()->SetRangeUser(0.,40.); | |
1320 | hCON->GetYaxis()->SetTitleOffset(1.2); | |
1321 | hCON->Draw("bar1"); leg->AddEntry(hCON, "Total", "f"); | |
1322 | hCON->SetMaximum(55.); | |
1323 | ||
08c8e4e8 | 1324 | if(scale) hBAR->Scale(100./scale); |
1ee39b3a | 1325 | hBAR->SetFillColor(kGreen);hBAR->SetLineColor(kGreen); |
1326 | hBAR->SetBarWidth(0.2); | |
1327 | hBAR->SetBarOffset(0.2); | |
1328 | hBAR->SetTitle(""); | |
1329 | hBAR->SetStats(kFALSE); | |
1330 | hBAR->GetYaxis()->SetRangeUser(0.,40.); | |
1331 | hBAR->GetYaxis()->SetTitleOffset(1.2); | |
1332 | hBAR->Draw("bar1same"); leg->AddEntry(hBAR, "Barrel", "f"); | |
1333 | ||
08c8e4e8 | 1334 | if(scale) hSTA->Scale(100./scale); |
1ee39b3a | 1335 | hSTA->SetFillColor(kBlue);hSTA->SetLineColor(kBlue); |
1336 | hSTA->SetBarWidth(0.2); | |
1337 | hSTA->SetBarOffset(0.4); | |
1338 | hSTA->SetTitle(""); | |
1339 | hSTA->SetStats(kFALSE); | |
1340 | hSTA->GetYaxis()->SetRangeUser(0.,40.); | |
1341 | hSTA->GetYaxis()->SetTitleOffset(1.2); | |
1342 | hSTA->Draw("bar1same"); leg->AddEntry(hSTA, "Stand Alone", "f"); | |
1343 | leg->Draw(); | |
1344 | gPad->Update(); | |
1345 | return hCON; | |
1346 | } | |
1347 | ||
0c76cfa4 | 1348 | //________________________________________________________ |
1349 | void AliTRDcheckDET::MakePlotnTrackletsVsP(){ | |
1350 | // | |
1351 | // Plot abundance of tracks with number of tracklets as function of momentum | |
1352 | // | |
147c3968 | 1353 | |
1354 | ||
1355 | ||
1356 | ||
1357 | Color_t color[AliTRDgeometry::kNlayer] = {kBlue, kOrange, kBlack, kGreen, kCyan, kRed}; | |
1358 | TH1 *h(NULL); TGraphErrors *g[AliTRDgeometry::kNlayer]; | |
1359 | for(Int_t itl(0); itl<AliTRDgeometry::kNlayer; itl++){ | |
1360 | g[itl] = new TGraphErrors(); | |
1361 | g[itl]->SetLineColor(color[itl]); | |
1362 | g[itl]->SetMarkerColor(color[itl]); | |
1363 | g[itl]->SetMarkerStyle(20 + itl); | |
1364 | } | |
1365 | ||
0c76cfa4 | 1366 | TH2 *hBar = (TH2F *)fContainer->FindObject("hNtlsBAR"); |
147c3968 | 1367 | TAxis *ax(hBar->GetXaxis()); |
1368 | Int_t np(ax->GetNbins()); | |
1369 | for(Int_t ipBin(1); ipBin<np; ipBin++){ | |
1370 | h = hBar->ProjectionY("npBin", ipBin, ipBin); | |
81979445 | 1371 | if(!Int_t(h->Integral())) continue; |
147c3968 | 1372 | h->Scale(100./h->Integral()); |
1373 | Float_t p(ax->GetBinCenter(ipBin)); | |
1374 | Float_t dp(ax->GetBinWidth(ipBin)); | |
81979445 | 1375 | Int_t ip(g[0]->GetN()); |
147c3968 | 1376 | for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){ |
81979445 | 1377 | g[itl]->SetPoint(ip, p, h->GetBinContent(itl+1)); |
1378 | g[itl]->SetPointError(ip, dp/3.46, h->GetBinError(itl+1)); | |
147c3968 | 1379 | } |
1380 | } | |
1381 | ||
81979445 | 1382 | TLegend *leg = new TLegend(0.76, 0.6, 1., 0.9); |
94f7dff7 | 1383 | leg->SetBorderSize(0); |
1384 | leg->SetHeader("Tracklet/Track"); | |
1385 | leg->SetFillStyle(0); | |
147c3968 | 1386 | h = hBar->ProjectionX("npxBin"); h->Reset(); |
81979445 | 1387 | h->SetTitle(""); |
1388 | h->GetYaxis()->SetRangeUser(1., 99.); | |
1389 | h->GetYaxis()->SetMoreLogLabels(); | |
1390 | h->GetYaxis()->CenterTitle(); | |
1391 | h->GetYaxis()->SetTitleOffset(1.2); | |
147c3968 | 1392 | h->SetYTitle("Prob. [%]"); |
81979445 | 1393 | h->GetXaxis()->SetRangeUser(0.4, 12.); |
1394 | h->GetXaxis()->SetMoreLogLabels(); | |
1395 | h->GetXaxis()->CenterTitle(); | |
147c3968 | 1396 | h->Draw("p"); |
1397 | for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){ | |
1398 | g[itl]->Draw("pc"); | |
1399 | leg->AddEntry(g[itl], Form("n = %d", itl+1),"pl"); | |
0c76cfa4 | 1400 | } |
147c3968 | 1401 | |
0c76cfa4 | 1402 | leg->Draw(); |
81979445 | 1403 | gPad->SetLogx();gPad->SetLogy(); |
0c76cfa4 | 1404 | } |
1405 | ||
1ee39b3a | 1406 | //________________________________________________________ |
c0a6ac06 | 1407 | Bool_t AliTRDcheckDET::MakePlotPulseHeight(){ |
1ee39b3a | 1408 | // |
1409 | // Create Plot of the Pluse Height Spectrum | |
1410 | // | |
c0a6ac06 | 1411 | TCanvas *output = gPad->GetCanvas(); |
1412 | output->Divide(2); | |
1413 | output->cd(1); | |
1ee39b3a | 1414 | TH1 *h, *h1, *h2; |
1415 | TObjArray *arr = (TObjArray*)fContainer->FindObject("<PH>"); | |
1416 | h = (TH1F*)arr->At(0); | |
1417 | h->SetMarkerStyle(24); | |
1418 | h->SetMarkerColor(kBlack); | |
1419 | h->SetLineColor(kBlack); | |
b795b480 | 1420 | h->GetYaxis()->SetTitleOffset(1.5); |
1ee39b3a | 1421 | h->Draw("e1"); |
3907f080 | 1422 | // Trending for the pulse height: plateau value, slope and timebin of the maximum |
1423 | TLinearFitter fit(1,"pol1"); | |
1424 | Double_t time = 0.; | |
1425 | for(Int_t itime = 10; itime <= 20; itime++){ | |
1426 | time = static_cast<Double_t>(itime); | |
1427 | fit.AddPoint(&time, h->GetBinContent(itime + 1), h->GetBinError(itime + 1)); | |
1428 | } | |
1429 | fit.Eval(); | |
1430 | Double_t plateau = fit.GetParameter(0) + 12 * fit.GetParameter(1); | |
1431 | Double_t slope = fit.GetParameter(1); | |
1432 | PutTrendValue("PHplateau", plateau); | |
1433 | PutTrendValue("PHslope", slope); | |
1434 | PutTrendValue("PHamplificationPeak", static_cast<Double_t>(h->GetMaximumBin()-1)); | |
1435 | AliDebug(1, Form("plateau %f, slope %f, MaxTime %f", plateau, slope, static_cast<Double_t>(h->GetMaximumBin()-1))); | |
1ee39b3a | 1436 | // copy the second histogram in a new one with the same x-dimension as the phs with respect to time |
1437 | h1 = (TH1F *)arr->At(1); | |
1438 | h2 = new TH1F("hphs1","Average PH", 31, -0.5, 30.5); | |
1439 | for(Int_t ibin = h1->GetXaxis()->GetFirst(); ibin < h1->GetNbinsX(); ibin++) | |
1440 | h2->SetBinContent(ibin, h1->GetBinContent(ibin)); | |
1441 | h2->SetMarkerStyle(22); | |
1442 | h2->SetMarkerColor(kBlue); | |
1443 | h2->SetLineColor(kBlue); | |
1444 | h2->Draw("e1same"); | |
1445 | gPad->Update(); | |
1446 | // create axis according to the histogram dimensions of the original second histogram | |
1447 | TGaxis *axis = new TGaxis(gPad->GetUxmin(), | |
1448 | gPad->GetUymax(), | |
1449 | gPad->GetUxmax(), | |
1450 | gPad->GetUymax(), | |
1451 | -0.08, 4.88, 510,"-L"); | |
1452 | axis->SetLineColor(kBlue); | |
1453 | axis->SetLabelColor(kBlue); | |
1454 | axis->SetTextColor(kBlue); | |
1455 | axis->SetTitle("x_{0}-x_{c} [cm]"); | |
1456 | axis->Draw(); | |
c0a6ac06 | 1457 | |
1458 | output->cd(2); | |
1459 | TH2 *ph2d = (TH2F *)arr->At(2); | |
b795b480 | 1460 | ph2d->GetYaxis()->SetTitleOffset(1.8); |
c0a6ac06 | 1461 | ph2d->SetStats(kFALSE); |
1462 | ph2d->Draw("colz"); | |
1463 | return kTRUE; | |
1ee39b3a | 1464 | } |
1465 | ||
44fd53ca | 1466 | //________________________________________________________ |
1467 | void AliTRDcheckDET::MakePlotMeanClustersLayer(){ | |
1468 | // | |
1469 | // Create Summary plot for the mean number of clusters per layer | |
1470 | // | |
1471 | TCanvas *output = gPad->GetCanvas(); | |
1472 | output->Divide(3,2); | |
1473 | TObjArray *histos = (TObjArray *)fContainer->At(kNclustersLayer); | |
1474 | if(!histos){ | |
1475 | AliWarning("Histos for each layer not found"); | |
1476 | return; | |
1477 | } | |
1478 | TProfile2D *hlayer = NULL; | |
1479 | for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++){ | |
1480 | hlayer = dynamic_cast<TProfile2D *>(histos->At(ily)); | |
1481 | output->cd(ily + 1); | |
1482 | gPad->SetGrid(0,0); | |
1483 | hlayer->Draw("colz"); | |
1484 | } | |
1485 | } | |
1486 | ||
1ee39b3a | 1487 | //________________________________________________________ |
1488 | Bool_t AliTRDcheckDET::MakeBarPlot(TH1 *histo, Int_t color){ | |
1489 | // | |
1490 | // Draw nice bar plots | |
1491 | // | |
1492 | if(!histo->GetEntries()) return kFALSE; | |
1493 | histo->Scale(100./histo->Integral()); | |
1494 | histo->SetFillColor(color); | |
1495 | histo->SetBarOffset(.2); | |
1496 | histo->SetBarWidth(.6); | |
1497 | histo->Draw("bar1"); | |
1498 | return kTRUE; | |
960a59e0 | 1499 | } |