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