]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDParameters.h
Adding the new AliRawReaderChain to the Create() mactory method. The URI syntax is...
[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;
dc02d468 40class AliCDBEntry;
41class AliFMDPreprocessor;
42
02a27b50 43//____________________________________________________________________
44//
45// Singleton class to handle various parameters (not geometry) of the
46// FMD
47// Should get ata fromm Conditions DB.
48//
1a1fdef7 49
c2fc1258 50/** @brief This class is a singleton that handles various parameters
51 of the FMD detectors.
52 This class reads from the Conditions DB to get the various
53 parameters, which code can then request from here. In that way,
54 all code uses the same data, and the interface is consistent.
9f662337 55
56 Some of the parameter managed are
57 - @c fPedestal, @c fPedestalWidth
58 Mean and width of the pedestal. The pedestal is simulated
59 by a Guassian, but derived classes my override MakePedestal
60 to simulate it differently (or pick it up from a database).
61 - @c fVA1MipRange
62 The dymamic MIP range of the VA1_ALICE pre-amplifier chip
63 - @c fAltroChannelSize
64 The largest number plus one that can be stored in one
65 channel in one time step in the ALTRO ADC chip.
66 - @c fSampleRate
67 How many times the ALTRO ADC chip samples the VA1_ALICE
68 pre-amplifier signal. The VA1_ALICE chip is read-out at
69 10MHz, while it's possible to drive the ALTRO chip at
70 25MHz. That means, that the ALTRO chip can have time to
71 sample each VA1_ALICE signal up to 2 times. Although it's
72 not certain this feature will be used in the production,
73 we'd like have the option, and so it should be reflected in
74 the code.
75
76 @ingroup FMD_base
77*/
1a1fdef7 78class AliFMDParameters : public TNamed
79{
80public:
f6449cc0 81 /** Enumeration of things to initialize */
82 enum What {
83 /** Pulser gain */
84 kPulseGain = 0x1, // Pulser gain
85 /** Pedestals and noise */
86 kPedestal = 0x2, // Pedestal and noise
87 /** Dead channel map */
88 kDeadMap = 0x4, // Dead channel map
89 /** Over sampling rate */
90 kSampleRate = 0x8, // Over sampling rate
91 /** Zero suppression parameters */
92 kZeroSuppression = 0x10, // Zero suppression parameters
93 /** ALTRO data map */
6bf06d81 94 kAltroMap = 0x20, // Altro channel map
95 /** Strip Range */
96 kStripRange = 0x40 //Strip range
97
f6449cc0 98 };
99
9f662337 100 /** Singleton access
101 @return single to */
1a1fdef7 102 static AliFMDParameters* Instance();
57c3c593 103
9f662337 104 /** Initialize the manager. This tries to read the parameters from
105 CDB. If that fails, the class uses the hard-coded parameters.
106 */
f6449cc0 107 void Init(Bool_t forceReInit=kFALSE,
108 UInt_t what = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
6bf06d81 109 kZeroSuppression|kAltroMap|kStripRange));
dc02d468 110 /** Initialize the manager. This tries to read the parameters from
111 CDB. If that fails, the class uses the hard-coded parameters.
112 */
113 void Init(AliFMDPreprocessor* pp,
114 Bool_t forceReInit=kFALSE,
115 UInt_t what = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
116 kZeroSuppression|kAltroMap));
c2fc1258 117 /** Print all parameters.
118 @param option Option string */
119 void Print(Option_t* option="A") const;
6169f936 120 /** Draw parameters.
121 @param option What to draw. Should be one of
122 - dead Dead channels
123 - threshold Threshold
124 - gain Gain
125 - pedestal Pedestal
126 - noise Noise (or pedestal width)
127 - zero Zero suppression
128 - rate Sampling rate (VA1 clock / ALTRO clock)
129 - min Minimum strip read out
130 - max Maximum strip read out
131 - map hardware address
132 */
133 void Draw(Option_t* option="pedestal");
1a1fdef7 134
9f662337 135 /** @{ */
136 /** @name Set various `Fixed' parameters */
c2fc1258 137 /** @param r How many MIP signals we can fit in the VA1
138 pre-amps. (default and design is 20) */
8f6ee336 139 void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; }
c2fc1258 140 /** @param s Maximum number of the ADC (ALTRO). This is a 10 bit
141 ADC so, the maximum number is 1024 */
8f6ee336 142 void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;}
c2fc1258 143 /** @param size The number of strips multiplexed into one ALTRO
144 channel. That is, how many strips is connected to one VA1
145 pre-amp. */
8f6ee336 146 void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
c2fc1258 147 /** @param f Factor to use for accepting a signal. */
8f6ee336 148 void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; }
9f662337 149 /** @} */
8f6ee336 150
9f662337 151 /** @{ */
152 /** @name Set various variable parameter defaults */
c2fc1258 153 /** @param s Zero suppression threshold in ADC counts */
8f6ee336 154 void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; }
c2fc1258 155 /** @param r How many times we oversample each strip. */
f743c846 156 void SetSampleRate(UShort_t r=1) { fFixedSampleRate = r ;}//(r>2?2:r);}
6acbd49f 157 void SetSampleRate(AliFMDCalibSampleRate* r) { fSampleRate = r; }
c2fc1258 158 /** @param p Pedestal value in ADC counts */
8f6ee336 159 void SetPedestal(Float_t p=10) { fFixedPedestal = p; }
c2fc1258 160 /** @param w Pedestal width in ADC counts */
8f6ee336 161 void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; }
c2fc1258 162 /** @param t Threshold used for 1 MIP acceptance. */
8f6ee336 163 void SetThreshold(Float_t t=0) { fFixedThreshold = t; }
c2fc1258 164 /** Range of strips read out
165 @param min Minimum strip number (0-127).
166 @param max Maximum strip number (0-127). */
167 void SetStripRange(UShort_t min=0, UShort_t max=127);
433a88bd 168 void SetStripRange(AliFMDCalibStripRange* r) { fStripRange = r; }
625d7886 169 /** Whether raw data has full common data header (8 32bit words) or
170 the older invalid format (7 32bit words with bogus entries)
171 @param yes if true the raw data has complete data header */
172 void UseCompleteHeader(Bool_t yes=kTRUE) { fHasCompleteHeader = yes; }
9f662337 173 /** @} */
1a1fdef7 174
9f662337 175 /** @{ */
176 /** @name Get `Fixed' various parameters */
c2fc1258 177 /** @return Number of MIP signals that fit inside a VA1 channel */
1a1fdef7 178 UShort_t GetVA1MipRange() const { return fVA1MipRange; }
c2fc1258 179 /** @return The maximum count in the ADC */
1a1fdef7 180 UShort_t GetAltroChannelSize() const { return fAltroChannelSize; }
c2fc1258 181 /** @return Number of strips muliplexed into one ADC channel */
1a1fdef7 182 UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; }
c2fc1258 183 /** @return The average energy deposited by one MIP */
1a1fdef7 184 Float_t GetEdepMip() const;
c2fc1258 185 /** @return The factor used of signal acceptance */
1a1fdef7 186 Float_t GetPedestalFactor() const { return fPedestalFactor; }
9f662337 187 /** @} */
1a1fdef7 188
9f662337 189 /** @{ */
190 /** @name Get variable parameters */
c2fc1258 191 /** Whether the strip is considered dead
192 @param detector Detector # (1-3)
193 @param ring Ring ID ('I' or 'O')
194 @param sector Sector number (0-39)
195 @param strip Strip number (0-511)
196 @return @c true if the strip is considered dead, @c false if
197 it's OK. */
8f6ee336 198 Bool_t IsDead(UShort_t detector,
199 Char_t ring,
200 UShort_t sector,
201 UShort_t strip) const;
202 Float_t GetThreshold() const;
c2fc1258 203 /** Gain of pre-amp.
204 @param detector Detector # (1-3)
205 @param ring Ring ID ('I' or 'O')
206 @param sector Sector number (0-39)
207 @param strip Strip number (0-511)
208 @return Gain of pre-amp. */
8f6ee336 209 Float_t GetPulseGain(UShort_t detector,
210 Char_t ring,
211 UShort_t sector,
212 UShort_t strip) const;
c2fc1258 213 /** Get mean of pedestal
214 @param detector Detector # (1-3)
215 @param ring Ring ID ('I' or 'O')
216 @param sector Sector number (0-39)
217 @param strip Strip number (0-511)
218 @return Mean of pedestal */
8f6ee336 219 Float_t GetPedestal(UShort_t detector,
220 Char_t ring,
221 UShort_t sector,
222 UShort_t strip) const;
c2fc1258 223 /** Width of pedestal
224 @param detector Detector # (1-3)
225 @param ring Ring ID ('I' or 'O')
226 @param sector Sector number (0-39)
227 @param strip Strip number (0-511)
228 @return Width of pedestal */
8f6ee336 229 Float_t GetPedestalWidth(UShort_t detector,
230 Char_t ring,
231 UShort_t sector,
232 UShort_t strip) const;
c2fc1258 233 /** zero suppression threshold (in ADC counts)
234 @param detector Detector # (1-3)
235 @param ring Ring ID ('I' or 'O')
236 @param sector Sector number (0-39)
237 @param strip Strip number (0-511)
238 @return zero suppression threshold (in ADC counts) */
8f6ee336 239 UShort_t GetZeroSuppression(UShort_t detector,
240 Char_t ring,
241 UShort_t sector,
242 UShort_t strip) const;
c2fc1258 243 /** Get the sampling rate
244 @param detector Detector # (1-3)
245 @param ring Ring ID ('I' or 'O')
246 @param sector Sector number (0-39)
247 @param strip Strip number (0-511)
248 @return The sampling rate */
249 UShort_t GetSampleRate(UShort_t detector,
250 Char_t ring,
251 UShort_t sector,
252 UShort_t strip) const;
253 /** Get the minimum strip in the read-out range
254 @param detector Detector # (1-3)
255 @param ring Ring ID ('I' or 'O')
256 @param sector Sector number (0-39)
257 @param strip Strip number (0-511)
258 @return Minimum strip */
259 UShort_t GetMinStrip(UShort_t detector,
260 Char_t ring,
261 UShort_t sector,
262 UShort_t strip) const;
263 /** Get the maximum strip in the read-out range
264 @param detector Detector # (1-3)
265 @param ring Ring ID ('I' or 'O')
266 @param sector Sector number (0-39)
267 @param strip Strip number (0-511)
268 @return Maximum strip */
269 UShort_t GetMaxStrip(UShort_t detector,
270 Char_t ring,
271 UShort_t sector,
272 UShort_t strip) const;
625d7886 273 /** Get the number of pre-samples in ALTRO channels
274 @param detector Detector # (1-3)
275 @param ring Ring ID ('I' or 'O')
276 @param sector Sector number (0-39)
277 @param strip Strip number (0-511)
278 @return Maximum strip */
279 UShort_t GetPreSamples(UShort_t,
280 Char_t,
281 UShort_t,
282 UShort_t) const { return 14+5; }
f6449cc0 283 /** Translate hardware address to detector coordinates
284 @param ddl DDL number
285 @param board Board address
286 @param chip Chip #
287 @param channel Channel #
288 @param det On return, Detector # (1-3)
289 @param ring On return, Ring ID ('I' or 'O')
290 @param sec On return, Sector number (0-39)
291 @param str On return, Strip number (0-511)
292 @return @c true on success. */
293 Bool_t Hardware2Detector(UInt_t ddl, UInt_t board,
294 UInt_t chip, UInt_t channel,
295 UShort_t& det, Char_t& ring,
296 UShort_t& sec, UShort_t& str) const;
c2fc1258 297 /** Translate hardware address to detector coordinates
298 @param ddl DDL number
299 @param addr Hardware address
300 @param det On return, Detector # (1-3)
301 @param ring On return, Ring ID ('I' or 'O')
302 @param sec On return, Sector number (0-39)
303 @param str On return, Strip number (0-511)
304 @return @c true on success. */
bf000c32 305 Bool_t Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
306 Char_t& ring, UShort_t& sec, UShort_t& str) const;
f6449cc0 307
308 /** Translate detector coordinates to hardware address
309 @param det Detector # (1-3)
310 @param ring Ring ID ('I' or 'O')
311 @param sec Sector number (0-39)
312 @param str Strip number (0-511)
313 @param ddl On return, DDL number
314 @param board On return, Board address
315 @param chip On return, Chip #
316 @param channel On return, Channel #
317 @return @c true on success. */
318 Bool_t Detector2Hardware(UShort_t det, Char_t ring,
319 UShort_t sec, UShort_t str,
320 UInt_t& ddl, UInt_t& board,
321 UInt_t& chip, UInt_t& channel) const;
c2fc1258 322 /** Translate detector coordinates to hardware address
323 @param det Detector # (1-3)
324 @param ring Ring ID ('I' or 'O')
325 @param sec Sector number (0-39)
326 @param str Strip number (0-511)
327 @param ddl On return, DDL number
328 @param addr On return, Hardware address
329 @return @c true on success. */
bf000c32 330 Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec,
331 UShort_t str, UInt_t& ddl, UInt_t& addr) const;
c2fc1258 332 /** Get the map that translates hardware to detector coordinates
333 @return Get the map that translates hardware to detector
334 coordinates */
57c3c593 335 AliFMDAltroMapping* GetAltroMap() const;
625d7886 336 /** Whether raw data has full common data header (8 32bit words) or
337 the older invalid format (7 32bit words with bogus entries)
338 @return false if the raw data has incomplete data header */
339 Bool_t HasCompleteHeader() const { return fHasCompleteHeader; }
340
9f662337 341 /** @} */
342
02a27b50 343 static const char* PulseGainPath() { return fgkPulseGain; }
344 static const char* PedestalPath() { return fgkPedestal; }
345 static const char* DeadPath() { return fgkDead; }
346 static const char* SampleRatePath() { return fgkSampleRate; }
347 static const char* AltroMapPath() { return fgkAltroMap; }
348 static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
349 static const char* StripRangePath() { return fgkStripRange; }
6cd5cd4d 350 static const char* GetPedestalShuttleID() {return fkPedestalShuttleID;}
351 static const char* GetGainShuttleID() {return fkGainShuttleID;}
352 static const char* GetConditionsShuttleID() {return fkConditionsShuttleID;}
497e0e62 353protected:
9f662337 354 /** CTOR */
497e0e62 355 AliFMDParameters();
02a27b50 356 /** CTOR */
357 AliFMDParameters(const AliFMDParameters& o)
b5ee4425 358 : TNamed(o),
359 fIsInit(o.fIsInit),
360 fkSiDeDxMip(o.fkSiDeDxMip),
361 fVA1MipRange(o.fVA1MipRange),
362 fAltroChannelSize(o.fAltroChannelSize),
363 fChannelsPerAltro(o.fChannelsPerAltro),
364 fPedestalFactor(o.fPedestalFactor),
365 fFixedPedestal(o.fFixedPedestal),
366 fFixedPedestalWidth(o.fFixedPedestalWidth),
367 fFixedZeroSuppression(o.fFixedZeroSuppression),
368 fFixedSampleRate(o.fFixedSampleRate),
369 fFixedThreshold(o.fFixedThreshold),
370 fFixedMinStrip(o.fFixedMinStrip),
371 fFixedMaxStrip(o.fFixedMaxStrip),
372 fFixedPulseGain(o.fFixedPulseGain),
373 fEdepMip(o.fEdepMip),
625d7886 374 fHasCompleteHeader(o.fHasCompleteHeader),
b5ee4425 375 fZeroSuppression(o.fZeroSuppression),
376 fSampleRate(o.fSampleRate),
377 fPedestal(o.fPedestal),
378 fPulseGain(o.fPulseGain),
379 fDeadMap(o.fDeadMap),
380 fAltroMap(o.fAltroMap),
381 fStripRange(o.fStripRange)
382 {}
02a27b50 383 /** Assignement operator
384 @return Reference to this */
385 AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
9f662337 386 /** DTOR */
497e0e62 387 virtual ~AliFMDParameters() {}
9f662337 388 /** Singleton instance */
497e0e62 389 static AliFMDParameters* fgInstance; // Static singleton instance
dc02d468 390 /** Get an entry from either global AliCDBManager or passed
391 AliFMDPreprocessor.
392 @param path Path to CDB object.
393 @param pp AliFMDPreprocessor
394 @param fatal If true, raise a fatal flag if we didn't get the entry.
395 @return AliCDBEntry if found */
396 AliCDBEntry* GetEntry(const char* path, AliFMDPreprocessor* pp,
397 Bool_t fatal=kTRUE) const;
9f662337 398 /** Initialize gains. Try to get them from CDB */
dc02d468 399 void InitPulseGain(AliFMDPreprocessor* pp=0);
9f662337 400 /** Initialize pedestals. Try to get them from CDB */
dc02d468 401 void InitPedestal(AliFMDPreprocessor* pp=0);
9f662337 402 /** Initialize dead map. Try to get it from CDB */
dc02d468 403 void InitDeadMap(AliFMDPreprocessor* pp=0);
9f662337 404 /** Initialize sample rates. Try to get them from CDB */
dc02d468 405 void InitSampleRate(AliFMDPreprocessor* pp=0);
9f662337 406 /** Initialize zero suppression thresholds. Try to get them from CDB */
dc02d468 407 void InitZeroSuppression(AliFMDPreprocessor* pp=0);
9f662337 408 /** Initialize hardware map. Try to get it from CDB */
dc02d468 409 void InitAltroMap(AliFMDPreprocessor* pp=0);
c2fc1258 410 /** Initialize strip range. Try to get it from CDB */
dc02d468 411 void InitStripRange(AliFMDPreprocessor* pp=0);
57c3c593 412
6cd5cd4d 413 Bool_t fIsInit; // Whether we've been initialised
57c3c593 414
6cd5cd4d 415 static const char* fgkPulseGain; // Path to PulseGain calib object
416 static const char* fgkPedestal; // Path to Pedestal calib object
417 static const char* fgkDead; // Path to Dead calib object
418 static const char* fgkSampleRate; // Path to SampleRate calib object
419 static const char* fgkAltroMap; // Path to AltroMap calib object
420 static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
421 static const char* fgkStripRange; // Path to strip range cal object
422 const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon
423 UShort_t fVA1MipRange; // # MIPs the pre-amp can do
424 UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch.
425 UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan.
426 Float_t fPedestalFactor; // Number of pedestal widths
1a1fdef7 427
6cd5cd4d 428 Float_t fFixedPedestal; // Pedestal to subtract
429 Float_t fFixedPedestalWidth; // Width of pedestal
430 UShort_t fFixedZeroSuppression; // Threshold for zero-suppression
431 UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp.
432 Float_t fFixedThreshold; // Threshold in ADC counts
433 UShort_t fFixedMinStrip; // Minimum strip read-out
434 UShort_t fFixedMaxStrip; // Maximum strip read-out
435 mutable Float_t fFixedPulseGain; //! Gain (cached)
436 mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
6cd5cd4d 437 Bool_t fHasCompleteHeader; // raw data has incomplete data header
438
439 static const char* fkPedestalShuttleID; // Shuttle/preprocessor ID for pedestals
440 static const char* fkGainShuttleID; // Shuttle/preprocessor ID for gains
441 static const char* fkConditionsShuttleID; // Shuttle/preprocessor ID for conditions
8f6ee336 442
443 AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
444 AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
445 AliFMDCalibPedestal* fPedestal; // Pedestals
446 AliFMDCalibGain* fPulseGain; // Pulser gain
447 AliFMDCalibDeadMap* fDeadMap; // Pulser gain
57c3c593 448 AliFMDAltroMapping* fAltroMap; // Map of hardware
c2fc1258 449 AliFMDCalibStripRange* fStripRange; // Strip range
8f6ee336 450
9a090ccd 451 ClassDef(AliFMDParameters,6) // Manager of parameters
1a1fdef7 452};
453
454#endif
455//____________________________________________________________________
456//
457// Local Variables:
458// mode: C++
459// End:
460//
461// EOF
462//
463