]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQAv1.cxx
parametrized the number of allowed QA histograms
[u/mrichter/AliRoot.git] / STEER / AliQAv1.cxx
CommitLineData
4e25ac79 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16/* $Id: AliQAv1.cxx 31503 2009-03-16 11:01:16Z schutz $ */
17
18//////////////////////////////////////////////////////////////////////////////
19//
20// Quality Assurance Object//_________________________________________________________________________
21// Quality Assurance object. The QA status is held in one word per detector,
22// each bit corresponds to a different status.
23// bit 0-3 : QA raised during simulation (RAW)
24// bit 4-7 : QA raised during simulation (SIM)
25// bit 8-11 : QA raised during reconstruction (REC)
26// bit 12-15 : QA raised during ESD checking (ESD)
27// bit 16-19 : QA raised during analysis (ANA)
28// Each of the 4 bits corresponds to a severity level of increasing importance
29// from lower to higher bit (INFO, WARNING, ERROR, FATAL)
30//
31//*-- Yves Schutz CERN, July 2007
32//////////////////////////////////////////////////////////////////////////////
33
34
35#include <cstdlib>
36// --- ROOT system ---
34709735 37#include <TClass.h>
4e25ac79 38#include <TFile.h>
39#include <TSystem.h>
40#include <TROOT.h>
41
42// --- Standard library ---
43
44// --- AliRoot header files ---
45#include "AliLog.h"
46#include "AliQAv1.h"
47
48
49ClassImp(AliQAv1)
49466ea2 50AliQAv1 * AliQAv1::fgQA = 0x0 ;
51TFile * AliQAv1::fgQADataFile = 0x0 ;
52TString AliQAv1::fgQADataFileName = "QA" ; // will transform into Det.QA.run.root
53TFile * AliQAv1::fgQARefFile = 0x0 ;
54TString AliQAv1::fgQARefDirName = "" ;
55TString AliQAv1::fgQARefFileName = "QA.root" ;
56TFile * AliQAv1::fgQAResultFile = 0x0 ;
57TString AliQAv1::fgQAResultDirName = "" ;
58TString AliQAv1::fgQAResultFileName = "QA.root" ;
59TString AliQAv1::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD",
60 "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT", "Global", "CORR"} ;
61TString AliQAv1::fgGRPPath = "GRP/GRP/Data" ;
62TString AliQAv1::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "DigitsR", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ;
63const TString AliQAv1::fgkLabLocalFile = "file://" ;
64const TString AliQAv1::fgkLabLocalOCDB = "local://" ;
65const TString AliQAv1::fgkLabAliEnOCDB = "alien://" ;
66const TString AliQAv1::fgkRefFileName = "QA.root" ;
67const TString AliQAv1::fgkQAName = "QA" ;
68const TString AliQAv1::fgkQACorrNtName = "CorrQA" ;
69const TString AliQAv1::fgkRefOCDBDirName = "QA" ;
70TString AliQAv1::fgRefDataDirName = "" ;
71const TString AliQAv1::fgkQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
72const TString AliQAv1::fgkExpert = "Expert" ;
73const UInt_t AliQAv1::fgkExpertBit = 0x40000 ;
74const UInt_t AliQAv1::fgkQABit = 0x80000 ;
75const UInt_t AliQAv1::fgkImageBit = 0x100000 ;
76const Int_t AliQAv1::fgkQADebugLevel = 99 ;
77const TString AliQAv1::fImageFileName = "QAImage" ;
78const TString AliQAv1::fImageFileFormat = "eps" ;
79const UShort_t AliQAv1::fgkMaxQAObjects = 10000 ;
fec0891b 80
4e25ac79 81//____________________________________________________________________________
82AliQAv1::AliQAv1() :
83 TNamed("", ""),
84 fNdet(kNDET),
85 fNEventSpecies(AliRecoParam::kNSpecies),
86 fLengthQA(fNdet*fNEventSpecies),
87 fQA(new ULong_t[fLengthQA]),
88 fDet(kNULLDET),
89 fTask(kNULLTASK),
90 fEventSpecie(AliRecoParam::kDefault),
91 fEventSpecies(new Bool_t[fNEventSpecies])
92{
93 // default constructor
94 memset(fQA,0,fLengthQA*sizeof(ULong_t));
95 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
96}
97
98//____________________________________________________________________________
99AliQAv1::AliQAv1(const AliQAv1& qa) :
100 TNamed(qa),
101 fNdet(qa.fNdet),
102 fNEventSpecies(qa.fNEventSpecies),
103 fLengthQA(qa.fLengthQA),
104 fQA(new ULong_t[fLengthQA]),
105 fDet(qa.fDet),
106 fTask(qa.fTask),
107 fEventSpecie(qa.fEventSpecie),
108 fEventSpecies(new Bool_t[fNEventSpecies])
109{
110 // cpy ctor
111 memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
112 memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
113}
114
115//_____________________________________________________________________________
116AliQAv1& AliQAv1::operator = (const AliQAv1& qa)
117{
118 // assignment operator
119 if(&qa != this) {
120 TNamed::operator=(qa);
121 fNdet = qa.fNdet;
122 fNEventSpecies = qa.fNEventSpecies;
123 fLengthQA = qa.fLengthQA;
124
125 if(fQA) delete [] fQA;
126 fQA = new ULong_t[fLengthQA];
127 memcpy(fQA,qa.fQA,fLengthQA*sizeof(ULong_t));
128
129 fDet = qa.fDet;
130 fTask = qa.fTask;
131 fEventSpecie = qa.fEventSpecie;
132 if(fEventSpecies) delete [] fEventSpecies;
133 fEventSpecies = new Bool_t[fNEventSpecies];
134 memcpy(fEventSpecies,qa.fEventSpecies,fNEventSpecies*sizeof(Bool_t));
135 }
136 return *this;
137}
138
139//_______________________________________________________________
140AliQAv1::AliQAv1(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) :
141TNamed("QA", "Quality Assurance status"),
142fNdet(kNDET),
143fNEventSpecies(eslength),
144fLengthQA(qalength),
145fQA(new ULong_t[fLengthQA]),
146fDet(kNULLDET),
147fTask(kNULLTASK),
148fEventSpecie(AliRecoParam::kDefault),
149fEventSpecies(new Bool_t[fNEventSpecies])
150{
151 // constructor to be used
152 memcpy(fQA, qa, fLengthQA*sizeof(ULong_t));
153 memcpy(fEventSpecies, es, fNEventSpecies*sizeof(Bool_t));
154}
155
156//_______________________________________________________________
157AliQAv1::AliQAv1(const DETECTORINDEX_t det) :
158 TNamed("QA", "Quality Assurance status"),
159 fNdet(kNDET),
160 fNEventSpecies(AliRecoParam::kNSpecies),
161 fLengthQA(fNdet*fNEventSpecies),
162 fQA(new ULong_t[fLengthQA]),
163 fDet(det),
164 fTask(kNULLTASK),
165 fEventSpecie(AliRecoParam::kDefault),
166 fEventSpecies(new Bool_t[fNEventSpecies])
167{
168 // constructor to be used
169 if (! CheckRange(det) ) fDet = kNULLDET ;
170 memset(fQA,0,fLengthQA*sizeof(ULong_t));
171 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
172}
173
174//_______________________________________________________________
175AliQAv1::AliQAv1(const ALITASK_t tsk) :
176 TNamed("QA", "Quality Assurance status"),
177 fNdet(kNDET),
178 fNEventSpecies(AliRecoParam::kNSpecies),
179 fLengthQA(fNdet*fNEventSpecies),
180 fQA(new ULong_t[fLengthQA]),
181 fDet(kNULLDET),
182 fTask(tsk),
183 fEventSpecie(AliRecoParam::kDefault),
184 fEventSpecies(new Bool_t[fNEventSpecies])
185{
186 // constructor to be used in the AliRoot module (SIM, REC, ESD or ANA)
187 if (! CheckRange(tsk) ) fTask = kNULLTASK ;
188 memset(fQA,0,fLengthQA*sizeof(ULong_t));
189 memset(fEventSpecies,kFALSE,fNEventSpecies*sizeof(Bool_t));
190}
191
192//____________________________________________________________________________
193AliQAv1::~AliQAv1()
194{
195 // dtor
196 delete [] fQA;
197 delete [] fEventSpecies;
198}
199
200//_______________________________________________________________
201void AliQAv1::Close()
202{
203 // close the open files
204 if (fgQADataFile)
205 if (fgQADataFile->IsOpen())
206 fgQADataFile->Close() ;
207 if (fgQAResultFile)
208 if (fgQAResultFile->IsOpen())
209 fgQAResultFile->Close() ;
210 if (fgQARefFile)
211 if (fgQARefFile->IsOpen())
212 fgQARefFile->Close() ;
213}
214
215//_______________________________________________________________
216Bool_t AliQAv1::CheckFatal() const
217{
218 // check if any FATAL status is set
219 Bool_t rv = kFALSE ;
220 Int_t index ;
221 for (index = 0; index < kNDET ; index++)
222 rv = rv || IsSet(DETECTORINDEX_t(index), fTask, fEventSpecie, kFATAL) ;
223 return rv ;
224}
225
226//_______________________________________________________________
227Bool_t AliQAv1::CheckRange(DETECTORINDEX_t det) const
228{
229 // check if detector is in given detector range: 0-kNDET
230
231 Bool_t rv = ( det < 0 || det > kNDET ) ? kFALSE : kTRUE ;
232 if (!rv)
233 AliFatal(Form("Detector index %d is out of range: 0 <= index <= %d", det, kNDET)) ;
234 return rv ;
235}
236
237//_______________________________________________________________
238Bool_t AliQAv1::CheckRange(ALITASK_t task) const
239{
240 // check if task is given taskk range: 0:kNTASK
241 Bool_t rv = ( task < kRAW || task > kNTASK ) ? kFALSE : kTRUE ;
242 if (!rv)
243 AliFatal(Form("Module index %d is out of range: 0 <= index <= %d", task, kNTASK)) ;
244 return rv ;
245}
246
247//_______________________________________________________________
248Bool_t AliQAv1::CheckRange(QABIT_t bit) const
249{
250 // check if bit is in given bit range: 0-kNBit
251
252 Bool_t rv = ( bit < 0 || bit > kNBIT ) ? kFALSE : kTRUE ;
253 if (!rv)
254 AliFatal(Form("Status bit %d is out of range: 0 <= bit <= %d", bit, kNBIT)) ;
255 return rv ;
256}
257
258//_______________________________________________________________
259Bool_t AliQAv1::CheckRange(AliRecoParam::EventSpecie_t es) const
260{
261 // check if bit is in given bit range: 0-kNBit
262 Bool_t rv = kFALSE ;
263 switch (es) {
264 case AliRecoParam::kDefault:
265 rv = kTRUE ;
266 break ;
267 case AliRecoParam::kLowMult:
268 rv = kTRUE ;
269 break ;
270 case AliRecoParam::kHighMult:
271 rv = kTRUE ;
272 break ;
273 case AliRecoParam::kCosmic:
274 rv = kTRUE ;
275 break ;
276 case AliRecoParam::kCalib:
277 rv = kTRUE ;
278 break ;
279 }
280 if (!rv)
281 AliFatal(Form("Event Specie %d is not valid", es)) ;
282 return rv ;
283}
284
285//_______________________________________________________________
286const char * AliQAv1::GetAliTaskName(ALITASK_t tsk)
287{
288 // returns the char name corresponding to module index
289 TString tskName ;
290 switch (tsk) {
291 case kNULLTASK:
292 break ;
293 case kRAW:
294 tskName = "RAW" ;
295 break ;
296 case kSIM:
297 tskName = "SIM" ;
298 break ;
299 case kREC:
300 tskName = "REC" ;
301 break ;
302 case kESD:
303 tskName = "ESD" ;
304 break ;
305 case kANA:
306 tskName = "ANA" ;
307 break ;
308 default:
309 tsk = kNULLTASK ;
310 break ;
311 }
312 return tskName.Data() ;
313}
314
315//_______________________________________________________________
316const char * AliQAv1::GetBitName(QABIT_t bit) const
317{
318 // returns the char name corresponding to bit
319 TString bitName ;
320 switch (bit) {
321 case kNULLBit:
322 break ;
323 case kINFO:
324 bitName = "INFO" ;
325 break ;
326 case kWARNING:
327 bitName = "WARNING" ;
328 break ;
329 case kERROR:
330 bitName = "ERROR" ;
331 break ;
332 case kFATAL:
333 bitName = "FATAL" ;
334 break ;
335 default:
336 bit = kNULLBit ;
337 break ;
338 }
339 return bitName.Data() ;
340}
341
342//_______________________________________________________________
343AliQAv1::DETECTORINDEX_t AliQAv1::GetDetIndex(const char * name)
344{
345 // returns the detector index corresponding to a given name
346 TString sname(name) ;
347 DETECTORINDEX_t rv = kNULLDET ;
348 for (Int_t det = 0; det < kNDET ; det++) {
349 if ( GetDetName(det) == sname ) {
350 rv = DETECTORINDEX_t(det) ;
351 break ;
352 }
353 }
354 return rv ;
355}
356
357//_______________________________________________________________
358const char * AliQAv1::GetDetName(Int_t det)
359{
360 // returns the detector name corresponding to a given index (needed in a loop)
361
362 if ( det >= 0 && det < kNDET)
363 return (fgDetNames[det]).Data() ;
364 else
365 return NULL ;
366}
367
368//_______________________________________________________________
369TFile * AliQAv1::GetQADataFile(const char * name, Int_t run)
370{
371 // opens the file to store the detectors Quality Assurance Data Maker results
372 const char * temp = Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ;
373 TString opt ;
374 if (! fgQADataFile ) {
375 if (gSystem->AccessPathName(temp))
376 opt = "NEW" ;
377 else
378 opt = "UPDATE" ;
379 fgQADataFile = TFile::Open(temp, opt.Data()) ;
380 } else {
381 if ( strcmp(temp, fgQADataFile->GetName()) != 0 ) {
eca4fa66 382 fgQADataFile = static_cast<TFile *>(gROOT->FindObject(temp)) ;
4e25ac79 383 if ( !fgQADataFile ) {
eca4fa66 384 if (gSystem->AccessPathName(temp))
385 opt = "NEW" ;
386 else
387 opt = "UPDATE" ;
4e25ac79 388 fgQADataFile = TFile::Open(temp, opt.Data()) ;
389 }
390 }
391 }
392 return fgQADataFile ;
393}
394
395//_____________________________________________________________________________
396TFile * AliQAv1::GetQADataFile(const char * fileName)
397{
398 // Open if necessary the Data file and return its pointer
399
400 if (!fgQADataFile)
401 if (!fileName)
402 fileName = AliQAv1::GetQADataFileName() ;
403 if (!gSystem->AccessPathName(fileName)) {
404 fgQADataFile = TFile::Open(fileName) ;
405 } else {
34709735 406 AliFatalClass(Form("File %s not found", fileName)) ;
4e25ac79 407 }
408 return fgQADataFile ;
409}
410
411//_______________________________________________________________
412TFile * AliQAv1::GetQAResultFile()
413{
414 // opens the file to store the Quality Assurance Data Checker results
415 if (fgQAResultFile)
416 fgQAResultFile->Close() ;
417 fgQAResultFile = 0x0 ;
418// if (!fgQAResultFile) {
419 TString dirName(fgQAResultDirName) ;
420 if ( dirName.Contains(fgkLabLocalFile))
421 dirName.ReplaceAll(fgkLabLocalFile, "") ;
422 TString fileName(dirName + fgQAResultFileName) ;
423 TString opt("") ;
424 if ( !gSystem->AccessPathName(fileName) )
425 opt = "UPDATE" ;
426 else {
427 if ( gSystem->AccessPathName(dirName) )
428 gSystem->mkdir(dirName) ;
429 opt = "NEW" ;
430 }
431 fgQAResultFile = TFile::Open(fileName, opt) ;
432// }
433
434 return fgQAResultFile ;
435}
436
437//_______________________________________________________________
438AliQAv1::TASKINDEX_t AliQAv1::GetTaskIndex(const char * name)
439{
440 // returns the detector index corresponding to a given name
441 TString sname(name) ;
442 TASKINDEX_t rv = kNULLTASKINDEX ;
443 for (Int_t tsk = 0; tsk < kNTASKINDEX ; tsk++) {
444 if ( GetTaskName(tsk) == sname ) {
445 rv = TASKINDEX_t(tsk) ;
446 break ;
447 }
448 }
449 return rv ;
450}
451
452//_______________________________________________________________
453Bool_t AliQAv1::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t ies, QABIT_t bit) const
454{
455 // Checks is the requested bit is set
456
457 const AliRecoParam::EventSpecie_t es = AliRecoParam::Convert(ies) ;
458 return IsSet(det, tsk, es, bit) ;
459
460}
461
462//_______________________________________________________________
463Bool_t AliQAv1::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const
464{
465 // Checks is the requested bit is set
466
467 CheckRange(det) ;
468 CheckRange(tsk) ;
469 CheckRange(bit) ;
470 CheckRange(es) ;
471
472 ULong_t offset = Offset(tsk) ;
473 ULong_t status = GetStatus(det, es) ;
474 offset+= bit ;
475 status = (status & 1 << offset) != 0 ;
476 return status ;
477}
478
479//_______________________________________________________________
480Bool_t AliQAv1::IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const
481{
482 // Checks is the requested bit is set
483
484 CheckRange(det) ;
485 CheckRange(tsk) ;
486 CheckRange(es) ;
487
488 ULong_t offset = Offset(tsk) ;
489 ULong_t status = GetStatus(det, es) ;
490 ULong_t st = 0 ;
491 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
492 offset+= bit ;
493 st += (status & 1 << offset) != 0 ;
494 }
495 if ( st == 0 )
496 return kFALSE ;
497 else
498 return kTRUE ;
499}
500//_______________________________________________________________
501Bool_t AliQAv1::IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const
502{
503 // Checks is the requested bit is set
504
505 CheckRange(det) ;
506 CheckRange(es) ;
507
508 ULong_t status = GetStatus(det, es) ;
509 ULong_t st = 0 ;
510 for ( Int_t tsk = 0 ; tsk < kNTASK ; tsk++) {
511 ULong_t offset = Offset(ALITASK_t(tsk)) ;
512 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
513 offset+= bit ;
514 st += (status & 1 << offset) != 0 ;
515 }
516 }
517 if ( st == 0 )
518 return kFALSE ;
519 else
520 return kTRUE ;
521}
522
523//_______________________________________________________________
524AliQAv1 * AliQAv1::Instance()
525{
526 // Get an instance of the singleton. The only authorized way to call the ctor
527
528 if ( ! fgQA) {
529 TFile * f = GetQAResultFile() ;
eca4fa66 530 fgQA = static_cast<AliQAv1 *>(f->Get("QA")) ;
4e25ac79 531 if ( ! fgQA )
532 fgQA = new AliQAv1() ;
eca4fa66 533 }
4e25ac79 534 return fgQA ;
535}
536
537//_______________________________________________________________
538AliQAv1 * AliQAv1::Instance(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es)
539{
540 // Get an instance of the singleton. The only authorized way to call the ctor
541
542 if ( ! fgQA)
543 fgQA = new AliQAv1(qalength, qa, eslength, es) ;
544 return fgQA ;
545}
546
547//_______________________________________________________________
548AliQAv1 * AliQAv1::Instance(const DETECTORINDEX_t det)
549{
550 // Get an instance of the singleton. The only authorized way to call the ctor
551
552 if ( ! fgQA) {
553 TFile * f = GetQAResultFile() ;
eca4fa66 554 fgQA = static_cast<AliQAv1 *>(f->Get("QA")) ;
4e25ac79 555 if ( ! fgQA )
eca4fa66 556 fgQA = new AliQAv1(det) ;
4e25ac79 557 }
558 fgQA->Set(det) ;
559 return fgQA ;
560}
561
562//_______________________________________________________________
563AliQAv1 * AliQAv1::Instance(const ALITASK_t tsk)
564{
565 // Get an instance of the singleton. The only authorized way to call the ctor
566
567 if ( ! fgQA)
568 switch (tsk) {
569 case kNULLTASK:
570 break ;
571 case kRAW:
572 fgQA = new AliQAv1(tsk) ;
573 break ;
574 case kSIM:
575 fgQA = new AliQAv1(tsk) ;
576 break ;
577 case kREC:
34709735 578 AliInfoClass("fgQA = gAlice->GetQA()") ;
4e25ac79 579 break ;
580 case kESD:
eca4fa66 581 AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
4e25ac79 582 break ;
583 case kANA:
eca4fa66 584 AliInfoClass("fgQA = static_cast<AliQAv1 *> (esdFile->Get(\"QA\")") ;
4e25ac79 585 break ;
586 case kNTASK:
587 break ;
588 }
589 if (fgQA)
590 fgQA->Set(tsk) ;
591 return fgQA ;
592}
593
594//_______________________________________________________________
595AliQAv1 * AliQAv1::Instance(const TASKINDEX_t tsk)
596{
597 // get an instance of the singleton.
598
599 ALITASK_t index = kNULLTASK ;
600
601 if ( tsk == kRAWS )
602 index = kRAW ;
603 else if (tsk < kDIGITS)
604 index = kSIM ;
605 else if (tsk < kRECPARTICLES)
606 index = kREC ;
607 else if (tsk == kESDS)
608 index = kESD ;
609
610 return Instance(index) ;
611}
612
613//_______________________________________________________________
614void AliQAv1::Merge(TCollection * list) {
615 // Merge the QA resuls in the list into this single AliQAv1 object
616
617 for (Int_t det = 0 ; det < kNDET ; det++) {
618 Set(DETECTORINDEX_t(det)) ;
619 for (Int_t task = 0 ; task < kNTASK ; task++) {
620 Set(ALITASK_t(task)) ;
621 for (Int_t bit = 0 ; bit < kNBIT ; bit++) {
622 TIter next(list) ;
623 AliQAv1 * qa ;
624 while ( (qa = (AliQAv1*)next() ) ) {
625 for (Int_t es = 0 ; es < fNEventSpecies ; es++) {
626 if (qa->IsSet(DETECTORINDEX_t(det), ALITASK_t(task), es, QABIT_t(bit)))
627 Set(QABIT_t(bit), es) ;
628 }
629 } // qa list
630 } // bit
631 } // task
632 } // detector
633}
634
635//_______________________________________________________________
636ULong_t AliQAv1::Offset(ALITASK_t tsk) const
637{
638 // Calculates the bit offset for a given module (SIM, REC, ESD, ANA)
639
640 CheckRange(tsk) ;
641
642 ULong_t offset = 0 ;
643 switch (tsk) {
644 case kNULLTASK:
645 break ;
646 case kRAW:
647 offset+= 0 ;
648 break ;
649 case kSIM:
650 offset+= 4 ;
651 break ;
652 case kREC:
653 offset+= 8 ;
654 break ;
655 case kESD:
656 offset+= 12 ;
657 break ;
658 case kANA:
659 offset+= 16 ;
660 break ;
661 case kNTASK:
662 break ;
663 }
664
665 return offset ;
666}
667
668//_______________________________________________________________
669void AliQAv1::ResetStatus(DETECTORINDEX_t det)
670{
671 // reset the status of det for all event specie
672 for (Int_t es = 0 ; es < fNEventSpecies ; es++)
673 fQA[det*fNdet+es] = 0 ;
674}
675
676//_______________________________________________________________
677void AliQAv1::Set(QABIT_t bit, Int_t ies)
678{
679 // Set the status bit of the current detector in the current module and for the current event specie
680 Set(bit, AliRecoParam::Convert(ies)) ;
681}
682
683//_______________________________________________________________
684void AliQAv1::Set(QABIT_t bit, AliRecoParam::EventSpecie_t es)
685{
686 // Set the status bit of the current detector in the current module and for the current event specie
687
688 SetStatusBit(fDet, fTask, es, bit) ;
689}
690
691//_____________________________________________________________________________
692void AliQAv1::SetQARefStorage(const char * name)
693{
694 // Set the root directory where the QA reference data are stored
695
696 fgQARefDirName = name ;
697 if ( fgQARefDirName.Contains(fgkLabLocalFile) )
698 fgQARefFileName = fgkRefFileName ;
699 else if ( fgQARefDirName.Contains(fgkLabLocalOCDB) )
700 fgQARefFileName = fgkQAName ;
701 else if ( fgQARefDirName.Contains(fgkLabAliEnOCDB) )
702 fgQARefFileName = fgkQAName ;
703
704 else {
34709735 705 AliErrorClass(Form("ERROR: %s is an invalid storage definition\n", name)) ;
4e25ac79 706 fgQARefDirName = "" ;
707 fgQARefFileName = "" ;
708 }
709 TString tmp(fgQARefDirName) ; // + fgQARefFileName) ;
34709735 710 AliInfoClass(Form("AliQAv1::SetQARefDir: QA references are in %s\n", tmp.Data() )) ;
4e25ac79 711}
712
713//_____________________________________________________________________________
714void AliQAv1::SetQAResultDirName(const char * name)
715{
716 // Set the root directory where to store the QA status object
717
718 fgQAResultDirName.Prepend(name) ;
34709735 719 AliInfoClass(Form("AliQAv1::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data())) ;
4e25ac79 720 if ( fgQAResultDirName.Contains(fgkLabLocalFile))
721 fgQAResultDirName.ReplaceAll(fgkLabLocalFile, "") ;
722 fgQAResultFileName.Prepend(fgQAResultDirName) ;
723}
724
725//_______________________________________________________________
726void AliQAv1::SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
727{
728 // Set the status bit for a given detector and a given task
729
730 CheckRange(det) ;
731 CheckRange(tsk) ;
732 CheckRange(bit) ;
733 CheckRange(es) ;
734
735 ULong_t offset = Offset(tsk) ;
736 ULong_t status = GetStatus(det, es) ;
737 offset+= bit ;
738 status = status | 1 << offset ;
739 SetStatus(det, es, status) ;
740}
741
742//_______________________________________________________________
743void AliQAv1::Show(DETECTORINDEX_t det) const
744{
745 // dispplay the QA status word
746 if ( det == kNULLDET)
747 det = fDet ;
748 for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
eca4fa66 749 if ( IsEventSpecieSet(ies) )
750 ShowStatus(det, kNULLTASK, AliRecoParam::ConvertIndex(ies)) ;
4e25ac79 751 }
752}
753
754//_______________________________________________________________
755void AliQAv1::ShowAll() const
756{
757 // dispplay the QA status word
758 Int_t index ;
759 for (index = 0 ; index < kNDET ; index++) {
760 for (Int_t tsk = kRAW ; tsk < kNTASK ; tsk++) {
761 for (Int_t ies = 0 ; ies < fNEventSpecies ; ies++) {
eca4fa66 762 if ( IsEventSpecieSet(ies) )
763 ShowStatus(DETECTORINDEX_t(index), ALITASK_t(tsk), AliRecoParam::ConvertIndex(ies)) ;
4e25ac79 764 }
765 }
766 }
767}
768
769//_______________________________________________________________
770void AliQAv1::ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const
771{
772 // Prints the full QA status of a given detector
773 CheckRange(det) ;
774 CheckRange(es) ;
775 ULong_t status = GetStatus(det, es) ;
776 ULong_t tskStatus[kNTASK] ;
777 tskStatus[kRAW] = status & 0x0000f ;
778 tskStatus[kSIM] = status & 0x000f0 ;
779 tskStatus[kREC] = status & 0x00f00 ;
780 tskStatus[kESD] = status & 0x0f000 ;
781 tskStatus[kANA] = status & 0xf0000 ;
782
783 AliInfo(Form("====> QA Status for %8s %8s raw =0x%x, sim=0x%x, rec=0x%x, esd=0x%x, ana=0x%x", GetDetName(det).Data(), AliRecoParam::GetEventSpecieName(es),
784 tskStatus[kRAW], tskStatus[kSIM], tskStatus[kREC], tskStatus[kESD], tskStatus[kANA] )) ;
785 if (tsk == kNULLTASK) {
786 for (Int_t itsk = kRAW ; itsk < kNTASK ; itsk++) {
787 ShowASCIIStatus(es, det, ALITASK_t(itsk), tskStatus[itsk]) ;
788 }
789 } else {
790 ShowASCIIStatus(es, det, tsk, tskStatus[tsk]) ;
791 }
792}
793
794//_______________________________________________________________
795void AliQAv1::ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, const ULong_t status) const
796{
797 // print the QA status in human readable format
798 TString text;
799 for (Int_t bit = kINFO ; bit < kNBIT ; bit++) {
800 if (IsSet(det, tsk, es, QABIT_t(bit))) {
801 text = GetBitName(QABIT_t(bit)) ;
802 text += " " ;
803 }
804 }
805 if (! text.IsNull())
34709735 806 AliInfoClass(Form(" %8s %8s %4s 0x%4lx, Problem signalled: %8s \n", AliRecoParam::GetEventSpecieName(es), GetDetName(det).Data(), GetAliTaskName(tsk), status, text.Data())) ;
4e25ac79 807}
808
809//_______________________________________________________________
810void AliQAv1::UnSet(QABIT_t bit, Int_t ies)
811{
812 // UnSet the status bit of the current detector in the current module
813 UnSet(bit, AliRecoParam::Convert(ies)) ;
814}
815
816//_______________________________________________________________
817void AliQAv1::UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es)
818{
819 // UnSet the status bit of the current detector in the current module
820
821 UnSetStatusBit(fDet, fTask, es, bit) ;
822}
823
824//_______________________________________________________________
825void AliQAv1::UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit)
826{
827 // UnSet the status bit for a given detector and a given task
828
829 CheckRange(det) ;
830 CheckRange(tsk) ;
831 CheckRange(bit) ;
832 CheckRange(es) ;
833
834 ULong_t offset = Offset(tsk) ;
835 ULong_t status = GetStatus(det, es) ;
836 offset+= bit ;
837 status = status & 0 << offset ;
838 SetStatus(det, es, status) ;
839}