1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////
20 // Produces the data needed to calculate the quality assurance. //
21 // All data must be mergeable objects. //
24 // Sylwester Radomski (radomski@physi.uni-heidelberg.de) //
26 ////////////////////////////////////////////////////////////////////////////
28 // --- ROOT system ---
29 #include <TClonesArray.h>
38 // --- AliRoot header files ---
39 #include "AliESDEvent.h"
41 #include "AliTRDcluster.h"
42 #include "AliTRDQADataMakerRec.h"
43 #include "AliTRDgeometry.h"
44 #include "AliTRDdataArrayI.h"
45 #include "AliTRDrawStreamTB.h"
47 #include "AliQAChecker.h"
49 ClassImp(AliTRDQADataMakerRec)
51 //____________________________________________________________________________
52 AliTRDQADataMakerRec::AliTRDQADataMakerRec() :
53 AliQADataMakerRec(AliQA::GetDetName(AliQA::kTRD), "TRD Quality Assurance Data Maker")
56 // Default constructor
59 //____________________________________________________________________________
60 AliTRDQADataMakerRec::AliTRDQADataMakerRec(const AliTRDQADataMakerRec& qadm) :
67 SetName((const char*)qadm.GetName()) ;
68 SetTitle((const char*)qadm.GetTitle());
72 //__________________________________________________________________
73 AliTRDQADataMakerRec& AliTRDQADataMakerRec::operator=(const AliTRDQADataMakerRec& qadm)
79 this->~AliTRDQADataMakerRec();
80 new(this) AliTRDQADataMakerRec(qadm);
85 //____________________________________________________________________________
86 void AliTRDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
89 // Detector specific actions at end of cycle
94 AliInfo("End of TRD cycle");
96 if (task == AliQA::kRECPOINTS) {
98 TH1D *hist = new TH1D("fitHist", "", 200, -0.5, 199.5);
101 // fill detector map;
102 for(int i=0; i<540; i++) {
103 Double_t v = ((TH1D*)list->At(0))->GetBinContent(i+1);
107 TH2D *detMap = (TH2D*)list->At(87);
108 Int_t bin = detMap->FindBin(sm, det);
109 detMap->SetBinContent(bin, v);
113 // Rec points full chambers
114 for (Int_t i=0; i<540; i++) {
116 //AliInfo(Form("I = %d", i));
118 //TH1D *h = ((TH2D*)list->At(1))->ProjectionY(Form("qaTRD_recPoints_amp_%d",i), i+1, i+1);
120 for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
121 Double_t xvalue = hist->GetBinCenter(b);
122 Int_t bin = ((TH2D*)list->At(1))->FindBin(i,xvalue);
123 Double_t value = ((TH2D*)list->At(1))->GetBinContent(bin);
124 hist->SetBinContent(b, value);
127 //printf("Sum = %d %f\n", i, hist->GetSum());
128 if (hist->GetSum() < 100) continue; // chamber not present
130 hist->Fit("landau", "q0", "goff", 10, 180);
131 TF1 *fit = hist->GetFunction("landau");
132 ((TH1D*)list->At(12))->Fill(fit->GetParameter(1));
133 ((TH1D*)list->At(13))->Fill(fit->GetParameter(2));
136 // time-bin by time-bin sm by sm
137 for(Int_t i=0; i<18; i++) { // loop over super-modules
139 for(Int_t j=0; j<35; j++) { // loop over time bins
141 //TH1D *h = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
143 for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
144 Double_t xvalue = hist->GetBinCenter(b);
147 for(Int_t det=i*30; det<(i+1)*30; det++) { // loop over detectors
148 Int_t bin = ((TH3D*)list->At(10))->FindBin(det,j,xvalue);
149 Double_t value = ((TH3D*)list->At(10))->GetBinContent(bin);
152 //printf("v = %f\n", value);
153 hist->SetBinContent(b, svalue);
156 if (hist->GetSum() < 100) continue;
157 //printf("fitting %d %d %f\n", i, j, hist->GetSum());
159 hist->Fit("landau", "q0", "goff", 10, 180);
160 TF1 *fit = hist->GetFunction("landau");
162 TH1D *h1 = (TH1D*)list->At(14+18+i);
163 Int_t bin = h1->FindBin(j);
164 // printf("%d %d %d\n", det, j, bin);
165 h1->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
170 // time-bin by time-bin chamber by chamber
171 for (Int_t i=0; i<540; i++) {
173 //TH1D *test = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, 0, 35);
174 //if (test->GetSum() < 100) continue;
176 //AliInfo(Form("fitting det = %d", i));
178 for(Int_t j=0; j<35; j++) {
180 //TH1D *h = ((TH3D*)list->At(10))->ProjectionZ(Form("ampTime_%d",i), i+1, i+1, j+1, j+1);
182 for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
183 Double_t xvalue = hist->GetBinCenter(b);
184 Int_t bin = ((TH3D*)list->At(10))->FindBin(i,j,xvalue);
185 Double_t value = ((TH3D*)list->At(10))->GetBinContent(bin);
186 //printf("v = %f\n", value);
187 hist->SetBinContent(b, value);
190 if (hist->GetSum() < 100) continue;
191 //printf("fitting %d %d %f\n", i, j, hist->GetSum());
193 hist->Fit("landau", "q0", "goff", 10, 180);
194 TF1 *fit = hist->GetFunction("landau");
198 TH2D *h2 = (TH2D*)list->At(14+sm);
199 Int_t bin = h2->FindBin(det,j);
200 // printf("%d %d %d\n", det, j, bin);
201 h2->SetBinContent(bin, TMath::Abs(fit->GetParameter(1)));
202 h2->SetBinError(bin,fit->GetParError(1));
206 if (hist) delete hist;
209 //////////////////////////
210 // const Int_t knbits = 6;
211 // const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
212 //const char *sufRatio[4] = {"TRDrTRDo", "TRDoTPCo", "TRDrTPCo", "TRDzTPCo"};
214 if (task == AliQA::kESDS) {
216 const Int_t knRatio = 4;
217 const Int_t kN[knRatio] = {4,3,4,5};
218 const Int_t kD[knRatio] = {3,1,1,3};
221 for(Int_t type=0; type<2; type++) {
222 for(Int_t i=0; i<knRatio; i++) {
224 TH1D *ratio = (TH1D*)list->At(19 + 2*i + type);
225 TH1D *histN = (TH1D*)list->At(3 + 2*kN[i] + type);
226 TH1D *histD = (TH1D*)list->At(3 + 2*kD[i] + type);
228 BuildRatio(ratio, histN, histD);
231 //ratio->Divide(histD);
235 // ratio for the fraction of electrons per stack
236 TH1D *histN = (TH1D*)list->At(33);
237 TH1D *histD = (TH1D*)list->At(32);
238 TH1D *ratio = (TH1D*)list->At(34);
239 BuildRatio(ratio, histN, histD);
244 AliQAChecker::Instance()->Run(AliQA::kTRD, task, list) ;
247 //____________________________________________________________________________
248 void AliTRDQADataMakerRec::InitESDs()
251 // Create ESDs histograms in ESDs subdir
254 const Int_t kNhist = 36+5+4;
257 Int_t histoCounter = -1 ;
259 hist[++histoCounter] = new TH1D("qaTRD_esd_ntracks", ";Number of tracks", 300, -0.5, 299.5);
260 hist[++histoCounter] = new TH1D("qaTRD_esd_sector", ";Sector", 18, -0.5, 17.7);
261 hist[++histoCounter] = new TH1D("qaTRD_esd_bits", ";Bits", 64, -0.5, 63.5);
263 const Int_t knbits = 6;
264 const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
267 for(Int_t i=0; i<knbits; i++) {
268 hist[++histoCounter] = new TH1D(Form("qaTRD_esd_pt%s",suf[i]), ";p_{T} (GeV/c);", 100, 0, 10);
269 hist[++histoCounter] = new TH1D(Form("qaTRD_esd_trdz%s", suf[i]), ";z (cm)", 200, -400, 400);
272 hist[++histoCounter] = new TH1D("qaTRD_esd_clsTRDo", "TRDo;number of clusters", 180, -0.5, 179.5);;
273 hist[++histoCounter] = new TH1D("qaTRD_esd_clsTRDr", "TRDr;number of clusters", 180, -0.5, 179.5);;
274 hist[++histoCounter] = new TH1D("qaTRD_esd_clsTRDz", "TRDz;number of clusters", 180, -0.5, 179.5);;
275 //hist[++histoCounter] = new TH1D("qaTRD_esd_clsRatio", ";cluster ratio", 100, 0., 1.3);;
277 hist[++histoCounter] = new TH2D("qaTRD_esd_sigMom", ";momentum (GeV/c);signal", 100, 0, 5, 200, 0, 1e3);
279 // end of cycle plots (hist 19)
280 const char *sufRatio[4] = {"TRDrTRDo", "TRDoTPCo", "TRDrTPCo", "TRDzTPCo"};
282 for(int i=0; i<4; i++) {
283 hist[++histoCounter] = new TH1D(Form("qaTRD_esd_pt%s",sufRatio[i]),
284 Form("Efficiency in Pt %s;p_{T};eff", sufRatio[i]),
287 hist[++histoCounter] = new TH1D(Form("qaTRD_esd_trdz%s",sufRatio[i]),
288 Form("Efficiency in Z %s;z (cm);eff", sufRatio[i]),
293 hist[27] = new TH1D("qaTRD_esd_quality", ";quality", 120, 0, 12);
294 hist[28] = new TH1D("qaTRD_esd_budget", ";NN", 110, -1000, 100);
295 hist[29] = new TH1D("qaTRD_esd_chi2", ";chi2", 200, 0, 100);
296 hist[30] = new TH1D("qaTRD_esd_timeBin", ";time bin", 7, -0.5, 6.5);
297 hist[31] = new TH1D("qaTRD_esd_pidQuality", "pid Quality", 7, -0.5, 6.5);
299 // stack by stack electron identyfication
300 hist[32] = new TH1D("qaTRD_esd_tracksStack", "number of all tracks;stack", 90, -0.5, 89.5);
301 hist[33] = new TH1D("qaTRD_esd_electronStack", "number of electron tracks;stack", 90, -0.5, 89.5);
302 hist[34] = new TH1D("qaTRD_esd_elRatioStack", "fraction of electron tracks;stack", 90, -0.5, 89.5);
303 hist[35] = new TH1D("qaTRD_esd_thetaOut", ";tan(theta);", 100, -1, 1);
305 const char *partType[5] = {"Electron", "Muon", "Pion", "Kaon", "Proton"};
307 for(Int_t i=0; i<AliPID::kSPECIES; i++)
308 hist[36+i] = new TH1D(Form("qaTRD_esd_pid%d",i),
309 Form("%s;probability",partType[i]), 100, 0, 1);
311 // dE/dX vs momentum in three regions
312 const char *zoneName[4] = {"total charge", "ampilification range", "plateau", "TR range"};
314 // prepare the scale from 0.1 to 10 GeV
315 Double_t scalex[101];
316 Double_t dd = (TMath::Log(10) - TMath::Log(0.5)) / 100.;
317 for(Int_t ix=0; ix<101; ix++) {
318 scalex[ix] = 0.5 * TMath::Exp(dd * ix);
321 Double_t scaley[101];
322 for(Int_t iy=0; iy<101; iy++) {
323 scaley[iy] = iy * (3e3/100.);
327 for(Int_t i=0; i<4; i++) {
328 hist[41+i] = new TH2D(Form("qaTRD_esd_signalPzone_%d",i),
329 Form("%s;momentum (GeV/c);singal (a.u.)", zoneName[i]),
330 100, scalex, 100, scaley);
333 for(Int_t i=0; i<kNhist; i++) {
335 Add2ESDsList(hist[i], i);
340 //____________________________________________________________________________
341 void AliTRDQADataMakerRec::InitRecPoints()
344 // Create Reconstructed Points histograms in RecPoints subdir
347 const Int_t kNhist = 14 + 4 * 18 + 2;
350 hist[0] = new TH1D("qaTRD_recPoints_det", ";Detector ID of the cluster", 540, -0.5, 539.5);
351 hist[1] = new TH2D("qaTRD_recPoints_amp", ";Amplitude", 540, -0.5, 539, 200, -0.5, 199.5);
352 hist[2] = new TH1D("qaTRD_recPoints_npad", ";Number of Pads", 12, -0.5, 11.5);
354 hist[3] = new TH1D("qaTRD_recPoints_dist2", ";residuals [2pad]", 100, -1, 1);
355 hist[4] = new TH1D("qaTRD_recPoints_dist3", ";residuals [3pad]", 100, -1, 1);
356 hist[5] = new TH1D("qaTRD_recPoints_dist4", ";residuals [4pad]", 100, -1, 1);
357 hist[6] = new TH1D("qaTRD_recPoints_dist5", ";residuals [5pad]", 100, -1, 1);
359 hist[7] = new TH2D("qaTRD_recPoints_rowCol", ";row;col", 16, -0.5, 15.5, 145, -0.5, 144.5);
360 hist[8] = new TH1D("qaTRD_recPoints_time", ";time bin", 35, -0.5, 34.5);
361 hist[9] = new TH1D("qaTRD_recPoints_nCls", ";number of clusters", 500, -0.5, 499.5);
363 hist[10] = new TH3D("qaTRD_recPoints_sigTime", ";chamber;time bin;signal",
364 540, -0.5, 539.5, 35, -0.5, 34.5, 200, -0.5, 199.5);
365 hist[11] = new TProfile("qaTRD_recPoints_prf", ";distance;center of gravity"
366 , 120, -0.6, 0.6, -1.2, 1.2, "");
368 hist[12] = new TH1D("qaTRD_recPoints_ampMPV", ";amplitude MPV", 200, 0, 200);
369 hist[13] = new TH1D("qaTRD_recPoints_ampSigma", ";amplitude Sigma", 200, 0, 200);
371 // chamber by chamber
372 for(Int_t i=0; i<18; i++) {
373 hist[14+i] = new TH2D(Form("qaTRD_recPoints_sigTime_sm%d",i), Form("sm%d;det;time bin"),
374 30, -0.5, 29.5, 35, -0.5, 34.5);
375 hist[14+i]->SetMinimum(20);
376 hist[14+i]->SetMaximum(40);
379 // time bin by time bin sm-by-sm
380 for(Int_t i=0; i<18; i++) {
381 hist[14+18+i] = new TH1D(Form("qaTRD_recPoints_sigTimeShape_sm%d", i),
382 Form("sm%d;time bin;signal"),
385 hist[14+18+i]->SetMaximum(120);
389 for(Int_t i=0; i<18; i++) {
390 hist[50+i] = new TH1D(Form("qaTRD_recPoints_nCls_sm%d",i),
391 Form("sm%d;time bin;number of clusters",i),
396 for(Int_t i=0; i<18; i++) {
397 hist[68+i] = new TH1D(Form("qaTRD_recPoints_totalCharge_sm%d", i),
398 Form("sm%d;time bin;total charge", i),
402 hist[86] = new TH1D("qaTRD_recPoints_signal", ";amplitude", 200, -0.5, 199.5);
403 hist[87] = new TH2D("qaTRD_recPoints_detMap", ";sm;chamber", 18, -0.5, 17.5, 30, -0.5, 29.5);
406 for(Int_t i=0; i<kNhist; i++) {
408 Add2RecPointsList(hist[i], i);
412 //____________________________________________________________________________
413 void AliTRDQADataMakerRec::InitRaws()
416 // create Raws histograms in Raws subdir
419 const Int_t kSM = 18;
420 //const Int_t kNCh = 540;
421 const Int_t kNhist = 4+kSM;
424 // four histograms to be published
425 hist[0] = new TH1D("qaTRD_raws_det", ";detector", 540, -0.5, 539.5);
426 hist[1] = new TH1D("qaTRD_raws_sig", ";signal", 100, -0.5, 99.5);
427 hist[2] = new TH1D("qaTRD_raws_timeBin", ";time bin", 40, -0.5, 39.5);
428 hist[3] = new TH1D("qaTRD_raws_smId", ";supermodule", 18, -0.5, 17.5);
431 // one double per MCM (not published)
432 const Int_t kNMCM = 30 * 8 * 16;
433 for(Int_t i=0; i<kSM; i++)
434 hist[4+i] = new TH1D(Form("qaTRD_raws_sm%d",i),"",kNMCM, -0.5, kNMCM-0.5);
437 for(Int_t i=0; i<kNhist; i++) {
439 Add2RawsList(hist[i], i);
444 //____________________________________________________________________________
445 void AliTRDQADataMakerRec::MakeESDs(AliESDEvent * esd)
448 // Make QA data from ESDs
451 Int_t nTracks = esd->GetNumberOfTracks();
452 GetESDsData(0)->Fill(nTracks);
455 for (Int_t i=0; i<nTracks; i++) {
457 AliESDtrack *track = esd->GetTrack(i);
458 const AliExternalTrackParam *paramOut = track->GetOuterParam();
459 const AliExternalTrackParam *paramIn = track->GetInnerParam();
462 if (!paramIn) continue;
463 if (!paramOut) continue;
466 if (track->GetKinkIndex(0) > 0) continue;
468 Double_t extZ = GetExtZ(paramIn);
469 if (TMath::Abs(extZ) > 320) continue; // acceptance cut
471 // .. in the acceptance
472 Int_t sector = GetSector(paramOut->GetAlpha());
473 Int_t stack = GetStack(paramOut);
476 UInt_t status = track->GetStatus();
477 for(Int_t bit=0; bit<32; bit++)
478 if (u<<bit & status) GetESDsData(2)->Fill(bit);
480 const Int_t knbits = 6;
481 Int_t bit[6] = {0,0,0,0,0,0};
482 bit[0] = status & AliESDtrack::kTPCin;
483 bit[1] = status & AliESDtrack::kTPCout;
484 bit[2] = (status & AliESDtrack::kTPCout) && !(status & AliESDtrack::kTRDout);
485 bit[3] = status & AliESDtrack::kTRDout;
486 bit[4] = status & AliESDtrack::kTRDrefit;
487 bit[5] = (status & AliESDtrack::kTRDout) && !(status & AliESDtrack::kTRDrefit);
489 // transverse momentum
490 //const Double_t *val = paramOut->GetParameter(); // parameters at the Outer plane
491 Double_t pt = paramOut->Pt(); //1./TMath::Abs(val[4]);
493 for(Int_t b=0; b<knbits; b++) {
495 GetESDsData(2*b+3)->Fill(pt);
496 GetESDsData(2*b+4)->Fill(extZ);
501 for(Int_t b=0; b<3; b++)
502 if (bit[3+b]) GetESDsData(b+15)->Fill(track->GetTRDncls0());
505 if (!bit[4]) continue;
507 //fQuality->Fill(track->GetTRDQuality());
508 //fBudget->Fill(track->GetTRDBudget());
509 //fSignal->Fill(track->GetTRDsignal());
511 GetESDsData(1)->Fill(sector);
512 GetESDsData(18)->Fill(track->GetP(), track->GetTRDsignal());
514 GetESDsData(27)->Fill(track->GetTRDQuality());
515 GetESDsData(28)->Fill(track->GetTRDBudget());
516 GetESDsData(29)->Fill(track->GetTRDchi2());
517 GetESDsData(30)->Fill(track->GetTRDTimBin(0));
518 GetESDsData(31)->Fill(track->GetTRDpidQuality());
522 for(Int_t i=0; i<4; i++) {
524 for(Int_t j=0; j<6; j++) {
525 dedx += track->GetTRDsignals(j, i-1);
527 GetESDsData(41+i)->Fill(paramOut->GetP(), dedx/6.);
531 if (status & AliESDtrack::kTRDpid) {
532 for(Int_t i=0; i<AliPID::kSPECIES; i++)
533 GetESDsData(36+i)->Fill(track->GetTRDpid(i));
536 // probabilities uniformity
537 if (track->GetTRDpidQuality() < 6) continue;
538 GetESDsData(35)->Fill(paramOut->GetZ()/paramOut->GetX());
540 Int_t idx = 5 * sector + stack;
541 GetESDsData(32)->Fill(idx); // all tracks
542 if (track->GetTRDpid(AliPID::kElectron) > 0.9)
543 GetESDsData(33)->Fill(idx); // electrons only
548 hist[27] = new TH1D("qaTRD_esd_quality", ";quality", 120, 0, 12);
549 hist[28] = new TH1D("qaTRD_esd_budget", ";NN", 110, -1000, 100);
550 hist[29] = new TH1D("qaTRD_esd_chi2", ";chi2", 300, 0, 100);
551 hist[30] = new TH1D("qaTRD_esd_timeBin", 7, -0.5, 6.5);
552 hist[31] = new TH1D("qaTRD_esd_pidQuality", 7, -0.5, 6.5);
557 if (status & AliESDtrack::kTRDpid) {
559 for(Int_t l=0; l<6; l++) fTime->Fill(track->GetTRDTimBin(l));
561 // fill pid histograms
562 Double_t trdr0 = 0; //, tpcr0 = 0;
563 Int_t trdBestPid = 5; //, tpcBestPid = 5; // charged
564 const Double_t kminPidValue = 0.9;
567 //track->GetTPCpid(pp); // ESD inconsequence
569 for(Int_t pid=0; pid<5; pid++) {
571 trdr0 += track->GetTRDpid(pid);
574 fTrdPID[pid]->Fill(track->GetTRDpid(pid));
575 //fTpcPID[pid]->Fill(pp[pid]);
577 if (track->GetTRDpid(pid) > kminPidValue) trdBestPid = pid;
578 //if (pp[pid] > kminPidValue) tpcBestPid = pid;
581 fTrdPID[5]->Fill(trdr0); // check unitarity
582 fTrdSigMomPID[trdBestPid]->Fill(track->GetP(), track->GetTRDsignal());
584 //fTpcPID[5]->Fill(tpcr0); // check unitarity
585 //fTpcSigMomPID[tpcBestPid]->Fill(track->GetP(), track->GetTPCsignal());
593 //______________________________________________________________________________
594 Int_t AliTRDQADataMakerRec::GetSector(Double_t alpha) const
597 // Gets the sector number
600 Double_t size = TMath::DegToRad() * 20.; // shall use TRDgeo
601 if (alpha < 0) alpha += 2*TMath::Pi();
602 Int_t sector = (Int_t)(alpha/size);
606 //______________________________________________________________________________
608 Int_t AliTRDQADataMakerRec::GetStack(const AliExternalTrackParam *paramOut) const
611 // calculates the stack the track is in
614 const Double_t L = -0.9;
615 const Double_t W = (2*L)/5;
617 Double_t tan = paramOut->GetZ() / paramOut->GetX();
618 Double_t pos = (tan - L) / W;
622 //______________________________________________________________________________
623 Double_t AliTRDQADataMakerRec::GetExtZ(const AliExternalTrackParam *in) const
626 // Returns the Z position at the entry to TRD
627 // using parameters from the TPC in
630 const Double_t kX0 = 300;
632 Double_t x = in->GetX();
633 const Double_t *par = in->GetParameter();
634 Double_t theta = par[3];
635 Double_t z = in->GetZ();
637 Double_t zz = z + (kX0-x) * TMath::Tan(theta);
642 //____________________________________________________________________________
643 void AliTRDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
646 // Makes QA data from raw data
652 //const Int_t kSM = 18;
653 //const Int_t kROC = 30;
654 const Int_t kROB = 8;
655 //const Int_t kLayer = 6;
656 //const Int_t kStack = 5;
657 const Int_t kMCM = 16;
658 // const Int_t kADC = 22;
660 //AliTRDrawStreamBase::SetRawStreamVersion("TB");
661 AliTRDrawStreamBase *raw = AliTRDrawStreamBase::GetRawStream(rawReader);
662 AliDebug(2,Form("Stream version: %s", raw->IsA()->GetName()));
664 while (raw->Next()) {
666 GetRawsData(0)->Fill(raw->GetDet());
668 // possibly needs changes with the new reader !!
669 Int_t *sig = raw->GetSignals();
670 for(Int_t i=0; i<3; i++) GetRawsData(1)->Fill(sig[i]);
673 GetRawsData(2)->Fill(raw->GetTimeBin());
675 // calculate the index;
676 Int_t sm = raw->GetSM();
677 Int_t roc = raw->GetROC();
678 Int_t rob = raw->GetROB();
679 Int_t mcm = raw->GetMCM();
680 //Int_t adc = raw->GetADC();
682 //Int_t index = roc * (kROB*kMCM*kADC) + rob * (kMCM*kADC) + mcm * kADC + adc;
683 Int_t index = roc * (kROB*kMCM) + rob * kMCM + mcm;
684 GetRawsData(3)->Fill(sm);
685 GetRawsData(4+sm)->Fill(index);
691 //____________________________________________________________________________
692 void AliTRDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
695 // Makes data from RecPoints
698 // Info("MakeRecPoints", "making");
700 Int_t nsize = Int_t(clustersTree->GetTotBytes() / (sizeof(AliTRDcluster)));
701 TObjArray *clusterArray = new TObjArray(nsize+1000);
703 TBranch *branch = clustersTree->GetBranch("TRDcluster");
705 AliError("Can't get the branch !");
708 branch->SetAddress(&clusterArray);
710 // Loop through all entries in the tree
711 Int_t nEntries = (Int_t) clustersTree->GetEntries();
713 AliTRDcluster *c = 0;
715 for (Int_t i=0; i<540; i++) nDet[i] = 0;
717 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
720 nbytes += clustersTree->GetEvent(iEntry);
722 // Get the number of points in the detector
723 Int_t nCluster = clusterArray->GetEntriesFast();
725 // Loop through all TRD digits
726 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
727 c = (AliTRDcluster *) clusterArray->UncheckedAt(iCluster);
729 Int_t iDet = c->GetDetector();
731 GetRecPointsData(0)->Fill(iDet);
732 GetRecPointsData(86)->Fill(c->GetQ());
733 GetRecPointsData(1)->Fill(iDet, c->GetQ());
734 GetRecPointsData(2)->Fill(c->GetNPads());
735 if (c->GetNPads() < 6)
736 GetRecPointsData(1+c->GetNPads())->Fill(c->GetCenter());
738 //if (c->GetPadTime() < 5)
739 ((TH2D*)GetRecPointsData(7))->Fill(c->GetPadRow(), c->GetPadCol());
740 GetRecPointsData(8)->Fill(c->GetPadTime());
742 ((TH3D*)GetRecPointsData(10))->Fill(iDet, c->GetPadTime(), c->GetQ());
744 Int_t iSM = iDet / 30;
745 GetRecPointsData(50+iSM)->Fill(c->GetPadTime());
746 GetRecPointsData(68+iSM)->Fill(c->GetPadTime(), c->GetQ());
749 //if (c->GetNPads() == 2) {
750 Short_t *sig = c->GetSignals();
753 if (sig[0] == 0 && sig[1] == 0 && sig[2] == 0 && sig[5] == 0 && sig[6] == 0)
754 frac = 1. * sig[4] / (sig[3] + sig[4]);
756 if (sig[0] == 0 && sig[1] == 0 && sig[4] == 0 && sig[5] == 0 && sig[6] == 0)
757 frac = -1. * sig[2] / (sig[2] + sig[3]);
759 if (frac > -10) ((TProfile*)GetRecPointsData(11))->Fill(c->GetCenter(), frac);
765 for(Int_t i=0; i<540; i++)
766 if (nDet[i] > 0) GetRecPointsData(9)->Fill(nDet[i]);
772 //____________________________________________________________________________
773 void AliTRDQADataMakerRec::StartOfDetectorCycle()
776 // Detector specific actions at start of cycle
781 //__________________________________________________________________________
782 Int_t AliTRDQADataMakerRec::CheckPointer(TObject *obj, const char *name)
785 // Checks initialization of pointers
788 if (!obj) AliWarning(Form("null pointer: %s", name));
791 //__________________________________________________________________________
792 void AliTRDQADataMakerRec::BuildRatio(TH1D *ratio, TH1D *histN, TH1D*histD) {
794 // Calculate the ratio of two histograms
795 // error are calculated assuming the histos have the same counts
800 Int_t nbins = histN->GetXaxis()->GetNbins();
801 for(Int_t i=1; i<nbins+2; i++) {
803 Double_t valueN = histN->GetBinContent(i);
804 Double_t valueD = histD->GetBinContent(i);
807 ratio->SetBinContent(i, 0);
808 ratio->SetBinError(i, 0);
812 Double_t eps = (valueN < valueD-valueN)? valueN : valueD-valueN;
814 ratio->SetBinContent(i, valueN/valueD);
815 ratio->SetBinError(i, TMath::Sqrt(eps)/valueD);
819 ratio->SetMinimum(-0.1);
820 ratio->SetMaximum(1.1);
821 ratio->SetMarkerStyle(20);
823 //__________________________________________________________________________