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