DCS DP with correct getters
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibQAChecker.h
CommitLineData
949d8707 1#ifndef AliTPCCalibQAChecker_H
2#define AliTPCCalibQAChecker_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6#include <TNamed.h>
7#include <TString.h>
8#include <TH1.h>
9
10class TTree;
37f2177e 11class TIterator;
949d8707 12class TGraph;
13class TObjArray;
cc65e4f5 14class TVirtualPad;
949d8707 15
16class AliTPCCalibQAChecker : public TNamed {
17public:
18 enum { kNQualityFlags=5 };
19 enum QualityFlag_t { kNULLFLAG=-1, kINFO, kWARNING, kERROR, kFATAL, kNFLAG };
20 enum AlarmType_t { kMean=0, kBinAny, kBinAll, kNentries};
21
22 AliTPCCalibQAChecker();
23 AliTPCCalibQAChecker(const char* name, const char *title);
949d8707 24
25 virtual ~AliTPCCalibQAChecker();
26
27 void Process();
28
29 void SetTreeChecker(TTree* &tree) {fTreePtr=&tree;}
30 void SetHistChecker(TH1* &hist) {fHistPtr=&hist;}
31 void SetGraphChecker(TGraph* &graph) {fGraphPtr=&graph;}
32 void SetNumberChecker(Double_t &number) {fNumberPtr=&number;}
33
34 const AliTPCCalibQAChecker* GetSubChecker(const char* name, Bool_t recursive=kTRUE) const;
35 AliTPCCalibQAChecker* NextSubChecker();
36 Int_t GetNumberOfSubCheckers(Bool_t recursive=kTRUE) const;
37 Bool_t HasSubCheckers() const {return GetNumberOfSubCheckers(kFALSE)>0;}
38
39 void AddSubChecker(AliTPCCalibQAChecker *alarm);
40
41 //getters
42 void GetAlarmThreshold(Double_t &min, Double_t &max, QualityFlag_t quality=kERROR) const {min=fThresMin[quality]; max=fThresMax[quality];}
43 //
44 const char* GetDrawString() { return fStrDraw.Data(); }
45 const char* GetCutsString() { return fStrCuts.Data(); }
46 const char* GetDrawOptString() {return fStrDrawOpt.Data(); }
47
48 //tree related
49 void SetDrawRepresentation(const char *draw, const char* drawOpt="") {fStrDrawRep=draw; fStrDrawRepOpt=drawOpt;}
50 void SetDrawAlarm(const char *draw, const char* drawOpt="") {fStrDraw=draw; fStrDrawOpt=drawOpt;}
51 void SetCutString(const char *cutString ) {fStrCuts=cutString;}
52
53 //general thresholds for the different qualities
54 void SetAlarmThreshold(const Double_t min, const Double_t max, const QualityFlag_t quality=kERROR);
55 void ResetAlarmThreshold(const QualityFlag_t quality);
56 void ResetAlarmThresholds();
57
58 //descriptions
59 void SetQualityDescription(const char* text, const QualityFlag_t quality=kERROR);
60
61 //alarm type
62 void SetAlarmType(AlarmType_t type) {fAlarmType=type;}
63
64
65 QualityFlag_t GetQuality() const {return fQualityLevel;}
66 Color_t GetQualityColor() const {return AliTPCCalibQAChecker::QualityColor(fQualityLevel);}
67 const char* GetQualityName() const {return AliTPCCalibQAChecker::QualityName(fQualityLevel);}
68 const char* GetQualityDescription() const { return QualityDescription(fQualityLevel);}
69
70 static const char* QualityName(const AliTPCCalibQAChecker::QualityFlag_t quality);
71 static Color_t QualityColor(const AliTPCCalibQAChecker::QualityFlag_t quality);
72 const char* QualityDescription(const QualityFlag_t quality) const;
73
74 virtual void Draw(Option_t *option="");
75 virtual void Print(Option_t *option="") const;
76
b0dfb2a8 77 private:
949d8707 78 //alarm decision variables
79 TTree **fTreePtr; //! Pointer to the Tree pointer
80 TH1 **fHistPtr; //! Pointer to the hist pointer
81 TGraph **fGraphPtr; //! Pointer to the graph pointer
82 Double_t *fNumberPtr; //! Pointer to number
83 TH1 *fHist; //! Hist pointer for tree processing
84
85 TIterator *fIterSubCheckers; //! iterator over sub checkers
86
87 TObjArray *fArrSubCheckers; //array with checkers to process
88 TObjArray *fArrAlarmDescriptions; //array with alarm descriptions
89
90 TString fStrDrawRep; //draw string for representation histogram to visualise
91 TString fStrDrawRepOpt; //draw option for representation histogram
92
93 TString fStrDraw; //draw string for alarm histogram
94 TString fStrDrawOpt; //draw option for alarm histogram
95
96 TString fStrCuts; //cut string
97
98 AlarmType_t fAlarmType; //type of the alarm
99 QualityFlag_t fQualityLevel; //quality level
100
cc65e4f5 101 TObject* fHistRep; //visualised histogram
949d8707 102
103 Double_t fThresMin[kNQualityFlags];//minimum thresholds
104 Double_t fThresMax[kNQualityFlags];//maximum thresholds
105
106 void CreateRepresentationHist();
107 void ResetRepresentationHist() {if (fHistRep) {delete fHistRep; fHistRep=0x0;}}
108 //general processing
109 void ProcessTree();
110 void ProcessHist();
111 void ProcessGraph();
112 void ProcessNumber();
113 void ProcessSub();
114 //special processing
115 void ProcessEntries();
116 void ProcessMean();
117 void ProcessBin();
118 //
119 void CreateAlarmHist();
120 void ResetAlarmHist();
121 //
cc65e4f5 122 Int_t DrawInPad(TVirtualPad *pad, Int_t sub=1);
123 void DrawSubNodes(Option_t *option);
124 void DrawRepresentationHist(Option_t *option);
125 void AddQualityLines(TH1 *hist);
126 //
949d8707 127 AliTPCCalibQAChecker(const AliTPCCalibQAChecker &cfg);
128 AliTPCCalibQAChecker& operator = (const AliTPCCalibQAChecker &cfg);
129
130 QualityFlag_t GetQuality(Double_t value) const;
131 QualityFlag_t GetQuality(Int_t n, Double_t *arr) const;
132
133 ClassDef(AliTPCCalibQAChecker,1);
134};
135
136//
137//inline functions
138//
139
140//_________________________________________________________________________
141inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Double_t value) const
142{
143 //
144 // check quality of a value
145 //
146
147 QualityFlag_t quality=kINFO;
148 //loop over Quality levels
149 for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
150 if (fThresMin[i]>=fThresMax[i]) continue;
151 if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
152 }
153 return quality;
154}
155//_________________________________________________________________________
156inline AliTPCCalibQAChecker::QualityFlag_t AliTPCCalibQAChecker::GetQuality(Int_t n, Double_t *arr) const
157{
158 //
159 // check quality of an array
160 //
161
162 QualityFlag_t quality=kINFO;
163 //loop over Quality levels
164 for (Int_t i=(Int_t)kINFO; i<kNQualityFlags; ++i){
165 if (fThresMin[i]>=fThresMax[i]) continue;
166 for (Int_t ientry=0; ientry<n; ++ientry){
167 Double_t value=arr[ientry];
168 if (value<fThresMin[i]||value>fThresMax[i]) quality=(QualityFlag_t)i;
169 }
170 }
171 return quality;
172}
173
174#endif