Introducing event specie in QA (Yves)
[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>
57acd2d2 13#include <TMath.h>
421ab0fb 14class TFile ;
15
7079c8d7 16#include "AliLog.h"
57acd2d2 17#include "AliRecoParam.h"
7079c8d7 18
2e42b4d4 19class AliQA : public TNamed {
421ab0fb 20public:
21
96d67a8d 22 enum DETECTORINDEX_t {
421ab0fb 23 kNULLDET=-1, kITS, kTPC, kTRD, kTOF, kPHOS, kHMPID, kEMCAL, kMUON, kFMD,
a2b64fbd 24 kZDC, kPMD, kT0, kVZERO, kACORDE, kHLT, kGLOBAL, kCORR, kNDET};
96d67a8d 25 enum ALITASK_t {
4edbc5bc 26 kNULLTASK=-1, kRAW, kSIM, kREC, kESD, kANA, kNTASK };
96d67a8d 27 enum QABIT_t {
4edbc5bc 28 kNULLBit=-1, kINFO, kWARNING, kERROR, kFATAL, kNBIT };
96d67a8d 29 enum TASKINDEX_t {
940d8e5f 30 kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
421ab0fb 31
4edbc5bc 32 // Creators - destructors
33 AliQA(); // beware singleton, not to be used
96d67a8d 34 AliQA(const ALITASK_t tsk) ;
35 AliQA(const DETECTORINDEX_t det) ;
4edbc5bc 36 AliQA(const AliQA& qa) ;
37 AliQA& operator = (const AliQA& qa) ;
38 virtual ~AliQA();
421ab0fb 39
cbae8032 40 static AliQA * Instance() ;
41 static AliQA * Instance(const DETECTORINDEX_t det) ;
42 static AliQA * Instance(const ALITASK_t tsk) ;
43 static AliQA * Instance(const TASKINDEX_t tsk) ;
57acd2d2 44 Bool_t CheckFatal() const ;
4edbc5bc 45 static void Close() ;
96d67a8d 46 static const char * GetAliTaskName(ALITASK_t tsk) ;
6e65319c 47 static const TString GetExpert() { return fkgExpert ; }
f12d42ce 48 static UInt_t GetExpertBit() { return fkgExpertBit ; }
7ce961eb 49 static const TString GetLabLocalFile() { return fkgLabLocalFile ; }
50 static const TString GetLabLocalOCDB() { return fkgLabLocalOCDB ; }
51 static const TString GetLabAliEnOCDB() { return fkgLabAliEnOCDB ; }
57acd2d2 52 static DETECTORINDEX_t GetDetIndex(const char * name) ;
96d67a8d 53 static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
4edbc5bc 54 static const char * GetDetName(Int_t det) ;
7ce961eb 55 static const TString GetGRPPath() { return fgGRPPath ; }
f12d42ce 56 static UInt_t GetQABit() { return fkgQABit ; }
930e6e3e 57 static TFile * GetQADataFile(const char * name, const Int_t run) ;
cbae8032 58 static TFile * GetQADataFile(const char * fileName) ;
930e6e3e 59 static const char * GetQADataFileName(const char * name, const Int_t run)
60 {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ; }
cc75f235 61 static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
96d67a8d 62 static const char * GetQAName() { return fkgQAName ; }
a2b64fbd 63 static const char * GetQACorrName() { return fkgQACorrNtName ; }
4edbc5bc 64 static TFile * GetQAResultFile() ;
65 static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
f73f556a 66 static const char * GetQARefDefaultStorage() { return fkgQARefOCDBDefault.Data() ; }
4edbc5bc 67 static const char * GetQARefFileName() { return fgQARefFileName ; }
68 static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
f73f556a 69 static const char * GetRefOCDBDirName() { return fkgRefOCDBDirName.Data() ; }
107bb232 70 static const char * GetRefDataDirName() { return fkgRefDataDirName.Data() ; }
57acd2d2 71 static TASKINDEX_t GetTaskIndex(const char * name) ;
f12d42ce 72 static TString GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
57acd2d2 73 Bool_t IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const { return fEventSpecies[(Int_t)TMath::Log2(es)] ; }
74 Bool_t IsEventSpecieSet(Int_t es) const { return fEventSpecies[es] ; }
75 Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const ;
76 Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t es, QABIT_t bit) const ;
77 Bool_t IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const ;
78 Bool_t IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const ;
0acdb2bb 79 void Merge(TCollection * list) ;
57acd2d2 80 void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
81 void Set(QABIT_t bit, Int_t es) ;
82 void SetEventSpecie(AliRecoParam::EventSpecie_t es) { fEventSpecies[(Int_t)TMath::Log2(es)] = kTRUE ; }
7ce961eb 83 static void SetQAResultDirName(const char * name) ;
4edbc5bc 84 static void SetQARefStorage(const char * name) ;
57acd2d2 85 static void SetQARefDataDirName(AliRecoParam::EventSpecie_t es) { fkgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
86 static void SetQARefDataDirName(Int_t es) { fkgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
87 void Show() const ;
88 void Show(DETECTORINDEX_t det) const ;
4edbc5bc 89 void ShowAll() const ;
57acd2d2 90 void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const ;
91 void UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
92 void UnSet(QABIT_t bit, Int_t es) ;
421ab0fb 93
94private:
95
f12d42ce 96 Bool_t CheckRange(DETECTORINDEX_t det) const ;
97 Bool_t CheckRange(ALITASK_t tsk) const ;
98 Bool_t CheckRange(QABIT_t bit) const ;
57acd2d2 99 Bool_t CheckRange(AliRecoParam::EventSpecie_t es) const ;
96d67a8d 100 const char * GetBitName(QABIT_t bit) const ;
57acd2d2 101 ULong_t GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const { return fQA[det][(Int_t)TMath::Log2(es)] ;}
4edbc5bc 102 void Finish() const ;
f12d42ce 103 ULong_t Offset(ALITASK_t tsk) const ;
57acd2d2 104 void ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ;
105 void ResetStatus(DETECTORINDEX_t det) ;
96d67a8d 106 void Set(DETECTORINDEX_t det) { fDet = det ;}
107 void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(1, Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
57acd2d2 108 void SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status) { fQA[det][(Int_t)TMath::Log2(es)] = status ; }
109 void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
110 void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
421ab0fb 111
7ce961eb 112 static AliQA * fgQA ; // pointer to the instance of the singleton
4038d5ed 113 Int_t fNdet ; // number of detectors
57acd2d2 114 Int_t fNEventSpecie ; // number of Event Specie (see AliRecoParam)
115 ULong_t ** fQA ; //[fNdet][fNEventSpecie] the status word 4 bits for SIM, REC, ESD, ANA each
116 DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
117 ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
118 AliRecoParam::EventSpecie_t fEventSpecie ; //! the current event specie
7ce961eb 119 static TString fgDetNames[] ; //! list of detector names
120 static TString fgGRPPath ; //! path of the GRP object in OCDB
121 static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
cbae8032 122 static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
7ce961eb 123 static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
124 static TString fgQARefDirName ; //! name of directory where to find the reference data file
cbae8032 125 static TString fgQARefFileName ; //! file name where to find the reference data
126 static TFile * fgQAResultFile ; //! File where to find the QA result
127 static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
128 static TString fgQAResultFileName ; //! the output file where the QA results are stored
7ce961eb 129 static TString fgRTNames[] ; //! list of Run Type names
130 static TString fgTaskNames[] ; //! list of tasks names
6e65319c 131 static const TString fkgExpert ; //! name for the expert directory
750730d8 132 static const UInt_t fkgExpertBit ; //! TObject bit identifing the object as "expert"
cbae8032 133 static const TString fkgLabLocalFile ; //! label to identify a file as local
134 static const TString fkgLabLocalOCDB ; //! label to identify a file as local OCDB
135 static const TString fkgLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
136 static const TString fkgRefFileName ; //! name of Reference File Name
4038d5ed 137 static const UInt_t fkgQABit ; //! bit in the QA data object which is set when Checker does not return 0
cbae8032 138 static const TString fkgQAName ; //! name of QA object
a2b64fbd 139 static const TString fkgQACorrNtName ; //! name of QA Correlation Ntuple
cbae8032 140 static const TString fkgRefOCDBDirName ; //! name of Reference directory name in OCDB
141 static TString fkgRefDataDirName ; //! name of Reference directory name in OCDB for data
142 static const TString fkgQARefOCDBDefault ; //! default storage for QA in OCDB
57acd2d2 143 Bool_t * fEventSpecies ; //[fNEventSpecie] list of event species encountered in a run
2e42b4d4 144
145 ClassDef(AliQA,1) //ALICE Quality Assurance Object
421ab0fb 146};
147#endif