]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDParameters.h
Added a lot of Doxygen documentation
[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 //
13 //  Singleton class to handle various parameters (not geometry) of the
14 //  FMD
15 //  Should get ata fromm Conditions DB.
16 //
17 #ifndef ROOT_TNamed
18 # include <TNamed.h>
19 #endif
20 #ifndef ROOT_TArrayI
21 # include <TArrayI.h>
22 #endif
23 #ifndef ALIFMDUSHORTMAP_H
24 # include <AliFMDUShortMap.h>
25 #endif
26 #ifndef ALIFMDBOOLMAP_H
27 # include <AliFMDBoolMap.h>
28 #endif
29 typedef AliFMDUShortMap AliFMDCalibZeroSuppression;
30 typedef AliFMDBoolMap   AliFMDCalibDeadMap;
31 class AliFMDCalibPedestal;
32 class AliFMDCalibGain;
33 class AliFMDCalibSampleRate;
34 class AliFMDAltroMapping;
35
36 /** This class is a singleton that handles various parameters of the
37     FMD detectors.  This class reads from the Conditions DB to get the
38     various parameters, which code can then request from here. In that
39     way, all code uses the same data, and the interface is consistent.
40      
41     Some of the parameter managed are 
42     - @c fPedestal, @c fPedestalWidth
43       Mean and width of the pedestal.  The pedestal is simulated
44       by a Guassian, but derived classes my override MakePedestal
45       to simulate it differently (or pick it up from a database).
46     - @c fVA1MipRange
47       The dymamic MIP range of the VA1_ALICE pre-amplifier chip 
48     - @c fAltroChannelSize
49       The largest number plus one that can be stored in one
50       channel in one time step in the ALTRO ADC chip. 
51     - @c fSampleRate
52       How many times the ALTRO ADC chip samples the VA1_ALICE
53       pre-amplifier signal.   The VA1_ALICE chip is read-out at
54       10MHz, while it's possible to drive the ALTRO chip at
55       25MHz.  That means, that the ALTRO chip can have time to
56       sample each VA1_ALICE signal up to 2 times.  Although it's
57       not certain this feature will be used in the production,
58       we'd like have the option, and so it should be reflected in
59       the code.
60
61     @ingroup FMD_base
62 */
63 class AliFMDParameters : public TNamed
64 {
65 public:
66   /** Singleton access
67       @return  single to */
68   static AliFMDParameters* Instance();
69
70   /** Initialize the manager.  This tries to read the parameters from
71       CDB.  If that fails, the class uses the hard-coded parameters. 
72    */
73   void Init();
74   
75   /** @{ */
76   /** @name Set various `Fixed' parameters */
77   void SetVA1MipRange(UShort_t r=20)          { fVA1MipRange = r; }
78   void SetAltroChannelSize(UShort_t s=1024)   { fAltroChannelSize = s;}
79   void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
80   void SetPedestalFactor(Float_t f=3)         { fPedestalFactor = f; }
81   /** @} */
82
83   /** @{ */
84   /** @name Set various variable parameter defaults */
85   void SetZeroSuppression(UShort_t s=0)       { fFixedZeroSuppression = s; }
86   void SetSampleRate(UShort_t r=1)            { fFixedSampleRate = (r>2?2:r);}
87   void SetPedestal(Float_t p=10)              { fFixedPedestal = p; }
88   void SetPedestalWidth(Float_t w=1)          { fFixedPedestalWidth = w; }
89   void SetThreshold(Float_t t=0)              { fFixedThreshold = t; }
90   /** @} */
91
92   /** @{ */
93   /** @name Get `Fixed' various parameters */
94   UShort_t GetVA1MipRange()          const { return fVA1MipRange; }
95   UShort_t GetAltroChannelSize()     const { return fAltroChannelSize; }
96   UShort_t GetChannelsPerAltro()     const { return fChannelsPerAltro; }
97   Float_t  GetEdepMip()              const;
98   Float_t  GetPedestalFactor()       const { return fPedestalFactor; }
99   /** @} */
100
101   /** @{ */
102   /** @name Get variable parameters */
103   Bool_t   IsDead(UShort_t detector, 
104                   Char_t ring, 
105                   UShort_t sector, 
106                   UShort_t strip) const;
107   Float_t  GetThreshold() const;
108   Float_t  GetPulseGain(UShort_t detector, 
109                         Char_t ring, 
110                         UShort_t sector, 
111                         UShort_t strip) const;
112   Float_t  GetPedestal(UShort_t detector, 
113                        Char_t ring, 
114                        UShort_t sector, 
115                        UShort_t strip) const;
116   Float_t  GetPedestalWidth(UShort_t detector, 
117                             Char_t ring, 
118                             UShort_t sector, 
119                             UShort_t strip) const;
120   UShort_t GetZeroSuppression(UShort_t detector, 
121                               Char_t ring, 
122                               UShort_t sector, 
123                               UShort_t strip) const;
124   UShort_t GetSampleRate(UShort_t ddl) const;
125
126   Bool_t   Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
127                              Char_t& ring, UShort_t& sec, UShort_t& str) const;
128   Bool_t   Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, 
129                              UShort_t str, UInt_t& ddl, UInt_t& addr) const;
130   AliFMDAltroMapping* GetAltroMap() const;
131   /** @} */
132
133   enum { 
134     kBaseDDL = 0x1000 // DDL offset for the FMD
135   };
136   static const char* fgkPulseGain;       // Path to PulseGain calib object
137   static const char* fgkPedestal;        // Path to Pedestal calib object
138   static const char* fgkDead;            // Path to Dead calib object
139   static const char* fgkSampleRate;      // Path to SampleRate calib object
140   static const char* fgkAltroMap;        // Path to AltroMap calib object
141   static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
142 protected:
143   /** CTOR  */
144   AliFMDParameters();
145   /** DTOR */
146   virtual ~AliFMDParameters() {}
147   /** Singleton instance  */
148   static AliFMDParameters* fgInstance;   // Static singleton instance
149   /** Initialize gains.  Try to get them from CDB */
150   void InitPulseGain();
151   /** Initialize pedestals.  Try to get them from CDB */
152   void InitPedestal();
153   /** Initialize dead map.  Try to get it from CDB */
154   void InitDeadMap();
155   /** Initialize sample rates.  Try to get them from CDB */
156   void InitSampleRate();
157   /** Initialize zero suppression thresholds.  Try to get them from CDB */
158   void InitZeroSuppression();
159   /** Initialize hardware map.  Try to get it from CDB */
160   void InitAltroMap();
161
162   Bool_t          fIsInit;               // Whether we've been initialised  
163
164   const Float_t   fSiDeDxMip;            // MIP dE/dx in Silicon
165   UShort_t        fVA1MipRange;          // # MIPs the pre-amp can do    
166   UShort_t        fAltroChannelSize;     // Largest # to store in 1 ADC ch.
167   UShort_t        fChannelsPerAltro;     // Number of pre-amp. chan/adc chan.
168   Float_t         fPedestalFactor;       // Number of pedestal widths
169
170   Float_t         fFixedPedestal;        // Pedestal to subtract
171   Float_t         fFixedPedestalWidth;   // Width of pedestal
172   UShort_t        fFixedZeroSuppression; // Threshold for zero-suppression
173   UShort_t        fFixedSampleRate;      // Times the ALTRO samples pre-amp.
174   Float_t         fFixedThreshold;       //
175   mutable Float_t fFixedPulseGain;       //! Gain (cached)
176   mutable Float_t fEdepMip;              //! Cache of energy loss for a MIP
177   
178   AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
179   AliFMDCalibSampleRate*      fSampleRate;      // Sample rate from CDB 
180   AliFMDCalibPedestal*        fPedestal;        // Pedestals 
181   AliFMDCalibGain*            fPulseGain;       // Pulser gain
182   AliFMDCalibDeadMap*         fDeadMap;         // Pulser gain
183   AliFMDAltroMapping*         fAltroMap;        // Map of hardware
184   
185   ClassDef(AliFMDParameters,3)
186 };
187
188 #endif
189 //____________________________________________________________________
190 //
191 // Local Variables:
192 //   mode: C++
193 // End:
194 //
195 // EOF
196 //
197