- Disentangle masks effect from trigger chamber efficiency estimation.
[u/mrichter/AliRoot.git] / MUON / AliMUONPadStatusMaker.h
CommitLineData
2c780493 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
1ed747b4 9/// \ingroup rec
2c780493 10/// \class AliMUONPadStatusMaker
11/// \brief Make a 2DStore of pad statuses, using different sources of information
12///
78649106 13// Author Laurent Aphecetche
2c780493 14
15#ifndef ROOT_TObject
16# include "TObject.h"
17#endif
18#ifndef ROOT_TVector2
19# include "TVector2.h"
20#endif
21
49e396d9 22class TExMap;
2c780493 23class AliMUONCalibrationData;
411a502a 24class AliMUONRecoParam;
49e396d9 25class AliMUONVCalibParam;
004a9ccd 26class AliMUONVTrackerData;
8d8e920c 27class AliMUONVStore;
2c780493 28
29class AliMUONPadStatusMaker : public TObject
30{
31public:
32 AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData);
33 virtual ~AliMUONPadStatusMaker();
0045b488 34
35 /// Get the reference to the calibrationdata object we use.
36 const AliMUONCalibrationData& CalibrationData() const { return fkCalibrationData; }
37
49e396d9 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; }
2c780493 43
49e396d9 44 AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
96199305 45
49e396d9 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);
004a9ccd 53
54 static TString AsCondition(Int_t status);
55
49e396d9 56 /// Return Low and High limits for a0 parameter of gain (linear slope)
49e396d9 57 TVector2 GainA1Limits() const { return fGainA1Limits; }
004a9ccd 58 /// Return Low and High limits for a1 parameter of gain (parabolic term)
59 TVector2 GainA2Limits() const { return fGainA2Limits; }
49e396d9 60 /// Return Low and High limits for thres parameter of gain
61 TVector2 GainThresLimits() const { return fGainThresLimits; }
62
32f1b761 63 /// Return HV threshold
64 Double_t HVLimit(Int_t chamberId) const;
2c780493 65
71a2d3aa 66 /// Return Low and High threshold for pedestal mean
2c780493 67 TVector2 PedMeanLimits() const { return fPedMeanLimits; }
71a2d3aa 68 /// Return Low and High threshold for pedestal sigma
2c780493 69 TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
70
49e396d9 71 /// Set Low and High limits for a0 parameter of gain (linear slope)
49e396d9 72 void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
004a9ccd 73 /// Set Low and High limits for a1 parameter of gain (parabolic term)
74 void GainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
49e396d9 75 /// Set Low and High limits for thres parameter of gain
76 void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
77
32f1b761 78 /// Set HV limit
79 void SetHVLimit(Int_t chamberId, Double_t hv);
2c780493 80
71a2d3aa 81 /// Set Low and High threshold for pedestal mean
2c780493 82 void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
71a2d3aa 83 /// Set Low and High threshold for pedestal sigma
2c780493 84 void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
85
004a9ccd 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; }
411a502a 97
98 /// Set Low and High bus patch occupancy limits
99 void SetBuspatchOccupancyLimits(float low, float high) { fBuspatchOccupancyLimits.Set(low,high); }
100 /// Get bus patch occupancy limits
101 TVector2 BuspatchOccupancyLimits() const { return fBuspatchOccupancyLimits; }
102
103 /// Set Low and High DE occupancy limits
104 void SetDEOccupancyLimits(float low, float high) { fDEOccupancyLimits.Set(low,high); }
105 /// Get DE occupancy limits
106 TVector2 DEOccupancyLimits() const { return fDEOccupancyLimits; }
107
108 void SetLimits(const AliMUONRecoParam& recoParams);
109
110 void Report(UInt_t mask);
004a9ccd 111
ca913045 112 static Float_t SwitchValue(const TObjArray& dcsArray);
113
b37b9546 114 Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
115
116 Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
f0856300 117
118 static void DecodeStatus(Int_t status, Int_t& pedStatus, Int_t& hvStatus,
119 Int_t& gainStatus, Int_t& otherStatus);
120 static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus,
121 Int_t gainStatus, Int_t otherStatus);
2c780493 122private:
71a2d3aa 123 /// Not implemented
2c780493 124 AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
71a2d3aa 125 /// Not implemented
2c780493 126 AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
49e396d9 127
2c780493 128
49e396d9 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;
2c780493 135
2c780493 136
49e396d9 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;
2c780493 142
49e396d9 143 void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
2c780493 144
2c780493 145private:
71a2d3aa 146 /// General status
96199305 147 enum EGeneralStatus
148 {
149 kMissing = (1<<7)
150 };
49e396d9 151
152 /// Gain status
153 enum EGainStatus
154 {
155 kGainOK = 0,
004a9ccd 156 kGainA1TooLow = (1<<1),
157 kGainA1TooHigh = (1<<2),
158 kGainA2TooLow = (1<<3),
159 kGainA2TooHigh = (1<<4),
49e396d9 160 kGainThresTooLow = (1<<5),
161 kGainThresTooHigh = (1<<6),
162
163 kGainMissing = kMissing // please always use last bit for meaning "missing"
164 };
96199305 165
71a2d3aa 166 /// Pedestal status
2c780493 167 enum EPedestalStatus
168 {
169 kPedOK = 0,
170 kPedMeanZero = (1<<1),
171 kPedMeanTooLow = (1<<2),
172 kPedMeanTooHigh = (1<<3),
173 kPedSigmaTooLow = (1<<4),
96199305 174 kPedSigmaTooHigh = (1<<5),
175
176 kPedMissing = kMissing // please always use last bit for meaning "missing"
2c780493 177 };
178
71a2d3aa 179 /// HV Error
2c780493 180 enum EHVError
181 {
182 kHVOK = 0,
183 kHVError = (1<<0),
184 kHVTooLow = (1<<1),
32f1b761 185 kHVTooHigh = (1<<2), // no longer to be used
2c780493 186 kHVChannelOFF = (1<<3),
96199305 187 kHVSwitchOFF = (1<<4),
188
189 kHVMissing = kMissing // please always use last bit for meaning "missing"
2c780493 190 };
191
004a9ccd 192 /// Other
7eafe398 193 enum EOccupancyStatus
004a9ccd 194 {
195 kManuOccupancyTooLow = (1<<1),
2b8a1212 196 kManuOccupancyTooHigh = (1<<2),
7eafe398 197 kBusPatchOccupancyTooLow = (1<<3),
198 kBusPatchOccupancyTooHigh = (1<<4),
199 kDEOccupancyTooLow = (1<<5),
4eef97dc 200 kDEOccupancyTooHigh = (1<<6)
004a9ccd 201 };
202
72dae9ff 203 const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
2c780493 204
004a9ccd 205 TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
206 TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
49e396d9 207 TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
208
32f1b761 209 Double_t fHVLimit[10]; //!< Low thresholds for HV
49e396d9 210
211 TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
212 TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
004a9ccd 213
214 TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
411a502a 215 TVector2 fBuspatchOccupancyLimits; //!< Low and High buspatch occupancy limits
7eafe398 216 TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
004a9ccd 217
49e396d9 218 AliMUONVStore* fStatus; //!< statuses of the pads
219
220 mutable TExMap* fHV; //!< cache of hv statuses
221
222 AliMUONVStore* fPedestals; //!< pedestal values
223 AliMUONVStore* fGains; //!< gain values
2c780493 224
004a9ccd 225 AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
226
2c780493 227 ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
228};
229
230#endif