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