56 m_topoSteering->setLegacyMode(m_isLegacyTopo);
59 CHECK( m_histSvc.retrieve() );
62 CHECK( m_emtauInputProvider.retrieve() );
65 CHECK( m_jetInputProvider.retrieve() );
68 CHECK( m_energyInputProvider.retrieve() );
71 CHECK( m_muonInputProvider.retrieve(DisableTool{m_isLegacyTopo}) );
74 CHECK( m_ControlHistSvc.retrieve());
76 CHECK(m_l1topoRawDataKey.initialize(m_fillHistogramsBasedOnHardwareDecision));
78 CHECK(m_legacyTopoCTPLocation.initialize(m_isLegacyTopo));
79 CHECK(m_legacyTopoOverflowCTPLocation.initialize(m_isLegacyTopo));
80 CHECK(m_topoCTPLocation.initialize(!m_isLegacyTopo));
81 CHECK(m_topoOverflowCTPLocation.initialize(!m_isLegacyTopo));
83 ATH_MSG_DEBUG(
"Legacy output trigger key property " << m_legacyTopoCTPLocation);
84 ATH_MSG_DEBUG(
"Legacy output overflow key property " << m_legacyTopoOverflowCTPLocation);
87 ATH_MSG_DEBUG(
"Output trigger key property " << m_topoCTPLocation);
88 ATH_MSG_DEBUG(
"Output overflow key property " << m_topoOverflowCTPLocation);
92 ATH_MSG_DEBUG(
"PrescaleDAQROBAccess factor set to " << m_prescaleForDAQROBAccess);
93 ATH_MSG_DEBUG(
"FillHistoBasedOnHardware " << m_fillHistogramsBasedOnHardwareDecision);
94 if(m_fillHistogramsBasedOnHardwareDecision and
95 (m_prescaleForDAQROBAccess % m_prescale)) {
96 ATH_MSG_FATAL(
"PrescaleDAQROBAccess must be a multiple of Prescale"
97 <<
" : current values :"
98 <<
" "<<m_prescaleForDAQROBAccess
100 return StatusCode::FAILURE;
105 ATH_MSG_INFO(
"initialize(): retrieving new-style L1 trigger menu from Detector Store" );
107 m_topoSteering->setUseBitwise(m_enableBitwise);
109 m_topoSteering->setupFromConfiguration(*
l1menu);
112 ATH_MSG_FATAL(
"Caught exception when configuring topo steering from menu: " <<
e.what() );
113 return StatusCode::FAILURE;
117 m_topoSteering->setOutputAlgosFillBasedOnHardware(m_fillHistogramsBasedOnHardwareDecision);
119 ATH_CHECK(m_ControlHistSvc->SetHistSvc(m_topoSteering, m_histBaseDir.value()));
121 ATH_CHECK(m_legacyL1topoKey.initialize(m_isLegacyTopo));
122 ATH_CHECK(m_l1topoKey.initialize(!m_isLegacyTopo));
124 return StatusCode::SUCCESS;
139 ATH_MSG_FATAL(
"Caught exception when initializing topo algorithms" <<
e.what() );
140 return StatusCode::FAILURE;
148 return StatusCode::SUCCESS;
155 const EventContext& ctx = Gaudi::Hive::currentContext();
159 return StatusCode::SUCCESS;
176 ctx.eventID().event_number(),
177 ctx.eventID().lumi_block(),
178 ctx.eventID().bunch_crossing_id());
229 auto topoOutput2CTP = std::make_unique< LVL1::FrontPanelCTP >();
230 auto topoOverflow2CTP = std::make_unique< LVL1::FrontPanelCTP >();
238 ATH_CHECK(outputHandle.
record(std::make_unique<xAOD::L1TopoSimResultsContainer>(), std::make_unique<xAOD::L1TopoSimResultsAuxContainer>()));
243 std::string conn1 =
l1menu->board(
"LegacyTopo0").connectorNames()[0];
244 std::string conn2 =
l1menu->board(
"LegacyTopo1").connectorNames()[0];
245 for(
unsigned int clock=0; clock<2; ++clock) {
246 topoOutput2CTP->setCableWord0( clock, 0 );
248 topoOutput2CTP->setCableWord1( clock, globalOutput.
decision_field( conn1, clock) );
251 topoOutput2CTP->setCableWord2( clock, globalOutput.
decision_field( conn2, clock) );
263 std::string conn1 =
l1menu->board(
"Topo2").connectorNames()[0];
264 std::string conn2 =
l1menu->board(
"Topo3").connectorNames()[0];
265 for(
unsigned int clock=0; clock<2; ++clock) {
267 topoOutput2CTP->setCableWord1( clock, globalOutput.
decision_field( conn1, clock) );
270 topoOutput2CTP->setCableWord2( clock, globalOutput.
decision_field( conn2, clock) );
273 topoOverflow2CTP->setCableWord0( clock, 0 );
274 topoOverflow2CTP->setCableWord1( clock, globalOutput.
overflow_field( conn1, clock) );
276 topoOverflow2CTP->setCableWord2( clock, globalOutput.
overflow_field( conn2, clock) );
284 for(
const auto& connOpt :
l1menu->board(
"Topo1").connectorNames() ) {
285 auto outputOpt = globalOutput.
count_field(connOpt);
286 std::bitset<64> outputOpt_1(outputOpt.to_string());
287 std::bitset<64> outputOpt_2((outputOpt<<64).
to_string());
288 topoOutput2CTP->setOptCableWord( connOpt, outputOpt );
289 WriteEDM(outputHandle,connOpt,1,outputOpt_1.to_ulong());
290 WriteEDM(outputHandle,connOpt,0,outputOpt_2.to_ulong());
297 return StatusCode::SUCCESS;
304 return StatusCode::SUCCESS;
310 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
312 handle->
back()->setClock(clock);
313 handle->
back()->setBitWidth(32);
314 handle->
back()->setTopoWord(word);
316 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
322 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
324 handle->
back()->setClock(clock);
325 handle->
back()->setBitWidth(32);
326 handle->
back()->setTopoWordOverflow(word);
328 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
334 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
336 handle->
back()->setClock(clock);
337 handle->
back()->setBitWidth(64);
338 handle->
back()->setTopoWord64(word);
340 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
346 handle->
push_back(std::make_unique<xAOD::L1TopoSimResults>());
348 handle->
back()->setClock(clock);
349 handle->
back()->setBitWidth(64);
350 handle->
back()->setTopoWord64Overflow(word);
352 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->
back()->connectionId() <<
" Clock: " << handle->
back()->clock() <<
" Decision: " << handle->
back()->topoWord() );
368 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
369 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
370 bool prescalForDAQROBAccess =
true;
371 if (prescalForDAQROBAccess){
372 std::vector<L1Topo::L1TopoTOB> daqTobsBC0;
373 std::vector<uint32_t> tobsbc0SourceIds;
376 if (
sc.isFailure() or 0 == rdos) {
377 ATH_MSG_INFO (
"Could not retrieve L1Topo DAQ RDO collection from StoreGate" );
378 }
else if (rdos->
empty()) {
382 const std::vector<uint32_t> cDataWords = rdo->getDataWords();
385 for (
const uint32_t word : cDataWords){
393 if (
header.bcn_offset()==0){
394 daqTobsBC0.push_back(tob);
395 tobsbc0SourceIds.push_back(rdo->getSourceID());
404 for(
uint32_t iTob=0; iTob<daqTobsBC0.size(); ++iTob){
406 const uint32_t &sourceId = tobsbc0SourceIds[iTob];
407 for(
unsigned int i=0;
i<8; ++
i){
414 hardwareDaqRobOvrflowBits);
427 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
428 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
432 ATH_MSG_FATAL(
"Could not retrieve L1Topo RAW Data Container from the BS data.");
433 return StatusCode::FAILURE;
436 std::unique_ptr<L1Topo::L1TopoResult> l1topoResult = std::make_unique<L1Topo::L1TopoResult>(*cont);
439 return StatusCode::FAILURE;
441 hardwareDaqRobTriggerBits = l1topoResult->
getDecisions();
442 hardwareDaqRobOvrflowBits = l1topoResult->
getOverflows();
447 hardwareDaqRobOvrflowBits);