]>
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" |
c9dd1c4d | 34 | |
35 | //_____________________________________________________________________ | |
36 | // This is the class that collects the QA data for the FMD during | |
37 | // reconstruction. | |
38 | // | |
39 | // The following data types are picked up: | |
c9dd1c4d | 40 | // - rec points |
41 | // - esd data | |
c9dd1c4d | 42 | // - raws |
43 | // Author : Hans Hjersing Dalsgaard, hans.dalsgaard@cern.ch | |
44 | //_____________________________________________________________________ | |
45 | ||
46 | ClassImp(AliFMDQADataMakerRec) | |
47 | #if 0 | |
48 | ; // For Emacs - do not delete! | |
49 | #endif | |
50 | ||
51 | //_____________________________________________________________________ | |
52 | AliFMDQADataMakerRec::AliFMDQADataMakerRec() : | |
4e25ac79 | 53 | AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kFMD), |
a7e41e8d | 54 | "FMD Quality Assurance Data Maker"), |
198942c7 | 55 | fDigitsArray("AliFMDDigit", 0), |
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"), |
66 | fDigitsArray(qadm.fDigitsArray), | |
67 | fRecPointsArray(qadm.fRecPointsArray) | |
c9dd1c4d | 68 | { |
ffa78f64 | 69 | // copy ctor |
c9dd1c4d | 70 | // Parameters: |
71 | // qadm Object to copy from | |
72 | ||
73 | } | |
9bd2ccc2 | 74 | //_____________________________________________________________________ |
a7e41e8d | 75 | AliFMDQADataMakerRec& AliFMDQADataMakerRec::operator = (const AliFMDQADataMakerRec& qadm ) |
76 | { | |
77 | fDigitsArray = qadm.fDigitsArray; | |
78 | fRecPointsArray = qadm.fRecPointsArray; | |
79 | ||
80 | return *this; | |
81 | } | |
82 | //_____________________________________________________________________ | |
9bd2ccc2 | 83 | AliFMDQADataMakerRec::~AliFMDQADataMakerRec() |
84 | { | |
56236ce9 | 85 | |
9bd2ccc2 | 86 | } |
c9dd1c4d | 87 | |
88 | ||
89 | //_____________________________________________________________________ | |
90 | ||
91 | void | |
4e25ac79 | 92 | AliFMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, |
57acd2d2 | 93 | TObjArray ** list) |
c9dd1c4d | 94 | { |
95 | // Detector specific actions at end of cycle | |
96 | // do the QA checking | |
ffa78f64 | 97 | AliLog::Message(5,"FMD: end of detector cycle", |
98 | "AliFMDQADataMakerRec","AliFMDQADataMakerRec", | |
99 | "AliFMDQADataMakerRec::EndOfDetectorCycle", | |
100 | "AliFMDQADataMakerRec.cxx",95); | |
4e25ac79 | 101 | AliQAChecker::Instance()->Run(AliQAv1::kFMD, task, list); |
c9dd1c4d | 102 | } |
103 | ||
104 | //_____________________________________________________________________ | |
105 | void AliFMDQADataMakerRec::InitESDs() | |
106 | { | |
107 | // create Digits histograms in Digits subdir | |
7d297381 | 108 | const Bool_t expert = kTRUE ; |
109 | const Bool_t image = kTRUE ; | |
110 | ||
c9dd1c4d | 111 | TH1F* hEnergyOfESD = new TH1F("hEnergyOfESD","Energy distribution",100,0,3); |
112 | hEnergyOfESD->SetXTitle("Edep/Emip"); | |
113 | hEnergyOfESD->SetYTitle("Counts"); | |
7d297381 | 114 | Add2ESDsList(hEnergyOfESD, 0, !expert, image); |
c9dd1c4d | 115 | |
116 | } | |
117 | ||
44ed7a66 | 118 | //_____________________________________________________________________ |
119 | void AliFMDQADataMakerRec::InitDigits() | |
120 | { | |
121 | // create Digits histograms in Digits subdir | |
122 | const Bool_t expert = kTRUE ; | |
123 | const Bool_t image = kTRUE ; | |
124 | ||
125 | TH1I* hADCCounts = new TH1I("hADCCounts","Dist of ADC counts",1024,0,1024); | |
126 | hADCCounts->SetXTitle("ADC counts"); | |
127 | Add2DigitsList(hADCCounts, 0, !expert, image); | |
128 | } | |
129 | ||
130 | ||
c9dd1c4d | 131 | //_____________________________________________________________________ |
132 | void AliFMDQADataMakerRec::InitRecPoints() | |
133 | { | |
7d297381 | 134 | // create Reconstructed Points histograms in RecPoints subdir |
135 | const Bool_t expert = kTRUE ; | |
136 | const Bool_t image = kTRUE ; | |
137 | ||
c9dd1c4d | 138 | TH1F* hEnergyOfRecpoints = new TH1F("hEnergyOfRecpoints", |
139 | "Energy Distribution",100,0,3); | |
140 | hEnergyOfRecpoints->SetXTitle("Edep/Emip"); | |
141 | hEnergyOfRecpoints->SetYTitle(""); | |
7d297381 | 142 | Add2RecPointsList(hEnergyOfRecpoints,0, !expert, image); |
c9dd1c4d | 143 | } |
144 | ||
145 | //_____________________________________________________________________ | |
146 | void AliFMDQADataMakerRec::InitRaws() | |
147 | { | |
7d297381 | 148 | // create Raws histograms in Raws subdir |
149 | const Bool_t expert = kTRUE ; | |
150 | const Bool_t saveCorr = kTRUE ; | |
151 | const Bool_t image = kTRUE ; | |
152 | ||
b4da452d | 153 | TH1I* hADCCounts; |
154 | for(Int_t det = 1; det<=3; det++) { | |
155 | Int_t firstring = (det==1 ? 1 : 0); | |
156 | for(Int_t iring = firstring;iring<=1;iring++) { | |
c18fe410 | 157 | Char_t ring = (iring == 1 ? 'I' : 'O'); |
158 | hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c", | |
159 | det, ring), "ADC counts", | |
160 | 1024,0,1023); | |
161 | ||
162 | Int_t index1 = GetHalfringIndex(det, ring, 0,1); | |
7d297381 | 163 | Add2RawsList(hADCCounts, index1, expert, !image, !saveCorr); |
c18fe410 | 164 | |
b4da452d | 165 | for(Int_t b = 0; b<=1;b++) { |
166 | ||
c18fe410 | 167 | //Hexadecimal board numbers 0x0, 0x1, 0x10, 0x11; |
b4da452d | 168 | UInt_t board = (iring == 1 ? 0 : 1); |
169 | board = board + b*16; | |
c18fe410 | 170 | |
b4da452d | 171 | |
172 | hADCCounts = new TH1I(Form("hADCCounts_FMD%d%c_board%d", | |
173 | det, ring, board), "ADC counts", | |
198942c7 | 174 | 1024,0,1023); |
b4da452d | 175 | hADCCounts->SetXTitle("ADC counts"); |
176 | hADCCounts->SetYTitle(""); | |
c18fe410 | 177 | Int_t index2 = GetHalfringIndex(det, ring, board/16,0); |
7d297381 | 178 | Add2RawsList(hADCCounts, index2, !expert, image, !saveCorr); |
c18fe410 | 179 | |
b4da452d | 180 | } |
181 | } | |
182 | } | |
c9dd1c4d | 183 | } |
184 | ||
185 | //_____________________________________________________________________ | |
186 | void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd) | |
187 | { | |
188 | if(!esd) { | |
189 | AliError("FMD ESD object not found!!") ; | |
190 | return; | |
191 | } | |
192 | AliESDFMD* fmd = esd->GetFMDData(); | |
193 | if (!fmd) return; | |
194 | ||
195 | for(UShort_t det=1;det<=3;det++) { | |
196 | for (UShort_t ir = 0; ir < 2; ir++) { | |
197 | Char_t ring = (ir == 0 ? 'I' : 'O'); | |
198 | UShort_t nsec = (ir == 0 ? 20 : 40); | |
199 | UShort_t nstr = (ir == 0 ? 512 : 256); | |
200 | for(UShort_t sec =0; sec < nsec; sec++) { | |
201 | for(UShort_t strip = 0; strip < nstr; strip++) { | |
202 | Float_t mult = fmd->Multiplicity(det,ring,sec,strip); | |
203 | if(mult == AliESDFMD::kInvalidMult) continue; | |
204 | ||
205 | GetESDsData(0)->Fill(mult); | |
206 | } | |
207 | } | |
208 | } | |
209 | } | |
210 | } | |
211 | ||
44ed7a66 | 212 | |
c9dd1c4d | 213 | //_____________________________________________________________________ |
214 | void AliFMDQADataMakerRec::MakeDigits(TClonesArray * digits) | |
215 | { | |
216 | // makes data from Digits | |
217 | if(!digits) { | |
ffa78f64 | 218 | AliError("FMD Digit object not found!!") ; |
219 | return; | |
c9dd1c4d | 220 | } |
56236ce9 | 221 | for(Int_t i=0;i<digits->GetEntriesFast();i++) { |
c9dd1c4d | 222 | //Raw ADC counts |
56236ce9 | 223 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(digits->At(i)); |
c9dd1c4d | 224 | GetDigitsData(0)->Fill(digit->Counts()); |
225 | } | |
226 | } | |
227 | ||
228 | //_____________________________________________________________________ | |
229 | void AliFMDQADataMakerRec::MakeDigits(TTree * digitTree) | |
230 | { | |
231 | ||
56236ce9 | 232 | fDigitsArray.Clear(); |
ffa78f64 | 233 | TBranch* branch = digitTree->GetBranch("FMD"); |
234 | if (!branch) { | |
c9dd1c4d | 235 | AliWarning("FMD branch in Digit Tree not found") ; |
236 | return; | |
237 | } | |
56236ce9 | 238 | TClonesArray* digitsAddress = &fDigitsArray; |
239 | branch->SetAddress(&digitsAddress); | |
ffa78f64 | 240 | branch->GetEntry(0); |
56236ce9 | 241 | MakeDigits(digitsAddress); |
c9dd1c4d | 242 | } |
44ed7a66 | 243 | |
c9dd1c4d | 244 | //_____________________________________________________________________ |
86c6cec8 | 245 | void AliFMDQADataMakerRec::MakeRaws(AliRawReader* rawReader) |
c9dd1c4d | 246 | { |
198942c7 | 247 | |
86c6cec8 | 248 | AliFMDRawReader fmdReader(rawReader,0); |
249 | TClonesArray* digitsAddress = &fDigitsArray; | |
3ceaa9ad | 250 | |
251 | rawReader->Reset(); | |
78328afd | 252 | |
c18fe410 | 253 | digitsAddress->Clear(); |
254 | fmdReader.ReadAdcs(digitsAddress); | |
255 | for(Int_t i=0;i<digitsAddress->GetEntriesFast();i++) { | |
256 | //Raw ADC counts | |
b995fc28 | 257 | AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitsAddress->At(i)); |
258 | UShort_t det = digit->Detector(); | |
259 | Char_t ring = digit->Ring(); | |
260 | UShort_t sec = digit->Sector(); | |
261 | // UShort_t strip = digit->Strip(); | |
262 | AliFMDParameters* pars = AliFMDParameters::Instance(); | |
263 | Short_t board = pars->GetAltroMap()->Sector2Board(ring, sec); | |
c18fe410 | 264 | |
265 | Int_t index1 = GetHalfringIndex(det, ring, 0, 1); | |
266 | GetRawsData(index1)->Fill(digit->Counts()); | |
267 | Int_t index2 = GetHalfringIndex(det, ring, board/16,0); | |
268 | GetRawsData(index2)->Fill(digit->Counts()); | |
269 | ||
270 | } | |
c9dd1c4d | 271 | } |
272 | ||
273 | //_____________________________________________________________________ | |
274 | void AliFMDQADataMakerRec::MakeRecPoints(TTree* clustersTree) | |
275 | { | |
276 | // makes data from RecPoints | |
198942c7 | 277 | AliFMDParameters* pars = AliFMDParameters::Instance(); |
56236ce9 | 278 | fRecPointsArray.Clear(); |
c9dd1c4d | 279 | TBranch *fmdbranch = clustersTree->GetBranch("FMD"); |
280 | if (!fmdbranch) { | |
281 | AliError("can't get the branch with the FMD recpoints !"); | |
282 | return; | |
283 | } | |
284 | ||
56236ce9 | 285 | TClonesArray* RecPointsAddress = &fRecPointsArray; |
9bd2ccc2 | 286 | |
56236ce9 | 287 | fmdbranch->SetAddress(&RecPointsAddress); |
c9dd1c4d | 288 | fmdbranch->GetEntry(0); |
56236ce9 | 289 | TIter next(RecPointsAddress) ; |
c9dd1c4d | 290 | AliFMDRecPoint * rp ; |
291 | while ((rp = static_cast<AliFMDRecPoint*>(next()))) { | |
198942c7 | 292 | |
293 | GetRecPointsData(0)->Fill(rp->Edep()/pars->GetEdepMip()) ; | |
294 | ||
c9dd1c4d | 295 | } |
c9dd1c4d | 296 | |
297 | } | |
298 | ||
299 | //_____________________________________________________________________ | |
300 | void AliFMDQADataMakerRec::StartOfDetectorCycle() | |
301 | { | |
302 | // What | |
303 | // to | |
304 | // do? | |
305 | } | |
306 | //_____________________________________________________________________ | |
b4da452d | 307 | Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det, |
308 | Char_t ring, | |
c18fe410 | 309 | UShort_t board, |
310 | UShort_t monitor) { | |
b4da452d | 311 | |
312 | UShort_t iring = (ring == 'I' ? 1 : 0); | |
313 | ||
c18fe410 | 314 | Int_t index = ( ((det-1) << 3) | (iring << 2) | (board << 1) | (monitor << 0)); |
b4da452d | 315 | |
316 | return index-2; | |
317 | ||
318 | } | |
319 | ||
320 | //_____________________________________________________________________ | |
321 | ||
322 | ||
c9dd1c4d | 323 | // |
324 | // EOF | |
325 | // |