]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDParameters.h
New RAW I/O. I rolled my own, because I wasn't happy with the old
[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 class AliFMDParameters : public TNamed
37 {
38 public:
39   static AliFMDParameters* Instance();
40
41   void Init();
42   
43   // Set various `Fixed' parameters 
44   void SetVA1MipRange(UShort_t r=20)          { fVA1MipRange = r; }
45   void SetAltroChannelSize(UShort_t s=1024)   { fAltroChannelSize = s;}
46   void SetChannelsPerAltro(UShort_t size=128) { fChannelsPerAltro = size; }
47   void SetPedestalFactor(Float_t f=3)         { fPedestalFactor = f; }
48
49   // Set various variable parameter defaults
50   void SetZeroSuppression(UShort_t s=0)       { fFixedZeroSuppression = s; }
51   void SetSampleRate(UShort_t r=1)            { fFixedSampleRate = (r>2?2:r);}
52   void SetPedestal(Float_t p=10)              { fFixedPedestal = p; }
53   void SetPedestalWidth(Float_t w=1)          { fFixedPedestalWidth = w; }
54   void SetThreshold(Float_t t=0)              { fFixedThreshold = t; }
55
56   // Get `Fixed' various parameters
57   UShort_t GetVA1MipRange()          const { return fVA1MipRange; }
58   UShort_t GetAltroChannelSize()     const { return fAltroChannelSize; }
59   UShort_t GetChannelsPerAltro()     const { return fChannelsPerAltro; }
60   Float_t  GetEdepMip()              const;
61   Float_t  GetPedestalFactor()       const { return fPedestalFactor; }
62
63   // Get variable parameters 
64   Bool_t   IsDead(UShort_t detector, 
65                   Char_t ring, 
66                   UShort_t sector, 
67                   UShort_t strip) const;
68   Float_t  GetThreshold() const;
69   Float_t  GetPulseGain(UShort_t detector, 
70                         Char_t ring, 
71                         UShort_t sector, 
72                         UShort_t strip) const;
73   Float_t  GetPedestal(UShort_t detector, 
74                        Char_t ring, 
75                        UShort_t sector, 
76                        UShort_t strip) const;
77   Float_t  GetPedestalWidth(UShort_t detector, 
78                             Char_t ring, 
79                             UShort_t sector, 
80                             UShort_t strip) const;
81   UShort_t GetZeroSuppression(UShort_t detector, 
82                               Char_t ring, 
83                               UShort_t sector, 
84                               UShort_t strip) const;
85   UShort_t GetSampleRate(UShort_t ddl) const;
86
87   Bool_t   Hardware2Detector(UInt_t ddl, UInt_t addr, UShort_t& det,
88                              Char_t& ring, UShort_t& sec, UShort_t& str) const;
89   Bool_t   Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, 
90                              UShort_t str, UInt_t& ddl, UInt_t& addr) const;
91   AliFMDAltroMapping* GetAltroMap() const;
92   enum { 
93     kBaseDDL = 0x1000 // DDL offset for the FMD
94   };
95   static const char* fgkPulseGain;       // Path to PulseGain calib object
96   static const char* fgkPedestal;        // Path to Pedestal calib object
97   static const char* fgkDead;            // Path to Dead calib object
98   static const char* fgkSampleRate;      // Path to SampleRate calib object
99   static const char* fgkAltroMap;        // Path to AltroMap calib object
100   static const char* fgkZeroSuppression; // Path to ZeroSuppression cal object
101 protected:
102   AliFMDParameters();
103   virtual ~AliFMDParameters() {}
104   static AliFMDParameters* fgInstance;   // Static singleton instance
105   void InitPulseGain();
106   void InitPedestal();
107   void InitDeadMap();
108   void InitSampleRate();
109   void InitZeroSuppression();
110   void InitAltroMap();
111
112   Bool_t          fIsInit;               // Whether we've been initialised  
113
114   const Float_t   fSiDeDxMip;            // MIP dE/dx in Silicon
115   UShort_t        fVA1MipRange;          // # MIPs the pre-amp can do    
116   UShort_t        fAltroChannelSize;     // Largest # to store in 1 ADC ch.
117   UShort_t        fChannelsPerAltro;     // Number of pre-amp. chan/adc chan.
118   Float_t         fPedestalFactor;       // Number of pedestal widths
119
120   Float_t         fFixedPedestal;        // Pedestal to subtract
121   Float_t         fFixedPedestalWidth;   // Width of pedestal
122   UShort_t        fFixedZeroSuppression; // Threshold for zero-suppression
123   UShort_t        fFixedSampleRate;      // Times the ALTRO samples pre-amp.
124   Float_t         fFixedThreshold;       //
125   mutable Float_t fFixedPulseGain;       //! Gain (cached)
126   mutable Float_t fEdepMip;              //! Cache of energy loss for a MIP
127   
128   AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
129   AliFMDCalibSampleRate*      fSampleRate;      // Sample rate from CDB 
130   AliFMDCalibPedestal*        fPedestal;        // Pedestals 
131   AliFMDCalibGain*            fPulseGain;       // Pulser gain
132   AliFMDCalibDeadMap*         fDeadMap;         // Pulser gain
133   AliFMDAltroMapping*         fAltroMap;        // Map of hardware
134   
135   ClassDef(AliFMDParameters,3)
136 };
137
138 #endif
139 //____________________________________________________________________
140 //
141 // Local Variables:
142 //   mode: C++
143 // End:
144 //
145 // EOF
146 //
147