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