]>
Commit | Line | Data |
---|---|---|
94594e5d | 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 | ||
16 | /* | |
17 | Checks the quality assurance. | |
18 | By comparing with reference data | |
19 | ||
20 | Based on PHOS code written by | |
21 | Y. Schutz CERN July 2007 | |
9e47432c | 22 | |
a2655076 | 23 | For the moment we only implement the checking of raw data QA. |
24 | The checked for ESD and RecPoints will be implemented later. | |
9e47432c | 25 | |
26 | ||
9e47432c | 27 | */ |
28 | ||
94594e5d | 29 | |
30 | // --- ROOT system --- | |
31 | #include <TClass.h> | |
9e47432c | 32 | #include <TH1.h> |
33 | #include <TF1.h> | |
94594e5d | 34 | #include <TH1I.h> |
38986b78 | 35 | #include <TH2F.h> |
94594e5d | 36 | #include <TIterator.h> |
37 | #include <TKey.h> | |
38 | #include <TFile.h> | |
9e47432c | 39 | #include <TLine.h> |
38986b78 | 40 | #include <TText.h> |
9e47432c | 41 | #include <TPaveText.h> |
42 | #include <TMath.h> | |
94594e5d | 43 | |
44 | // --- Standard library --- | |
45 | ||
46 | // --- AliRoot header files --- | |
47 | #include "AliLog.h" | |
4e25ac79 | 48 | #include "AliQAv1.h" |
94594e5d | 49 | #include "AliQAChecker.h" |
50 | #include "AliEMCALQAChecker.h" | |
51 | ||
52 | ClassImp(AliEMCALQAChecker) | |
53 | ||
9e47432c | 54 | //__________________________________________________________________ |
55 | AliEMCALQAChecker::AliEMCALQAChecker() : | |
56 | AliQACheckerBase("EMCAL","EMCAL Quality Assurance Data Maker"), | |
afae9650 | 57 | fTextSM(new TText*[fgknSM]), |
8a38cd34 | 58 | fLineCol(new TLine(47.5,-0.5,47.5,119.5)), |
00957c37 | 59 | fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC")) |
9e47432c | 60 | { |
38986b78 | 61 | // ctor |
62 | fLineCol->SetLineColor(1); | |
63 | fLineCol->SetLineWidth(2); | |
38986b78 | 64 | |
65 | fTextSM[0]= new TText(20, 12, "SM A0"); | |
8a38cd34 | 66 | fTextSM[1]= new TText(20, 36, "SM A1"); |
67 | fTextSM[2]= new TText(20, 60, "SM A2"); | |
68 | fTextSM[3]= new TText(20, 84, "SM A3"); | |
69 | fTextSM[4]= new TText(20, 108,"SM A4"); | |
b8769ad2 | 70 | fTextSM[5]= new TText(20, 132,"SM A5"); |
8a38cd34 | 71 | |
b8769ad2 | 72 | fTextSM[6]= new TText(64, 12, "SM C0"); |
73 | fTextSM[7]= new TText(64, 36, "SM C1"); | |
74 | fTextSM[8]= new TText(64, 60, "SM C2"); | |
75 | fTextSM[9]= new TText(64, 84, "SM C3"); | |
76 | fTextSM[10]= new TText(64, 108,"SM C4"); | |
77 | fTextSM[11]= new TText(64, 132,"SM C5"); | |
8a38cd34 | 78 | |
b8769ad2 | 79 | for(int i = 0; i < 5; i++) { |
8a38cd34 | 80 | fLineRow[i] = new TLine(-0.5,23.5+(24*i),95.5,23.5+(24*i)); |
81 | fLineRow[i]->SetLineColor(1); | |
82 | fLineRow[i]->SetLineWidth(2); | |
83 | } | |
84 | ||
a2e583d8 | 85 | for(int i = 0; i < 3; i++) { |
86 | fTextL1[i] = new TPaveText(0.2,0.7,0.8,0.9,"NDC"); | |
87 | } | |
88 | ||
8a38cd34 | 89 | |
9e47432c | 90 | } |
91 | ||
92 | //__________________________________________________________________ | |
93 | AliEMCALQAChecker::~AliEMCALQAChecker() | |
94 | { | |
95 | /// dtor | |
38986b78 | 96 | delete [] fTextSM ; |
a42ceb0e | 97 | delete fLineCol ; |
b8769ad2 | 98 | for (Int_t i=0; i<5; ++i) delete fLineRow[i] ; |
a42ceb0e | 99 | delete fText ; |
9e47432c | 100 | } |
101 | ||
9e47432c | 102 | //______________________________________________________________________________ |
a42ceb0e | 103 | void AliEMCALQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) |
9e47432c | 104 | { |
105 | /// Check objects in list | |
106 | ||
107 | if ( index == AliQAv1::kRAW ) | |
108 | { | |
a42ceb0e | 109 | CheckRaws(test, list); |
9e47432c | 110 | printf ("checkers for task %d \n", index) ; |
111 | } | |
112 | ||
113 | if ( index == AliQAv1::kREC) | |
114 | { | |
a42ceb0e | 115 | CheckRecPoints(test, list); |
9e47432c | 116 | } |
117 | ||
118 | if ( index == AliQAv1::kESD ) | |
119 | { | |
a42ceb0e | 120 | CheckESD(test, list); |
9e47432c | 121 | } |
122 | AliWarning(Form("Checker for task %d not implement for the moment",index)); | |
9e47432c | 123 | } |
124 | ||
125 | //______________________________________________________________________________ | |
126 | TH1* | |
127 | AliEMCALQAChecker::GetHisto(TObjArray* list, const char* hname, Int_t specie) const | |
128 | { | |
129 | /// Get a given histo from the list | |
130 | TH1* h = static_cast<TH1*>(list->FindObject(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),hname))); | |
131 | if (!h) | |
132 | { | |
133 | AliError(Form("Did not find expected histo %s",hname)); | |
134 | } | |
135 | return h; | |
136 | } | |
137 | ||
138 | //______________________________________________________________________________ | |
139 | Double_t | |
140 | AliEMCALQAChecker::MarkHisto(TH1& histo, Double_t value) const | |
141 | { | |
142 | /// Mark histo as originator of some QA error/warning | |
143 | ||
144 | if ( value != 1.0 ) | |
145 | { | |
146 | histo.SetBit(AliQAv1::GetQABit()); | |
147 | } | |
148 | ||
149 | return value; | |
150 | } | |
151 | ||
152 | ||
153 | //______________________________________________________________________________ | |
a42ceb0e | 154 | void AliEMCALQAChecker::CheckRaws(Double_t * test, TObjArray ** list) |
9e47432c | 155 | { |
f05c8877 | 156 | // Check RAW QA histograms |
157 | // -- Yaxian Mao, CCNU/CERN/LPSC | |
158 | //adding new checking method: 25/04/2010, Yaxian Mao | |
159 | //Comparing the amplitude from current run to the reference run, if the ratio in the range [0.8, .12], count as a good tower. | |
160 | //If more than 90% towers are good, EMCAL works fine, otherwise experts should be contacted. | |
38986b78 | 161 | |
38986b78 | 162 | Int_t nTowersPerSM = 24*48; // number of towers in a SuperModule; 24x48 |
afae9650 | 163 | Double_t nTot = fgknSM * nTowersPerSM ; |
180c431b | 164 | TList *lstF = 0; |
a2655076 | 165 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
a42ceb0e | 166 | test[specie] = 0.0 ; |
a2e583d8 | 167 | if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ; |
168 | if (list[specie]->GetEntries() == 0) test[specie] = 0. ; // nothing to check | |
a2655076 | 169 | else { |
a2e583d8 | 170 | //get calib histos |
171 | TH2F * hdata = (TH2F*)list[specie]->At(k2DRatioAmp) ; | |
172 | TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ; | |
173 | ||
174 | //get L1 histos | |
175 | TH2F *hL1GammaPatch = (TH2F*)list[specie]->At(kGL1); | |
176 | TH2F *hL1JetPatch = (TH2F*)list[specie]->At(kJL1); | |
177 | TH1I *hFrameR = (TH1I*)list[specie]->At(kSTUTRU); | |
178 | ||
179 | //calib histo checker first: | |
180 | ||
181 | if(hdata->GetEntries()!=0 && ratio->GetEntries()!=0) { | |
182 | //adding the lines to distinguish different SMs | |
183 | lstF = hdata->GetListOfFunctions(); | |
184 | CleanListOfFunctions(lstF); | |
185 | lstF->Add(fLineCol->Clone()); | |
186 | for(Int_t iLine = 0; iLine < 4; iLine++) { | |
187 | lstF->Add(fLineRow[iLine]->Clone()); | |
188 | } | |
189 | //Now adding the text to for each SM | |
190 | for(Int_t iSM = 0 ; iSM < fgknSM ; iSM++){ //number of SMs loop start | |
191 | lstF->Add(fTextSM[iSM]->Clone()); | |
192 | } | |
193 | // | |
194 | lstF = ratio->GetListOfFunctions(); | |
195 | CleanListOfFunctions(lstF); | |
196 | // | |
197 | //now check the ratio histogram | |
198 | Double_t binContent = 0. ; | |
edd592b8 | 199 | Int_t nGoodTower = 0 ; |
a2e583d8 | 200 | Double_t rv = 0. ; |
201 | for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) { | |
202 | for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) { | |
203 | binContent = hdata->GetBinContent(ix, iy) ; | |
edd592b8 | 204 | if (binContent < 1.2 && binContent > 0.8) nGoodTower++ ; |
a2e583d8 | 205 | } |
206 | } | |
edd592b8 | 207 | rv = nGoodTower/nTot ; |
a2e583d8 | 208 | printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100); |
209 | if(fText){ | |
210 | lstF->Add(fText->Clone()) ; | |
211 | fText->Clear() ; | |
7e1d9a9b | 212 | |
a2e583d8 | 213 | fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100)); |
214 | if (rv < 0.9) { | |
215 | test[specie] = 0.9 ; | |
216 | // 2 lines text info for quality | |
217 | fText->SetFillColor(2) ; | |
218 | fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!")); | |
219 | } | |
220 | else { | |
221 | test[specie] = 0.1 ; | |
222 | fText->SetFillColor(3) ; | |
223 | fText->AddText(Form("EMCAL = OK, ENJOY...")); | |
224 | } | |
225 | }//fText | |
226 | } // calib histo checking done | |
227 | ||
228 | //now L1 checks: | |
229 | if(hL1GammaPatch->GetEntries() !=0) { | |
230 | lstF = hL1GammaPatch->GetListOfFunctions(); | |
231 | CleanListOfFunctions(lstF); | |
232 | ||
233 | ||
234 | //Checker for L1GammaPatch (if a patch triggers > sigmaG * mean value (1/#patch positions total) says "hot spot !") | |
edd592b8 | 235 | Double_t dL1GmeanTrig = 1/2961.; |
a2e583d8 | 236 | Int_t sigmaG = 5; // deviation from mean value |
edd592b8 | 237 | Double_t dL1GEntries = hL1GammaPatch->GetEntries(); |
238 | Int_t badL1G[48][64] = {{0}} ; | |
239 | Int_t nBadL1G = 0; | |
a2e583d8 | 240 | for(Int_t ix = 1; ix <= hL1GammaPatch->GetNbinsX(); ix++) { |
241 | for(Int_t iy = 1; iy <= hL1GammaPatch->GetNbinsY(); iy++) { | |
242 | Double_t binContent = hL1GammaPatch->GetBinContent(ix, iy) ; | |
243 | if (binContent != 0) { | |
edd592b8 | 244 | if ((double)binContent/(double)dL1GEntries > sigmaG*dL1GmeanTrig) { |
245 | badL1G[ix-1][iy-1] += 1; | |
246 | nBadL1G += 1; | |
a2e583d8 | 247 | } |
248 | } | |
249 | } | |
250 | } | |
251 | ||
252 | if(fTextL1[0]){ | |
253 | lstF->Add(fTextL1[0]->Clone()) ; | |
254 | fTextL1[0]->Clear() ; | |
255 | ||
edd592b8 | 256 | if (nBadL1G == 0) { |
a2e583d8 | 257 | fTextL1[0]->SetFillColor(3) ; |
258 | fTextL1[0]->AddText(Form("L1 GAMMA TRIGGER = OK, ENJOY...")); | |
259 | } | |
260 | else { | |
261 | fTextL1[0]->SetFillColor(2) ; | |
262 | fTextL1[0]->AddText(Form("HOT SPOT IN L1 GAMMA TRIGGER = CALL EXPERT!!")); | |
263 | /* | |
264 | for(Int_t ix = 1; ix <= hL1GammaPatch->GetNbinsX(); ix++) { | |
265 | for(Int_t iy = 1; iy <= hL1GammaPatch->GetNbinsY(); iy++) { | |
edd592b8 | 266 | if(badL1G[ix-1][iy-1] != 0) printf("L1 Gamma patch with position x = %d, y = %d is out of range\n",ix,iy); |
a2e583d8 | 267 | } |
268 | } | |
269 | */ | |
270 | } | |
271 | }//fTextL1[0] | |
272 | }// L1 gamma patch checking done | |
273 | ||
274 | if(hL1JetPatch->GetEntries() !=0) { | |
275 | lstF = hL1JetPatch->GetListOfFunctions(); | |
276 | CleanListOfFunctions(lstF); | |
277 | ||
278 | //Checker for L1JetPatch (if a patch triggers > sigmaJ * mean value (1/#patch positions total) says "hot spot !") | |
edd592b8 | 279 | Double_t dL1JmeanTrig = 1/126.; |
a2e583d8 | 280 | Int_t sigmaJ = 5; // deviation from mean value |
edd592b8 | 281 | Double_t dL1JEntries = hL1JetPatch->GetEntries(); |
282 | Int_t badL1J[12][16] = {{0}} ; | |
283 | Int_t nBadL1J = 0; | |
a2e583d8 | 284 | for(Int_t ix = 1; ix <= hL1JetPatch->GetNbinsX(); ix++) { |
285 | for(Int_t iy = 1; iy <= hL1JetPatch->GetNbinsY(); iy++) { | |
286 | Double_t binContent = hL1JetPatch->GetBinContent(ix, iy) ; | |
287 | if (binContent != 0) { | |
edd592b8 | 288 | if ((double)binContent/(double)dL1JEntries > sigmaJ*dL1JmeanTrig) { |
289 | badL1J[ix-1][iy-1] += 1 ; | |
290 | nBadL1J += 1; | |
a2e583d8 | 291 | } |
292 | } | |
293 | } | |
294 | } | |
295 | ||
296 | if(fTextL1[1]){ | |
297 | lstF->Add(fTextL1[1]->Clone()) ; | |
298 | fTextL1[1]->Clear() ; | |
299 | ||
edd592b8 | 300 | if (nBadL1J == 0) { |
a2e583d8 | 301 | fTextL1[1]->SetFillColor(3) ; |
302 | fTextL1[1]->AddText(Form("L1 JET TRIGGER = OK, ENJOY...")); | |
303 | } | |
304 | else { | |
305 | fTextL1[1]->SetFillColor(2) ; | |
306 | fTextL1[1]->AddText(Form("HOT SPOT IN L1 JET TRIGGER = CALL EXPERT!!")); | |
307 | /* | |
308 | for(Int_t ix = 1; ix <= hL1JetPatch->GetNbinsX(); ix++) { | |
309 | for(Int_t iy = 1; iy <= hL1JetPatch->GetNbinsY(); iy++) { | |
edd592b8 | 310 | if(badL1J[ix-1][iy-1] != 0) printf("L1 Jet patch with position x = %d, y = %d is out of range\n",(4*ix-4),(4*iy-4)); |
a2e583d8 | 311 | } |
312 | } | |
313 | */ | |
314 | ||
315 | } | |
316 | }//fTextL1[1] | |
317 | } // L1 Jet patch checking done | |
318 | ||
319 | if(hFrameR->GetEntries() !=0) { | |
320 | lstF = hFrameR->GetListOfFunctions(); | |
321 | CleanListOfFunctions(lstF); | |
322 | ||
edd592b8 | 323 | Int_t badLink[32] = {0}; |
324 | Int_t nBadLink = 0; | |
bb5d026f | 325 | for(Int_t ix = 1; ix <= hFrameR->GetNbinsX(); ix++) { |
a2e583d8 | 326 | Double_t binContent = hFrameR->GetBinContent(ix) ; |
327 | if (binContent == 0) { | |
bb5d026f | 328 | badLink[ix-1] += 1; |
edd592b8 | 329 | nBadLink += 1; |
a2e583d8 | 330 | } |
331 | } | |
332 | if(fTextL1[2]){ | |
333 | lstF->Add(fTextL1[2]->Clone()) ; | |
334 | fTextL1[2]->Clear() ; | |
335 | ||
edd592b8 | 336 | if (nBadLink == 0) { |
a2e583d8 | 337 | fTextL1[2]->SetFillColor(3) ; |
338 | fTextL1[2]->AddText(Form("LINK TRU-STU = OK, ENJOY...")); | |
339 | } | |
340 | else { | |
341 | fTextL1[2]->SetFillColor(2) ; | |
342 | fTextL1[2]->AddText(Form("PROBLEM WITH TRU-STU LINK = CALL EXPERT!!")); | |
343 | /* | |
344 | for(Int_t ix = 0; ix <= hFrameR->GetNbinsX(); ix++) { | |
edd592b8 | 345 | if(badLink[ix] != 0) printf("STU link with TRU %d is out\n",ix); |
a2e583d8 | 346 | } |
347 | */ | |
348 | } | |
349 | }//fTextL1[2] | |
350 | } // Checker for link TRU-STU done | |
351 | } | |
9e47432c | 352 | |
a2e583d8 | 353 | } |
354 | } | |
9e47432c | 355 | //______________________________________________________________________________ |
a2e583d8 | 356 | |
9e47432c | 357 | void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) |
358 | { | |
359 | /// intialises QA and QA checker settings | |
360 | AliQAv1::Instance(det) ; | |
361 | Float_t hiValue[AliQAv1::kNBIT] ; | |
362 | Float_t lowValue[AliQAv1::kNBIT] ; | |
363 | lowValue[AliQAv1::kINFO] = 0.0 ; | |
364 | hiValue[AliQAv1::kINFO] = 0.1 ; | |
9e47432c | 365 | lowValue[AliQAv1::kWARNING] = 0.1 ; |
6a754398 | 366 | hiValue[AliQAv1::kWARNING] = 0.5 ; |
9e47432c | 367 | lowValue[AliQAv1::kERROR] = 0.5 ; |
368 | hiValue[AliQAv1::kERROR] = 0.8 ; | |
369 | lowValue[AliQAv1::kFATAL] = 0.8 ; | |
370 | hiValue[AliQAv1::kFATAL] = 1.0 ; | |
371 | SetHiLo(&hiValue[0], &lowValue[0]) ; | |
372 | } | |
94594e5d | 373 | |
a2e583d8 | 374 | //______________________________________________________________________________ |
375 | ||
376 | void AliEMCALQAChecker::CleanListOfFunctions(TList *list) | |
edd592b8 | 377 | { // clean up |
a2e583d8 | 378 | |
379 | if (list) { | |
380 | TObject *stats = list->FindObject("stats"); list->Remove(stats); | |
381 | TObject *obj; | |
382 | while ((obj = list->First())) { while(list->Remove(obj)) { } delete obj; } | |
383 | if (stats) list->Add(stats); | |
384 | } | |
385 | else { | |
386 | AliWarning(Form("Checker : empty list of data functions; returning")); | |
387 | return; | |
388 | } | |
389 | ||
390 | } | |
391 | ||
392 |