]>
Commit | Line | Data |
---|---|---|
c9dd1c4d | 1 | /************************************************************************** |
2 | * Copyright(c) 2004, 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 | // --- ROOT system --- | |
16 | #include <iostream> | |
17 | #include <TClonesArray.h> | |
18 | #include <TFile.h> | |
19 | #include <TH1F.h> | |
20 | #include <TH1I.h> | |
05e5e0c1 | 21 | #include <TH2I.h> |
c9dd1c4d | 22 | |
23 | // --- AliRoot header files --- | |
24 | #include "AliESDEvent.h" | |
25 | #include "AliLog.h" | |
26 | #include "AliFMDQADataMakerRec.h" | |
27 | #include "AliFMDDigit.h" | |
28 | #include "AliFMDRecPoint.h" | |
29 | #include "AliQAChecker.h" | |
30 | #include "AliESDFMD.h" | |
31 | #include "AliFMDParameters.h" | |
86c6cec8 | 32 | #include "AliFMDRawReader.h" |
3ceaa9ad | 33 | #include "AliRawReader.h" |
b995fc28 | 34 | #include "AliFMDAltroMapping.h" |
f4b5062e | 35 | #include "AliFMDDebug.h" |
c9dd1c4d | 36 | |
05e5e0c1 | 37 | namespace { |
38 | Int_t colors[3] = {kRed,kGreen,kBlue}; | |
39 | } | |
c9dd1c4d | 40 | //_____________________________________________________________________ |
41 | // This is the class that collects the QA data for the FMD during | |
42 | // reconstruction. | |
43 | // | |
44 | // The following data types are picked up: | |
c9dd1c4d | 45 | // - rec points |
46 | // - esd data | |
c9dd1c4d | 47 | // - raws |
48 | // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch | |
49 | //_____________________________________________________________________ | |
50 | ||
51 | ClassImp(AliFMDQADataMakerRec) | |
52 | #if 0 | |
53 | ; // For Emacs - do not delete! | |
54 | #endif | |
55 | ||
56 | //_____________________________________________________________________ | |
57 | AliFMDQADataMakerRec::AliFMDQADataMakerRec() : | |
4e25ac79 | 58 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD), |
a7e41e8d | 59 | "FMD Quality Assurance Data Maker"), |
198942c7 | 60 | fRecPointsArray("AliFMDRecPoint", 1000) |
c9dd1c4d | 61 | { |
62 | // ctor | |
56236ce9 | 63 | |
c9dd1c4d | 64 | } |
65 | ||
66 | //_____________________________________________________________________ | |
a7e41e8d | 67 | AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm) |
4e25ac79 | 68 | : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD), |
a7e41e8d | 69 | "FMD Quality Assurance Data Maker"), |
a7e41e8d | 70 | fRecPointsArray(qadm.fRecPointsArray) |
c9dd1c4d | 71 | { |
ffa78f64 | 72 | // copy ctor |
c9dd1c4d | 73 | // Parameters: |
74 | // qadm Object to copy from | |
75 | ||
76 | } | |
9bd2ccc2 | 77 | //_____________________________________________________________________ |
63720979 | 78 | AliFMDQADataMakerRec& |
79 | AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm ) | |
a7e41e8d | 80 | { |
09b6c804 | 81 | // |
82 | // Assignment operator | |
83 | // | |
84 | // Parameters: | |
85 | // qadm What to assign from | |
86 | // | |
87 | // Return: | |
88 | // Reference to this | |
89 | // | |
a7e41e8d | 90 | fRecPointsArray = qadm.fRecPointsArray; |
91 | ||
92 | return *this; | |
93 | } | |
94 | //_____________________________________________________________________ | |
9bd2ccc2 | 95 | AliFMDQADataMakerRec::~AliFMDQADataMakerRec() |
96 | { | |
09b6c804 | 97 | // |
98 | // Destrcutor | |
99 | // | |
9bd2ccc2 | 100 | } |
c9dd1c4d | 101 | |
102 | ||
103 | //_____________________________________________________________________ | |
104 | ||
105 | void | |
4e25ac79 | 106 | AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, |
57acd2d2 | 107 | TObjArray ** list) |
c9dd1c4d | 108 | { |
109 | // Detector specific actions at end of cycle | |
110 | // do the QA checking | |
92664bc8 | 111 | ResetEventTrigClasses(); // reset triggers list to select all histos |
ffa78f64 | 112 | AliLog::Message(5,"FMD: end of detector cycle", |
113 | "AliFMDQADataMakerRec","AliFMDQADataMakerRec", | |
114 | "AliFMDQADataMakerRec::EndOfDetectorCycle", | |
115 | "AliFMDQADataMakerRec.cxx",95); | |
4e25ac79 | 116 | AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list); |
c9dd1c4d | 117 | } |
118 | ||
05e5e0c1 | 119 | //_____________________________________________________________________ |
120 | TH1* AliFMDQADataMakerRec::MakeADCHist(UShort_t d, Char_t r, Short_t b) | |
121 | { | |
122 | TString name("adc"); | |
123 | TString title("ADC counts"); | |
124 | Int_t color = kRed+1; | |
125 | if (d > 0) { | |
126 | name.Append(Form("FMD%d%c", d, r)); | |
127 | title.Append(Form(" in FMD%d%c", d, r)); | |
128 | color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1); | |
129 | if (b >= 0) { | |
130 | name.Append(Form("_0x%02x", b)); | |
131 | title.Append(Form("[0x%02x]", b)); | |
132 | } | |
133 | } | |
134 | TH1* hist = new TH1F(name, title,1024,0,1024); | |
135 | hist->SetXTitle("Amplitude [ADC counts]"); | |
136 | hist->SetYTitle("Events [log]"); | |
137 | hist->SetFillStyle(3001); | |
138 | hist->SetFillColor(color); | |
139 | hist->SetLineColor(color); | |
140 | hist->SetMarkerColor(color); | |
141 | hist->GetXaxis()->SetNdivisions(408,false); | |
142 | // hist->SetStats(0); | |
143 | ||
144 | return hist; | |
145 | } | |
146 | //_____________________________________________________________________ | |
147 | TH1* AliFMDQADataMakerRec::MakeELossHist(UShort_t d, Char_t r, Short_t b) | |
148 | { | |
149 | TString name("eloss"); | |
150 | TString title("Energy loss"); | |
151 | Int_t color = kBlue+1; | |
152 | if (d > 0) { | |
153 | name.Append(Form("FMD%d%c", d, r)); | |
154 | title.Append(Form(" in FMD%d%c", d, r)); | |
155 | color = colors[d-1]+3+(r == 'I' || r == 'i' ? 0 : 1); | |
156 | if (b >= 0) { | |
157 | name.Append(Form("_0x%02x", b)); | |
158 | title.Append(Form("[0x%02x]", b)); | |
159 | } | |
160 | } | |
161 | TH1* hist = new TH1F(name, title,300,0, 15); | |
162 | hist->SetXTitle("#Delta E/#Delta_{mip}"); | |
163 | hist->SetYTitle("Events [log]"); | |
164 | hist->SetFillStyle(3001); | |
165 | hist->SetFillColor(color); | |
166 | hist->SetLineColor(color); | |
167 | hist->SetMarkerColor(color); | |
168 | // hist->SetStats(0); | |
169 | ||
170 | return hist; | |
171 | } | |
172 | ||
173 | ||
c9dd1c4d | 174 | //_____________________________________________________________________ |
175 | void AliFMDQADataMakerRec::InitESDs() | |
176 | { | |
177 | // create Digits histograms in Digits subdir | |
7d297381 | 178 | const Bool_t expert = kTRUE ; |
179 | const Bool_t image = kTRUE ; | |
180 | ||
05e5e0c1 | 181 | TH1* hist = MakeELossHist(); |
182 | Add2ESDsList(hist, 0, !expert, image); | |
92664bc8 | 183 | ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line |
c9dd1c4d | 184 | } |
185 | ||
44ed7a66 | 186 | //_____________________________________________________________________ |
187 | void AliFMDQADataMakerRec::InitDigits() | |
188 | { | |
189 | // create Digits histograms in Digits subdir | |
190 | const Bool_t expert = kTRUE ; | |
191 | const Bool_t image = kTRUE ; | |
192 | ||
05e5e0c1 | 193 | TH1* hist = MakeADCHist(); |
194 | Add2DigitsList(hist, 0, !expert, image); | |
92664bc8 | 195 | ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line |
44ed7a66 | 196 | } |
197 | ||
c9dd1c4d | 198 | //_____________________________________________________________________ |
199 | void AliFMDQADataMakerRec::InitRecPoints() | |
200 | { | |
7d297381 | 201 | // create Reconstructed Points histograms in RecPoints subdir |
202 | const Bool_t expert = kTRUE ; | |
203 | const Bool_t image = kTRUE ; | |
204 | ||
05e5e0c1 | 205 | TH1* hist = MakeELossHist(); |
206 | Add2RecPointsList(hist,0, !expert, image); | |
92664bc8 | 207 | ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last linea |
c9dd1c4d | 208 | } |
209 | ||
210 | //_____________________________________________________________________ | |
211 | void AliFMDQADataMakerRec::InitRaws() | |
212 | { | |
7d297381 | 213 | // create Raws histograms in Raws subdir |
214 | const Bool_t expert = kTRUE ; | |
215 | const Bool_t saveCorr = kTRUE ; | |
216 | const Bool_t image = kTRUE ; | |
05e5e0c1 | 217 | TH2I* hErrors = new TH2I("readoutErrors", "Read out errors", 3, .5, 3.5, |
218 | 160, 0, 160); | |
219 | hErrors->GetXaxis()->SetBinLabel(1, "FMD1"); | |
220 | hErrors->GetXaxis()->SetBinLabel(2, "FMD2"); | |
221 | hErrors->GetXaxis()->SetBinLabel(3, "FMD3"); | |
222 | hErrors->SetYTitle("# errors"); | |
223 | hErrors->SetZTitle("Events [log]"); | |
224 | Add2RawsList(hErrors, 1, !expert, image, !saveCorr); | |
225 | //AliInfo(Form("Adding %30s to raw list @ %2d", hErrors->GetName(), 1)); | |
226 | ||
227 | TH1* hist; | |
228 | Int_t idx = 0; | |
229 | for(UShort_t d = 1; d<=3; d++) { | |
230 | UShort_t nR = (d == 1 ? 1 : 2); | |
231 | for(UShort_t q = 0; q < nR; q++) { | |
232 | Char_t r = (q == 1 ? 'O' : 'I'); | |
233 | hist = MakeADCHist(d, r, -1); | |
234 | ||
235 | Int_t index1 = GetHalfringIndex(d, r, 0, 1); | |
236 | idx = TMath::Max(index1, idx); | |
237 | Add2RawsList(hist, index1, !expert, image, !saveCorr); | |
238 | //AliInfo(Form("Adding %30s to raw list @ %2d", hist->GetName(), index1)); | |
c18fe410 | 239 | |
05e5e0c1 | 240 | for(UShort_t b = 0; b <= 1; b++) { |
c18fe410 | 241 | //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11; |
05e5e0c1 | 242 | UShort_t board = (q == 1 ? 0 : 1) + b*16; |
c18fe410 | 243 | |
05e5e0c1 | 244 | hist = MakeADCHist(d, r, board); |
245 | Int_t index2 = GetHalfringIndex(d, r, board/16,0); | |
246 | idx = TMath::Max(index2, idx); | |
247 | Add2RawsList(hist, index2, expert, !image, !saveCorr); | |
248 | //AliInfo(Form("Adding %30s to raw list @ %2d",hist->GetName(),index2)); | |
b4da452d | 249 | } |
250 | } | |
251 | } | |
92664bc8 | 252 | // |
253 | ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line | |
c9dd1c4d | 254 | } |
255 | ||
408bf2b4 | 256 | #if 0 |
257 | struct FillESDHist : public AliESDFMD::ForOne | |
258 | { | |
259 | FillESDHist(AliFMDQADataMakerRec* m) : fM(m) {} | |
260 | FillESDHist(const FillESDHist& o) : fM(o.fM) {} | |
261 | FillESDHist& operator=(const FillESDHist& o) { fM = o.fM; return *this; } | |
262 | Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t m, Float_t) | |
263 | { | |
264 | // Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
265 | if(m == AliESDFMD::kInvalidMult) return true; | |
266 | ||
92664bc8 | 267 | fM->FillESDsData(0,m); |
408bf2b4 | 268 | return true; |
269 | } | |
270 | AliFMDQADataMakerRec* fM; | |
271 | }; | |
272 | #endif | |
273 | ||
c9dd1c4d | 274 | //_____________________________________________________________________ |
275 | void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
276 | { | |
09b6c804 | 277 | // |
278 | // Analyse ESD event | |
279 | // | |
280 | // Parameters: | |
281 | // esd ESD event | |
282 | // | |
c9dd1c4d | 283 | if(!esd) { |
284 | AliError("FMD ESD object not found!!") ; | |
285 | return; | |
286 | } | |
f4b5062e | 287 | AliFMDDebug(2, ("Will loop over ESD data and fill histogram")); |
288 | ||
c9dd1c4d | 289 | AliESDFMD* fmd = esd->GetFMDData(); |
290 | if (!fmd) return; | |
f4b5062e | 291 | |
408bf2b4 | 292 | #if 0 |
293 | FillESDHist f(this); | |
294 | fmd->ForEach(f); | |
295 | #else | |
296 | ||
297 | ||
298 | ||
f4b5062e | 299 | // FIXME - we should use AliESDFMD::ForOne subclass to do this! |
c9dd1c4d | 300 | for(UShort_t det=1;det<=3;det++) { |
f4b5062e | 301 | UShort_t nrng = (det == 1 ? 1 : 2); |
302 | for (UShort_t ir = 0; ir < nrng; ir++) { | |
c9dd1c4d | 303 | Char_t ring = (ir == 0 ? 'I' : 'O'); |
304 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
305 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
306 | for(UShort_t sec =0; sec < nsec; sec++) { | |
307 | for(UShort_t strip = 0; strip < nstr; strip++) { | |
308 | Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
309 | if(mult == AliESDFMD::kInvalidMult) continue; | |
310 | ||
92664bc8 | 311 | FillESDsData(0,mult); |
c9dd1c4d | 312 | } |
313 | } | |
314 | } | |
315 | } | |
408bf2b4 | 316 | #endif |
92664bc8 | 317 | IncEvCountCycleESDs(); |
318 | IncEvCountTotalESDs(); | |
c9dd1c4d | 319 | } |
320 | ||
44ed7a66 | 321 | |
c9dd1c4d | 322 | //_____________________________________________________________________ |
6252ceeb | 323 | void AliFMDQADataMakerRec::MakeDigits() |
c9dd1c4d | 324 | { |
325 | // makes data from Digits | |
6252ceeb | 326 | if(!fDigitsArray) { |
ffa78f64 | 327 | AliError("FMD Digit object not found!!") ; |
328 | return; | |
c9dd1c4d | 329 | } |
eca4fa66 | 330 | |
6252ceeb | 331 | for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) { |
c9dd1c4d | 332 | //Raw ADC counts |
6252ceeb | 333 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i)); |
92664bc8 | 334 | FillDigitsData(0,digit->Counts()); |
c9dd1c4d | 335 | } |
336 | } | |
337 | ||
338 | //_____________________________________________________________________ | |
339 | void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree) | |
340 | { | |
09b6c804 | 341 | // |
342 | // Analyse digits | |
343 | // | |
344 | // Parameters: | |
345 | // digitTree Tree of digits | |
346 | // | |
6252ceeb | 347 | if (fDigitsArray) |
348 | fDigitsArray->Clear(); | |
349 | else | |
350 | fDigitsArray = new TClonesArray("AliFMDDigit", 1000); | |
351 | ||
ffa78f64 | 352 | TBranch* branch = digitTree->GetBranch("FMD"); |
353 | if (!branch) { | |
c9dd1c4d | 354 | AliWarning("FMD branch in Digit Tree not found") ; |
355 | return; | |
356 | } | |
6252ceeb | 357 | branch->SetAddress(&fDigitsArray); |
ffa78f64 | 358 | branch->GetEntry(0); |
6252ceeb | 359 | MakeDigits(); |
92664bc8 | 360 | // |
361 | IncEvCountCycleDigits(); | |
362 | IncEvCountTotalDigits(); | |
c9dd1c4d | 363 | } |
44ed7a66 | 364 | |
c9dd1c4d | 365 | //_____________________________________________________________________ |
86c6cec8 | 366 | void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader) |
c9dd1c4d | 367 | { |
09b6c804 | 368 | // |
369 | // Analyse raw | |
370 | // | |
371 | // Parameters: | |
372 | // rawReader Raw reader | |
373 | // | |
198942c7 | 374 | |
09b6c804 | 375 | AliFMDRawReader fmdReader(rawReader,0); |
6252ceeb | 376 | |
377 | if (fDigitsArray) | |
378 | fDigitsArray->Clear(); | |
379 | else | |
380 | fDigitsArray = new TClonesArray("AliFMDDigit", 1000); | |
eca4fa66 | 381 | |
6252ceeb | 382 | TClonesArray* digitsAddress = fDigitsArray; |
3ceaa9ad | 383 | |
384 | rawReader->Reset(); | |
78328afd | 385 | |
c18fe410 | 386 | digitsAddress->Clear(); |
387 | fmdReader.ReadAdcs(digitsAddress); | |
388 | for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) { | |
389 | //Raw ADC counts | |
b995fc28 | 390 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i)); |
391 | UShort_t det = digit->Detector(); | |
392 | Char_t ring = digit->Ring(); | |
393 | UShort_t sec = digit->Sector(); | |
394 | // UShort_t strip = digit->Strip(); | |
395 | AliFMDParameters* pars = AliFMDParameters::Instance(); | |
396 | Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec); | |
c18fe410 | 397 | |
398 | Int_t index1 = GetHalfringIndex(det, ring, 0, 1); | |
92664bc8 | 399 | FillRawsData(index1,digit->Counts()); |
c18fe410 | 400 | Int_t index2 = GetHalfringIndex(det, ring, board/16,0); |
92664bc8 | 401 | FillRawsData(index2,digit->Counts()); |
402 | ||
c18fe410 | 403 | } |
92664bc8 | 404 | // |
405 | FillRawsData(1,1, fmdReader.GetNErrors(0)); | |
406 | FillRawsData(1,2, fmdReader.GetNErrors(1)); | |
407 | FillRawsData(1,3, fmdReader.GetNErrors(2)); | |
408 | // | |
409 | IncEvCountCycleRaws(); | |
410 | IncEvCountTotalRaws(); | |
c9dd1c4d | 411 | } |
412 | ||
413 | //_____________________________________________________________________ | |
414 | void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree) | |
415 | { | |
416 | // makes data from RecPoints | |
eca4fa66 | 417 | |
6252ceeb | 418 | AliFMDParameters* pars = AliFMDParameters::Instance(); |
56236ce9 | 419 | fRecPointsArray.Clear(); |
c9dd1c4d | 420 | TBranch *fmdbranch = clustersTree->GetBranch("FMD"); |
421 | if (!fmdbranch) { | |
422 | AliError("can't get the branch with the FMD recpoints !"); | |
423 | return; | |
424 | } | |
425 | ||
56236ce9 | 426 | TClonesArray* RecPointsAddress = &fRecPointsArray; |
9bd2ccc2 | 427 | |
56236ce9 | 428 | fmdbranch->SetAddress(&RecPointsAddress); |
c9dd1c4d | 429 | fmdbranch->GetEntry(0); |
56236ce9 | 430 | TIter next(RecPointsAddress) ; |
c9dd1c4d | 431 | AliFMDRecPoint * rp ; |
432 | while ((rp = static_cast<AliFMDRecPoint*>(next()))) { | |
92664bc8 | 433 | FillRecPointsData(0,rp->Edep()/pars->GetEdepMip()); |
c9dd1c4d | 434 | } |
92664bc8 | 435 | IncEvCountCycleRecPoints(); |
436 | IncEvCountTotalRecPoints(); | |
437 | // | |
c9dd1c4d | 438 | } |
439 | ||
440 | //_____________________________________________________________________ | |
441 | void AliFMDQADataMakerRec::StartOfDetectorCycle() | |
442 | { | |
443 | // What | |
444 | // to | |
445 | // do? | |
446 | } | |
447 | //_____________________________________________________________________ | |
b4da452d | 448 | Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det, |
449 | Char_t ring, | |
c18fe410 | 450 | UShort_t board, |
09b6c804 | 451 | UShort_t monitor) const |
452 | { | |
453 | // | |
454 | // Get the half-ring index | |
455 | // | |
456 | // Parameters: | |
457 | // det Detector | |
458 | // ring Ring | |
459 | // board Board number | |
460 | // monitor Monitor | |
461 | // | |
462 | // Return: | |
463 | // Half ring index | |
464 | // | |
05e5e0c1 | 465 | UShort_t iring = (ring == 'I' || ring == 'i' ? 1 : 0); |
466 | Int_t index = ((((det-1) & 0x3) << 3) | | |
467 | ((iring & 0x1) << 2) | | |
468 | ((board & 0x1) << 1) | | |
469 | ((monitor & 0x1) << 0)); | |
470 | #if 0 | |
471 | AliInfo(Form("d=%d, r=%c, b=%d, m=%d -> (%d<<3)|(%d<<2)|(%d<<1)|(%d<<0)=%2d", | |
472 | det, ring, board, monitor, (det-1) & 0x3, iring & 0x1, | |
473 | board & 0x1, monitor & 0x1, index)); | |
474 | #endif | |
b4da452d | 475 | return index-2; |
b4da452d | 476 | } |
477 | ||
478 | //_____________________________________________________________________ | |
479 | ||
480 | ||
c9dd1c4d | 481 | // |
482 | // EOF | |
483 | // |