]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - FMD/AliFMDParameters.h
Coding conventions (Christian)
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.h
... / ...
CommitLineData
1#ifndef ALIFMDPARAMETERS_H
2#define ALIFMDPARAMETERS_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4 * reserved.
5 *
6 * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
7 *
8 * See cxx source for full Copyright notice
9 */
10//____________________________________________________________________
11//
12// Singleton class to handle various parameters (not geometry) of the
13// FMD
14// Should get ata fromm Conditions DB.
15//
16/** @file AliFMDParameters.h
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Mon Mar 27 12:44:43 2006
19 @brief Manager of FMD parameters
20*/
21#ifndef ROOT_TNamed
22# include <TNamed.h>
23#endif
24#ifndef ROOT_TArrayI
25# include <TArrayI.h>
26#endif
27#ifndef ALIFMDUSHORTMAP_H
28# include <AliFMDUShortMap.h>
29#endif
30#ifndef ALIFMDBOOLMAP_H
31# include <AliFMDBoolMap.h>
32#endif
33typedef AliFMDUShortMap AliFMDCalibZeroSuppression;
34typedef AliFMDBoolMap AliFMDCalibDeadMap;
35class AliFMDCalibPedestal;
36class AliFMDCalibGain;
37class AliFMDCalibSampleRate;
38class AliFMDCalibStripRange;
39class AliFMDAltroMapping;
40//____________________________________________________________________
41//
42// Singleton class to handle various parameters (not geometry) of the
43// FMD
44// Should get ata fromm Conditions DB.
45//
46
47/** @brief This class is a singleton that handles various parameters
48 of the FMD detectors.
49 This class reads from the Conditions DB to get the various
50 parameters, which code can then request from here. In that way,
51 all code uses the same data, and the interface is consistent.
52
53 Some of the parameter managed are
54 - @c fPedestal, @c fPedestalWidth
55 Mean and width of the pedestal. The pedestal is simulated
56 by a Guassian, but derived classes my override MakePedestal
57 to simulate it differently (or pick it up from a database).
58 - @c fVA1MipRange
59 The dymamic MIP range of the VA1_ALICE pre-amplifier chip
60 - @c fAltroChannelSize
61 The largest number plus one that can be stored in one
62 channel in one time step in the ALTRO ADC chip.
63 - @c fSampleRate
64 How many times the ALTRO ADC chip samples the VA1_ALICE
65 pre-amplifier signal. The VA1_ALICE chip is read-out at
66 10MHz, while it's possible to drive the ALTRO chip at
67 25MHz. That means, that the ALTRO chip can have time to
68 sample each VA1_ALICE signal up to 2 times. Although it's
69 not certain this feature will be used in the production,
70 we'd like have the option, and so it should be reflected in
71 the code.
72
73 @ingroup FMD_base
74*/
75class AliFMDParameters : public TNamed
76{
77public:
78 /** Singleton access
79 @return single to */
80 static AliFMDParameters* Instance();
81
82 /** Initialize the manager. This tries to read the parameters from
83 CDB. If that fails, the class uses the hard-coded parameters.
84 */
85 void Init();
86 /** Print all parameters.
87 @param option Option string */
88 void Print(Option_t* option="A") const;
89
90 /** @{ */
91 /** @name Set various `Fixed' parameters */
92 /** @param r How many MIP signals we can fit in the VA1
93 pre-amps. (default and design is 20) */
94 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
95 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
96 ADC so, the maximum number is 1024 */
97 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
98 /** @param size The number of strips multiplexed into one ALTRO
99 channel. That is, how many strips is connected to one VA1
100 pre-amp. */
101 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
102 /** @param f Factor to use for accepting a signal. */
103 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
104 /** @} */
105
106 /** @{ */
107 /** @name Set various variable parameter defaults */
108 /** @param s Zero suppression threshold in ADC counts */
109 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
110 /** @param r How many times we oversample each strip. */
111 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);}
112 /** @param p Pedestal value in ADC counts */
113 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
114 /** @param w Pedestal width in ADC counts */
115 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
116 /** @param t Threshold used for 1 MIP acceptance. */
117 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
118 /** Range of strips read out
119 @param min Minimum strip number (0-127).
120 @param max Maximum strip number (0-127). */
121 void SetStripRange(UShort_t min=0, UShort_t max=127);
122 /** @} */
123
124 /** @{ */
125 /** @name Get `Fixed' various parameters */
126 /** @return Number of MIP signals that fit inside a VA1 channel */
127 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
128 /** @return The maximum count in the ADC */
129 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
130 /** @return Number of strips muliplexed into one ADC channel */
131 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
132 /** @return The average energy deposited by one MIP */
133 Float_t GetEdepMip() const;
134 /** @return The factor used of signal acceptance */
135 Float_t GetPedestalFactor() const { return fPedestalFactor; }
136 /** @} */
137
138 /** @{ */
139 /** @name Get variable parameters */
140 /** Whether the strip is considered dead
141 @param detector Detector # (1-3)
142 @param ring Ring ID ('I' or 'O')
143 @param sector Sector number (0-39)
144 @param strip Strip number (0-511)
145 @return @c true if the strip is considered dead, @c false if
146 it's OK. */
147 Bool_t IsDead(UShort_t detector,
148 Char_t ring,
149 UShort_t sector,
150 UShort_t strip) const;
151 Float_t GetThreshold() const;
152 /** Gain of pre-amp.
153 @param detector Detector # (1-3)
154 @param ring Ring ID ('I' or 'O')
155 @param sector Sector number (0-39)
156 @param strip Strip number (0-511)
157 @return Gain of pre-amp. */
158 Float_t GetPulseGain(UShort_t detector,
159 Char_t ring,
160 UShort_t sector,
161 UShort_t strip) const;
162 /** Get mean of pedestal
163 @param detector Detector # (1-3)
164 @param ring Ring ID ('I' or 'O')
165 @param sector Sector number (0-39)
166 @param strip Strip number (0-511)
167 @return Mean of pedestal */
168 Float_t GetPedestal(UShort_t detector,
169 Char_t ring,
170 UShort_t sector,
171 UShort_t strip) const;
172 /** Width of pedestal
173 @param detector Detector # (1-3)
174 @param ring Ring ID ('I' or 'O')
175 @param sector Sector number (0-39)
176 @param strip Strip number (0-511)
177 @return Width of pedestal */
178 Float_t GetPedestalWidth(UShort_t detector,
179 Char_t ring,
180 UShort_t sector,
181 UShort_t strip) const;
182 /** zero suppression threshold (in ADC counts)
183 @param detector Detector # (1-3)
184 @param ring Ring ID ('I' or 'O')
185 @param sector Sector number (0-39)
186 @param strip Strip number (0-511)
187 @return zero suppression threshold (in ADC counts) */
188 UShort_t GetZeroSuppression(UShort_t detector,
189 Char_t ring,
190 UShort_t sector,
191 UShort_t strip) const;
192 /** Get the sampling rate
193 @param detector Detector # (1-3)
194 @param ring Ring ID ('I' or 'O')
195 @param sector Sector number (0-39)
196 @param strip Strip number (0-511)
197 @return The sampling rate */
198 UShort_t GetSampleRate(UShort_t detector,
199 Char_t ring,
200 UShort_t sector,
201 UShort_t strip) const;
202 /** Get the minimum strip in the read-out range
203 @param detector Detector # (1-3)
204 @param ring Ring ID ('I' or 'O')
205 @param sector Sector number (0-39)
206 @param strip Strip number (0-511)
207 @return Minimum strip */
208 UShort_t GetMinStrip(UShort_t detector,
209 Char_t ring,
210 UShort_t sector,
211 UShort_t strip) const;
212 /** Get the maximum strip in the read-out range
213 @param detector Detector # (1-3)
214 @param ring Ring ID ('I' or 'O')
215 @param sector Sector number (0-39)
216 @param strip Strip number (0-511)
217 @return Maximum strip */
218 UShort_t GetMaxStrip(UShort_t detector,
219 Char_t ring,
220 UShort_t sector,
221 UShort_t strip) const;
222 /** Translate hardware address to detector coordinates
223 @param ddl DDL number
224 @param addr Hardware address
225 @param det On return, Detector # (1-3)
226 @param ring On return, Ring ID ('I' or 'O')
227 @param sec On return, Sector number (0-39)
228 @param str On return, Strip number (0-511)
229 @return @c true on success. */
230 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
231 Char_t& ring, UShort_t& sec, UShort_t& str) const;
232 /** Translate detector coordinates to hardware address
233 @param det Detector # (1-3)
234 @param ring Ring ID ('I' or 'O')
235 @param sec Sector number (0-39)
236 @param str Strip number (0-511)
237 @param ddl On return, DDL number
238 @param addr On return, Hardware address
239 @return @c true on success. */
240 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
241 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
242 /** Get the map that translates hardware to detector coordinates
243 @return Get the map that translates hardware to detector
244 coordinates */
245 AliFMDAltroMapping* GetAltroMap() const;
246 /** @} */
247
248 enum {
249 kBaseDDL = 0x1000 // DDL offset for the FMD
250 };
251 static const char* PulseGainPath() { return fgkPulseGain; }
252 static const char* PedestalPath() { return fgkPedestal; }
253 static const char* DeadPath() { return fgkDead; }
254 static const char* SampleRatePath() { return fgkSampleRate; }
255 static const char* AltroMapPath() { return fgkAltroMap; }
256 static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
257 static const char* StripRangePath() { return fgkStripRange; }
258protected:
259 /** CTOR */
260 AliFMDParameters();
261 /** CTOR */
262 AliFMDParameters(const AliFMDParameters& o)
263 : TNamed(o), fkSiDeDxMip(o.fkSiDeDxMip) {}
264 /** Assignement operator
265 @return Reference to this */
266 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
267 /** DTOR */
268 virtual ~AliFMDParameters() {}
269 /** Singleton instance */
270 static AliFMDParameters* fgInstance; // Static singleton instance
271 /** Initialize gains. Try to get them from CDB */
272 void InitPulseGain();
273 /** Initialize pedestals. Try to get them from CDB */
274 void InitPedestal();
275 /** Initialize dead map. Try to get it from CDB */
276 void InitDeadMap();
277 /** Initialize sample rates. Try to get them from CDB */
278 void InitSampleRate();
279 /** Initialize zero suppression thresholds. Try to get them from CDB */
280 void InitZeroSuppression();
281 /** Initialize hardware map. Try to get it from CDB */
282 void InitAltroMap();
283 /** Initialize strip range. Try to get it from CDB */
284 void InitStripRange();
285
286 Bool_t fIsInit; // Whether we've been initialised
287
288 static const char* fgkPulseGain; // Path to PulseGain calib object
289 static const char* fgkPedestal; // Path to Pedestal calib object
290 static const char* fgkDead; // Path to Dead calib object
291 static const char* fgkSampleRate; // Path to SampleRate calib object
292 static const char* fgkAltroMap; // Path to AltroMap calib object
293 static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
294 static const char* fgkStripRange; // Path to strip range cal object
295 const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon
296 UShort_t fVA1MipRange; // # MIPs the pre-amp can do
297 UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch.
298 UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan.
299 Float_t fPedestalFactor; // Number of pedestal widths
300
301 Float_t fFixedPedestal; // Pedestal to subtract
302 Float_t fFixedPedestalWidth; // Width of pedestal
303 UShort_t fFixedZeroSuppression; // Threshold for zero-suppression
304 UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp.
305 Float_t fFixedThreshold; // Threshold in ADC counts
306 UShort_t fFixedMinStrip; // Minimum strip read-out
307 UShort_t fFixedMaxStrip; // Maximum strip read-out
308 mutable Float_t fFixedPulseGain; //! Gain (cached)
309 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
310
311 AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
312 AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
313 AliFMDCalibPedestal* fPedestal; // Pedestals
314 AliFMDCalibGain* fPulseGain; // Pulser gain
315 AliFMDCalibDeadMap* fDeadMap; // Pulser gain
316 AliFMDAltroMapping* fAltroMap; // Map of hardware
317 AliFMDCalibStripRange* fStripRange; // Strip range
318
319 ClassDef(AliFMDParameters,5) // Manager of parameters
320};
321
322#endif
323//____________________________________________________________________
324//
325// Local Variables:
326// mode: C++
327// End:
328//
329// EOF
330//
331