]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPadStatusMaker.h
Adding data corruption recovery procedure for magnetic field = 0 runs. (http://savann...
[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 class AliMUONPadStatusMaker : public TObject
30 {
31 public:
32   AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData);
33   virtual ~AliMUONPadStatusMaker();
34   
35   /// Get the reference to the calibrationdata object we use.
36   const AliMUONCalibrationData& CalibrationData() const { return fkCalibrationData; }
37   
38   /** Get access to internal status store (for debug only, as it may not be complete,
39     depending on whether you've already called PadStatus for all possible de,manu
40     combinations or not...
41     */
42   AliMUONVStore* StatusStore() const { return fStatus; }
43
44   AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
45
46   Int_t PadStatus(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
47   
48   AliMUONVStore* NeighboursStore() const;
49   
50   AliMUONVCalibParam* Neighbours(Int_t detElemId, Int_t manuId) const;
51   
52   static TString AsString(Int_t status);
53
54   static TString AsCondition(Int_t status);
55
56   /// Return Low and High limits for a0 parameter of gain (linear slope)
57   TVector2 GainA1Limits() const { return fGainA1Limits; }
58   /// Return Low and High limits for a1 parameter of gain (parabolic term)
59   TVector2 GainA2Limits() const { return fGainA2Limits; }
60   /// Return Low and High limits for thres parameter of gain
61   TVector2 GainThresLimits() const { return fGainThresLimits; }
62   
63   /// Return Low and High threshold for St12 HV
64   TVector2 HVSt12Limits() const { return fHVSt12Limits; }
65   /// Return Low and High threshold for St345 HV
66   TVector2 HVSt345Limits() const { return fHVSt345Limits; }
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 Low and High threshold for St12 HV
81   void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
82   /// Set Low and High threshold for St345 HV
83   void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
84
85   /// Set Low and High threshold for pedestal mean
86   void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
87   /// Set Low and High threshold for pedestal sigma 
88   void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
89   
90         /// Set Low and High threshold for gain a0 term
91         void SetGainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
92         /// Set Low and High threshold for gain a1 term
93         void SetGainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
94         /// Set Low and High threshold for gain threshold term
95         void SetGainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
96         
97   /// Set Low and High manu occupancy limits
98   void SetManuOccupancyLimits(float low, float high) { fManuOccupancyLimits.Set(low,high); }
99   /// Get manu occupancy limits
100   TVector2 ManuOccupancyLimits() const { return fManuOccupancyLimits; }
101
102   /// Set Low and High bus patch occupancy limits
103   void SetBuspatchOccupancyLimits(float low, float high) { fBuspatchOccupancyLimits.Set(low,high); }
104   /// Get bus patch occupancy limits
105   TVector2 BuspatchOccupancyLimits() const { return fBuspatchOccupancyLimits; }
106
107   /// Set Low and High DE occupancy limits
108   void SetDEOccupancyLimits(float low, float high) { fDEOccupancyLimits.Set(low,high); }
109   /// Get DE occupancy limits
110   TVector2 DEOccupancyLimits() const { return fDEOccupancyLimits; }
111   
112   void SetLimits(const AliMUONRecoParam& recoParams);
113
114   void Report(UInt_t mask);
115   
116   static Float_t SwitchValue(const TObjArray& dcsArray);
117   
118 private:
119   /// Not implemented
120   AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
121   /// Not implemented
122   AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
123
124   static void DecodeStatus(Int_t status, Int_t& pedStatus, Int_t& hvStatus, 
125                            Int_t&  gainStatus, Int_t& otherStatus);
126   static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus, 
127                            Int_t gainStatus, Int_t otherStatus);
128   
129   AliMUONVCalibParam* ComputeStatus(Int_t detElemId, Int_t manuId) const;
130
131   Bool_t HVSt12Status(Int_t detElemId, Int_t sector,
132                       Bool_t& hvChannelTooLow,
133                       Bool_t& hvChannelTooHigh,
134                       Bool_t& hvChannelON) const;
135   
136   
137   Bool_t HVSt345Status(Int_t detElemId, Int_t pcbIndex,
138                        Bool_t& hvChannelTooLow,
139                        Bool_t& hvChannelTooHigh,
140                        Bool_t& hvChannelON,
141                        Bool_t& hvSwitchON) const;
142
143   Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
144
145   Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
146   
147   void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
148
149 private:
150   /// General status
151   enum EGeneralStatus
152   {
153     kMissing = (1<<7)
154   };
155
156   /// Gain status
157   enum EGainStatus
158   {
159     kGainOK = 0,
160     kGainA1TooLow = (1<<1),
161     kGainA1TooHigh = (1<<2),
162     kGainA2TooLow = (1<<3),
163     kGainA2TooHigh = (1<<4),
164     kGainThresTooLow = (1<<5),
165     kGainThresTooHigh = (1<<6),
166     
167     kGainMissing = kMissing // please always use last bit for meaning "missing"
168   };
169   
170   /// Pedestal status
171   enum EPedestalStatus
172   {
173     kPedOK = 0,
174     kPedMeanZero = (1<<1),
175     kPedMeanTooLow = (1<<2),
176     kPedMeanTooHigh = (1<<3),
177     kPedSigmaTooLow = (1<<4),
178     kPedSigmaTooHigh = (1<<5),
179     
180     kPedMissing = kMissing // please always use last bit for meaning "missing"
181   };
182   
183   /// HV Error
184   enum EHVError 
185   {
186     kHVOK = 0,
187     kHVError = (1<<0),
188     kHVTooLow = (1<<1),
189     kHVTooHigh = (1<<2),
190     kHVChannelOFF = (1<<3),
191     kHVSwitchOFF = (1<<4),
192
193     kHVMissing = kMissing // please always use last bit for meaning "missing"
194   };
195   
196   /// Other
197   enum EOccupancyStatus
198   {
199     kManuOccupancyTooLow = (1<<1),
200     kManuOccupancyTooHigh = (1<<2),
201     kBusPatchOccupancyTooLow = (1<<3),
202     kBusPatchOccupancyTooHigh = (1<<4),
203     kDEOccupancyTooLow = (1<<5),
204     kDEOccupancyTooHigh = (1<<6)
205   };
206   
207   const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
208   
209   TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
210   TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
211   TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
212
213   TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
214   TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
215
216   TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
217   TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
218   
219   TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
220   TVector2 fBuspatchOccupancyLimits; //!< Low and High buspatch occupancy limits
221   TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
222   
223   AliMUONVStore* fStatus; //!< statuses of the pads
224   
225   mutable TExMap* fHV; //!< cache of hv statuses
226
227   AliMUONVStore* fPedestals; //!< pedestal values
228   AliMUONVStore* fGains; //!< gain values
229   
230   AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
231   
232   ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
233 };
234
235 #endif