]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliQAv1.h
Added ptHard to the information in the AliAODMCHeader, filled in the AODHandler
[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, kDIGITSR, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
31   enum MODE_t {kNULLMODE=0, kSIMMODE, kRECMODE};
32   
33   // Creators - destructors
34   AliQAv1(); // beware singleton, not to be used
35   AliQAv1(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) ;
36   AliQAv1(const ALITASK_t tsk) ;
37   AliQAv1(const DETECTORINDEX_t det) ;
38   AliQAv1(const AliQAv1& qa) ;   
39   AliQAv1& operator = (const AliQAv1& qa) ;
40   virtual ~AliQAv1();
41   
42   static  AliQAv1 *      Instance() ;
43   static  AliQAv1 *      Instance(const Int_t qalength, ULong_t * qa, const Int_t eslength, Bool_t * es) ;
44   static  AliQAv1 *      Instance(const DETECTORINDEX_t det) ;
45   static  AliQAv1 *      Instance(const ALITASK_t tsk) ;
46   static  AliQAv1 *      Instance(const TASKINDEX_t tsk) ;
47   Bool_t                 CheckFatal() const ;
48   static void            Close() ; 
49   static const char *    GetAliTaskName(ALITASK_t tsk) ;
50   Bool_t *               GetEventSpecies() { return fEventSpecies ; }
51   static const TString   GetExpert() { return fgkExpert ; }
52   static       UInt_t    GetExpertBit() { return fgkExpertBit ; }
53   static       UInt_t    GetImageBit()  { return fgkImageBit ; }
54   static const char *    GetImageFileName() { return fImageFileName.Data() ; }
55   static const char *    GetImageFileFormat() { return fImageFileFormat.Data() ; }
56   static const TString   GetLabLocalFile() { return fgkLabLocalFile ; } 
57   static const TString   GetLabLocalOCDB() { return fgkLabLocalOCDB ; } 
58   static const TString   GetLabAliEnOCDB() { return fgkLabAliEnOCDB ; } 
59   static DETECTORINDEX_t GetDetIndex(const char * name) ; 
60   static const TString   GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
61   static const char *    GetDetName(Int_t det) ;
62   static const TString   GetGRPPath() { return fgGRPPath ; }  
63   ULong_t *              GetQA() { return fQA ; }
64   static       UInt_t    GetQABit() { return fgkQABit ; }
65   static TFile *         GetQADataFile(const char * name, Int_t run) ; 
66   static TFile *               GetQADataFile(const char * fileName) ;
67   static const char *    GetQADataFileName(const char * name, Int_t run) 
68   {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run)  ; }
69   static const char *    GetQADataFileName() { return fgQADataFileName.Data() ; }
70   static Int_t           GetQADebugLevel() { return fgkQADebugLevel ; }
71   static const char *    GetQAName() { return fgkQAName ; } 
72   static const char *    GetQACorrName() { return fgkQACorrNtName ; }
73   static  UShort_t       GetMaxQAObj() { return fgkMaxQAObjects ; }
74   static TFile *         GetQAResultFile() ; 
75   static const char  *   GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
76   static const char  *   GetQARefDefaultStorage() { return fgkQARefOCDBDefault.Data() ; }
77   static const char  *   GetQARefFileName() { return fgQARefFileName ; }
78   static const char  *   GetQARefStorage() { return fgQARefDirName.Data() ; }
79   static const char  *   GetRefOCDBDirName() { return fgkRefOCDBDirName.Data() ; }
80   static const char  *   GetRefDataDirName() { return fgRefDataDirName.Data() ; }
81   static     TASKINDEX_t GetTaskIndex(const char * name) ; 
82   static       TString   GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
83   static const char *    GetModeName(MODE_t mode) { return (mode == kSIMMODE || mode == kRECMODE) ? (fgModeNames[mode]).Data() : "" ; }
84   Bool_t                 IsEventSpecieSet(AliRecoParam::EventSpecie_t es) const 
85   {Int_t ibit=0; while(es!=1<<ibit) ++ibit; return fEventSpecies[ibit];}
86   Bool_t                 IsEventSpecieSet(Int_t es) const { return fEventSpecies[es] ; }
87   Bool_t                 IsSet(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) const ;
88   Bool_t                 IsSet(DETECTORINDEX_t det, ALITASK_t tsk, Int_t es, QABIT_t bit) const ;
89   Bool_t                 IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es) const ;
90   Bool_t                 IsSetAny(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const ;
91   void                   Merge(TCollection * list) ; 
92   static MODE_t          Mode(TASKINDEX_t task) ;
93   void                   Set(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
94   void                   Set(QABIT_t bit, Int_t es) ;
95   void                   SetEventSpecie(AliRecoParam::EventSpecie_t es) 
96 //    {Int_t ibit=0; while(es!=1<<ibit) ++ibit; fEventSpecies[ibit] = kTRUE ; }
97   {if(es==AliRecoParam::kDefault) return; Int_t ibit=0; while(es!=1<<ibit) ++ibit; fEventSpecies[ibit] = kTRUE ; }
98   static void            SetQADebug() { AliLog::SetGlobalDebugLevel(GetQADebugLevel()); }
99   static void            SetQAResultDirName(const char * name) ; 
100   static void            SetQARefStorage(const char * name) ; 
101   static void            SetQARefDataDirName(AliRecoParam::EventSpecie_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
102   static void            SetQARefDataDirName(Int_t es) { fgRefDataDirName = AliRecoParam::GetEventSpecieName(es) ; }
103   void                   Show(DETECTORINDEX_t det = kNULLDET) const ;
104   void                   ShowAll() const ;
105   void                   ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault) const ;
106   void                   UnSet(QABIT_t bit, AliRecoParam::EventSpecie_t es) ;
107   void                   UnSet(QABIT_t bit, Int_t es) ;
108   
109 private:      
110   
111   Bool_t                CheckRange(DETECTORINDEX_t det) const ;
112   Bool_t                CheckRange(ALITASK_t tsk) const ;
113   Bool_t                CheckRange(QABIT_t bit) const ;
114   Bool_t                CheckRange(AliRecoParam::EventSpecie_t es) const ;
115   const char *          GetBitName(QABIT_t bit) const ;
116   ULong_t               GetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es) const  { return fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] ;}
117   void                  Finish() const ;  
118   ULong_t               Offset(ALITASK_t tsk) const ;
119   void                  ShowASCIIStatus(AliRecoParam::EventSpecie_t es, DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ; 
120   void                  ResetStatus(DETECTORINDEX_t det) ; 
121   void                  Set(DETECTORINDEX_t det) { fDet = det ;}
122   void                  Set(ALITASK_t tsk) { fTask = tsk ; AliDebug(GetQADebugLevel(), Form("Ready to set QA status in %s", GetAliTaskName(tsk) )) ; }
123   void                  SetStatus(DETECTORINDEX_t det, AliRecoParam::EventSpecie_t es, ULong_t status) { fQA[det*fNEventSpecies+(Int_t)TMath::Log2(es)] = status ; }
124   void                  SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
125   void                  UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, AliRecoParam::EventSpecie_t es, QABIT_t bit) ;
126   
127   static AliQAv1 *      fgQA                           ; // pointer to the instance of the singleton
128   Int_t                 fNdet                      ; // number of detectors
129   Int_t                 fNEventSpecies         ; // number of Event Species (see AliRecoParam)
130   Int_t                 fLengthQA              ; // Auxiliary length of fQA
131   ULong_t    *          fQA                              ; //[fLengthQA]  the status word 4 bits for SIM, REC, ESD, ANA each
132   DETECTORINDEX_t       fDet                           ; //! the current detector (ITS, TPC, ....)
133   ALITASK_t             fTask                    ; //! the current environment (SIM, REC, ESD, ANA)
134   AliRecoParam::EventSpecie_t fEventSpecie     ; //! the current event specie
135   static TString        fgDetNames[]             ; //! list of detector names   
136   static TString        fgGRPPath              ; //! path of the GRP object in OCDB
137   static TFile *        fgQADataFile             ; //! the output file where the quality assurance maker store their results
138   static TString        fgQADataFileName       ; //! the name of the file where the quality assurance maker store their results
139   static TFile *        fgQARefFile                ; //! the output file where the quality assurance maker store their results
140   static TString        fgQARefDirName         ; //! name of directory where to find the reference data file
141   static TString        fgQARefFileName        ; //! file name where to find the reference data
142   static TFile *        fgQAResultFile         ; //! File where to find the QA result
143   static TString        fgQAResultDirName      ; //! the location of the output file where the QA results are stored  
144   static TString        fgQAResultFileName     ; //! the output file where the QA results are stored  
145   static TString        fgRTNames[]                ; //! list of Run Type names   
146   static TString        fgTaskNames[]            ; //! list of tasks names   
147   static TString        fgModeNames[]            ; //! list of mode names   
148   static const TString  fgkExpert              ; //! name for the expert directory
149   static const UInt_t   fgkExpertBit           ; //! TObject bit identifing the object as "expert"
150   static const UInt_t   fgkImageBit            ; //! TObject bit identifing the object to be plotted on the QA image
151   static const TString  fgkLabLocalFile        ; //! label to identify a file as local 
152   static const TString  fgkLabLocalOCDB        ; //! label to identify a file as local OCDB 
153   static const TString  fgkLabAliEnOCDB        ; //! label to identify a file as AliEn OCDB 
154   static const TString  fgkRefFileName         ; //! name of Reference File Name 
155   static const UInt_t   fgkQABit               ; //! bit in the QA data object which is set when Checker does not return 0
156   static const Int_t    fgkQADebugLevel        ; //! debug level used for QA verbosity
157   static const TString  fgkQAName              ; //! name of QA object 
158   static const TString  fgkQACorrNtName        ; //! name of QA Correlation Ntuple
159   static const TString  fgkRefOCDBDirName      ; //! name of Reference directory name in OCDB   
160   static       TString  fgRefDataDirName       ; //! name of Reference directory name in OCDB for data          
161   static const TString  fgkQARefOCDBDefault    ; //! default storage for QA in OCDB 
162   Bool_t *              fEventSpecies          ; //[fNEventSpecies] list of event species encountered in a run
163   static const TString  fImageFileName         ; //! name of the file that contains all the QA images
164   static const TString  fImageFileFormat       ; //! format of the file that contains all the QA images
165   static const UShort_t fgkMaxQAObjects        ;//! maximum number of QA objects allowed dor each task (Raws, digits,....) 
166
167  ClassDef(AliQAv1,3)  //ALICE Quality Assurance Object
168 };
169 #endif