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 <TObjArray.h>
42 #include <TObjString.h>
46 #include <TProfile2D.h>
51 #include "AliTRDcluster.h"
52 #include "AliESDHeader.h"
53 #include "AliESDRun.h"
54 #include "AliESDtrack.h"
55 #include "AliExternalTrackParam.h"
56 #include "AliTRDgeometry.h"
57 #include "AliTRDpadPlane.h"
58 #include "AliTRDSimParam.h"
59 #include "AliTRDseedV1.h"
60 #include "AliTRDtrackV1.h"
61 #include "AliTRDtrackerV1.h"
62 #include "AliTRDReconstructor.h"
63 #include "AliTrackReference.h"
64 #include "AliTrackPointArray.h"
65 #include "AliTracker.h"
66 #include "TTreeStream.h"
68 #include "info/AliTRDtrackInfo.h"
69 #include "info/AliTRDeventInfo.h"
70 #include "AliTRDcheckDET.h"
75 ClassImp(AliTRDcheckDET)
77 //_______________________________________________________
78 AliTRDcheckDET::AliTRDcheckDET():
87 // Default constructor
89 SetNameTitle("checkDET", "Basic TRD data checker");
92 //_______________________________________________________
93 AliTRDcheckDET::AliTRDcheckDET(char* name):
94 AliTRDrecoTask(name, "Basic TRD data checker")
102 // Default constructor
104 DefineInput(2, AliTRDeventInfo::Class());
106 fReconstructor = new AliTRDReconstructor;
107 fReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
108 fGeo = new AliTRDgeometry;
113 //_______________________________________________________
114 AliTRDcheckDET::~AliTRDcheckDET(){
118 if(fTriggerNames) delete fTriggerNames;
119 delete fReconstructor;
123 //_______________________________________________________
124 void AliTRDcheckDET::ConnectInputData(Option_t *opt){
126 // Connect the Input data with the task
128 AliTRDrecoTask::ConnectInputData(opt);
129 fEventInfo = dynamic_cast<AliTRDeventInfo *>(GetInputData(2));
132 //_______________________________________________________
133 void AliTRDcheckDET::UserCreateOutputObjects(){
135 // Create Output Objects
137 OpenFile(1,"RECREATE");
138 fContainer = Histos();
139 if(!fTriggerNames) fTriggerNames = new TMap();
142 //_______________________________________________________
143 void AliTRDcheckDET::UserExec(Option_t *opt){
145 // Execution function
146 // Filling TRD quality histos
148 if(!HasMCdata() && fEventInfo->GetEventHeader()->GetEventType() != 7) return; // For real data we select only physical events
149 AliTRDrecoTask::UserExec(opt);
150 Int_t nTracks = 0; // Count the number of tracks per event
151 Int_t triggermask = fEventInfo->GetEventHeader()->GetTriggerMask();
152 TString triggername = fEventInfo->GetRunInfo()->GetFiredTriggerClasses(triggermask);
153 AliDebug(6, Form("Trigger cluster: %d, Trigger class: %s\n", triggermask, triggername.Data()));
154 dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger))->Fill(triggermask);
155 for(Int_t iti = 0; iti < fTracks->GetEntriesFast(); iti++){
156 if(!fTracks->UncheckedAt(iti)) continue;
157 AliTRDtrackInfo *fTrackInfo = dynamic_cast<AliTRDtrackInfo *>(fTracks->UncheckedAt(iti));
158 if(!fTrackInfo->GetTrack()) continue;
163 dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks))->Fill(triggermask);
164 dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNtracksEvent))->Fill(nTracks);
166 if(triggermask <= 20 && !fTriggerNames->FindObject(Form("%d", triggermask))){
167 fTriggerNames->Add(new TObjString(Form("%d", triggermask)), new TObjString(triggername));
168 // also set the label for both histograms
169 TH1 *histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTriggerTracks));
170 histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername);
171 histo = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kNeventsTrigger));
172 histo->GetXaxis()->SetBinLabel(histo->FindBin(triggermask), triggername);
174 PostData(1, fContainer);
178 //_______________________________________________________
179 Bool_t AliTRDcheckDET::PostProcess(){
181 // Do Postprocessing (for the moment set the number of Reference histograms)
186 // Calculate of the trigger clusters purity
187 h = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTrigger"));
188 TH1F *h1 = dynamic_cast<TH1F *>(fContainer->FindObject("hEventsTriggerTracks"));
190 Float_t purities[20], val = 0;
191 TString triggernames[20];
192 Int_t nTriggerClasses = 0;
193 for(Int_t ibin = 1; ibin <= h->GetNbinsX(); ibin++){
194 if((val = h1->GetBinContent(ibin))){
195 purities[nTriggerClasses] = val;
196 triggernames[nTriggerClasses] = h1->GetXaxis()->GetBinLabel(ibin);
200 h = dynamic_cast<TH1F *>(fContainer->UncheckedAt(kTriggerPurity));
201 TAxis *ax = h->GetXaxis();
202 for(Int_t itrg = 0; itrg < nTriggerClasses; itrg++){
203 h->Fill(itrg, purities[itrg]);
204 ax->SetBinLabel(itrg+1, triggernames[itrg].Data());
206 ax->SetRangeUser(-0.5, nTriggerClasses+.5);
207 h->GetYaxis()->SetRangeUser(0,1);
210 h=dynamic_cast<TH1F*>(fContainer->At(kTrackStatus));
211 Float_t ok = h->GetBinContent(1);
212 Int_t nerr = h->GetNbinsX();
213 for(Int_t ierr=nerr; ierr--;){
214 h->SetBinContent(ierr+1, 1.e2*h->GetBinContent(ierr+1)/ok);
216 h->SetBinContent(1, 0.);
220 TObjArray *arr = dynamic_cast<TObjArray*>(fContainer->UncheckedAt(kTrackletStatus));
221 for(Int_t ily = AliTRDgeometry::kNlayer; ily--;){
222 h=dynamic_cast<TH1F*>(arr->At(ily));
223 Float_t okB = h->GetBinContent(1);
224 Int_t nerrB = h->GetNbinsX();
225 for(Int_t ierr=nerrB; ierr--;){
226 h->SetBinContent(ierr+1, 1.e2*h->GetBinContent(ierr+1)/okB);
228 h->SetBinContent(1, 0.);
236 //_______________________________________________________
237 Bool_t AliTRDcheckDET::GetRefFigure(Int_t ifig){
239 // Setting Reference Figures
243 kFigNclustersTracklet,
247 kFigNtrackletsFindable,
257 kFigNeventsTriggerTracks,
262 TH1 *h = NULL; TObjArray *arr=NULL;
266 case kFigNclustersTrack:
267 (h=(TH1F*)fContainer->FindObject("hNcls"))->Draw("pl");
268 PutTrendValue("NClustersTrack", h->GetMean());
269 PutTrendValue("NClustersTrackRMS", h->GetRMS());
271 case kFigNclustersTracklet:
272 (h =(TH1F*)fContainer->FindObject("hNclTls"))->Draw("pc");
273 PutTrendValue("NClustersTracklet", h->GetMean());
274 PutTrendValue("NClustersTrackletRMS", h->GetRMS());
276 case kFigNtrackletsTrack:
277 h=MakePlotNTracklets();
278 PutTrendValue("NTrackletsTrack", h->GetMean());
279 PutTrendValue("NTrackletsTrackRMS", h->GetRMS());
281 case kFigNTrackletsP:
282 MakePlotnTrackletsVsP();
284 case kFigNtrackletsCross:
285 h = (TH1F*)fContainer->FindObject("hNtlsCross");
286 if(!MakeBarPlot(h, kRed)) break;
287 PutTrendValue("NTrackletsCross", h->GetMean());
288 PutTrendValue("NTrackletsCrossRMS", h->GetRMS());
290 case kFigNtrackletsFindable:
291 h = (TH1F*)fContainer->FindObject("hNtlsFindable");
292 if(!MakeBarPlot(h, kGreen)) break;
293 PutTrendValue("NTrackletsFindable", h->GetMean());
294 PutTrendValue("NTrackletsFindableRMS", h->GetRMS());
296 case kFigNtracksEvent:
297 (h = (TH1F*)fContainer->FindObject("hNtrks"))->Draw("pl");
298 PutTrendValue("NTracksEvent", h->GetMean());
299 PutTrendValue("NTracksEventRMS", h->GetRMS());
301 case kFigNtracksSector:
302 h = (TH1F*)fContainer->FindObject("hNtrksSector");
303 if(!MakeBarPlot(h, kGreen)) break;
304 PutTrendValue("NTracksSector", h->Integral()/h->GetNbinsX());
306 case kFigTrackStatus:
307 if(!(h=(TH1F *)fContainer->FindObject("hTrackStatus"))) break;
308 h->GetXaxis()->SetRangeUser(0.5, -1);
309 h->GetYaxis()->CenterTitle();
311 PutTrendValue("TrackStatus", h->Integral());
314 case kFigTrackletStatus:
315 if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))) break;
316 leg = new TLegend(.68, .7, .97, .97);
317 leg->SetBorderSize(0);leg->SetFillStyle(0);
318 leg->SetHeader("TRD layer");
319 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
320 if(!(h=dynamic_cast<TH1F*>(arr->At(ily)))) continue;
323 h->GetXaxis()->SetRangeUser(0.5, -1);
324 h->GetYaxis()->CenterTitle();
326 } else h->Draw("samepl");
327 leg->AddEntry(h, Form("ly = %d", ily), "l");
328 PutTrendValue(Form("TrackletStatus%d", ily), h->Integral());
337 gPad->SetMargin(0.125, 0.015, 0.1, 0.1);
338 MakePlotPulseHeight();
341 case kFigChargeCluster:
342 (h = (TH1F*)fContainer->FindObject("hQcl"))->Draw("c");
344 PutTrendValue("ChargeCluster", h->GetMaximumBin());
345 PutTrendValue("ChargeClusterRMS", h->GetRMS());
347 case kFigChargeTracklet:
348 (h=(TH1F*)fContainer->FindObject("hQtrklt"))->Draw("c");
349 PutTrendValue("ChargeTracklet", h->GetMaximumBin());
350 PutTrendValue("ChargeTrackletRMS", h->GetRMS());
352 case kFigNeventsTrigger:
353 ((TH1F*)fContainer->FindObject("hEventsTrigger"))->Draw("");
355 case kFigNeventsTriggerTracks:
356 ((TH1F*)fContainer->FindObject("hEventsTriggerTracks"))->Draw("");
358 case kFigTriggerPurity:
359 if(!MakeBarPlot((TH1F*)fContainer->FindObject("hTriggerPurity"), kGreen)) break;
364 AliInfo(Form("Reference plot [%d] missing result", ifig));
368 //_______________________________________________________
369 TObjArray *AliTRDcheckDET::Histos(){
371 // Create QA histograms
374 if(fContainer) return fContainer;
376 fContainer = new TObjArray(20);
377 //fContainer->SetOwner(kTRUE);
379 // Register Histograms
382 if(!(h = (TH1F *)gROOT->FindObject("hNcls"))){
383 h = new TH1F("hNcls", "N_{clusters} / track", 181, -0.5, 180.5);
384 h->GetXaxis()->SetTitle("N_{clusters}");
385 h->GetYaxis()->SetTitle("Entries");
387 fContainer->AddAt(h, kNclustersTrack);
389 if(!(h = (TH1F *)gROOT->FindObject("hNclTls"))){
390 h = new TH1F("hNclTls","N_{clusters} / tracklet", 51, -0.5, 50.5);
391 h->GetXaxis()->SetTitle("N_{clusters}");
392 h->GetYaxis()->SetTitle("Entries");
394 fContainer->AddAt(h, kNclustersTracklet);
396 if(!(h = (TH1F *)gROOT->FindObject("hNtls"))){
397 h = new TH1F("hNtls", "N_{tracklets} / track", AliTRDgeometry::kNlayer, 0.5, 6.5);
398 h->GetXaxis()->SetTitle("N^{tracklet}");
399 h->GetYaxis()->SetTitle("freq. [%]");
401 fContainer->AddAt(h, kNtrackletsTrack);
403 if(!(h = (TH1F *)gROOT->FindObject("htlsSTA"))){
404 h = new TH1F("hNtlsSTA", "N_{tracklets} / track (Stand Alone)", AliTRDgeometry::kNlayer, 0.5, 6.5);
405 h->GetXaxis()->SetTitle("N^{tracklet}");
406 h->GetYaxis()->SetTitle("freq. [%]");
408 fContainer->AddAt(h, kNtrackletsSTA);
410 // Binning for momentum dependent tracklet Plots
413 Float_t binsP[kNp+1], binsTrklt[AliTRDgeometry::kNlayer+1];
414 for(Int_t i=0;i<kNp+1; i++,P+=(TMath::Exp(i*i*.001)-1.)) binsP[i]=P;
415 for(Int_t il = 0; il <= AliTRDgeometry::kNlayer; il++) binsTrklt[il] = 0.5 + il;
416 if(!(h = (TH1F *)gROOT->FindObject("htlsBAR"))){
417 // Make tracklets for barrel tracks momentum dependent (if we do not exceed min and max values)
418 h = new TH2F("hNtlsBAR",
419 "N_{tracklets} / track;p [GeV/c];N^{tracklet};freq. [%]",
420 kNp, binsP, AliTRDgeometry::kNlayer, binsTrklt);
422 fContainer->AddAt(h, kNtrackletsBAR);
425 if(!(h = (TH1F *)gROOT->FindObject("hNtlsCross"))){
426 h = new TH1F("hNtlsCross", "N_{tracklets}^{cross} / track", 7, -0.5, 6.5);
427 h->GetXaxis()->SetTitle("n_{row cross}");
428 h->GetYaxis()->SetTitle("freq. [%]");
430 fContainer->AddAt(h, kNtrackletsCross);
432 if(!(h = (TH1F *)gROOT->FindObject("hNtlsFindable"))){
433 h = new TH1F("hNtlsFindable", "Found/Findable Tracklets" , 101, -0.005, 1.005);
434 h->GetXaxis()->SetTitle("r [a.u]");
435 h->GetYaxis()->SetTitle("Entries");
437 fContainer->AddAt(h, kNtrackletsFindable);
439 if(!(h = (TH1F *)gROOT->FindObject("hNtrks"))){
440 h = new TH1F("hNtrks", "N_{tracks} / event", 100, 0, 100);
441 h->GetXaxis()->SetTitle("N_{tracks}");
442 h->GetYaxis()->SetTitle("Entries");
444 fContainer->AddAt(h, kNtracksEvent);
446 if(!(h = (TH1F *)gROOT->FindObject("hNtrksSector"))){
447 h = new TH1F("hNtrksSector", "N_{tracks} / sector", AliTRDgeometry::kNsector, -0.5, 17.5);
448 h->GetXaxis()->SetTitle("sector");
449 h->GetYaxis()->SetTitle("freq. [%]");
451 fContainer->AddAt(h, kNtracksSector);
453 if(!(h = (TH1F*)gROOT->FindObject("hTrackStatus"))){
454 const Int_t nerr = 7;
455 h = new TH1F("hTrackStatus", "Track Status", nerr, -0.5, nerr-0.5);
456 const Char_t *label[nerr] = {"OK", "PROL", "PROP", "AJST", "SNP", "TINI", "UPDT"};
458 for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]);
459 h->SetYTitle("Relative Error to Good [%]");
461 fContainer->AddAt(h, kTrackStatus);
463 TObjArray *arr = new TObjArray(AliTRDgeometry::kNlayer);
464 arr->SetOwner(kTRUE); arr->SetName("TrackletStatus");
465 fContainer->AddAt(arr, kTrackletStatus);
466 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
467 if(!(h = (TH1F *)gROOT->FindObject(Form("hTrackletStatus%d", ily)))){
468 const Int_t nerr = 8;
469 h = new TH1F(Form("hTrackletStatus%d", ily), "Tracklet status", nerr, -0.5, nerr-0.5);
470 h->SetLineColor(ily+1);
471 const Char_t *label[nerr] = {"OK", "Geom", "Bound", "NoCl", "NoAttach", "NoClTr", "NoFit", "Chi2"};
473 for(Int_t ierr=nerr; ierr--;) ax->SetBinLabel(ierr+1, label[ierr]);
474 h->SetYTitle("Relative Error to Good [%]");
480 arr = new TObjArray(2);
481 arr->SetOwner(kTRUE); arr->SetName("<PH>");
482 fContainer->AddAt(arr, kPH);
483 if(!(h = (TH1F *)gROOT->FindObject("hPHt"))){
484 h = new TProfile("hPHt", "<PH>", 31, -0.5, 30.5);
485 h->GetXaxis()->SetTitle("Time / 100ns");
486 h->GetYaxis()->SetTitle("<PH> [a.u]");
489 if(!(h = (TH1F *)gROOT->FindObject("hPHx")))
490 h = new TProfile("hPHx", "<PH>", 31, -0.08, 4.88);
495 if(!(h = (TH2S*)gROOT->FindObject("hChi2"))){
496 h = new TH2S("hChi2", "#chi^{2} per track", AliTRDgeometry::kNlayer, .5, AliTRDgeometry::kNlayer+.5, 100, 0, 50);
498 h->SetYTitle("#chi^{2}/ndf");
499 h->SetZTitle("entries");
501 fContainer->AddAt(h, kChi2);
503 if(!(h = (TH1F *)gROOT->FindObject("hQcl"))){
504 h = new TH1F("hQcl", "Q_{cluster}", 200, 0, 1200);
505 h->GetXaxis()->SetTitle("Q_{cluster} [a.u.]");
506 h->GetYaxis()->SetTitle("Entries");
508 fContainer->AddAt(h, kChargeCluster);
510 if(!(h = (TH1F *)gROOT->FindObject("hQtrklt"))){
511 h = new TH1F("hQtrklt", "Q_{tracklet}", 6000, 0, 6000);
512 h->GetXaxis()->SetTitle("Q_{tracklet} [a.u.]");
513 h->GetYaxis()->SetTitle("Entries");
515 fContainer->AddAt(h, kChargeTracklet);
518 if(!(h = (TH1F *)gROOT->FindObject("hEventsTrigger")))
519 h = new TH1F("hEventsTrigger", "Trigger Class", 100, 0, 100);
521 printf("Histos Adding \n");
523 fContainer->AddAt(h, kNeventsTrigger);
525 if(!(h = (TH1F *)gROOT->FindObject("hEventsTriggerTracks")))
526 h = new TH1F("hEventsTriggerTracks", "Trigger Class (Tracks)", 100, 0, 100);
528 fContainer->AddAt(h, kNeventsTriggerTracks);
530 if(!(h = (TH1F *)gROOT->FindObject("hTriggerPurity"))){
531 h = new TH1F("hTriggerPurity", "Trigger Purity", 10, -0.5, 9.5);
532 h->GetXaxis()->SetTitle("Trigger Cluster");
533 h->GetYaxis()->SetTitle("freq.");
535 fContainer->AddAt(h, kTriggerPurity);
544 //_______________________________________________________
545 TH1 *AliTRDcheckDET::PlotTrackStatus(const AliTRDtrackV1 *track)
548 // Plot the track propagation status. The following errors are defined (see AliTRDtrackV1::ETRDtrackError)
549 // PROL - track prolongation failure
550 // PROP - track propagation failure
551 // AJST - crossing sectors failure
552 // SNP - too large bending
553 // TINI - tracklet initialization failure
554 // UPDT - track position/covariance update failure
556 // Performance plot looks as below:
558 //<img src="TRD/trackStatus.gif">
561 if(track) fkTrack = track;
563 AliWarning("No Track defined.");
567 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kTrackStatus)))){
568 AliWarning("No Histogram defined.");
571 h->Fill(fkTrack->GetStatusTRD());
575 //_______________________________________________________
576 TH1 *AliTRDcheckDET::PlotTrackletStatus(const AliTRDtrackV1 *track)
579 // Plot the tracklet propagation status. The following errors are defined for tracklet (see AliTRDtrackV1::ETRDlayerError)
581 // Bound - tracklet too close to chamber walls
582 // NoCl - no clusters in the track roads
583 // NoAttach - fail to attach clusters
584 // NoClTr - fail to use clusters for fit
585 // NoFit - tracklet fit failled
586 // Chi2 - chi2 tracklet-track over threshold
588 // Performance plot looks as below:
590 //<img src="TRD/trackletStatus.gif">
593 if(track) fkTrack = track;
595 AliWarning("No Track defined.");
598 TObjArray *arr =NULL;
599 if(!(arr = dynamic_cast<TObjArray*>(fContainer->At(kTrackletStatus)))){
600 AliWarning("Histograms not defined.");
605 for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
606 if(!(h = dynamic_cast<TH1F*>(arr->At(ily)))){
607 AliWarning(Form("Missing histo for layer %d.", ily));
610 h->Fill(fkTrack->GetStatusTRD(ily));
615 //_______________________________________________________
616 TH1 *AliTRDcheckDET::PlotNClustersTracklet(const AliTRDtrackV1 *track){
618 // Plot the mean number of clusters per tracklet
620 if(track) fkTrack = track;
622 AliWarning("No Track defined.");
626 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTracklet)))){
627 AliWarning("No Histogram defined.");
630 AliTRDseedV1 *tracklet = NULL;
631 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
632 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
633 h->Fill(tracklet->GetN2());
638 //_______________________________________________________
639 TH1 *AliTRDcheckDET::PlotNClustersTrack(const AliTRDtrackV1 *track){
641 // Plot the number of clusters in one track
643 if(track) fkTrack = track;
645 AliWarning("No Track defined.");
649 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNclustersTrack)))){
650 AliWarning("No Histogram defined.");
655 AliTRDseedV1 *tracklet = NULL;
656 AliExternalTrackParam *par = fkTrack->GetTrackOut() ? fkTrack->GetTrackOut() : fkTrack->GetTrackIn();
657 Double_t momentumRec = par->P();
658 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
659 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
660 Int_t n(tracklet->GetN());
662 if(DebugLevel() > 2){
663 Int_t crossing = Int_t(tracklet->IsRowCross());
664 Int_t detector = tracklet->GetDetector();
665 Float_t theta = TMath::ATan(tracklet->GetZref(1));
666 Float_t phi = TMath::ATan(tracklet->GetYref(1));
667 Float_t momentumMC = 0.;
669 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
670 UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0;
672 if(fkMC->GetTrackRef()) momentumMC = fkMC->GetTrackRef()->P();
673 pdg = fkMC->GetPDG();
675 (*DebugStream()) << "NClustersTrack"
676 << "Detector=" << detector
677 << "crossing=" << crossing
678 << "momentumMC="<< momentumMC
679 << "momentumRec=" << momentumRec
683 << "kinkIndex=" << kinkIndex
684 << "TPCncls=" << nclsTPC
694 //_______________________________________________________
695 TH1 *AliTRDcheckDET::PlotNTrackletsTrack(const AliTRDtrackV1 *track){
697 // Plot the number of tracklets
699 if(track) fkTrack = track;
701 AliWarning("No Track defined.");
704 TH1 *h = NULL, *hSta = NULL; TH2 *hBarrel = NULL;
705 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsTrack)))){
706 AliWarning("No Histogram defined.");
709 Int_t nTracklets = fkTrack->GetNumberOfTracklets();
712 Int_t status = fkESD->GetStatus();
714 /* 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);*/
716 Int_t method = -1; // to distinguish between stand alone and full barrel tracks in the debugging
717 if((status & AliESDtrack::kTRDin) != 0){
719 // Full Barrel Track: Save momentum dependence
720 if(!(hBarrel = dynamic_cast<TH2F *>(fContainer->At(kNtrackletsBAR)))){
721 AliWarning("Method: Barrel. Histogram not processed!");
724 AliExternalTrackParam *par(fkTrack->GetTrackIn());
726 AliError("Input track params missing");
729 hBarrel->Fill(par->P(), nTracklets);
731 // Stand alone Track: momentum dependence not usefull
733 if(!(hSta = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsSTA)))) {
734 AliWarning("Method: StandAlone. Histogram not processed!");
737 hSta->Fill(nTracklets);
740 if(DebugLevel() > 2){
741 AliTRDseedV1 *tracklet = NULL;
743 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
744 if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue;
745 sector = fGeo->GetSector(tracklet->GetDetector());
748 (*DebugStream()) << "NTrackletsTrack"
749 << "Sector=" << sector
750 << "NTracklets=" << nTracklets
751 << "Method=" << method
755 if(DebugLevel() > 3){
757 // If we have one Tracklet, check in which layer this happens
759 AliTRDseedV1 *tracklet = NULL;
760 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
761 if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){layer = il; break;}
764 (*DebugStream()) << "NTrackletsLayer"
775 //_______________________________________________________
776 TH1 *AliTRDcheckDET::PlotNTrackletsRowCross(const AliTRDtrackV1 *track){
778 // Plot the number of tracklets
780 if(track) fkTrack = track;
782 AliWarning("No Track defined.");
786 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsCross)))){
787 AliWarning("No Histogram defined.");
792 AliTRDseedV1 *tracklet = NULL;
793 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
794 if(!(tracklet = fkTrack->GetTracklet(il)) || !tracklet->IsOK()) continue;
796 if(tracklet->IsRowCross()) ncross++;
802 //_______________________________________________________
803 TH1 *AliTRDcheckDET::PlotFindableTracklets(const AliTRDtrackV1 *track){
805 // Plots the ratio of number of tracklets vs.
806 // number of findable tracklets
808 // Findable tracklets are defined as track prolongation
809 // to layer i does not hit the dead area +- epsilon
811 // In order to check whether tracklet hist active area in Layer i,
812 // the track is refitted and the fitted position + an uncertainty
813 // range is compared to the chamber border (also with a different
816 // For the track fit two cases are distinguished:
817 // If the track is a stand alone track (defined by the status bit
818 // encoding, then the track is fitted with the tilted Rieman model
819 // Otherwise the track is fitted with the Kalman fitter in two steps:
820 // Since the track parameters are give at the outer point, we first
821 // fit in direction inwards. Afterwards we fit again in direction outwards
822 // to extrapolate the track to layers which are not reached by the track
823 // For the Kalman model, the radial track points have to be shifted by
824 // a distance epsilon in the direction that we want to fit
826 const Float_t epsilon = 0.01; // dead area tolerance
827 const Float_t epsilonR = 1; // shift in radial direction of the anode wire position (Kalman filter only)
828 const Float_t deltaY = 0.7; // Tolerance in the track position in y-direction
829 const Float_t deltaZ = 7.0; // Tolerance in the track position in z-direction (Padlength)
830 Double_t xAnode[AliTRDgeometry::kNlayer] = {300.2, 312.8, 325.4, 338.0, 350.6, 363.2}; // Take the default X0
832 if(track) fkTrack = track;
834 AliWarning("No Track defined.");
838 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtrackletsFindable)))){
839 AliWarning("No Histogram defined.");
842 Int_t nFound = 0, nFindable = 0;
844 Double_t ymin = 0., ymax = 0., zmin = 0., zmax = 0.;
845 Double_t y = 0., z = 0.;
846 AliTRDseedV1 *tracklet = NULL;
848 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
849 if((tracklet = fkTrack->GetTracklet(il)) && tracklet->IsOK()){
850 tracklet->SetReconstructor(fReconstructor);
854 // 2 Different cases:
855 // 1st stand alone: here we cannot propagate, but be can do a Tilted Rieman Fit
856 // 2nd barrel track: here we propagate the track to the layers
857 AliTrackPoint points[6];
859 memset(xyz, 0, sizeof(Float_t) * 3);
860 if(((fkESD->GetStatus() & AliESDtrack::kTRDout) > 0) && !((fkESD->GetStatus() & AliESDtrack::kTRDin) > 0)){
862 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
864 points[il].SetXYZ(xyz);
866 AliTRDtrackerV1::FitRiemanTilt(const_cast<AliTRDtrackV1 *>(fkTrack), NULL, kTRUE, 6, points);
872 // -> Kalman outwards
873 AliTRDtrackV1 copyTrack(*fkTrack); // Do Kalman on a (non-constant) copy of the track
874 AliTrackPoint pointsInward[6], pointsOutward[6];
875 for(Int_t il = AliTRDgeometry::kNlayer; il--;){
876 // In order to avoid complications in the Kalman filter if the track points have the same radial
877 // position like the tracklets, we have to shift the radial postion of the anode wire by epsilon
878 // in the direction we want to go
879 // The track points have to be in reverse order for the Kalman Filter inwards
880 xyz[0] = xAnode[AliTRDgeometry::kNlayer - il - 1] - epsilonR;
881 pointsInward[il].SetXYZ(xyz);
882 xyz[0] = xAnode[il] + epsilonR;
883 pointsOutward[il].SetXYZ(xyz);
885 /*for(Int_t ipt = 0; ipt < AliTRDgeometry::kNlayer; ipt++)
886 printf("%d. X = %f\n", ipt, points[ipt].GetX());*/
888 AliTRDtrackerV1::FitKalman(©Track, NULL, kFALSE, 6, pointsInward);
889 memcpy(points, pointsInward, sizeof(AliTrackPoint) * 6); // Preliminary store the inward results in the Array points
891 AliTRDtrackerV1::FitKalman(©Track, NULL, kTRUE, 6, pointsInward);
892 memcpy(points, pointsOutward, sizeof(AliTrackPoint) * AliTRDgeometry::kNlayer);
894 for(Int_t il = 0; il < AliTRDgeometry::kNlayer; il++){
895 y = points[il].GetY();
896 z = points[il].GetZ();
897 if((stack = fGeo->GetStack(z, il)) < 0) continue; // Not findable
898 pp = fGeo->GetPadPlane(il, stack);
899 ymin = pp->GetCol0() + epsilon;
900 ymax = pp->GetColEnd() - epsilon;
901 zmin = pp->GetRowEnd() + epsilon;
902 zmax = pp->GetRow0() - epsilon;
903 // ignore y-crossing (material)
904 if((z + deltaZ > zmin && z - deltaZ < zmax) && (y + deltaY > ymin && y - deltaY < ymax)) nFindable++;
905 if(DebugLevel() > 3){
906 Double_t posTracklet[2] = {tracklet ? tracklet->GetYfit(0) : 0, tracklet ? tracklet->GetZfit(0) : 0};
907 Int_t hasTracklet = tracklet ? 1 : 0;
908 (*DebugStream()) << "FindableTracklets"
910 << "ytracklet=" << posTracklet[0]
912 << "ztracklet=" << posTracklet[1]
914 << "tracklet=" << hasTracklet
919 h->Fill(nFindable > 0 ? TMath::Min(nFound/static_cast<Double_t>(nFindable), 1.) : 1);
920 AliDebug(2, Form("Findable[Found]: %d[%d|%f]", nFindable, nFound, nFound/static_cast<Float_t>(nFindable > 0 ? nFindable : 1)));
925 //_______________________________________________________
926 TH1 *AliTRDcheckDET::PlotChi2(const AliTRDtrackV1 *track){
928 // Plot the chi2 of the track
930 if(track) fkTrack = track;
932 AliWarning("No Track defined.");
936 if(!(h = dynamic_cast<TH2S*>(fContainer->At(kChi2)))) {
937 AliWarning("No Histogram defined.");
940 Int_t n = fkTrack->GetNumberOfTracklets();
943 h->Fill(n, fkTrack->GetChi2()/n);
948 //_______________________________________________________
949 TH1 *AliTRDcheckDET::PlotPHt(const AliTRDtrackV1 *track){
951 // Plot the average pulse height
953 if(track) fkTrack = track;
955 AliWarning("No Track defined.");
959 if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(0)))){
960 AliWarning("No Histogram defined.");
963 AliTRDseedV1 *tracklet = NULL;
964 AliTRDcluster *c = NULL;
965 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
966 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue;
967 Int_t crossing = Int_t(tracklet->IsRowCross());
968 Int_t detector = tracklet->GetDetector();
969 tracklet->ResetClusterIter();
970 while((c = tracklet->NextCluster())){
971 if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue;
972 Int_t localtime = c->GetLocalTimeBin();
973 Double_t absoluteCharge = TMath::Abs(c->GetQ());
974 h->Fill(localtime, absoluteCharge);
975 if(DebugLevel() > 3){
976 Double_t distance[2];
977 GetDistanceToTracklet(distance, tracklet, c);
978 Float_t theta = TMath::ATan(tracklet->GetZref(1));
979 Float_t phi = TMath::ATan(tracklet->GetYref(1));
980 Float_t momentum = 0.;
982 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
983 UShort_t TPCncls = fkESD ? fkESD->GetTPCncls() : 0;
985 if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P();
986 pdg = fkMC->GetPDG();
988 (*DebugStream()) << "PHt"
989 << "Detector=" << detector
990 << "crossing=" << crossing
991 << "Timebin=" << localtime
992 << "Charge=" << absoluteCharge
993 << "momentum=" << momentum
997 << "kinkIndex=" << kinkIndex
998 << "TPCncls=" << TPCncls
999 << "dy=" << distance[0]
1000 << "dz=" << distance[1]
1009 //_______________________________________________________
1010 TH1 *AliTRDcheckDET::PlotPHx(const AliTRDtrackV1 *track){
1012 // Plots the average pulse height vs the distance from the anode wire
1013 // (plus const anode wire offset)
1015 if(track) fkTrack = track;
1017 AliWarning("No Track defined.");
1021 if(!(h = dynamic_cast<TProfile *>(((TObjArray*)(fContainer->At(kPH)))->At(1)))){
1022 AliWarning("No Histogram defined.");
1025 AliTRDseedV1 *tracklet = NULL;
1026 AliTRDcluster *c = NULL;
1027 Double_t xd(0.), dqdl(0.);
1028 TVectorD vq(AliTRDseedV1::kNtb), vxd(AliTRDseedV1::kNtb), vdqdl(AliTRDseedV1::kNtb);
1029 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1030 if(!(tracklet = fkTrack->GetTracklet(itl)) || !(tracklet->IsOK())) continue;
1031 Int_t det(tracklet->GetDetector());
1032 Bool_t rc(tracklet->IsRowCross());
1034 for(Int_t ic(0); ic<AliTRDseedV1::kNclusters; ic++){
1035 if(!(c = tracklet->GetClusters(ic))) continue;
1036 if(!IsUsingClustersOutsideChamber() && !c->IsInChamber()) continue;
1037 jc = TMath::Max(ic, ic-AliTRDseedV1::kNtb);
1038 xd = tracklet->GetX0() - c->GetX(); vxd[jc] = xd;
1039 dqdl=tracklet->GetdQdl(ic); vdqdl[jc] = dqdl;
1042 if(DebugLevel() > 3){
1044 (*DebugStream()) << "PHx"
1049 << "dqdl=" << &vdqdl
1056 //_______________________________________________________
1057 TH1 *AliTRDcheckDET::PlotChargeCluster(const AliTRDtrackV1 *track){
1059 // Plot the cluster charge
1061 if(track) fkTrack = track;
1063 AliWarning("No Track defined.");
1067 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeCluster)))){
1068 AliWarning("No Histogram defined.");
1071 AliTRDseedV1 *tracklet = NULL;
1072 AliTRDcluster *c = NULL;
1073 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1074 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK())continue;
1075 for(Int_t itime = 0; itime < AliTRDtrackerV1::GetNTimeBins(); itime++){
1076 if(!(c = tracklet->GetClusters(itime))) continue;
1083 //_______________________________________________________
1084 TH1 *AliTRDcheckDET::PlotChargeTracklet(const AliTRDtrackV1 *track){
1086 // Plot the charge deposit per chamber
1088 if(track) fkTrack = track;
1090 AliWarning("No Track defined.");
1094 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kChargeTracklet)))){
1095 AliWarning("No Histogram defined.");
1098 AliTRDseedV1 *tracklet = NULL;
1099 AliTRDcluster *c = NULL;
1101 Int_t nTracklets =fkTrack->GetNumberOfTracklets();
1102 for(Int_t itl(0); itl < AliTRDgeometry::kNlayer; itl++){
1103 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
1105 for(Int_t ic = AliTRDseedV1::kNclusters; ic--;){
1106 if(!(c = tracklet->GetClusters(ic))) continue;
1107 qTot += TMath::Abs(c->GetQ());
1110 if(DebugLevel() > 3){
1111 Int_t crossing = (Int_t)tracklet->IsRowCross();
1112 Int_t detector = tracklet->GetDetector();
1113 Float_t theta = TMath::ATan(tracklet->GetZfit(1));
1114 Float_t phi = TMath::ATan(tracklet->GetYfit(1));
1115 Float_t momentum = 0.;
1117 Int_t kinkIndex = fkESD ? fkESD->GetKinkIndex() : 0;
1118 UShort_t nclsTPC = fkESD ? fkESD->GetTPCncls() : 0;
1120 if(fkMC->GetTrackRef()) momentum = fkMC->GetTrackRef()->P();
1121 pdg = fkMC->GetPDG();
1123 (*DebugStream()) << "ChargeTracklet"
1124 << "Detector=" << detector
1125 << "crossing=" << crossing
1126 << "momentum=" << momentum
1127 << "nTracklets="<< nTracklets
1129 << "theta=" << theta
1131 << "kinkIndex=" << kinkIndex
1132 << "TPCncls=" << nclsTPC
1140 //_______________________________________________________
1141 TH1 *AliTRDcheckDET::PlotNTracksSector(const AliTRDtrackV1 *track){
1143 // Plot the number of tracks per Sector
1145 if(track) fkTrack = track;
1147 AliWarning("No Track defined.");
1151 if(!(h = dynamic_cast<TH1F *>(fContainer->At(kNtracksSector)))){
1152 AliWarning("No Histogram defined.");
1156 // TODO we should compare with
1157 // sector = Int_t(track->GetAlpha() / AliTRDgeometry::GetAlpha());
1159 AliTRDseedV1 *tracklet = NULL;
1161 for(Int_t itl = 0; itl < AliTRDgeometry::kNlayer; itl++){
1162 if(!(tracklet = fkTrack->GetTracklet(itl)) || !tracklet->IsOK()) continue;
1163 sector = static_cast<Int_t>(tracklet->GetDetector()/AliTRDgeometry::kNdets);
1171 //________________________________________________________
1172 void AliTRDcheckDET::SetRecoParam(AliTRDrecoParam *r)
1175 fReconstructor->SetRecoParam(r);
1178 //________________________________________________________
1179 void AliTRDcheckDET::GetDistanceToTracklet(Double_t *dist, AliTRDseedV1 * const tracklet, AliTRDcluster * const c)
1181 Float_t x = c->GetX();
1182 dist[0] = c->GetY() - tracklet->GetYat(x);
1183 dist[1] = c->GetZ() - tracklet->GetZat(x);
1187 //_______________________________________________________
1188 TH1* AliTRDcheckDET::MakePlotChi2()
1190 // Plot chi2/track normalized to number of degree of freedom
1191 // (tracklets) and compare with the theoretical distribution.
1193 // Alex Bercuci <A.Bercuci@gsi.de>
1195 TH2S *h2 = (TH2S*)fContainer->At(kChi2);
1196 TF1 f("fChi2", "[0]*pow(x, [1]-1)*exp(-0.5*x)", 0., 50.);
1197 TLegend *leg = new TLegend(.7,.7,.95,.95);
1198 leg->SetBorderSize(1); leg->SetHeader("Tracklets per Track");
1200 Bool_t kFIRST = kTRUE;
1201 for(Int_t il=1; il<=h2->GetNbinsX(); il++){
1202 h1 = h2->ProjectionY(Form("pyChi2%d", il), il, il);
1203 if(h1->Integral()<50) continue;
1204 h1->Scale(1./h1->Integral());
1205 h1->SetMarkerStyle(7);h1->SetMarkerColor(il);
1206 h1->SetLineColor(il);h1->SetLineStyle(2);
1207 f.SetParameter(1, .5*il);f.SetLineColor(il);
1208 h1->Fit(&f, "QW+", kFIRST ? "pc": "pcsame");
1209 leg->AddEntry(h1, Form("%d", il), "l");
1211 h1->GetXaxis()->SetRangeUser(0., 25.);
1221 //________________________________________________________
1222 TH1* AliTRDcheckDET::MakePlotNTracklets(){
1224 // Make nice bar plot of the number of tracklets in each method
1226 TH2F *tmp = (TH2F *)fContainer->FindObject("hNtlsBAR");
1227 TH1D *hBAR = tmp->ProjectionY();
1228 TH1F *hSTA = (TH1F *)fContainer->FindObject("hNtlsSTA");
1229 TH1F *hCON = (TH1F *)fContainer->FindObject("hNtls");
1230 TLegend *leg = new TLegend(0.13, 0.75, 0.39, 0.89);
1231 leg->SetBorderSize(1);
1232 leg->SetFillColor(0);
1234 Float_t scale = hCON->Integral();
1235 hCON->Scale(100./scale);
1236 hCON->SetFillColor(kRed);hCON->SetLineColor(kRed);
1237 hCON->SetBarWidth(0.2);
1238 hCON->SetBarOffset(0.6);
1239 hCON->SetStats(kFALSE);
1240 hCON->GetYaxis()->SetRangeUser(0.,40.);
1241 hCON->GetYaxis()->SetTitleOffset(1.2);
1242 hCON->Draw("bar1"); leg->AddEntry(hCON, "Total", "f");
1243 hCON->SetMaximum(55.);
1245 hBAR->Scale(100./scale);
1246 hBAR->SetFillColor(kGreen);hBAR->SetLineColor(kGreen);
1247 hBAR->SetBarWidth(0.2);
1248 hBAR->SetBarOffset(0.2);
1250 hBAR->SetStats(kFALSE);
1251 hBAR->GetYaxis()->SetRangeUser(0.,40.);
1252 hBAR->GetYaxis()->SetTitleOffset(1.2);
1253 hBAR->Draw("bar1same"); leg->AddEntry(hBAR, "Barrel", "f");
1255 hSTA->Scale(100./scale);
1256 hSTA->SetFillColor(kBlue);hSTA->SetLineColor(kBlue);
1257 hSTA->SetBarWidth(0.2);
1258 hSTA->SetBarOffset(0.4);
1260 hSTA->SetStats(kFALSE);
1261 hSTA->GetYaxis()->SetRangeUser(0.,40.);
1262 hSTA->GetYaxis()->SetTitleOffset(1.2);
1263 hSTA->Draw("bar1same"); leg->AddEntry(hSTA, "Stand Alone", "f");
1269 //________________________________________________________
1270 void AliTRDcheckDET::MakePlotnTrackletsVsP(){
1272 // Plot abundance of tracks with number of tracklets as function of momentum
1278 Color_t color[AliTRDgeometry::kNlayer] = {kBlue, kOrange, kBlack, kGreen, kCyan, kRed};
1279 TH1 *h(NULL); TGraphErrors *g[AliTRDgeometry::kNlayer];
1280 for(Int_t itl(0); itl<AliTRDgeometry::kNlayer; itl++){
1281 g[itl] = new TGraphErrors();
1282 g[itl]->SetLineColor(color[itl]);
1283 g[itl]->SetMarkerColor(color[itl]);
1284 g[itl]->SetMarkerStyle(20 + itl);
1287 TH2 *hBar = (TH2F *)fContainer->FindObject("hNtlsBAR");
1288 TAxis *ax(hBar->GetXaxis());
1289 Int_t np(ax->GetNbins());
1290 for(Int_t ipBin(1); ipBin<np; ipBin++){
1291 h = hBar->ProjectionY("npBin", ipBin, ipBin);
1292 if(!Int_t(h->Integral())) continue;
1293 h->Scale(100./h->Integral());
1294 Float_t p(ax->GetBinCenter(ipBin));
1295 Float_t dp(ax->GetBinWidth(ipBin));
1296 Int_t ip(g[0]->GetN());
1297 for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){
1298 g[itl]->SetPoint(ip, p, h->GetBinContent(itl+1));
1299 g[itl]->SetPointError(ip, dp/3.46, h->GetBinError(itl+1));
1303 TLegend *leg = new TLegend(0.76, 0.6, 1., 0.9);
1304 leg->SetBorderSize(0);
1305 leg->SetHeader("Tracklet/Track");
1306 leg->SetFillStyle(0);
1307 h = hBar->ProjectionX("npxBin"); h->Reset();
1309 h->GetYaxis()->SetRangeUser(1., 99.);
1310 h->GetYaxis()->SetMoreLogLabels();
1311 h->GetYaxis()->CenterTitle();
1312 h->GetYaxis()->SetTitleOffset(1.2);
1313 h->SetYTitle("Prob. [%]");
1314 h->GetXaxis()->SetRangeUser(0.4, 12.);
1315 h->GetXaxis()->SetMoreLogLabels();
1316 h->GetXaxis()->CenterTitle();
1318 for(Int_t itl(AliTRDgeometry::kNlayer); itl--;){
1320 leg->AddEntry(g[itl], Form("n = %d", itl+1),"pl");
1324 gPad->SetLogx();gPad->SetLogy();
1327 //________________________________________________________
1328 TH1* AliTRDcheckDET::MakePlotPulseHeight(){
1330 // Create Plot of the Pluse Height Spectrum
1333 TObjArray *arr = (TObjArray*)fContainer->FindObject("<PH>");
1334 h = (TH1F*)arr->At(0);
1335 h->SetMarkerStyle(24);
1336 h->SetMarkerColor(kBlack);
1337 h->SetLineColor(kBlack);
1339 // Trending for the pulse height: plateau value, slope and timebin of the maximum
1340 TLinearFitter fit(1,"pol1");
1342 for(Int_t itime = 10; itime <= 20; itime++){
1343 time = static_cast<Double_t>(itime);
1344 fit.AddPoint(&time, h->GetBinContent(itime + 1), h->GetBinError(itime + 1));
1347 Double_t plateau = fit.GetParameter(0) + 12 * fit.GetParameter(1);
1348 Double_t slope = fit.GetParameter(1);
1349 PutTrendValue("PHplateau", plateau);
1350 PutTrendValue("PHslope", slope);
1351 PutTrendValue("PHamplificationPeak", static_cast<Double_t>(h->GetMaximumBin()-1));
1352 AliDebug(1, Form("plateau %f, slope %f, MaxTime %f", plateau, slope, static_cast<Double_t>(h->GetMaximumBin()-1)));
1353 // copy the second histogram in a new one with the same x-dimension as the phs with respect to time
1354 h1 = (TH1F *)arr->At(1);
1355 h2 = new TH1F("hphs1","Average PH", 31, -0.5, 30.5);
1356 for(Int_t ibin = h1->GetXaxis()->GetFirst(); ibin < h1->GetNbinsX(); ibin++)
1357 h2->SetBinContent(ibin, h1->GetBinContent(ibin));
1358 h2->SetMarkerStyle(22);
1359 h2->SetMarkerColor(kBlue);
1360 h2->SetLineColor(kBlue);
1363 // create axis according to the histogram dimensions of the original second histogram
1364 TGaxis *axis = new TGaxis(gPad->GetUxmin(),
1368 -0.08, 4.88, 510,"-L");
1369 axis->SetLineColor(kBlue);
1370 axis->SetLabelColor(kBlue);
1371 axis->SetTextColor(kBlue);
1372 axis->SetTitle("x_{0}-x_{c} [cm]");
1377 //________________________________________________________
1378 Bool_t AliTRDcheckDET::MakeBarPlot(TH1 *histo, Int_t color){
1380 // Draw nice bar plots
1382 if(!histo->GetEntries()) return kFALSE;
1383 histo->Scale(100./histo->Integral());
1384 histo->SetFillColor(color);
1385 histo->SetBarOffset(.2);
1386 histo->SetBarWidth(.6);
1387 histo->Draw("bar1");