Execute method.
76 {
77 unsigned eventNb = ctx.eventID().event_number();
78
79 ATH_MSG_INFO (
"======== executing event "<< eventNb <<
" ========" );
80
81
82
83 const LArDigitContainer* larDigitCont = nullptr;
85
86
87 const LArCalibParams* calibParams = nullptr;
89
90 SG::ReadCondHandle<LArBadChannelCont> readHandle(
m_BCKey, ctx);
92 if(!bcCont) {
94 return StatusCode::FAILURE;
95 }
96
97 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl(
m_cablingKey, ctx);
98 const LArOnOffIdMapping*
cabling=*cablingHdl;
99 if(!cabling) {
100 ATH_MSG_ERROR(
"Do not have cabling object LArOnOffIdMapping" );
101 return StatusCode::FAILURE;
102 }
103
104 SG::ReadCondHandle<LArCalibLineMapping> clHdl(
m_CLKey, ctx);
105 const LArCalibLineMapping *clCont {*clHdl};
106 if(!clCont) {
108 return StatusCode::FAILURE;
109 }
110
111
112
116
119
120 int cellsCounter = 0;
121
122 int inconsistencyCounter = 0;
123 int disconnectedCounter = 0;
124 int badChannelCounter = 0;
125
126 bool signalPresent;
127 bool pulsed;
128 bool badChannel;
129 bool disconnected;
130
131
132 std::ostringstream ErrorList;
133
134
135 for (const LArDigit* digit : *larDigitCont) {
136 cellsCounter++;
137
138 ErrorList.clear();
139
140
141 const HWIdentifier online_id =
digit->hardwareID();
143
145
146
147 if (!
cabling->isOnlineConnected(online_id)) {
148 disconnected = true;
149 disconnectedCounter++;
150 } else
151 disconnected = false;
152
153 Identifier offline_id;
154
155
156 bool noOffline_id = false;
157 try {
158 offline_id =
cabling->cnvToIdentifier(online_id);
159 }
160 catch (const LArID_Exception&) {
161 noOffline_id = true;
162 }
163
164
165
166 const int max = *max_element(
digit->samples().begin(),
digit->samples().end());
168 signalPresent = true;
169 else
170 signalPresent = false;
171
172
173
174 pulsed = false;
175 int DACvalue = -1;
176 std::ostringstream PulserList;
177 const std::vector<HWIdentifier>& calibChannelIDs=clCont->
calibSlotLine(online_id);
178
179 for (HWIdentifier hwid : calibChannelIDs) {
180
181 bool isPulsed=calibParams->
isPulsed(eventNb, hwid);
182 if (isPulsed) {
183 int DACvalue_temp = calibParams->
DAC(eventNb, hwid);
184 if (DACvalue_temp > DACvalue)
185 DACvalue = DACvalue_temp;
186 pulsed = true;
189 PulserList << std::hex << hwid.get_compact() << std::dec <<
" " << slot <<
" " <<
line <<
" ";
190 }
191 }
192
193
195 bool DACOverThreshold;
196 switch (gain) {
199 break;
202 break;
205 break;
206 default:
208 }
209
210
213 badChannel = false;
214 } else {
215 badChannel = true;
216 badChannelCounter++;
217 }
218 } else {
219 badChannel = false;
220 }
221
222
223
224 bool inconsistency = (signalPresent != pulsed) && DACOverThreshold;
225 if (inconsistency)
226 inconsistencyCounter++;
227
228 bool errorInCell = inconsistency || badChannel;
229 if (errorInCell)
231
232 std::ostringstream CellData;
233 CellData <<
"0x" << std::hex << std::setw(8) << febid.
get_compact() << std::dec
236 << std::setw(5) << chNb;
237
238 CellData << std::setw(5);
239 if (noOffline_id)
240 CellData << "-";
241 else
242 CellData <<
m_emId->sampling(offline_id);
243
244 CellData << std::setw(5);
245 if (noOffline_id)
246 CellData << "-";
247 else
248 CellData <<
m_emId->eta(offline_id);
249
250 CellData << std::setw(5);
251 if (noOffline_id)
252 CellData << "-";
253 else
254 CellData <<
m_emId->phi(offline_id);
255
256 CellData << std::setw(7) <<
max;
257 if (DACvalue >= 0)
258 CellData << std::setw(7) << DACvalue;
259 else
260 CellData << std::setw(7) << "-";
261
262 if (disconnected) {
264 ErrorList << " D ";
265 ErrorList << CellData.str() << std::endl;
266 }
267 }
268 else {
269
270 if (errorInCell)
271 (*m_errorcellsThisEvent)[
m_onlineHelper->channel_Hash(online_id)] =
true;
272
274 if (inconsistency)
275 ErrorList << "I";
276 else
277 ErrorList << " ";
278 if (pulsed)
279 ErrorList << "P";
280 else
281 ErrorList << " ";
282 if (signalPresent)
283 ErrorList << "S";
284 else
285 ErrorList << " ";
286 if (badChannel)
287 ErrorList << "B ";
288 else
289 ErrorList << " ";
290
291 ErrorList << CellData.str();
292
293 if (pulsed)
294 ErrorList << " " << PulserList.str();
295
296 ErrorList << std::endl;
297 }
298 }
299 }
300
301 ErrorList << std::endl;
302
304 ErrorList << "Examined " << cellsCounter << " cells in event " << eventNb << ". Found:" << std::endl;
305 ErrorList << std::left << std::setw(25) << "Inconsistencies: "
306 << std::right << std::setw(4) << inconsistencyCounter << std::endl;
307 ErrorList << std::left << std::setw(25) << "Bad cells: "
308 << std::right << std::setw(4) << badChannelCounter << std::endl;
309 ErrorList << std::left << std::setw(25) << "Sum errors: "
311 ErrorList << std::left << std::setw(25) << "Disconnected cells: "
312 << std::right << std::setw(4) << disconnectedCounter << std::endl;
313 ErrorList << std::endl;
314 }
315
317
319
321 }
322 else {
323
327
329 m_outfile <<
"Error in event "<< std::setw(7) << eventNb
330 << " ==========================================================================" << std::endl;
331 m_outfile <<
"I=Inconsistency P=Pulsed S=Signal B=Bad D=Disconnected" << std::endl;
333 << std::left << std::setw(10) << "FEB"
334 << std::right << std::setw(5) << "FT"
335 << std::setw(5) << "SL"
336 << std::setw(5) << "CH"
337 << std::setw(5) << "Smpl"
338 << std::setw(5) << "Eta"
339 << std::setw(5) << "Phi"
340 << std::setw(7) << "ADC"
341 << std::setw(7) << "DAC"
342 << " Pulsed by calibchannel slot line"
343 << std::endl;
344
346 }
347
349 }
350 }
351 else {
352 m_outfile <<
"Status of event "<< std::setw(7) << eventNb
353 << " ==========================================================================" << std::endl;
354 m_outfile <<
"I=Inconsistency P=Pulsed S=Signal B=Bad D=Disconnected" << std::endl;
356 << std::left << std::setw(10) << "FEB"
357 << std::right << std::setw(5) << "FT"
358 << std::setw(5) << "SL"
359 << std::setw(5) << "CH"
360 << std::setw(5) << "Smpl"
361 << std::setw(5) << "Eta"
362 << std::setw(5) << "Phi"
363 << std::setw(7) << "ADC"
364 << std::setw(7) << "DAC"
365 << " Pulsed by slot line"
366 << std::endl;
367
369 }
370
371 return StatusCode::SUCCESS;
372}
#define ATH_CHECK
Evaluate an expression and check for errors.
LArBadXCont< LArBadChannel > LArBadChannelCont
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
value_type get_compact() const
Get the compact id.
bool good() const
Returns true if no problems at all (all bits at zero).
LArBC_t offlineStatus(const Identifier id) const
Query the status of a particular channel by offline ID This is the main client access method.
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
SG::ReadCondHandleKey< LArBadChannelCont > m_BCKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const