]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - FMD/AliFMDParameters.h
Old and new RCU format altro readers are merged in one. The desired format is control...
[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 /** Draw parameters.
90 @param option What to draw. Should be one of
91 - dead Dead channels
92 - threshold Threshold
93 - gain Gain
94 - pedestal Pedestal
95 - noise Noise (or pedestal width)
96 - zero Zero suppression
97 - rate Sampling rate (VA1 clock / ALTRO clock)
98 - min Minimum strip read out
99 - max Maximum strip read out
100 - map hardware address
101 */
102 void Draw(Option_t* option="pedestal");
103
104 /** @{ */
105 /** @name Set various `Fixed' parameters */
106 /** @param r How many MIP signals we can fit in the VA1
107 pre-amps. (default and design is 20) */
108 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
109 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
110 ADC so, the maximum number is 1024 */
111 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
112 /** @param size The number of strips multiplexed into one ALTRO
113 channel. That is, how many strips is connected to one VA1
114 pre-amp. */
115 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
116 /** @param f Factor to use for accepting a signal. */
117 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
118 /** @} */
119
120 /** @{ */
121 /** @name Set various variable parameter defaults */
122 /** @param s Zero suppression threshold in ADC counts */
123 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
124 /** @param r How many times we oversample each strip. */
125 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);}
126 /** @param p Pedestal value in ADC counts */
127 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
128 /** @param w Pedestal width in ADC counts */
129 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
130 /** @param t Threshold used for 1 MIP acceptance. */
131 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
132 /** Range of strips read out
133 @param min Minimum strip number (0-127).
134 @param max Maximum strip number (0-127). */
135 void SetStripRange(UShort_t min=0, UShort_t max=127);
136 /** @} */
137
138 /** @{ */
139 /** @name Get `Fixed' various parameters */
140 /** @return Number of MIP signals that fit inside a VA1 channel */
141 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
142 /** @return The maximum count in the ADC */
143 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
144 /** @return Number of strips muliplexed into one ADC channel */
145 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
146 /** @return The average energy deposited by one MIP */
147 Float_t GetEdepMip() const;
148 /** @return The factor used of signal acceptance */
149 Float_t GetPedestalFactor() const { return fPedestalFactor; }
150 /** @} */
151
152 /** @{ */
153 /** @name Get variable parameters */
154 /** Whether the strip is considered dead
155 @param detector Detector # (1-3)
156 @param ring Ring ID ('I' or 'O')
157 @param sector Sector number (0-39)
158 @param strip Strip number (0-511)
159 @return @c true if the strip is considered dead, @c false if
160 it's OK. */
161 Bool_t IsDead(UShort_t detector,
162 Char_t ring,
163 UShort_t sector,
164 UShort_t strip) const;
165 Float_t GetThreshold() const;
166 /** Gain of pre-amp.
167 @param detector Detector # (1-3)
168 @param ring Ring ID ('I' or 'O')
169 @param sector Sector number (0-39)
170 @param strip Strip number (0-511)
171 @return Gain of pre-amp. */
172 Float_t GetPulseGain(UShort_t detector,
173 Char_t ring,
174 UShort_t sector,
175 UShort_t strip) const;
176 /** Get mean of pedestal
177 @param detector Detector # (1-3)
178 @param ring Ring ID ('I' or 'O')
179 @param sector Sector number (0-39)
180 @param strip Strip number (0-511)
181 @return Mean of pedestal */
182 Float_t GetPedestal(UShort_t detector,
183 Char_t ring,
184 UShort_t sector,
185 UShort_t strip) const;
186 /** Width of pedestal
187 @param detector Detector # (1-3)
188 @param ring Ring ID ('I' or 'O')
189 @param sector Sector number (0-39)
190 @param strip Strip number (0-511)
191 @return Width of pedestal */
192 Float_t GetPedestalWidth(UShort_t detector,
193 Char_t ring,
194 UShort_t sector,
195 UShort_t strip) const;
196 /** zero suppression threshold (in ADC counts)
197 @param detector Detector # (1-3)
198 @param ring Ring ID ('I' or 'O')
199 @param sector Sector number (0-39)
200 @param strip Strip number (0-511)
201 @return zero suppression threshold (in ADC counts) */
202 UShort_t GetZeroSuppression(UShort_t detector,
203 Char_t ring,
204 UShort_t sector,
205 UShort_t strip) const;
206 /** Get the sampling rate
207 @param detector Detector # (1-3)
208 @param ring Ring ID ('I' or 'O')
209 @param sector Sector number (0-39)
210 @param strip Strip number (0-511)
211 @return The sampling rate */
212 UShort_t GetSampleRate(UShort_t detector,
213 Char_t ring,
214 UShort_t sector,
215 UShort_t strip) const;
216 /** Get the minimum strip in the read-out range
217 @param detector Detector # (1-3)
218 @param ring Ring ID ('I' or 'O')
219 @param sector Sector number (0-39)
220 @param strip Strip number (0-511)
221 @return Minimum strip */
222 UShort_t GetMinStrip(UShort_t detector,
223 Char_t ring,
224 UShort_t sector,
225 UShort_t strip) const;
226 /** Get the maximum strip in the read-out range
227 @param detector Detector # (1-3)
228 @param ring Ring ID ('I' or 'O')
229 @param sector Sector number (0-39)
230 @param strip Strip number (0-511)
231 @return Maximum strip */
232 UShort_t GetMaxStrip(UShort_t detector,
233 Char_t ring,
234 UShort_t sector,
235 UShort_t strip) const;
236 /** Translate hardware address to detector coordinates
237 @param ddl DDL number
238 @param addr Hardware address
239 @param det On return, Detector # (1-3)
240 @param ring On return, Ring ID ('I' or 'O')
241 @param sec On return, Sector number (0-39)
242 @param str On return, Strip number (0-511)
243 @return @c true on success. */
244 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
245 Char_t& ring, UShort_t& sec, UShort_t& str) const;
246 /** Translate detector coordinates to hardware address
247 @param det Detector # (1-3)
248 @param ring Ring ID ('I' or 'O')
249 @param sec Sector number (0-39)
250 @param str Strip number (0-511)
251 @param ddl On return, DDL number
252 @param addr On return, Hardware address
253 @return @c true on success. */
254 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
255 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
256 /** Get the map that translates hardware to detector coordinates
257 @return Get the map that translates hardware to detector
258 coordinates */
259 AliFMDAltroMapping* GetAltroMap() const;
260 /** @} */
261
262 enum {
263 kBaseDDL = 0x1000 // DDL offset for the FMD
264 };
265 static const char* PulseGainPath() { return fgkPulseGain; }
266 static const char* PedestalPath() { return fgkPedestal; }
267 static const char* DeadPath() { return fgkDead; }
268 static const char* SampleRatePath() { return fgkSampleRate; }
269 static const char* AltroMapPath() { return fgkAltroMap; }
270 static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
271 static const char* StripRangePath() { return fgkStripRange; }
272protected:
273 /** CTOR */
274 AliFMDParameters();
275 /** CTOR */
276 AliFMDParameters(const AliFMDParameters& o)
277 : TNamed(o), fkSiDeDxMip(o.fkSiDeDxMip) {}
278 /** Assignement operator
279 @return Reference to this */
280 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
281 /** DTOR */
282 virtual ~AliFMDParameters() {}
283 /** Singleton instance */
284 static AliFMDParameters* fgInstance; // Static singleton instance
285 /** Initialize gains. Try to get them from CDB */
286 void InitPulseGain();
287 /** Initialize pedestals. Try to get them from CDB */
288 void InitPedestal();
289 /** Initialize dead map. Try to get it from CDB */
290 void InitDeadMap();
291 /** Initialize sample rates. Try to get them from CDB */
292 void InitSampleRate();
293 /** Initialize zero suppression thresholds. Try to get them from CDB */
294 void InitZeroSuppression();
295 /** Initialize hardware map. Try to get it from CDB */
296 void InitAltroMap();
297 /** Initialize strip range. Try to get it from CDB */
298 void InitStripRange();
299
300 Bool_t fIsInit; // Whether we've been initialised
301
302 static const char* fgkPulseGain; // Path to PulseGain calib object
303 static const char* fgkPedestal; // Path to Pedestal calib object
304 static const char* fgkDead; // Path to Dead calib object
305 static const char* fgkSampleRate; // Path to SampleRate calib object
306 static const char* fgkAltroMap; // Path to AltroMap calib object
307 static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
308 static const char* fgkStripRange; // Path to strip range cal object
309 const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon
310 UShort_t fVA1MipRange; // # MIPs the pre-amp can do
311 UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch.
312 UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan.
313 Float_t fPedestalFactor; // Number of pedestal widths
314
315 Float_t fFixedPedestal; // Pedestal to subtract
316 Float_t fFixedPedestalWidth; // Width of pedestal
317 UShort_t fFixedZeroSuppression; // Threshold for zero-suppression
318 UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp.
319 Float_t fFixedThreshold; // Threshold in ADC counts
320 UShort_t fFixedMinStrip; // Minimum strip read-out
321 UShort_t fFixedMaxStrip; // Maximum strip read-out
322 mutable Float_t fFixedPulseGain; //! Gain (cached)
323 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
324
325 AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
326 AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
327 AliFMDCalibPedestal* fPedestal; // Pedestals
328 AliFMDCalibGain* fPulseGain; // Pulser gain
329 AliFMDCalibDeadMap* fDeadMap; // Pulser gain
330 AliFMDAltroMapping* fAltroMap; // Map of hardware
331 AliFMDCalibStripRange* fStripRange; // Strip range
332
333 ClassDef(AliFMDParameters,5) // Manager of parameters
334};
335
336#endif
337//____________________________________________________________________
338//
339// Local Variables:
340// mode: C++
341// End:
342//
343// EOF
344//
345