ATLAS Offline Software
Loading...
Searching...
No Matches
TileCondToolMuID.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Tile includes
9
10// Calo includes
12
13// Athena includes
16
17
18//
19//____________________________________________________________________
20static const InterfaceID IID_TileCondToolMuID("TileCondToolMuID", 1, 0);
21const InterfaceID&
25
26//
27//____________________________________________________________________
28TileCondToolMuID::TileCondToolMuID(const std::string& type, const std::string& name, const IInterface* parent)
29 : AthAlgTool(type, name, parent)
30{
31 declareInterface<TileCondToolMuID>(this);
32}
33
34//
35//____________________________________________________________________
38
39//
40//____________________________________________________________________
42
43 ATH_MSG_DEBUG( "In initialize()" );
44
45 //=== Initialize MuID conditions data key
46 ATH_CHECK( m_calibMuIdKey.initialize() );
47
48 // Retrieve CaloIdManager
49 ATH_CHECK( detStore()->retrieve(m_caloID) );
50
51 return StatusCode::SUCCESS;
52}
53
54//
55//____________________________________________________________________
57 ATH_MSG_DEBUG( "finalize called" );
58 return StatusCode::SUCCESS;
59}
60
61//
62//____________________________________________________________________
63void TileCondToolMuID::getLowThreshold(Identifier & id, int & ros, int & module, int & index) const {
64
65 module = m_caloID->module(id);
66
67 if (m_caloID->is_tile_barrel(id) && m_caloID->is_tile_positive(id)) {
68
69 if (m_caloID->sample(id) == 0) {
70 index = m_caloID->tower(id);
71 }
72
73 if (m_caloID->sample(id) == 1) {
74 index = m_caloID->tower(id) + 10;
75 }
76
77 if (m_caloID->sample(id) == 2) {
78 index = m_caloID->tower(id) / 2 + 19;
79 }
80
81 ros = 1;
82
83 }
84
85 if (m_caloID->is_tile_barrel(id) && m_caloID->is_tile_negative(id)) {
86
87 if (m_caloID->sample(id) == 0) {
88 index = m_caloID->tower(id);
89 }
90
91 if (m_caloID->sample(id) == 1) {
92 index = m_caloID->tower(id) + 10;
93 }
94
95 if (m_caloID->sample(id) == 2) {
96 index = m_caloID->tower(id) / 2 + 19;
97 }
98
99 ros = 2;
100
101 }
102
103 if (m_caloID->is_tile_extbarrel(id) && m_caloID->is_tile_positive(id)) {
104
105 if (m_caloID->sample(id) == 0) {
106 index = m_caloID->tower(id) - 11;
107 }
108
109 if (m_caloID->sample(id) == 1) {
110 index = m_caloID->tower(id) - 4;
111 }
112
113 if (m_caloID->sample(id) == 2) {
114 index = m_caloID->tower(id) / 2 + 7;
115 }
116
117 ros = 3;
118
119 }
120
121 if (m_caloID->is_tile_gap(id) && m_caloID->is_tile_positive(id)) {
122
123 if (m_caloID->sample(id) == 1) {
124 index = 5;
125 }
126
127 if (m_caloID->sample(id) == 2) {
128 index = 11;
129 }
130
131 ros = 3;
132
133 }
134
135 if (m_caloID->is_tile_extbarrel(id) && m_caloID->is_tile_negative(id)) {
136
137 if (m_caloID->sample(id) == 0) {
138 index = m_caloID->tower(id) - 11;
139 }
140
141 if (m_caloID->sample(id) == 1) {
142 index = m_caloID->tower(id) - 4;
143 }
144
145 if (m_caloID->sample(id) == 2) {
146 index = m_caloID->tower(id) / 2 + 7;
147 }
148
149 ros = 4;
150
151 }
152
153 if (m_caloID->is_tile_gap(id) && m_caloID->is_tile_negative(id)) {
154
155 if (m_caloID->sample(id) == 1) {
156 index = 5;
157 }
158
159 if (m_caloID->sample(id) == 2) {
160 index = 11;
161 }
162
163 ros = 4;
164
165 }
166
167}
168
169//
170//____________________________________________________________________
171void TileCondToolMuID::getHighThreshold(Identifier & id, int & ros, int & module, int & index) const {
172
173 index = ros = -999;
174 module = m_caloID->module(id);
175
176 if (m_caloID->is_tile_barrel(id) && m_caloID->is_tile_positive(id)) {
177
178 if (m_caloID->sample(id) == 0) {
179 index = m_caloID->tower(id) + 23;
180 }
181
182 if (m_caloID->sample(id) == 1) {
183 index = m_caloID->tower(id) + 10 + 23;
184 }
185
186 if (m_caloID->sample(id) == 2) {
187 index = m_caloID->tower(id) / 2 + 19 + 23;
188 }
189
190 ros = 1;
191
192 }
193
194 if (m_caloID->is_tile_barrel(id) && m_caloID->is_tile_negative(id)) {
195
196 if (m_caloID->sample(id) == 0) {
197 index = m_caloID->tower(id) + 23;
198 }
199
200 if (m_caloID->sample(id) == 1) {
201 index = m_caloID->tower(id) + 10 + 23;
202 }
203
204 if (m_caloID->sample(id) == 2) {
205 index = m_caloID->tower(id) / 2 + 19 + 23;
206 }
207
208 ros = 2;
209
210 }
211
212 if (m_caloID->is_tile_extbarrel(id) && m_caloID->is_tile_positive(id)) {
213
214 if (m_caloID->sample(id) == 0) {
215 index = m_caloID->tower(id) - 11 + 14;
216 }
217
218 if (m_caloID->sample(id) == 1) {
219 index = m_caloID->tower(id) - 4 + 14;
220 }
221
222 if (m_caloID->sample(id) == 2) {
223 index = m_caloID->tower(id) / 2 + 7 + 14;
224 }
225
226 ros = 3;
227
228 }
229
230 if (m_caloID->is_tile_gap(id) && m_caloID->is_tile_positive(id)) {
231
232 if (m_caloID->sample(id) == 1) {
233 index = 5 + 14;
234 }
235
236 if (m_caloID->sample(id) == 2) {
237 index = 11 + 14;
238 }
239
240 ros = 3;
241
242 }
243
244 if (m_caloID->is_tile_extbarrel(id) && m_caloID->is_tile_negative(id)) {
245
246 if (m_caloID->sample(id) == 0) {
247 index = m_caloID->tower(id) - 11 + 14;
248 }
249
250 if (m_caloID->sample(id) == 1) {
251 index = m_caloID->tower(id) - 4 + 14;
252 }
253
254 if (m_caloID->sample(id) == 2) {
255 index = m_caloID->tower(id) / 2 + 7 + 14;
256 }
257
258 ros = 4;
259
260 }
261
262 if (m_caloID->is_tile_gap(id) && m_caloID->is_tile_negative(id)) {
263
264 if (m_caloID->sample(id) == 1) {
265 index = 5 + 14;
266 }
267
268 if (m_caloID->sample(id) == 2) {
269 index = 11 + 14;
270 }
271
272 ros = 4;
273
274 }
275
276}
277
278//
279//____________________________________________________________________
281
282 int ros;
283 int module;
284 int index;
285
286 getLowThreshold(id, ros, module, index);
287
288 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, module);
289
291 int nValues = calibMuID->getCalibDrawer(drawerIdx)->getObjSizeUint32();
292
293
294 if (index >= nValues) {
295 ATH_MSG_ERROR( "getLowThresholdValue: index out of range! -> ros/mod/num_values/ind "
296 << ros << " " << module << " " << nValues << " " << index );
297 return -999.;
298 } else {
299 ATH_MSG_DEBUG( "getLowThresholdValue: ros/mod/drawer_ind/num_values/ind " << ros << " "
300 << module << " " << drawerIdx << " " << nValues << " " << index );
301
302 return calibMuID->getCalibDrawer(drawerIdx)->getData(0, 0, index);
303 }
304}
305
306//
307//____________________________________________________________________
309
310 int ros;
311 int module;
312 int index;
313
314 getHighThreshold(id, ros, module, index);
315
316 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, module);
317
319 int nValues = calibMuID->getCalibDrawer(drawerIdx)->getObjSizeUint32();
320
321 if (index >= nValues) {
322 ATH_MSG_ERROR( "getHighThresholdValue: index out of range! -> ros/mod/num_values/ind "
323 << ros << " " << module << " " << nValues << " " << index );
324
325 return -999.;
326 } else {
327 ATH_MSG_DEBUG( "getHighThresholdValue: ros/mod/drawer_ind/num_values/ind " << ros << " "
328 << module << " " << drawerIdx << " " << nValues << " " << index );
329
330 return calibMuID->getCalibDrawer(drawerIdx)->getData(0, 0, index);
331
332 }
333}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
Helpers for checking error return status codes and reporting errors.
static const InterfaceID IID_TileCondToolMuID("TileCondToolMuID", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
virtual StatusCode finalize() override
float getLowThresholdValue(Identifier id) const
void getLowThreshold(Identifier &id, int &ros, int &module, int &index) const
void getHighThreshold(Identifier &id, int &ros, int &module, int &index) const
float getHighThresholdValue(Identifier id) const
SG::ReadCondHandleKey< TileCalibDataFlt > m_calibMuIdKey
const CaloCell_ID * m_caloID
virtual StatusCode initialize() override
static const InterfaceID & interfaceID()
TileCondToolMuID(const std::string &type, const std::string &name, const IInterface *parent)
Definition index.py:1