]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliQA.h
New classes for event plane calculation (Johanna)
[u/mrichter/AliRoot.git] / STEER / AliQA.h
1 #ifndef ALIQA_H
2 #define ALIQA_H
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
12 #include <TNamed.h> 
13 class TFile ; 
14
15 #include "AliLog.h"
16
17 class AliQA : public TNamed {
18 public:
19   
20         enum DETECTORINDEX_t {
21     kNULLDET=-1, kITS, kTPC, kTRD, kTOF, kPHOS, kHMPID, kEMCAL, kMUON, kFMD,
22     kZDC, kPMD, kT0, kVZERO, kACORDE, kHLT, kGLOBAL, kCORR, kNDET};
23         enum ALITASK_t {
24     kNULLTASK=-1, kRAW, kSIM, kREC, kESD, kANA, kNTASK };
25         enum QABIT_t {
26     kNULLBit=-1, kINFO, kWARNING, kERROR, kFATAL, kNBIT };
27   enum RUNTYPE_t {
28     kNULLTYPE=-1, kUNKOWN, kAUTOTEST, kCALIBRATION, kCALIBRATIONPULSER, kCHANNELDELAYTUNING, kCOSMIC, kCOSMICS, kDAQFOUNIFSCAN, 
29     kDAQGENDACSCAN, kDAQMEANTHSCAN, kDAQMINTHSCAN, kDAQNOISYPIXSCAN, kDAQPIXDELAYSCAN, kDAQUNIFORMITYSCAN, 
30     kDCSFOUNIFSCAN, kDCSMEANTHSCAN, kDCSMINTHSCAN, kDCSPIXDELAYSCAN, kDCSUNIFORMITYSCAN, kDDLTEST, kGAIN, 
31     kPEDESTAL, kINJECTOR,  kLASER, kMONTECARLO, kNOISE, kNOISYPIXSCAN,  kPHYSICS, kPULSER, kSTANDALONE, kSTANDALONEBC, 
32     kSTANDALONECENTRAL, kSTANDALONECOSMIC, kSTANDALONEEMD, kSTANDALONELASER, kSTANDALONEMB, kSTANDALONEPEDESTAL, 
33     kSTANDALONESEMICENTRAL, kSTANDALONEPULSER, kNTYPE};
34         
35         enum TASKINDEX_t {
36     kNULLTASKINDEX=-1, kRAWS, kHITS, kSDIGITS, kDIGITS, kRECPOINTS, kTRACKSEGMENTS, kRECPARTICLES, kESDS, kNTASKINDEX };
37   
38         // Creators - destructors
39         AliQA(); // beware singleton, not to be used
40         AliQA(const ALITASK_t tsk) ;
41         AliQA(const DETECTORINDEX_t det) ;
42         AliQA(const AliQA& qa) ;   
43         AliQA& operator = (const AliQA& qa) ;
44         virtual ~AliQA();
45   
46         static  AliQA *        Instance() ;
47         static  AliQA *        Instance(const DETECTORINDEX_t det) ;
48         static  AliQA *        Instance(const ALITASK_t tsk) ;
49         static  AliQA *        Instance(const TASKINDEX_t tsk) ;
50   Bool_t                 CheckFatal() const ;
51         static void            Close() ; 
52         static  char *         GetAliTaskName(ALITASK_t tsk) ;
53   static const TString   GetExpert() { return fgkExpert ; }
54   static  UInt_t         GetExpertBit() { return fgkExpertBit ; }
55         static const TString   GetLabLocalFile() { return fgkLabLocalFile ; } 
56         static const TString   GetLabLocalOCDB() { return fgkLabLocalOCDB ; } 
57         static const TString   GetLabAliEnOCDB() { return fgkLabAliEnOCDB ; } 
58         static  DETECTORINDEX_t GetDetIndex(const char * name) ; 
59         static const TString   GetDetName(DETECTORINDEX_t det) { return fgDetNames[det] ; }
60         static const char *    GetDetName(Int_t det) ;
61         static const TString   GetGRPPath() { return fgGRPPath ; }  
62   static  UInt_t         GetQABit() { return fgkQABit ; }
63         static TFile *         GetQADataFile(const char * name, const Int_t run) ; 
64         static TFile *         GetQADataFile(const char * fileName) ;
65         static const char *    GetQADataFileName(const char * name, const Int_t run) 
66     {return Form("%s.%s.%d.root", name, fgQADataFileName.Data(), run)  ; }
67         static const char *    GetQADataFileName() { return fgQADataFileName.Data() ; }
68         static const char *    GetQAName() { return fgkQAName ; } 
69   static const char *    GetQACorrName() { return fgkQACorrNtName ; }
70         static TFile *         GetQAResultFile() ; 
71         static const char  *   GetQAResultFileName() { return (fgQAResultDirName + fgQAResultFileName).Data() ; }
72         static const char  *   GetQARefDefaultStorage() { return fgkQARefOCDBDefault.Data() ; }
73         static const char  *   GetQARefFileName() { return fgQARefFileName ; }
74         static const char  *   GetQARefStorage() { return fgQARefDirName.Data() ; }
75         static const char  *   GetRefOCDBDirName() { return fgkRefOCDBDirName.Data() ; }
76         static const char  *   GetRefDataDirName() { return fgkRefDataDirName.Data() ; }
77         static const TString   GetRunTypeName(RUNTYPE_t rt = kNULLTYPE) ;
78         static  TASKINDEX_t    GetTaskIndex(const char * name) ; 
79         static const TString   GetTaskName(UInt_t tsk) { return fgTaskNames[tsk] ; }
80   Bool_t                 IsSet(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) const ;
81   Bool_t                 IsSetAny(DETECTORINDEX_t det, ALITASK_t tsk) const ;
82   Bool_t                 IsSetAny(DETECTORINDEX_t det) const ;
83         void                   Merge(TCollection * list) ; 
84         void                   Set(QABIT_t bit) ;
85         static void                            SetQAResultDirName(const char * name) ; 
86         static void            SetQARefStorage(const char * name) ; 
87         static void            SetQARefDataDirName(RUNTYPE_t rt) { fgkRefDataDirName = GetRunTypeName(rt) ; }
88         static void            SetQARefDataDirName(const char * name) ;
89         void                   Show() const { ShowStatus(fDet, fTask) ; }
90         void                   Show(DETECTORINDEX_t det) const { ShowStatus(det) ; }
91         void                   ShowAll() const ;
92         void                   UnSet(QABIT_t bit) ;
93   
94 private:      
95     
96   Bool_t               CheckRange(DETECTORINDEX_t det) const ;
97   Bool_t               CheckRange(ALITASK_t tsk) const ;
98   Bool_t               CheckRange(QABIT_t bit) const ;
99   char *               GetBitName(QABIT_t bit) const ;
100   ULong_t              GetStatus(DETECTORINDEX_t det) const  { return fQA[det] ;}
101         void                 Finish() const ;  
102   ULong_t              Offset(ALITASK_t tsk) const ;
103         void                 ShowStatus(DETECTORINDEX_t det, ALITASK_t tsk=kNULLTASK) const ;
104         void                 ShowASCIIStatus(DETECTORINDEX_t det, ALITASK_t tsk, ULong_t status) const ; 
105         void                 ResetStatus(DETECTORINDEX_t det) { fQA[det] = 0 ; }
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) )) ; }
108         void                 SetStatus(DETECTORINDEX_t det, UShort_t status) { fQA[det] = status ; }
109         void                 SetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
110         void                 UnSetStatusBit(DETECTORINDEX_t det, ALITASK_t tsk, QABIT_t bit) ;
111   
112         static AliQA *       fgQA                               ; // pointer to the instance of the singleton
113         Int_t                fNdet                  ; // number of detectors
114         ULong_t    *         fQA                                ; //[fNdet] the status word 4 bits for SIM, REC, ESD, ANA each
115         DETECTORINDEX_t      fDet                               ; //!  the current detector (ITS, TPC, ....)
116         ALITASK_t            fTask                      ; //!  the current environment (SIM, REC, ESD, ANA)
117         static TString       fgDetNames[]                 ; //! list of detector names   
118         static TString       fgGRPPath              ; //! path of the GRP object in OCDB
119         static TFile *       fgQADataFile                 ; //! the output file where the quality assurance maker store their results
120         static TString       fgQADataFileName       ; //! the name of the file where the quality assurance maker store their results
121         static TFile *       fgQARefFile                  ; //! the output file where the quality assurance maker store their results
122         static TString       fgQARefDirName             ; //! name of directory where to find the reference data file
123         static TString       fgQARefFileName        ; //! file name where to find the reference data
124         static TFile *       fgQAResultFile         ; //! File where to find the QA result
125         static TString       fgQAResultDirName      ; //! the location of the output file where the QA results are stored  
126         static TString       fgQAResultFileName     ; //! the output file where the QA results are stored  
127         static TString       fgRTNames[]                  ; //! list of Run Type names   
128         static TString       fgTaskNames[]              ; //! list of tasks names   
129   static const TString fgkExpert              ; //! name for the expert directory
130   static const UInt_t  fgkExpertBit           ; //! TObject bit identifing the object as "expert"
131         static const TString fgkLabLocalFile        ; //! label to identify a file as local 
132         static const TString fgkLabLocalOCDB        ; //! label to identify a file as local OCDB 
133         static const TString fgkLabAliEnOCDB        ; //! label to identify a file as AliEn OCDB 
134         static const TString fgkRefFileName         ; //! name of Reference File Name 
135         static const UInt_t  fgkQABit               ; //! bit in the QA data object which is set when Checker does not return 0
136         static const TString fgkQAName              ; //! name of QA object 
137         static const TString fgkQACorrNtName        ; //! name of QA Correlation Ntuple
138         static const TString fgkRefOCDBDirName      ; //! name of Reference directory name in OCDB      
139         static       TString fgkRefDataDirName      ; //! name of Reference directory name in OCDB for data     
140         static const TString fgkQARefOCDBDefault    ; //! default storage for QA in OCDB 
141   
142   ClassDef(AliQA,1)  //ALICE Quality Assurance Object
143 };
144 #endif