]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDParameters.h
Optional scoring for background studies in HALL.
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.h
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  */
10 //____________________________________________________________________
11 //
12 //  Singleton class to handle various parameters (not geometry) of the
13 //  FMD
14 //  Should get ata fromm Conditions DB.
15 //
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 */
21 #ifndef ROOT_TNamed
22 # include <TNamed.h>
23 #endif
24 #ifndef ROOT_TArrayI
25 # include <TArrayI.h>
26 #endif
27 #include "AliFMDCalibFwd.h"
28 class AliCDBEntry;
29 class AliFMDPreprocessor;
30
31 //____________________________________________________________________
32 //
33 //  Singleton class to handle various parameters (not geometry) of the
34 //  FMD
35 //  Should get ata fromm Conditions DB.
36 //
37
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.
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 */
66 class AliFMDParameters : public TNamed
67 {
68 public:
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 */ 
82     kAltroMap = 0x20, // Altro channel map
83     /** Strip Range */
84     kStripRange = 0x40 //Strip range, 
85   };
86   enum { 
87     kAll = (kPulseGain|kPedestal|kDeadMap|kSampleRate|
88             kZeroSuppression|kAltroMap|kStripRange)
89   };
90     
91   /** 
92    * Singleton access
93    * 
94    * 
95    * @return singleton
96    */
97   static AliFMDParameters* Instance();
98
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 
105    */
106   void Init(Bool_t forceReInit=kFALSE, UInt_t what=kAll );
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 
114    */
115   void Init(AliFMDPreprocessor* pp, 
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);
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    */
180   void Print(Option_t* option="A") const;
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    */
196   void Draw(Option_t* option="pedestal");
197   
198   /** @{ */
199   /** @name Set various `Fixed' parameters */
200   /** 
201    * @param r How many MIP signals we can fit in the VA1
202    * pre-amps. (default and design is 20) 
203    */
204   void SetVA1MipRange(UShort_t r=20)          { fVA1MipRange = r; }
205   /** 
206    * @param s Maximum number of the ADC (ALTRO).  This is a 10 bit
207    * ADC so, the maximum number is 1024 
208    */
209   void SetAltroChannelSize(UShort_t s=1024)   { fAltroChannelSize = s;}
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    */
215   void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
216   /** 
217    * @param f Factor to use for accepting a signal. 
218    */
219   void SetPedestalFactor(Float_t f=3)         { fPedestalFactor = f; }
220   /** 
221    * @param n Number of pre-samples to keep during zero-suppression -
222    * only used in simulation. 
223    */
224   void SetZSPreSamples(UShort_t n=1) { fZSPre = (n & 0x3); }
225   /** 
226    * @param n Number of post-samples to keep during zero-suppression -
227    * only used in simulation. 
228    */
229   void SetZSPostSamples(UShort_t n=1) { fZSPost = (n & 0x3); }
230   /** 
231    * @param use If true, do pedestal subtraction before zero
232    * suppression - only used in simulation 
233    */
234   void SetZSPedSubtract(Bool_t use=kTRUE) { fZSPedSubtract = use; }
235   /** @} */
236
237   /** @{ */
238   /** @name Set various variable parameter defaults */
239   /** 
240    * @param s Zero suppression threshold in ADC counts 
241    */
242   void SetZeroSuppression(UShort_t s=1)       { fFixedZeroSuppression = s; }
243   /** 
244    * @param r How many times we oversample each strip. 
245    */
246   void SetSampleRate(UShort_t r=2)            { fFixedSampleRate = r ;}//(r>2?2:r);}
247   /** 
248    * @param r How many times we oversample each strip. 
249    */
250   void SetSampleRate(AliFMDCalibSampleRate* r) { fSampleRate = r; }
251   /** 
252    * @param p Pedestal value in ADC counts 
253    */
254   void SetPedestal(Float_t p=100)              { fFixedPedestal = p; }
255   /** 
256    * @param p Pedestal map 
257    */
258   void SetPedestal(AliFMDCalibPedestal* p) { fPedestal = p; }
259   /** 
260    * @param w Pedestal width in ADC counts 
261    */
262   void SetPedestalWidth(Float_t w=2)          { fFixedPedestalWidth = w; }
263   /** 
264    * @param t Threshold used for 1 MIP acceptance. 
265    */
266   void SetThreshold(Float_t t=0)              { fFixedThreshold = t; }
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    */
273   void SetStripRange(UShort_t min=0, UShort_t max=127);
274   /** 
275    * set the strip range from object
276    * 
277    * @param r Strip range object 
278    */
279   void SetStripRange(AliFMDCalibStripRange* r) { fStripRange = r; }
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    */ 
286   void UseCompleteHeader(Bool_t yes=kTRUE) { fHasCompleteHeader = yes; } 
287   /** 
288    * @param g Gain map 
289    */
290   void SetGain(AliFMDCalibGain* g) { fPulseGain = g; }
291   /** 
292    * @param g Gain map 
293    */
294   void SetGain(Float_t g=2) { fFixedPulseGain = g; }
295   /** @} */
296
297   /** @{ */
298   /** @name Get `Fixed' various parameters */
299   /** 
300    * @return Number of MIP signals that fit inside a VA1 channel  
301    */
302   UShort_t GetVA1MipRange()          const { return fVA1MipRange; }
303   /** 
304    * @return The maximum count in the ADC 
305    */
306   UShort_t GetAltroChannelSize()     const { return fAltroChannelSize; }
307   /** 
308    * @return Number of strips muliplexed into one ADC channel 
309    */
310   UShort_t GetChannelsPerAltro()     const { return fChannelsPerAltro; }
311   /** 
312    * @return The average energy deposited by one MIP 
313    */
314   Float_t  GetEdepMip()              const;
315   /** 
316    * This is the conversion from Digital-to-Analog-Converter setting
317    * to the number of MIPs. The number was measured in the NBI lab during
318    * August 2008.
319    *
320    * @return The conversion factor from DAC to ADC 
321    */
322   Float_t  GetDACPerMIP()              const;
323   /** 
324    * @return The factor used of signal acceptance 
325    */
326   Float_t  GetPedestalFactor()       const { return fPedestalFactor; }
327   /** 
328    * @param n Number of pre-samples to keep during zero-suppression -
329    * only used in simulation. 
330    */
331   UShort_t GetZSPreSamples() const { return fZSPre; }
332   /** 
333    * @param n Number of post-samples to keep during zero-suppression -
334    * only used in simulation. 
335    */
336   UShort_t GetZSPostSamples() const { return fZSPost; }
337   /**
338    * @param use If true, do pedestal subtraction before zero
339    * suppression - only used in simulation 
340    */
341   Bool_t IsZSPedSubtract() const { return fZSPedSubtract; }
342   /** @} */
343   
344   /** @{ */
345   /** @name Various varible conditions */
346   /** 
347    * Whether the strip is considered dead
348    * 
349    * @param detector Detector # (1-3)
350    * @param ring     Ring ID ('I' or 'O')
351    * @param sector   Sector number (0-39)
352    * @param strip    Strip number (0-511)
353    *
354    * @return @c true if the strip is considered dead, @c false if it's
355    * OK.
356    */
357   Bool_t   IsDead(UShort_t detector, 
358                   Char_t ring, 
359                   UShort_t sector, 
360                   UShort_t strip) const;
361   /** 
362    * Get the threshold in the pulser gain 
363    * 
364    * 
365    * @return Threshold from pulser 
366    */
367   Float_t  GetThreshold() const;
368   /** 
369    * Gain of pre-amp. for strip, sector, ring, detector 
370    *
371    * For simulations this is normally set to 
372    *
373    * @f[ 
374    *  \frac{\mbox{VA1_MIP_Range}{\mbox{ALTRO_channel_size}}\mbox{MIP_Energy_Loss}
375    * @f]
376    * 
377    *  
378    * @param detector Detector # (1-3)
379    * @param ring     Ring ID ('I' or 'O')
380    * @param sector   Sector number (0-39)
381    * @param strip    Strip number (0-511)
382    *
383    * @return Gain of pre-amp.  
384    */
385   Float_t  GetPulseGain(UShort_t detector, 
386                         Char_t ring, 
387                         UShort_t sector, 
388                         UShort_t strip) const;
389   /** 
390    * Get mean of pedestal
391    *
392    * @param detector Detector # (1-3)
393    * @param ring     Ring ID ('I' or 'O')
394    * @param sector   Sector number (0-39)
395    * @param strip    Strip number (0-511)
396    *
397    * @return Mean of pedestal 
398    */
399   Float_t  GetPedestal(UShort_t detector, 
400                        Char_t ring, 
401                        UShort_t sector, 
402                        UShort_t strip) const;
403   /** 
404    * Width of pedestal
405    *
406    * @param detector Detector # (1-3)
407    * @param ring     Ring ID ('I' or 'O')
408    * @param sector   Sector number (0-39)
409    * @param strip    Strip number (0-511)
410    *
411    * @return Width of pedestal 
412    */
413   Float_t  GetPedestalWidth(UShort_t detector, 
414                             Char_t ring, 
415                             UShort_t sector, 
416                             UShort_t strip) const;
417   /** 
418    * zero suppression threshold (in ADC counts)
419    *
420    * @param detector Detector # (1-3)
421    * @param ring     Ring ID ('I' or 'O')
422    * @param sector   Sector number (0-39)
423    * @param strip    Strip number (0-511)
424    *
425    * @return zero suppression threshold (in ADC counts) 
426    */
427   UShort_t GetZeroSuppression(UShort_t detector, 
428                               Char_t ring, 
429                               UShort_t sector, 
430                               UShort_t strip) const;
431   /** 
432    * Get the sampling rate
433    *
434    * @param detector Detector # (1-3)
435    * @param ring     Ring ID ('I' or 'O')
436    * @param sector   Sector number (0-39)
437    * @param strip    Strip number (0-511)
438    *
439    * @return The sampling rate 
440    */
441   UShort_t GetSampleRate(UShort_t detector, 
442                          Char_t ring, 
443                          UShort_t sector, 
444                          UShort_t strip) const;
445   /** 
446    * Get the minimum strip in the read-out range
447    *
448    * @param detector Detector # (1-3)
449    * @param ring     Ring ID ('I' or 'O')
450    * @param sector   Sector number (0-39)
451    * @param strip    Strip number (0-511)
452    *
453    * @return Minimum strip 
454    */
455   UShort_t GetMinStrip(UShort_t detector, 
456                        Char_t ring, 
457                        UShort_t sector, 
458                        UShort_t strip) const;
459   /** 
460    * Get the maximum strip in the read-out range
461    *
462    * @param detector Detector # (1-3)
463    * @param ring     Ring ID ('I' or 'O')
464    * @param sector   Sector number (0-39)
465    * @param strip    Strip number (0-511)
466    *
467    * @return Maximum strip 
468    */
469   UShort_t GetMaxStrip(UShort_t detector, 
470                        Char_t ring, 
471                        UShort_t sector, 
472                        UShort_t strip) const;
473   /** 
474    * Get the number of pre-samples in ALTRO channels
475    *
476    * @param detector Detector # (1-3)
477    * @param ring     Ring ID ('I' or 'O')
478    * @param sector   Sector number (0-39)
479    * @param strip    Strip number (0-511)
480    *
481    * @return Maximum strip 
482    */
483   UShort_t GetPreSamples(UShort_t, 
484                          Char_t, 
485                          UShort_t, 
486                          UShort_t) const { return 14+5; }
487   /* @}*/
488   
489   /** 
490    * @{ 
491    * @name Hardware to detector translation (and inverse) 
492    */
493   /** 
494    * Map a hardware address into a detector index. 
495    *
496    * @param ddl        Hardware DDL number 
497    * @param board      FEC number
498    * @param altro      ALTRO number 
499    * @param channel    Channel number 
500    * @param timebin    Timebin 
501    * @param det        On return, the detector #
502    * @param ring       On return, the ring ID
503    * @param sec        On return, the sector #
504    * @param str        On return, the base of strip #
505    * @param sam        On return, the sample number for this strip
506    *
507    * @return @c true on success, false otherwise 
508    */
509   Bool_t Hardware2Detector(UShort_t    ddl,        UShort_t    board, 
510                            UShort_t    altro,      UShort_t    chan,
511                            UShort_t  timebin,   
512                            UShort_t& det,        Char_t&   ring, 
513                            UShort_t& sec,        Short_t& str,
514                            UShort_t& sam) const;
515   /** 
516    * Map a hardware address into a detector index. 
517    *
518    * @param ddl        Hardware DDL number 
519    * @param hwaddr     Hardware address.  
520    * @param timebin    Timebin 
521    * @param det        On return, the detector #
522    * @param ring       On return, the ring ID
523    * @param sec        On return, the sector #
524    * @param str        On return, the base of strip #
525    * @param sam        On return, the sample number for this strip
526    *
527    * @return @c true on success, false otherwise 
528    */
529   Bool_t Hardware2Detector(UShort_t    ddl,        UShort_t    hwaddr, 
530                            UShort_t  timebin,    
531                            UShort_t& det,        Char_t&   ring, 
532                            UShort_t& sec,        Short_t& str,
533                            UShort_t& sam) const;
534
535   /** 
536    * Map a detector index into a hardware address. 
537    *
538    * @param det         The detector #
539    * @param ring        The ring ID
540    * @param sec         The sector #
541    * @param str         The strip #
542    * @param sam         The sample number 
543    * @param ddl         On return, hardware DDL number 
544    * @param board       On return, the FEC board address (local to DDL)
545    * @param altro       On return, the ALTRO number (local to FEC)
546    * @param channel     On return, the channel number (local to ALTRO)
547    * @param timebin     On return, the timebin number (local to ALTRO)
548    *
549    * @return @c true on success, false otherwise 
550    */
551   Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
552                            UShort_t  sec,        UShort_t  str,
553                            UShort_t  sam, 
554                            UShort_t&   ddl,        UShort_t&   board, 
555                            UShort_t&   altro,      UShort_t&   channel, 
556                            UShort_t& timebin) const;
557   /** 
558    * Map a detector index into a hardware address. 
559    *
560    * @param det         The detector #
561    * @param ring        The ring ID
562    * @param sec         The sector #
563    * @param str         The strip #
564    * @param sam         The sample number 
565    * @param ddl         On return, hardware DDL number 
566    * @param hwaddr      On return, hardware address.  
567    * @param timebin     On return, the timebin number (local to ALTRO)
568    *
569    * @return @c true on success, false otherwise 
570    */
571   Bool_t Detector2Hardware(UShort_t  det,        Char_t    ring, 
572                            UShort_t  sec,        UShort_t  str,
573                            UShort_t  sam, 
574                            UShort_t&   ddl,        UShort_t&   hwaddr, 
575                            UShort_t& timebin) const;
576   /** 
577    * Get the map that translates hardware to detector coordinates 
578    *
579    * @return Get the map that translates hardware to detector
580    * coordinates 
581    */ 
582   AliFMDAltroMapping* GetAltroMap() const;
583   /** 
584    * Whether raw data has full common data header (8 32bit words) or
585    * the older invalid format (7 32bit words with bogus entries)
586    *
587    * @return false if the raw data has incomplete data header 
588    */ 
589   Bool_t HasCompleteHeader() const { return fHasCompleteHeader; } 
590
591   /** @} */
592
593   static const char* PulseGainPath()       { return fgkPulseGain; }
594   static const char* PedestalPath()        { return fgkPedestal; }
595   static const char* DeadPath()            { return fgkDead; }
596   static const char* SampleRatePath()      { return fgkSampleRate; }
597   static const char* AltroMapPath()        { return fgkAltroMap; }
598   static const char* ZeroSuppressionPath() { return fgkZeroSuppression; }
599   static const char* StripRangePath()      { return fgkStripRange; }
600   static const char* GetPedestalShuttleID()   {return fkPedestalShuttleID;}
601   static const char* GetGainShuttleID()       {return fkGainShuttleID;}
602   static const char* GetConditionsShuttleID()   {return fkConditionsShuttleID;}
603   
604 protected:
605   /** 
606    * CTOR  
607    */
608   AliFMDParameters();
609   /** 
610    * CTOR  
611    */
612   AliFMDParameters(const AliFMDParameters& o) 
613     : TNamed(o), 
614       fIsInit(o.fIsInit),
615       fkSiDeDxMip(o.fkSiDeDxMip),
616       fVA1MipRange(o.fVA1MipRange),
617       fAltroChannelSize(o.fAltroChannelSize),
618       fChannelsPerAltro(o.fChannelsPerAltro),
619       fPedestalFactor(o.fPedestalFactor),
620       fZSPre(o.fZSPre),
621       fZSPost(o.fZSPost),
622       fZSPedSubtract(o.fZSPedSubtract),
623       fFixedPedestal(o.fFixedPedestal),
624       fFixedPedestalWidth(o.fFixedPedestalWidth),
625       fFixedZeroSuppression(o.fFixedZeroSuppression),
626       fFixedSampleRate(o.fFixedSampleRate),
627       fFixedThreshold(o.fFixedThreshold),
628       fFixedMinStrip(o.fFixedMinStrip),
629       fFixedMaxStrip(o.fFixedMaxStrip),
630       fFixedPulseGain(o.fFixedPulseGain),
631       fEdepMip(o.fEdepMip),
632       fHasCompleteHeader(o.fHasCompleteHeader),
633       fZeroSuppression(o.fZeroSuppression),
634       fSampleRate(o.fSampleRate),
635       fPedestal(o.fPedestal),
636       fPulseGain(o.fPulseGain),
637       fDeadMap(o.fDeadMap),
638       fAltroMap(o.fAltroMap),
639       fStripRange(o.fStripRange)
640   {}
641   /** 
642    * Assignement operator 
643    *
644    * @return Reference to this 
645    */
646   AliFMDParameters& operator=(const AliFMDParameters&) { return *this; }
647   /** 
648    * DTOR 
649    */
650   virtual ~AliFMDParameters() {}
651   /** 
652    * Singleton instance  
653    */
654   static AliFMDParameters* fgInstance;   // Static singleton instance
655   /** 
656    * Check if the file <i>prefix</i><i>number</i> exists in @a path, 
657    * and write the full path to @a f.  
658    * 
659    * @param prefix  File prefix (cond, peds, gains, ...)
660    * @param path    Path to files
661    * @param number  Detector number (1, 2, or 3)
662    * @param f       On return full path to file (if found)
663    * 
664    * @return @c true if file exists and is readable, @c false otherwise
665    */
666   Bool_t CheckFile(const char* prefix, const char* path, 
667                    int         number, TString&    f) const;
668   /** 
669    * Get an entry from either global AliCDBManager or passed
670    * AliFMDPreprocessor. 
671    * 
672    * @param path  Path to CDB object. 
673    * @param pp    AliFMDPreprocessor 
674    * @param fatal If true, raise a fatal flag if we didn't get the entry.
675    * @return AliCDBEntry if found 
676    */ 
677   AliCDBEntry* GetEntry(const char* path, AliFMDPreprocessor* pp, 
678                         Bool_t fatal=kTRUE) const;
679   /** 
680    * Initialize gains.  Try to get them from CDB 
681    *
682    * @param pp Pre-processor if called from shuttle
683    */
684   void InitPulseGain(AliFMDPreprocessor* pp=0);
685   /**
686    * Initialize pedestals.  Try to get them from CDB
687    *
688    * @param pp Pre-processor if called from shuttle
689    */
690   void InitPedestal(AliFMDPreprocessor* pp=0);
691   /**
692    * Initialize dead map.  Try to get it from CDB
693    *
694    * @param pp Pre-processor if called from shuttle
695    */
696   void InitDeadMap(AliFMDPreprocessor* pp=0);
697   /**
698    * Initialize sample rates.  Try to get them from CDB
699    *
700    * @param pp Pre-processor if called from shuttle
701    */
702   void InitSampleRate(AliFMDPreprocessor* pp=0);
703   /**
704    * Initialize zero suppression thresholds.  Try to get them from CDB
705    *
706    * @param pp Pre-processor if called from shuttle
707    */
708   void InitZeroSuppression(AliFMDPreprocessor* pp=0);
709   /**
710    * Initialize hardware map.  Try to get it from CDB
711    *
712    * @param pp Pre-processor if called from shuttle
713    */
714   void InitAltroMap(AliFMDPreprocessor* pp=0);
715   /**
716    * Initialize strip range.  Try to get it from CDB
717    *
718    * @param pp Pre-processor if called from shuttle
719    */
720   void InitStripRange(AliFMDPreprocessor* pp=0);
721
722   Bool_t          fIsInit;                   // Whether we've been initialised  
723
724   static const char* fgkPulseGain;           // Path to PulseGain calib object
725   static const char* fgkPedestal;            // Path to Pedestal calib object
726   static const char* fgkDead;                // Path to Dead calib object
727   static const char* fgkSampleRate;          // Path to SampleRate calib object
728   static const char* fgkAltroMap;            // Path to AltroMap calib object
729   static const char* fgkZeroSuppression;     // Path to ZeroSuppression cal object
730   static const char* fgkStripRange;          // Path to strip range cal object
731   const Float_t   fkSiDeDxMip;               // MIP dE/dx in Silicon
732   UShort_t        fVA1MipRange;              // # MIPs the pre-amp can do    
733   UShort_t        fAltroChannelSize;         // Largest # to store in 1 ADC ch.
734   UShort_t        fChannelsPerAltro;         // Number of pre-amp. chan/adc chan.
735   Float_t         fPedestalFactor;           // Number of pedestal widths
736   UShort_t        fZSPre;                    // Number of pre-samples in ZS
737   UShort_t        fZSPost;                   // Number of post-samples in ZS
738   Bool_t          fZSPedSubtract;            // Pedestal subtraction before ZS
739
740   Float_t         fFixedPedestal;            // Pedestal to subtract
741   Float_t         fFixedPedestalWidth;       // Width of pedestal
742   UShort_t        fFixedZeroSuppression;     // Threshold for zero-suppression
743   UShort_t        fFixedSampleRate;          // Times the ALTRO samples pre-amp.
744   Float_t         fFixedThreshold;           // Threshold in ADC counts
745   UShort_t        fFixedMinStrip;            // Minimum strip read-out
746   UShort_t        fFixedMaxStrip;            // Maximum strip read-out 
747   mutable Float_t fFixedPulseGain;           //! Gain (cached)
748   mutable Float_t fEdepMip;                  //! Cache of energy loss for a MIP
749   Bool_t          fHasCompleteHeader;        // raw data has incomplete data header
750   
751   static const char* fkPedestalShuttleID;    // Shuttle/preprocessor ID for pedestals
752   static const char* fkGainShuttleID;        // Shuttle/preprocessor ID for gains
753   static const char* fkConditionsShuttleID;  // Shuttle/preprocessor ID for conditions
754   
755   AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
756   AliFMDCalibSampleRate*      fSampleRate;      // Sample rate from CDB 
757   AliFMDCalibPedestal*        fPedestal;        // Pedestals 
758   AliFMDCalibGain*            fPulseGain;       // Pulser gain
759   AliFMDCalibDeadMap*         fDeadMap;         // Pulser gain
760   AliFMDAltroMapping*         fAltroMap;        // Map of hardware
761   AliFMDCalibStripRange*      fStripRange;      // Strip range
762   
763   ClassDef(AliFMDParameters,6) // Manager of parameters
764 };
765
766 //__________________________________________________________________
767 inline void
768 AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) 
769 {
770   // Set fixed strip range 
771   fFixedMinStrip = min;
772   fFixedMaxStrip = max;
773 }
774
775 #endif
776 //____________________________________________________________________
777 //
778 // Local Variables:
779 //   mode: C++
780 // End:
781 //
782 // EOF
783 //
784