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