]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDCalibDrawer.h
Coverity fix
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibDrawer.h
1 #ifndef ALIFMDCALIBDRAWER_H
2 #define ALIFMDCALIBDRAWER_H
3 #include <TObject.h>
4 class TH2D;
5 class TH1D;
6 class TH1;
7
8 class AliFMDCalibDrawer : public TObject 
9 {
10 public:
11   /**
12    * Things we can draw 
13    */
14   enum EWhat { 
15     kPedestal, 
16     kNoise, 
17     kGain, 
18     kDead,
19     kRate, 
20     kRange, 
21     kZeroSuppression 
22   };
23
24   AliFMDCalibDrawer() {}
25   /** 
26    * Initialize the drawer
27    * 
28    * @param runNo  Run number
29    * @param ocdb   Source of parameters (if 0, do not set)
30    */
31   void Init(Int_t runNo, const char* ocdb=0);
32   /** 
33    * Draw pedestals for the selected region.
34    * 
35 ]   * @param d Detector number (if 0 or negative, draw all)
36    * @param r Ring id (if null, draw all rings)
37    * @param s Sector number (if negative, draw all sectors) 
38    * @param t Strip number (if negative, draw all strips)
39    */
40   void DrawPedestals(Short_t d=-1, Char_t r='\0', 
41                      Short_t s=-1, Short_t t=-1) const 
42   { 
43     DrawOne(kPedestal, d, r, s, t);
44   }
45   /** 
46    * Draw noise for the selected region.
47    * 
48    * @param d Detector number (if 0 or negative, draw all)
49    * @param r Ring id (if null, draw all rings)
50    * @param s Sector number (if negative, draw all sectors) 
51    * @param t Strip number (if negative, draw all strips)
52    */
53   void DrawNoise(Short_t d=-1, Char_t r='\0', 
54                  Short_t s=-1, Short_t t=-1) const 
55   {
56     DrawOne(kNoise, d, r, s, t);
57   }
58   /** 
59    * Draw gains for the selected region.
60    * 
61    * @param d Detector number (if 0 or negative, draw all)
62    * @param r Ring id (if null, draw all rings)
63    * @param s Sector number (if negative, draw all sectors) 
64    * @param t Strip number (if negative, draw all strips)
65    */
66   void DrawGains(Short_t d=-1, Char_t r='\0', 
67                      Short_t s=-1, Short_t t=-1) const
68   {
69     DrawOne(kGain, d, r, s, t);
70   }
71   /** 
72    * Draw dead for the selected region.
73    * 
74    * @param d Detector number (if 0 or negative, draw all)
75    * @param r Ring id (if null, draw all rings)
76    * @param s Sector number (if negative, draw all sectors) 
77    * @param t Strip number (if negative, draw all strips)
78    */
79   void DrawDead(Short_t d=-1, Char_t r='\0', Short_t s=-1, Short_t t=-1) const
80   {
81     DrawOne(kDead, d, r, s, t);
82   }
83   
84   void DrawRates(Short_t d=-1, Char_t r='\0', Short_t s=-1, Short_t t=-1) const
85   {
86     DrawOne(kRate, d, r, s, t);
87   }
88   void DrawRanges(Short_t d=-1, Char_t r='\0', Short_t s=-1, Short_t t=-1) const
89   {
90     DrawOne(kRange, d, r, s, t);
91   }
92   void DrawThresholds(Short_t d=-1, Char_t r='\0', Short_t s=-1, 
93                      Short_t t=-1) const
94   {
95     DrawOne(kZeroSuppression, d, r, s, t);
96   }
97   /** 
98    * Draw one thing
99    * 
100    * @param what  What to draw 
101    * @param d Detector number (if 0 or negative, draw all)
102    * @param r Ring id (if null, draw all rings)
103    * @param s Sector number (if negative, draw all sectors) 
104    * @param t Strip number (if negative, draw all strips)
105    */
106   void  DrawOne(EWhat what, Short_t d=-1, Char_t r='\0', 
107                 Short_t s=-1, Short_t t=-1) const;
108 protected:
109   void SetAttributes(TH1* ret, EWhat what, UShort_t d, Char_t r) const;
110   Double_t GetHistMax(EWhat what) const;
111   Double_t GetHistMin(EWhat what) const;
112   /** 
113    * Get the base histogram name
114    * 
115    * @param what What is drawn
116    * 
117    * @return Histogram base name
118    */
119   const char* GetHistName(EWhat what) const;
120   /** 
121    * Get the base histogram title
122    * 
123    * @param what What is drawn
124    * 
125    * @return Histogram base title
126    */
127   const char* GetHistTitle(EWhat what) const;
128   /** 
129    * Get the numbers 
130    * 
131    * @param what What to get
132    * @param d    Detector number
133    * @param r    Ring id
134    * @param s    Sector number
135    * @param t    Strip number
136    * @param val  On return, the value 
137    * @param err  On return, the error on value (or negative if no error)
138    */
139   void GetNumber(EWhat what, UShort_t d, Char_t r, UShort_t s, UShort_t t, 
140                  Double_t& val, Double_t& err) const;
141   /** 
142    * Make a 1D histogram
143    *  
144    * @param what What to make the histogram for 
145    * @param d    Detector 
146    * @param r    Ring 
147    * @param s    Sector
148    * 
149    * @return Newly allocated histogram
150    */
151   TH1D* Make1D(EWhat what, UShort_t d, Char_t r, UShort_t s) const;
152   /** 
153    * Make a 2D histogram
154    *  
155    * @param what What to make the histogram for 
156    * @param d    Detector 
157    * @param r    Ring 
158    * 
159    * @return Newly allocated histogram
160    */
161   TH2D* Make2D(EWhat what, UShort_t d, Char_t r) const;
162   /** 
163    * Fill a per-ring 2D histogram 
164    * 
165    * @param what What to fill in
166    * @param d    Detector 
167    * @param r    Ring 
168    * 
169    * @return Filled histogram 
170    */
171   TH1* FillRing(EWhat what, UShort_t d, Char_t r) const;
172   /** 
173    * Fill a per-sector 1D histogram 
174    * 
175    * @param what What to fill in
176    * @param d    Detector
177    * @param r    Ring 
178    * @param s    Sector 
179    * 
180    * @return Filled histogram 
181    */
182   TH1* FillSector(EWhat what, UShort_t d, Char_t r, UShort_t s) const;
183
184   Int_t GetRingColor(UShort_t d, Char_t r) const;
185   ClassDef(AliFMDCalibDrawer,0); // Draw calibrations 
186 };
187 #endif
188 // Local Variables: 
189 //  mode: C++
190 // End:
191