QA works during reconstruction in and outside the event loop
[u/mrichter/AliRoot.git] / STEER / AliQA.h
CommitLineData
2e42b4d4 1#ifndef ALIQA_H
2#define ALIQA_H
421ab0fb 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//
9// Quality Assurance Object
10//
11
a5fa6165 12#include <TNamed.h>
421ab0fb 13class TFile ;
14
7079c8d7 15#include "AliLog.h"
16
2e42b4d4 17class AliQA : public TNamed {
421ab0fb 18public:
19
96d67a8d 20 enum DETECTORINDEX_t {
421ab0fb 21 kNULLDET=-1, kITS, kTPC, kTRD, kTOF, kPHOS, kHMPID, kEMCAL, kMUON, kFMD,
7c002d48 22 kZDC, kPMD, kT0, kVZERO, kACORDE, kHLT, kGLOBAL, kNDET };
96d67a8d 23 enum ALITASK_t {
4edbc5bc 24 kNULLTASK=-1, kRAW, kSIM, kREC, kESD, kANA, kNTASK };
96d67a8d 25 enum QABIT_t {
4edbc5bc 26 kNULLBit=-1, kINFO, kWARNING, kERROR, kFATAL, kNBIT };
421ab0fb 27
96d67a8d 28 enum TASKINDEX_t {
4edbc5bc 29 kRAWS, kHITS, kSDIGITS, kDIGITS, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
421ab0fb 30
4edbc5bc 31 // Creators - destructors
32 AliQA(); // beware singleton, not to be used
96d67a8d 33 AliQA(const ALITASK_t tsk) ;
34 AliQA(const DETECTORINDEX_t det) ;
4edbc5bc 35 AliQA(const AliQA& qa) ;
36 AliQA& operator = (const AliQA& qa) ;
37 virtual ~AliQA();
421ab0fb 38
4edbc5bc 39 static AliQA * Instance() ;
96d67a8d 40 static AliQA * Instance(const DETECTORINDEX_t det) ;
41 static AliQA * Instance(const ALITASK_t tsk) ;
42 static AliQA * Instance(const TASKINDEX_t tsk) ;
4edbc5bc 43 const Bool_t CheckFatal() const ;
44 static void Close() ;
96d67a8d 45 static const char * GetAliTaskName(ALITASK_t tsk) ;
4edbc5bc 46 static const TString GetLabLocalFile() { return fkgLabLocalFile ; }
47 static const TString GetLabLocalOCDB() { return fkgLabLocalOCDB ; }
48 static const TString GetLabAliEnOCDB() { return fkgLabAliEnOCDB ; }
7c002d48 49 static const DETECTORINDEX_t GetDetIndex(const char * name) ;
96d67a8d 50 static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
4edbc5bc 51 static const char * GetDetName(Int_t det) ;
52 static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
53 static TFile * GetQADataFile(const char * name, const Int_t run, const Int_t cycle) ;
54 static TFile * GetQADataFile(const char * fileName) ;
96d67a8d 55 static const char * GetQAName() { return fkgQAName ; }
4edbc5bc 56 static TFile * GetQAResultFile() ;
57 static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
f73f556a 58 static const char * GetQARefDefaultStorage() { return fkgQARefOCDBDefault.Data() ; }
4edbc5bc 59 static const char * GetQARefFileName() { return fgQARefFileName ; }
60 static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
f73f556a 61 static const char * GetRefOCDBDirName() { return fkgRefOCDBDirName.Data() ; }
107bb232 62 static const char * GetRefDataDirName() { return fkgRefDataDirName.Data() ; }
7c002d48 63 static const TString GetTaskName(TASKINDEX_t tsk) { return fgTaskNames[tsk] ; }
96d67a8d 64 const Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) const ;
65 void Set(QABIT_t bit) ;
4edbc5bc 66 static void SetQAResultDirName(const char * name) ;
67 static void SetQARefStorage(const char * name) ;
96d67a8d 68 static void SetQARefDataDirName( const char * name) { fkgRefDataDirName = name ; }
69 void Show() const { ShowStatus(fDet) ; }
4edbc5bc 70 void ShowAll() const ;
96d67a8d 71 void UnSet(QABIT_t bit) ;
421ab0fb 72
73private:
74
96d67a8d 75 const Bool_t CheckRange(DETECTORINDEX_t det) const ;
76 const Bool_t CheckRange(ALITASK_t tsk) const ;
77 const Bool_t CheckRange(QABIT_t bit) const ;
78 const char * GetBitName(QABIT_t bit) const ;
79 const ULong_t GetStatus(DETECTORINDEX_t det) const { return fQA[det] ;}
4edbc5bc 80 void Finish() const ;
96d67a8d 81 const ULong_t Offset(ALITASK_t tsk) const ;
82 virtual void ShowStatus(DETECTORINDEX_t det) const ;
83 void ResetStatus(DETECTORINDEX_t det) { fQA[det] = 0 ; }
84 void Set(DETECTORINDEX_t det) { fDet = det ;}
85 void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(1, Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
86 void SetStatus(DETECTORINDEX_t det, UShort_t status) { fQA[det] = status ; }
87 void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
88 void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
421ab0fb 89
4edbc5bc 90 static AliQA *fgQA ; // pointer to the instance of the singleton
91 Int_t fNdet ; // number of detectors
92 ULong_t * fQA ; //[fNdet] the status word 4 bits for SIM, REC, ESD, ANA each
96d67a8d 93 DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
94 ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
4edbc5bc 95 static TString fgDetNames[] ; //! list of detector names
96 static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
97 static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
98 static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
99 static TString fgQARefDirName ; //! name of directory where to find the reference data file
100 static TString fgQARefFileName ; //! file name where to find the reference data
101 static TFile * fgQAResultFile ; //! File where to find the QA result
102 static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
103 static TString fgQAResultFileName ; //! the output file where the QA results are stored
104 static TString fgTaskNames[] ; //! list of tasks names
105 static const TString fkgLabLocalFile ; //! label to identify a file as local
106 static const TString fkgLabLocalOCDB ; //! label to identify a file as local OCDB
107 static const TString fkgLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
108 static const TString fkgRefFileName ; //! name of Reference File Name
96d67a8d 109 static const TString fkgQAName ; //! name of QA object
4edbc5bc 110 static const TString fkgRefOCDBDirName ; //! name of Reference directory name in OCDB
96d67a8d 111 static TString fkgRefDataDirName ; //! name of Reference directory name in OCDB for data
f73f556a 112 static const TString fkgQARefOCDBDefault; //! default storage for QA in OCDB
2e42b4d4 113
114 ClassDef(AliQA,1) //ALICE Quality Assurance Object
421ab0fb 115};
116#endif