Fixes for coverity.
[u/mrichter/AliRoot.git] / STEER / STEER / AliQAv1.h
CommitLineData
45726e0b 1#ifndef ALIQAV1_H
2#define ALIQAV1_H
4e25ac79 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id: AliQAv1.h 31503 2009-03-16 11:01:16Z schutz $ */
7
8//
9// Quality Assurance Object
10//
11
12#include <TNamed.h>
13#include <TMath.h>
14class TFile ;
6188eeaf 15class TH1 ;
4e25ac79 16
17#include "AliLog.h"
18#include "AliRecoParam.h"
19
20class AliQAv1 : public TNamed {
21public:
22
23 enum DETECTORINDEX_t {
24 kNULLDET=-1, kITS, kTPC, kTRD, kTOF, kPHOS, kHMPID, kEMCAL, kMUON, kFMD,
942ddde8 25 kZDC, kPMD, kT0, kVZERO, kACORDE, kAD, kFIT, kMFT, kHLT, kGLOBAL, kCORR, kNDET};
4e25ac79 26 enum ALITASK_t {
27 kNULLTASK=-1, kRAW, kSIM, kREC, kESD, kANA, kNTASK };
28 enum QABIT_t {
29 kNULLBit=-1, kINFO, kWARNING, kERROR, kFATAL, kNBIT };
30 enum TASKINDEX_t {
44ed7a66 31 kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kDIGITSR, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
5aae1dab 32 enum MODE_t {kNULLMODE=0, kSIMMODE, kRECMODE, kQAMODE};
4e25ac79 33
34 // Creators - destructors
35 AliQAv1(); // beware singleton, not to be used
36 AliQAv1(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) ;
37 AliQAv1(const ALITASK_t tsk) ;
38 AliQAv1(const DETECTORINDEX_t det) ;
39 AliQAv1(const AliQAv1& qa) ;
40 AliQAv1& operator = (const AliQAv1& qa) ;
41 virtual ~AliQAv1();
42
fec0891b 43 static AliQAv1 * Instance() ;
44 static AliQAv1 * Instance(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) ;
45 static AliQAv1 * Instance(const DETECTORINDEX_t det) ;
46 static AliQAv1 * Instance(const ALITASK_t tsk) ;
47 static AliQAv1 * Instance(const TASKINDEX_t tsk) ;
4e25ac79 48 Bool_t CheckFatal() const ;
49 static void Close() ;
50 static const char * GetAliTaskName(ALITASK_t tsk) ;
45726e0b 51 static TH1 * GetData(TObjArray** list, Int_t index, AliRecoParam::EventSpecie_t eventSpecie) ;
4e25ac79 52 Bool_t * GetEventSpecies() { return fEventSpecies ; }
53 static const TString GetExpert() { return fgkExpert ; }
54 static UInt_t GetExpertBit() { return fgkExpertBit ; }
7d297381 55 static UInt_t GetImageBit() { return fgkImageBit ; }
45726e0b 56 static const char * GetImageFileName() { return fgkImageFileName.Data() ; }
fec0891b 57 static const char * GetImageFileFormat() { return fImageFileFormat.Data() ; }
4e25ac79 58 static const TString GetLabLocalFile() { return fgkLabLocalFile ; }
59 static const TString GetLabLocalOCDB() { return fgkLabLocalOCDB ; }
60 static const TString GetLabAliEnOCDB() { return fgkLabAliEnOCDB ; }
61 static DETECTORINDEX_t GetDetIndex(const char * name) ;
62 static const TString GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
63 static const char * GetDetName(Int_t det) ;
64 static const TString GetGRPPath() { return fgGRPPath ; }
65 ULong_t * GetQA() { return fQA ; }
66 static UInt_t GetQABit() { return fgkQABit ; }
67 static TFile * GetQADataFile(const char * name, Int_t run) ;
45726e0b 68 static TFile * GetQADataFile(const char * fileName) ;
4e25ac79 69 static const char * GetQADataFileName(const char * name, Int_t run)
70 {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run) ; }
71 static const char * GetQADataFileName() { return fgQADataFileName.Data() ; }
5379c4a3 72 static Int_t GetQADebugLevel() { return fgkQADebugLevel ; }
4e25ac79 73 static const char * GetQAName() { return fgkQAName ; }
74 static const char * GetQACorrName() { return fgkQACorrNtName ; }
49466ea2 75 static UShort_t GetMaxQAObj() { return fgkMaxQAObjects ; }
4e25ac79 76 static TFile * GetQAResultFile() ;
77 static const char * GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
78 static const char * GetQARefDefaultStorage() { return fgkQARefOCDBDefault.Data() ; }
79 static const char * GetQARefFileName() { return fgQARefFileName ; }
80 static const char * GetQARefStorage() { return fgQARefDirName.Data() ; }
e5bcc358 81 QABIT_t GetQAStatusBit(AliRecoParam::EventSpecie_t es = AliRecoParam::kDefault, DETECTORINDEX_t det=kNULLDET, ALITASK_t tsk=kNULLTASK) const ;
4e25ac79 82 static const char * GetRefOCDBDirName() { return fgkRefOCDBDirName.Data() ; }
83 static const char * GetRefDataDirName() { return fgRefDataDirName.Data() ; }
92664bc8 84 //
85 static UInt_t GetClonedBit() { return fgkQAClonedBit; }
86 static UInt_t GetForbidCloningBit() { return fgkForbidCloningBit; }
87 static UInt_t GetOrigHistoKeptBit() { return fgkOrigHistoKeptBit; }
88 //
4e25ac79 89 static TASKINDEX_t GetTaskIndex(const char * name) ;
90 static TString GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
3a8710ce 91 static const char * GetModeName(MODE_t mode) { return (mode == kSIMMODE || mode == kRECMODE || mode == kQAMODE) ? (fgModeNames[mode]).Data() : "" ; }
4e25ac79 92 Bool_t IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const
93 {Int_t ibit=0; while(es!=1<<ibit) ++ibit; return fEventSpecies[ibit];}
94 Bool_t IsEventSpecieSet(Int_t es) const { return fEventSpecies[es] ; }
95 Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const ;
96 Bool_t IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t es, QABIT_t bit) const ;
97 Bool_t IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const ;
98 Bool_t IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const ;
d759b4a4 99 Long64_t Merge(const TCollection * list) ;
634696f5 100 static MODE_t Mode(TASKINDEX_t task) ;
4e25ac79 101 void Set(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
102 void Set(QABIT_t bit, Int_t es) ;
103 void SetEventSpecie(AliRecoParam::EventSpecie_t es)
c39ee44c 104 {if(es==AliRecoParam::kDefault) return; Int_t ibit=0; while(es!=1<<ibit) ++ibit; fEventSpecies[ibit] = kTRUE ; }
b7a0b96c 105 void UnSetEventSpecie(AliRecoParam::EventSpecie_t es)
106 {if(es==AliRecoParam::kDefault) return; Int_t ibit=0; while(es!=1<<ibit) ++ibit; fEventSpecies[ibit] = kFALSE ; }
5379c4a3 107 static void SetQADebug() { AliLog::SetGlobalDebugLevel(GetQADebugLevel()); }
4e25ac79 108 static void SetQAResultDirName(const char * name) ;
109 static void SetQARefStorage(const char * name) ;
110 static void SetQARefDataDirName(AliRecoParam::EventSpecie_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
111 static void SetQARefDataDirName(Int_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
112 void Show(DETECTORINDEX_t det = kNULLDET) const ;
113 void ShowAll() const ;
114 void ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const ;
115 void UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
116 void UnSet(QABIT_t bit, Int_t es) ;
117
118private:
119
120 Bool_t CheckRange(DETECTORINDEX_t det) const ;
121 Bool_t CheckRange(ALITASK_t tsk) const ;
122 Bool_t CheckRange(QABIT_t bit) const ;
123 Bool_t CheckRange(AliRecoParam::EventSpecie_t es) const ;
124 const char * GetBitName(QABIT_t bit) const ;
b872fee3 125 ULong_t GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const { return fQA[det*fNEventSpecies+AliRecoParam::AConvert(es)] ;}
4e25ac79 126 void Finish() const ;
127 ULong_t Offset(ALITASK_t tsk) const ;
128 void ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ;
b872fee3 129 void Reset(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) ;
130
4e25ac79 131 void ResetStatus(DETECTORINDEX_t det) ;
132 void Set(DETECTORINDEX_t det) { fDet = det ;}
5379c4a3 133 void Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(GetQADebugLevel(), Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
b872fee3 134 void SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status) { fQA[det*fNEventSpecies+AliRecoParam::AConvert(es)] = status ; }
4e25ac79 135 void SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
136 void UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
137
f31c45c9 138 static AliQAv1 * fgQA ; // pointer to the instance of the singleton
139 Int_t fNdet ; // number of detectors
140 Int_t fNEventSpecies ; // number of Event Species (see AliRecoParam)
141 Int_t fLengthQA ; // Auxiliary length of fQA
142 ULong_t * fQA ; //[fLengthQA] the status word 4 bits for SIM, REC, ESD, ANA each
143 DETECTORINDEX_t fDet ; //! the current detector (ITS, TPC, ....)
144 ALITASK_t fTask ; //! the current environment (SIM, REC, ESD, ANA)
145 AliRecoParam::EventSpecie_t fEventSpecie ; //! the current event specie
146 static TString fgDetNames[] ; //! list of detector names
147 static TString fgGRPPath ; //! path of the GRP object in OCDB
148 static TFile * fgQADataFile ; //! the output file where the quality assurance maker store their results
149 static TString fgQADataFileName ; //! the name of the file where the quality assurance maker store their results
150 static TFile * fgQARefFile ; //! the output file where the quality assurance maker store their results
151 static TString fgQARefDirName ; //! name of directory where to find the reference data file
152 static TString fgQARefFileName ; //! file name where to find the reference data
153 static TFile * fgQAResultFile ; //! File where to find the QA result
154 static TString fgQAResultDirName ; //! the location of the output file where the QA results are stored
155 static TString fgQAResultFileName ; //! the output file where the QA results are stored
156 static TString fgRTNames[] ; //! list of Run Type names
157 static TString fgTaskNames[] ; //! list of tasks names
158 static TString fgModeNames[] ; //! list of mode names
159 static const TString fgkExpert ; //! name for the expert directory
160 static const UInt_t fgkExpertBit ; //! TObject bit identifing the object as "expert"
161 static const UInt_t fgkImageBit ; //! TObject bit identifing the object to be plotted on the QA image
162 static const TString fgkLabLocalFile ; //! label to identify a file as local
163 static const TString fgkLabLocalOCDB ; //! label to identify a file as local OCDB
164 static const TString fgkLabAliEnOCDB ; //! label to identify a file as AliEn OCDB
165 static const TString fgkRefFileName ; //! name of Reference File Name
166 static const UInt_t fgkQABit ; //! bit in the QA data object which is set when Checker does not return 0
167 static const Int_t fgkQADebugLevel ; //! debug level used for QA verbosity
168 static const TString fgkQAName ; //! name of QA object
169 static const TString fgkQACorrNtName ; //! name of QA Correlation Ntuple
170 static const TString fgkRefOCDBDirName ; //! name of Reference directory name in OCDB
171 static TString fgRefDataDirName ; //! name of Reference directory name in OCDB for data
172 static const TString fgkQARefOCDBDefault ; //! default storage for QA in OCDB
173 Bool_t * fEventSpecies ; //[fNEventSpecies] list of event species encountered in a run
45726e0b 174 static const TString fgkImageFileName ; //! name of the file that contains all the QA images
f31c45c9 175 static const TString fImageFileFormat ; //! format of the file that contains all the QA images
176 static const UShort_t fgkMaxQAObjects ;//! maximum number of QA objects allowed dor each task (Raws, digits,....)
92664bc8 177 //
178 static const UInt_t fgkQAClonedBit ;//! flag that the histrogram was cloned per trigger class
179 static const UInt_t fgkForbidCloningBit ;//! flag that the histogram is forbiden to clone per trigger class
180 static const UInt_t fgkOrigHistoKeptBit ;//! flag that the histogram was clonned but original is kept
5379c4a3 181 ClassDef(AliQAv1,3) //ALICE Quality Assurance Object
4e25ac79 182};
183#endif