]>
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> | |
21 | ||
22 | // --- AliRoot header files --- | |
23 | #include "AliESDEvent.h" | |
24 | #include "AliLog.h" | |
25 | #include "AliFMDQADataMakerRec.h" | |
26 | #include "AliFMDDigit.h" | |
27 | #include "AliFMDRecPoint.h" | |
28 | #include "AliQAChecker.h" | |
29 | #include "AliESDFMD.h" | |
30 | #include "AliFMDParameters.h" | |
86c6cec8 | 31 | #include "AliFMDRawReader.h" |
3ceaa9ad | 32 | #include "AliRawReader.h" |
b995fc28 | 33 | #include "AliFMDAltroMapping.h" |
f4b5062e | 34 | #include "AliFMDDebug.h" |
c9dd1c4d | 35 | |
36 | //_____________________________________________________________________ | |
37 | // This is the class that collects the QA data for the FMD during | |
38 | // reconstruction. | |
39 | // | |
40 | // The following data types are picked up: | |
c9dd1c4d | 41 | // - rec points |
42 | // - esd data | |
c9dd1c4d | 43 | // - raws |
44 | // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch | |
45 | //_____________________________________________________________________ | |
46 | ||
47 | ClassImp(AliFMDQADataMakerRec) | |
48 | #if 0 | |
49 | ; // For Emacs - do not delete! | |
50 | #endif | |
51 | ||
52 | //_____________________________________________________________________ | |
53 | AliFMDQADataMakerRec::AliFMDQADataMakerRec() : | |
4e25ac79 | 54 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD), |
a7e41e8d | 55 | "FMD Quality Assurance Data Maker"), |
198942c7 | 56 | fRecPointsArray("AliFMDRecPoint", 1000) |
c9dd1c4d | 57 | { |
58 | // ctor | |
56236ce9 | 59 | |
c9dd1c4d | 60 | } |
61 | ||
62 | //_____________________________________________________________________ | |
a7e41e8d | 63 | AliFMDQADataMakerRec::AliFMDQADataMakerRec(const AliFMDQADataMakerRec& qadm) |
4e25ac79 | 64 | : AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD), |
a7e41e8d | 65 | "FMD Quality Assurance Data Maker"), |
a7e41e8d | 66 | fRecPointsArray(qadm.fRecPointsArray) |
c9dd1c4d | 67 | { |
ffa78f64 | 68 | // copy ctor |
c9dd1c4d | 69 | // Parameters: |
70 | // qadm Object to copy from | |
71 | ||
72 | } | |
9bd2ccc2 | 73 | //_____________________________________________________________________ |
63720979 | 74 | AliFMDQADataMakerRec& |
75 | AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm ) | |
a7e41e8d | 76 | { |
09b6c804 | 77 | // |
78 | // Assignment operator | |
79 | // | |
80 | // Parameters: | |
81 | // qadm What to assign from | |
82 | // | |
83 | // Return: | |
84 | // Reference to this | |
85 | // | |
a7e41e8d | 86 | fRecPointsArray = qadm.fRecPointsArray; |
87 | ||
88 | return *this; | |
89 | } | |
90 | //_____________________________________________________________________ | |
9bd2ccc2 | 91 | AliFMDQADataMakerRec::~AliFMDQADataMakerRec() |
92 | { | |
09b6c804 | 93 | // |
94 | // Destrcutor | |
95 | // | |
9bd2ccc2 | 96 | } |
c9dd1c4d | 97 | |
98 | ||
99 | //_____________________________________________________________________ | |
100 | ||
101 | void | |
4e25ac79 | 102 | AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, |
57acd2d2 | 103 | TObjArray ** list) |
c9dd1c4d | 104 | { |
105 | // Detector specific actions at end of cycle | |
106 | // do the QA checking | |
ffa78f64 | 107 | AliLog::Message(5,"FMD: end of detector cycle", |
108 | "AliFMDQADataMakerRec","AliFMDQADataMakerRec", | |
109 | "AliFMDQADataMakerRec::EndOfDetectorCycle", | |
110 | "AliFMDQADataMakerRec.cxx",95); | |
4e25ac79 | 111 | AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list); |
c9dd1c4d | 112 | } |
113 | ||
114 | //_____________________________________________________________________ | |
115 | void AliFMDQADataMakerRec::InitESDs() | |
116 | { | |
117 | // create Digits histograms in Digits subdir | |
7d297381 | 118 | const Bool_t expert = kTRUE ; |
119 | const Bool_t image = kTRUE ; | |
120 | ||
c9dd1c4d | 121 | TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3); |
122 | hEnergyOfESD->SetXTitle("Edep/Emip"); | |
123 | hEnergyOfESD->SetYTitle("Counts"); | |
7d297381 | 124 | Add2ESDsList(hEnergyOfESD, 0, !expert, image); |
c9dd1c4d | 125 | |
126 | } | |
127 | ||
44ed7a66 | 128 | //_____________________________________________________________________ |
129 | void AliFMDQADataMakerRec::InitDigits() | |
130 | { | |
131 | // create Digits histograms in Digits subdir | |
132 | const Bool_t expert = kTRUE ; | |
133 | const Bool_t image = kTRUE ; | |
134 | ||
63720979 | 135 | TH1I* hADCCounts = new TH1I("hADCCounts", |
136 | "Dist of ADC counts;ADC counts;Counts", | |
137 | 1024,0,1024); | |
44ed7a66 | 138 | Add2DigitsList(hADCCounts, 0, !expert, image); |
139 | } | |
140 | ||
141 | ||
c9dd1c4d | 142 | //_____________________________________________________________________ |
143 | void AliFMDQADataMakerRec::InitRecPoints() | |
144 | { | |
7d297381 | 145 | // create Reconstructed Points histograms in RecPoints subdir |
146 | const Bool_t expert = kTRUE ; | |
147 | const Bool_t image = kTRUE ; | |
148 | ||
c9dd1c4d | 149 | TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints", |
150 | "Energy Distribution",100,0,3); | |
151 | hEnergyOfRecpoints->SetXTitle("Edep/Emip"); | |
db72ff3b | 152 | hEnergyOfRecpoints->SetYTitle("Counts"); |
7d297381 | 153 | Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image); |
c9dd1c4d | 154 | } |
155 | ||
156 | //_____________________________________________________________________ | |
157 | void AliFMDQADataMakerRec::InitRaws() | |
158 | { | |
7d297381 | 159 | // create Raws histograms in Raws subdir |
160 | const Bool_t expert = kTRUE ; | |
161 | const Bool_t saveCorr = kTRUE ; | |
162 | const Bool_t image = kTRUE ; | |
17a67721 | 163 | Int_t colors[3] = {kRed,kGreen,kBlue}; |
b4da452d | 164 | TH1I* hADCCounts; |
165 | for(Int_t det = 1; det<=3; det++) { | |
166 | Int_t firstring = (det==1 ? 1 : 0); | |
167 | for(Int_t iring = firstring;iring<=1;iring++) { | |
c18fe410 | 168 | Char_t ring = (iring == 1 ? 'I' : 'O'); |
63720979 | 169 | hADCCounts = |
170 | new TH1I(Form("hADCCounts_FMD%d%c", det, ring), | |
171 | Form("FMD%d%c ADC counts;Amplitude [ADC counts];Counts", | |
172 | det,ring),1024,0,1023); | |
17a67721 | 173 | hADCCounts->SetFillStyle(3001); |
63720979 | 174 | hADCCounts->SetFillColor(colors[det-1]+2+iring); |
175 | hADCCounts->SetDrawOption("LOGY"); | |
176 | ||
c18fe410 | 177 | Int_t index1 = GetHalfringIndex(det, ring, 0,1); |
6ceca4ef | 178 | Add2RawsList(hADCCounts, index1, !expert, image, !saveCorr); |
c18fe410 | 179 | |
b4da452d | 180 | for(Int_t b = 0; b<=1;b++) { |
181 | ||
c18fe410 | 182 | //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11; |
b4da452d | 183 | UInt_t board = (iring == 1 ? 0 : 1); |
184 | board = board + b*16; | |
c18fe410 | 185 | |
b4da452d | 186 | |
63720979 | 187 | hADCCounts = |
188 | new TH1I(Form("hADCCounts_FMD%d%c_0x%02x", det, ring, board), | |
189 | Form("FMD%d%c_0x%x ADC counts;Amplitude [ADC counts];Counts", | |
190 | det,ring, board),1024,0,1023); | |
b4da452d | 191 | hADCCounts->SetXTitle("ADC counts"); |
192 | hADCCounts->SetYTitle(""); | |
63720979 | 193 | hADCCounts->SetFillStyle(3001); |
194 | hADCCounts->SetFillColor(colors[det-1]+2+iring); | |
195 | hADCCounts->SetDrawOption("LOGY"); | |
c18fe410 | 196 | Int_t index2 = GetHalfringIndex(det, ring, board/16,0); |
6ceca4ef | 197 | Add2RawsList(hADCCounts, index2, expert, !image, !saveCorr); |
c18fe410 | 198 | |
b4da452d | 199 | } |
200 | } | |
201 | } | |
c9dd1c4d | 202 | } |
203 | ||
408bf2b4 | 204 | #if 0 |
205 | struct FillESDHist : public AliESDFMD::ForOne | |
206 | { | |
207 | FillESDHist(AliFMDQADataMakerRec* m) : fM(m) {} | |
208 | FillESDHist(const FillESDHist& o) : fM(o.fM) {} | |
209 | FillESDHist& operator=(const FillESDHist& o) { fM = o.fM; return *this; } | |
210 | Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t m, Float_t) | |
211 | { | |
212 | // Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
213 | if(m == AliESDFMD::kInvalidMult) return true; | |
214 | ||
215 | fM->GetESDsData(0)->Fill(m); | |
216 | return true; | |
217 | } | |
218 | AliFMDQADataMakerRec* fM; | |
219 | }; | |
220 | #endif | |
221 | ||
c9dd1c4d | 222 | //_____________________________________________________________________ |
223 | void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
224 | { | |
09b6c804 | 225 | // |
226 | // Analyse ESD event | |
227 | // | |
228 | // Parameters: | |
229 | // esd ESD event | |
230 | // | |
c9dd1c4d | 231 | if(!esd) { |
232 | AliError("FMD ESD object not found!!") ; | |
233 | return; | |
234 | } | |
f4b5062e | 235 | AliFMDDebug(2, ("Will loop over ESD data and fill histogram")); |
236 | ||
c9dd1c4d | 237 | AliESDFMD* fmd = esd->GetFMDData(); |
238 | if (!fmd) return; | |
f4b5062e | 239 | |
408bf2b4 | 240 | #if 0 |
241 | FillESDHist f(this); | |
242 | fmd->ForEach(f); | |
243 | #else | |
244 | ||
245 | ||
246 | ||
f4b5062e | 247 | // FIXME - we should use AliESDFMD::ForOne subclass to do this! |
c9dd1c4d | 248 | for(UShort_t det=1;det<=3;det++) { |
f4b5062e | 249 | UShort_t nrng = (det == 1 ? 1 : 2); |
250 | for (UShort_t ir = 0; ir < nrng; ir++) { | |
c9dd1c4d | 251 | Char_t ring = (ir == 0 ? 'I' : 'O'); |
252 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
253 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
254 | for(UShort_t sec =0; sec < nsec; sec++) { | |
255 | for(UShort_t strip = 0; strip < nstr; strip++) { | |
256 | Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
257 | if(mult == AliESDFMD::kInvalidMult) continue; | |
258 | ||
259 | GetESDsData(0)->Fill(mult); | |
260 | } | |
261 | } | |
262 | } | |
263 | } | |
408bf2b4 | 264 | #endif |
c9dd1c4d | 265 | } |
266 | ||
44ed7a66 | 267 | |
c9dd1c4d | 268 | //_____________________________________________________________________ |
6252ceeb | 269 | void AliFMDQADataMakerRec::MakeDigits() |
c9dd1c4d | 270 | { |
271 | // makes data from Digits | |
6252ceeb | 272 | if(!fDigitsArray) { |
ffa78f64 | 273 | AliError("FMD Digit object not found!!") ; |
274 | return; | |
c9dd1c4d | 275 | } |
eca4fa66 | 276 | |
6252ceeb | 277 | for(Int_t i=0;i<fDigitsArray->GetEntriesFast();i++) { |
c9dd1c4d | 278 | //Raw ADC counts |
6252ceeb | 279 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(fDigitsArray->At(i)); |
c9dd1c4d | 280 | GetDigitsData(0)->Fill(digit->Counts()); |
281 | } | |
282 | } | |
283 | ||
284 | //_____________________________________________________________________ | |
285 | void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree) | |
286 | { | |
09b6c804 | 287 | // |
288 | // Analyse digits | |
289 | // | |
290 | // Parameters: | |
291 | // digitTree Tree of digits | |
292 | // | |
c9dd1c4d | 293 | |
6252ceeb | 294 | if (fDigitsArray) |
295 | fDigitsArray->Clear(); | |
296 | else | |
297 | fDigitsArray = new TClonesArray("AliFMDDigit", 1000); | |
298 | ||
ffa78f64 | 299 | TBranch* branch = digitTree->GetBranch("FMD"); |
300 | if (!branch) { | |
c9dd1c4d | 301 | AliWarning("FMD branch in Digit Tree not found") ; |
302 | return; | |
303 | } | |
6252ceeb | 304 | branch->SetAddress(&fDigitsArray); |
ffa78f64 | 305 | branch->GetEntry(0); |
6252ceeb | 306 | MakeDigits(); |
c9dd1c4d | 307 | } |
44ed7a66 | 308 | |
c9dd1c4d | 309 | //_____________________________________________________________________ |
86c6cec8 | 310 | void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader) |
c9dd1c4d | 311 | { |
09b6c804 | 312 | // |
313 | // Analyse raw | |
314 | // | |
315 | // Parameters: | |
316 | // rawReader Raw reader | |
317 | // | |
198942c7 | 318 | |
09b6c804 | 319 | AliFMDRawReader fmdReader(rawReader,0); |
6252ceeb | 320 | |
321 | if (fDigitsArray) | |
322 | fDigitsArray->Clear(); | |
323 | else | |
324 | fDigitsArray = new TClonesArray("AliFMDDigit", 1000); | |
eca4fa66 | 325 | |
6252ceeb | 326 | TClonesArray* digitsAddress = fDigitsArray; |
3ceaa9ad | 327 | |
328 | rawReader->Reset(); | |
78328afd | 329 | |
c18fe410 | 330 | digitsAddress->Clear(); |
331 | fmdReader.ReadAdcs(digitsAddress); | |
332 | for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) { | |
333 | //Raw ADC counts | |
b995fc28 | 334 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i)); |
335 | UShort_t det = digit->Detector(); | |
336 | Char_t ring = digit->Ring(); | |
337 | UShort_t sec = digit->Sector(); | |
338 | // UShort_t strip = digit->Strip(); | |
339 | AliFMDParameters* pars = AliFMDParameters::Instance(); | |
340 | Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec); | |
c18fe410 | 341 | |
342 | Int_t index1 = GetHalfringIndex(det, ring, 0, 1); | |
343 | GetRawsData(index1)->Fill(digit->Counts()); | |
344 | Int_t index2 = GetHalfringIndex(det, ring, board/16,0); | |
345 | GetRawsData(index2)->Fill(digit->Counts()); | |
346 | ||
347 | } | |
c9dd1c4d | 348 | } |
349 | ||
350 | //_____________________________________________________________________ | |
351 | void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree) | |
352 | { | |
353 | // makes data from RecPoints | |
eca4fa66 | 354 | |
6252ceeb | 355 | AliFMDParameters* pars = AliFMDParameters::Instance(); |
56236ce9 | 356 | fRecPointsArray.Clear(); |
c9dd1c4d | 357 | TBranch *fmdbranch = clustersTree->GetBranch("FMD"); |
358 | if (!fmdbranch) { | |
359 | AliError("can't get the branch with the FMD recpoints !"); | |
360 | return; | |
361 | } | |
362 | ||
56236ce9 | 363 | TClonesArray* RecPointsAddress = &fRecPointsArray; |
9bd2ccc2 | 364 | |
56236ce9 | 365 | fmdbranch->SetAddress(&RecPointsAddress); |
c9dd1c4d | 366 | fmdbranch->GetEntry(0); |
56236ce9 | 367 | TIter next(RecPointsAddress) ; |
c9dd1c4d | 368 | AliFMDRecPoint * rp ; |
369 | while ((rp = static_cast<AliFMDRecPoint*>(next()))) { | |
198942c7 | 370 | |
371 | GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ; | |
372 | ||
c9dd1c4d | 373 | } |
c9dd1c4d | 374 | |
375 | } | |
376 | ||
377 | //_____________________________________________________________________ | |
378 | void AliFMDQADataMakerRec::StartOfDetectorCycle() | |
379 | { | |
380 | // What | |
381 | // to | |
382 | // do? | |
383 | } | |
384 | //_____________________________________________________________________ | |
b4da452d | 385 | Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det, |
386 | Char_t ring, | |
c18fe410 | 387 | UShort_t board, |
09b6c804 | 388 | UShort_t monitor) const |
389 | { | |
390 | // | |
391 | // Get the half-ring index | |
392 | // | |
393 | // Parameters: | |
394 | // det Detector | |
395 | // ring Ring | |
396 | // board Board number | |
397 | // monitor Monitor | |
398 | // | |
399 | // Return: | |
400 | // Half ring index | |
401 | // | |
b4da452d | 402 | UShort_t iring = (ring == 'I' ? 1 : 0); |
09b6c804 | 403 | Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | |
404 | (monitor << 0)); | |
b4da452d | 405 | |
406 | return index-2; | |
b4da452d | 407 | } |
408 | ||
409 | //_____________________________________________________________________ | |
410 | ||
411 | ||
c9dd1c4d | 412 | // |
413 | // EOF | |
414 | // |