]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCQAChecker.cxx
Checker for pp implemented
[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>
075a0e70 21
22// --- Standard library ---
23
24// --- AliRoot header files ---
25#include "AliLog.h"
075a0e70 26#include "AliZDCQAChecker.h"
27
28ClassImp(AliZDCQAChecker)
29
075a0e70 30//____________________________________________________________________________
fdc38bb2 31const Double_t AliZDCQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
075a0e70 32{
12b9729c 33 // Checks the QA histograms on the input list:
34 //
35 Double_t test=0.;
36 Int_t ntests=0;
37 const char* taskName = AliQA::GetAliTaskName(index);
38 //
39 Int_t beamType=0; // 0 -> protons, 1 -> ions
40
41 // ====================================================================
42 // Checks for p-p events
43 // ====================================================================
44 if (beamType==0){
45 // -------------------------------------------------------------------
46 if(index == AliQA::kSIM){
47
48 if(list->GetEntries()==0){
49 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
50 test = 1.; // nothing to check
51 return test;
52 }
53 //printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
54
55 TIter next(list);
56 TH1 * hdata;
57 //
58 ntests = 0;
59 //
60 while((hdata = dynamic_cast<TH1 *>(next()))){
61 if(hdata){
62 //printf("\tAliZDCQAChecker-> checking histo %s",hdata->GetName());
63 // Check DIGITS histos
64 if(!(strncmp(hdata->GetName(),"hDig",4))){
65 if(hdata->GetEntries()>0){
66 test += 1.; ntests++;
67 }
68 }
69 // Check HITS histos
70 else{
71 if(hdata->GetEntries()>0){
72 test += 1.; ntests++;
73 }
74
75 }
76 }
77 else{
78 AliError("AliZDCQAChecker-> No histos!!!\n");
79 }
80 }
81 if(ntests!=0) test = test/ntests;
82 //printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
83 }
075a0e70 84
fdc38bb2 85 // -------------------------------------------------------------------
12b9729c 86 else if(index == AliQA::kRAW){
87
88 if(list->GetEntries()==0){
89 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
90 test = 1.; // nothing to check
91 return test;
92 }
93 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
94
95 TIter next(list);
96 TH1 * hdata;
97 ntests = 0;
98 //
99 while((hdata = dynamic_cast<TH1 *>(next()))){
100 if(hdata){
101 if(hdata->GetEntries()!=0){
102 if(hdata->GetMean()>10.) test += 1.;
103 else test = 0.5;
104 ntests++;
105 }
106 }
107 //
108 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
109 else{
110 AliError("\t AliZDCQAChecker->No histos!!!\n");
111 }
112 }
113 if(ntests!=0) test = test/ntests;
114 //printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
115 }
116
117 // -------------------------------------------------------------------
118 else if(index == AliQA::kESD){
fdc38bb2 119
120 if(list->GetEntries()==0){
121 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
122 test = 1.; // nothing to check
123 return test;
124 }
125 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
126
12b9729c 127 TIter next(list);
128 TH1 * hdata;
129 Int_t esdInd=0;
130 //
131 ntests = 0;
132 //
133 while((hdata = dynamic_cast<TH1 *>(next()))){
134 if(hdata){
135 if(hdata->GetEntries()!=0){
136 if(esdInd>1){
137 if(hdata->GetMean()>10.) test += 1.;
138 else test = 0.5;
139 ntests++;
140 }
141 }
142 //
143 esdInd++;
144 }
145 else{
146 AliError("AliZDCQAChecker-> No histos!!!\n");
147 }
148 }
149 if(ntests!=0) test = test/ntests;
150 //printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n\n",test);
151 }
152 else{
153 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
154 return 1.;
155 }
156 }
157 // ====================================================================
158 // Checks for A-A events
159 // ====================================================================
160 else if (beamType==1){
161 // -------------------------------------------------------------------
162 if(index == AliQA::kSIM){
163
164 if(list->GetEntries()==0){
165 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
166 test = 1.; // nothing to check
167 return test;
168 }
169 //printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
170
3d26d59b 171 TIter next(list);
fdc38bb2 172 TH1 * hdata;
173 Double_t meanX=0., meanY=0.;
174 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
175 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
176 Double_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
177 Double_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
178 Float_t res=0.;
179 Int_t digInd=0, testgood=0;
180 //
12b9729c 181 ntests = 0;
fdc38bb2 182 //
075a0e70 183 while((hdata = dynamic_cast<TH1 *>(next()))){
184 if(hdata){
fdc38bb2 185 //printf("\tAliZDCQAChecker-> checking histo %s",hdata->GetName());
12b9729c 186 // Check DIGITS histos
187 if (!(strncmp(hdata->GetName(),"hDig",4))){
fdc38bb2 188 // [1] check response of ZNC vs. ZNA
189 if(digInd==0 || digInd==1){
190 if(digInd==0){
191 if(hdata->GetEntries() != 0.){
192 testgood=1;
193 meanZNA = hdata->GetMean();
194 rmsZNA = hdata->GetRMS();
195 }
196 }
197 else{
198 if(hdata->GetEntries() != 0.){
199 testgood=1;
200 meanZNC = hdata->GetMean();
201 }
202 else testgood=0;
203 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
204 if(testgood==1){
205 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
206 else res=.5;
207 testgood=0;
208 test += res;
209 ntests++;
210 //
211 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
212 }
213 else res=0.;
214 }
215 }
216 // [2] check response of ZPC vs. ZPA
217 else if(digInd==2 || digInd==3){
218 if(digInd==2){
219 if(hdata->GetEntries() != 0.){
220 testgood=1;
221 meanZPA = hdata->GetMean();
222 rmsZPA = hdata->GetRMS();
223 }
224 }
225 else{
226 if(hdata->GetEntries() != 0.){
227 testgood=1;
228 meanZPC = hdata->GetMean();
229 }
230 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
231 if(testgood==1){
232 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
233 else res=.5;
234 test += res;
235 ntests++;
236 testgood=0;
237 //
238 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
239 }
240 else res=0.;
241 }
242 }
243 // [2] check PMC responses vs. summed PMQ responses
244 else if(digInd>3 && digInd<12){
245 if(digInd==4) pmQZNC = hdata->GetMean();
246 else if(digInd==5) pmQZNA = hdata->GetMean();
247 else if(digInd==6) pmQZPC = hdata->GetMean();
248 else if(digInd==7) pmQZPA = hdata->GetMean();
249 else if(digInd==8){
250 pmCZNC = hdata->GetMean();
251 if(TMath::Abs(pmQZNC-pmCZNC)<(0.1*(pmQZNC+pmCZNC)/2)) res=1.;
252 else res=0.5;
253 test += res;
254 ntests++;
255 //
256 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
257 }
258 else if(digInd==9){
259 pmCZNA = hdata->GetMean();
260 if(TMath::Abs(pmQZNA-pmCZNA)<(0.1*(pmQZNA+pmCZNA)/2)) res=1.;
261 else res=0.5;
262 test += res;
263 ntests++;
264 //
265 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
266 }
267 else if(digInd==10){
268 pmCZPC = hdata->GetMean();
269 if(TMath::Abs(pmQZPC-pmCZPC)<(0.1*(pmQZPC+pmCZPC)/2)) res=1.;
270 else res=0.5;
271 test += res;
272 ntests++;
273 //
274 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
275 }
276 else if(digInd==11){
277 pmCZPA = hdata->GetMean();
278 if(TMath::Abs(pmQZPA-pmCZPA)<(0.1*(pmQZPA+pmCZPA)/2)) res=1.;
279 else res=0.5;
280 test += res;
281 ntests++;
282 //
283 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
284 }
285 }
286 //
287 digInd++;
288 }
12b9729c 289 // Check HITS histos
290 else{
291 // hits histos
292 meanX = hdata->GetMean(1);
293 meanY = hdata->GetMean(2);
294 // check if the spot is centered
295 if((TMath::Abs(meanX)<0.2) && (TMath::Abs(meanY)<0.2)) res=1.;
296 else res=0.5;
297 test += res;
298 ntests++;
299 //
300 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
301 }
075a0e70 302 }
303 else{
fdc38bb2 304 AliError("AliZDCQAChecker-> No histos!!!\n");
075a0e70 305 }
306 }
fdc38bb2 307 if(ntests!=0) test = test/ntests;
308 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
309 }
310
311 // -------------------------------------------------------------------
c7b59e5d 312 else if(index == AliQA::kRAW){
fdc38bb2 313
314 if(list->GetEntries()==0){
315 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
316 test = 1.; // nothing to check
317 return test;
318 }
319 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
320
321 TIter next(list);
322 TH1 * hdata;
323 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
324 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
325 Double_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
326 Double_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
327 Float_t res=0.;
328 Int_t rawInd=0, testgood=0;
12b9729c 329 ntests = 0;
fdc38bb2 330 //
331 while((hdata = dynamic_cast<TH1 *>(next()))){
332 if(hdata){
333 // [1] check response of ZNC vs. ZNA
334 if(rawInd==0 || rawInd==1){
335 if(rawInd==0){
336 if(hdata->GetEntries() != 0.){
337 testgood=1;
338 meanZNA = hdata->GetMean();
339 rmsZNA = hdata->GetRMS();
340 }
341 }
342 else{
343 if(hdata->GetEntries() != 0.){
344 testgood=1;
345 meanZNC = hdata->GetMean();
346 }
347 else testgood=0;
348 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
349 if(testgood==1){
350 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
351 else res=.5;
352 test += res;
353 ntests++;
354 testgood=0;
355 }
356 else res=0.;
357 }
358 }
359 // [2] check response of ZPC vs. ZPA
360 else if(rawInd==2 || rawInd==3){
361 if(rawInd==2){
362 if(hdata->GetEntries() != 0.){
363 testgood=1;
364 meanZPA = hdata->GetMean();
365 rmsZPA = hdata->GetRMS();
366 }
367 }
368 else{
369 if(hdata->GetEntries() != 0.){
370 testgood=1;
371 meanZPC = hdata->GetMean();
372 }
373 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
374 if(testgood==1){
375 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
376 else res=.5;
377 test += res;
378 ntests++;
379 testgood=0;
380 }
381 else res=0.;
382 }
383 }
384 // [2] check PMC responses vs. summed PMQ responses
385 else if(rawInd>3 && rawInd<12){
386 if(rawInd==4) pmQZNC = hdata->GetMean();
387 else if(rawInd==5) pmQZNA = hdata->GetMean();
388 else if(rawInd==6) pmQZPC = hdata->GetMean();
389 else if(rawInd==7) pmQZPA = hdata->GetMean();
390 else if(rawInd==8){
391 pmCZNC = hdata->GetMean();
392 if(TMath::Abs(pmQZNC-pmCZNC)<(0.1*(pmQZNC+pmCZNC)/2)) res=1.;
393 else res=0.5;
394 test += res;
395 ntests++;
396 }
397 else if(rawInd==9){
398 pmCZNA = hdata->GetMean();
399 if(TMath::Abs(pmQZNA-pmCZNA)<(0.1*(pmQZNA+pmCZNA)/2)) res=1.;
400 else res=0.5;
401 test += res;
402 ntests++;
403 }
404 else if(rawInd==10){
405 pmCZPC = hdata->GetMean();
406 if(TMath::Abs(pmQZPC-pmCZPC)<(0.1*(pmQZPC+pmCZPC)/2)) res=1.;
407 else res=0.5;
408 test += res;
409 ntests++;
410 }
411 else if(rawInd==11){
412 pmCZPA = hdata->GetMean();
413 if(TMath::Abs(pmQZPA-pmCZPA)<(0.1*(pmQZPA+pmCZPA)/2)) res=1.;
414 else res=0.5;
415 test += res;
416 ntests++;
417 }
418 }
419 //
420 rawInd++;
075a0e70 421 }
fdc38bb2 422 //
423 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
424 else{
425 AliError("\t AliZDCQAChecker->No histos!!!\n");
075a0e70 426 }
427 }
fdc38bb2 428 if(ntests!=0) test = test/ntests;
429 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
075a0e70 430 }
431
fdc38bb2 432 // -------------------------------------------------------------------
c7b59e5d 433 else if(index == AliQA::kESD){
fdc38bb2 434
435 if(list->GetEntries()==0){
436 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
437 test = 1.; // nothing to check
438 return test;
439 }
440 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
441
442 TIter next(list);
443 TH1 * hdata;
444 Double_t meanX=0., meanY=0.;
445 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
446 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
447 Double_t eneCZNA=0., eneCZNC=0., eneCZPA=0., eneCZPC=0.;
448 Double_t eneQZNA=0., eneQZNC=0., eneQZPA=0., eneQZPC=0.;
449 Float_t res=0.;
450 Int_t esdInd=0, testgood=0;
451 //
12b9729c 452 ntests = 0;
fdc38bb2 453 //
454 while((hdata = dynamic_cast<TH1 *>(next()))){
455 if(hdata){
456 //printf("\tAliZDCQAChecker-> checking histo %s",hdata->GetName());
457 if(esdInd<2){
458 // hits histos
459 meanX = hdata->GetMean(1);
460 meanY = hdata->GetMean(2);
461 // check if the spot is centered
462 if((TMath::Abs(meanX)<0.2) && (TMath::Abs(meanY)<0.2)) res=1.;
463 else res=0.5;
464 test += res;
465 ntests++;
466 }
467 //
468 else{
469 // [1] check response of ZNC vs. ZNA
470 if(esdInd==0 || esdInd==1){
471 if(esdInd==0){
472 if(hdata->GetEntries() != 0.){
473 testgood=1;
474 meanZNA = hdata->GetMean();
475 rmsZNA = hdata->GetRMS();
476 }
477 }
478 else{
479 if(hdata->GetEntries() != 0.){
480 testgood=1;
481 meanZNC = hdata->GetMean();
482 }
483 else testgood=0;
484 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
485 if(testgood==1){
486 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
487 else res=.5;
488 testgood=0;
489 test += res;
490 ntests++;
491 }
492 else res=0.;
493 }
494 }
495 // [2] check response of ZPC vs. ZPA
496 else if(esdInd==2 || esdInd==3){
497 if(esdInd==2){
498 if(hdata->GetEntries() != 0.){
499 testgood=1;
500 meanZPA = hdata->GetMean();
501 rmsZPA = hdata->GetRMS();
502 }
503 }
504 else{
505 if(hdata->GetEntries() != 0.){
506 testgood=1;
507 meanZPC = hdata->GetMean();
508 }
509 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
510 if(testgood==1){
511 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
512 else res=.5;
513 test += res;
514 ntests++;
515 testgood=0;
516 }
517 else res=0.;
518 }
519 }
520 // [2] check eneC responses vs. summed eneQ responses
521 else if(esdInd>3 && esdInd<12){
522 if(esdInd==4) eneQZNC = hdata->GetMean();
523 else if(esdInd==5) eneQZNA = hdata->GetMean();
524 else if(esdInd==6) eneQZPC = hdata->GetMean();
525 else if(esdInd==7) eneQZPA = hdata->GetMean();
526 else if(esdInd==8){
527 eneCZNC = hdata->GetMean();
528 if(TMath::Abs(eneQZNC-eneCZNC)<(0.1*(eneQZNC+eneCZNC)/2)) res=1.;
529 else res=0.5;
530 test += res;
531 ntests++;
532 }
533 else if(esdInd==9){
534 eneCZNA = hdata->GetMean();
535 if(TMath::Abs(eneQZNA-eneCZNA)<(0.1*(eneQZNA+eneCZNA)/2)) res=1.;
536 else res=0.5;
537 test += res;
538 ntests++;
539 }
540 else if(esdInd==10){
541 eneCZPC = hdata->GetMean();
542 if(TMath::Abs(eneQZPC-eneCZPC)<(0.1*(eneQZPC+eneCZPC)/2)) res=1.;
543 else res=0.5;
544 test += res;
545 ntests++;
546 }
547 else if(esdInd==11){
548 eneCZPA = hdata->GetMean();
549 if(TMath::Abs(eneQZPA-eneCZPA)<(0.1*(eneQZPA+eneCZPA)/2)) res=1.;
550 else res=0.5;
551 test += res;
552 ntests++;
553 }
554 }
555 //
556 esdInd++;
557 }
558 //
559 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
fdc38bb2 560 }
561 else{
562 AliError("AliZDCQAChecker-> No histos!!!\n");
563 }
564 }
565 if(ntests!=0) test = test/ntests;
566 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n\n",test);
567 }
568 else{
569 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
570 return 1.;
571 }
12b9729c 572 }
fdc38bb2 573
12b9729c 574 AliInfo(Form("Test Result = %f", test));
575 return test;
075a0e70 576}