added merging for QA
[u/mrichter/AliRoot.git] / STEER / AliQA.cxx
CommitLineData
8661738e 1
421ab0fb 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$ */
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.
12581b04 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)
421ab0fb 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
b09247a2 35#include <cstdlib>
421ab0fb 36// --- ROOT system ---
37#include <TFile.h>
38#include <TSystem.h>
0d13dd63 39#include <TROOT.h>
421ab0fb 40
41// --- Standard library ---
42
43// --- AliRoot header files ---
44#include "AliLog.h"
2e42b4d4 45#include "AliQA.h"
421ab0fb 46
47
2e42b4d4 48ClassImp(AliQA)
f73f556a 49AliQA * AliQA::fgQA = 0x0 ;
50TFile * AliQA::fgQADataFile = 0x0 ;
51TString AliQA::fgQADataFileName = "QA" ; // will transform into Det.QA.run.cycle.root
52TFile * AliQA::fgQARefFile = 0x0 ;
53TString AliQA::fgQARefDirName = "" ;
54TString AliQA::fgQARefFileName = "QA.root" ;
55TFile * AliQA::fgQAResultFile = 0x0 ;
56TString AliQA::fgQAResultDirName = "" ;
57TString AliQA::fgQAResultFileName = "QA.root" ;
58TString AliQA::fgDetNames[] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD",
4fb24ca4 59 "ZDC", "PMD", "T0", "VZERO", "ACORDE", "HLT", "Global"} ;
60TString AliQA::fgGRPPath = "GRP/GRP/Data" ;
61TString AliQA::fgRTNames[] = {"UNKNOWN", "AUTO_TEST", "CALIBRATION", "CALIBRATION_PULSER", "CHANNEL_DELAY_TUNING", "COSMIC",
7ce961eb 62 "COSMICS", "DAQ_FO_UNIF_SCAN", "DAQ_GEN_DAC_SCAN", "DAQ_MEAN_TH_SCAN", "DAQ_MIN_TH_SCAN",
63 "DAQ_NOISY_PIX_SCAN", "DAQ_PIX_DELAY_SCAN", "DAQ_UNIFORMITY_SCAN", "DCS_FO_UNIF_SCAN",
64 "DCS_MEAN_TH_SCAN", "DCS_MIN_TH_SCAN", "DCS_PIX_DELAY_SCAN", "DCS_UNIFORMITY_SCAN",
65 "DDL_TEST", "GAIN", "PEDESTAL", "INJECTOR", "LASER", "MONTECARLO", "NOISE", "NOISY_PIX_SCAN",
66 "PHYSICS", "PULSER", "STANDALONE", "STANDALONE_BC", "STANDALONE_CENTRAL", "STANDALONE_COSMIC",
67 "STANDALONE_EMD", "STANDALONE_LASER", "STANDALONE_MB", "STANDALONE_PEDESTAL",
68 "STANDALONE_SEMICENTRAL", "STANDALONE_PULSER" } ;
f73f556a 69TString AliQA::fgTaskNames[] = {"Raws", "Hits", "SDigits", "Digits", "RecPoints", "TrackSegments", "RecParticles", "ESDs"} ;
70const TString AliQA::fkgLabLocalFile = "file://" ;
71const TString AliQA::fkgLabLocalOCDB = "local://" ;
72const TString AliQA::fkgLabAliEnOCDB = "alien://" ;
73const TString AliQA::fkgRefFileName = "QA.root" ;
96d67a8d 74const TString AliQA::fkgQAName = "QA" ;
f73f556a 75const TString AliQA::fkgRefOCDBDirName = "Ref" ;
4fb24ca4 76TString AliQA::fkgRefDataDirName = "" ;
13c8b505 77const TString AliQA::fkgQARefOCDBDefault = "alien://folder=/alice/QA/20" ;
421ab0fb 78//____________________________________________________________________________
2e42b4d4 79AliQA::AliQA() :
421ab0fb 80 TNamed("", ""),
9a223722 81 fNdet(kNDET),
82 fQA(new ULong_t[fNdet]),
421ab0fb 83 fDet(kNULLDET),
84 fTask(kNULLTASK)
4edbc5bc 85
421ab0fb 86{
87 // default constructor
88 // beware singleton: not to be used
4ecde5fc 89
9a223722 90 for (Int_t index = 0 ; index < fNdet ; index++)
91 fQA[index] = 0 ;
421ab0fb 92}
93
94//____________________________________________________________________________
2e42b4d4 95AliQA::AliQA(const AliQA& qa) :
421ab0fb 96 TNamed(qa),
9a223722 97 fNdet(qa.fNdet),
421ab0fb 98 fQA(qa.fQA),
99 fDet(qa.fDet),
100 fTask(qa.fTask)
101{
102 // cpy ctor
103}
104
105//_____________________________________________________________________________
2e42b4d4 106AliQA& AliQA::operator = (const AliQA& qa)
421ab0fb 107{
108// assignment operator
109
2e42b4d4 110 this->~AliQA();
111 new(this) AliQA(qa);
421ab0fb 112 return *this;
113}
114
115//_______________________________________________________________
96d67a8d 116AliQA::AliQA(const DETECTORINDEX_t det) :
9a223722 117 TNamed("QA", "Quality Assurance status"),
118 fNdet(kNDET),
119 fQA(new ULong_t[fNdet]),
a5fa6165 120 fDet(det),
4edbc5bc 121 fTask(kNULLTASK)
a5fa6165 122{
123 // constructor to be used
124 if (! CheckRange(det) ) {
125 fDet = kNULLDET ;
126 return ;
a4976ef3 127 }
a5fa6165 128 Int_t index ;
9a223722 129 for (index = 0; index < fNdet; index++)
a5fa6165 130 fQA[index] = 0 ;
131}
132
133//_______________________________________________________________
96d67a8d 134AliQA::AliQA(const ALITASK_t tsk) :
421ab0fb 135 TNamed("QA", "Quality Assurance status"),
9a223722 136 fNdet(kNDET),
137 fQA(new ULong_t[fNdet]),
421ab0fb 138 fDet(kNULLDET),
139 fTask(tsk)
140{
141 // constructor to be used in the AliRoot module (SIM, REC, ESD or ANA)
142 if (! CheckRange(tsk) ) {
143 fTask = kNULLTASK ;
144 return ;
a4976ef3 145 }
a5fa6165 146 Int_t index ;
9a223722 147 for (index = 0; index < fNdet; index++)
a5fa6165 148 fQA[index] = 0 ;
421ab0fb 149}
150
151//____________________________________________________________________________
2e42b4d4 152AliQA::~AliQA()
421ab0fb 153{
154 // dtor
155 delete[] fQA ;
156}
157
46ca5304 158//_______________________________________________________________
159void AliQA::Close()
160{
161 // close the open files
162 if (fgQADataFile)
163 if (fgQADataFile->IsOpen())
164 fgQADataFile->Close() ;
165 if (fgQAResultFile)
166 if (fgQAResultFile->IsOpen())
167 fgQAResultFile->Close() ;
168 if (fgQARefFile)
169 if (fgQARefFile->IsOpen())
170 fgQARefFile->Close() ;
171}
172
4ecde5fc 173//_______________________________________________________________
174const Bool_t AliQA::CheckFatal() const
175{
176 // check if any FATAL status is set
177 Bool_t rv = kFALSE ;
178 Int_t index ;
179 for (index = 0; index < kNDET ; index++)
96d67a8d 180 rv = rv || IsSet(DETECTORINDEX_t(index), fTask, kFATAL) ;
4ecde5fc 181 return rv ;
182}
183
421ab0fb 184//_______________________________________________________________
96d67a8d 185const Bool_t AliQA::CheckRange(DETECTORINDEX_t det) const
421ab0fb 186{
a4976ef3 187 // check if detector is in given detector range: 0-kNDET
421ab0fb 188
a5fa6165 189 Bool_t rv = ( det < 0 || det > kNDET ) ? kFALSE : kTRUE ;
421ab0fb 190 if (!rv)
191 AliFatal(Form("Detector index %d is out of range: 0 <= index <= %d", det, kNDET)) ;
192 return rv ;
193}
194
195//_______________________________________________________________
96d67a8d 196const Bool_t AliQA::CheckRange(ALITASK_t task) const
421ab0fb 197{
198 // check if task is given taskk range: 0:kNTASK
6c18591a 199 Bool_t rv = ( task < kRAW || task > kNTASK ) ? kFALSE : kTRUE ;
421ab0fb 200 if (!rv)
201 AliFatal(Form("Module index %d is out of range: 0 <= index <= %d", task, kNTASK)) ;
202 return rv ;
203}
204
205//_______________________________________________________________
96d67a8d 206const Bool_t AliQA::CheckRange(QABIT_t bit) const
421ab0fb 207{
208 // check if bit is in given bit range: 0-kNBit
209
210 Bool_t rv = ( bit < 0 || bit > kNBIT ) ? kFALSE : kTRUE ;
211 if (!rv)
212 AliFatal(Form("Status bit %d is out of range: 0 <= bit <= %d", bit, kNBIT)) ;
213 return rv ;
214}
215
421ab0fb 216
4ecde5fc 217
a5fa6165 218//_______________________________________________________________
96d67a8d 219const char * AliQA::GetAliTaskName(ALITASK_t tsk)
421ab0fb 220{
0b96c27c 221 // returns the char name corresponding to module index
222 TString tskName ;
223 switch (tsk) {
224 case kNULLTASK:
225 break ;
226 case kRAW:
227 tskName = "RAW" ;
228 break ;
229 case kSIM:
230 tskName = "SIM" ;
231 break ;
232 case kREC:
233 tskName = "REC" ;
234 break ;
235 case kESD:
236 tskName = "ESD" ;
237 break ;
238 case kANA:
239 tskName = "ANA" ;
240 break ;
241 default:
242 tsk = kNULLTASK ;
243 break ;
244 }
245 return tskName.Data() ;
246}
0acdb2bb 247
0b96c27c 248//_______________________________________________________________
249const char * AliQA::GetBitName(QABIT_t bit) const
250{
251 // returns the char name corresponding to bit
252 TString bitName ;
253 switch (bit) {
254 case kNULLBit:
255 break ;
256 case kINFO:
257 bitName = "INFO" ;
258 break ;
259 case kWARNING:
260 bitName = "WARNING" ;
261 break ;
262 case kERROR:
263 bitName = "ERROR" ;
264 break ;
265 case kFATAL:
266 bitName = "FATAL" ;
267 break ;
268 default:
269 bit = kNULLBit ;
270 break ;
271 }
272 return bitName.Data() ;
421ab0fb 273}
274
46ca5304 275//_______________________________________________________________
7c002d48 276const AliQA::DETECTORINDEX_t AliQA::GetDetIndex(const char * name)
96d67a8d 277{
278 // returns the detector index corresponding to a given name
279 TString sname(name) ;
280 DETECTORINDEX_t rv = kNULLDET ;
281 for (Int_t det = 0; det < kNDET ; det++) {
282 if ( GetDetName(det) == sname ) {
283 rv = DETECTORINDEX_t(det) ;
284 break ;
285 }
286 }
287 return rv ;
288}
289
7c002d48 290//_______________________________________________________________
291const char * AliQA::GetDetName(Int_t det)
292{
293 // returns the detector name corresponding to a given index (needed in a loop)
294
295 if ( det >= 0 && det < kNDET)
296 return (fgDetNames[det]).Data() ;
297 else
298 return NULL ;
299}
300
46ca5304 301//_______________________________________________________________
302TFile * AliQA::GetQADataFile(const char * name, const Int_t run, const Int_t cycle)
303{
304 // opens the file to store the detectors Quality Assurance Data Maker results
96d67a8d 305 const char * temp = Form("%s.%s.%d.%d.root", name, fgQADataFileName.Data(), run, cycle) ;
306 TString opt ;
307 if (! fgQADataFile ) {
308 if (gSystem->AccessPathName(temp))
309 opt = "NEW" ;
310 else
311 opt = "UPDATE" ;
312 fgQADataFile = TFile::Open(temp, opt.Data()) ;
313 } else {
314 if ( strcmp(temp, fgQADataFile->GetName()) != 0 ) {
315 fgQADataFile = dynamic_cast<TFile *>(gROOT->FindObject(temp)) ;
316 if ( !fgQADataFile ) {
317 if (gSystem->AccessPathName(temp))
318 opt = "NEW" ;
319 else
320 opt = "UPDATE" ;
321 fgQADataFile = TFile::Open(temp, opt.Data()) ;
322 }
323 }
46ca5304 324 }
96d67a8d 325 return fgQADataFile ;
46ca5304 326}
327
328//_____________________________________________________________________________
329TFile * AliQA::GetQADataFile(const char * fileName)
330{
331 // Open if necessary the Data file and return its pointer
332
333 if (!fgQADataFile)
334 if (!fileName)
335 fileName = AliQA::GetQADataFileName() ;
336 if (!gSystem->AccessPathName(fileName)) {
337 fgQADataFile = TFile::Open(fileName) ;
338 } else {
339 printf("File %s not found", fileName) ;
340 exit(1) ;
341 }
342 return fgQADataFile ;
343}
344
4ecde5fc 345//_______________________________________________________________
346TFile * AliQA::GetQAResultFile()
347{
348 // opens the file to store the Quality Assurance Data Checker results
2ba0b5f5 349 if (fgQAResultFile)
350 fgQAResultFile->Close() ;
351 fgQAResultFile = 0x0 ;
352// if (!fgQAResultFile) {
1c0190ec 353 TString dirName(fgQAResultDirName) ;
4edbc5bc 354 if ( dirName.Contains(fkgLabLocalFile))
355 dirName.ReplaceAll(fkgLabLocalFile, "") ;
1c0190ec 356 TString fileName(dirName + fgQAResultFileName) ;
46ca5304 357 TString opt("") ;
358 if ( !gSystem->AccessPathName(fileName) )
359 opt = "UPDATE" ;
5bd22145 360 else {
1c0190ec 361 if ( gSystem->AccessPathName(dirName) )
362 gSystem->mkdir(dirName) ;
46ca5304 363 opt = "NEW" ;
5bd22145 364 }
46ca5304 365 fgQAResultFile = TFile::Open(fileName, opt) ;
2ba0b5f5 366// }
46ca5304 367
368 return fgQAResultFile ;
421ab0fb 369}
370
51757634 371//_______________________________________________________________
372const TString AliQA::GetRunTypeName(RUNTYPE_t rt)
373{
374 TString rv("Invalid Run Type") ;
375 if ( rt == kNULLTYPE ) {
376 rv = "Known RUN_TYPE are: \n" ;
377 for (Int_t index = 0 ; index < kNTYPE; index++) {
378 rv += Form("%2d -- %s\n", index, fgRTNames[index].Data()) ;
379 }
380 printf("%s", rv.Data()) ;
381 return "" ;
382 }
383 else {
384 if ( rt > kNULLTYPE && rt < kNTYPE )
385 rv = fgRTNames[rt] ;
386 }
387 return rv ;
388}
389
940d8e5f 390//_______________________________________________________________
391const AliQA::TASKINDEX_t AliQA::GetTaskIndex(const char * name)
392{
393 // returns the detector index corresponding to a given name
394 TString sname(name) ;
395 TASKINDEX_t rv ;
75f6ebf0 396 for (Int_t tsk = 0; tsk < kNTASKINDEX ; tsk++) {
940d8e5f 397 if ( GetTaskName(tsk) == sname ) {
398 rv = TASKINDEX_t(tsk) ;
399 break ;
400 }
401 }
402 return rv ;
403}
404
421ab0fb 405//_______________________________________________________________
96d67a8d 406const Bool_t AliQA::IsSet(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) const
421ab0fb 407{
408 // Checks is the requested bit is set
384c0618 409
421ab0fb 410 CheckRange(det) ;
411 CheckRange(tsk) ;
412 CheckRange(bit) ;
384c0618 413
421ab0fb 414 ULong_t offset = Offset(tsk) ;
415 ULong_t status = GetStatus(det) ;
416 offset+= bit ;
417 status = (status & 1 << offset) != 0 ;
418 return status ;
419}
420
384c0618 421//_______________________________________________________________
422const Bool_t AliQA::IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk) const
423{
424 // Checks is the requested bit is set
425
426 CheckRange(det) ;
427 CheckRange(tsk) ;
428
429 ULong_t offset = Offset(tsk) ;
430 ULong_t status = GetStatus(det) ;
431 UShort_t st = 0 ;
432 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
433 offset+= bit ;
434 st += (status & 1 << offset) != 0 ;
435 }
436 if ( st == 0 )
437 return kFALSE ;
438 else
439 return kTRUE ;
440}
441//_______________________________________________________________
442const Bool_t AliQA::IsSetAny(DETECTORINDEX_t det) const
443{
444 // Checks is the requested bit is set
445
446 CheckRange(det) ;
447
448 ULong_t status = GetStatus(det) ;
449 UShort_t st = 0 ;
450 for ( Int_t tsk = 0 ; tsk < kNTASK ; tsk++) {
451 ULong_t offset = Offset(ALITASK_t(tsk)) ;
452 for ( Int_t bit = 0 ; bit < kNBIT ; bit++) {
453 offset+= bit ;
454 st += (status & 1 << offset) != 0 ;
455 }
456 }
457 if ( st == 0 )
458 return kFALSE ;
459 else
460 return kTRUE ;
461}
462
421ab0fb 463//_______________________________________________________________
2e42b4d4 464AliQA * AliQA::Instance()
421ab0fb 465{
466 // Get an instance of the singleton.
467 // Object must have been instantiated with Instance(ALITASK) first
468
469 return fgQA ;
470}
471
472//_______________________________________________________________
96d67a8d 473AliQA * AliQA::Instance(const DETECTORINDEX_t det)
421ab0fb 474{
475 // Get an instance of the singleton. The only authorized way to call the ctor
476
9a223722 477 if ( ! fgQA) {
46ca5304 478 TFile * f = GetQAResultFile() ;
9a223722 479 fgQA = dynamic_cast<AliQA *>(f->Get("QA")) ;
480 if ( ! fgQA )
481 fgQA = new AliQA(det) ;
482 }
421ab0fb 483 fgQA->Set(det) ;
484 return fgQA ;
485}
486
487//_______________________________________________________________
96d67a8d 488AliQA * AliQA::Instance(const ALITASK_t tsk)
421ab0fb 489{
490 // get an instance of the singleton.
491
492 if ( ! fgQA)
493 switch (tsk) {
494 case kNULLTASK:
495 break ;
6c18591a 496 case kRAW:
2e42b4d4 497 fgQA = new AliQA(tsk) ;
6c18591a 498 break ;
499 case kSIM:
2e42b4d4 500 fgQA = new AliQA(tsk) ;
421ab0fb 501 break ;
502 case kREC:
503 printf("fgQA = gAlice->GetQA()") ;
504 break ;
505 case kESD:
506 printf("fgQA = dynamic_cast<AliQA *> (esdFile->Get(\"QA\")") ;
507 break ;
508 case kANA:
509 printf("fgQA = dynamic_cast<AliQA *> (esdFile->Get(\"QA\")") ;
510 break ;
511 case kNTASK:
512 break ;
513 }
514 if (fgQA)
515 fgQA->Set(tsk) ;
516 return fgQA ;
517}
518
519//_______________________________________________________________
96d67a8d 520AliQA * AliQA::Instance(const TASKINDEX_t tsk)
521{
522 // get an instance of the singleton.
523
524 ALITASK_t index = kNULLTASK ;
525
526 if ( tsk == kRAWS )
527 index = kRAW ;
528 else if (tsk < kDIGITS)
529 index = kSIM ;
530 else if (tsk < kRECPARTICLES)
531 index = kREC ;
532 else if (tsk == kESDS)
533 index = kESD ;
534
535 return Instance(index) ;
536}
537
0acdb2bb 538//_______________________________________________________________
539void AliQA::Merge(TCollection * list) {
540 // Merge the QA resuls in the list into this single AliQA object
541
542 for (Int_t det = 0 ; det < kNDET ; det++) {
543 Set(DETECTORINDEX_t(det)) ;
544 for (Int_t task = 0 ; task < kNTASK ; task++) {
545 Set(ALITASK_t(task)) ;
546 for (Int_t bit = 0 ; bit < kNBIT ; bit++) {
547 TIter next(list) ;
548 AliQA * qa ;
549 while ( (qa = (AliQA*)next() ) ) {
550 qa->IsSet(DETECTORINDEX_t(det), ALITASK_t(task), QABIT_t(bit)) ;
551 Set(QABIT_t(bit)) ;
552 } // qa list
553 } // bit
554 } // task
555 } // detector
556}
557
96d67a8d 558//_______________________________________________________________
559const ULong_t AliQA::Offset(ALITASK_t tsk) const
421ab0fb 560{
561 // Calculates the bit offset for a given module (SIM, REC, ESD, ANA)
562
563 CheckRange(tsk) ;
564
565 ULong_t offset = 0 ;
566 switch (tsk) {
567 case kNULLTASK:
568 break ;
6c18591a 569 case kRAW:
421ab0fb 570 offset+= 0 ;
571 break ;
6c18591a 572 case kSIM:
421ab0fb 573 offset+= 4 ;
574 break ;
6c18591a 575 case kREC:
421ab0fb 576 offset+= 8 ;
577 break ;
6c18591a 578 case kESD:
421ab0fb 579 offset+= 12 ;
580 break ;
6c18591a 581 case kANA:
582 offset+= 16 ;
583 break ;
421ab0fb 584 case kNTASK:
585 break ;
586 }
587
588 return offset ;
589}
590
591//_______________________________________________________________
96d67a8d 592void AliQA::Set(QABIT_t bit)
421ab0fb 593{
594 // Set the status bit of the current detector in the current module
595
596 SetStatusBit(fDet, fTask, bit) ;
597}
598
4ecde5fc 599//_____________________________________________________________________________
4edbc5bc 600void AliQA::SetQARefStorage(const char * name)
4ecde5fc 601{
72c25501 602 // Set the root directory where the QA reference data are stored
603
604 fgQARefDirName = name ;
605 if ( fgQARefDirName.Contains(fkgLabLocalFile) )
606 fgQARefFileName = fkgRefFileName ;
607 else if ( fgQARefDirName.Contains(fkgLabLocalOCDB) )
96d67a8d 608 fgQARefFileName = fkgQAName ;
72c25501 609 else if ( fgQARefDirName.Contains(fkgLabAliEnOCDB) )
96d67a8d 610 fgQARefFileName = fkgQAName ;
4ecde5fc 611
4edbc5bc 612 else {
613 printf("ERROR: %s is an invalid storage definition\n", name) ;
614 fgQARefDirName = "" ;
615 fgQARefFileName = "" ;
616 }
72c25501 617 TString tmp(fgQARefDirName) ; // + fgQARefFileName) ;
4edbc5bc 618 printf("AliQA::SetQARefDir: QA references are in %s\n", tmp.Data() ) ;
4ecde5fc 619}
620
4fb24ca4 621//_____________________________________________________________________________
622void AliQA::SetQARefDataDirName(const char * name)
623{
624 // Set the lower level directory name where reference data are found
625 TString test(name) ;
7ce961eb 626 RUNTYPE_t rt = kNULLTYPE ;
627 for (Int_t index = 0; index < kNTYPE; index++) {
628 if (test.CompareTo(fgRTNames[index]) == 0) {
4fb24ca4 629 rt = (RUNTYPE_t) index ;
630 break ;
7ce961eb 631 }
632 }
633
634 if (rt == kNULLTYPE) {
4fb24ca4 635 printf("AliQA::SetQARefDataDirName: %s is an unknown RUN TYPE name\n", name) ;
636 return ;
7ce961eb 637 }
638
639 SetQARefDataDirName(rt) ;
4fb24ca4 640}
641
4ecde5fc 642//_____________________________________________________________________________
643void AliQA::SetQAResultDirName(const char * name)
644{
645 // Set the root directory where to store the QA status object
646
647 fgQAResultDirName.Prepend(name) ;
648 printf("AliQA::SetQAResultDirName: QA results are in %s\n", fgQAResultDirName.Data()) ;
4edbc5bc 649 if ( fgQAResultDirName.Contains(fkgLabLocalFile))
650 fgQAResultDirName.ReplaceAll(fkgLabLocalFile, "") ;
4ecde5fc 651 fgQAResultFileName.Prepend(fgQAResultDirName) ;
652}
653
421ab0fb 654//_______________________________________________________________
96d67a8d 655void AliQA::SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit)
421ab0fb 656{
657 // Set the status bit for a given detector and a given task
658
659 CheckRange(det) ;
660 CheckRange(tsk) ;
661 CheckRange(bit) ;
662
663 ULong_t offset = Offset(tsk) ;
664 ULong_t status = GetStatus(det) ;
665 offset+= bit ;
666 status = status | 1 << offset ;
667 SetStatus(det, status) ;
668}
669
670//_______________________________________________________________
2e42b4d4 671void AliQA::ShowAll() const
421ab0fb 672{
673 // dispplay the QA status word
674 Int_t index ;
15df7cc8 675 for (index = 0 ; index < kNDET ; index++) {
676 for (Int_t tsk = kRAW ; tsk < kNTASK ; tsk++) {
677 ShowStatus(DETECTORINDEX_t(index), ALITASK_t(tsk)) ;
678 }
679 }
421ab0fb 680}
681
682//_______________________________________________________________
15df7cc8 683void AliQA::ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk) const
421ab0fb 684{
0b96c27c 685 // Prints the full QA status of a given detector
686 CheckRange(det) ;
687 ULong_t status = GetStatus(det) ;
688 ULong_t tskStatus[kNTASK] ;
689 tskStatus[kRAW] = status & 0x0000f ;
690 tskStatus[kSIM] = status & 0x000f0 ;
691 tskStatus[kREC] = status & 0x00f00 ;
692 tskStatus[kESD] = status & 0x0f000 ;
693 tskStatus[kANA] = status & 0xf0000 ;
694
695 AliInfo(Form("====> QA Status for %8s raw =0x%x, sim=0x%x, rec=0x%x, esd=0x%x, ana=0x%x", GetDetName(det).Data(),
696 tskStatus[kRAW], tskStatus[kSIM], tskStatus[kREC], tskStatus[kESD], tskStatus[kANA] )) ;
15df7cc8 697 if (tsk == kNULLTASK) {
698 for (Int_t itsk = kRAW ; itsk < kNTASK ; itsk++) {
699 ShowASCIIStatus(det, ALITASK_t(itsk), tskStatus[itsk]) ;
700 }
701 } else {
702 ShowASCIIStatus(det, tsk, tskStatus[tsk]) ;
0b96c27c 703 }
704}
421ab0fb 705
0b96c27c 706//_______________________________________________________________
707void AliQA::ShowASCIIStatus(DETECTORINDEX_t det, ALITASK_t tsk, const ULong_t status) const
708{
709 // print the QA status in human readable format
710 TString text;
711 for (Int_t bit = kINFO ; bit < kNBIT ; bit++) {
712 if (IsSet(det, tsk, QABIT_t(bit))) {
713 text = GetBitName(QABIT_t(bit)) ;
714 text += " " ;
715 }
716 }
717 if (! text.IsNull())
718 printf(" %8s %4s 0x%4x, Problem signalled: %8s \n", GetDetName(det).Data(), GetAliTaskName(tsk), status, text.Data()) ;
421ab0fb 719}
720
96d67a8d 721//_______________________________________________________________
722void AliQA::UnSet(QABIT_t bit)
723{
724 // UnSet the status bit of the current detector in the current module
725
726 UnSetStatusBit(fDet, fTask, bit) ;
727}
728
729//_______________________________________________________________
730void AliQA::UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit)
731{
732 // UnSet the status bit for a given detector and a given task
733
734 CheckRange(det) ;
735 CheckRange(tsk) ;
736 CheckRange(bit) ;
737
738 ULong_t offset = Offset(tsk) ;
739 ULong_t status = GetStatus(det) ;
740 offset+= bit ;
741 status = status & 0 << offset ;
742 SetStatus(det, status) ;
92a357bf 743}