]>
Commit | Line | Data |
---|---|---|
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 | |
09b6c804 | 27 | #include "AliFMDCalibFwd.h" |
dc02d468 | 28 | class AliCDBEntry; |
29 | class AliFMDPreprocessor; | |
30 | ||
02a27b50 | 31 | //____________________________________________________________________ |
32 | // | |
33 | // Singleton class to handle various parameters (not geometry) of the | |
34 | // FMD | |
35 | // Should get ata fromm Conditions DB. | |
36 | // | |
1a1fdef7 | 37 | |
c2fc1258 | 38 | /** @brief This class is a singleton that handles various parameters |
39 | of the FMD detectors. | |
40 | This class reads from the Conditions DB to get the various | |
41 | parameters, which code can then request from here. In that way, | |
42 | all code uses the same data, and the interface is consistent. | |
9f662337 | 43 | |
44 | Some of the parameter managed are | |
45 | - @c fPedestal, @c fPedestalWidth | |
46 | Mean and width of the pedestal. The pedestal is simulated | |
47 | by a Guassian, but derived classes my override MakePedestal | |
48 | to simulate it differently (or pick it up from a database). | |
49 | - @c fVA1MipRange | |
50 | The dymamic MIP range of the VA1_ALICE pre-amplifier chip | |
51 | - @c fAltroChannelSize | |
52 | The largest number plus one that can be stored in one | |
53 | channel in one time step in the ALTRO ADC chip. | |
54 | - @c fSampleRate | |
55 | How many times the ALTRO ADC chip samples the VA1_ALICE | |
56 | pre-amplifier signal. The VA1_ALICE chip is read-out at | |
57 | 10MHz, while it's possible to drive the ALTRO chip at | |
58 | 25MHz. That means, that the ALTRO chip can have time to | |
59 | sample each VA1_ALICE signal up to 2 times. Although it's | |
60 | not certain this feature will be used in the production, | |
61 | we'd like have the option, and so it should be reflected in | |
62 | the code. | |
63 | ||
64 | @ingroup FMD_base | |
65 | */ | |
1a1fdef7 | 66 | class AliFMDParameters : public TNamed |
67 | { | |
68 | public: | |
f6449cc0 | 69 | /** Enumeration of things to initialize */ |
70 | enum What { | |
71 | /** Pulser gain */ | |
72 | kPulseGain = 0x1, // Pulser gain | |
73 | /** Pedestals and noise */ | |
74 | kPedestal = 0x2, // Pedestal and noise | |
75 | /** Dead channel map */ | |
76 | kDeadMap = 0x4, // Dead channel map | |
77 | /** Over sampling rate */ | |
78 | kSampleRate = 0x8, // Over sampling rate | |
79 | /** Zero suppression parameters */ | |
80 | kZeroSuppression = 0x10, // Zero suppression parameters | |
81 | /** ALTRO data map */ | |
6bf06d81 | 82 | kAltroMap = 0x20, // Altro channel map |
83 | /** Strip Range */ | |
f560b28c | 84 | kStripRange = 0x40 //Strip range, |
f6449cc0 | 85 | }; |
f560b28c | 86 | enum { |
87 | kAll = (kPulseGain|kPedestal|kDeadMap|kSampleRate| | |
88 | kZeroSuppression|kAltroMap|kStripRange) | |
89 | }; | |
90 | ||
09b6c804 | 91 | /** |
92 | * Singleton access | |
93 | * | |
94 | * | |
95 | * @return singleton | |
96 | */ | |
1a1fdef7 | 97 | static AliFMDParameters* Instance(); |
57c3c593 | 98 | |
09b6c804 | 99 | /** |
100 | * Initialize the manager. This tries to read the parameters from | |
101 | * CDB. If that fails, the class uses the hard-coded parameters. | |
102 | * | |
103 | * @param forceReInit Force (re-)initalize flag | |
104 | * @param what What to initialize | |
9f662337 | 105 | */ |
f560b28c | 106 | void Init(Bool_t forceReInit=kFALSE, UInt_t what=kAll ); |
09b6c804 | 107 | /** |
108 | * Initialize the manager. This tries to read the parameters from | |
109 | * CDB. If that fails, the class uses the hard-coded parameters. | |
110 | * | |
111 | * @param pp Preprocessor | |
112 | * @param forceReInit Force (re-)initalize flag | |
113 | * @param what What to initialize | |
dc02d468 | 114 | */ |
115 | void Init(AliFMDPreprocessor* pp, | |
f560b28c | 116 | Bool_t forceReInit=kFALSE, |
117 | UInt_t what=kAll); | |
118 | /** | |
119 | * Initialize the manager. This will try to read some calibrations | |
120 | * (sample rate, strip range, gains, pedestals) from local comma | |
121 | * separated value (CSV) files in the directory pointed at by @a | |
122 | * path. If they are not found, then they will be retrieved from | |
123 | * OCDB as appropriately. Other calibrations are always read from | |
124 | * OCDB. | |
125 | * | |
126 | * The CSV files should be named as | |
127 | * | |
128 | * - Pedestals: <tt>peds</tt><i>det_number</i><tt>.csv</tt> | |
129 | * - Gains: <tt>gains</tt><i>det_number</i><tt>.csv</tt> | |
130 | * - Sample Rate: <tt>conditions</tt><i>det_number</i><tt>.csv</tt> | |
131 | * - Strip Range: <tt>conditions</tt><i>det_number</i><tt>.csv</tt> | |
132 | * | |
133 | * where <i>det_number</i> is the detector number (1, 2, or 3). | |
134 | * | |
135 | * @param path Where to look for the CSV files | |
136 | * @param forceReInit Always reinitialise | |
137 | * @param what What calibrations to load. | |
138 | */ | |
139 | void Init(const char* path, | |
140 | Bool_t forceReInit=kFALSE, | |
141 | UInt_t what=kAll); | |
142 | ||
143 | /** | |
144 | * Automatically generate a dead map from the pedestals and gains. | |
145 | * A channel is marked as dead of the noise is too high (currently | |
146 | * more than 10 ADC counts), or the gain is unreasonable (currently | |
147 | * larger than 10, or smaller than 0.1). | |
148 | * | |
149 | * The procedure does not overwrite channels previously marked as | |
150 | * dead - e.g., channels marked as dead in the calibration loaded | |
151 | * from OCDB will continue to be marked as dead. That is, this | |
152 | * procedure will never make a channel un-dead. | |
153 | * | |
154 | * @param maxNoise Maximum noise value before a channel is marked | |
155 | * as dead. | |
156 | * @param minGain Minimum value of the calibrated gain before a | |
157 | * channel is considered dead. | |
158 | * @param maxGain Maximum value of the calibrated gain before a | |
159 | * channel is considered dead. | |
160 | */ | |
161 | void MakeDeadMap(Float_t maxNoise=10, Float_t minGain=.1, Float_t maxGain=10); | |
09b6c804 | 162 | /** |
163 | * Print all parameters. | |
164 | * | |
165 | * If option contains an 'A' then everything is printed. | |
166 | * | |
167 | * If the option contains the string "FMD" the function will search | |
168 | * for detector, ring, sector, and strip numbers to print, in | |
169 | * format | |
170 | * | |
171 | * @verbatim | |
172 | * FMD<detector><ring>[<sector>,<string>] | |
173 | * @endverbatim | |
174 | * | |
175 | * The wild card '*' means all of <detector>, <ring>, <sector>, or | |
176 | * <strip>. | |
177 | * | |
178 | * @param option Option string | |
179 | */ | |
c2fc1258 | 180 | void Print(Option_t* option="A") const; |
09b6c804 | 181 | /** |
182 | * Draw parameters. | |
183 | * | |
184 | * @param option What to draw. Should be one of | |
185 | * - dead Dead channels | |
186 | * - threshold Threshold | |
187 | * - gain Gain | |
188 | * - pedestal Pedestal | |
189 | * - noise Noise (or pedestal width) | |
190 | * - zero Zero suppression | |
191 | * - rate Sampling rate (VA1 clock / ALTRO clock) | |
192 | * - min Minimum strip read out | |
193 | * - max Maximum strip read out | |
194 | * - map hardware address | |
195 | */ | |
6169f936 | 196 | void Draw(Option_t* option="pedestal"); |
1a1fdef7 | 197 | |
9f662337 | 198 | /** @{ */ |
199 | /** @name Set various `Fixed' parameters */ | |
09b6c804 | 200 | /** |
201 | * @param r How many MIP signals we can fit in the VA1 | |
202 | * pre-amps. (default and design is 20) | |
203 | */ | |
8f6ee336 | 204 | void SetVA1MipRange(UShort_t r=20) { fVA1MipRange = r; } |
09b6c804 | 205 | /** |
206 | * @param s Maximum number of the ADC (ALTRO). This is a 10 bit | |
207 | * ADC so, the maximum number is 1024 | |
208 | */ | |
8f6ee336 | 209 | void SetAltroChannelSize(UShort_t s=1024) { fAltroChannelSize = s;} |
09b6c804 | 210 | /** |
211 | * @param size The number of strips multiplexed into one ALTRO | |
212 | * channel. That is, how many strips is connected to one VA1 | |
213 | * pre-amp. | |
214 | */ | |
8f6ee336 | 215 | void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; } |
09b6c804 | 216 | /** |
217 | * @param f Factor to use for accepting a signal. | |
218 | */ | |
8f6ee336 | 219 | void SetPedestalFactor(Float_t f=3) { fPedestalFactor = f; } |
09b6c804 | 220 | /** |
221 | * @param n Number of pre-samples to keep during zero-suppression - | |
222 | * only used in simulation. | |
223 | */ | |
cce354f6 | 224 | void SetZSPreSamples(UShort_t n=1) { fZSPre = (n & 0x3); } |
09b6c804 | 225 | /** |
226 | * @param n Number of post-samples to keep during zero-suppression - | |
227 | * only used in simulation. | |
228 | */ | |
cce354f6 | 229 | void SetZSPostSamples(UShort_t n=1) { fZSPost = (n & 0x3); } |
09b6c804 | 230 | /** |
231 | * @param use If true, do pedestal subtraction before zero | |
232 | * suppression - only used in simulation | |
233 | */ | |
cce354f6 | 234 | void SetZSPedSubtract(Bool_t use=kTRUE) { fZSPedSubtract = use; } |
9f662337 | 235 | /** @} */ |
8f6ee336 | 236 | |
9f662337 | 237 | /** @{ */ |
238 | /** @name Set various variable parameter defaults */ | |
09b6c804 | 239 | /** |
240 | * @param s Zero suppression threshold in ADC counts | |
241 | */ | |
8f6ee336 | 242 | void SetZeroSuppression(UShort_t s=0) { fFixedZeroSuppression = s; } |
09b6c804 | 243 | /** |
244 | * @param r How many times we oversample each strip. | |
245 | */ | |
f743c846 | 246 | void SetSampleRate(UShort_t r=1) { fFixedSampleRate = r ;}//(r>2?2:r);} |
09b6c804 | 247 | /** |
248 | * @param r How many times we oversample each strip. | |
249 | */ | |
6acbd49f | 250 | void SetSampleRate(AliFMDCalibSampleRate* r) { fSampleRate = r; } |
09b6c804 | 251 | /** |
252 | * @param p Pedestal value in ADC counts | |
253 | */ | |
8f6ee336 | 254 | void SetPedestal(Float_t p=10) { fFixedPedestal = p; } |
09b6c804 | 255 | /** |
256 | * @param p Pedestal map | |
257 | */ | |
e064ab4a | 258 | void SetPedestal(AliFMDCalibPedestal* p) { fPedestal = p; } |
09b6c804 | 259 | /** |
260 | * @param w Pedestal width in ADC counts | |
261 | */ | |
8f6ee336 | 262 | void SetPedestalWidth(Float_t w=1) { fFixedPedestalWidth = w; } |
09b6c804 | 263 | /** |
264 | * @param t Threshold used for 1 MIP acceptance. | |
265 | */ | |
8f6ee336 | 266 | void SetThreshold(Float_t t=0) { fFixedThreshold = t; } |
09b6c804 | 267 | /** |
268 | * Range of strips read out | |
269 | * | |
270 | * @param min Minimum strip number (0-127). | |
271 | * @param max Maximum strip number (0-127). | |
272 | */ | |
c2fc1258 | 273 | void SetStripRange(UShort_t min=0, UShort_t max=127); |
09b6c804 | 274 | /** |
275 | * set the strip range from object | |
276 | * | |
277 | * @param r Strip range object | |
278 | */ | |
433a88bd | 279 | void SetStripRange(AliFMDCalibStripRange* r) { fStripRange = r; } |
09b6c804 | 280 | /** |
281 | * Whether raw data has full common data header (8 32bit words) or | |
282 | * the older invalid format (7 32bit words with bogus entries) | |
283 | * | |
284 | * @param yes if true the raw data has complete data header | |
285 | */ | |
625d7886 | 286 | void UseCompleteHeader(Bool_t yes=kTRUE) { fHasCompleteHeader = yes; } |
09b6c804 | 287 | /** |
288 | * @param g Gain map | |
289 | */ | |
e064ab4a | 290 | void SetGain(AliFMDCalibGain* g) { fPulseGain = g; } |
9f662337 | 291 | /** @} */ |
1a1fdef7 | 292 | |
9f662337 | 293 | /** @{ */ |
294 | /** @name Get `Fixed' various parameters */ | |
09b6c804 | 295 | /** |
296 | * @return Number of MIP signals that fit inside a VA1 channel | |
297 | */ | |
1a1fdef7 | 298 | UShort_t GetVA1MipRange() const { return fVA1MipRange; } |
09b6c804 | 299 | /** |
300 | * @return The maximum count in the ADC | |
301 | */ | |
1a1fdef7 | 302 | UShort_t GetAltroChannelSize() const { return fAltroChannelSize; } |
09b6c804 | 303 | /** |
304 | * @return Number of strips muliplexed into one ADC channel | |
305 | */ | |
1a1fdef7 | 306 | UShort_t GetChannelsPerAltro() const { return fChannelsPerAltro; } |
09b6c804 | 307 | /** |
308 | * @return The average energy deposited by one MIP | |
309 | */ | |
1a1fdef7 | 310 | Float_t GetEdepMip() const; |
09b6c804 | 311 | /** |
312 | * This is the conversion from Digital-to-Analog-Converter setting | |
313 | * to the number of MIPs. The number was measured in the NBI lab during | |
314 | * August 2008. | |
315 | * | |
316 | * @return The conversion factor from DAC to ADC | |
317 | */ | |
68aba90a | 318 | Float_t GetDACPerMIP() const; |
09b6c804 | 319 | /** |
320 | * @return The factor used of signal acceptance | |
321 | */ | |
1a1fdef7 | 322 | Float_t GetPedestalFactor() const { return fPedestalFactor; } |
09b6c804 | 323 | /** |
324 | * @param n Number of pre-samples to keep during zero-suppression - | |
325 | * only used in simulation. | |
326 | */ | |
cce354f6 | 327 | UShort_t GetZSPreSamples() const { return fZSPre; } |
09b6c804 | 328 | /** |
329 | * @param n Number of post-samples to keep during zero-suppression - | |
330 | * only used in simulation. | |
331 | */ | |
cce354f6 | 332 | UShort_t GetZSPostSamples() const { return fZSPost; } |
09b6c804 | 333 | /** |
334 | * @param use If true, do pedestal subtraction before zero | |
335 | * suppression - only used in simulation | |
336 | */ | |
cce354f6 | 337 | Bool_t IsZSPedSubtract() const { return fZSPedSubtract; } |
9f662337 | 338 | /** @} */ |
09b6c804 | 339 | |
9f662337 | 340 | /** @{ */ |
f38b1653 | 341 | /** @name Various varible conditions */ |
09b6c804 | 342 | /** |
343 | * Whether the strip is considered dead | |
344 | * | |
345 | * @param detector Detector # (1-3) | |
346 | * @param ring Ring ID ('I' or 'O') | |
347 | * @param sector Sector number (0-39) | |
348 | * @param strip Strip number (0-511) | |
349 | * | |
350 | * @return @c true if the strip is considered dead, @c false if it's | |
351 | * OK. | |
352 | */ | |
8f6ee336 | 353 | Bool_t IsDead(UShort_t detector, |
354 | Char_t ring, | |
355 | UShort_t sector, | |
356 | UShort_t strip) const; | |
09b6c804 | 357 | /** |
358 | * Get the threshold in the pulser gain | |
359 | * | |
360 | * | |
361 | * @return Threshold from pulser | |
362 | */ | |
8f6ee336 | 363 | Float_t GetThreshold() const; |
09b6c804 | 364 | /** |
365 | * Gain of pre-amp. for strip, sector, ring, detector | |
366 | * | |
367 | * For simulations this is normally set to | |
368 | * | |
369 | * @f[ | |
370 | * \frac{\mbox{VA1_MIP_Range}{\mbox{ALTRO_channel_size}}\mbox{MIP_Energy_Loss} | |
371 | * @f] | |
372 | * | |
373 | * | |
374 | * @param detector Detector # (1-3) | |
375 | * @param ring Ring ID ('I' or 'O') | |
376 | * @param sector Sector number (0-39) | |
377 | * @param strip Strip number (0-511) | |
378 | * | |
379 | * @return Gain of pre-amp. | |
380 | */ | |
8f6ee336 | 381 | Float_t GetPulseGain(UShort_t detector, |
382 | Char_t ring, | |
383 | UShort_t sector, | |
384 | UShort_t strip) const; | |
09b6c804 | 385 | /** |
386 | * Get mean of pedestal | |
387 | * | |
388 | * @param detector Detector # (1-3) | |
389 | * @param ring Ring ID ('I' or 'O') | |
390 | * @param sector Sector number (0-39) | |
391 | * @param strip Strip number (0-511) | |
392 | * | |
393 | * @return Mean of pedestal | |
394 | */ | |
8f6ee336 | 395 | Float_t GetPedestal(UShort_t detector, |
396 | Char_t ring, | |
397 | UShort_t sector, | |
398 | UShort_t strip) const; | |
09b6c804 | 399 | /** |
400 | * Width of pedestal | |
401 | * | |
402 | * @param detector Detector # (1-3) | |
403 | * @param ring Ring ID ('I' or 'O') | |
404 | * @param sector Sector number (0-39) | |
405 | * @param strip Strip number (0-511) | |
406 | * | |
407 | * @return Width of pedestal | |
408 | */ | |
8f6ee336 | 409 | Float_t GetPedestalWidth(UShort_t detector, |
410 | Char_t ring, | |
411 | UShort_t sector, | |
412 | UShort_t strip) const; | |
09b6c804 | 413 | /** |
414 | * zero suppression threshold (in ADC counts) | |
415 | * | |
416 | * @param detector Detector # (1-3) | |
417 | * @param ring Ring ID ('I' or 'O') | |
418 | * @param sector Sector number (0-39) | |
419 | * @param strip Strip number (0-511) | |
420 | * | |
421 | * @return zero suppression threshold (in ADC counts) | |
422 | */ | |
8f6ee336 | 423 | UShort_t GetZeroSuppression(UShort_t detector, |
424 | Char_t ring, | |
425 | UShort_t sector, | |
426 | UShort_t strip) const; | |
09b6c804 | 427 | /** |
428 | * Get the sampling rate | |
429 | * | |
430 | * @param detector Detector # (1-3) | |
431 | * @param ring Ring ID ('I' or 'O') | |
432 | * @param sector Sector number (0-39) | |
433 | * @param strip Strip number (0-511) | |
434 | * | |
435 | * @return The sampling rate | |
436 | */ | |
c2fc1258 | 437 | UShort_t GetSampleRate(UShort_t detector, |
438 | Char_t ring, | |
439 | UShort_t sector, | |
440 | UShort_t strip) const; | |
09b6c804 | 441 | /** |
442 | * Get the minimum strip in the read-out range | |
443 | * | |
444 | * @param detector Detector # (1-3) | |
445 | * @param ring Ring ID ('I' or 'O') | |
446 | * @param sector Sector number (0-39) | |
447 | * @param strip Strip number (0-511) | |
448 | * | |
449 | * @return Minimum strip | |
450 | */ | |
c2fc1258 | 451 | UShort_t GetMinStrip(UShort_t detector, |
452 | Char_t ring, | |
453 | UShort_t sector, | |
454 | UShort_t strip) const; | |
09b6c804 | 455 | /** |
456 | * Get the maximum strip in the read-out range | |
457 | * | |
458 | * @param detector Detector # (1-3) | |
459 | * @param ring Ring ID ('I' or 'O') | |
460 | * @param sector Sector number (0-39) | |
461 | * @param strip Strip number (0-511) | |
462 | * | |
463 | * @return Maximum strip | |
464 | */ | |
c2fc1258 | 465 | UShort_t GetMaxStrip(UShort_t detector, |
466 | Char_t ring, | |
467 | UShort_t sector, | |
468 | UShort_t strip) const; | |
09b6c804 | 469 | /** |
470 | * Get the number of pre-samples in ALTRO channels | |
471 | * | |
472 | * @param detector Detector # (1-3) | |
473 | * @param ring Ring ID ('I' or 'O') | |
474 | * @param sector Sector number (0-39) | |
475 | * @param strip Strip number (0-511) | |
476 | * | |
477 | * @return Maximum strip | |
478 | */ | |
625d7886 | 479 | UShort_t GetPreSamples(UShort_t, |
480 | Char_t, | |
481 | UShort_t, | |
482 | UShort_t) const { return 14+5; } | |
09b6c804 | 483 | /* @}*/ |
f38b1653 | 484 | |
09b6c804 | 485 | /** |
486 | * @{ | |
487 | * @name Hardware to detector translation (and inverse) | |
488 | */ | |
489 | /** | |
490 | * Map a hardware address into a detector index. | |
491 | * | |
492 | * @param ddl Hardware DDL number | |
493 | * @param board FEC number | |
494 | * @param altro ALTRO number | |
495 | * @param channel Channel number | |
496 | * @param timebin Timebin | |
497 | * @param det On return, the detector # | |
498 | * @param ring On return, the ring ID | |
499 | * @param sec On return, the sector # | |
500 | * @param str On return, the base of strip # | |
501 | * @param sam On return, the sample number for this strip | |
502 | * | |
503 | * @return @c true on success, false otherwise | |
504 | */ | |
b995fc28 | 505 | Bool_t Hardware2Detector(UShort_t ddl, UShort_t board, |
506 | UShort_t altro, UShort_t chan, | |
f38b1653 | 507 | UShort_t timebin, |
508 | UShort_t& det, Char_t& ring, | |
509 | UShort_t& sec, Short_t& str, | |
510 | UShort_t& sam) const; | |
09b6c804 | 511 | /** |
512 | * Map a hardware address into a detector index. | |
513 | * | |
514 | * @param ddl Hardware DDL number | |
515 | * @param hwaddr Hardware address. | |
516 | * @param timebin Timebin | |
517 | * @param det On return, the detector # | |
518 | * @param ring On return, the ring ID | |
519 | * @param sec On return, the sector # | |
520 | * @param str On return, the base of strip # | |
521 | * @param sam On return, the sample number for this strip | |
522 | * | |
523 | * @return @c true on success, false otherwise | |
524 | */ | |
b995fc28 | 525 | Bool_t Hardware2Detector(UShort_t ddl, UShort_t hwaddr, |
f38b1653 | 526 | UShort_t timebin, |
527 | UShort_t& det, Char_t& ring, | |
528 | UShort_t& sec, Short_t& str, | |
529 | UShort_t& sam) const; | |
f6449cc0 | 530 | |
09b6c804 | 531 | /** |
532 | * Map a detector index into a hardware address. | |
533 | * | |
534 | * @param det The detector # | |
535 | * @param ring The ring ID | |
536 | * @param sec The sector # | |
537 | * @param str The strip # | |
538 | * @param sam The sample number | |
539 | * @param ddl On return, hardware DDL number | |
540 | * @param board On return, the FEC board address (local to DDL) | |
541 | * @param altro On return, the ALTRO number (local to FEC) | |
542 | * @param channel On return, the channel number (local to ALTRO) | |
543 | * @param timebin On return, the timebin number (local to ALTRO) | |
544 | * | |
545 | * @return @c true on success, false otherwise | |
546 | */ | |
f38b1653 | 547 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, |
548 | UShort_t sec, UShort_t str, | |
549 | UShort_t sam, | |
b995fc28 | 550 | UShort_t& ddl, UShort_t& board, |
551 | UShort_t& altro, UShort_t& channel, | |
f38b1653 | 552 | UShort_t& timebin) const; |
09b6c804 | 553 | /** |
554 | * Map a detector index into a hardware address. | |
555 | * | |
556 | * @param det The detector # | |
557 | * @param ring The ring ID | |
558 | * @param sec The sector # | |
559 | * @param str The strip # | |
560 | * @param sam The sample number | |
561 | * @param ddl On return, hardware DDL number | |
562 | * @param hwaddr On return, hardware address. | |
563 | * @param timebin On return, the timebin number (local to ALTRO) | |
564 | * | |
565 | * @return @c true on success, false otherwise | |
566 | */ | |
f38b1653 | 567 | Bool_t Detector2Hardware(UShort_t det, Char_t ring, |
568 | UShort_t sec, UShort_t str, | |
569 | UShort_t sam, | |
b995fc28 | 570 | UShort_t& ddl, UShort_t& hwaddr, |
f38b1653 | 571 | UShort_t& timebin) const; |
09b6c804 | 572 | /** |
573 | * Get the map that translates hardware to detector coordinates | |
574 | * | |
575 | * @return Get the map that translates hardware to detector | |
576 | * coordinates | |
577 | */ | |
57c3c593 | 578 | AliFMDAltroMapping* GetAltroMap() const; |
09b6c804 | 579 | /** |
580 | * Whether raw data has full common data header (8 32bit words) or | |
581 | * the older invalid format (7 32bit words with bogus entries) | |
582 | * | |
583 | * @return false if the raw data has incomplete data header | |
584 | */ | |
625d7886 | 585 | Bool_t HasCompleteHeader() const { return fHasCompleteHeader; } |
586 | ||
9f662337 | 587 | /** @} */ |
588 | ||
02a27b50 | 589 | static const char* PulseGainPath() { return fgkPulseGain; } |
590 | static const char* PedestalPath() { return fgkPedestal; } | |
591 | static const char* DeadPath() { return fgkDead; } | |
592 | static const char* SampleRatePath() { return fgkSampleRate; } | |
593 | static const char* AltroMapPath() { return fgkAltroMap; } | |
594 | static const char* ZeroSuppressionPath() { return fgkZeroSuppression; } | |
595 | static const char* StripRangePath() { return fgkStripRange; } | |
6cd5cd4d | 596 | static const char* GetPedestalShuttleID() {return fkPedestalShuttleID;} |
597 | static const char* GetGainShuttleID() {return fkGainShuttleID;} | |
598 | static const char* GetConditionsShuttleID() {return fkConditionsShuttleID;} | |
cf12b007 | 599 | |
497e0e62 | 600 | protected: |
09b6c804 | 601 | /** |
602 | * CTOR | |
603 | */ | |
497e0e62 | 604 | AliFMDParameters(); |
09b6c804 | 605 | /** |
606 | * CTOR | |
607 | */ | |
02a27b50 | 608 | AliFMDParameters(const AliFMDParameters& o) |
b5ee4425 | 609 | : TNamed(o), |
610 | fIsInit(o.fIsInit), | |
611 | fkSiDeDxMip(o.fkSiDeDxMip), | |
612 | fVA1MipRange(o.fVA1MipRange), | |
613 | fAltroChannelSize(o.fAltroChannelSize), | |
614 | fChannelsPerAltro(o.fChannelsPerAltro), | |
615 | fPedestalFactor(o.fPedestalFactor), | |
cce354f6 | 616 | fZSPre(o.fZSPre), |
617 | fZSPost(o.fZSPost), | |
618 | fZSPedSubtract(o.fZSPedSubtract), | |
b5ee4425 | 619 | fFixedPedestal(o.fFixedPedestal), |
620 | fFixedPedestalWidth(o.fFixedPedestalWidth), | |
621 | fFixedZeroSuppression(o.fFixedZeroSuppression), | |
622 | fFixedSampleRate(o.fFixedSampleRate), | |
623 | fFixedThreshold(o.fFixedThreshold), | |
624 | fFixedMinStrip(o.fFixedMinStrip), | |
625 | fFixedMaxStrip(o.fFixedMaxStrip), | |
626 | fFixedPulseGain(o.fFixedPulseGain), | |
627 | fEdepMip(o.fEdepMip), | |
625d7886 | 628 | fHasCompleteHeader(o.fHasCompleteHeader), |
b5ee4425 | 629 | fZeroSuppression(o.fZeroSuppression), |
630 | fSampleRate(o.fSampleRate), | |
631 | fPedestal(o.fPedestal), | |
632 | fPulseGain(o.fPulseGain), | |
633 | fDeadMap(o.fDeadMap), | |
634 | fAltroMap(o.fAltroMap), | |
3d7ed4ed | 635 | fStripRange(o.fStripRange) |
b5ee4425 | 636 | {} |
09b6c804 | 637 | /** |
638 | * Assignement operator | |
639 | * | |
640 | * @return Reference to this | |
641 | */ | |
02a27b50 | 642 | AliFMDParameters& operator=(const AliFMDParameters&) { return *this; } |
09b6c804 | 643 | /** |
644 | * DTOR | |
645 | */ | |
497e0e62 | 646 | virtual ~AliFMDParameters() {} |
09b6c804 | 647 | /** |
648 | * Singleton instance | |
649 | */ | |
497e0e62 | 650 | static AliFMDParameters* fgInstance; // Static singleton instance |
f560b28c | 651 | /** |
652 | * Check if the file <i>prefix</i><i>number</i> exists in @a path, | |
653 | * and write the full path to @a f. | |
654 | * | |
655 | * @param prefix File prefix (cond, peds, gains, ...) | |
656 | * @param path Path to files | |
657 | * @param number Detector number (1, 2, or 3) | |
658 | * @param f On return full path to file (if found) | |
659 | * | |
660 | * @return @c true if file exists and is readable, @c false otherwise | |
661 | */ | |
662 | Bool_t CheckFile(const char* prefix, const char* path, | |
663 | int number, TString& f) const; | |
09b6c804 | 664 | /** |
665 | * Get an entry from either global AliCDBManager or passed | |
666 | * AliFMDPreprocessor. | |
667 | * | |
668 | * @param path Path to CDB object. | |
669 | * @param pp AliFMDPreprocessor | |
670 | * @param fatal If true, raise a fatal flag if we didn't get the entry. | |
671 | * @return AliCDBEntry if found | |
672 | */ | |
dc02d468 | 673 | AliCDBEntry* GetEntry(const char* path, AliFMDPreprocessor* pp, |
674 | Bool_t fatal=kTRUE) const; | |
09b6c804 | 675 | /** |
676 | * Initialize gains. Try to get them from CDB | |
677 | * | |
678 | * @param pp Pre-processor if called from shuttle | |
679 | */ | |
dc02d468 | 680 | void InitPulseGain(AliFMDPreprocessor* pp=0); |
09b6c804 | 681 | /** |
682 | * Initialize pedestals. Try to get them from CDB | |
683 | * | |
684 | * @param pp Pre-processor if called from shuttle | |
685 | */ | |
dc02d468 | 686 | void InitPedestal(AliFMDPreprocessor* pp=0); |
09b6c804 | 687 | /** |
688 | * Initialize dead map. Try to get it from CDB | |
689 | * | |
690 | * @param pp Pre-processor if called from shuttle | |
691 | */ | |
dc02d468 | 692 | void InitDeadMap(AliFMDPreprocessor* pp=0); |
09b6c804 | 693 | /** |
694 | * Initialize sample rates. Try to get them from CDB | |
695 | * | |
696 | * @param pp Pre-processor if called from shuttle | |
697 | */ | |
dc02d468 | 698 | void InitSampleRate(AliFMDPreprocessor* pp=0); |
09b6c804 | 699 | /** |
700 | * Initialize zero suppression thresholds. Try to get them from CDB | |
701 | * | |
702 | * @param pp Pre-processor if called from shuttle | |
703 | */ | |
dc02d468 | 704 | void InitZeroSuppression(AliFMDPreprocessor* pp=0); |
09b6c804 | 705 | /** |
706 | * Initialize hardware map. Try to get it from CDB | |
707 | * | |
708 | * @param pp Pre-processor if called from shuttle | |
709 | */ | |
dc02d468 | 710 | void InitAltroMap(AliFMDPreprocessor* pp=0); |
09b6c804 | 711 | /** |
712 | * Initialize strip range. Try to get it from CDB | |
713 | * | |
714 | * @param pp Pre-processor if called from shuttle | |
715 | */ | |
dc02d468 | 716 | void InitStripRange(AliFMDPreprocessor* pp=0); |
57c3c593 | 717 | |
6cd5cd4d | 718 | Bool_t fIsInit; // Whether we've been initialised |
57c3c593 | 719 | |
6cd5cd4d | 720 | static const char* fgkPulseGain; // Path to PulseGain calib object |
721 | static const char* fgkPedestal; // Path to Pedestal calib object | |
722 | static const char* fgkDead; // Path to Dead calib object | |
723 | static const char* fgkSampleRate; // Path to SampleRate calib object | |
724 | static const char* fgkAltroMap; // Path to AltroMap calib object | |
725 | static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object | |
726 | static const char* fgkStripRange; // Path to strip range cal object | |
727 | const Float_t fkSiDeDxMip; // MIP dE/dx in Silicon | |
728 | UShort_t fVA1MipRange; // # MIPs the pre-amp can do | |
729 | UShort_t fAltroChannelSize; // Largest # to store in 1 ADC ch. | |
730 | UShort_t fChannelsPerAltro; // Number of pre-amp. chan/adc chan. | |
731 | Float_t fPedestalFactor; // Number of pedestal widths | |
cce354f6 | 732 | UShort_t fZSPre; // Number of pre-samples in ZS |
733 | UShort_t fZSPost; // Number of post-samples in ZS | |
734 | Bool_t fZSPedSubtract; // Pedestal subtraction before ZS | |
1a1fdef7 | 735 | |
6cd5cd4d | 736 | Float_t fFixedPedestal; // Pedestal to subtract |
737 | Float_t fFixedPedestalWidth; // Width of pedestal | |
738 | UShort_t fFixedZeroSuppression; // Threshold for zero-suppression | |
739 | UShort_t fFixedSampleRate; // Times the ALTRO samples pre-amp. | |
740 | Float_t fFixedThreshold; // Threshold in ADC counts | |
741 | UShort_t fFixedMinStrip; // Minimum strip read-out | |
742 | UShort_t fFixedMaxStrip; // Maximum strip read-out | |
743 | mutable Float_t fFixedPulseGain; //! Gain (cached) | |
744 | mutable Float_t fEdepMip; //! Cache of energy loss for a MIP | |
6cd5cd4d | 745 | Bool_t fHasCompleteHeader; // raw data has incomplete data header |
746 | ||
747 | static const char* fkPedestalShuttleID; // Shuttle/preprocessor ID for pedestals | |
748 | static const char* fkGainShuttleID; // Shuttle/preprocessor ID for gains | |
749 | static const char* fkConditionsShuttleID; // Shuttle/preprocessor ID for conditions | |
8f6ee336 | 750 | |
751 | AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB | |
752 | AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB | |
753 | AliFMDCalibPedestal* fPedestal; // Pedestals | |
754 | AliFMDCalibGain* fPulseGain; // Pulser gain | |
755 | AliFMDCalibDeadMap* fDeadMap; // Pulser gain | |
57c3c593 | 756 | AliFMDAltroMapping* fAltroMap; // Map of hardware |
c2fc1258 | 757 | AliFMDCalibStripRange* fStripRange; // Strip range |
8f6ee336 | 758 | |
9a090ccd | 759 | ClassDef(AliFMDParameters,6) // Manager of parameters |
1a1fdef7 | 760 | }; |
761 | ||
09b6c804 | 762 | //__________________________________________________________________ |
763 | inline void | |
764 | AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) | |
765 | { | |
766 | // Set fixed strip range | |
767 | fFixedMinStrip = min; | |
768 | fFixedMaxStrip = max; | |
769 | } | |
770 | ||
1a1fdef7 | 771 | #endif |
772 | //____________________________________________________________________ | |
773 | // | |
774 | // Local Variables: | |
775 | // mode: C++ | |
776 | // End: | |
777 | // | |
778 | // EOF | |
779 | // | |
780 |