56 m_topoSteering->setLegacyMode(m_isLegacyTopo);
59 CHECK( m_histSvc.retrieve() );
61 if (m_emtauInputProvider.isEnabled()) {
63 CHECK( m_emtauInputProvider.retrieve() );
66 if (m_jetInputProvider.isEnabled()) {
68 CHECK( m_jetInputProvider.retrieve() );
71 if (m_energyInputProvider.isEnabled()) {
73 CHECK( m_energyInputProvider.retrieve() );
76 if (m_muonInputProvider.isEnabled()) {
78 CHECK( m_muonInputProvider.retrieve(DisableTool{m_isLegacyTopo}) );
82 CHECK( m_ControlHistSvc.retrieve());
84 CHECK(m_l1topoRawDataKey.initialize(m_fillHistogramsBasedOnHardwareDecision));
86 CHECK(m_legacyTopoCTPLocation.initialize(m_isLegacyTopo));
87 CHECK(m_legacyTopoOverflowCTPLocation.initialize(m_isLegacyTopo));
88 CHECK(m_topoCTPLocation.initialize(!m_isLegacyTopo));
89 CHECK(m_topoOverflowCTPLocation.initialize(!m_isLegacyTopo));
91 ATH_MSG_DEBUG(
"Legacy output trigger key property " << m_legacyTopoCTPLocation);
92 ATH_MSG_DEBUG(
"Legacy output overflow key property " << m_legacyTopoOverflowCTPLocation);
95 ATH_MSG_DEBUG(
"Output trigger key property " << m_topoCTPLocation);
96 ATH_MSG_DEBUG(
"Output overflow key property " << m_topoOverflowCTPLocation);
100 ATH_MSG_DEBUG(
"PrescaleDAQROBAccess factor set to " << m_prescaleForDAQROBAccess);
101 ATH_MSG_DEBUG(
"FillHistoBasedOnHardware " << m_fillHistogramsBasedOnHardwareDecision);
102 if(m_fillHistogramsBasedOnHardwareDecision and
103 (m_prescaleForDAQROBAccess % m_prescale)) {
104 ATH_MSG_FATAL(
"PrescaleDAQROBAccess must be a multiple of Prescale"
105 <<
" : current values :"
106 <<
" "<<m_prescaleForDAQROBAccess
108 return StatusCode::FAILURE;
113 ATH_MSG_INFO(
"initialize(): retrieving new-style L1 trigger menu from Detector Store" );
115 m_topoSteering->setUseBitwise(m_enableBitwise);
117 m_topoSteering->setupFromConfiguration(*
l1menu);
120 ATH_MSG_FATAL(
"Caught exception when configuring topo steering from menu: " <<
e.what() );
121 return StatusCode::FAILURE;
125 m_topoSteering->setOutputAlgosFillBasedOnHardware(m_fillHistogramsBasedOnHardwareDecision);
127 if (m_doMonitoring) {
ATH_CHECK(m_ControlHistSvc->SetHistSvc(m_topoSteering, m_histBaseDir.value()));}
129 ATH_CHECK(m_legacyL1topoKey.initialize(m_isLegacyTopo));
130 ATH_CHECK(m_l1topoKey.initialize(!m_isLegacyTopo));
132 return StatusCode::SUCCESS;
147 ATH_MSG_FATAL(
"Caught exception when initializing topo algorithms" <<
e.what() );
148 return StatusCode::FAILURE;
156 return StatusCode::SUCCESS;
163 const EventContext& ctx = Gaudi::Hive::currentContext();
167 return StatusCode::SUCCESS;
184 ctx.eventID().event_number(),
185 ctx.eventID().lumi_block(),
186 ctx.eventID().bunch_crossing_id());
240 auto topoOutput2CTP = std::make_unique< LVL1::FrontPanelCTP >();
241 auto topoOverflow2CTP = std::make_unique< LVL1::FrontPanelCTP >();
249 ATH_CHECK(outputHandle.
record(std::make_unique<xAOD::L1TopoSimResultsContainer>(), std::make_unique<xAOD::L1TopoSimResultsAuxContainer>()));
254 std::string conn1 =
l1menu->board(
"LegacyTopo0").connectorNames()[0];
255 std::string conn2 =
l1menu->board(
"LegacyTopo1").connectorNames()[0];
256 for(
unsigned int clock=0; clock<2; ++clock) {
257 topoOutput2CTP->setCableWord0( clock, 0 );
259 topoOutput2CTP->setCableWord1( clock, globalOutput.
decision_field( conn1, clock) );
262 topoOutput2CTP->setCableWord2( clock, globalOutput.
decision_field( conn2, clock) );
274 std::string conn1 =
l1menu->board(
"Topo2").connectorNames()[0];
275 std::string conn2 =
l1menu->board(
"Topo3").connectorNames()[0];
276 for(
unsigned int clock=0; clock<2; ++clock) {
284 topoOverflow2CTP->setCableWord0( clock, 0 );
285 topoOverflow2CTP->setCableWord1( clock, globalOutput.
overflow_field( conn1, clock) );
287 topoOverflow2CTP->setCableWord2( clock, globalOutput.
overflow_field( conn2, clock) );
295 for(
const auto& connOpt :
l1menu->board(
"Topo1").connectorNames() ) {
296 auto outputOpt = globalOutput.
count_field(connOpt);
297 std::bitset<64> outputOpt_1(outputOpt.to_string());
298 std::bitset<64> outputOpt_2((outputOpt<<64).
to_string());
299 topoOutput2CTP->setOptCableWord( connOpt, outputOpt );
300 WriteEDM(outputHandle,connOpt,1,outputOpt_1.to_ulong());
301 WriteEDM(outputHandle,connOpt,0,outputOpt_2.to_ulong());
308 return StatusCode::SUCCESS;
315 return StatusCode::SUCCESS;
321 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
323 handle->
back()->setClock(clock);
324 handle->
back()->setBitWidth(32);
325 handle->
back()->setTopoWord(word);
327 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
333 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
335 handle->
back()->setClock(clock);
336 handle->
back()->setBitWidth(32);
337 handle->
back()->setTopoWordOverflow(word);
339 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
345 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
347 handle->
back()->setClock(clock);
348 handle->
back()->setBitWidth(64);
349 handle->
back()->setTopoWord64(word);
351 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
357 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
359 handle->
back()->setClock(clock);
360 handle->
back()->setBitWidth(64);
361 handle->
back()->setTopoWord64Overflow(word);
363 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
379 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
380 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
381 bool prescalForDAQROBAccess =
true;
382 if (prescalForDAQROBAccess){
383 std::vector<L1Topo::L1TopoTOB> daqTobsBC0;
384 std::vector<uint32_t> tobsbc0SourceIds;
387 if (
sc.isFailure() or 0 == rdos) {
388 ATH_MSG_INFO (
"Could not retrieve L1Topo DAQ RDO collection from StoreGate" );
389 }
else if (rdos->
empty()) {
393 const std::vector<uint32_t> cDataWords = rdo->getDataWords();
396 for (
const uint32_t word : cDataWords){
404 if (
header.bcn_offset()==0){
405 daqTobsBC0.push_back(tob);
406 tobsbc0SourceIds.push_back(rdo->getSourceID());
415 for(
uint32_t iTob=0; iTob<daqTobsBC0.size(); ++iTob){
417 const uint32_t &sourceId = tobsbc0SourceIds[iTob];
418 for(
unsigned int i=0;
i<8; ++
i){
425 hardwareDaqRobOvrflowBits);
438 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
439 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
443 ATH_MSG_FATAL(
"Could not retrieve L1Topo RAW Data Container from the BS data.");
444 return StatusCode::FAILURE;
447 std::unique_ptr<L1Topo::L1TopoResult> l1topoResult = std::make_unique<L1Topo::L1TopoResult>(*cont);
450 return StatusCode::FAILURE;
452 hardwareDaqRobTriggerBits = l1topoResult->
getDecisions();
453 hardwareDaqRobOvrflowBits = l1topoResult->
getOverflows();
458 hardwareDaqRobOvrflowBits);