]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDParameters.h
Update (I/II)
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.h
CommitLineData
1a1fdef7 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 */
1a1fdef7 10//____________________________________________________________________
11//
12// Singleton class to handle various parameters (not geometry) of the
13// FMD
088f8e79 14// Should get ata fromm Conditions DB.
1a1fdef7 15//
02a27b50 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*/
1a1fdef7 21#ifndef ROOT_TNamed
22# include <TNamed.h>
23#endif
8f6ee336 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;
c2fc1258 38class AliFMDCalibStripRange;
57c3c593 39class AliFMDAltroMapping;
02a27b50 40//____________________________________________________________________
41//
42// Singleton class to handle various parameters (not geometry) of the
43// FMD
44// Should get ata fromm Conditions DB.
45//
1a1fdef7 46
c2fc1258 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.
9f662337 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*/
1a1fdef7 75class AliFMDParameters : public TNamed
76{
77public:
f6449cc0 78 /** Enumeration of things to initialize */
79 enum What {
80 /** Pulser gain */
81 kPulseGain = 0x1, // Pulser gain
82 /** Pedestals and noise */
83 kPedestal = 0x2, // Pedestal and noise
84 /** Dead channel map */
85 kDeadMap = 0x4, // Dead channel map
86 /** Over sampling rate */
87 kSampleRate = 0x8, // Over sampling rate
88 /** Zero suppression parameters */
89 kZeroSuppression = 0x10, // Zero suppression parameters
90 /** ALTRO data map */
91 kAltroMap = 0x20 // Altro channel map
92 };
93
9f662337 94 /** Singleton access
95 @return single to */
1a1fdef7 96 static AliFMDParameters* Instance();
57c3c593 97
9f662337 98 /** Initialize the manager. This tries to read the parameters from
99 CDB. If that fails, the class uses the hard-coded parameters.
100 */
f6449cc0 101 void Init(Bool_t forceReInit=kFALSE,
102 UInt_t what = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
103 kZeroSuppression|kAltroMap));
c2fc1258 104 /** Print all parameters.
105 @param option Option string */
106 void Print(Option_t* option="A") const;
6169f936 107 /** Draw parameters.
108 @param option What to draw. Should be one of
109 - dead Dead channels
110 - threshold Threshold
111 - gain Gain
112 - pedestal Pedestal
113 - noise Noise (or pedestal width)
114 - zero Zero suppression
115 - rate Sampling rate (VA1 clock / ALTRO clock)
116 - min Minimum strip read out
117 - max Maximum strip read out
118 - map hardware address
119 */
120 void Draw(Option_t* option="pedestal");
1a1fdef7 121
9f662337 122 /** @{ */
123 /** @name Set various `Fixed' parameters */
c2fc1258 124 /** @param r How many MIP signals we can fit in the VA1
125 pre-amps. (default and design is 20) */
8f6ee336 126 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
c2fc1258 127 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
128 ADC so, the maximum number is 1024 */
8f6ee336 129 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
c2fc1258 130 /** @param size The number of strips multiplexed into one ALTRO
131 channel. That is, how many strips is connected to one VA1
132 pre-amp. */
8f6ee336 133 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
c2fc1258 134 /** @param f Factor to use for accepting a signal. */
8f6ee336 135 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
9f662337 136 /** @} */
8f6ee336 137
9f662337 138 /** @{ */
139 /** @name Set various variable parameter defaults */
c2fc1258 140 /** @param s Zero suppression threshold in ADC counts */
8f6ee336 141 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
c2fc1258 142 /** @param r How many times we oversample each strip. */
8f6ee336 143 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);}
c2fc1258 144 /** @param p Pedestal value in ADC counts */
8f6ee336 145 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
c2fc1258 146 /** @param w Pedestal width in ADC counts */
8f6ee336 147 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
c2fc1258 148 /** @param t Threshold used for 1 MIP acceptance. */
8f6ee336 149 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
c2fc1258 150 /** Range of strips read out
151 @param min Minimum strip number (0-127).
152 @param max Maximum strip number (0-127). */
153 void SetStripRange(UShort_t min=0, UShort_t max=127);
9f662337 154 /** @} */
1a1fdef7 155
9f662337 156 /** @{ */
157 /** @name Get `Fixed' various parameters */
c2fc1258 158 /** @return Number of MIP signals that fit inside a VA1 channel */
1a1fdef7 159 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
c2fc1258 160 /** @return The maximum count in the ADC */
1a1fdef7 161 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
c2fc1258 162 /** @return Number of strips muliplexed into one ADC channel */
1a1fdef7 163 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
c2fc1258 164 /** @return The average energy deposited by one MIP */
1a1fdef7 165 Float_t GetEdepMip() const;
c2fc1258 166 /** @return The factor used of signal acceptance */
1a1fdef7 167 Float_t GetPedestalFactor() const { return fPedestalFactor; }
9f662337 168 /** @} */
1a1fdef7 169
9f662337 170 /** @{ */
171 /** @name Get variable parameters */
c2fc1258 172 /** Whether the strip is considered dead
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 @c true if the strip is considered dead, @c false if
178 it's OK. */
8f6ee336 179 Bool_t IsDead(UShort_t detector,
180 Char_t ring,
181 UShort_t sector,
182 UShort_t strip) const;
183 Float_t GetThreshold() const;
c2fc1258 184 /** Gain of pre-amp.
185 @param detector Detector # (1-3)
186 @param ring Ring ID ('I' or 'O')
187 @param sector Sector number (0-39)
188 @param strip Strip number (0-511)
189 @return Gain of pre-amp. */
8f6ee336 190 Float_t GetPulseGain(UShort_t detector,
191 Char_t ring,
192 UShort_t sector,
193 UShort_t strip) const;
c2fc1258 194 /** Get mean of pedestal
195 @param detector Detector # (1-3)
196 @param ring Ring ID ('I' or 'O')
197 @param sector Sector number (0-39)
198 @param strip Strip number (0-511)
199 @return Mean of pedestal */
8f6ee336 200 Float_t GetPedestal(UShort_t detector,
201 Char_t ring,
202 UShort_t sector,
203 UShort_t strip) const;
c2fc1258 204 /** Width of pedestal
205 @param detector Detector # (1-3)
206 @param ring Ring ID ('I' or 'O')
207 @param sector Sector number (0-39)
208 @param strip Strip number (0-511)
209 @return Width of pedestal */
8f6ee336 210 Float_t GetPedestalWidth(UShort_t detector,
211 Char_t ring,
212 UShort_t sector,
213 UShort_t strip) const;
c2fc1258 214 /** zero suppression threshold (in ADC counts)
215 @param detector Detector # (1-3)
216 @param ring Ring ID ('I' or 'O')
217 @param sector Sector number (0-39)
218 @param strip Strip number (0-511)
219 @return zero suppression threshold (in ADC counts) */
8f6ee336 220 UShort_t GetZeroSuppression(UShort_t detector,
221 Char_t ring,
222 UShort_t sector,
223 UShort_t strip) const;
c2fc1258 224 /** Get the sampling rate
225 @param detector Detector # (1-3)
226 @param ring Ring ID ('I' or 'O')
227 @param sector Sector number (0-39)
228 @param strip Strip number (0-511)
229 @return The sampling rate */
230 UShort_t GetSampleRate(UShort_t detector,
231 Char_t ring,
232 UShort_t sector,
233 UShort_t strip) const;
234 /** Get the minimum strip in the read-out range
235 @param detector Detector # (1-3)
236 @param ring Ring ID ('I' or 'O')
237 @param sector Sector number (0-39)
238 @param strip Strip number (0-511)
239 @return Minimum strip */
240 UShort_t GetMinStrip(UShort_t detector,
241 Char_t ring,
242 UShort_t sector,
243 UShort_t strip) const;
244 /** Get the maximum strip in the read-out range
245 @param detector Detector # (1-3)
246 @param ring Ring ID ('I' or 'O')
247 @param sector Sector number (0-39)
248 @param strip Strip number (0-511)
249 @return Maximum strip */
250 UShort_t GetMaxStrip(UShort_t detector,
251 Char_t ring,
252 UShort_t sector,
253 UShort_t strip) const;
f6449cc0 254 /** Translate hardware address to detector coordinates
255 @param ddl DDL number
256 @param board Board address
257 @param chip Chip #
258 @param channel Channel #
259 @param det On return, Detector # (1-3)
260 @param ring On return, Ring ID ('I' or 'O')
261 @param sec On return, Sector number (0-39)
262 @param str On return, Strip number (0-511)
263 @return @c true on success. */
264 Bool_t Hardware2Detector(UInt_t ddl, UInt_t board,
265 UInt_t chip, UInt_t channel,
266 UShort_t& det, Char_t& ring,
267 UShort_t& sec, UShort_t& str) const;
c2fc1258 268 /** Translate hardware address to detector coordinates
269 @param ddl DDL number
270 @param addr Hardware address
271 @param det On return, Detector # (1-3)
272 @param ring On return, Ring ID ('I' or 'O')
273 @param sec On return, Sector number (0-39)
274 @param str On return, Strip number (0-511)
275 @return @c true on success. */
bf000c32 276 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
277 Char_t& ring, UShort_t& sec, UShort_t& str) const;
f6449cc0 278
279 /** Translate detector coordinates to hardware address
280 @param det Detector # (1-3)
281 @param ring Ring ID ('I' or 'O')
282 @param sec Sector number (0-39)
283 @param str Strip number (0-511)
284 @param ddl On return, DDL number
285 @param board On return, Board address
286 @param chip On return, Chip #
287 @param channel On return, Channel #
288 @return @c true on success. */
289 Bool_t Detector2Hardware(UShort_t det, Char_t ring,
290 UShort_t sec, UShort_t str,
291 UInt_t& ddl, UInt_t& board,
292 UInt_t& chip, UInt_t& channel) const;
c2fc1258 293 /** Translate detector coordinates to hardware address
294 @param det Detector # (1-3)
295 @param ring Ring ID ('I' or 'O')
296 @param sec Sector number (0-39)
297 @param str Strip number (0-511)
298 @param ddl On return, DDL number
299 @param addr On return, Hardware address
300 @return @c true on success. */
bf000c32 301 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
302 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
c2fc1258 303 /** Get the map that translates hardware to detector coordinates
304 @return Get the map that translates hardware to detector
305 coordinates */
57c3c593 306 AliFMDAltroMapping* GetAltroMap() const;
9f662337 307 /** @} */
308
02a27b50 309 static const char* PulseGainPath() { return fgkPulseGain; }
310 static const char* PedestalPath() { return fgkPedestal; }
311 static const char* DeadPath() { return fgkDead; }
312 static const char* SampleRatePath() { return fgkSampleRate; }
313 static const char* AltroMapPath() { return fgkAltroMap; }
314 static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
315 static const char* StripRangePath() { return fgkStripRange; }
497e0e62 316protected:
9f662337 317 /** CTOR */
497e0e62 318 AliFMDParameters();
02a27b50 319 /** CTOR */
320 AliFMDParameters(const AliFMDParameters& o)
b5ee4425 321 : TNamed(o),
322 fIsInit(o.fIsInit),
323 fkSiDeDxMip(o.fkSiDeDxMip),
324 fVA1MipRange(o.fVA1MipRange),
325 fAltroChannelSize(o.fAltroChannelSize),
326 fChannelsPerAltro(o.fChannelsPerAltro),
327 fPedestalFactor(o.fPedestalFactor),
328 fFixedPedestal(o.fFixedPedestal),
329 fFixedPedestalWidth(o.fFixedPedestalWidth),
330 fFixedZeroSuppression(o.fFixedZeroSuppression),
331 fFixedSampleRate(o.fFixedSampleRate),
332 fFixedThreshold(o.fFixedThreshold),
333 fFixedMinStrip(o.fFixedMinStrip),
334 fFixedMaxStrip(o.fFixedMaxStrip),
335 fFixedPulseGain(o.fFixedPulseGain),
336 fEdepMip(o.fEdepMip),
337 fZeroSuppression(o.fZeroSuppression),
338 fSampleRate(o.fSampleRate),
339 fPedestal(o.fPedestal),
340 fPulseGain(o.fPulseGain),
341 fDeadMap(o.fDeadMap),
342 fAltroMap(o.fAltroMap),
343 fStripRange(o.fStripRange)
344 {}
02a27b50 345 /** Assignement operator
346 @return Reference to this */
347 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
9f662337 348 /** DTOR */
497e0e62 349 virtual ~AliFMDParameters() {}
9f662337 350 /** Singleton instance */
497e0e62 351 static AliFMDParameters* fgInstance; // Static singleton instance
9f662337 352 /** Initialize gains. Try to get them from CDB */
1e8f773e 353 void InitPulseGain();
9f662337 354 /** Initialize pedestals. Try to get them from CDB */
1e8f773e 355 void InitPedestal();
9f662337 356 /** Initialize dead map. Try to get it from CDB */
1e8f773e 357 void InitDeadMap();
9f662337 358 /** Initialize sample rates. Try to get them from CDB */
1e8f773e 359 void InitSampleRate();
9f662337 360 /** Initialize zero suppression thresholds. Try to get them from CDB */
1e8f773e 361 void InitZeroSuppression();
9f662337 362 /** Initialize hardware map. Try to get it from CDB */
1e8f773e 363 void InitAltroMap();
c2fc1258 364 /** Initialize strip range. Try to get it from CDB */
365 void InitStripRange();
57c3c593 366
367 Bool_t fIsInit; // Whether we've been initialised
368
02a27b50 369 static const char* fgkPulseGain; // Path to PulseGain calib object
370 static const char* fgkPedestal; // Path to Pedestal calib object
371 static const char* fgkDead; // Path to Dead calib object
372 static const char* fgkSampleRate; // Path to SampleRate calib object
373 static const char* fgkAltroMap; // Path to AltroMap calib object
374 static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
375 static const char* fgkStripRange; // Path to strip range cal object
376 const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon
8f6ee336 377 UShort_t fVA1MipRange; // # MIPs the pre-amp can do
378 UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch.
379 UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan.
380 Float_t fPedestalFactor; // Number of pedestal widths
1a1fdef7 381
8f6ee336 382 Float_t fFixedPedestal; // Pedestal to subtract
383 Float_t fFixedPedestalWidth; // Width of pedestal
384 UShort_t fFixedZeroSuppression; // Threshold for zero-suppression
385 UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp.
02a27b50 386 Float_t fFixedThreshold; // Threshold in ADC counts
387 UShort_t fFixedMinStrip; // Minimum strip read-out
388 UShort_t fFixedMaxStrip; // Maximum strip read-out
8f6ee336 389 mutable Float_t fFixedPulseGain; //! Gain (cached)
390 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
391
392 AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
393 AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
394 AliFMDCalibPedestal* fPedestal; // Pedestals
395 AliFMDCalibGain* fPulseGain; // Pulser gain
396 AliFMDCalibDeadMap* fDeadMap; // Pulser gain
57c3c593 397 AliFMDAltroMapping* fAltroMap; // Map of hardware
c2fc1258 398 AliFMDCalibStripRange* fStripRange; // Strip range
8f6ee336 399
02a27b50 400 ClassDef(AliFMDParameters,5) // Manager of parameters
1a1fdef7 401};
402
403#endif
404//____________________________________________________________________
405//
406// Local Variables:
407// mode: C++
408// End:
409//
410// EOF
411//
412