]>
Commit | Line | Data |
---|---|---|
380c04bf | 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 | **************************************************************************/ | |
8fd6fd6c | 15 | |
16 | /////////////////////////////////////////////////////////////////////// | |
17 | // // | |
18 | // Produces the data needed to calculate the TOF quality assurance. // | |
19 | // QA objects are 1 & 2 Dimensional histograms. // | |
20 | // author: S.Arcelli // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////// | |
380c04bf | 23 | |
24 | #include <TClonesArray.h> | |
25 | #include <TFile.h> | |
26 | #include <TH1I.h> | |
27 | #include <TH1F.h> | |
28 | #include <TH2F.h> | |
29 | #include "AliESDEvent.h" | |
30 | #include "AliESDtrack.h" | |
31 | #include "AliTOFcluster.h" | |
32 | #include "AliTOFdigit.h" | |
33 | #include "AliTOFSDigit.h" | |
34 | #include "AliTOFhitT0.h" | |
35 | #include "AliTOFQADataMaker.h" | |
693a790d | 36 | #include "AliQAChecker.h" |
380c04bf | 37 | #include "AliRawReader.h" |
38 | #include "AliTOFRawStream.h" | |
39 | #include "AliTOFrawData.h" | |
40 | #include "AliLog.h" | |
41 | ||
42 | ClassImp(AliTOFQADataMaker) | |
43 | ||
44 | //____________________________________________________________________________ | |
45 | AliTOFQADataMaker::AliTOFQADataMaker() : | |
97430dfe | 46 | AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"), |
47 | fTOFRawStream(AliTOFRawStream()) | |
380c04bf | 48 | { |
49 | // | |
50 | // ctor | |
51 | // | |
52 | } | |
53 | ||
54 | //____________________________________________________________________________ | |
55 | AliTOFQADataMaker::AliTOFQADataMaker(const AliTOFQADataMaker& qadm) : | |
97430dfe | 56 | AliQADataMaker(), |
57 | fTOFRawStream(AliTOFRawStream(qadm.fTOFRawStream)) | |
380c04bf | 58 | { |
59 | // | |
60 | //copy ctor | |
61 | // | |
62 | SetName((const char*)qadm.GetName()) ; | |
63 | SetTitle((const char*)qadm.GetTitle()); | |
64 | } | |
65 | ||
66 | //__________________________________________________________________ | |
67 | AliTOFQADataMaker& AliTOFQADataMaker::operator = (const AliTOFQADataMaker& qadm ) | |
68 | { | |
69 | // | |
70 | // assignment operator. | |
71 | // | |
72 | this->~AliTOFQADataMaker(); | |
73 | new(this) AliTOFQADataMaker(qadm); | |
74 | return *this; | |
75 | } | |
76 | ||
77 | //____________________________________________________________________________ | |
78 | void AliTOFQADataMaker::InitHits() | |
79 | { | |
80 | // | |
81 | // create Hits histograms in Hits subdir | |
82 | // | |
135306ea | 83 | |
84 | Bool_t expert = kFALSE; | |
85 | ||
5561a41b | 86 | TH1F * h0 = new TH1F("hTOFHits", "Number of TOF Hits ",301, -1.02, 5.) ; |
380c04bf | 87 | h0->Sumw2() ; |
5561a41b | 88 | h0->GetXaxis()->SetTitle("TOF hit number [10 power]"); |
135306ea | 89 | Add2HitsList(h0, 0, expert) ; |
380c04bf | 90 | |
5561a41b | 91 | TH1F * h1 = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns)", 2000, 0., 200) ; |
380c04bf | 92 | h1->Sumw2() ; |
5561a41b | 93 | h1->GetXaxis()->SetTitle("Simulated TOF time [ns]"); |
135306ea | 94 | Add2HitsList(h1, 1, expert) ; |
380c04bf | 95 | |
5561a41b | 96 | TH1F * h2 = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ; |
380c04bf | 97 | h2->Sumw2() ; |
5561a41b | 98 | h2->GetXaxis()->SetTitle("Track length from primary vertex till hit TOF pad [cm]"); |
135306ea | 99 | Add2HitsList(h2, 2, expert) ; |
380c04bf | 100 | |
5561a41b | 101 | TH2F * h3 = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; |
380c04bf | 102 | h3->Sumw2() ; |
5561a41b | 103 | h3->GetXaxis()->SetTitle("2*strip+padz (eta)"); |
104 | h3->GetYaxis()->SetTitle("48*sector+padx (phi)"); | |
105 | h3->GetYaxis()->SetTitleOffset(1.15); | |
135306ea | 106 | Add2HitsList(h3, 3, expert) ; |
380c04bf | 107 | } |
108 | ||
109 | //____________________________________________________________________________ | |
110 | void AliTOFQADataMaker::InitDigits() | |
111 | { | |
112 | // | |
113 | // create Digits histograms in Digits subdir | |
114 | // | |
135306ea | 115 | |
116 | Bool_t expert = kFALSE; | |
117 | ||
5561a41b | 118 | TH1F * h0 = new TH1F("hTOFDigits", "Number of TOF Digits ",301, -1.02, 5.) ; |
119 | h0->Sumw2() ; | |
120 | h0->GetXaxis()->SetTitle("TOF digit number [10 power]"); | |
135306ea | 121 | Add2DigitsList(h0, 0, expert) ; |
380c04bf | 122 | |
5561a41b | 123 | TH1F * h1 = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns)", 2000, 0., 200) ; |
380c04bf | 124 | h1->Sumw2() ; |
5561a41b | 125 | h1->GetXaxis()->SetTitle("Digitized TOF time [ns]"); |
135306ea | 126 | Add2DigitsList(h1, 1, expert) ; |
380c04bf | 127 | |
5561a41b | 128 | TH1F * h2 = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns)", 500, 0., 50) ; |
380c04bf | 129 | h2->Sumw2() ; |
5561a41b | 130 | h2->GetXaxis()->SetTitle("Digitized TOT [ns]"); |
131 | h2->GetYaxis()->SetTitle("Digitized TOF time [ns]"); | |
135306ea | 132 | Add2DigitsList(h2, 2, expert) ; |
380c04bf | 133 | |
5561a41b | 134 | TH2F * h3 = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; |
380c04bf | 135 | h3->Sumw2() ; |
5561a41b | 136 | h3->GetXaxis()->SetTitle("2*strip+padz (eta)"); |
137 | h3->GetYaxis()->SetTitle("48*sector+padx (phi)"); | |
138 | h3->GetYaxis()->SetTitleOffset(1.15); | |
135306ea | 139 | Add2DigitsList(h3, 3, expert) ; |
380c04bf | 140 | |
141 | } | |
142 | ||
143 | //____________________________________________________________________________ | |
144 | void AliTOFQADataMaker::InitSDigits() | |
145 | { | |
146 | // | |
147 | // create SDigits histograms in SDigits subdir | |
148 | // | |
135306ea | 149 | |
150 | Bool_t expert = kFALSE; | |
151 | ||
5561a41b | 152 | TH1F * h0 = new TH1F("hTOFSDigits", "Number of TOF SDigits ",301, -1.02, 5.) ; |
153 | h0->Sumw2() ; | |
154 | h0->GetXaxis()->SetTitle("TOF sdigit number [10 power]"); | |
135306ea | 155 | Add2SDigitsList(h0, 0, expert) ; |
380c04bf | 156 | |
5561a41b | 157 | TH1F * h1 = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns)", 2000, 0., 200) ; |
380c04bf | 158 | h1->Sumw2() ; |
5561a41b | 159 | h1->GetXaxis()->SetTitle("SDigitized TOF time [ns]"); |
135306ea | 160 | Add2SDigitsList(h1, 1, expert) ; |
380c04bf | 161 | |
5561a41b | 162 | TH2F * h2 = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; |
380c04bf | 163 | h2->Sumw2() ; |
5561a41b | 164 | h2->GetXaxis()->SetTitle("2*strip+padz (eta)"); |
165 | h2->GetYaxis()->SetTitle("48*sector+padx (phi)"); | |
166 | h2->GetYaxis()->SetTitleOffset(1.15); | |
135306ea | 167 | Add2SDigitsList(h2, 2, expert) ; |
380c04bf | 168 | |
169 | } | |
170 | ||
171 | //____________________________________________________________________________ | |
172 | void AliTOFQADataMaker::InitRaws() | |
173 | { | |
174 | // | |
175 | // create Raws histograms in Raws subdir | |
176 | // | |
135306ea | 177 | |
178 | Bool_t expert = kFALSE; | |
179 | ||
5561a41b | 180 | TH1F * h0 = new TH1F("hTOFRaws", "Number of TOF Raws ",301, -1.02, 5.) ; |
181 | h0->Sumw2() ; | |
182 | h0->GetXaxis()->SetTitle("TOF raw number [10 power]"); | |
135306ea | 183 | Add2RawsList(h0, 0, expert) ; |
380c04bf | 184 | |
0a2a478c | 185 | TH1F * h1 = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 20000, 0., 2000) ; |
380c04bf | 186 | h1->Sumw2() ; |
5561a41b | 187 | h1->GetXaxis()->SetTitle("Measured TOF time [ns]"); |
135306ea | 188 | Add2RawsList(h1, 1, expert) ; |
380c04bf | 189 | |
5561a41b | 190 | TH1F * h2 = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns)", 500, 0., 50) ; |
380c04bf | 191 | h2->Sumw2() ; |
5561a41b | 192 | h2->GetXaxis()->SetTitle("Measured TOT [ns]"); |
193 | h2->GetYaxis()->SetTitle("Measured TOF time [ns]"); | |
135306ea | 194 | Add2RawsList(h2, 2, expert) ; |
380c04bf | 195 | |
5561a41b | 196 | TH2F * h3 = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; |
380c04bf | 197 | h3->Sumw2() ; |
5561a41b | 198 | h3->GetXaxis()->SetTitle("2*strip+padz (eta)"); |
199 | h3->GetYaxis()->SetTitle("48*sector+padx (phi)"); | |
200 | h3->GetYaxis()->SetTitleOffset(1.15); | |
135306ea | 201 | Add2RawsList(h3, 3, expert) ; |
380c04bf | 202 | |
203 | } | |
204 | ||
205 | //____________________________________________________________________________ | |
206 | void AliTOFQADataMaker::InitRecPoints() | |
207 | { | |
208 | // | |
209 | // create RecPoints histograms in RecPoints subdir | |
210 | // | |
135306ea | 211 | |
212 | Bool_t expert = kFALSE; | |
213 | ||
5561a41b | 214 | TH1F * h0 = new TH1F("hTOFRecPoints", "Number of TOF RecPoints ",301, -1.02, 5.) ; |
215 | h0->Sumw2() ; | |
216 | h0->GetXaxis()->SetTitle("TOF recPoint number [10 power]"); | |
135306ea | 217 | Add2RecPointsList(h0, 0, expert) ; |
380c04bf | 218 | |
0a2a478c | 219 | TH1F * h1 = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 20000, 0., 2000) ; |
380c04bf | 220 | h1->Sumw2() ; |
5561a41b | 221 | h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]"); |
135306ea | 222 | Add2RecPointsList(h1, 1, expert) ; |
380c04bf | 223 | |
0a2a478c | 224 | TH1F * h2 = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ; |
380c04bf | 225 | h2->Sumw2() ; |
5561a41b | 226 | h2->GetXaxis()->SetTitle("Measured TOT [ns]"); |
227 | h2->GetYaxis()->SetTitle("Measured TOF time [ns]"); | |
135306ea | 228 | Add2RecPointsList(h2, 2, expert) ; |
380c04bf | 229 | |
5561a41b | 230 | TH1F * h3 = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ; |
380c04bf | 231 | h3->Sumw2() ; |
5561a41b | 232 | h3->GetXaxis()->SetTitle("Measured TOT [ns]"); |
135306ea | 233 | Add2RecPointsList(h3, 3, expert) ; |
380c04bf | 234 | |
5561a41b | 235 | TH2F * h4 = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta",183, -0.5, 182.5,865,-0.5,864.5) ; |
380c04bf | 236 | h4->Sumw2() ; |
0ea3c44e | 237 | h4->GetXaxis()->SetTitle("2*strip+padz (eta)"); |
238 | h4->GetYaxis()->SetTitle("48*sector+padx (phi)"); | |
5561a41b | 239 | h4->GetYaxis()->SetTitleOffset(1.15); |
135306ea | 240 | Add2RecPointsList(h4, 4, expert) ; |
380c04bf | 241 | |
242 | } | |
243 | ||
244 | //____________________________________________________________________________ | |
245 | void AliTOFQADataMaker::InitESDs() | |
246 | { | |
247 | // | |
248 | //create ESDs histograms in ESDs subdir | |
249 | // | |
135306ea | 250 | |
251 | Bool_t expert = kFALSE; | |
252 | ||
5561a41b | 253 | TH1F * h0 = new TH1F("hTOFESDs", "Number of matched TOF tracks over ESDs", 250, -1., 4.) ; |
380c04bf | 254 | h0->Sumw2() ; |
5561a41b | 255 | h0->GetXaxis()->SetTitle("Number of TOF matched ESD tracks [10 power]"); |
135306ea | 256 | Add2ESDsList(h0, 0, expert) ; |
380c04bf | 257 | |
0a2a478c | 258 | TH1F * h1 = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 20000, 0., 2000) ; |
380c04bf | 259 | h1->Sumw2() ; |
5561a41b | 260 | h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]"); |
135306ea | 261 | Add2ESDsList(h1, 1, expert) ; |
380c04bf | 262 | |
0a2a478c | 263 | TH1F * h2 = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ; |
380c04bf | 264 | h2->Sumw2() ; |
5561a41b | 265 | h2->GetXaxis()->SetTitle("Measured TOF time [ns]"); |
135306ea | 266 | Add2ESDsList(h2, 2, expert) ; |
380c04bf | 267 | |
5561a41b | 268 | TH1F * h3 = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ; |
380c04bf | 269 | h3->Sumw2() ; |
5561a41b | 270 | h3->GetXaxis()->SetTitle("Measured TOT [ns]"); |
135306ea | 271 | Add2ESDsList(h3, 3, expert) ; |
380c04bf | 272 | |
5561a41b | 273 | TH1F * h4 = new TH1F("hTOFESDsPID", "Fraction of matched TOF tracks with good PID flag", 101, 0., 101.) ; |
274 | h4->Sumw2() ; | |
275 | h4->GetXaxis()->SetTitle("Fraction of TOF matched ESD tracks with good flag [%]"); | |
135306ea | 276 | Add2ESDsList(h4, 4, expert) ; |
380c04bf | 277 | } |
278 | ||
279 | ||
280 | //____________________________________________________________________________ | |
281 | void AliTOFQADataMaker::MakeHits(TClonesArray * hits) | |
282 | { | |
283 | // | |
284 | //make QA data from Hits | |
285 | // | |
286 | ||
287 | Int_t in[5]; | |
288 | Int_t out[5]; | |
289 | ||
290 | Int_t nentries=hits->GetEntriesFast(); | |
c332d0d1 | 291 | if(nentries<=0) { |
ed77256d | 292 | GetHitsData(0)->Fill(-1.) ; |
293 | } else{ | |
294 | GetHitsData(0)->Fill(TMath::Log10(nentries)) ; | |
295 | } | |
380c04bf | 296 | TIter next(hits) ; |
297 | AliTOFhitT0 * hit ; | |
298 | while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) { | |
299 | ||
300 | GetHitsData(1)->Fill( hit->GetTof()*1.E9) ;//in ns | |
301 | GetHitsData(2)->Fill( hit->GetLen()) ;//in cm | |
302 | ||
303 | in[0] = hit->GetSector(); | |
304 | in[1] = hit->GetPlate(); | |
305 | in[2]= hit->GetStrip(); | |
306 | in[3]= hit->GetPadx(); | |
307 | in[4]= hit->GetPadz(); | |
308 | GetMapIndeces(in,out); | |
309 | GetHitsData(3)->Fill( out[0],out[1]) ;//hit map | |
310 | } | |
311 | ||
312 | } | |
313 | ||
314 | ||
315 | //____________________________________________________________________________ | |
316 | void AliTOFQADataMaker::MakeHits(TTree * hitTree) | |
317 | { | |
318 | // | |
319 | // make QA data from Hit Tree | |
320 | // | |
321 | if(!hitTree){ | |
322 | AliError("can't get the tree with TOF hits !"); | |
323 | return; | |
324 | } | |
325 | ||
326 | TBranch * branch = hitTree->GetBranch("TOF") ; | |
327 | ||
328 | if (!branch ) { | |
329 | AliError("TOF branch in Hit Tree not found") ; | |
330 | return; | |
331 | } | |
332 | ||
333 | TClonesArray * hits = new TClonesArray("AliTOFhitT0", 1000); | |
334 | TClonesArray * dummy = new TClonesArray("AliTOFhitT0", 1000); | |
335 | branch->SetAddress(&dummy); | |
336 | Int_t index = 0 ; | |
337 | for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) { | |
338 | branch->GetEntry(ientry) ; | |
339 | for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) { | |
340 | AliTOFhitT0 * hit = dynamic_cast<AliTOFhitT0 *> (dummy->At(ihit)) ; | |
341 | new((*hits)[index]) AliTOFhitT0(*hit) ; | |
342 | index++ ; | |
343 | } | |
344 | } | |
345 | ||
346 | dummy->Delete(); | |
347 | delete dummy; | |
348 | MakeHits(hits) ; | |
349 | ||
350 | } | |
351 | ||
352 | //____________________________________________________________________________ | |
353 | void AliTOFQADataMaker::MakeDigits(TClonesArray * digits) | |
354 | { | |
355 | // | |
356 | // makes data from Digits | |
357 | // | |
358 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; | |
359 | Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3; | |
360 | Int_t in[5]; | |
361 | Int_t out[5]; | |
362 | ||
363 | Int_t nentries=digits->GetEntriesFast(); | |
c332d0d1 | 364 | if(nentries<=0){ |
ed77256d | 365 | GetDigitsData(0)->Fill(-1.) ; |
366 | }else{ | |
367 | GetDigitsData(0)->Fill(TMath::Log10(nentries)) ; | |
368 | } | |
369 | ||
380c04bf | 370 | TIter next(digits) ; |
371 | AliTOFdigit * digit ; | |
372 | while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) { | |
373 | ||
374 | GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns | |
375 | GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns | |
376 | ||
377 | in[0] = digit->GetSector(); | |
378 | in[1] = digit->GetPlate(); | |
379 | in[2] = digit->GetStrip(); | |
380 | in[3] = digit->GetPadx(); | |
381 | in[4]= digit->GetPadz(); | |
382 | GetMapIndeces(in,out); | |
383 | GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map | |
384 | } | |
385 | ||
386 | } | |
387 | ||
388 | ||
389 | //____________________________________________________________________________ | |
390 | void AliTOFQADataMaker::MakeDigits(TTree * digitTree) | |
391 | { | |
392 | // | |
393 | // makes data from Digit Tree | |
394 | // | |
395 | TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ; | |
396 | ||
397 | TBranch * branch = digitTree->GetBranch("TOF") ; | |
398 | if ( ! branch ) { | |
399 | AliError("TOF branch in Digit Tree not found") ; | |
400 | return; | |
401 | } | |
402 | branch->SetAddress(&digits) ; | |
403 | branch->GetEntry(0) ; | |
404 | MakeDigits(digits) ; | |
405 | } | |
406 | ||
407 | //____________________________________________________________________________ | |
408 | void AliTOFQADataMaker::MakeSDigits(TClonesArray * sdigits) | |
409 | { | |
410 | // | |
411 | // makes data from SDigits | |
412 | // | |
413 | ||
414 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; | |
415 | Int_t in[5]; | |
416 | Int_t out[5]; | |
417 | ||
418 | Int_t nentries=sdigits->GetEntriesFast(); | |
c332d0d1 | 419 | if(nentries<=0){ |
ed77256d | 420 | GetSDigitsData(0)->Fill(-1.) ; |
421 | }else{ | |
422 | GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ; | |
423 | } | |
380c04bf | 424 | |
425 | TIter next(sdigits) ; | |
426 | AliTOFSDigit * sdigit ; | |
427 | while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) { | |
428 | ||
429 | for(Int_t i=0;i<sdigit->GetNDigits();i++){ | |
430 | GetSDigitsData(1)->Fill( sdigit->GetTdc(i)*tdc2ns) ;//in ns | |
431 | } | |
432 | ||
433 | in[0] = sdigit->GetSector(); | |
434 | in[1] = sdigit->GetPlate(); | |
435 | in[2] = sdigit->GetStrip(); | |
436 | in[3] = sdigit->GetPadx(); | |
437 | in[4]= sdigit->GetPadz(); | |
438 | GetMapIndeces(in,out); | |
439 | GetSDigitsData(2)->Fill( out[0],out[1]) ;//sdigit map | |
440 | } | |
441 | } | |
442 | ||
443 | //____________________________________________________________________________ | |
444 | void AliTOFQADataMaker::MakeSDigits(TTree * sdigitTree) | |
445 | { | |
446 | // | |
447 | // makes data from SDigit Tree | |
448 | // | |
449 | TClonesArray * sdigits = new TClonesArray("AliTOFSDigit", 1000) ; | |
450 | ||
451 | TBranch * branch = sdigitTree->GetBranch("TOF") ; | |
452 | if ( ! branch ) { | |
453 | AliError("TOF branch in SDigit Tree not found") ; | |
454 | return; | |
455 | } | |
456 | branch->SetAddress(&sdigits) ; | |
457 | branch->GetEntry(0) ; | |
458 | MakeSDigits(sdigits) ; | |
459 | } | |
460 | ||
461 | //____________________________________________________________________________ | |
462 | void AliTOFQADataMaker::MakeRaws(AliRawReader* rawReader) | |
463 | { | |
464 | // | |
465 | // makes data from Raws | |
466 | // | |
467 | ||
468 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; | |
469 | Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3; | |
470 | ||
471 | ||
472 | Int_t ntof = 0 ; | |
473 | Int_t in[5]; | |
474 | Int_t out[5]; | |
475 | ||
476 | TClonesArray * clonesRawData; | |
97430dfe | 477 | //AliTOFRawStream tofInput(rawReader); |
478 | fTOFRawStream.SetRawReader(rawReader); | |
380c04bf | 479 | for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){ |
480 | rawReader->Reset(); | |
97430dfe | 481 | fTOFRawStream.LoadRawData(iDDL); |
482 | clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData(); | |
380c04bf | 483 | for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) { |
484 | AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); | |
5561a41b | 485 | //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue; |
486 | if (!tofRawDatum->GetTOF()) continue; | |
380c04bf | 487 | ntof++; |
488 | GetRawsData(1)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns | |
489 | GetRawsData(2)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns | |
490 | ||
97430dfe | 491 | fTOFRawStream.EquipmentId2VolumeId(iDDL, |
492 | tofRawDatum->GetTRM(), | |
493 | tofRawDatum->GetTRMchain(), | |
494 | tofRawDatum->GetTDC(), | |
495 | tofRawDatum->GetTDCchannel(), | |
496 | in); | |
380c04bf | 497 | |
498 | GetMapIndeces(in,out); | |
499 | GetRawsData(3)->Fill( out[0],out[1]) ;//raw map | |
500 | ||
501 | } // while loop | |
502 | ||
503 | clonesRawData->Clear(); | |
504 | ||
505 | } // DDL Loop | |
506 | ||
97430dfe | 507 | fTOFRawStream.Clear(); |
508 | ||
380c04bf | 509 | Int_t nentries=ntof; |
c332d0d1 | 510 | if(nentries<=0){ |
ed77256d | 511 | GetRawsData(0)->Fill(-1.) ; |
512 | }else{ | |
513 | GetRawsData(0)->Fill(TMath::Log10(nentries)) ; | |
514 | } | |
380c04bf | 515 | } |
516 | ||
517 | //____________________________________________________________________________ | |
518 | void AliTOFQADataMaker::MakeRecPoints(TTree * clustersTree) | |
519 | { | |
520 | // | |
521 | // Make data from Clusters | |
522 | // | |
523 | ||
524 | Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3; | |
525 | Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3; | |
526 | ||
527 | Int_t in[5]; | |
528 | Int_t out[5]; | |
529 | ||
530 | TBranch *branch=clustersTree->GetBranch("TOF"); | |
531 | if (!branch) { | |
532 | AliError("can't get the branch with the TOF clusters !"); | |
533 | return; | |
534 | } | |
535 | ||
ed77256d | 536 | TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy; |
380c04bf | 537 | branch->SetAddress(&clusters); |
380c04bf | 538 | |
ed77256d | 539 | // Import the tree |
540 | clustersTree->GetEvent(0); | |
541 | ||
380c04bf | 542 | Int_t nentries=clusters->GetEntriesFast(); |
c332d0d1 | 543 | if(nentries<=0){ |
ed77256d | 544 | GetRecPointsData(0)->Fill(-1.) ; |
545 | }else{ | |
546 | GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ; | |
547 | } | |
548 | ||
380c04bf | 549 | TIter next(clusters) ; |
550 | AliTOFcluster * c ; | |
551 | while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) { | |
552 | GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns); | |
553 | GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns); | |
554 | GetRecPointsData(3)->Fill(c->GetToT()*tot2ns); | |
ed77256d | 555 | |
380c04bf | 556 | in[0] = c->GetDetInd(0); |
557 | in[1] = c->GetDetInd(1); | |
558 | in[2] = c->GetDetInd(2); | |
559 | in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints | |
560 | in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints | |
ed77256d | 561 | |
380c04bf | 562 | GetMapIndeces(in,out); |
563 | GetRecPointsData(4)->Fill(out[0],out[1]); | |
ed77256d | 564 | |
380c04bf | 565 | } |
380c04bf | 566 | } |
567 | ||
568 | //____________________________________________________________________________ | |
569 | void AliTOFQADataMaker::MakeESDs(AliESDEvent * esd) | |
570 | { | |
571 | // | |
572 | // make QA data from ESDs | |
573 | // | |
574 | Int_t ntrk = esd->GetNumberOfTracks() ; | |
575 | Int_t ntof=0; | |
576 | Int_t ntofpid=0; | |
577 | while (ntrk--) { | |
578 | AliESDtrack *track=esd->GetTrack(ntrk); | |
579 | Double_t tofTime=track->GetTOFsignal()*1E-3;//in ns | |
580 | Double_t tofTimeRaw=track->GetTOFsignalRaw()*1E-3;//in ns | |
581 | Double_t tofToT=track->GetTOFsignalToT(); //in ns | |
582 | if(!(tofTime>0))continue; | |
583 | ntof++; | |
584 | GetESDsData(1)->Fill(tofTime); | |
585 | GetESDsData(2)->Fill(tofTimeRaw); | |
586 | GetESDsData(3)->Fill(tofToT); | |
587 | //check how many tracks where ESD PID is ok | |
588 | UInt_t status=track->GetStatus(); | |
589 | if (((status&AliESDtrack::kESDpid)==0) || | |
590 | ((status&AliESDtrack::kTOFpid)==0)) continue; | |
591 | ntofpid++; | |
592 | } | |
593 | ||
594 | Int_t nentries=ntof; | |
c332d0d1 | 595 | if(nentries<=0){ |
ed77256d | 596 | GetESDsData(0)->Fill(-1.) ; |
597 | }else{ | |
598 | GetESDsData(0)->Fill(TMath::Log10(nentries)) ; | |
599 | } | |
600 | ||
5561a41b | 601 | Float_t ratio = 0.; |
602 | if(ntof>0) ratio=(Float_t)ntofpid/(Float_t)ntof*100.; | |
603 | GetESDsData(4)->Fill(ratio) ; | |
380c04bf | 604 | |
605 | } | |
606 | ||
607 | //____________________________________________________________________________ | |
608 | void AliTOFQADataMaker::StartOfDetectorCycle() | |
609 | { | |
610 | // | |
611 | //Detector specific actions at start of cycle | |
612 | //to be implemented | |
613 | } | |
614 | ||
693a790d | 615 | //____________________________________________________________________________ |
4e25ac79 | 616 | void AliTOFQADataMaker::EndOfDetectorCycle(AliQAv1::TASKINDEX task, TObjArray * list) |
693a790d | 617 | { |
618 | //Detector specific actions at end of cycle | |
619 | // do the QA checking | |
620 | ||
4e25ac79 | 621 | AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ; |
693a790d | 622 | } |
380c04bf | 623 | //____________________________________________________________________________ |
624 | void AliTOFQADataMaker::GetMapIndeces(Int_t* in , Int_t* out) | |
625 | { | |
626 | // | |
627 | //return appropriate indeces for the theta-phi map | |
628 | // | |
629 | ||
630 | Int_t npadX = AliTOFGeometry::NpadX(); | |
631 | Int_t npadZ = AliTOFGeometry::NpadZ(); | |
632 | Int_t nStripA = AliTOFGeometry::NStripA(); | |
633 | Int_t nStripB = AliTOFGeometry::NStripB(); | |
634 | Int_t nStripC = AliTOFGeometry::NStripC(); | |
635 | ||
636 | Int_t isector = in[0]; | |
637 | Int_t iplate = in[1]; | |
638 | Int_t istrip = in[2]; | |
639 | Int_t ipadX = in[3]; | |
640 | Int_t ipadZ = in[4]; | |
641 | ||
642 | Int_t stripOffset = 0; | |
643 | switch (iplate) { | |
644 | case 0: | |
645 | stripOffset = 0; | |
646 | break; | |
647 | case 1: | |
648 | stripOffset = nStripC; | |
649 | break; | |
650 | case 2: | |
651 | stripOffset = nStripC+nStripB; | |
652 | break; | |
653 | case 3: | |
654 | stripOffset = nStripC+nStripB+nStripA; | |
655 | break; | |
656 | case 4: | |
657 | stripOffset = nStripC+nStripB+nStripA+nStripB; | |
658 | break; | |
659 | default: | |
660 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
661 | break; | |
662 | }; | |
663 | Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1); | |
664 | Int_t phiindex=npadX*isector+ipadX+1; | |
665 | out[0]=zindex; | |
666 | out[1]=phiindex; | |
667 | ||
668 | } |