196 {
197
198 const EventContext& ctx = Gaudi::Hive::currentContext();
200
201 static std::atomic<bool>
first=
true;
202 static std::atomic<bool> firstORsecond=true;
203
204 if ( firstORsecond ) {
205 const eformat::FullEventFragment<const uint32_t*> *
event =
m_robSvc->getEvent(ctx);
206 if( true ) {
210
212 uint32_t L1type =
event->lvl1_trigger_type();
213
214 for (size_t irob=0; irob<nrob; ++irob) {
216 event->child(fprob, irob);
217 const eformat::ROBFragment<const uint32_t*> robf(fprob);
218
221 ROBfrag.ROBid = robf.source_id();
222 ROBfrag.RODid = robf.rod_source_id();
223
224
225 unsigned int source_id = robf.rod_source_id();
226 eformat::helper::SourceIdentifier id = eformat::helper::SourceIdentifier(source_id);
227 unsigned int subdet_id = id.subdetector_id();
228
229
230 unsigned int max_allowed_size = robf.rod_fragment_size_word();
231 unsigned int delta = robf.rod_header_size_word() + robf.rod_trailer_size_word();
232 if (max_allowed_size > delta) {
233 max_allowed_size -= delta;
234 } else {
235 max_allowed_size = 0;
236 }
237
238 unsigned int size = robf.rod_ndata();
239 if (size > max_allowed_size) {
240
241 if (size - robf.rod_trailer_size_word() < max_allowed_size) {
242 ATH_MSG_ERROR(
"Problem with data size - assuming that trailer size is " << robf.rod_trailer_size_word()-(size-max_allowed_size)
243 <<" words instead of " << robf.rod_trailer_size_word() << " and data size is " << size << " words " );
244 max_allowed_size = size;
245 } else if (size - robf.rod_trailer_size_word() == max_allowed_size) {
246 ATH_MSG_ERROR(
"Problem with data size - assuming that trailer is absent "
247 << " ROD size " << robf.rod_fragment_size_word()
248 << " header size " << robf.rod_header_size_word()
249 << " data size " << size );
250 max_allowed_size = size;
251 } else {
252 max_allowed_size += robf.rod_trailer_size_word();
253 size = max_allowed_size;
254 ATH_MSG_ERROR(
"Problem with data size - assuming " << size <<
" words and no trailer at all" );
255 }
256 }
257
258 if ( size > 0 ) {
259
262
263 switch ( subdet_id ) {
266 case 0x63:
272 break;
273 default:
274 break;
275 }
276 }
278 if ((ROBfrag.RODid & 0xFF0000) == 0x500000) {
282 }
285 }
286 }
287 }
288
290 std::cout << "Fragments found in event " << event->global_id();
291 else if (firstORsecond)
292 std::cout << "Fragments found in first event";
293 else
294 std::cout << "Fragments found in second event";
295 std::cout << " L1 trigger type " << L1type << " (0x"<< std::hex << L1type << std::dec << ")"
296 <<
" calib mode=" << dqStatus->
calibMode() << std::endl
297 << " ROB ID ROD ID Frag IDs" << std::endl;
298 for (
unsigned int i = 0;
i < nrob; ++
i) {
300 for (
unsigned int j = 0; j <
m_fragMap[
i].fragID.size(); ++j)
301 std::cout << std::hex <<
" 0x" <<
m_fragMap[i].fragID[j];
302 std::cout << std::dec << std::endl;
303 }
304 }
305 }
306
307
308
310
311 unsigned int testsum=0;
312 for (
int k = 4;
k < 16; ++
k) testsum +=
m_cisPar[k];
313 if ( testsum == 0 &&
m_cisPar[3] == 8 ) {
316 } else {
326 }
327
328 const eformat::FullEventFragment<const uint32_t*> *
event =
m_robSvc->getEvent(ctx);
329
330 if (testsum!=0) {
337 }
338 }
339
340 m_evTime =
event->bc_time_seconds();
344
346 }
347
352
354 }
355
359
363 std::vector<uint32_t> robid;
366 std::vector<const ROBDataProviderSvc::ROBF*> robf;
367 m_robSvc->getROBData(ctx, robid, robf);
369 if (robFrag) {
370 m_runNo = robFrag->rod_run_no();
371 } else {
373 }
379
381 }
382
384
385 bool first_header=true;
386 for (size_t irob=0; irob<event->nchildren(); ++irob) {
388 event->child(fprob, irob);
389 const eformat::ROBFragment<const uint32_t*> robf(fprob);
390
392 ROBfrag.
L1type =
event->lvl1_trigger_type();
393 ROBfrag.ROBid = robf.source_id();
394 ROBfrag.RODid = robf.rod_source_id();
395
396 if ((ROBfrag.RODid & 0xFF0000) == 0x500000) {
400 }
402 unsigned int size = robf.rod_ndata();
403 if ( size > 0 ) {
408 if (first_header) {
409 first_header=false;
410 std::cout <<
"Beam Fragments found in event " <<
m_evtNo <<
" ( " <<
m_evtNr <<
" ) L1 trigger type "
411 << ROBfrag.L1type << " (0x"<< std::hex << ROBfrag.L1type << std::dec << ")" << std::endl
412 << " ROB ID ROD ID Frag IDs" << std::endl;
413 }
414 std::cout << std::hex << " 0x" << ROBfrag.ROBid << " 0x" << ROBfrag.RODid;
415 for (unsigned int j = 0; j < ROBfrag.fragID.size(); ++j)
416 std::cout << std::hex << " 0x" << ROBfrag.fragID[j];
417 std::cout << std::dec << std::endl;
418 }
419 }
420 }
421 }
422 }
423
426
428 <<
" event header time " <<
event->bc_time_seconds()
431
434
436 } else {
438
440 }
441 }
442
446 }
447
448 int ind = 4;
450 case 1: ind = 0; break;
451 case 2: ind = 1; break;
452 case 4: ind = 2; break;
453 case 8: ind = 3; break;
454 case 16: ind = 3; break;
455 default: ind = 4; break;
456 }
458
459 unsigned int lvl1_trigger_type = event->lvl1_trigger_type();
462
465
468
470
472
474 if(!pTileLasObj.isValid()) {
475 ATH_MSG_ERROR(
"There is a problem opening the LASER object" );
476
477
478 } else {
480 m_lasAmp.addValue((
int)pTileLasObj->getDiodeCurrOrd());
484 m_gasFlow.addValue(pTileLasObj->getGasFlux());
485 m_lasStatus = (pTileLasObj->getAlarm() << 0x9) + (pTileLasObj->getInterlock() << 0x8) + (pTileLasObj->getShutter() << 0x6)
486 + ((
int)pTileLasObj->getHVpmts() << 0x4) + ((
int)pTileLasObj->getLVdiodes() << 0x3) + (pTileLasObj->getAlphaPos());
487 int lasAlpha = (
int)pTileLasObj->getAlphaPos() & 0x7;
491
492
493 }
494
495
496 return StatusCode::SUCCESS;
497}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
#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())