]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDParameters.h
Moving the destructor to the implementation 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 */
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:
9f662337 78 /** Singleton access
79 @return single to */
1a1fdef7 80 static AliFMDParameters* Instance();
57c3c593 81
9f662337 82 /** Initialize the manager. This tries to read the parameters from
83 CDB. If that fails, the class uses the hard-coded parameters.
84 */
57c3c593 85 void Init();
c2fc1258 86 /** Print all parameters.
87 @param option Option string */
88 void Print(Option_t* option="A") const;
1a1fdef7 89
9f662337 90 /** @{ */
91 /** @name Set various `Fixed' parameters */
c2fc1258 92 /** @param r How many MIP signals we can fit in the VA1
93 pre-amps. (default and design is 20) */
8f6ee336 94 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
c2fc1258 95 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
96 ADC so, the maximum number is 1024 */
8f6ee336 97 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
c2fc1258 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. */
8f6ee336 101 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
c2fc1258 102 /** @param f Factor to use for accepting a signal. */
8f6ee336 103 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
9f662337 104 /** @} */
8f6ee336 105
9f662337 106 /** @{ */
107 /** @name Set various variable parameter defaults */
c2fc1258 108 /** @param s Zero suppression threshold in ADC counts */
8f6ee336 109 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
c2fc1258 110 /** @param r How many times we oversample each strip. */
8f6ee336 111 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);}
c2fc1258 112 /** @param p Pedestal value in ADC counts */
8f6ee336 113 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
c2fc1258 114 /** @param w Pedestal width in ADC counts */
8f6ee336 115 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
c2fc1258 116 /** @param t Threshold used for 1 MIP acceptance. */
8f6ee336 117 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
c2fc1258 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);
9f662337 122 /** @} */
1a1fdef7 123
9f662337 124 /** @{ */
125 /** @name Get `Fixed' various parameters */
c2fc1258 126 /** @return Number of MIP signals that fit inside a VA1 channel */
1a1fdef7 127 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
c2fc1258 128 /** @return The maximum count in the ADC */
1a1fdef7 129 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
c2fc1258 130 /** @return Number of strips muliplexed into one ADC channel */
1a1fdef7 131 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
c2fc1258 132 /** @return The average energy deposited by one MIP */
1a1fdef7 133 Float_t GetEdepMip() const;
c2fc1258 134 /** @return The factor used of signal acceptance */
1a1fdef7 135 Float_t GetPedestalFactor() const { return fPedestalFactor; }
9f662337 136 /** @} */
1a1fdef7 137
9f662337 138 /** @{ */
139 /** @name Get variable parameters */
c2fc1258 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. */
8f6ee336 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;
c2fc1258 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. */
8f6ee336 158 Float_t GetPulseGain(UShort_t detector,
159 Char_t ring,
160 UShort_t sector,
161 UShort_t strip) const;
c2fc1258 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 */
8f6ee336 168 Float_t GetPedestal(UShort_t detector,
169 Char_t ring,
170 UShort_t sector,
171 UShort_t strip) const;
c2fc1258 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 */
8f6ee336 178 Float_t GetPedestalWidth(UShort_t detector,
179 Char_t ring,
180 UShort_t sector,
181 UShort_t strip) const;
c2fc1258 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) */
8f6ee336 188 UShort_t GetZeroSuppression(UShort_t detector,
189 Char_t ring,
190 UShort_t sector,
191 UShort_t strip) const;
c2fc1258 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. */
bf000c32 230 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
231 Char_t& ring, UShort_t& sec, UShort_t& str) const;
c2fc1258 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. */
bf000c32 240 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
241 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
c2fc1258 242 /** Get the map that translates hardware to detector coordinates
243 @return Get the map that translates hardware to detector
244 coordinates */
57c3c593 245 AliFMDAltroMapping* GetAltroMap() const;
9f662337 246 /** @} */
247
1a1fdef7 248 enum {
249 kBaseDDL = 0x1000 // DDL offset for the FMD
250 };
02a27b50 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; }
497e0e62 258protected:
9f662337 259 /** CTOR */
497e0e62 260 AliFMDParameters();
02a27b50 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; }
9f662337 267 /** DTOR */
497e0e62 268 virtual ~AliFMDParameters() {}
9f662337 269 /** Singleton instance */
497e0e62 270 static AliFMDParameters* fgInstance; // Static singleton instance
9f662337 271 /** Initialize gains. Try to get them from CDB */
1e8f773e 272 void InitPulseGain();
9f662337 273 /** Initialize pedestals. Try to get them from CDB */
1e8f773e 274 void InitPedestal();
9f662337 275 /** Initialize dead map. Try to get it from CDB */
1e8f773e 276 void InitDeadMap();
9f662337 277 /** Initialize sample rates. Try to get them from CDB */
1e8f773e 278 void InitSampleRate();
9f662337 279 /** Initialize zero suppression thresholds. Try to get them from CDB */
1e8f773e 280 void InitZeroSuppression();
9f662337 281 /** Initialize hardware map. Try to get it from CDB */
1e8f773e 282 void InitAltroMap();
c2fc1258 283 /** Initialize strip range. Try to get it from CDB */
284 void InitStripRange();
57c3c593 285
286 Bool_t fIsInit; // Whether we've been initialised
287
02a27b50 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
8f6ee336 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
1a1fdef7 300
8f6ee336 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.
02a27b50 305 Float_t fFixedThreshold; // Threshold in ADC counts
306 UShort_t fFixedMinStrip; // Minimum strip read-out
307 UShort_t fFixedMaxStrip; // Maximum strip read-out
8f6ee336 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
57c3c593 316 AliFMDAltroMapping* fAltroMap; // Map of hardware
c2fc1258 317 AliFMDCalibStripRange* fStripRange; // Strip range
8f6ee336 318
02a27b50 319 ClassDef(AliFMDParameters,5) // Manager of parameters
1a1fdef7 320};
321
322#endif
323//____________________________________________________________________
324//
325// Local Variables:
326// mode: C++
327// End:
328//
329// EOF
330//
331