]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPadStatusMaker.h
reco update
[u/mrichter/AliRoot.git] / MUON / AliMUONPadStatusMaker.h
1 #ifndef ALIMUONPADSTATUSMAKER_H
2 #define ALIMUONPADSTATUSMAKER_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup rec
10 /// \class AliMUONPadStatusMaker
11 /// \brief Make a 2DStore of pad statuses, using different sources of information
12 /// 
13 //  Author Laurent Aphecetche
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18 #ifndef ROOT_TVector2
19 #  include "TVector2.h"
20 #endif
21
22 class TExMap;
23 class AliMUONCalibrationData;
24 class AliMUONRecoParam;
25 class AliMUONVCalibParam;
26 class AliMUONVTrackerData;
27 class AliMUONVStore;
28
29 using std::ostream;
30
31 class AliMUONPadStatusMaker : public TObject
32 {
33 public:
34   AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData);
35   virtual ~AliMUONPadStatusMaker();
36   
37   /// Get the reference to the calibrationdata object we use.
38   const AliMUONCalibrationData& CalibrationData() const { return fkCalibrationData; }
39   
40   /** Get access to internal status store (for debug only, as it may not be complete,
41     depending on whether you've already called PadStatus for all possible de,manu
42     combinations or not...
43     */
44   AliMUONVStore* StatusStore() const { return fStatus; }
45
46   AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
47
48   Int_t PadStatus(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
49   
50   AliMUONVStore* NeighboursStore() const;
51   
52   AliMUONVCalibParam* Neighbours(Int_t detElemId, Int_t manuId) const;
53   
54   static TString AsString(Int_t status);
55
56   static TString AsCondition(Int_t status);
57
58   /// Return Low and High limits for a0 parameter of gain (linear slope)
59   TVector2 GainA1Limits() const { return fGainA1Limits; }
60   /// Return Low and High limits for a1 parameter of gain (parabolic term)
61   TVector2 GainA2Limits() const { return fGainA2Limits; }
62   /// Return Low and High limits for thres parameter of gain
63   TVector2 GainThresLimits() const { return fGainThresLimits; }
64   
65   /// Return HV threshold
66   Double_t HVLimit(Int_t chamberId) const;
67   
68   /// Return Low and High threshold for pedestal mean
69   TVector2 PedMeanLimits() const { return fPedMeanLimits; }
70   /// Return Low and High threshold for pedestal sigma
71   TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
72   
73   /// Set Low and High limits for a0 parameter of gain (linear slope)
74   void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
75   /// Set Low and High limits for a1 parameter of gain (parabolic term)
76   void GainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
77   /// Set Low and High limits for thres parameter of gain
78   void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
79   
80   /// Set HV limit
81   void SetHVLimit(Int_t chamberId, Double_t hv);
82
83   /// Set Low and High threshold for pedestal mean
84   void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
85   /// Set Low and High threshold for pedestal sigma 
86   void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
87   
88         /// Set Low and High threshold for gain a0 term
89         void SetGainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
90         /// Set Low and High threshold for gain a1 term
91         void SetGainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
92         /// Set Low and High threshold for gain threshold term
93         void SetGainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
94         
95   /// Set Low and High manu occupancy limits
96   void SetManuOccupancyLimits(float low, float high) { fManuOccupancyLimits.Set(low,high); }
97   /// Get manu occupancy limits
98   TVector2 ManuOccupancyLimits() const { return fManuOccupancyLimits; }
99
100   /// Set Low and High bus patch occupancy limits
101   void SetBuspatchOccupancyLimits(float low, float high) { fBuspatchOccupancyLimits.Set(low,high); }
102   /// Get bus patch occupancy limits
103   TVector2 BuspatchOccupancyLimits() const { return fBuspatchOccupancyLimits; }
104
105   /// Set Low and High DE occupancy limits
106   void SetDEOccupancyLimits(float low, float high) { fDEOccupancyLimits.Set(low,high); }
107   /// Get DE occupancy limits
108   TVector2 DEOccupancyLimits() const { return fDEOccupancyLimits; }
109   
110   void SetLimits(const AliMUONRecoParam& recoParams);
111
112   void Report(UInt_t mask);
113   
114   static Float_t SwitchValue(const TObjArray& dcsArray);
115   
116   Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
117   
118   Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
119
120   static void DecodeStatus(Int_t status, Int_t& pedStatus, Int_t& hvStatus, 
121                            Int_t&  gainStatus, Int_t& otherStatus);
122   static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus, 
123                            Int_t gainStatus, Int_t otherStatus);  
124 private:
125   /// Not implemented
126   AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
127   /// Not implemented
128   AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
129
130   
131   AliMUONVCalibParam* ComputeStatus(Int_t detElemId, Int_t manuId) const;
132
133   Bool_t HVSt12Status(Int_t detElemId, Int_t sector,
134                       Bool_t& hvChannelTooLow,
135                       Bool_t& hvChannelTooHigh,
136                       Bool_t& hvChannelON) const;
137   
138   
139   Bool_t HVSt345Status(Int_t detElemId, Int_t pcbIndex,
140                        Bool_t& hvChannelTooLow,
141                        Bool_t& hvChannelTooHigh,
142                        Bool_t& hvChannelON,
143                        Bool_t& hvSwitchON) const;
144
145   void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
146
147 private:
148   /// General status
149   enum EGeneralStatus
150   {
151     kMissing = (1<<7)
152   };
153
154   /// Gain status
155   enum EGainStatus
156   {
157     kGainOK = 0,
158     kGainA1TooLow = (1<<1),
159     kGainA1TooHigh = (1<<2),
160     kGainA2TooLow = (1<<3),
161     kGainA2TooHigh = (1<<4),
162     kGainThresTooLow = (1<<5),
163     kGainThresTooHigh = (1<<6),
164     
165     kGainMissing = kMissing // please always use last bit for meaning "missing"
166   };
167   
168   /// Pedestal status
169   enum EPedestalStatus
170   {
171     kPedOK = 0,
172     kPedMeanZero = (1<<1),
173     kPedMeanTooLow = (1<<2),
174     kPedMeanTooHigh = (1<<3),
175     kPedSigmaTooLow = (1<<4),
176     kPedSigmaTooHigh = (1<<5),
177     
178     kPedMissing = kMissing // please always use last bit for meaning "missing"
179   };
180   
181   /// HV Error
182   enum EHVError 
183   {
184     kHVOK = 0,
185     kHVError = (1<<0),
186     kHVTooLow = (1<<1),
187     kHVTooHigh = (1<<2), // no longer to be used
188     kHVChannelOFF = (1<<3),
189     kHVSwitchOFF = (1<<4),
190
191     kHVMissing = kMissing // please always use last bit for meaning "missing"
192   };
193   
194   /// Other
195   enum EOccupancyStatus
196   {
197     kManuOccupancyTooLow = (1<<1),
198     kManuOccupancyTooHigh = (1<<2),
199     kBusPatchOccupancyTooLow = (1<<3),
200     kBusPatchOccupancyTooHigh = (1<<4),
201     kDEOccupancyTooLow = (1<<5),
202     kDEOccupancyTooHigh = (1<<6)
203   };
204   
205   const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
206   
207   TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
208   TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
209   TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
210
211   Double_t fHVLimit[10]; //!< Low thresholds for HV
212
213   TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
214   TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
215   
216   TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
217   TVector2 fBuspatchOccupancyLimits; //!< Low and High buspatch occupancy limits
218   TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
219   
220   AliMUONVStore* fStatus; //!< statuses of the pads
221   
222   mutable TExMap* fHV; //!< cache of hv statuses
223
224   AliMUONVStore* fPedestals; //!< pedestal values
225   AliMUONVStore* fGains; //!< gain values
226   
227   AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
228   
229   ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
230 };
231
232 #endif