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