added merging for QA
[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 };
51757634 27 enum RUNTYPE_t {
cbae8032 28 kNULLTYPE=-1, kUNKOWN, kAUTO_TEST, kCALIBRATION, kCALIBRATION_PULSER, kCHANNEL_DELAY_TUNING, kCOSMIC, kCOSMICS, kDAQ_FO_UNIF_SCAN,
7ce961eb 29 kDAQ_GEN_DAC_SCAN, kDAQ_MEAN_TH_SCAN, kDAQ_MIN_TH_SCAN, kDAQ_NOISY_PIX_SCAN, kDAQ_PIX_DELAY_SCAN, kDAQ_UNIFORMITY_SCAN,
30 kDCS_FO_UNIF_SCAN, kDCS_MEAN_TH_SCAN, kDCS_MIN_TH_SCAN, kDCS_PIX_DELAY_SCAN, kDCS_UNIFORMITY_SCAN, kDDL_TEST, kGAIN,
31 kPEDESTAL, kINJECTOR, kLASER, kMONTECARLO, kNOISE, kNOISY_PIX_SCAN, kPHYSICS, kPULSER, kSTANDALONE, kSTANDALONE_BC,
32 kSTANDALONE_CENTRAL, kSTANDALONE_COSMIC, kSTANDALONE_EMD, kSTANDALONE_LASER, kSTANDALONE_MB, kSTANDALONE_PEDESTAL,
33 kSTANDALONE_SEMICENTRAL, kSTANDALONE_PULSER, kNTYPE};
51757634 34
96d67a8d 35 enum TASKINDEX_t {
940d8e5f 36 kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
421ab0fb 37
4edbc5bc 38 // Creators - destructors
39 AliQA(); // beware singleton, not to be used
96d67a8d 40 AliQA(const ALITASK_t tsk) ;
41 AliQA(const DETECTORINDEX_t det) ;
4edbc5bc 42 AliQA(const AliQA& qa) ;
43 AliQA& operator = (const AliQA& qa) ;
44 virtual ~AliQA();
421ab0fb 45
cbae8032 46 static AliQA * Instance() ;
47 static AliQA * Instance(const DETECTORINDEX_t det) ;
48 static AliQA * Instance(const ALITASK_t tsk) ;
49 static AliQA * Instance(const TASKINDEX_t tsk) ;
4edbc5bc 50 const Bool_t CheckFatal() const ;
51 static void Close() ;
96d67a8d 52 static const char * GetAliTaskName(ALITASK_t tsk) ;
7ce961eb 53 static const TString GetLabLocalFile() { return fkgLabLocalFile ; }
54 static const TString GetLabLocalOCDB() { return fkgLabLocalOCDB ; }
55 static const TString GetLabAliEnOCDB() { return fkgLabAliEnOCDB ; }
7c002d48 56 static const DETECTORINDEX_t GetDetIndex(const char * name) ;
96d67a8d 57 static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
4edbc5bc 58 static const char * GetDetName(Int_t det) ;
7ce961eb 59 static const TString GetGRPPath() { return fgGRPPath ; }
4edbc5bc 60 static TFile * GetQADataFile(const char * name, const Int_t run, const Int_t cycle) ;
cbae8032 61 static TFile * GetQADataFile(const char * fileName) ;
cc75f235 62 static const char * GetQADataFileName(const char * name, const Int_t run, const Int_t cycle)
7ce961eb 63 {return Form("%s.%s.%d.%d.root", name, fgQADataFileName.Data(), run, cycle) ; }
cc75f235 64 static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
96d67a8d 65 static const char * GetQAName() { return fkgQAName ; }
4edbc5bc 66 static TFile * GetQAResultFile() ;
67 static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
f73f556a 68 static const char * GetQARefDefaultStorage() { return fkgQARefOCDBDefault.Data() ; }
4edbc5bc 69 static const char * GetQARefFileName() { return fgQARefFileName ; }
70 static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
f73f556a 71 static const char * GetRefOCDBDirName() { return fkgRefOCDBDirName.Data() ; }
107bb232 72 static const char * GetRefDataDirName() { return fkgRefDataDirName.Data() ; }
51757634 73 static const TString GetRunTypeName(RUNTYPE_t rt = kNULLTYPE) ;
940d8e5f 74 static const TASKINDEX_t GetTaskIndex(const char * name) ;
75 static const TString GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
96d67a8d 76 const Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) const ;
384c0618 77 const Bool_t IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk) const ;
78 const Bool_t IsSetAny(DETECTORINDEX_t det) const ;
0acdb2bb 79 void Merge(TCollection * list) ;
96d67a8d 80 void Set(QABIT_t bit) ;
7ce961eb 81 static void SetQAResultDirName(const char * name) ;
4edbc5bc 82 static void SetQARefStorage(const char * name) ;
51757634 83 static void SetQARefDataDirName(RUNTYPE_t rt) { fkgRefDataDirName = GetRunTypeName(rt) ; }
cbae8032 84 static void SetQARefDataDirName(const char * name) ;
15df7cc8 85 void Show() const { ShowStatus(fDet, fTask) ; }
d5865d2f 86 void Show(DETECTORINDEX_t det) const { ShowStatus(det) ; }
4edbc5bc 87 void ShowAll() const ;
96d67a8d 88 void UnSet(QABIT_t bit) ;
421ab0fb 89
90private:
91
96d67a8d 92 const Bool_t CheckRange(DETECTORINDEX_t det) const ;
93 const Bool_t CheckRange(ALITASK_t tsk) const ;
94 const Bool_t CheckRange(QABIT_t bit) const ;
95 const char * GetBitName(QABIT_t bit) const ;
96 const ULong_t GetStatus(DETECTORINDEX_t det) const { return fQA[det] ;}
4edbc5bc 97 void Finish() const ;
96d67a8d 98 const ULong_t Offset(ALITASK_t tsk) const ;
15df7cc8 99 void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK) const ;
0b96c27c 100 void ShowASCIIStatus(DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ;
96d67a8d 101 void ResetStatus(DETECTORINDEX_t det) { fQA[det] = 0 ; }
102 void Set(DETECTORINDEX_t det) { fDet = det ;}
103 void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(1, Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
104 void SetStatus(DETECTORINDEX_t det, UShort_t status) { fQA[det] = status ; }
105 void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
106 void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
421ab0fb 107
7ce961eb 108 static AliQA * fgQA ; // pointer to the instance of the singleton
109 Int_t fNdet ; // number of detectors
110 ULong_t * fQA ; //[fNdet] the status word 4 bits for SIM, REC, ESD, ANA each
111 DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
112 ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
113 static TString fgDetNames[] ; //! list of detector names
114 static TString fgGRPPath ; //! path of the GRP object in OCDB
115 static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
cbae8032 116 static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
7ce961eb 117 static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
118 static TString fgQARefDirName ; //! name of directory where to find the reference data file
cbae8032 119 static TString fgQARefFileName ; //! file name where to find the reference data
120 static TFile * fgQAResultFile ; //! File where to find the QA result
121 static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
122 static TString fgQAResultFileName ; //! the output file where the QA results are stored
7ce961eb 123 static TString fgRTNames[] ; //! list of Run Type names
124 static TString fgTaskNames[] ; //! list of tasks names
cbae8032 125 static const TString fkgLabLocalFile ; //! label to identify a file as local
126 static const TString fkgLabLocalOCDB ; //! label to identify a file as local OCDB
127 static const TString fkgLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
128 static const TString fkgRefFileName ; //! name of Reference File Name
129 static const TString fkgQAName ; //! name of QA object
130 static const TString fkgRefOCDBDirName ; //! name of Reference directory name in OCDB
131 static TString fkgRefDataDirName ; //! name of Reference directory name in OCDB for data
132 static const TString fkgQARefOCDBDefault ; //! default storage for QA in OCDB
2e42b4d4 133
134 ClassDef(AliQA,1) //ALICE Quality Assurance Object
421ab0fb 135};
136#endif