]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ZDC/AliZDCQAChecker.cxx
Update train macros
[u/mrichter/AliRoot.git] / ZDC / AliZDCQAChecker.cxx
... / ...
CommitLineData
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// --- ROOT system ---
18#include <TH1F.h>
19#include <TIterator.h>
20#include <TString.h>
21#include <TPaveText.h>
22#include <TObjArray.h>
23#include "TList.h"
24
25// --- Standard library ---
26
27// --- AliRoot header files ---
28#include "AliLog.h"
29#include "AliZDCQAChecker.h"
30
31ClassImp(AliZDCQAChecker)
32
33//____________________________________________________________________________
34void AliZDCQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list,
35 const AliDetectorRecoParam * /*recoParam*/)
36{
37 // Checks the QA histograms on the input list:
38 //
39 const char* taskName = AliQAv1::GetAliTaskName(index);
40 //printf("\n\tAliZDCQAChecker -> checking QA histos for task %s\n",taskName);
41 //
42 Int_t ihitHisto=0, idigHisto=0;
43 Int_t irecHisto=0, irawHisto=0, esdInd=0;
44
45 TObjArray messages;
46 messages.SetOwner(kTRUE);
47
48 for(Int_t specie = 0; specie<AliRecoParam::kNSpecies; specie++){
49 Int_t count = 0;
50 if(!AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)))
51 continue ;
52 //printf("\tAliZDCQAChecker -> specie %d, AliRecoParam::ConvertIndex(specie) %d, AliRecoParam::kLowMult %d, IsEventSpecieSet(specie) %d\n",
53 // specie, AliRecoParam::ConvertIndex(specie) ,AliRecoParam::kLowMult,
54 // AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)));
55
56 // ====================================================================
57 // Checks for p-p events
58 // ====================================================================
59 if(AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult){
60 if(list[specie]->GetEntries()==0){
61 AliWarning("\t The list to be checked is empty!"); // nothing to check
62 return;
63 }
64 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
65 TIter next(list[specie]);
66 count = 0;
67 TH1 * hdata;
68
69 Float_t res=0., percentageDiff=0.30;
70 Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
71 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
72 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
73 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
74 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
75 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
76 Int_t nentries = -99;
77
78 while((hdata = dynamic_cast<TH1 *>(next()))){
79 if(hdata){
80 // -------------------------------------------------------------------
81 if(index == AliQAv1::kSIM){
82 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
83 // Check HITS histos
84 //
85 if(!(strncmp(hdata->GetName(),"hHits",5))){
86 if(hdata->GetEntries()>0){
87 if(ihitHisto==0) meanZNC = hdata->GetMean();
88 else if(ihitHisto==1) meanZNA = hdata->GetMean();
89 else if(ihitHisto==2) meanZPC = hdata->GetMean();
90 else if(ihitHisto==3) meanZPA = hdata->GetMean();
91 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
92 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
93 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
94 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
95 else if(ihitHisto==8) pmCZNC = hdata->GetMean();
96 else if(ihitHisto==9) pmCZNA = hdata->GetMean();
97 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
98 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
99 }
100 //
101 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
102 if(ihitHisto==11){
103 if(TMath::Abs(meanZNC)>1.e-10){
104 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
105 res=1.;
106 else
107 res=.5;
108 test[specie] += res;
109 count++;
110 }
111 if(TMath::Abs(meanZNA)>1.e-10){
112 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
113 res=1.;
114 else percentageDiff=
115 res=.5;
116 test[specie] += res;
117 count++;
118 }
119 if(TMath::Abs(meanZPC)>1.e-10){
120 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
121 res=1.;
122 else
123 res=.5;
124 test[specie] += res;
125 count++;
126 }
127 if(TMath::Abs(meanZPA)>1.e-10){
128 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
129 res=1.;
130 else
131 res=.5;
132 test[specie] += res;
133 count++;
134 }
135 }
136 ihitHisto++;
137 }
138 // Check DIGIT HIGH GAIN CHAIN histos
139 else if(!(strncmp(hdata->GetName(),"hDig",4))){
140 if(hdata->GetEntries()>0){
141 if(idigHisto==0) sumADCZNC = hdata->GetMean();
142 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
143 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
144 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
145 else if(idigHisto==4) pmQZNC = hdata->GetMean();
146 else if(idigHisto==5) pmQZNA = hdata->GetMean();
147 else if(idigHisto==6) pmQZPC = hdata->GetMean();
148 else if(idigHisto==7) pmQZPA = hdata->GetMean();
149 else if(idigHisto==8) pmCZNC = hdata->GetMean();
150 else if(idigHisto==9) pmCZNA = hdata->GetMean();
151 else if(idigHisto==10) pmCZPC = hdata->GetMean();
152 else if(idigHisto==11) pmCZPA = hdata->GetMean();
153 }
154 //
155 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
156 if(idigHisto==11){
157 if(TMath::Abs(sumADCZNC)>1.e-10){
158 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
159 res=1.;
160 else
161 res=.5;
162 test[specie] += res;
163 count++;
164 }
165 if(TMath::Abs(sumADCZNA)>1.e-10){
166 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
167 res=1.;
168 else
169 res=.5;
170 test[specie] += res;
171 count++;
172 }
173 if(TMath::Abs(sumADCZPC)>1.e-10){
174 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
175 res=1.;
176 else
177 res=.5;
178 test[specie] += res;
179 count++;
180 }
181 if(TMath::Abs(sumADCZPA)>1.e-10){
182 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
183 res=1.;
184 else
185 res=.5;
186 test[specie] += res;
187 count++;
188 }
189 }
190 idigHisto++;
191 }
192 }
193 // -------------------------------------------------------------------
194 else if(index == AliQAv1::kRAW) {
195 //
196 // Check RAW HIGH GAIN CHAIN histos
197
198 messages.Clear();
199
200 Bool_t iDetPM = kTRUE;
201 // --- Checks
202 if(irawHisto==16) nentries = Int_t (hdata->GetEntries());
203 if(irawHisto==18){
204 Float_t resADC=0.;
205 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
206 if((hdata->GetBinContent(ibin))>10.){
207 res=1.;
208 }
209 else if((hdata->GetBinContent(ibin))<10.){
210 res=0.5;
211 if(ibin==1 || ibin==6 || ibin==11 || ibin==12 || ibin==13 || ibin==18){
212 iDetPM = kFALSE;
213 }
214 }
215 //
216 resADC += res;
217 test[specie] += res;
218 count++;
219 }
220 if(nentries != -99) messages.Add(new TObjString(Form("#entries %d",nentries)));
221 else messages.Add(new TObjString("#entries not known"));
222 //
223 Float_t rv=1.;
224 if(hdata->GetNbinsX() != 0) rv = resADC/hdata->GetNbinsX();
225 if(rv == 1.) messages.Add(new TObjString("ADCs are OK!"));
226 else if(iDetPM==kFALSE){
227 messages.Add(new TObjString("Problem with some ADC!"));
228 messages.Add(new TObjString("IF THIS IS A PHYSICS RUN"));
229 }
230 else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
231 SetupHisto(messages, *hdata, rv);
232 }
233 else if(irawHisto==19){
234 // Reference values from RUN 145456
235 Double_t refTDCs[6] = {-322.5,-319.1,-320.9,-319.2,-319.7,-319.2};
236 Float_t resTDC=0.;
237 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
238 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<3.){
239 res=1.;
240 }
241 else if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<5.){
242 res=0.8;
243 }
244 else res=0.5;
245 //
246 resTDC += res;
247 test[specie] += res;
248 count++;
249 }
250 Float_t rv=1.;
251 if(hdata->GetNbinsX() != 0) rv = resTDC/hdata->GetNbinsX();
252 if(rv == 1.) messages.Add(new TObjString("TDCs are OK!"));
253 else if(rv<1. && rv>0.75) messages.Add(new TObjString("Minor problem with TDCs"));
254 else{
255 messages.Add(new TObjString("Serious problem in ZDC timing"));
256 messages.Add(new TObjString("IF THIS IS A PHYSICS RUN"));
257 }
258 SetupHisto(messages, *hdata, rv);
259 }
260 irawHisto++;
261
262 }
263 // -------------------------------------------------------------------
264 else if(index == AliQAv1::kREC) {
265 //
266 // Check REC HIGH GAIN CHAIN histos
267 if(hdata->GetEntries()>0){
268 if(irecHisto==0) meanZNC = hdata->GetMean();
269 else if(irecHisto==1) meanZNA = hdata->GetMean();
270 else if(irecHisto==2) meanZPC = hdata->GetMean();
271 else if(irecHisto==3) meanZPA = hdata->GetMean();
272 else if(irecHisto==4) pmQZNC = hdata->GetMean();
273 else if(irecHisto==5) pmQZNA = hdata->GetMean();
274 else if(irecHisto==6) pmQZPC = hdata->GetMean();
275 else if(irecHisto==7) pmQZPA = hdata->GetMean();
276 else if(irecHisto==8) pmCZNC = hdata->GetMean();
277 else if(irecHisto==9) pmCZNA = hdata->GetMean();
278 else if(irecHisto==10) pmCZPC = hdata->GetMean();
279 else if(irecHisto==11) pmCZPA = hdata->GetMean();
280 }
281 //
282 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
283 if(irecHisto==11){
284 if(TMath::Abs(meanZNC)>1.e-10){
285 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
286 res=1.;
287 else
288 res=.5;
289 test[specie] += res;
290 count++;
291 }
292 if(TMath::Abs(meanZNA)>1.e-10){
293 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
294 res=1.;
295 else
296 res=.5;
297 test[specie] += res;
298 count++;
299 }
300 if(TMath::Abs(meanZPC)>1.e-10){
301 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
302 res=1.;
303 else
304 res=.5;
305 test[specie] += res;
306 count++;
307 }
308 if(TMath::Abs(meanZPA)>1.e-10){
309 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
310 res=1.;
311 else
312 res=.5;
313 test[specie] += res;
314 count++;
315 }
316 }
317 irecHisto++;
318 }
319 // -------------------------------------------------------------------
320 else if(index == AliQAv1::kESD) {
321 //
322 // Check ESD HIGH GAIN CHAIN histos
323 if(hdata->GetEntries()>0){
324 if(esdInd==0) sumADCZNC = hdata->GetMean();
325 else if(esdInd==1) sumADCZNA = hdata->GetMean();
326 else if(esdInd==2) sumADCZPC = hdata->GetMean();
327 else if(esdInd==3) sumADCZPA = hdata->GetMean();
328 else if(esdInd==6) pmQZNC = hdata->GetMean();
329 else if(esdInd==7) pmQZNA = hdata->GetMean();
330 else if(esdInd==8) pmQZPC = hdata->GetMean();
331 else if(esdInd==9) pmQZPA = hdata->GetMean();
332 else if(esdInd==10) pmCZNC = hdata->GetMean();
333 else if(esdInd==11) pmCZNA = hdata->GetMean();
334 else if(esdInd==12) pmCZPC = hdata->GetMean();
335 else if(esdInd==13) pmCZPA = hdata->GetMean();
336 }
337 //
338 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
339 if(esdInd==15){
340 if(TMath::Abs(sumADCZNC)>1.e-10){
341 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
342 res=1.;
343 else
344 res=.5;
345 test[specie] += res;
346 count++;
347 }
348 if(TMath::Abs(sumADCZNA)>1.e-10){
349 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
350 res=1.;
351 else
352 res=.5;
353 test[specie] += res;
354 count++;
355 }
356 if(TMath::Abs(sumADCZPC)>1.e-10){
357 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
358 res=1.;
359 else
360 res=.5;
361 test[specie] += res;
362 count++;
363 }
364 if(TMath::Abs(sumADCZPA)>1.e-10){
365 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
366 res=1.;
367 else
368 res=.5;
369 test[specie] += res;
370 count++;
371 }
372 }
373 esdInd++;
374 }
375 else {
376 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
377 return ;
378 }
379 }//if(hdata)
380 else AliError("AliZDCQAChecker-> No histos!!!\n");
381 }
382 } // LowMult (p-p)
383 // ====================================================================
384 // Checks for A-A events
385 // ====================================================================
386 if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult) {
387 if(list[specie]->GetEntries()==0){
388 AliWarning("\t The list to be checked is empty!");
389 return ;
390 }
391 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName));
392 //
393 TIter next(list[specie]);
394 count = 0;
395 TH1 * hdata;
396
397 Float_t res=0., percentageDiff=0.10;
398 Float_t meanZNA=0., meanZNC=0., meanZPA=0., meanZPC=0.;
399 Float_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
400 Float_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
401 Float_t sumADCZNA=0., sumADCZNC=0., sumADCZPA=0., sumADCZPC=0.;
402 Float_t adcCZNA=0., adcCZNC=0., adcCZPA=0., adcCZPC=0.;
403 Float_t adcQZNA=0., adcQZNC=0., adcQZPA=0., adcQZPC=0.;
404 Int_t nentries=-99;
405
406 while((hdata = dynamic_cast<TH1 *>(next()))){
407 if(hdata){
408 //AliDebug(AliQAv1::GetQADebugLevel(), Form("\tAliZDCQAChecker-> checking histo %s",hdata->GetName()));
409 // -------------------------------------------------------------------
410 if(index == AliQAv1::kSIM){
411 // Check HITS histos
412 if (!(strncmp(hdata->GetName(),"hHits",5))){
413 if(hdata->GetEntries()>0){
414 if(ihitHisto==0) meanZNC = hdata->GetMean();
415 else if(ihitHisto==1) meanZNA = hdata->GetMean();
416 else if(ihitHisto==2) meanZPC = hdata->GetMean();
417 else if(ihitHisto==3) meanZPA = hdata->GetMean();
418 else if(ihitHisto==4) pmQZNC = hdata->GetMean();
419 else if(ihitHisto==5) pmQZNA = hdata->GetMean();
420 else if(ihitHisto==6) pmQZPC = hdata->GetMean();
421 else if(ihitHisto==7) pmQZPA = hdata->GetMean();
422 else if(ihitHisto==8) pmCZNC = hdata->GetMean();
423 else if(ihitHisto==9) pmCZNA = hdata->GetMean();
424 else if(ihitHisto==10) pmCZPC = hdata->GetMean();
425 else if(ihitHisto==11) pmCZPA = hdata->GetMean();
426 }
427 //
428 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
429 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
430 if(ihitHisto==3){
431 if(TMath::Abs(meanZNC)>1.e-10 && TMath::Abs(meanZNA)>1.e-10){
432 if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff)
433 res=1.;
434 else
435 res=.5;
436 test[specie] += res;
437 count++;
438 }
439 if(TMath::Abs(meanZPC)>1.e-10 && TMath::Abs(meanZPA)>1.e-10){
440 if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff)
441 res=1.;
442 else
443 res=.5;
444 test[specie] += res;
445 count++;
446 }
447 }
448 // --- Check whether (mean PMQi - PMC)/PMC < percentageDiff
449 if(ihitHisto==11){
450 if(TMath::Abs(meanZNC)>1.e-10){
451 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
452 res=1.;
453 else
454 res=.5;
455 test[specie] += res;
456 count++;
457 }
458 if(TMath::Abs(meanZNA)>1.e-10){
459 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
460 res=1.;
461 else
462 res=.5;
463 test[specie] += res;
464 count++;
465 }
466 if(TMath::Abs(meanZPC)>1.e-10){
467 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
468 res=1.;
469 else
470 res=.5;
471 test[specie] += res;
472 count++;
473 }
474 if(TMath::Abs(meanZPA)>1.e-10){
475 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
476 res=1.;
477 else
478 res=.5;
479 test[specie] += res;
480 count++;
481 }
482 }
483 ihitHisto++;
484 }
485 // Check DIGITS histos
486 else if (!(strncmp(hdata->GetName(),"hDig",4))){
487 if(hdata->GetEntries()>0){
488 if(idigHisto==0) sumADCZNC = hdata->GetMean();
489 else if(idigHisto==1) sumADCZNA = hdata->GetMean();
490 else if(idigHisto==2) sumADCZPC = hdata->GetMean();
491 else if(idigHisto==3) sumADCZPA = hdata->GetMean();
492 else if(idigHisto==4) adcQZNC = hdata->GetMean();
493 else if(idigHisto==5) adcQZNA = hdata->GetMean();
494 else if(idigHisto==6) adcQZPC = hdata->GetMean();
495 else if(idigHisto==7) adcQZPA = hdata->GetMean();
496 else if(idigHisto==8) adcCZNC = hdata->GetMean();
497 else if(idigHisto==9) adcCZNA = hdata->GetMean();
498 else if(idigHisto==10) adcCZPC = hdata->GetMean();
499 else if(idigHisto==11) adcCZPA = hdata->GetMean();
500 }
501 //
502 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
503 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
504 if(idigHisto==3){
505 if(TMath::Abs(sumADCZNC)>1.e-10 && TMath::Abs(sumADCZNA)>1.e-10){
506 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
507 res=1.;
508 else
509 res=.5;
510 test[specie] += res;
511 count++;
512 }
513 if(TMath::Abs(sumADCZPC)>1.e-10 && TMath::Abs(sumADCZPA)>1.e-10){
514 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
515 res=1.;
516 else
517 res=.5;
518 test[specie] += res;
519 count++;
520 }
521 }
522 // --- Check whether (sumADC PMQi - PMC)/PMC < percentageDiff
523 if(idigHisto==11){
524 if(TMath::Abs(sumADCZNC)>1.e-10){
525 if((TMath::Abs(adcQZNC-adcCZNC)/adcCZNC)<percentageDiff)
526 res=1.;
527 else
528 res=.5;
529 test[specie] += res;
530 count++;
531 }
532 if(TMath::Abs(sumADCZNA)>1.e-10){
533 if((TMath::Abs(adcQZNA-adcCZNA)/adcCZNA)<percentageDiff)
534 res=1.;
535 else
536 res=.5;
537 test[specie] += res;
538 count++;
539 }
540 if(TMath::Abs(sumADCZPC)>1.e-10){
541 if((TMath::Abs(adcQZPC-adcCZPC)/adcCZPC)<percentageDiff)
542 res=1.;
543 else
544 res=.5;
545 test[specie] += res;
546 count++;
547 }
548 if(TMath::Abs(sumADCZPA)>1.e-10){
549 if((TMath::Abs(adcQZPA-adcCZPA)/adcCZPA)<percentageDiff)
550 res=1.;
551 else
552 res=.5;
553 test[specie] += res;
554 count++;
555 }
556 }
557 idigHisto++;
558 }
559 }
560 // -------------------------------------------------------------------
561 else if(index == AliQAv1::kRAW){
562 //
563 // Check RAW HIGH GAIN CHAIN histos
564
565 messages.Clear();
566
567 Bool_t iDetPM = kTRUE;
568 // --- Checks
569 if(irawHisto==16) nentries = Int_t (hdata->GetEntries());
570 if(irawHisto==18){
571 Float_t resADC=0.;
572 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
573 if((hdata->GetBinContent(ibin))>10.){
574 res=1.;
575 }
576 else if((hdata->GetBinContent(ibin))<10. &&
577 (ibin==1 || ibin==6 || ibin==11 || ibin==12 || ibin==13 || ibin==18)){
578 res=0.5;
579 iDetPM = kFALSE;
580 }
581 //
582 resADC += res;
583 test[specie] += res;
584 count++;
585 }
586 if(nentries != -99) messages.Add(new TObjString(Form("#entries %d",nentries)));
587 else messages.Add(new TObjString("#entries not known"));
588 //
589 Float_t rv=1.;
590 if(hdata->GetNbinsX() != 0) rv = resADC/hdata->GetNbinsX();
591 if(rv > 0.98) messages.Add(new TObjString("ADCs are OK!"));
592 else if(iDetPM==kFALSE){
593 messages.Add(new TObjString("Problem with ADCs!"));
594 messages.Add(new TObjString("IF THIS IS A PHYSICS RUN"));
595 }
596 else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
597 SetupHisto(messages, *hdata, rv);
598 }
599 else if(irawHisto==19){
600 // Reference values from RUN 137161
601 Double_t refTDCs[6] = {-320.7,-319.0,-318.6,-319.9,-321.3,-320.8};
602 Float_t resTDC=0.;
603 for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
604 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<3.){
605 res=1.;
606 }
607 else if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<4.){
608 res=0.8;
609 }
610 else res=0.5;
611 //
612 resTDC += res;
613 test[specie] += res;
614 count++;
615 }
616 Float_t rv=1.;
617 if(hdata->GetNbinsX() != 0) rv = resTDC/hdata->GetNbinsX();
618 if(rv == 1.) messages.Add(new TObjString("TDCs are OK!"));
619 else if(rv<1 && rv>0.75) messages.Add(new TObjString("Minor problem with TDCs"));
620 else{
621 messages.Add(new TObjString("Serious problem in ZDC timing"));
622 messages.Add(new TObjString("IF THIS IS A PHYSICS RUN"));
623 }
624 SetupHisto(messages, *hdata, rv);
625 }
626 irawHisto++;
627
628 }
629 // -------------------------------------------------------------------
630 else if(index == AliQAv1::kREC){
631 //
632 // Check RAW HIGH GAIN CHAIN histos
633 if(hdata->GetEntries()>0){
634 if(irecHisto==0) meanZNC = hdata->GetMean();
635 else if(irecHisto==1) meanZNA = hdata->GetMean();
636 else if(irecHisto==2) meanZPC = hdata->GetMean();
637 else if(irecHisto==3) meanZPA = hdata->GetMean();
638 else if(irecHisto==4) pmQZNC = hdata->GetMean();
639 else if(irecHisto==5) pmQZNA = hdata->GetMean();
640 else if(irecHisto==6) pmQZPC = hdata->GetMean();
641 else if(irecHisto==7) pmQZPA = hdata->GetMean();
642 else if(irecHisto==8) pmCZNC = hdata->GetMean();
643 else if(irecHisto==9) pmCZNA = hdata->GetMean();
644 else if(irecHisto==10) pmCZPC = hdata->GetMean();
645 else if(irecHisto==11) pmCZPA = hdata->GetMean();
646 }
647 //
648 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
649 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
650 if(irecHisto==3){
651 if(TMath::Abs(meanZNC)>1.e-10 && TMath::Abs(meanZNA)>1.e-10){
652 if((2*TMath::Abs(meanZNC-meanZNA)/(meanZNA+meanZNC))<percentageDiff)
653 res=1.;
654 else
655 res=.5;
656 test[specie] += res;
657 count++;
658 }
659 if(TMath::Abs(meanZPC)>1.e-10 && TMath::Abs(meanZPA)>1.e-10){
660 if((TMath::Abs(meanZPC-meanZPA)/(meanZPA+meanZPC))<percentageDiff)
661 res=1.;
662 else
663 res=.5;
664 test[specie] += res;
665 count++;
666 }
667 }
668 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
669 if(irecHisto==11){
670 if((TMath::Abs(meanZNC)>1.e-10) && (pmCZNC>1.e-10)){
671 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
672 res=1.;
673 else
674 res=.5;
675 test[specie] += res;
676 count++;
677 }
678 if((TMath::Abs(meanZNA)>1.e-10) && (pmCZNA>1.e-10)){
679 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
680 res=1.;
681 else
682 res=.5;
683 test[specie] += res;
684 count++;
685 }
686 if((TMath::Abs(meanZPC)>1.e-10) && (pmCZPC>1.e-10)){
687 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
688 res=1.;
689 else
690 res=.5;
691 test[specie] += res;
692 count++;
693 }
694 if((TMath::Abs(meanZPA)>1.e-10) && (pmCZPA>1.e-10)){
695 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
696 res=1.;
697 else
698 res=.5;
699 test[specie] += res;
700 count++;
701 }
702 }
703 irecHisto++;
704 }
705 // -------------------------------------------------------------------
706 else if(index == AliQAv1::kESD){
707 //
708 // Check ESD HIGH GAIN CHAIN histos
709 if(hdata->GetEntries()>0){
710 if(esdInd==0) sumADCZNC = hdata->GetMean();
711 else if(esdInd==1) sumADCZNA = hdata->GetMean();
712 else if(esdInd==2) sumADCZPC = hdata->GetMean();
713 else if(esdInd==3) sumADCZPA = hdata->GetMean();
714 else if(esdInd==6) pmQZNC = hdata->GetMean();
715 else if(esdInd==7) pmQZNA = hdata->GetMean();
716 else if(esdInd==8) pmQZPC = hdata->GetMean();
717 else if(esdInd==9) pmQZPA = hdata->GetMean();
718 else if(esdInd==10) pmCZNC = hdata->GetMean();
719 else if(esdInd==11) pmCZNA = hdata->GetMean();
720 else if(esdInd==12) pmCZPC = hdata->GetMean();
721 else if(esdInd==13) pmCZPA = hdata->GetMean();
722 }
723 //
724 // --- Check whether 2*|Mean ZNA - Mean ZNC|/(Mean ZNA + Mean ZNC) < percentageDiff
725 // --- and 2*|Mean ZPA - Mean ZPC|/(Mean ZPA + Mean ZPC) < 2*percentageDiff
726 if(esdInd==5){
727 if(TMath::Abs(sumADCZNC)>1.e-10 && TMath::Abs(sumADCZNA)>1.e-10){
728 if((2*TMath::Abs(sumADCZNC-sumADCZNA)/(sumADCZNA+sumADCZNC))<percentageDiff)
729 res=1.;
730 else
731 res=.5;
732 test[specie] += res;
733 count++;
734 }
735 if(TMath::Abs(sumADCZPC)>1.e-10 && TMath::Abs(sumADCZPA)>1.e-10){
736 if((TMath::Abs(sumADCZPC-sumADCZPA)/(sumADCZPA+sumADCZPC))<percentageDiff)
737 res=1.;
738 else
739 res=.5;
740 test[specie] += res;
741 count++;
742 }
743 }
744 // --- Check whether (sum PMQi - PMC)/PMC < percentageDiff
745 if(esdInd==15){
746 if(TMath::Abs(sumADCZNC)>1.e-10){
747 if((TMath::Abs(pmQZNC-pmCZNC)/pmCZNC)<percentageDiff)
748 res=1.;
749 else
750 res=.5;
751 test[specie] += res;
752 count++;
753 }
754 if(TMath::Abs(sumADCZNA)>1.e-10){
755 if((TMath::Abs(pmQZNA-pmCZNA)/pmCZNA)<percentageDiff)
756 res=1.;
757 else
758 res=.5;
759 test[specie] += res;
760 count++;
761 }
762/* if(TMath::Abs(sumADCZPC)>1.e-10){
763 if((TMath::Abs(pmQZPC-pmCZPC)/pmCZPC)<percentageDiff)
764 res=1.;
765 else
766 res=.5;
767 test[specie] += res;
768 count++;
769 }
770 if(TMath::Abs(sumADCZPA)>1.e-10){
771 if((TMath::Abs(pmQZPA-pmCZPA)/pmCZPA)<percentageDiff)
772 res=1.;
773 else
774 res=.5;
775 test[specie] += res;
776 count++;
777 }
778*/
779 }
780 esdInd++;
781 }
782 else {
783 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
784 return ;
785 }
786 }//if(hdata)
787 else AliError("\t No histos found for ZDC!!!\n");
788 }
789 } // HighMult (Pb-Pb)
790 // ====================================================================
791 // Checks for Calibration events
792 // ====================================================================
793 if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib) {
794 AliWarning(Form("\n\t No check implemented in ZDC QA for %s task in CALIBRATION events\n",taskName));
795 return ;
796 } // Calibration
797 // ====================================================================
798 // Checks for cosmic events
799 // ====================================================================
800 else if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic) {
801 AliWarning(Form("\n\t No check needed in ZDC QA for %s task in COSMIC events\n",taskName));
802 return ;
803 } // Cosmic
804 if(TMath::Abs(count)>1.e-10) test[specie] = test[specie]/count;
805 AliDebug(AliQAv1::GetQADebugLevel(), Form("\n\t ZDC QA check result = %1.2f\n",test[specie]));
806 } // Loop on species
807}
808
809//___________________________________________________________________
810void AliZDCQAChecker::SetupHisto(const TObjArray& messages, TH1& histo, Float_t& code)
811{
812 //
813 /// Add text to histos
814 //
815
816 TPaveText* text = new TPaveText(0.70,0.70,0.99,0.99,"NDC");
817
818 TIter next(&messages);
819 TObjString* str;
820
821 while ( ( str = static_cast<TObjString*>(next()) ) ){
822 text->AddText(str->String());
823 }
824
825 TString defaultText = "";
826
827 Int_t color = 0;
828 if(code==1.){
829 color = kGreen;
830 defaultText = "Everything is fine!";
831 }
832 else if(code<1. && code>=0.85){
833 color = kYellow;
834 defaultText = "To be monitored in next runs";
835 }
836 else if(code<0.85 && code>=0.6){
837 color = kOrange;
838 defaultText = "notify the expert DURING THE DAY!";
839 }
840 else if(code<0.6){
841 color = kRed;
842 defaultText = "PLEASE CALL THE EXPERT!!!!";
843 }
844
845
846 text->AddText(defaultText.Data());
847 text->SetFillColor(color);
848
849 //histo.SetFillStyle(1001);
850 //histo.SetFillColor(color);
851
852 histo.SetStats(kFALSE);
853
854 TList* lst = histo.GetListOfFunctions();
855 if(lst){
856 TObject *stats = lst->FindObject("stats");
857 lst->Remove(stats);
858 TObject *obj;
859 while ((obj = lst->First())) {
860 while(lst->Remove(obj)) { }
861 delete obj;
862 }
863 if(stats) lst->Add(stats);
864 }
865 lst->Add(text);
866}