Execute method.
196 {
197
199
200 static std::atomic<bool>
first=
true;
201 static std::atomic<bool> firstORsecond=true;
202
203 if ( firstORsecond ) {
204 const eformat::FullEventFragment<const uint32_t*> *
event =
m_robSvc->getEvent(ctx);
205 if( true ) {
209
211 uint32_t L1type =
event->lvl1_trigger_type();
212
213 for (size_t irob=0; irob<nrob; ++irob) {
215 event->child(fprob, irob);
216 const eformat::ROBFragment<const uint32_t*> robf(fprob);
217
220 ROBfrag.ROBid = robf.source_id();
221 ROBfrag.RODid = robf.rod_source_id();
222
223
224 unsigned int source_id = robf.rod_source_id();
225 eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(source_id);
226 unsigned int subdet_id = id.subdetector_id();
227
228
229 unsigned int max_allowed_size = robf.rod_fragment_size_word();
230 unsigned int delta = robf.rod_header_size_word() + robf.rod_trailer_size_word();
231 if (max_allowed_size > delta) {
232 max_allowed_size -= delta;
233 } else {
234 max_allowed_size = 0;
235 }
236
237 unsigned int size = robf.rod_ndata();
238 if (
size > max_allowed_size) {
239
240 if (
size - robf.rod_trailer_size_word() < max_allowed_size) {
241 ATH_MSG_ERROR(
"Problem with data size - assuming that trailer size is " << robf.rod_trailer_size_word()-(
size-max_allowed_size)
242 <<
" words instead of " << robf.rod_trailer_size_word() <<
" and data size is " <<
size <<
" words " );
243 max_allowed_size =
size;
244 }
else if (
size - robf.rod_trailer_size_word() == max_allowed_size) {
245 ATH_MSG_ERROR(
"Problem with data size - assuming that trailer is absent "
246 << " ROD size " << robf.rod_fragment_size_word()
247 << " header size " << robf.rod_header_size_word()
248 <<
" data size " <<
size );
249 max_allowed_size =
size;
250 } else {
251 max_allowed_size += robf.rod_trailer_size_word();
252 size = max_allowed_size;
253 ATH_MSG_ERROR(
"Problem with data size - assuming " <<
size <<
" words and no trailer at all" );
254 }
255 }
256
258
260 robf.rod_data(data);
261
262 switch ( subdet_id ) {
265 case 0x63:
271 break;
272 default:
273 break;
274 }
275 }
277 if ((ROBfrag.RODid & 0xFF0000) == 0x500000) {
281 }
284 }
285 }
286 }
287
289 std::cout << "Fragments found in event " << event->global_id();
290 else if (firstORsecond)
291 std::cout << "Fragments found in first event";
292 else
293 std::cout << "Fragments found in second event";
294 std::cout << " L1 trigger type " << L1type << " (0x"<< std::hex << L1type << std::dec << ")"
295 <<
" calib mode=" << dqStatus->
calibMode() << std::endl
296 << " ROB ID ROD ID Frag IDs" << std::endl;
297 for (
unsigned int i = 0;
i < nrob; ++
i) {
299 for (
unsigned int j = 0;
j <
m_fragMap[
i].fragID.size(); ++
j)
300 std::cout << std::hex <<
" 0x" <<
m_fragMap[i].fragID[j];
301 std::cout << std::dec << std::endl;
302 }
303 }
304 }
305
306
307
309
310 unsigned int testsum=0;
311 for (
int k = 4;
k < 16; ++
k) testsum +=
m_cisPar[k];
312 if ( testsum == 0 &&
m_cisPar[3] == 8 ) {
315 } else {
325 }
326
327 const eformat::FullEventFragment<const uint32_t*> *
event =
m_robSvc->getEvent(ctx);
328
329 if (testsum!=0) {
336 }
337 }
338
339 m_evTime =
event->bc_time_seconds();
343
345 }
346
351
353 }
354
358
362 std::vector<uint32_t> robid;
365 std::vector<const ROBDataProviderSvc::ROBF*> robf;
366 m_robSvc->getROBData(ctx, robid, robf);
368 if (robFrag) {
369 m_runNo = robFrag->rod_run_no();
370 } else {
372 }
378
380 }
381
383
384 bool first_header=true;
385 for (size_t irob=0; irob<event->nchildren(); ++irob) {
387 event->child(fprob, irob);
388 const eformat::ROBFragment<const uint32_t*> robf(fprob);
389
391 ROBfrag.
L1type =
event->lvl1_trigger_type();
392 ROBfrag.ROBid = robf.source_id();
393 ROBfrag.RODid = robf.rod_source_id();
394
395 if ((ROBfrag.RODid & 0xFF0000) == 0x500000) {
399 }
401 unsigned int size = robf.rod_ndata();
404 robf.rod_data(data);
407 if (first_header) {
408 first_header=false;
409 std::cout <<
"Beam Fragments found in event " <<
m_evtNo <<
" ( " <<
m_evtNr <<
" ) L1 trigger type "
410 << ROBfrag.L1type << " (0x"<< std::hex << ROBfrag.L1type << std::dec << ")" << std::endl
411 << " ROB ID ROD ID Frag IDs" << std::endl;
412 }
413 std::cout << std::hex << " 0x" << ROBfrag.ROBid << " 0x" << ROBfrag.RODid;
414 for (
unsigned int j = 0;
j < ROBfrag.fragID.size(); ++
j)
415 std::cout << std::hex << " 0x" << ROBfrag.fragID[j];
416 std::cout << std::dec << std::endl;
417 }
418 }
419 }
420 }
421 }
422
425
427 <<
" event header time " <<
event->bc_time_seconds()
430
433
435 } else {
437
439 }
440 }
441
445 }
446
449 case 1:
ind = 0;
break;
450 case 2:
ind = 1;
break;
451 case 4:
ind = 2;
break;
452 case 8:
ind = 3;
break;
453 case 16:
ind = 3;
break;
454 default:
ind = 4;
break;
455 }
457
458 unsigned int lvl1_trigger_type = event->lvl1_trigger_type();
459
461
464
467
469
471
473 if(!pTileLasObj.isValid()) {
474 ATH_MSG_ERROR(
"There is a problem opening the LASER object" );
475
476
477 } else {
479 m_lasAmp.addValue((
int)pTileLasObj->getDiodeCurrOrd());
483 m_gasFlow.addValue(pTileLasObj->getGasFlux());
484 m_lasStatus = (pTileLasObj->getAlarm() << 0x9) + (pTileLasObj->getInterlock() << 0x8) + (pTileLasObj->getShutter() << 0x6)
485 + ((
int)pTileLasObj->getHVpmts() << 0x4) + ((
int)pTileLasObj->getLVdiodes() << 0x3) + (pTileLasObj->getAlphaPos());
486 int lasAlpha = (
int)pTileLasObj->getAlphaPos() & 0x7;
490
491
492 }
493
494
495 return StatusCode::SUCCESS;
496}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
size_t size() const
Number of registered mappings.
#define TILE_BEAM_ID
definition of various fragments expected in BS files from testbeam
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
ROB Fragment class.
int trigType() const
Trigger type.
uint32_t calibMode() const
Calibration mode.
const uint32_t * cispar() const
CIS parameters.
std::vector< T_RobRodFragMap > m_fragMap
void find_frag(const uint32_t *data, unsigned int size, T_RobRodFragMap &ROBfrag)
StatDouble m_laserBoxTemp
StatDouble m_laserDiodeTemp
Gaudi::Property< bool > m_printAllEvents
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
SG::ReadHandleKey< TileLaserObject > m_laserObjectKey
ServiceHandle< IROBDataProviderSvc > m_robSvc
Name of ROB data provider service.
std::vector< T_RobRodFragMap > m_beamFragMap
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)