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