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