1 #ifndef ALIFMDPARAMETERS_H
2 #define ALIFMDPARAMETERS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
6 * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
8 * See cxx source for full Copyright notice
10 //____________________________________________________________________
12 // Singleton class to handle various parameters (not geometry) of the
14 // Should get ata fromm Conditions DB.
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
27 #ifndef ALIFMDUSHORTMAP_H
28 # include <AliFMDUShortMap.h>
30 #ifndef ALIFMDBOOLMAP_H
31 # include <AliFMDBoolMap.h>
33 typedef AliFMDUShortMap AliFMDCalibZeroSuppression;
34 typedef AliFMDBoolMap AliFMDCalibDeadMap;
35 class AliFMDCalibPedestal;
36 class AliFMDCalibGain;
37 class AliFMDCalibSampleRate;
38 class AliFMDCalibStripRange;
39 class AliFMDAltroMapping;
40 //____________________________________________________________________
42 // Singleton class to handle various parameters (not geometry) of the
44 // Should get ata fromm Conditions DB.
47 /** @brief This class is a singleton that handles various parameters
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.
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).
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.
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
75 class AliFMDParameters : public TNamed
80 static AliFMDParameters* Instance();
82 /** Initialize the manager. This tries to read the parameters from
83 CDB. If that fails, the class uses the hard-coded parameters.
86 /** Print all parameters.
87 @param option Option string */
88 void Print(Option_t* option="A") const;
90 @param option What to draw. Should be one of
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
102 void Draw(Option_t* option="pedestal");
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
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; }
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);
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; }
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
161 Bool_t IsDead(UShort_t detector,
164 UShort_t strip) const;
165 Float_t GetThreshold() const;
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,
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,
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,
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,
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,
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,
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,
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
259 AliFMDAltroMapping* GetAltroMap() const;
262 static const char* PulseGainPath() { return fgkPulseGain; }
263 static const char* PedestalPath() { return fgkPedestal; }
264 static const char* DeadPath() { return fgkDead; }
265 static const char* SampleRatePath() { return fgkSampleRate; }
266 static const char* AltroMapPath() { return fgkAltroMap; }
267 static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
268 static const char* StripRangePath() { return fgkStripRange; }
273 AliFMDParameters(const AliFMDParameters& o)
276 fkSiDeDxMip(o.fkSiDeDxMip),
277 fVA1MipRange(o.fVA1MipRange),
278 fAltroChannelSize(o.fAltroChannelSize),
279 fChannelsPerAltro(o.fChannelsPerAltro),
280 fPedestalFactor(o.fPedestalFactor),
281 fFixedPedestal(o.fFixedPedestal),
282 fFixedPedestalWidth(o.fFixedPedestalWidth),
283 fFixedZeroSuppression(o.fFixedZeroSuppression),
284 fFixedSampleRate(o.fFixedSampleRate),
285 fFixedThreshold(o.fFixedThreshold),
286 fFixedMinStrip(o.fFixedMinStrip),
287 fFixedMaxStrip(o.fFixedMaxStrip),
288 fFixedPulseGain(o.fFixedPulseGain),
289 fEdepMip(o.fEdepMip),
290 fZeroSuppression(o.fZeroSuppression),
291 fSampleRate(o.fSampleRate),
292 fPedestal(o.fPedestal),
293 fPulseGain(o.fPulseGain),
294 fDeadMap(o.fDeadMap),
295 fAltroMap(o.fAltroMap),
296 fStripRange(o.fStripRange)
298 /** Assignement operator
299 @return Reference to this */
300 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
302 virtual ~AliFMDParameters() {}
303 /** Singleton instance */
304 static AliFMDParameters* fgInstance; // Static singleton instance
305 /** Initialize gains. Try to get them from CDB */
306 void InitPulseGain();
307 /** Initialize pedestals. Try to get them from CDB */
309 /** Initialize dead map. Try to get it from CDB */
311 /** Initialize sample rates. Try to get them from CDB */
312 void InitSampleRate();
313 /** Initialize zero suppression thresholds. Try to get them from CDB */
314 void InitZeroSuppression();
315 /** Initialize hardware map. Try to get it from CDB */
317 /** Initialize strip range. Try to get it from CDB */
318 void InitStripRange();
320 Bool_t fIsInit; // Whether we've been initialised
322 static const char* fgkPulseGain; // Path to PulseGain calib object
323 static const char* fgkPedestal; // Path to Pedestal calib object
324 static const char* fgkDead; // Path to Dead calib object
325 static const char* fgkSampleRate; // Path to SampleRate calib object
326 static const char* fgkAltroMap; // Path to AltroMap calib object
327 static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
328 static const char* fgkStripRange; // Path to strip range cal object
329 const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon
330 UShort_t fVA1MipRange; // # MIPs the pre-amp can do
331 UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch.
332 UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan.
333 Float_t fPedestalFactor; // Number of pedestal widths
335 Float_t fFixedPedestal; // Pedestal to subtract
336 Float_t fFixedPedestalWidth; // Width of pedestal
337 UShort_t fFixedZeroSuppression; // Threshold for zero-suppression
338 UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp.
339 Float_t fFixedThreshold; // Threshold in ADC counts
340 UShort_t fFixedMinStrip; // Minimum strip read-out
341 UShort_t fFixedMaxStrip; // Maximum strip read-out
342 mutable Float_t fFixedPulseGain; //! Gain (cached)
343 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
345 AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
346 AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
347 AliFMDCalibPedestal* fPedestal; // Pedestals
348 AliFMDCalibGain* fPulseGain; // Pulser gain
349 AliFMDCalibDeadMap* fDeadMap; // Pulser gain
350 AliFMDAltroMapping* fAltroMap; // Map of hardware
351 AliFMDCalibStripRange* fStripRange; // Strip range
353 ClassDef(AliFMDParameters,5) // Manager of parameters
357 //____________________________________________________________________