Leftover from previous commit
[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;
49e396d9 24class AliMUONVCalibParam;
004a9ccd 25class AliMUONVTrackerData;
8d8e920c 26class AliMUONVStore;
2c780493 27
28class AliMUONPadStatusMaker : public TObject
29{
30public:
31 AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData);
32 virtual ~AliMUONPadStatusMaker();
0045b488 33
34 /// Get the reference to the calibrationdata object we use.
35 const AliMUONCalibrationData& CalibrationData() const { return fkCalibrationData; }
36
49e396d9 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; }
2c780493 42
49e396d9 43 AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
96199305 44
49e396d9 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);
004a9ccd 52
53 static TString AsCondition(Int_t status);
54
49e396d9 55 /// Return Low and High limits for a0 parameter of gain (linear slope)
49e396d9 56 TVector2 GainA1Limits() const { return fGainA1Limits; }
004a9ccd 57 /// Return Low and High limits for a1 parameter of gain (parabolic term)
58 TVector2 GainA2Limits() const { return fGainA2Limits; }
49e396d9 59 /// Return Low and High limits for thres parameter of gain
60 TVector2 GainThresLimits() const { return fGainThresLimits; }
61
71a2d3aa 62 /// Return Low and High threshold for St12 HV
2c780493 63 TVector2 HVSt12Limits() const { return fHVSt12Limits; }
71a2d3aa 64 /// Return Low and High threshold for St345 HV
2c780493 65 TVector2 HVSt345Limits() const { return fHVSt345Limits; }
66
71a2d3aa 67 /// Return Low and High threshold for pedestal mean
2c780493 68 TVector2 PedMeanLimits() const { return fPedMeanLimits; }
71a2d3aa 69 /// Return Low and High threshold for pedestal sigma
2c780493 70 TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
71
49e396d9 72 /// Set Low and High limits for a0 parameter of gain (linear slope)
49e396d9 73 void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
004a9ccd 74 /// Set Low and High limits for a1 parameter of gain (parabolic term)
75 void GainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
49e396d9 76 /// Set Low and High limits for thres parameter of gain
77 void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
78
71a2d3aa 79 /// Set Low and High threshold for St12 HV
2c780493 80 void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
71a2d3aa 81 /// Set Low and High threshold for St345 HV
2c780493 82 void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
83
71a2d3aa 84 /// Set Low and High threshold for pedestal mean
2c780493 85 void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
71a2d3aa 86 /// Set Low and High threshold for pedestal sigma
2c780493 87 void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
88
004a9ccd 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
2c780493 101private:
71a2d3aa 102 /// Not implemented
2c780493 103 AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
71a2d3aa 104 /// Not implemented
2c780493 105 AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
49e396d9 106
004a9ccd 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);
2c780493 111
49e396d9 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;
2c780493 118
2c780493 119
49e396d9 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;
2c780493 125
49e396d9 126 Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
127
7eafe398 128 Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
004a9ccd 129
49e396d9 130 void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
2c780493 131
2c780493 132private:
71a2d3aa 133 /// General status
96199305 134 enum EGeneralStatus
135 {
136 kMissing = (1<<7)
137 };
49e396d9 138
139 /// Gain status
140 enum EGainStatus
141 {
142 kGainOK = 0,
004a9ccd 143 kGainA1TooLow = (1<<1),
144 kGainA1TooHigh = (1<<2),
145 kGainA2TooLow = (1<<3),
146 kGainA2TooHigh = (1<<4),
49e396d9 147 kGainThresTooLow = (1<<5),
148 kGainThresTooHigh = (1<<6),
149
150 kGainMissing = kMissing // please always use last bit for meaning "missing"
151 };
96199305 152
71a2d3aa 153 /// Pedestal status
2c780493 154 enum EPedestalStatus
155 {
156 kPedOK = 0,
157 kPedMeanZero = (1<<1),
158 kPedMeanTooLow = (1<<2),
159 kPedMeanTooHigh = (1<<3),
160 kPedSigmaTooLow = (1<<4),
96199305 161 kPedSigmaTooHigh = (1<<5),
162
163 kPedMissing = kMissing // please always use last bit for meaning "missing"
2c780493 164 };
165
71a2d3aa 166 /// HV Error
2c780493 167 enum EHVError
168 {
169 kHVOK = 0,
170 kHVError = (1<<0),
171 kHVTooLow = (1<<1),
172 kHVTooHigh = (1<<2),
173 kHVChannelOFF = (1<<3),
96199305 174 kHVSwitchOFF = (1<<4),
175
176 kHVMissing = kMissing // please always use last bit for meaning "missing"
2c780493 177 };
178
004a9ccd 179 /// Other
7eafe398 180 enum EOccupancyStatus
004a9ccd 181 {
182 kManuOccupancyTooLow = (1<<1),
2b8a1212 183 kManuOccupancyTooHigh = (1<<2),
7eafe398 184 kBusPatchOccupancyTooLow = (1<<3),
185 kBusPatchOccupancyTooHigh = (1<<4),
186 kDEOccupancyTooLow = (1<<5),
4eef97dc 187 kDEOccupancyTooHigh = (1<<6)
004a9ccd 188 };
189
72dae9ff 190 const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
2c780493 191
004a9ccd 192 TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
193 TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
49e396d9 194 TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
195
2c780493 196 TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
197 TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
49e396d9 198
199 TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
200 TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
004a9ccd 201
202 TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
7eafe398 203 TVector2 fBusPatchOccupancyLimits; //!< Low and High buspatch occupancy limits
204 TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
004a9ccd 205
49e396d9 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
2c780493 212
004a9ccd 213 AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
214
2c780493 215 ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
216};
217
218#endif