]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDQADataMaker.cxx
Coding conventions
[u/mrichter/AliRoot.git] / TRD / AliTRDQADataMaker.cxx
CommitLineData
ffb5de4c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
01abcaa3 16/* $Id$ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// Produces the data needed to calculate the quality assurance. //
21// All data must be mergeable objects. //
22// S.Radomski Uni-Heidelberg October 2007 //
23// //
24////////////////////////////////////////////////////////////////////////////
ffb5de4c 25
26// --- ROOT system ---
27#include <TClonesArray.h>
28#include <TFile.h>
29#include <TH1D.h>
01abcaa3 30#include <TH2D.h>
31#include <TProfile.h>
ffb5de4c 32
33// --- AliRoot header files ---
34#include "AliESDEvent.h"
35#include "AliLog.h"
36#include "AliTRDdigit.h"
37#include "AliTRDhit.h"
38#include "AliTRDcluster.h"
39#include "AliTRDQADataMaker.h"
01abcaa3 40#include "AliTRDdigitsManager.h"
41#include "AliTRDgeometry.h"
42#include "AliTRDdataArrayI.h"
ffb5de4c 43#include "AliTRDRawStreamV2.h"
44
45ClassImp(AliTRDQADataMaker)
46
47//____________________________________________________________________________
48 AliTRDQADataMaker::AliTRDQADataMaker() :
49 AliQADataMaker(AliQA::GetDetName(AliQA::kTRD), "TRD Quality Assurance Data Maker")
50{
51 // ctor
52}
53
54//____________________________________________________________________________
55AliTRDQADataMaker::AliTRDQADataMaker(const AliTRDQADataMaker& qadm) :
56 AliQADataMaker()
57{
58 //copy ctor
59 SetName((const char*)qadm.GetName()) ;
60 SetTitle((const char*)qadm.GetTitle());
61}
62
63//__________________________________________________________________
64AliTRDQADataMaker& AliTRDQADataMaker::operator = (const AliTRDQADataMaker& qadm )
65{
66 // Equal operator.
67 this->~AliTRDQADataMaker();
68 new(this) AliTRDQADataMaker(qadm);
69 return *this;
70}
71
72//____________________________________________________________________________
73void AliTRDQADataMaker::EndOfDetectorCycle()
74{
75 //Detector specific actions at end of cycle
01abcaa3 76
77 // Rec points
78
ffb5de4c 79}
80
81//____________________________________________________________________________
82void AliTRDQADataMaker::InitESDs()
83{
84 //create ESDs histograms in ESDs subdir
01abcaa3 85 const Int_t nhist = 19;
86 TH1 *hist[nhist];
ffb5de4c 87
01abcaa3 88 hist[0] = new TH1D("qaTRD_esd_ntracks", ":Number of tracks", 300, -0.5, 299.5);
89 hist[1] = new TH1D("qaTRD_esd_sector", ":Sector", 18, -0.5, 17.7);
90 hist[2] = new TH1D("qaTRD_esd_bits", ";Bits", 64, -0.5, 63.5);
91
92 const Int_t knbits = 6;
93 const char *suf[knbits] = {"TPCi", "TPCo", "TPCz", "TRDo", "TRDr", "TRDz"};
94
95 // 3
96 for(Int_t i=0; i<knbits; i++) {
f75c4b05 97 hist[2*i+3] = new TH1D(Form("qaTRD_esd_pt%s",suf[i]), ";p_{T} (GeV/c);", 50, 0, 10);
98 hist[2*i+4] = new TH1D(Form("qaTRD_esd_trdz%s", suf[i]), ";z (cm)", 200, -400, 400);
01abcaa3 99 }
100
101 // 3 + 12 = 15
102 hist[15] = new TH1D("qaTRD_esd_clsTRDo", "TRDo;number of clusters", 130, -0.5, 129.5);;
103 hist[16] = new TH1D("qaTRD_esd_clsTRDr", "TRDr;number of clusters", 130, -0.5, 129.5);;
104 hist[17] = new TH1D("qaTRD_esd_clsTRDz", "TRDz;number of clusters", 130, -0.5, 129.5);;
105 // hist[18] = new TH1D("qaTRD_esd_clsRatio", ";cluster ratio", 100, 0., 1.3);;
106
107 hist[18] = new TH2D("qaTRD_esd_sigMom", ";momentum (GeV/c);signal", 100, 0, 5, 200, 0, 1e3);
ffb5de4c 108
109 for(Int_t i=0; i<nhist; i++) {
110 //hist[i]->Sumw2();
111 Add2ESDsList(hist[i], i);
112 }
113}
114
115//____________________________________________________________________________
116void AliTRDQADataMaker::InitHits()
117{
118 // create Hits histograms in Hits subdir
119 const Int_t nhist = 4;
120 TH1D *hist[nhist];
121
122 hist[0] = new TH1D("qaTRD_hits_det", ";Detector Id of the hit", 540, -0.5, 539.5) ;
123
124 hist[1] = new TH1D("qaTRD_hist_Qdrift", ";Charge from tracks", 100, 0, 100);
125 hist[2] = new TH1D("qaTRD_hist_Qamp", ";Charge from TRD photon", 100, 0, 100);
126 hist[3] = new TH1D("qaTRD_hist_Qphoton", ";Charge from TRD photon", 100, 0, 100);
127
128 for(Int_t i=0; i<nhist; i++) {
129 //hist[i]->Sumw2();
130 Add2HitsList(hist[i], i);
131 }
132}
133
134//____________________________________________________________________________
135void AliTRDQADataMaker::InitDigits()
136{
137 // create Digits histograms in Digits subdir
138
139 const Int_t nhist = 3;
140 TH1D *hist[nhist];
141
142 hist[0] = new TH1D("qaTRD_digits_det", ";Detector Id of the digit", 540, -0.5, 539.5);
143 hist[1] = new TH1D("qaTRD_digits_time", ";Time bin", 40, -0.5, 39.5);
144 hist[2] = new TH1D("qaTRD_digits_amp", ";Amplitude", 100, 0, 100.);
145
146 for(Int_t i=0; i<nhist; i++) {
147 hist[i]->Sumw2();
148 Add2DigitsList(hist[i], i);
149 }
150
151}
152
153//____________________________________________________________________________
154void AliTRDQADataMaker::InitRecPoints()
155{
156 // create Reconstructed Points histograms in RecPoints subdir
01abcaa3 157 const Int_t nhist = 12;
158 TH1 *hist[nhist];
ffb5de4c 159
160 hist[0] = new TH1D("qaTRD_recPoints_det", ";Detector ID of the cluster", 540, -0.5, 539.5);
01abcaa3 161 hist[1] = new TH2D("qaTRD_recPoints_amp", ";Amplitude", 540, -0.5, 539, 200, -0.5, 199.5);
ffb5de4c 162 hist[2] = new TH1D("qaTRD_recPoints_npad", ";Number of Pads", 12, -0.5, 11.5);
01abcaa3 163
ffb5de4c 164 hist[3] = new TH1D("qaTRD_recPoints_dist2", ";residuals [2pad]", 100, -1, 1);
165 hist[4] = new TH1D("qaTRD_recPoints_dist3", ";residuals [3pad]", 100, -1, 1);
166 hist[5] = new TH1D("qaTRD_recPoints_dist4", ";residuals [4pad]", 100, -1, 1);
167 hist[6] = new TH1D("qaTRD_recPoints_dist5", ";residuals [5pad]", 100, -1, 1);
168
01abcaa3 169 hist[7] = new TH2D("qaTRD_recPoints_rowCol", ";row;col", 16, -0.5, 15.5, 145, -0.5, 144.5);
170 hist[8] = new TH1D("qaTRD_recPoints_time", ";time bin", 35, -0.5, 34.5);
171 hist[9] = new TH1D("qaTRD_recPoints_nCls", ";number of clusters", 500, -0.5, 499.5);
172
173 hist[10] = new TProfile("qaTRD_recPoints_sigTime", ";time bin;signal", 35, -0.5, 34.5, 0, 200, "");
174 hist[11] = new TProfile("qaTRD_recPoints_prf", ";distance;center of gravity", 120, -0.6, 0.6, -1.2, 1.2, "");
175
176 hist[12] = new TH1D("qaTRD_recPoints_ampDist", ";amplitude MPV", 100, 0, 100);
177
178
ffb5de4c 179 for(Int_t i=0; i<nhist; i++) {
180 //hist[i]->Sumw2();
181 Add2RecPointsList(hist[i], i);
182 }
183}
184
185//____________________________________________________________________________
186void AliTRDQADataMaker::InitRaws()
187{
188 // create Raws histograms in Raws subdir
189 const Int_t kSM = 18;
190 const Int_t nhist = 6+kSM;
191 TH1D *hist[nhist];
192
193 hist[0] = new TH1D("qaTRD_raws_det", ";detector", 540, -0.5, 539.5);
194 hist[1] = new TH1D("qaTRD_raws_sig", ";signal", 100, -0.5, 99.5);
195 hist[2] = new TH1D("qaTRD_raws_sigCentral", "; signal central bin", 100, -0.5, 99.5);
196 hist[3] = new TH1D("qaTRD_raws_sigTail", ";signal cluster", 100, -0.5, 99.5);
197 hist[4] = new TH1D("qaTRD_raws_tiemBin", ";time bin", 40, -0.5, 39.5);
198 hist[5] = new TH1D("qaTRD_rows_smId", ";supermodule", 18, -0.5, 17.5);
199
200 // one char per ADC chanell
201 const Int_t nADC = 30 * 8 * 16 * 22;
202 for(Int_t i=0; i<kSM; i++)
203 hist[6+i] = new TH1D(Form("qaTRD_raws_sm%d",i),"",nADC, -0.5, nADC-0.5);
204
205 for(Int_t i=0; i<nhist; i++) {
206 //hist[i]->Sumw2();
207 Add2RawsList(hist[i], i);
208 }
209}
210
211//____________________________________________________________________________
212void AliTRDQADataMaker::InitSDigits()
213{
214 // create SDigits histograms in SDigits subdir
215
01abcaa3 216 const Int_t nhist = 3;
ffb5de4c 217 TH1D *hist[nhist];
218
01abcaa3 219 hist[0] = new TH1D("qaTRD_sdigits_det", ";Detector Id of the digit", 540, -0.5, 539.5);
220 hist[1] = new TH1D("qaTRD_sdigits_time", ";Time bin", 40, -0.5, 39.5);
221 hist[2] = new TH1D("qaTRD_sdigits_amp", ";Amplitude", 100, 0, 1e7);
ffb5de4c 222
223 for(Int_t i=0; i<nhist; i++) {
224 hist[i]->Sumw2();
225 Add2SDigitsList(hist[i], i);
226 }
227}
228
229//____________________________________________________________________________
230void AliTRDQADataMaker::MakeESDs(AliESDEvent * esd)
231{
232 // make QA data from ESDs
01abcaa3 233 Int_t nTracks = esd->GetNumberOfTracks();
234 GetESDsData(0)->Fill(nTracks);
ffb5de4c 235
01abcaa3 236 // track loop
237 for(Int_t i=0; i<nTracks; i++) {
238
239 AliESDtrack *track = esd->GetTrack(i);
240 const AliExternalTrackParam *paramOut = track->GetOuterParam();
241 const AliExternalTrackParam *paramIn = track->GetInnerParam();
242
243 // long track ..
244 if (!paramIn) continue;
245 if (!paramOut) continue;
246
247 // not a kink
248 if (track->GetKinkIndex(0) > 0) continue;
249
250 Double_t extZ = GetExtZ(paramIn);
251 if (TMath::Abs(extZ) > 320) continue; // acceptance cut
252
253 // .. in the acceptance
254 Int_t sector = GetSector(paramOut->GetAlpha());
255 GetESDsData(1)->Fill(sector);
256
257 UInt_t u = 1;
258 UInt_t status = track->GetStatus();
259 for(Int_t bit=0; bit<32; bit++)
260 if (u<<bit & status) GetESDsData(2)->Fill(bit);
261
262 const Int_t knbits = 6;
263 Int_t bit[6] = {0,0,0,0,0,0};
264 bit[0] = status & AliESDtrack::kTPCin;
265 bit[1] = status & AliESDtrack::kTPCout;
266 bit[2] = (status & AliESDtrack::kTPCout) && !(status & AliESDtrack::kTRDout);
267 bit[3] = status & AliESDtrack::kTRDout;
268 bit[4] = status & AliESDtrack::kTRDrefit;
269 bit[5] = (status & AliESDtrack::kTRDout) && !(status & AliESDtrack::kTRDrefit);
270
271 // transverse momentum
272 //const Double_t *val = paramOut->GetParameter(); // parameters at the Outer plane
273 Double_t pt = paramOut->Pt(); //1./TMath::Abs(val[4]);
274
275 for(Int_t b=0; b<knbits; b++) {
276 if (bit[b]) {
f75c4b05 277 GetESDsData(2*b+3)->Fill(pt);
278 GetESDsData(2*b+4)->Fill(extZ);
01abcaa3 279 }
280 }
281
282 // clusters
283 for(Int_t b=0; b<3; b++)
284 if (bit[3+b]) GetESDsData(b+15)->Fill(track->GetTRDncls());
285
286 // refitted only
287 if (!bit[4]) continue;
288
289 //fQuality->Fill(track->GetTRDQuality());
290 //fBudget->Fill(track->GetTRDBudget());
291 //fSignal->Fill(track->GetTRDsignal());
292
293 GetESDsData(18)->Fill(track->GetP(), track->GetTRDsignal());
294
295 /*
296 // PID only
297 if (status & AliESDtrack::kTRDpid) {
298
299 for(Int_t l=0; l<6; l++) fTime->Fill(track->GetTRDTimBin(l));
300
301 // fill pid histograms
302 Double_t trdr0 = 0; //, tpcr0 = 0;
303 Int_t trdBestPid = 5; //, tpcBestPid = 5; // charged
304 const Double_t kminPidValue = 0.9;
305
306 //Double_t pp[5];
307 //track->GetTPCpid(pp); // ESD inconsequence
308
309 for(Int_t pid=0; pid<5; pid++) {
310
311 trdr0 += track->GetTRDpid(pid);
312 //tpcr0 += pp[pid];
313
314 fTrdPID[pid]->Fill(track->GetTRDpid(pid));
315 //fTpcPID[pid]->Fill(pp[pid]);
316
317 if (track->GetTRDpid(pid) > kminPidValue) trdBestPid = pid;
318 //if (pp[pid] > kminPidValue) tpcBestPid = pid;
319 }
320
321 fTrdPID[5]->Fill(trdr0); // check unitarity
322 fTrdSigMomPID[trdBestPid]->Fill(track->GetP(), track->GetTRDsignal());
323
324 //fTpcPID[5]->Fill(tpcr0); // check unitarity
325 //fTpcSigMomPID[tpcBestPid]->Fill(track->GetP(), track->GetTPCsignal());
326 }
327 */
328
329 }
330
ffb5de4c 331
ffb5de4c 332
01abcaa3 333}
334
335//______________________________________________________________________________
336Int_t AliTRDQADataMaker::GetSector(const Double_t alpha) const {
337 // Gets the sector number
338
339 Double_t size = TMath::DegToRad() * 20.; // shall use TRDgeo
340 Int_t sector = (Int_t)((alpha + TMath::Pi())/size);
341 return sector;
342}
343
344//______________________________________________________________________________
345Double_t AliTRDQADataMaker::GetExtZ(const AliExternalTrackParam *in) const {
346 //
347 // returns the Z position at the entry to TRD
348 // using parameters from the TPC in
349 //
350
351 const Double_t x0 = 300;
352
353 Double_t x = in->GetX();
354 const Double_t *par = in->GetParameter();
355 Double_t theta = par[3];
356 Double_t z = in->GetZ();
357
358 Double_t zz = z + (x0-x) * TMath::Tan(theta);
359 return zz;
ffb5de4c 360}
361
362//____________________________________________________________________________
363void AliTRDQADataMaker::MakeHits(TClonesArray * hits)
364{
365 //make QA data from Hits
366 //printf("making QA for TRD hits from an array %d\n", hits->GetEntriesFast());
367
368 TIter next(hits);
369 AliTRDhit * hit;
370
371 while ( (hit = dynamic_cast<AliTRDhit *>(next())) ) {
372 GetHitsData(0)->Fill(hit->GetDetector());
373 Double_t q = TMath::Abs(hit->GetCharge());
374
375 if (hit->FromDrift()) GetHitsData(1)->Fill(q);
376 if (hit->FromAmplification()) GetHitsData(2)->Fill(q);
377 if (hit->FromTRphoton()) GetHitsData(3)->Fill(q);
378 }
379
380}
01abcaa3 381
ffb5de4c 382//____________________________________________________________________________
383void AliTRDQADataMaker::MakeHits(TTree * hitTree)
384{
385 //make QA data from Hits
386 //printf("making QA for TRD hits from a tree\n");
387
388 if (!CheckPointer(hitTree, "TRD hits tree")) return;
389
390 TBranch *branch = hitTree->GetBranch("TRD");
391 if (!CheckPointer(branch, "TRD hits branch")) return;
392
393 Int_t nhits = (Int_t)(hitTree->GetTotBytes()/sizeof(AliTRDhit));
394 TClonesArray *hits = new TClonesArray("AliTRDhit", nhits+1000);
395 TClonesArray *tmp = new TClonesArray("AliTRDhit", 1000);
396 branch->SetAddress(&tmp);
397
398 Int_t index = 0;
399 Int_t nEntries = (Int_t)branch->GetEntries();
400 for(Int_t i = 0; i < nEntries; i++) {
401 branch->GetEntry(i);
402 Int_t nHits = (Int_t)tmp->GetEntries();
403 for(Int_t j=0; j<nHits; j++) {
404 AliTRDhit *hit = (AliTRDhit*)tmp->At(j);
405 new((*hits)[index++]) AliTRDhit(*hit);
406 }
407 }
408
409 tmp->Delete();
410 delete tmp;
411 MakeHits(hits);
412}
01abcaa3 413
ffb5de4c 414//____________________________________________________________________________
415void AliTRDQADataMaker::MakeDigits(TClonesArray * digits)
416{
417 // makes data from Digits
418
419 TIter next(digits) ;
420 AliTRDdigit * digit ;
421 while ( (digit = dynamic_cast<AliTRDdigit *>(next())) ) {
422 GetDigitsData(0)->Fill(digit->GetDetector());
423 GetDigitsData(1)->Fill(digit->GetTime());
424 GetDigitsData(2)->Fill(digit->GetAmp());
425 }
426}
427
01abcaa3 428//____________________________________________________________________________
429void AliTRDQADataMaker::MakeDigits(TTree * digits)
430{
431
432 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
433 digitsManager->CreateArrays();
434 digitsManager->ReadDigits(digits);
435
436 for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
437
438 AliTRDdataArrayI *digitsIn = digitsManager->GetDigits(i);
439
440 // This is to take care of switched off super modules
441 if (digitsIn->GetNtime() == 0) continue;
442
443 digitsIn->Expand();
444
445 //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
446 //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
447
448 Int_t nRows = digitsIn->GetNrow();
449 Int_t nCols = digitsIn->GetNcol();
450 Int_t nTbins = digitsIn->GetNtime();
451
452 for(Int_t row = 0; row < nRows; row++)
453 for(Int_t col = 0; col < nCols; col++)
454 for(Int_t time = 0; time < nTbins; time++) {
455
456 Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
457 GetDigitsData(0)->Fill(i);
458 GetDigitsData(1)->Fill(time);
459 GetDigitsData(2)->Fill(signal);
460 }
461
462 //delete digitsIn;
463 }
464 delete digitsManager;
465}
466
ffb5de4c 467//____________________________________________________________________________
468void AliTRDQADataMaker::MakeSDigits(TClonesArray * sdigits)
469{
470 // makes data from Digits
471
472 TIter next(sdigits) ;
473 AliTRDdigit * digit ;
474 while ( (digit = dynamic_cast<AliTRDdigit *>(next())) ) {
475 GetDigitsData(0)->Fill(digit->GetDetector());
01abcaa3 476 GetDigitsData(1)->Fill(digit->GetTime());
477 GetDigitsData(2)->Fill(digit->GetAmp());
ffb5de4c 478 }
479}
480
01abcaa3 481//____________________________________________________________________________
482void AliTRDQADataMaker::MakeSDigits(TTree * digits)
483{
484
485 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
486 digitsManager->CreateArrays();
487 digitsManager->ReadDigits(digits);
488
489 for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) {
490
491 AliTRDdataArrayI *digitsIn = digitsManager->GetDigits(i);
492
493 // This is to take care of switched off super modules
494 if (digitsIn->GetNtime() == 0) continue;
495
496 digitsIn->Expand();
497
498 //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
499 //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
500
501 Int_t nRows = digitsIn->GetNrow();
502 Int_t nCols = digitsIn->GetNcol();
503 Int_t nTbins = digitsIn->GetNtime();
504
505 for(Int_t row = 0; row < nRows; row++)
506 for(Int_t col = 0; col < nCols; col++)
507 for(Int_t time = 0; time < nTbins; time++) {
508
509 Float_t signal = digitsIn->GetDataUnchecked(row,col,time);
510 if (signal <= 0) continue;
511 GetSDigitsData(0)->Fill(i);
512 GetSDigitsData(1)->Fill(time);
513 GetSDigitsData(2)->Fill(signal);
514 }
515
516 // delete digitsIn;
517 }
518
519 delete digitsManager;
520}
521
ffb5de4c 522//____________________________________________________________________________
523void AliTRDQADataMaker::MakeRaws(AliRawReader* rawReader)
524{
525 // 157
526 // T9 -- T10
527
01abcaa3 528 //const Int_t kSM = 18;
ffb5de4c 529 //const Int_t kROC = 30;
ffb5de4c 530 //const Int_t kLayer = 6;
531 //const Int_t kStack = 5;
01abcaa3 532 const Int_t kROB = 8;
ffb5de4c 533 const Int_t kMCM = 16;
534 const Int_t kADC = 22;
535
536 AliTRDRawStreamV2 *raw = new AliTRDRawStreamV2(rawReader);
537
538 raw->SetRawVersion(3);
539 raw->Init();
540
541 while (raw->Next()) {
542
543 GetRawsData(0)->Fill(raw->GetDet());
544
545 Int_t *sig = raw->GetSignals();
546 for(Int_t i=0; i<3; i++) GetRawsData(1)->Fill(sig[i]);
547
548 GetRawsData(2)->Fill(sig[1]);
549 GetRawsData(3)->Fill(sig[0]);
550 GetRawsData(3)->Fill(sig[2]);
551
552 GetRawsData(4)->Fill(raw->GetTimeBin());
553
554 // calculate the index;
555 Int_t sm = raw->GetSM();
556 Int_t roc = raw->GetROC();
557 Int_t rob = raw->GetROB();
558 Int_t mcm = raw->GetMCM();
559 Int_t adc = raw->GetADC();
560
561 Int_t index = roc * (kROB*kMCM*kADC) + rob * (kMCM*kADC) + mcm * kADC + adc;
562 GetRawsData(5)->Fill(sm);
563 //printf("SM = %d\n", sm);
564 GetRawsData(6+sm)->Fill(index);
565 }
566}
567
568//____________________________________________________________________________
569void AliTRDQADataMaker::MakeRecPoints(TTree * clustersTree)
570{
571
572 // makes data from RecPoints
573 //
574
575 Int_t nsize = Int_t(clustersTree->GetTotBytes() / (sizeof(AliTRDcluster)));
576 TObjArray *clusterArray = new TObjArray(nsize+1000);
577
578 TBranch *branch = clustersTree->GetBranch("TRDcluster");
579 if (!branch) {
580 AliError("Can't get the branch !");
581 return;
582 }
583 branch->SetAddress(&clusterArray);
584
585 // Loop through all entries in the tree
586 Int_t nEntries = (Int_t) clustersTree->GetEntries();
587 Int_t nbytes = 0;
588 AliTRDcluster *c = 0;
01abcaa3 589 Int_t nDet[540];
590 for (Int_t i=0; i<540; i++) nDet[i] = 0;
ffb5de4c 591
592 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
593
594 // Import the tree
595 nbytes += clustersTree->GetEvent(iEntry);
596
597 // Get the number of points in the detector
598 Int_t nCluster = clusterArray->GetEntriesFast();
599
600 // Loop through all TRD digits
601 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
602 c = (AliTRDcluster *) clusterArray->UncheckedAt(iCluster);
603
01abcaa3 604 Int_t iDet = c->GetDetector();
605 nDet[iDet]++;
606 GetRecPointsData(0)->Fill(iDet);
607 GetRecPointsData(1)->Fill(iDet, c->GetQ());
ffb5de4c 608 GetRecPointsData(2)->Fill(c->GetNPads());
609 if (c->GetNPads() < 6)
610 GetRecPointsData(1+c->GetNPads())->Fill(c->GetCenter());
01abcaa3 611
612 //if (c->GetPadTime() < 5)
613 ((TH2D*)GetRecPointsData(7))->Fill(c->GetPadRow(), c->GetPadCol());
614 GetRecPointsData(8)->Fill(c->GetPadTime());
615
616 ((TProfile*)GetRecPointsData(10))->Fill(c->GetPadTime(), c->GetQ());
617
618 // PRF for 2pad
619 //if (c->GetNPads() == 2) {
620 Short_t *sig = c->GetSignals();
621 Double_t frac = -10;
622
623 if (sig[0] == 0 && sig[1] == 0 && sig[2] == 0 && sig[5] == 0 && sig[6] == 0)
624 frac = 1. * sig[4] / (sig[3] + sig[4]);
625
626
627 if (sig[0] == 0 && sig[1] == 0 && sig[4] == 0 && sig[5] == 0 && sig[6] == 0)
628 frac = -1. * sig[2] / (sig[2] + sig[3]);
629
630 if (frac > -10) ((TProfile*)GetRecPointsData(11))->Fill(c->GetCenter(), frac);
631
632 //}
ffb5de4c 633 }
634 }
635
01abcaa3 636 for(Int_t i=0; i<540; i++)
637 if (nDet[i] > 0) GetRecPointsData(9)->Fill(nDet[i]);
638
639
ffb5de4c 640 delete clusterArray;
641}
642
643//____________________________________________________________________________
644void AliTRDQADataMaker::StartOfDetectorCycle()
645{
646 //Detector specific actions at start of cycle
647
648}
01abcaa3 649
ffb5de4c 650//__________________________________________________________________________
651Int_t AliTRDQADataMaker::CheckPointer(TObject *obj, const char *name) {
652
653 if (!obj) AliWarning(Form("null pointer: %s", name));
654 return !!obj;
655}
656//__________________________________________________________________________