- singleton functionality added for component and configuration handler
[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;
8d8e920c 25class AliMUONVStore;
2c780493 26
27class AliMUONPadStatusMaker : public TObject
28{
29public:
30 AliMUONPadStatusMaker(const AliMUONCalibrationData& calibData);
31 virtual ~AliMUONPadStatusMaker();
32
49e396d9 33 /** Get access to internal status store (for debug only, as it may not be complete,
34 depending on whether you've already called PadStatus for all possible de,manu
35 combinations or not...
36 */
37 AliMUONVStore* StatusStore() const { return fStatus; }
2c780493 38
49e396d9 39 AliMUONVCalibParam* PadStatus(Int_t detElemId, Int_t manuId) const;
96199305 40
49e396d9 41 Int_t PadStatus(Int_t detElemId, Int_t manuId, Int_t manuChannel) const;
42
43 AliMUONVStore* NeighboursStore() const;
44
45 AliMUONVCalibParam* Neighbours(Int_t detElemId, Int_t manuId) const;
46
47 static TString AsString(Int_t status);
48
49 /// Return Low and High limits for a0 parameter of gain (linear slope)
50 TVector2 GainA0Limits() const { return fGainA0Limits; }
51 /// Return Low and High limits for a1 parameter of gain (parabolic term)
52 TVector2 GainA1Limits() const { return fGainA1Limits; }
53 /// Return Low and High limits for thres parameter of gain
54 TVector2 GainThresLimits() const { return fGainThresLimits; }
55
71a2d3aa 56 /// Return Low and High threshold for St12 HV
2c780493 57 TVector2 HVSt12Limits() const { return fHVSt12Limits; }
71a2d3aa 58 /// Return Low and High threshold for St345 HV
2c780493 59 TVector2 HVSt345Limits() const { return fHVSt345Limits; }
60
71a2d3aa 61 /// Return Low and High threshold for pedestal mean
2c780493 62 TVector2 PedMeanLimits() const { return fPedMeanLimits; }
71a2d3aa 63 /// Return Low and High threshold for pedestal sigma
2c780493 64 TVector2 PedSigmaLimits() const { return fPedSigmaLimits; }
65
49e396d9 66 /// Set Low and High limits for a0 parameter of gain (linear slope)
67 void GainA0Limits(float low, float high) { fGainA0Limits.Set(low,high); }
68 /// Set Low and High limits for a1 parameter of gain (parabolic term)
69 void GainA1Limits(float low, float high) { fGainA1Limits.Set(low,high); }
70 /// Set Low and High limits for thres parameter of gain
71 void GainThresLimits(float low, float high) { fGainThresLimits.Set(low,high); }
72
71a2d3aa 73 /// Set Low and High threshold for St12 HV
2c780493 74 void SetHVSt12Limits(float low, float high) { fHVSt12Limits.Set(low,high); }
71a2d3aa 75 /// Set Low and High threshold for St345 HV
2c780493 76 void SetHVSt345Limits(float low, float high) { fHVSt345Limits.Set(low,high); }
77
71a2d3aa 78 /// Set Low and High threshold for pedestal mean
2c780493 79 void SetPedMeanLimits(float low, float high) { fPedMeanLimits.Set(low,high); }
71a2d3aa 80 /// Set Low and High threshold for pedestal sigma
2c780493 81 void SetPedSigmaLimits(float low, float high) { fPedSigmaLimits.Set(low,high); }
82
83private:
71a2d3aa 84 /// Not implemented
2c780493 85 AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
71a2d3aa 86 /// Not implemented
2c780493 87 AliMUONPadStatusMaker& operator=(const AliMUONPadStatusMaker&);
49e396d9 88
89 static void DecodeStatus(Int_t status, Int_t& pedStatus, Int_t& hvStatus, Int_t& gainStatus);
90 static Int_t BuildStatus(Int_t pedStatus, Int_t hvStatus, Int_t gainStatus);
2c780493 91
49e396d9 92 AliMUONVCalibParam* ComputeStatus(Int_t detElemId, Int_t manuId) const;
93
94 Bool_t HVSt12Status(Int_t detElemId, Int_t sector,
95 Bool_t& hvChannelTooLow,
96 Bool_t& hvChannelTooHigh,
97 Bool_t& hvChannelON) const;
2c780493 98
2c780493 99
49e396d9 100 Bool_t HVSt345Status(Int_t detElemId, Int_t pcbIndex,
101 Bool_t& hvChannelTooLow,
102 Bool_t& hvChannelTooHigh,
103 Bool_t& hvChannelON,
104 Bool_t& hvSwitchON) const;
2c780493 105
49e396d9 106 Int_t HVStatus(Int_t detElemId, Int_t manuId) const;
107
108 void SetHVStatus(Int_t detElemId, Int_t index, Int_t status) const;
2c780493 109
2c780493 110private:
71a2d3aa 111 /// General status
96199305 112 enum EGeneralStatus
113 {
114 kMissing = (1<<7)
115 };
49e396d9 116
117 /// Gain status
118 enum EGainStatus
119 {
120 kGainOK = 0,
121 kGainA0TooLow = (1<<1),
122 kGainA0TooHigh = (1<<2),
123 kGainA1TooLow = (1<<3),
124 kGainA1TooHigh = (1<<4),
125 kGainThresTooLow = (1<<5),
126 kGainThresTooHigh = (1<<6),
127
128 kGainMissing = kMissing // please always use last bit for meaning "missing"
129 };
96199305 130
71a2d3aa 131 /// Pedestal status
2c780493 132 enum EPedestalStatus
133 {
134 kPedOK = 0,
135 kPedMeanZero = (1<<1),
136 kPedMeanTooLow = (1<<2),
137 kPedMeanTooHigh = (1<<3),
138 kPedSigmaTooLow = (1<<4),
96199305 139 kPedSigmaTooHigh = (1<<5),
140
141 kPedMissing = kMissing // please always use last bit for meaning "missing"
2c780493 142 };
143
71a2d3aa 144 /// HV Error
2c780493 145 enum EHVError
146 {
147 kHVOK = 0,
148 kHVError = (1<<0),
149 kHVTooLow = (1<<1),
150 kHVTooHigh = (1<<2),
151 kHVChannelOFF = (1<<3),
96199305 152 kHVSwitchOFF = (1<<4),
153
154 kHVMissing = kMissing // please always use last bit for meaning "missing"
2c780493 155 };
156
157 const AliMUONCalibrationData& fCalibrationData; //!< helper class to get data access (not owner)
2c780493 158
49e396d9 159 TVector2 fGainA0Limits; //!< Low and High threshold for gain a0 parameter
160 TVector2 fGainA1Limits; //!< Low and High threshold for gain a1 parameter
161 TVector2 fGainThresLimits; //!< Low and High threshold for gain threshold parameter
162
2c780493 163 TVector2 fHVSt12Limits; //!< Low and High threshold for St12 HV
164 TVector2 fHVSt345Limits; //!< Low and High threshold for St345 HV
49e396d9 165
166 TVector2 fPedMeanLimits; //!< Low and High threshold for pedestal mean
167 TVector2 fPedSigmaLimits; //!< Low and High threshold for pedestal sigma
168
169 AliMUONVStore* fStatus; //!< statuses of the pads
170
171 mutable TExMap* fHV; //!< cache of hv statuses
172
173 AliMUONVStore* fPedestals; //!< pedestal values
174 AliMUONVStore* fGains; //!< gain values
2c780493 175
176 ClassDef(AliMUONPadStatusMaker,0) // Creates pad statuses from ped,gain,hv
177};
178
179#endif