Update of ACORDE-QA-Raw data histograms (now they go from -0.5 to 59.5)
[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
71a2d3aa 63 /// Return Low and High threshold for St12 HV
2c780493 64 TVector2 HVSt12Limits() const { return fHVSt12Limits; }
71a2d3aa 65 /// Return Low and High threshold for St345 HV
2c780493 66 TVector2 HVSt345Limits() const { return fHVSt345Limits; }
67
71a2d3aa 68 /// Return Low and High threshold for pedestal mean
2c780493 69 TVector2 PedMeanLimits() const { return fPedMeanLimits; }
71a2d3aa 70 /// Return Low and High threshold for pedestal sigma
2c780493 71 TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
72
49e396d9 73 /// Set Low and High limits for a0 parameter of gain (linear slope)
49e396d9 74 void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
004a9ccd 75 /// Set Low and High limits for a1 parameter of gain (parabolic term)
76 void GainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
49e396d9 77 /// Set Low and High limits for thres parameter of gain
78 void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
79
71a2d3aa 80 /// Set Low and High threshold for St12 HV
2c780493 81 void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
71a2d3aa 82 /// Set Low and High threshold for St345 HV
2c780493 83 void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
84
71a2d3aa 85 /// Set Low and High threshold for pedestal mean
2c780493 86 void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
71a2d3aa 87 /// Set Low and High threshold for pedestal sigma
2c780493 88 void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
89
004a9ccd 90 /// Set Low and High threshold for gain a0 term
91 void SetGainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
92 /// Set Low and High threshold for gain a1 term
93 void SetGainA2Limits(float low, float high) { fGainA2Limits.Set(low,high); }
94 /// Set Low and High threshold for gain threshold term
95 void SetGainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
96
97 /// Set Low and High manu occupancy limits
98 void SetManuOccupancyLimits(float low, float high) { fManuOccupancyLimits.Set(low,high); }
99 /// Get manu occupancy limits
100 TVector2 ManuOccupancyLimits() const { return fManuOccupancyLimits; }
411a502a 101
102 /// Set Low and High bus patch occupancy limits
103 void SetBuspatchOccupancyLimits(float low, float high) { fBuspatchOccupancyLimits.Set(low,high); }
104 /// Get bus patch occupancy limits
105 TVector2 BuspatchOccupancyLimits() const { return fBuspatchOccupancyLimits; }
106
107 /// Set Low and High DE occupancy limits
108 void SetDEOccupancyLimits(float low, float high) { fDEOccupancyLimits.Set(low,high); }
109 /// Get DE occupancy limits
110 TVector2 DEOccupancyLimits() const { return fDEOccupancyLimits; }
111
112 void SetLimits(const AliMUONRecoParam& recoParams);
113
114 void Report(UInt_t mask);
004a9ccd 115
ca913045 116 static Float_t SwitchValue(const TObjArray& dcsArray);
117
2c780493 118private:
71a2d3aa 119 /// Not implemented
2c780493 120 AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
71a2d3aa 121 /// Not implemented
2c780493 122 AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
49e396d9 123
004a9ccd 124 static void DecodeStatus(Int_t status, Int_t& pedStatus, Int_t& hvStatus,
125 Int_t& gainStatus, Int_t& otherStatus);
126 static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus,
127 Int_t gainStatus, Int_t otherStatus);
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 Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
144
7eafe398 145 Int_t OccupancyStatus(Int_t detElemId, Int_t manuId) const;
004a9ccd 146
49e396d9 147 void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
2c780493 148
2c780493 149private:
71a2d3aa 150 /// General status
96199305 151 enum EGeneralStatus
152 {
153 kMissing = (1<<7)
154 };
49e396d9 155
156 /// Gain status
157 enum EGainStatus
158 {
159 kGainOK = 0,
004a9ccd 160 kGainA1TooLow = (1<<1),
161 kGainA1TooHigh = (1<<2),
162 kGainA2TooLow = (1<<3),
163 kGainA2TooHigh = (1<<4),
49e396d9 164 kGainThresTooLow = (1<<5),
165 kGainThresTooHigh = (1<<6),
166
167 kGainMissing = kMissing // please always use last bit for meaning "missing"
168 };
96199305 169
71a2d3aa 170 /// Pedestal status
2c780493 171 enum EPedestalStatus
172 {
173 kPedOK = 0,
174 kPedMeanZero = (1<<1),
175 kPedMeanTooLow = (1<<2),
176 kPedMeanTooHigh = (1<<3),
177 kPedSigmaTooLow = (1<<4),
96199305 178 kPedSigmaTooHigh = (1<<5),
179
180 kPedMissing = kMissing // please always use last bit for meaning "missing"
2c780493 181 };
182
71a2d3aa 183 /// HV Error
2c780493 184 enum EHVError
185 {
186 kHVOK = 0,
187 kHVError = (1<<0),
188 kHVTooLow = (1<<1),
189 kHVTooHigh = (1<<2),
190 kHVChannelOFF = (1<<3),
96199305 191 kHVSwitchOFF = (1<<4),
192
193 kHVMissing = kMissing // please always use last bit for meaning "missing"
2c780493 194 };
195
004a9ccd 196 /// Other
7eafe398 197 enum EOccupancyStatus
004a9ccd 198 {
199 kManuOccupancyTooLow = (1<<1),
2b8a1212 200 kManuOccupancyTooHigh = (1<<2),
7eafe398 201 kBusPatchOccupancyTooLow = (1<<3),
202 kBusPatchOccupancyTooHigh = (1<<4),
203 kDEOccupancyTooLow = (1<<5),
4eef97dc 204 kDEOccupancyTooHigh = (1<<6)
004a9ccd 205 };
206
72dae9ff 207 const AliMUONCalibrationData& fkCalibrationData; //!< helper class to get data access (not owner)
2c780493 208
004a9ccd 209 TVector2 fGainA1Limits; //!< Low and High threshold for gain a0 parameter
210 TVector2 fGainA2Limits; //!< Low and High threshold for gain a1 parameter
49e396d9 211 TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
212
2c780493 213 TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
214 TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
49e396d9 215
216 TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
217 TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
004a9ccd 218
219 TVector2 fManuOccupancyLimits; //!< Low and High manu occupancy limits
411a502a 220 TVector2 fBuspatchOccupancyLimits; //!< Low and High buspatch occupancy limits
7eafe398 221 TVector2 fDEOccupancyLimits; //!< Low and High DE occupancy limits
004a9ccd 222
49e396d9 223 AliMUONVStore* fStatus; //!< statuses of the pads
224
225 mutable TExMap* fHV; //!< cache of hv statuses
226
227 AliMUONVStore* fPedestals; //!< pedestal values
228 AliMUONVStore* fGains; //!< gain values
2c780493 229
004a9ccd 230 AliMUONVTrackerData* fTrackerData; //!< to get occupancies...
231
2c780493 232 ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
233};
234
235#endif