1 ////////////////////////////////////////////////////////////////////////////
4 // Basic checks for tracking and detector performance //
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
13 // - Chi2 distribution for tracks
14 // - Charge distribution per cluster and tracklet
15 // - Number of events and tracks per trigger source
17 // - Track and Tracklet propagation status
20 // Anton Andronic <A.Andronic@gsi.de> //
21 // Alexandru Bercuci <A.Bercuci@gsi.de> //
22 // Markus Fasel <M.Fasel@gsi.de> //
24 ////////////////////////////////////////////////////////////////////////////
35 #include <TGraphErrors.h>
37 #include <TLinearFitter.h>
40 #include <TProfile2D.h>
41 #include <TObjArray.h>
43 #include <TObjString.h>
47 #include <TProfile2D.h>
52 #include "AliTRDcluster.h"
53 #include "AliESDHeader.h"
54 #include "AliESDRun.h"
55 #include "AliESDtrack.h"
56 #include "AliExternalTrackParam.h"
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"
69 #include "info/AliTRDtrackInfo.h"
70 #include "info/AliTRDeventInfo.h"
71 #include "AliTRDinfoGen.h"
72 #include "AliTRDcheckDET.h"
77 ClassImp(AliTRDcheckDET)
79 //_______________________________________________________
80 AliTRDcheckDET::AliTRDcheckDET():
87 // Default constructor
89 SetNameTitle("TRDcheckDET", "Basic TRD data checker");
92 //_______________________________________________________
93 AliTRDcheckDET::AliTRDcheckDET(char* name):
94 AliTRDrecoTask(name, "Basic TRD data checker")
100 // Default constructor
102 DefineInput(2, AliTRDeventInfo::Class());
108 //_______________________________________________________
109 AliTRDcheckDET::~AliTRDcheckDET(){
113 if(fTriggerNames) delete fTriggerNames;
116 //_______________________________________________________
117 void AliTRDcheckDET::UserCreateOutputObjects(){
119 // Create Output Objects
121 AliTRDrecoTask::UserCreateOutputObjects();
122 if(!fTriggerNames) fTriggerNames = new TMap();
125 //_______________________________________________________
126 void AliTRDcheckDET::UserExec(Option_t *opt){
128 // Execution function
129 // Filling TRD quality histos
131 fEventInfo = dynamic_cast<AliTRDeventInfo *>(GetInputData(2));
132 AliDebug(2, Form("EventInfo[%p] Header[%p]", (void*)fEventInfo, (void*)(fEventInfo?fEventInfo->GetEventHeader():NULL)));
134 AliTRDrecoTask::UserExec(opt);
136 TH1F *histo(NULL); AliTRDtrackInfo *fTrackInfo(NULL); Int_t nTracks(0); // Count the number of tracks per event
137 for(Int_t iti = 0; iti < fTracks->GetEntriesFast(); iti++){
138 if(!fTracks->UncheckedAt(iti)) continue;
139 if(!(fTrackInfo = dynamic_cast<AliTRDtrackInfo *>(fTracks->UncheckedAt(iti)))) continue;
140 if(!fTrackInfo->GetTrack()) continue;
144 dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNtracksEvent))->Fill(nTracks);
146 if(!fEventInfo->GetEventHeader()) return; // For trigger statistics event header is essential
147 Int_t triggermask = fEventInfo->GetEventHeader()->GetTriggerMask();
148 TString triggername = fEventInfo->GetRunInfo()->GetFiredTriggerClasses(triggermask);
149 AliDebug(6, Form("Trigger cluster: %d, Trigger class: %s\n", triggermask, triggername.Data()));
150 if((histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger)))) histo->Fill(triggermask);
153 if((histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks)))) histo->Fill(triggermask);
155 if(triggermask <= 20 && !fTriggerNames->FindObject(Form("%d", triggermask))){
156 fTriggerNames->Add(new TObjString(Form("%d", triggermask)), new TObjString(triggername));
157 // also set the label for both histograms
158 if((histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks))))
159 histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername);
160 if((histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger))))
161 histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername);
166 //_______________________________________________________
167 Bool_t AliTRDcheckDET::PostProcess(){
169 // Do Postprocessing (for the moment set the number of Reference histograms)
172 TH1F *h(NULL), *h1(NULL);
174 // Calculate of the trigger clusters purity
175 if((h = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTrigger"))) &&
176 (h1 = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTriggerTracks")))) {
178 Float_t purities[20], val = 0; memset(purities, 0, 20*sizeof(Float_t));
179 TString triggernames[20];
180 Int_t nTriggerClasses = 0;
181 for(Int_t ibin = 1; ibin <= h->GetNbinsX(); ibin++){
182 if((val = h1->GetBinContent(ibin))){
183 purities[nTriggerClasses] = val;
184 triggernames[nTriggerClasses] = h1->GetXaxis()->GetBinLabel(ibin);
189 if((h = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kTriggerPurity)))){
190 TAxis *ax = h->GetXaxis();
191 for(Int_t itrg = 0; itrg < nTriggerClasses; itrg++){
192 h->Fill(itrg, purities[itrg]);
193 ax->SetBinLabel(itrg+1, triggernames[itrg].Data());
195 ax->SetRangeUser(-0.5, nTriggerClasses+.5);
196 h->GetYaxis()->SetRangeUser(0,1);
201 if((h=dynamic_cast<TH1F*>(fContainer->At(kTrackStatus)))){
202 Float_t ok = h->GetBinContent(1);
203 Int_t nerr = h->GetNbinsX();
204 for(Int_t ierr=nerr; ierr--;){
205 h->SetBinContent(ierr+1, ok>0.?1.e2*h->GetBinContent(ierr+1)/ok:0.);
207 h->SetBinContent(1, 0.);
211 TObjArray *arr(NULL);
212 if(( arr = dynamic_cast<TObjArray*>(fContainer->UncheckedAt(kTrackletStatus)))){
213 for(Int_t ily = AliTRDgeometry::kNlayer; ily--;){
214 if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue;
215 Float_t okB = h->GetBinContent(1);
216 Int_t nerrB = h->GetNbinsX();
217 for(Int_t ierr=nerrB; ierr--;){
218 h->SetBinContent(ierr+1, okB>0.?1.e2*h->GetBinContent(ierr+1)/okB:0.);
220 h->SetBinContent(1, 0.);
228 //_______________________________________________________
229 void AliTRDcheckDET::MakeSummary(){
231 // Create summary plots for TRD check DET
232 // This function creates 2 summary plots:
233 // - General Quantities
235 // The function will reuse GetRefFigure
238 TCanvas *cOut = new TCanvas(Form("summary%s1", GetName()), Form("Summary 1 for task %s", GetName()), 1024, 768);
241 // Create figures using GetRefFigure
242 cOut->cd(1); GetRefFigure(kFigNtracksEvent);
243 cOut->cd(2); GetRefFigure(kFigNtracksSector);
244 cOut->cd(3); GetRefFigure(kFigNclustersTrack);
245 cOut->cd(4); GetRefFigure(kFigNclustersTracklet);
246 cOut->cd(5); GetRefFigure(kFigNtrackletsTrack);
247 cOut->cd(6); GetRefFigure(kFigNTrackletsP);
248 cOut->cd(7); GetRefFigure(kFigChargeCluster);
249 cOut->cd(8); GetRefFigure(kFigChargeTracklet);
250 cOut->SaveAs("TRD_TrackQuality.gif");
254 cOut = new TCanvas(Form("summary%s2", GetName()), Form("Summary 2 for task %s", GetName()), 1024, 512);
255 cOut->cd(); GetRefFigure(kFigPH);
256 cOut->SaveAs("TRD_PH.gif");
259 // Third Plot: Mean Number of clusters as function of eta, phi and layer
260 cOut = new TCanvas(Form("summary%s3", GetName()), Form("Summary 3 for task %s", GetName()), 1024, 768);
261 cOut->cd(); MakePlotMeanClustersLayer();
262 cOut->SaveAs("TRD_MeanNclusters.gif");
267 //_______________________________________________________
268 Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){
270 // Setting Reference Figures
274 TH1 *h = NULL; TObjArray *arr=NULL;
278 case kFigNclustersTrack:
279 (h=(TH1F*)fContainer->FindObject("hNcls"))->Draw("pl");
280 PutTrendValue("NClustersTrack", h->GetMean());
281 PutTrendValue("NClustersTrackRMS", h->GetRMS());
283 case kFigNclustersTracklet:
284 (h =(TH1F*)fContainer->FindObject("hNclTls"))->Draw("pc");
285 PutTrendValue("NClustersTracklet", h->GetMean());
286 PutTrendValue("NClustersTrackletRMS", h->GetRMS());
288 case kFigNtrackletsTrack:
289 h=MakePlotNTracklets();
291 PutTrendValue("NTrackletsTrack", h->GetMean());
292 PutTrendValue("NTrackletsTrackRMS", h->GetRMS());
295 case kFigNTrackletsP:
296 MakePlotnTrackletsVsP();
298 case kFigNtrackletsCross:
299 h = (TH1F*)fContainer->FindObject("hNtlsCross");
300 if(!MakeBarPlot(h, kRed)) break;
301 PutTrendValue("NTrackletsCross", h->GetMean());
302 PutTrendValue("NTrackletsCrossRMS", h->GetRMS());
304 case kFigNtrackletsFindable:
305 h = (TH1F*)fContainer->FindObject("hNtlsFindable");
306 if(!MakeBarPlot(h, kGreen)) break;
307 PutTrendValue("NTrackletsFindable", h->GetMean());
308 PutTrendValue("NTrackletsFindableRMS", h->GetRMS());
310 case kFigNtracksEvent:
311 (h = (TH1F*)fContainer->FindObject("hNtrks"))->Draw("pl");
312 PutTrendValue("NTracksEvent", h->GetMean());
313 PutTrendValue("NTracksEventRMS", h->GetRMS());
315 case kFigNtracksSector:
316 h = (TH1F*)fContainer->FindObject("hNtrksSector");
317 if(!MakeBarPlot(h, kGreen)) break;
318 PutTrendValue("NTracksSector", h->Integral()/h->GetNbinsX());
320 case kFigTrackStatus:
321 if(!(h=(TH1F *)fContainer->FindObject("hTrackStatus"))) break;
322 h->GetXaxis()->SetRangeUser(0.5, -1);
323 h->GetYaxis()->CenterTitle();
325 PutTrendValue("TrackStatus", h->Integral());
328 case kFigTrackletStatus:
329 if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))) break;
330 leg = new TLegend(.68, .7, .97, .97);
331 leg->SetBorderSize(0);leg->SetFillStyle(0);
332 leg->SetHeader("TRD layer");
333 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
334 if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue;
337 h->GetXaxis()->SetRangeUser(0.5, -1);
338 h->GetYaxis()->CenterTitle();
340 } else h->Draw("samepl");
341 leg->AddEntry(h, Form("ly = %d", ily), "l");
342 PutTrendValue(Form("TrackletStatus%d", ily), h->Integral());
351 gPad->SetMargin(0.125, 0.015, 0.1, 0.1);
352 MakePlotPulseHeight();
355 case kFigChargeCluster:
356 (h = (TH1F*)fContainer->FindObject("hQcl"))->Draw("c");
358 PutTrendValue("ChargeCluster", h->GetMaximumBin());
359 PutTrendValue("ChargeClusterRMS", h->GetRMS());
361 case kFigChargeTracklet:
362 (h=(TH1F*)fContainer->FindObject("hQtrklt"))->Draw("c");
363 PutTrendValue("ChargeTracklet", h->GetMaximumBin());
364 PutTrendValue("ChargeTrackletRMS", h->GetRMS());
366 case kFigNeventsTrigger:
367 ((TH1F*)fContainer->FindObject("hEventsTrigger"))->Draw("");
369 case kFigNeventsTriggerTracks:
370 ((TH1F*)fContainer->FindObject("hEventsTriggerTracks"))->Draw("");
372 case kFigTriggerPurity:
373 if(!MakeBarPlot((TH1F*)fContainer->FindObject("hTriggerPurity"), kGreen)) break;
378 AliInfo(Form("Reference plot [%d] missing result", ifig));
382 //_______________________________________________________
383 TObjArray *AliTRDcheckDET::Histos(){
385 // Create QA histograms
388 if(fContainer) return fContainer;
390 fContainer = new TObjArray(20);
391 //fContainer->SetOwner(kTRUE);
393 // Register Histograms
396 if(!(h = (TH1F *)gROOT->FindObject("hNcls"))){
397 h = new TH1F("hNcls", "N_{clusters} / track", 181, -0.5, 180.5);
398 h->GetXaxis()->SetTitle("N_{clusters}");
399 h->GetYaxis()->SetTitle("Entries");
401 fContainer->AddAt(h, kNclustersTrack);
403 TObjArray *arr = new TObjArray(AliTRDgeometry::kNlayer);
404 arr->SetOwner(kTRUE); arr->SetName("clusters");
405 fContainer->AddAt(arr, kNclustersLayer);
406 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
407 if(!(h = (TProfile2D *)gROOT->FindObject(Form("hNcl%d", ily)))){
408 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());
409 h->GetXaxis()->SetTitle("#eta");
410 h->GetYaxis()->SetTitle("#phi");
415 if(!(h = (TH1F *)gROOT->FindObject("hNclTls"))){
416 h = new TH1F("hNclTls","N_{clusters} / tracklet", 51, -0.5, 50.5);
417 h->GetXaxis()->SetTitle("N_{clusters}");
418 h->GetYaxis()->SetTitle("Entries");
420 fContainer->AddAt(h, kNclustersTracklet);
422 if(!(h = (TH1F *)gROOT->FindObject("hNtls"))){
423 h = new TH1F("hNtls", "N_{tracklets} / track", AliTRDgeometry::kNlayer, 0.5, 6.5);
424 h->GetXaxis()->SetTitle("N^{tracklet}");
425 h->GetYaxis()->SetTitle("freq. [%]");
427 fContainer->AddAt(h, kNtrackletsTrack);
429 if(!(h = (TH1F *)gROOT->FindObject("htlsSTA"))){
430 h = new TH1F("hNtlsSTA", "N_{tracklets} / track (Stand Alone)", AliTRDgeometry::kNlayer, 0.5, 6.5);
431 h->GetXaxis()->SetTitle("N^{tracklet}");
432 h->GetYaxis()->SetTitle("freq. [%]");
434 fContainer->AddAt(h, kNtrackletsSTA);
436 // Binning for momentum dependent tracklet Plots
439 Float_t binsP[kNp+1], binsTrklt[AliTRDgeometry::kNlayer+1];
440 for(Int_t i=0;i<kNp+1; i++,p+=(TMath::Exp(i*i*.001)-1.)) binsP[i]=p;
441 for(Int_t il = 0; il <= AliTRDgeometry::kNlayer; il++) binsTrklt[il] = 0.5 + il;
442 if(!(h = (TH1F *)gROOT->FindObject("htlsBAR"))){
443 // Make tracklets for barrel tracks momentum dependent (if we do not exceed min and max values)
444 h = new TH2F("hNtlsBAR",
445 "N_{tracklets} / track;p [GeV/c];N^{tracklet};freq. [%]",
446 kNp, binsP, AliTRDgeometry::kNlayer, binsTrklt);
448 fContainer->AddAt(h, kNtrackletsBAR);
451 if(!(h = (TH1F *)gROOT->FindObject("hNtlsCross"))){
452 h = new TH1F("hNtlsCross", "N_{tracklets}^{cross} / track", 7, -0.5, 6.5);
453 h->GetXaxis()->SetTitle("n_{row cross}");
454 h->GetYaxis()->SetTitle("freq. [%]");
456 fContainer->AddAt(h, kNtrackletsCross);
458 if(!(h = (TH1F *)gROOT->FindObject("hNtlsFindable"))){
459 h = new TH1F("hNtlsFindable", "Found/Findable Tracklets" , 101, -0.005, 1.005);
460 h->GetXaxis()->SetTitle("r [a.u]");
461 h->GetYaxis()->SetTitle("Entries");
463 fContainer->AddAt(h, kNtrackletsFindable);
465 if(!(h = (TH1F *)gROOT->FindObject("hNtrks"))){
466 h = new TH1F("hNtrks", "N_{tracks} / event", 100, 0, 100);
467 h->GetXaxis()->SetTitle("N_{tracks}");
468 h->GetYaxis()->SetTitle("Entries");
470 fContainer->AddAt(h, kNtracksEvent);
472 if(!(h = (TH1F *)gROOT->FindObject("hNtrksSector"))){
473 h = new TH1F("hNtrksSector", "N_{tracks} / sector", AliTRDgeometry::kNsector, -0.5, 17.5);
474 h->GetXaxis()->SetTitle("sector");
475 h->GetYaxis()->SetTitle("freq. [%]");
477 fContainer->AddAt(h, kNtracksSector);
479 if(!(h = (TH1F*)gROOT->FindObject("hTrackStatus"))){
480 const Int_t nerr = 7;
481 h = new TH1F("hTrackStatus", "Track Status", nerr, -0.5, nerr-0.5);
482 const Char_t *label[nerr] = {"OK", "PROL", "PROP", "AJST", "SNP", "TINI", "UPDT"};
484 for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]);
485 h->SetYTitle("Relative Error to Good [%]");
487 fContainer->AddAt(h, kTrackStatus);
489 arr = new TObjArray(AliTRDgeometry::kNlayer);
490 arr->SetOwner(kTRUE); arr->SetName("TrackletStatus");
491 fContainer->AddAt(arr, kTrackletStatus);
492 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
493 if(!(h = (TH1F *)gROOT->FindObject(Form("hTrackletStatus%d", ily)))){
494 const Int_t nerr = 8;
495 h = new TH1F(Form("hTrackletStatus%d", ily), "Tracklet status", nerr, -0.5, nerr-0.5);
496 h->SetLineColor(ily+1);
497 const Char_t *label[nerr] = {"OK", "Geom", "Bound", "NoCl", "NoAttach", "NoClTr", "NoFit", "Chi2"};
499 for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]);
500 h->SetYTitle("Relative Error to Good [%]");
506 arr = new TObjArray(3);
507 arr->SetOwner(kTRUE); arr->SetName("<PH>");
508 fContainer->AddAt(arr, kPH);
509 if(!(h = (TH1F *)gROOT->FindObject("hPHt"))){
510 h = new TProfile("hPHt", "<PH>", 31, -0.5, 30.5);
511 h->GetXaxis()->SetTitle("Time / 100ns");
512 h->GetYaxis()->SetTitle("<PH> [a.u]");
515 if(!(h = (TH1F *)gROOT->FindObject("hPHx")))
516 h = new TProfile("hPHx", "<PH>", 31, -0.08, 4.88);
519 if(!(h = (TH2F *)gROOT->FindObject("hPH2D"))){
520 h = new TH2F("hPH2D", "Charge Distribution / time", 31, -0.5, 30.5, 100, 0, 1024);
521 h->GetXaxis()->SetTitle("Time / 100ns");
522 h->GetYaxis()->SetTitle("Charge / a.u.");
527 if(!(h = (TH2S*)gROOT->FindObject("hChi2"))){
528 h = new TH2S("hChi2", "#chi^{2} per track", AliTRDgeometry::kNlayer, .5, AliTRDgeometry::kNlayer+.5, 100, 0, 50);
530 h->SetYTitle("#chi^{2}/ndf");
531 h->SetZTitle("entries");
533 fContainer->AddAt(h, kChi2);
535 if(!(h = (TH1F *)gROOT->FindObject("hQcl"))){
536 h = new TH1F("hQcl", "Q_{cluster}", 200, 0, 1200);
537 h->GetXaxis()->SetTitle("Q_{cluster} [a.u.]");
538 h->GetYaxis()->SetTitle("Entries");
540 fContainer->AddAt(h, kChargeCluster);
542 if(!(h = (TH1F *)gROOT->FindObject("hQtrklt"))){
543 h = new TH1F("hQtrklt", "Q_{tracklet}", 6000, 0, 6000);
544 h->GetXaxis()->SetTitle("Q_{tracklet} [a.u.]");
545 h->GetYaxis()->SetTitle("Entries");
547 fContainer->AddAt(h, kChargeTracklet);
550 if(!(h = (TH1F *)gROOT->FindObject("hEventsTrigger")))
551 h = new TH1F("hEventsTrigger", "Trigger Class", 100, 0, 100);
554 fContainer->AddAt(h, kNeventsTrigger);
556 if(!(h = (TH1F *)gROOT->FindObject("hEventsTriggerTracks")))
557 h = new TH1F("hEventsTriggerTracks", "Trigger Class (Tracks)", 100, 0, 100);
559 fContainer->AddAt(h, kNeventsTriggerTracks);
561 if(!(h = (TH1F *)gROOT->FindObject("hTriggerPurity"))){
562 h = new TH1F("hTriggerPurity", "Trigger Purity", 10, -0.5, 9.5);
563 h->GetXaxis()->SetTitle("Trigger Cluster");
564 h->GetYaxis()->SetTitle("freq.");
566 fContainer->AddAt(h, kTriggerPurity);
575 //_______________________________________________________
576 TH1 *AliTRDcheckDET::PlotTrackStatus(const AliTRDtrackV1 *track)
579 // Plot the track propagation status. The following errors are defined (see AliTRDtrackV1::ETRDtrackError)
580 // PROL - track prolongation failure
581 // PROP - track propagation failure
582 // AJST - crossing sectors failure
583 // SNP - too large bending
584 // TINI - tracklet initialization failure
585 // UPDT - track position/covariance update failure
587 // Performance plot looks as below:
589 //<img src="TRD/trackStatus.gif">
592 if(track) fkTrack = track;
594 AliDebug(4, "No Track defined.");
598 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kTrackStatus)))){
599 AliWarning("No Histogram defined.");
602 h->Fill(fkTrack->GetStatusTRD());
606 //_______________________________________________________
607 TH1 *AliTRDcheckDET::PlotTrackletStatus(const AliTRDtrackV1 *track)
610 // Plot the tracklet propagation status. The following errors are defined for tracklet (see AliTRDtrackV1::ETRDlayerError)
612 // Bound - tracklet too close to chamber walls
613 // NoCl - no clusters in the track roads
614 // NoAttach - fail to attach clusters
615 // NoClTr - fail to use clusters for fit
616 // NoFit - tracklet fit failled
617 // Chi2 - chi2 tracklet-track over threshold
619 // Performance plot looks as below:
621 //<img src="TRD/trackletStatus.gif">
624 if(track) fkTrack = track;
626 AliDebug(4, "No Track defined.");
629 TObjArray *arr =NULL;
630 if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))){
631 AliWarning("Histograms not defined.");
636 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
637 if(!(h = dynamic_cast<TH1F*>(arr->At(ily)))){
638 AliWarning(Form("Missing histo for layer %d.", ily));
641 h->Fill(fkTrack->GetStatusTRD(ily));
646 //_______________________________________________________
647 TH1 *AliTRDcheckDET::PlotNClustersTracklet(const AliTRDtrackV1 *track){
649 // Plot the mean number of clusters per tracklet
651 if(track) fkTrack = track;
653 AliDebug(4, "No Track defined.");
656 AliExternalTrackParam *par = fkTrack->GetTrackIn() ? fkTrack->GetTrackIn() : fkTrack->GetTrackOut();
658 TProfile2D *hlayer = NULL;
659 Double_t eta = 0., phi = 0.;
660 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTracklet)))){
661 AliWarning("No Histogram defined.");
664 AliTRDseedV1 *tracklet = NULL;
665 TObjArray *histosLayer = dynamic_cast<TObjArray *>(fContainer->At(kNclustersLayer));
667 AliWarning("No Histograms for single layer defined");
669 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
670 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
671 h->Fill(tracklet->GetN2());
672 if(histosLayer && par){
673 if((hlayer = dynamic_cast<TProfile2D *>(histosLayer->At(itl)))){
674 GetEtaPhiAt(par, tracklet->GetX0(), eta, phi);
675 hlayer->Fill(eta, phi, tracklet->GetN2());
682 //_______________________________________________________
683 TH1 *AliTRDcheckDET::PlotNClustersTrack(const AliTRDtrackV1 *track){
685 // Plot the number of clusters in one track
687 if(track) fkTrack = track;
689 AliDebug(4, "No Track defined.");
693 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTrack)))){
694 AliWarning("No Histogram defined.");
699 AliTRDseedV1 *tracklet = NULL;
700 AliExternalTrackParam *par = fkTrack->GetTrackOut() ? fkTrack->GetTrackOut() : fkTrack->GetTrackIn();
701 if(!par) return NULL;
702 Double_t momentumRec = par->P();
703 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
704 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
705 Int_t n(tracklet->GetN());
707 if(DebugLevel() > 2){
708 Int_t crossing = Int_t(tracklet->IsRowCross());
709 Int_t detector = tracklet->GetDetector();
710 Float_t theta = TMath::ATan(tracklet->GetZref(1));
711 Float_t phi = TMath::ATan(tracklet->GetYref(1));
712 Float_t momentumMC = 0.;
714 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
715 UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0;
717 if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P();
718 pdg = fkMC->GetPDG();
720 (*DebugStream()) << "NClustersTrack"
721 << "Detector=" << detector
722 << "crossing=" << crossing
723 << "momentumMC="<< momentumMC
724 << "momentumRec=" << momentumRec
728 << "kinkIndex=" << kinkIndex
729 << "TPCncls=" << nclsTPC
739 //_______________________________________________________
740 TH1 *AliTRDcheckDET::PlotNTrackletsTrack(const AliTRDtrackV1 *track){
742 // Plot the number of tracklets
744 if(track) fkTrack = track;
746 AliDebug(4, "No Track defined.");
749 TH1 *h = NULL, *hSta = NULL; TH2 *hBarrel = NULL;
750 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsTrack)))){
751 AliWarning("No Histogram defined.");
754 Int_t nTracklets = fkTrack->GetNumberOfTracklets();
757 Int_t status = fkESD->GetStatus();
759 /* 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);*/
761 Int_t method = -1; // to distinguish between stand alone and full barrel tracks in the debugging
762 if((status & AliESDtrack::kTRDin) != 0){
764 // Full Barrel Track: Save momentum dependence
765 if(!(hBarrel = dynamic_cast<TH2F *>(fContainer->At(kNtrackletsBAR)))){
766 AliWarning("Method: Barrel. Histogram not processed!");
769 AliExternalTrackParam *par(fkTrack->GetTrackIn());
771 AliError("Input track params missing");
774 p = par->P(); // p needed later in the debug streaming
775 hBarrel->Fill(p, nTracklets);
777 // Stand alone Track: momentum dependence not usefull
779 if(!(hSta = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsSTA)))) {
780 AliWarning("Method: StandAlone. Histogram not processed!");
783 hSta->Fill(nTracklets);
786 if(DebugLevel() > 2){
787 AliTRDseedV1 *tracklet = NULL;
788 AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
789 Int_t sector = -1, stack = -1, detector;
790 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
791 if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue;
792 detector = tracklet->GetDetector();
793 sector = geo->GetSector(detector);
794 stack = geo->GetStack(detector);
797 (*DebugStream()) << "NTrackletsTrack"
798 << "Sector=" << sector
800 << "NTracklets=" << nTracklets
801 << "Method=" << method
805 if(DebugLevel() > 3){
806 AliTRDseedV1 *tracklet = NULL;
807 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
808 if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){
809 (*DebugStream()) << "NTrackletsLayer"
820 //_______________________________________________________
821 TH1 *AliTRDcheckDET::PlotNTrackletsRowCross(const AliTRDtrackV1 *track){
823 // Plot the number of tracklets
825 if(track) fkTrack = track;
827 AliDebug(4, "No Track defined.");
831 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsCross)))){
832 AliWarning("No Histogram defined.");
837 AliTRDseedV1 *tracklet = NULL;
838 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
839 if(!(tracklet = fkTrack->GetTracklet(il)) || !tracklet->IsOK()) continue;
841 if(tracklet->IsRowCross()) ncross++;
847 //_______________________________________________________
848 TH1 *AliTRDcheckDET::PlotFindableTracklets(const AliTRDtrackV1 *track){
850 // Plots the ratio of number of tracklets vs.
851 // number of findable tracklets
853 // Findable tracklets are defined as track prolongation
854 // to layer i does not hit the dead area +- epsilon
856 // In order to check whether tracklet hist active area in Layer i,
857 // the track is refitted and the fitted position + an uncertainty
858 // range is compared to the chamber border (also with a different
861 // For the track fit two cases are distinguished:
862 // If the track is a stand alone track (defined by the status bit
863 // encoding, then the track is fitted with the tilted Rieman model
864 // Otherwise the track is fitted with the Kalman fitter in two steps:
865 // Since the track parameters are give at the outer point, we first
866 // fit in direction inwards. Afterwards we fit again in direction outwards
867 // to extrapolate the track to layers which are not reached by the track
868 // For the Kalman model, the radial track points have to be shifted by
869 // a distance epsilon in the direction that we want to fit
871 const Float_t epsilon = 0.01; // dead area tolerance
872 const Float_t epsilonR = 1; // shift in radial direction of the anode wire position (Kalman filter only)
873 const Float_t deltaY = 0.7; // Tolerance in the track position in y-direction
874 const Float_t deltaZ = 7.0; // Tolerance in the track position in z-direction (Padlength)
875 Double_t xAnode[AliTRDgeometry::kNlayer] = {300.2, 312.8, 325.4, 338.0, 350.6, 363.2}; // Take the default X0
877 if(track) fkTrack = track;
879 AliDebug(4, "No Track defined.");
883 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsFindable)))){
884 AliWarning("No Histogram defined.");
887 Int_t nFound = 0, nFindable = 0;
889 Double_t ymin = 0., ymax = 0., zmin = 0., zmax = 0.;
890 Double_t y = 0., z = 0.;
891 AliTRDseedV1 *tracklet = NULL;
893 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
894 if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){
895 tracklet->SetReconstructor(AliTRDinfoGen::Reconstructor());
899 // 2 Different cases:
900 // 1st stand alone: here we cannot propagate, but be can do a Tilted Rieman Fit
901 // 2nd barrel track: here we propagate the track to the layers
902 AliTrackPoint points[6];
904 memset(xyz, 0, sizeof(Float_t) * 3);
905 if(((fkESD->GetStatus() & AliESDtrack::kTRDout) > 0) && !((fkESD->GetStatus() & AliESDtrack::kTRDin) > 0)){
907 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
909 points[il].SetXYZ(xyz);
911 AliTRDtrackerV1::FitRiemanTilt(const_cast<AliTRDtrackV1 *>(fkTrack), NULL, kTRUE, 6, points);
917 // -> Kalman outwards
918 AliTRDtrackV1 copyTrack(*fkTrack); // Do Kalman on a (non-constant) copy of the track
919 AliTrackPoint pointsInward[6], pointsOutward[6];
920 for(Int_t il = AliTRDgeometry::kNlayer; il--;){
921 // In order to avoid complications in the Kalman filter if the track points have the same radial
922 // position like the tracklets, we have to shift the radial postion of the anode wire by epsilon
923 // in the direction we want to go
924 // The track points have to be in reverse order for the Kalman Filter inwards
925 xyz[0] = xAnode[AliTRDgeometry::kNlayer - il - 1] - epsilonR;
926 pointsInward[il].SetXYZ(xyz);
927 xyz[0] = xAnode[il] + epsilonR;
928 pointsOutward[il].SetXYZ(xyz);
930 /*for(Int_t ipt = 0; ipt < AliTRDgeometry::kNlayer; ipt++)
931 printf("%d. X = %f\n", ipt, points[ipt].GetX());*/
933 AliTRDtrackerV1::FitKalman(©Track, NULL, kFALSE, 6, pointsInward);
934 memcpy(points, pointsInward, sizeof(AliTrackPoint) * 6); // Preliminary store the inward results in the Array points
936 AliTRDtrackerV1::FitKalman(©Track, NULL, kTRUE, 6, pointsInward);
937 memcpy(points, pointsOutward, sizeof(AliTrackPoint) * AliTRDgeometry::kNlayer);
939 AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
940 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
941 y = points[il].GetY();
942 z = points[il].GetZ();
943 if((stack = geo->GetStack(z, il)) < 0) continue; // Not findable
944 pp = geo->GetPadPlane(il, stack);
945 ymin = pp->GetCol0() + epsilon;
946 ymax = pp->GetColEnd() - epsilon;
947 zmin = pp->GetRowEnd() + epsilon;
948 zmax = pp->GetRow0() - epsilon;
949 // ignore y-crossing (material)
950 if((z + deltaZ > zmin && z - deltaZ < zmax) && (y + deltaY > ymin && y - deltaY < ymax)) nFindable++;
951 if(DebugLevel() > 3){
952 Double_t posTracklet[2] = {tracklet ? tracklet->GetYfit(0) : 0, tracklet ? tracklet->GetZfit(0) : 0};
953 Int_t hasTracklet = tracklet ? 1 : 0;
954 (*DebugStream()) << "FindableTracklets"
956 << "ytracklet=" << posTracklet[0]
958 << "ztracklet=" << posTracklet[1]
960 << "tracklet=" << hasTracklet
965 h->Fill(nFindable > 0 ? TMath::Min(nFound/static_cast<Double_t>(nFindable), 1.) : 1);
966 AliDebug(2, Form("Findable[Found]: %d[%d|%f]", nFindable, nFound, nFound/static_cast<Float_t>(nFindable > 0 ? nFindable : 1)));
971 //_______________________________________________________
972 TH1 *AliTRDcheckDET::PlotChi2(const AliTRDtrackV1 *track){
974 // Plot the chi2 of the track
976 if(track) fkTrack = track;
978 AliDebug(4, "No Track defined.");
982 if(!(h = dynamic_cast<TH2S*>(fContainer->At(kChi2)))) {
983 AliWarning("No Histogram defined.");
986 Int_t n = fkTrack->GetNumberOfTracklets();
989 h->Fill(n, fkTrack->GetChi2()/n);
994 //_______________________________________________________
995 TH1 *AliTRDcheckDET::PlotPHt(const AliTRDtrackV1 *track){
997 // Plot the average pulse height
999 if(track) fkTrack = track;
1001 AliDebug(4, "No Track defined.");
1004 TProfile *h = NULL; TH2F *phs2D = NULL;
1005 if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(0)))){
1006 AliWarning("No Histogram defined.");
1009 if(!(phs2D = dynamic_cast<TH2F *>(((TObjArray*)(fContainer->At(kPH)))->At(2)))){
1010 AliWarning("2D Pulse Height histogram not defined. Histogramm cannot be filled");
1012 AliTRDseedV1 *tracklet = NULL;
1013 AliTRDcluster *c = NULL;
1014 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1015 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue;
1016 Int_t crossing = Int_t(tracklet->IsRowCross());
1017 Int_t detector = tracklet->GetDetector();
1018 tracklet->ResetClusterIter();
1019 while((c = tracklet->NextCluster())){
1020 if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue;
1021 Int_t localtime = c->GetLocalTimeBin();
1022 Double_t absoluteCharge = TMath::Abs(c->GetQ());
1023 h->Fill(localtime, absoluteCharge);
1024 phs2D->Fill(localtime, absoluteCharge);
1025 if(DebugLevel() > 3){
1026 Int_t inChamber = c->IsInChamber() ? 1 : 0;
1027 Double_t distance[2];
1028 GetDistanceToTracklet(distance, tracklet, c);
1029 Float_t theta = TMath::ATan(tracklet->GetZref(1));
1030 Float_t phi = TMath::ATan(tracklet->GetYref(1));
1031 AliExternalTrackParam *trdPar = fkTrack->GetTrackIn();
1032 Float_t momentumMC = 0, momentumRec = trdPar ? trdPar->P() : fkTrack->P(); // prefer Track Low
1034 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
1035 UShort_t tpcNCLS = fkESD ? fkESD->GetTPCncls() : 0;
1037 if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P();
1038 pdg = fkMC->GetPDG();
1040 (*DebugStream()) << "PHt"
1041 << "Detector=" << detector
1042 << "crossing=" << crossing
1043 << "inChamber=" << inChamber
1044 << "Timebin=" << localtime
1045 << "Charge=" << absoluteCharge
1046 << "momentumMC=" << momentumMC
1047 << "momentumRec=" << momentumRec
1049 << "theta=" << theta
1051 << "kinkIndex=" << kinkIndex
1052 << "TPCncls=" << tpcNCLS
1053 << "dy=" << distance[0]
1054 << "dz=" << distance[1]
1063 //_______________________________________________________
1064 TH1 *AliTRDcheckDET::PlotPHx(const AliTRDtrackV1 *track){
1066 // Plots the average pulse height vs the distance from the anode wire
1067 // (plus const anode wire offset)
1069 if(track) fkTrack = track;
1071 AliDebug(4, "No Track defined.");
1075 if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(1)))){
1076 AliWarning("No Histogram defined.");
1079 AliTRDseedV1 *tracklet(NULL);
1080 AliTRDcluster *c(NULL);
1081 Double_t xd(0.), dqdl(0.);
1082 TVectorD vq(AliTRDseedV1::kNtb), vxd(AliTRDseedV1::kNtb), vdqdl(AliTRDseedV1::kNtb);
1083 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1084 if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue;
1085 Int_t det(tracklet->GetDetector());
1086 Bool_t rc(tracklet->IsRowCross());
1087 for(Int_t ic(0); ic<AliTRDseedV1::kNtb; ic++){
1088 Bool_t kFIRST(kFALSE);
1089 if(!(c = tracklet->GetClusters(ic))){
1090 if(!(c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) continue;
1091 } else kFIRST=kTRUE;
1092 if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue;
1093 xd = tracklet->GetX0() - c->GetX(); vxd[ic] = xd;
1094 dqdl=tracklet->GetdQdl(ic); vdqdl[ic] = dqdl;
1096 if(kFIRST && (c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) vq[ic]+=c->GetQ();
1099 if(DebugLevel() > 3){
1100 (*DebugStream()) << "PHx"
1105 << "dqdl=" << &vdqdl
1112 //_______________________________________________________
1113 TH1 *AliTRDcheckDET::PlotChargeCluster(const AliTRDtrackV1 *track){
1115 // Plot the cluster charge
1117 if(track) fkTrack = track;
1119 AliDebug(4, "No Track defined.");
1123 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeCluster)))){
1124 AliWarning("No Histogram defined.");
1127 AliTRDseedV1 *tracklet = NULL;
1128 AliTRDcluster *c = NULL;
1129 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1130 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue;
1131 for(Int_t ic(0); ic < AliTRDseedV1::kNtb; ic++){
1132 Bool_t kFIRST(kFALSE);
1133 if(!(c = tracklet->GetClusters(ic))) {
1134 if(!(c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) continue;
1135 } else kFIRST = kTRUE;
1136 Float_t q(c->GetQ());
1137 if(kFIRST && (c = tracklet->GetClusters(AliTRDseedV1::kNtb+ic))) q+=c->GetQ();
1144 //_______________________________________________________
1145 TH1 *AliTRDcheckDET::PlotChargeTracklet(const AliTRDtrackV1 *track){
1147 // Plot the charge deposit per chamber
1149 if(track) fkTrack = track;
1151 AliDebug(4, "No Track defined.");
1155 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeTracklet)))){
1156 AliWarning("No Histogram defined.");
1159 AliTRDseedV1 *tracklet = NULL;
1160 AliTRDcluster *c = NULL;
1162 Int_t nTracklets =fkTrack->GetNumberOfTracklets();
1163 for(Int_t itl(0); itl < AliTRDgeometry::kNlayer; itl++){
1164 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
1166 for(Int_t ic = AliTRDseedV1::kNclusters; ic--;){
1167 if(!(c = tracklet->GetClusters(ic))) continue;
1168 qTot += TMath::Abs(c->GetQ());
1171 if(DebugLevel() > 3){
1172 Int_t crossing = (Int_t)tracklet->IsRowCross();
1173 Int_t detector = tracklet->GetDetector();
1174 Float_t theta = TMath::ATan(tracklet->GetZfit(1));
1175 Float_t phi = TMath::ATan(tracklet->GetYfit(1));
1176 Float_t momentum = 0.;
1178 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
1179 UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0;
1181 if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P();
1182 pdg = fkMC->GetPDG();
1184 (*DebugStream()) << "ChargeTracklet"
1185 << "Detector=" << detector
1186 << "crossing=" << crossing
1187 << "momentum=" << momentum
1188 << "nTracklets="<< nTracklets
1190 << "theta=" << theta
1192 << "kinkIndex=" << kinkIndex
1193 << "TPCncls=" << nclsTPC
1201 //_______________________________________________________
1202 TH1 *AliTRDcheckDET::PlotNTracksSector(const AliTRDtrackV1 *track){
1204 // Plot the number of tracks per Sector
1206 if(track) fkTrack = track;
1208 AliDebug(4, "No Track defined.");
1212 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtracksSector)))){
1213 AliWarning("No Histogram defined.");
1217 // TODO we should compare with
1218 // sector = Int_t(track->GetAlpha() / AliTRDgeometry::GetAlpha());
1220 AliTRDseedV1 *tracklet = NULL;
1222 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1223 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
1224 sector = static_cast<Int_t>(tracklet->GetDetector()/AliTRDgeometry::kNdets);
1232 //________________________________________________________
1233 void AliTRDcheckDET::GetDistanceToTracklet(Double_t *dist, AliTRDseedV1 * const tracklet, AliTRDcluster * const c)
1235 Float_t x = c->GetX();
1236 dist[0] = c->GetY() - tracklet->GetYat(x);
1237 dist[1] = c->GetZ() - tracklet->GetZat(x);
1240 //________________________________________________________
1241 void AliTRDcheckDET::GetEtaPhiAt(const AliExternalTrackParam *track, Double_t x, Double_t &eta, Double_t &phi){
1243 // Get phi and eta at a given radial position
1245 AliExternalTrackParam workpar(*track);
1247 Double_t posLocal[3];
1248 Bool_t sucPos = workpar.GetXYZAt(x, fEventInfo->GetRunInfo()->GetMagneticField(), posLocal);
1249 Double_t sagPhi = sucPos ? TMath::ATan2(posLocal[1], posLocal[0]) : 0.;
1251 eta = workpar.Eta();
1255 //_______________________________________________________
1256 TH1* AliTRDcheckDET::MakePlotChi2()
1258 // Plot chi2/track normalized to number of degree of freedom
1259 // (tracklets) and compare with the theoretical distribution.
1261 // Alex Bercuci <A.Bercuci@gsi.de>
1265 /* TH2S *h2 = (TH2S*)fContainer->At(kChi2);
1266 TF1 f("fChi2", "[0]*pow(x, [1]-1)*exp(-0.5*x)", 0., 50.);
1267 f.SetParLimits(1,1, 1e100);
1268 TLegend *leg = new TLegend(.7,.7,.95,.95);
1269 leg->SetBorderSize(1); leg->SetHeader("Tracklets per Track");
1271 Bool_t kFIRST = kTRUE;
1272 for(Int_t il=1; il<=h2->GetNbinsX(); il++){
1273 h1 = h2->ProjectionY(Form("pyChi2%d", il), il, il);
1274 if(h1->Integral()<50) continue;
1275 h1->Scale(1./h1->Integral());
1276 h1->SetMarkerStyle(7);h1->SetMarkerColor(il);
1277 h1->SetLineColor(il);h1->SetLineStyle(2);
1278 f.SetParameter(1, .5*il);f.SetLineColor(il);
1279 h1->Fit(&f, "QW+", kFIRST ? "pc": "pcsame");
1280 leg->AddEntry(h1, Form("%d", il), "l");
1282 h1->GetXaxis()->SetRangeUser(0., 25.);
1292 //________________________________________________________
1293 TH1* AliTRDcheckDET::MakePlotNTracklets(){
1295 // Make nice bar plot of the number of tracklets in each method
1297 TH2F *tmp = (TH2F *)fContainer->FindObject("hNtlsBAR");
1298 TH1D *hBAR = tmp->ProjectionY();
1299 TH1F *hSTA = (TH1F *)fContainer->FindObject("hNtlsSTA");
1300 TH1F *hCON = (TH1F *)fContainer->FindObject("hNtls");
1301 TLegend *leg = new TLegend(0.13, 0.75, 0.39, 0.89);
1302 leg->SetBorderSize(1);
1303 leg->SetFillColor(0);
1305 Float_t scale = hCON->Integral();
1306 if(scale) hCON->Scale(100./scale);
1307 hCON->SetFillColor(kRed);hCON->SetLineColor(kRed);
1308 hCON->SetBarWidth(0.2);
1309 hCON->SetBarOffset(0.6);
1310 hCON->SetStats(kFALSE);
1311 hCON->GetYaxis()->SetRangeUser(0.,40.);
1312 hCON->GetYaxis()->SetTitleOffset(1.2);
1313 hCON->Draw("bar1"); leg->AddEntry(hCON, "Total", "f");
1314 hCON->SetMaximum(55.);
1316 if(scale) hBAR->Scale(100./scale);
1317 hBAR->SetFillColor(kGreen);hBAR->SetLineColor(kGreen);
1318 hBAR->SetBarWidth(0.2);
1319 hBAR->SetBarOffset(0.2);
1321 hBAR->SetStats(kFALSE);
1322 hBAR->GetYaxis()->SetRangeUser(0.,40.);
1323 hBAR->GetYaxis()->SetTitleOffset(1.2);
1324 hBAR->Draw("bar1same"); leg->AddEntry(hBAR, "Barrel", "f");
1326 if(scale) hSTA->Scale(100./scale);
1327 hSTA->SetFillColor(kBlue);hSTA->SetLineColor(kBlue);
1328 hSTA->SetBarWidth(0.2);
1329 hSTA->SetBarOffset(0.4);
1331 hSTA->SetStats(kFALSE);
1332 hSTA->GetYaxis()->SetRangeUser(0.,40.);
1333 hSTA->GetYaxis()->SetTitleOffset(1.2);
1334 hSTA->Draw("bar1same"); leg->AddEntry(hSTA, "Stand Alone", "f");
1340 //________________________________________________________
1341 void AliTRDcheckDET::MakePlotnTrackletsVsP(){
1343 // Plot abundance of tracks with number of tracklets as function of momentum
1349 Color_t color[AliTRDgeometry::kNlayer] = {kBlue, kOrange, kBlack, kGreen, kCyan, kRed};
1350 TH1 *h(NULL); TGraphErrors *g[AliTRDgeometry::kNlayer];
1351 for(Int_t itl(0); itl<AliTRDgeometry::kNlayer; itl++){
1352 g[itl] = new TGraphErrors();
1353 g[itl]->SetLineColor(color[itl]);
1354 g[itl]->SetMarkerColor(color[itl]);
1355 g[itl]->SetMarkerStyle(20 + itl);
1358 TH2 *hBar = (TH2F *)fContainer->FindObject("hNtlsBAR");
1359 TAxis *ax(hBar->GetXaxis());
1360 Int_t np(ax->GetNbins());
1361 for(Int_t ipBin(1); ipBin<np; ipBin++){
1362 h = hBar->ProjectionY("npBin", ipBin, ipBin);
1363 if(!Int_t(h->Integral())) continue;
1364 h->Scale(100./h->Integral());
1365 Float_t p(ax->GetBinCenter(ipBin));
1366 Float_t dp(ax->GetBinWidth(ipBin));
1367 Int_t ip(g[0]->GetN());
1368 for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){
1369 g[itl]->SetPoint(ip, p, h->GetBinContent(itl+1));
1370 g[itl]->SetPointError(ip, dp/3.46, h->GetBinError(itl+1));
1374 TLegend *leg = new TLegend(0.76, 0.6, 1., 0.9);
1375 leg->SetBorderSize(0);
1376 leg->SetHeader("Tracklet/Track");
1377 leg->SetFillStyle(0);
1378 h = hBar->ProjectionX("npxBin"); h->Reset();
1380 h->GetYaxis()->SetRangeUser(1., 99.);
1381 h->GetYaxis()->SetMoreLogLabels();
1382 h->GetYaxis()->CenterTitle();
1383 h->GetYaxis()->SetTitleOffset(1.2);
1384 h->SetYTitle("Prob. [%]");
1385 h->GetXaxis()->SetRangeUser(0.4, 12.);
1386 h->GetXaxis()->SetMoreLogLabels();
1387 h->GetXaxis()->CenterTitle();
1389 for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){
1391 leg->AddEntry(g[itl], Form("n = %d", itl+1),"pl");
1395 gPad->SetLogx();gPad->SetLogy();
1398 //________________________________________________________
1399 Bool_t AliTRDcheckDET::MakePlotPulseHeight(){
1401 // Create Plot of the Pluse Height Spectrum
1403 TCanvas *output = gPad->GetCanvas();
1407 TObjArray *arr = (TObjArray*)fContainer->FindObject("<PH>");
1408 h = (TH1F*)arr->At(0);
1409 if((Int_t)h->GetEntries()){
1410 h->SetMarkerStyle(24);
1411 h->SetMarkerColor(kBlack);
1412 h->SetLineColor(kBlack);
1413 h->GetYaxis()->SetTitleOffset(1.5);
1415 // Trending for the pulse height: plateau value, slope and timebin of the maximum
1416 TLinearFitter fit(1,"pol1");
1418 for(Int_t itime = 10; itime <= 20; itime++){
1419 time = Double_t(itime);
1420 Double_t err(h->GetBinError(itime + 1));
1421 if(err>1.e-10) fit.AddPoint(&time, h->GetBinContent(itime + 1), err);
1424 Double_t plateau = fit.GetParameter(0) + 12 * fit.GetParameter(1);
1425 Double_t slope = fit.GetParameter(1);
1426 PutTrendValue("PHplateau", plateau);
1427 PutTrendValue("PHslope", slope);
1428 PutTrendValue("PHamplificationPeak", static_cast<Double_t>(h->GetMaximumBin()-1));
1429 AliDebug(1, Form("plateau %f, slope %f, MaxTime %f", plateau, slope, static_cast<Double_t>(h->GetMaximumBin()-1)));
1432 // copy the second histogram in a new one with the same x-dimension as the phs with respect to time
1433 h1 = (TH1F *)arr->At(1);
1434 h2 = new TH1F("hphs1","Average PH", 31, -0.5, 30.5);
1435 for(Int_t ibin = h1->GetXaxis()->GetFirst(); ibin < h1->GetNbinsX(); ibin++)
1436 h2->SetBinContent(ibin, h1->GetBinContent(ibin));
1437 h2->SetMarkerStyle(22);
1438 h2->SetMarkerColor(kBlue);
1439 h2->SetLineColor(kBlue);
1443 // create axis according to the histogram dimensions of the original second histogram
1444 TGaxis *axis = new TGaxis(gPad->GetUxmin(),
1448 -0.08, 4.88, 510,"-L");
1449 axis->SetLineColor(kBlue);
1450 axis->SetLabelColor(kBlue);
1451 axis->SetTextColor(kBlue);
1452 axis->SetTitle("x_{0}-x_{c} [cm]");
1456 TH2 *ph2d = (TH2F *)arr->At(2);
1457 ph2d->GetYaxis()->SetTitleOffset(1.8);
1458 ph2d->SetStats(kFALSE);
1463 //________________________________________________________
1464 void AliTRDcheckDET::MakePlotMeanClustersLayer(){
1466 // Create Summary plot for the mean number of clusters per layer
1468 TCanvas *output = gPad->GetCanvas();
1469 output->Divide(3,2);
1470 TObjArray *histos = (TObjArray *)fContainer->At(kNclustersLayer);
1472 AliWarning("Histos for each layer not found");
1475 TProfile2D *hlayer = NULL;
1476 for(Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++){
1477 if(!(hlayer = dynamic_cast<TProfile2D *>(histos->At(ily)))) continue;
1478 output->cd(ily + 1);
1480 hlayer->Draw("colz");
1484 //________________________________________________________
1485 Bool_t AliTRDcheckDET::MakeBarPlot(TH1 *histo, Int_t color){
1487 // Draw nice bar plots
1489 if(!histo->GetEntries()) return kFALSE;
1490 histo->Scale(100./histo->Integral());
1491 histo->SetFillColor(color);
1492 histo->SetBarOffset(.2);
1493 histo->SetBarWidth(.6);
1494 histo->Draw("bar1");