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