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