]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDParameters.h
Updated alignment macros and related changes (Raffaele)
[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 */
a9579262 85 void Init(Bool_t forceReInit=kFALSE);
c2fc1258 86 /** Print all parameters.
87 @param option Option string */
88 void Print(Option_t* option="A") const;
6169f936 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");
1a1fdef7 103
9f662337 104 /** @{ */
105 /** @name Set various `Fixed' parameters */
c2fc1258 106 /** @param r How many MIP signals we can fit in the VA1
107 pre-amps. (default and design is 20) */
8f6ee336 108 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
c2fc1258 109 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
110 ADC so, the maximum number is 1024 */
8f6ee336 111 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
c2fc1258 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. */
8f6ee336 115 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
c2fc1258 116 /** @param f Factor to use for accepting a signal. */
8f6ee336 117 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
9f662337 118 /** @} */
8f6ee336 119
9f662337 120 /** @{ */
121 /** @name Set various variable parameter defaults */
c2fc1258 122 /** @param s Zero suppression threshold in ADC counts */
8f6ee336 123 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
c2fc1258 124 /** @param r How many times we oversample each strip. */
8f6ee336 125 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = (r>2?2:r);}
c2fc1258 126 /** @param p Pedestal value in ADC counts */
8f6ee336 127 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
c2fc1258 128 /** @param w Pedestal width in ADC counts */
8f6ee336 129 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
c2fc1258 130 /** @param t Threshold used for 1 MIP acceptance. */
8f6ee336 131 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
c2fc1258 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);
9f662337 136 /** @} */
1a1fdef7 137
9f662337 138 /** @{ */
139 /** @name Get `Fixed' various parameters */
c2fc1258 140 /** @return Number of MIP signals that fit inside a VA1 channel */
1a1fdef7 141 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
c2fc1258 142 /** @return The maximum count in the ADC */
1a1fdef7 143 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
c2fc1258 144 /** @return Number of strips muliplexed into one ADC channel */
1a1fdef7 145 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
c2fc1258 146 /** @return The average energy deposited by one MIP */
1a1fdef7 147 Float_t GetEdepMip() const;
c2fc1258 148 /** @return The factor used of signal acceptance */
1a1fdef7 149 Float_t GetPedestalFactor() const { return fPedestalFactor; }
9f662337 150 /** @} */
1a1fdef7 151
9f662337 152 /** @{ */
153 /** @name Get variable parameters */
c2fc1258 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. */
8f6ee336 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;
c2fc1258 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. */
8f6ee336 172 Float_t GetPulseGain(UShort_t detector,
173 Char_t ring,
174 UShort_t sector,
175 UShort_t strip) const;
c2fc1258 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 */
8f6ee336 182 Float_t GetPedestal(UShort_t detector,
183 Char_t ring,
184 UShort_t sector,
185 UShort_t strip) const;
c2fc1258 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 */
8f6ee336 192 Float_t GetPedestalWidth(UShort_t detector,
193 Char_t ring,
194 UShort_t sector,
195 UShort_t strip) const;
c2fc1258 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) */
8f6ee336 202 UShort_t GetZeroSuppression(UShort_t detector,
203 Char_t ring,
204 UShort_t sector,
205 UShort_t strip) const;
c2fc1258 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. */
bf000c32 244 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
245 Char_t& ring, UShort_t& sec, UShort_t& str) const;
c2fc1258 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. */
bf000c32 254 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
255 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
c2fc1258 256 /** Get the map that translates hardware to detector coordinates
257 @return Get the map that translates hardware to detector
258 coordinates */
57c3c593 259 AliFMDAltroMapping* GetAltroMap() const;
9f662337 260 /** @} */
261
02a27b50 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; }
497e0e62 269protected:
9f662337 270 /** CTOR */
497e0e62 271 AliFMDParameters();
02a27b50 272 /** CTOR */
273 AliFMDParameters(const AliFMDParameters& o)
b5ee4425 274 : TNamed(o),
275 fIsInit(o.fIsInit),
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)
297 {}
02a27b50 298 /** Assignement operator
299 @return Reference to this */
300 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
9f662337 301 /** DTOR */
497e0e62 302 virtual ~AliFMDParameters() {}
9f662337 303 /** Singleton instance */
497e0e62 304 static AliFMDParameters* fgInstance; // Static singleton instance
9f662337 305 /** Initialize gains. Try to get them from CDB */
1e8f773e 306 void InitPulseGain();
9f662337 307 /** Initialize pedestals. Try to get them from CDB */
1e8f773e 308 void InitPedestal();
9f662337 309 /** Initialize dead map. Try to get it from CDB */
1e8f773e 310 void InitDeadMap();
9f662337 311 /** Initialize sample rates. Try to get them from CDB */
1e8f773e 312 void InitSampleRate();
9f662337 313 /** Initialize zero suppression thresholds. Try to get them from CDB */
1e8f773e 314 void InitZeroSuppression();
9f662337 315 /** Initialize hardware map. Try to get it from CDB */
1e8f773e 316 void InitAltroMap();
c2fc1258 317 /** Initialize strip range. Try to get it from CDB */
318 void InitStripRange();
57c3c593 319
320 Bool_t fIsInit; // Whether we've been initialised
321
02a27b50 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
8f6ee336 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
1a1fdef7 334
8f6ee336 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.
02a27b50 339 Float_t fFixedThreshold; // Threshold in ADC counts
340 UShort_t fFixedMinStrip; // Minimum strip read-out
341 UShort_t fFixedMaxStrip; // Maximum strip read-out
8f6ee336 342 mutable Float_t fFixedPulseGain; //! Gain (cached)
343 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
344
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
57c3c593 350 AliFMDAltroMapping* fAltroMap; // Map of hardware
c2fc1258 351 AliFMDCalibStripRange* fStripRange; // Strip range
8f6ee336 352
02a27b50 353 ClassDef(AliFMDParameters,5) // Manager of parameters
1a1fdef7 354};
355
356#endif
357//____________________________________________________________________
358//
359// Local Variables:
360// mode: C++
361// End:
362//
363// EOF
364//
365