76 {
77 const EventContext& ctx = Gaudi::Hive::currentContext();
78 unsigned eventNb = ctx.eventID().event_number();
79
80 ATH_MSG_INFO (
"======== executing event "<< eventNb <<
" ========" );
81
82
83
84 const LArDigitContainer* larDigitCont = nullptr;
86
87
88 const LArCalibParams* calibParams = nullptr;
90
91 SG::ReadCondHandle<LArBadChannelCont> readHandle(
m_BCKey, ctx);
93 if(!bcCont) {
95 return StatusCode::FAILURE;
96 }
97
98 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl(
m_cablingKey, ctx);
99 const LArOnOffIdMapping*
cabling=*cablingHdl;
100 if(!cabling) {
101 ATH_MSG_ERROR(
"Do not have cabling object LArOnOffIdMapping" );
102 return StatusCode::FAILURE;
103 }
104
105 SG::ReadCondHandle<LArCalibLineMapping> clHdl(
m_CLKey, ctx);
106 const LArCalibLineMapping *clCont {*clHdl};
107 if(!clCont) {
109 return StatusCode::FAILURE;
110 }
111
112
113
117
120
121 int cellsCounter = 0;
122
123 int inconsistencyCounter = 0;
124 int disconnectedCounter = 0;
125 int badChannelCounter = 0;
126
127 bool signalPresent;
128 bool pulsed;
129 bool badChannel;
130 bool disconnected;
131
132
133 std::ostringstream ErrorList;
134
135
136 for (const LArDigit* digit : *larDigitCont) {
137 cellsCounter++;
138
139 ErrorList.clear();
140
141
142 const HWIdentifier online_id =
digit->hardwareID();
144
146
147
148 if (!
cabling->isOnlineConnected(online_id)) {
149 disconnected = true;
150 disconnectedCounter++;
151 } else
152 disconnected = false;
153
154 Identifier offline_id;
155
156
157 bool noOffline_id = false;
158 try {
159 offline_id =
cabling->cnvToIdentifier(online_id);
160 }
161 catch (const LArID_Exception&) {
162 noOffline_id = true;
163 }
164
165
166
167 const int max = *max_element(
digit->samples().begin(),
digit->samples().end());
169 signalPresent = true;
170 else
171 signalPresent = false;
172
173
174
175 pulsed = false;
176 int DACvalue = -1;
177 std::ostringstream PulserList;
178 const std::vector<HWIdentifier>& calibChannelIDs=clCont->
calibSlotLine(online_id);
179
180 for (HWIdentifier hwid : calibChannelIDs) {
181
182 bool isPulsed=calibParams->
isPulsed(eventNb, hwid);
183 if (isPulsed) {
184 int DACvalue_temp = calibParams->
DAC(eventNb, hwid);
185 if (DACvalue_temp > DACvalue)
186 DACvalue = DACvalue_temp;
187 pulsed = true;
190 PulserList << std::hex << hwid.get_compact() << std::dec <<
" " << slot <<
" " <<
line <<
" ";
191 }
192 }
193
194
196 bool DACOverThreshold;
197 switch (gain) {
200 break;
203 break;
206 break;
207 default:
209 }
210
211
214 badChannel = false;
215 } else {
216 badChannel = true;
217 badChannelCounter++;
218 }
219 } else {
220 badChannel = false;
221 }
222
223
224
225 bool inconsistency = (signalPresent != pulsed) && DACOverThreshold;
226 if (inconsistency)
227 inconsistencyCounter++;
228
229 bool errorInCell = inconsistency || badChannel;
230 if (errorInCell)
232
233 std::ostringstream CellData;
234 CellData <<
"0x" << std::hex << std::setw(8) << febid.
get_compact() << std::dec
237 << std::setw(5) << chNb;
238
239 CellData << std::setw(5);
240 if (noOffline_id)
241 CellData << "-";
242 else
243 CellData <<
m_emId->sampling(offline_id);
244
245 CellData << std::setw(5);
246 if (noOffline_id)
247 CellData << "-";
248 else
249 CellData <<
m_emId->eta(offline_id);
250
251 CellData << std::setw(5);
252 if (noOffline_id)
253 CellData << "-";
254 else
255 CellData <<
m_emId->phi(offline_id);
256
257 CellData << std::setw(7) <<
max;
258 if (DACvalue >= 0)
259 CellData << std::setw(7) << DACvalue;
260 else
261 CellData << std::setw(7) << "-";
262
263 if (disconnected) {
265 ErrorList << " D ";
266 ErrorList << CellData.str() << std::endl;
267 }
268 }
269 else {
270
271 if (errorInCell)
272 (*m_errorcellsThisEvent)[
m_onlineHelper->channel_Hash(online_id)] =
true;
273
275 if (inconsistency)
276 ErrorList << "I";
277 else
278 ErrorList << " ";
279 if (pulsed)
280 ErrorList << "P";
281 else
282 ErrorList << " ";
283 if (signalPresent)
284 ErrorList << "S";
285 else
286 ErrorList << " ";
287 if (badChannel)
288 ErrorList << "B ";
289 else
290 ErrorList << " ";
291
292 ErrorList << CellData.str();
293
294 if (pulsed)
295 ErrorList << " " << PulserList.str();
296
297 ErrorList << std::endl;
298 }
299 }
300 }
301
302 ErrorList << std::endl;
303
305 ErrorList << "Examined " << cellsCounter << " cells in event " << eventNb << ". Found:" << std::endl;
306 ErrorList << std::left << std::setw(25) << "Inconsistencies: "
307 << std::right << std::setw(4) << inconsistencyCounter << std::endl;
308 ErrorList << std::left << std::setw(25) << "Bad cells: "
309 << std::right << std::setw(4) << badChannelCounter << std::endl;
310 ErrorList << std::left << std::setw(25) << "Sum errors: "
312 ErrorList << std::left << std::setw(25) << "Disconnected cells: "
313 << std::right << std::setw(4) << disconnectedCounter << std::endl;
314 ErrorList << std::endl;
315 }
316
318
320
322 }
323 else {
324
328
330 m_outfile <<
"Error in event "<< std::setw(7) << eventNb
331 << " ==========================================================================" << std::endl;
332 m_outfile <<
"I=Inconsistency P=Pulsed S=Signal B=Bad D=Disconnected" << std::endl;
334 << std::left << std::setw(10) << "FEB"
335 << std::right << std::setw(5) << "FT"
336 << std::setw(5) << "SL"
337 << std::setw(5) << "CH"
338 << std::setw(5) << "Smpl"
339 << std::setw(5) << "Eta"
340 << std::setw(5) << "Phi"
341 << std::setw(7) << "ADC"
342 << std::setw(7) << "DAC"
343 << " Pulsed by calibchannel slot line"
344 << std::endl;
345
347 }
348
350 }
351 }
352 else {
353 m_outfile <<
"Status of event "<< std::setw(7) << eventNb
354 << " ==========================================================================" << std::endl;
355 m_outfile <<
"I=Inconsistency P=Pulsed S=Signal B=Bad D=Disconnected" << std::endl;
357 << std::left << std::setw(10) << "FEB"
358 << std::right << std::setw(5) << "FT"
359 << std::setw(5) << "SL"
360 << std::setw(5) << "CH"
361 << std::setw(5) << "Smpl"
362 << std::setw(5) << "Eta"
363 << std::setw(5) << "Phi"
364 << std::setw(7) << "ADC"
365 << std::setw(7) << "DAC"
366 << " Pulsed by slot line"
367 << std::endl;
368
370 }
371
372 return StatusCode::SUCCESS;
373}
#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
retrieve(aClass, aKey=None)