Removing a useless dynamic_cast
[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();
33
49e396d9 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; }
2c780493 39
49e396d9 40 AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
96199305 41
49e396d9 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);
004a9ccd 49
50 static TString AsCondition(Int_t status);
51
49e396d9 52 /// Return Low and High limits for a0 parameter of gain (linear slope)
49e396d9 53 TVector2 GainA1Limits() const { return fGainA1Limits; }
004a9ccd 54 /// Return Low and High limits for a1 parameter of gain (parabolic term)
55 TVector2 GainA2Limits() const { return fGainA2Limits; }
49e396d9 56 /// Return Low and High limits for thres parameter of gain
57 TVector2 GainThresLimits() const { return fGainThresLimits; }
58
71a2d3aa 59 /// Return Low and High threshold for St12 HV
2c780493 60 TVector2 HVSt12Limits() const { return fHVSt12Limits; }
71a2d3aa 61 /// Return Low and High threshold for St345 HV
2c780493 62 TVector2 HVSt345Limits() const { return fHVSt345Limits; }
63
71a2d3aa 64 /// Return Low and High threshold for pedestal mean
2c780493 65 TVector2 PedMeanLimits() const { return fPedMeanLimits; }
71a2d3aa 66 /// Return Low and High threshold for pedestal sigma
2c780493 67 TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
68
49e396d9 69 /// Set Low and High limits for a0 parameter of gain (linear slope)
49e396d9 70 void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
004a9ccd 71 /// Set Low and High limits for a1 parameter of gain (parabolic term)
72 void GainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
49e396d9 73 /// Set Low and High limits for thres parameter of gain
74 void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
75
71a2d3aa 76 /// Set Low and High threshold for St12 HV
2c780493 77 void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
71a2d3aa 78 /// Set Low and High threshold for St345 HV
2c780493 79 void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
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; }
97
2c780493 98private:
71a2d3aa 99 /// Not implemented
2c780493 100 AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
71a2d3aa 101 /// Not implemented
2c780493 102 AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
49e396d9 103
004a9ccd 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);
2c780493 108
49e396d9 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;
2c780493 115
2c780493 116
49e396d9 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;
2c780493 122
49e396d9 123 Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
124
7eafe398 125 Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
004a9ccd 126
49e396d9 127 void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
2c780493 128
2c780493 129private:
71a2d3aa 130 /// General status
96199305 131 enum EGeneralStatus
132 {
133 kMissing = (1<<7)
134 };
49e396d9 135
136 /// Gain status
137 enum EGainStatus
138 {
139 kGainOK = 0,
004a9ccd 140 kGainA1TooLow = (1<<1),
141 kGainA1TooHigh = (1<<2),
142 kGainA2TooLow = (1<<3),
143 kGainA2TooHigh = (1<<4),
49e396d9 144 kGainThresTooLow = (1<<5),
145 kGainThresTooHigh = (1<<6),
146
147 kGainMissing = kMissing // please always use last bit for meaning "missing"
148 };
96199305 149
71a2d3aa 150 /// Pedestal status
2c780493 151 enum EPedestalStatus
152 {
153 kPedOK = 0,
154 kPedMeanZero = (1<<1),
155 kPedMeanTooLow = (1<<2),
156 kPedMeanTooHigh = (1<<3),
157 kPedSigmaTooLow = (1<<4),
96199305 158 kPedSigmaTooHigh = (1<<5),
159
160 kPedMissing = kMissing // please always use last bit for meaning "missing"
2c780493 161 };
162
71a2d3aa 163 /// HV Error
2c780493 164 enum EHVError
165 {
166 kHVOK = 0,
167 kHVError = (1<<0),
168 kHVTooLow = (1<<1),
169 kHVTooHigh = (1<<2),
170 kHVChannelOFF = (1<<3),
96199305 171 kHVSwitchOFF = (1<<4),
172
173 kHVMissing = kMissing // please always use last bit for meaning "missing"
2c780493 174 };
175
004a9ccd 176 /// Other
7eafe398 177 enum EOccupancyStatus
004a9ccd 178 {
179 kManuOccupancyTooLow = (1<<1),
2b8a1212 180 kManuOccupancyTooHigh = (1<<2),
7eafe398 181 kBusPatchOccupancyTooLow = (1<<3),
182 kBusPatchOccupancyTooHigh = (1<<4),
183 kDEOccupancyTooLow = (1<<5),
4eef97dc 184 kDEOccupancyTooHigh = (1<<6)
004a9ccd 185 };
186
72dae9ff 187 const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
2c780493 188
004a9ccd 189 TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
190 TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
49e396d9 191 TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
192
2c780493 193 TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
194 TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
49e396d9 195
196 TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
197 TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
004a9ccd 198
199 TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
7eafe398 200 TVector2 fBusPatchOccupancyLimits; //!< Low and High buspatch occupancy limits
201 TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
004a9ccd 202
49e396d9 203 AliMUONVStore* fStatus; //!< statuses of the pads
204
205 mutable TExMap* fHV; //!< cache of hv statuses
206
207 AliMUONVStore* fPedestals; //!< pedestal values
208 AliMUONVStore* fGains; //!< gain values
2c780493 209
004a9ccd 210 AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
211
2c780493 212 ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
213};
214
215#endif