]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCQAChecker.cxx
Updated example macro for TPC calibration (Marian)
[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
30//__________________________________________________________________
31AliZDCQAChecker& AliZDCQAChecker::operator = (const AliZDCQAChecker& qac )
32{
33 // Equal operator.
34 this->~AliZDCQAChecker();
35 new(this) AliZDCQAChecker(qac);
36 return *this;
37}
38
39
40//____________________________________________________________________________
fdc38bb2 41const Double_t AliZDCQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
075a0e70 42{
3d26d59b 43 // Checks the QA histograms on the input list:
44 //
fdc38bb2 45 Double_t test=0.;
46 Int_t count=0, ntests=0;
47 //
48 const char* taskName = AliQA::GetAliTaskName(index);
075a0e70 49
fdc38bb2 50 // -------------------------------------------------------------------
51 if(!(strncmp(taskName,"SIM",3))){
52
53 if(list->GetEntries()==0){
54 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
55 test = 1.; // nothing to check
56 return test;
57 }
58 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
59
3d26d59b 60 TIter next(list);
fdc38bb2 61 TH1 * hdata;
62 Double_t meanX=0., meanY=0.;
63 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
64 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
65 Double_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
66 Double_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
67 Float_t res=0.;
68 Int_t digInd=0, testgood=0;
69 //
70 count = ntests = 0;
71 //
075a0e70 72 while((hdata = dynamic_cast<TH1 *>(next()))){
73 if(hdata){
fdc38bb2 74 //printf("\tAliZDCQAChecker-> checking histo %s",hdata->GetName());
75 // Check HITS histos
76 if(!(strncmp(hdata->GetName(),"hZNCh",5))){
77 // hits histos
78 meanX = hdata->GetMean(1);
79 meanY = hdata->GetMean(2);
80 // check if the spot is centered
81 if((TMath::Abs(meanX)<0.2) && (TMath::Abs(meanY)<0.2)) res=1.;
82 else res=0.5;
83 test += res;
84 ntests++;
85 //
86 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
87 }
88 // Check DIGITS histos
89 else{
90 // [1] check response of ZNC vs. ZNA
91 if(digInd==0 || digInd==1){
92 if(digInd==0){
93 if(hdata->GetEntries() != 0.){
94 testgood=1;
95 meanZNA = hdata->GetMean();
96 rmsZNA = hdata->GetRMS();
97 }
98 }
99 else{
100 if(hdata->GetEntries() != 0.){
101 testgood=1;
102 meanZNC = hdata->GetMean();
103 }
104 else testgood=0;
105 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
106 if(testgood==1){
107 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
108 else res=.5;
109 testgood=0;
110 test += res;
111 ntests++;
112 //
113 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
114 }
115 else res=0.;
116 }
117 }
118 // [2] check response of ZPC vs. ZPA
119 else if(digInd==2 || digInd==3){
120 if(digInd==2){
121 if(hdata->GetEntries() != 0.){
122 testgood=1;
123 meanZPA = hdata->GetMean();
124 rmsZPA = hdata->GetRMS();
125 }
126 }
127 else{
128 if(hdata->GetEntries() != 0.){
129 testgood=1;
130 meanZPC = hdata->GetMean();
131 }
132 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
133 if(testgood==1){
134 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
135 else res=.5;
136 test += res;
137 ntests++;
138 testgood=0;
139 //
140 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
141 }
142 else res=0.;
143 }
144 }
145 // [2] check PMC responses vs. summed PMQ responses
146 else if(digInd>3 && digInd<12){
147 if(digInd==4) pmQZNC = hdata->GetMean();
148 else if(digInd==5) pmQZNA = hdata->GetMean();
149 else if(digInd==6) pmQZPC = hdata->GetMean();
150 else if(digInd==7) pmQZPA = hdata->GetMean();
151 else if(digInd==8){
152 pmCZNC = hdata->GetMean();
153 if(TMath::Abs(pmQZNC-pmCZNC)<(0.1*(pmQZNC+pmCZNC)/2)) res=1.;
154 else res=0.5;
155 test += res;
156 ntests++;
157 //
158 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
159 }
160 else if(digInd==9){
161 pmCZNA = hdata->GetMean();
162 if(TMath::Abs(pmQZNA-pmCZNA)<(0.1*(pmQZNA+pmCZNA)/2)) res=1.;
163 else res=0.5;
164 test += res;
165 ntests++;
166 //
167 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
168 }
169 else if(digInd==10){
170 pmCZPC = hdata->GetMean();
171 if(TMath::Abs(pmQZPC-pmCZPC)<(0.1*(pmQZPC+pmCZPC)/2)) res=1.;
172 else res=0.5;
173 test += res;
174 ntests++;
175 //
176 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
177 }
178 else if(digInd==11){
179 pmCZPA = hdata->GetMean();
180 if(TMath::Abs(pmQZPA-pmCZPA)<(0.1*(pmQZPA+pmCZPA)/2)) res=1.;
181 else res=0.5;
182 test += res;
183 ntests++;
184 //
185 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
186 }
187 }
188 //
189 digInd++;
190 }
191 //
192 count++;
075a0e70 193 }
194 else{
fdc38bb2 195 AliError("AliZDCQAChecker-> No histos!!!\n");
075a0e70 196 }
197 }
fdc38bb2 198 if(ntests!=0) test = test/ntests;
199 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
200 }
201
202 // -------------------------------------------------------------------
203 else if(!(strncmp(taskName,"RAW",3))){
204
205 if(list->GetEntries()==0){
206 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
207 test = 1.; // nothing to check
208 return test;
209 }
210 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
211
212 TIter next(list);
213 TH1 * hdata;
214 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
215 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
216 Double_t pmCZNA=0., pmCZNC=0., pmCZPA=0., pmCZPC=0.;
217 Double_t pmQZNA=0., pmQZNC=0., pmQZPA=0., pmQZPC=0.;
218 Float_t res=0.;
219 Int_t rawInd=0, testgood=0;
220 count = ntests = 0;
221 //
222 while((hdata = dynamic_cast<TH1 *>(next()))){
223 if(hdata){
224 // [1] check response of ZNC vs. ZNA
225 if(rawInd==0 || rawInd==1){
226 if(rawInd==0){
227 if(hdata->GetEntries() != 0.){
228 testgood=1;
229 meanZNA = hdata->GetMean();
230 rmsZNA = hdata->GetRMS();
231 }
232 }
233 else{
234 if(hdata->GetEntries() != 0.){
235 testgood=1;
236 meanZNC = hdata->GetMean();
237 }
238 else testgood=0;
239 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
240 if(testgood==1){
241 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
242 else res=.5;
243 test += res;
244 ntests++;
245 testgood=0;
246 }
247 else res=0.;
248 }
249 }
250 // [2] check response of ZPC vs. ZPA
251 else if(rawInd==2 || rawInd==3){
252 if(rawInd==2){
253 if(hdata->GetEntries() != 0.){
254 testgood=1;
255 meanZPA = hdata->GetMean();
256 rmsZPA = hdata->GetRMS();
257 }
258 }
259 else{
260 if(hdata->GetEntries() != 0.){
261 testgood=1;
262 meanZPC = hdata->GetMean();
263 }
264 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
265 if(testgood==1){
266 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
267 else res=.5;
268 test += res;
269 ntests++;
270 testgood=0;
271 }
272 else res=0.;
273 }
274 }
275 // [2] check PMC responses vs. summed PMQ responses
276 else if(rawInd>3 && rawInd<12){
277 if(rawInd==4) pmQZNC = hdata->GetMean();
278 else if(rawInd==5) pmQZNA = hdata->GetMean();
279 else if(rawInd==6) pmQZPC = hdata->GetMean();
280 else if(rawInd==7) pmQZPA = hdata->GetMean();
281 else if(rawInd==8){
282 pmCZNC = hdata->GetMean();
283 if(TMath::Abs(pmQZNC-pmCZNC)<(0.1*(pmQZNC+pmCZNC)/2)) res=1.;
284 else res=0.5;
285 test += res;
286 ntests++;
287 }
288 else if(rawInd==9){
289 pmCZNA = hdata->GetMean();
290 if(TMath::Abs(pmQZNA-pmCZNA)<(0.1*(pmQZNA+pmCZNA)/2)) res=1.;
291 else res=0.5;
292 test += res;
293 ntests++;
294 }
295 else if(rawInd==10){
296 pmCZPC = hdata->GetMean();
297 if(TMath::Abs(pmQZPC-pmCZPC)<(0.1*(pmQZPC+pmCZPC)/2)) res=1.;
298 else res=0.5;
299 test += res;
300 ntests++;
301 }
302 else if(rawInd==11){
303 pmCZPA = hdata->GetMean();
304 if(TMath::Abs(pmQZPA-pmCZPA)<(0.1*(pmQZPA+pmCZPA)/2)) res=1.;
305 else res=0.5;
306 test += res;
307 ntests++;
308 }
309 }
310 //
311 rawInd++;
312 count++;
075a0e70 313 }
fdc38bb2 314 //
315 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
316 else{
317 AliError("\t AliZDCQAChecker->No histos!!!\n");
075a0e70 318 }
319 }
fdc38bb2 320 if(ntests!=0) test = test/ntests;
321 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n",test);
075a0e70 322 }
323
fdc38bb2 324 // -------------------------------------------------------------------
325 else if(!(strncmp(taskName,"ESD",3))){
326
327 if(list->GetEntries()==0){
328 AliWarning("\tAliZDCQAChecker->The list to be checked is empty!");
329 test = 1.; // nothing to check
330 return test;
331 }
332 printf("\n\tAliZDCQAChecker-> checking QA histograms for task %s\n\n",taskName);
333
334 TIter next(list);
335 TH1 * hdata;
336 Double_t meanX=0., meanY=0.;
337 Double_t meanZNA=0., rmsZNA=0., meanZNC=0.;
338 Double_t meanZPA=0., rmsZPA=0., meanZPC=0.;
339 Double_t eneCZNA=0., eneCZNC=0., eneCZPA=0., eneCZPC=0.;
340 Double_t eneQZNA=0., eneQZNC=0., eneQZPA=0., eneQZPC=0.;
341 Float_t res=0.;
342 Int_t esdInd=0, testgood=0;
343 //
344 count = ntests = 0;
345 //
346 while((hdata = dynamic_cast<TH1 *>(next()))){
347 if(hdata){
348 //printf("\tAliZDCQAChecker-> checking histo %s",hdata->GetName());
349 if(esdInd<2){
350 // hits histos
351 meanX = hdata->GetMean(1);
352 meanY = hdata->GetMean(2);
353 // check if the spot is centered
354 if((TMath::Abs(meanX)<0.2) && (TMath::Abs(meanY)<0.2)) res=1.;
355 else res=0.5;
356 test += res;
357 ntests++;
358 }
359 //
360 else{
361 // [1] check response of ZNC vs. ZNA
362 if(esdInd==0 || esdInd==1){
363 if(esdInd==0){
364 if(hdata->GetEntries() != 0.){
365 testgood=1;
366 meanZNA = hdata->GetMean();
367 rmsZNA = hdata->GetRMS();
368 }
369 }
370 else{
371 if(hdata->GetEntries() != 0.){
372 testgood=1;
373 meanZNC = hdata->GetMean();
374 }
375 else testgood=0;
376 // check if the response m.v. of ZNA and ZNC are equal (@ 1sigma level)
377 if(testgood==1){
378 if(TMath::Abs(meanZNA-meanZNC)<rmsZNA) res=1.;
379 else res=.5;
380 testgood=0;
381 test += res;
382 ntests++;
383 }
384 else res=0.;
385 }
386 }
387 // [2] check response of ZPC vs. ZPA
388 else if(esdInd==2 || esdInd==3){
389 if(esdInd==2){
390 if(hdata->GetEntries() != 0.){
391 testgood=1;
392 meanZPA = hdata->GetMean();
393 rmsZPA = hdata->GetRMS();
394 }
395 }
396 else{
397 if(hdata->GetEntries() != 0.){
398 testgood=1;
399 meanZPC = hdata->GetMean();
400 }
401 // check if the response m.v. of ZPA and ZPC are equal (@ 3sigma level)
402 if(testgood==1){
403 if(TMath::Abs(meanZPA-meanZPC)<(3.*rmsZPA)) res=1.;
404 else res=.5;
405 test += res;
406 ntests++;
407 testgood=0;
408 }
409 else res=0.;
410 }
411 }
412 // [2] check eneC responses vs. summed eneQ responses
413 else if(esdInd>3 && esdInd<12){
414 if(esdInd==4) eneQZNC = hdata->GetMean();
415 else if(esdInd==5) eneQZNA = hdata->GetMean();
416 else if(esdInd==6) eneQZPC = hdata->GetMean();
417 else if(esdInd==7) eneQZPA = hdata->GetMean();
418 else if(esdInd==8){
419 eneCZNC = hdata->GetMean();
420 if(TMath::Abs(eneQZNC-eneCZNC)<(0.1*(eneQZNC+eneCZNC)/2)) res=1.;
421 else res=0.5;
422 test += res;
423 ntests++;
424 }
425 else if(esdInd==9){
426 eneCZNA = hdata->GetMean();
427 if(TMath::Abs(eneQZNA-eneCZNA)<(0.1*(eneQZNA+eneCZNA)/2)) res=1.;
428 else res=0.5;
429 test += res;
430 ntests++;
431 }
432 else if(esdInd==10){
433 eneCZPC = hdata->GetMean();
434 if(TMath::Abs(eneQZPC-eneCZPC)<(0.1*(eneQZPC+eneCZPC)/2)) res=1.;
435 else res=0.5;
436 test += res;
437 ntests++;
438 }
439 else if(esdInd==11){
440 eneCZPA = hdata->GetMean();
441 if(TMath::Abs(eneQZPA-eneCZPA)<(0.1*(eneQZPA+eneCZPA)/2)) res=1.;
442 else res=0.5;
443 test += res;
444 ntests++;
445 }
446 }
447 //
448 esdInd++;
449 }
450 //
451 //printf("\t %d performed tests, results %1.2f\n",ntests,test/ntests);
452 //
453 count++;
454 }
455 else{
456 AliError("AliZDCQAChecker-> No histos!!!\n");
457 }
458 }
459 if(ntests!=0) test = test/ntests;
460 printf("\n\tAliZDCQAChecker-> QA check result = %1.2f\n\n",test);
461 }
462 else{
463 AliWarning(Form("\n\t No ZDC QA for %s task\n",taskName));
464 return 1.;
465 }
466
3d26d59b 467 AliInfo(Form("Test Result = %f", test));
468 return test;
075a0e70 469}