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