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