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