60 m_topoSteering->setLegacyMode(m_isLegacyTopo);
63 CHECK( m_histSvc.retrieve() );
65 if (m_emtauInputProvider.isEnabled()) {
67 CHECK( m_emtauInputProvider.retrieve() );
70 if (m_jetInputProvider.isEnabled()) {
72 CHECK( m_jetInputProvider.retrieve() );
75 if (m_energyInputProvider.isEnabled()) {
77 CHECK( m_energyInputProvider.retrieve() );
80 if (m_muonInputProvider.isEnabled()) {
82 CHECK( m_muonInputProvider.retrieve(DisableTool{m_isLegacyTopo}) );
86 CHECK( m_ControlHistSvc.retrieve());
88 CHECK(m_l1topoRawDataKey.initialize(m_fillHistogramsBasedOnHardwareDecision));
90 CHECK(m_legacyTopoCTPLocation.initialize(m_isLegacyTopo));
91 CHECK(m_legacyTopoOverflowCTPLocation.initialize(m_isLegacyTopo));
92 CHECK(m_topoCTPLocation.initialize(!m_isLegacyTopo));
93 CHECK(m_topoOverflowCTPLocation.initialize(!m_isLegacyTopo));
95 ATH_MSG_DEBUG(
"Legacy output trigger key property " << m_legacyTopoCTPLocation);
96 ATH_MSG_DEBUG(
"Legacy output overflow key property " << m_legacyTopoOverflowCTPLocation);
99 ATH_MSG_DEBUG(
"Output trigger key property " << m_topoCTPLocation);
100 ATH_MSG_DEBUG(
"Output overflow key property " << m_topoOverflowCTPLocation);
104 ATH_MSG_DEBUG(
"PrescaleDAQROBAccess factor set to " << m_prescaleForDAQROBAccess);
105 ATH_MSG_DEBUG(
"FillHistoBasedOnHardware " << m_fillHistogramsBasedOnHardwareDecision);
106 if(m_fillHistogramsBasedOnHardwareDecision and
107 (m_prescaleForDAQROBAccess % m_prescale)) {
108 ATH_MSG_FATAL(
"PrescaleDAQROBAccess must be a multiple of Prescale"
109 <<
" : current values :"
110 <<
" "<<m_prescaleForDAQROBAccess
112 return StatusCode::FAILURE;
116 ATH_CHECK( detStore()->retrieve(l1menu) );
117 ATH_MSG_INFO(
"initialize(): retrieving new-style L1 trigger menu from Detector Store" );
124 if ( jetProviderAsAlgTool && l1menu->thrExtraInfo().hasInfo(
"cXE") ) {
126 if ( jetProviderAsAlgTool->hasProperty(
"cXEweight_jFEX") ) {
127 float jXEweight = cXeExtraInfo.
jXeWeight();
128 jetProviderAsAlgTool->setProperty(
"cXEweight_jFEX", jXEweight).ignore();
130 if ( jetProviderAsAlgTool->hasProperty(
"cXEweight_gFEX") ) {
131 float gXEweight = cXeExtraInfo.
gXeWeight();
132 jetProviderAsAlgTool->setProperty(
"cXEweight_gFEX", gXEweight).ignore();
136 m_topoSteering->setUseBitwise(m_enableBitwise);
138 m_topoSteering->setupFromConfiguration(*l1menu);
140 catch(std::exception & e) {
141 ATH_MSG_FATAL(
"Caught exception when configuring topo steering from menu: " << e.what() );
142 return StatusCode::FAILURE;
146 m_topoSteering->setOutputAlgosFillBasedOnHardware(m_fillHistogramsBasedOnHardwareDecision);
148 if (m_doMonitoring) {
ATH_CHECK(m_ControlHistSvc->SetHistSvc(m_topoSteering, m_histBaseDir.value()));}
150 ATH_CHECK(m_legacyL1topoKey.initialize(m_isLegacyTopo));
151 ATH_CHECK(m_l1topoKey.initialize(!m_isLegacyTopo));
153 return StatusCode::SUCCESS;
167 catch(std::exception & e) {
168 ATH_MSG_FATAL(
"Caught exception when initializing topo algorithms" << e.what() );
169 return StatusCode::FAILURE;
177 return StatusCode::SUCCESS;
184 const EventContext& ctx = Gaudi::Hive::currentContext();
188 return StatusCode::SUCCESS;
205 ctx.eventID().event_number(),
206 ctx.eventID().lumi_block(),
207 ctx.eventID().bunch_crossing_id());
261 auto topoOutput2CTP = std::make_unique< LVL1::FrontPanelCTP >();
262 auto topoOverflow2CTP = std::make_unique< LVL1::FrontPanelCTP >();
270 ATH_CHECK(outputHandle.
record(std::make_unique<xAOD::L1TopoSimResultsContainer>(), std::make_unique<xAOD::L1TopoSimResultsAuxContainer>()));
275 std::string conn1 = l1menu->board(
"LegacyTopo0").connectorNames()[0];
276 std::string conn2 = l1menu->board(
"LegacyTopo1").connectorNames()[0];
277 for(
unsigned int clock=0; clock<2; ++clock) {
278 topoOutput2CTP->setCableWord0( clock, 0 );
280 topoOutput2CTP->setCableWord1( clock, globalOutput.
decision_field( conn1, clock) );
283 topoOutput2CTP->setCableWord2( clock, globalOutput.
decision_field( conn2, clock) );
295 std::string conn1 = l1menu->board(
"Topo2").connectorNames()[0];
296 std::string conn2 = l1menu->board(
"Topo3").connectorNames()[0];
297 for(
unsigned int clock=0; clock<2; ++clock) {
305 topoOverflow2CTP->setCableWord0( clock, 0 );
306 topoOverflow2CTP->setCableWord1( clock, globalOutput.
overflow_field( conn1, clock) );
308 topoOverflow2CTP->setCableWord2( clock, globalOutput.
overflow_field( conn2, clock) );
316 for(
const auto& connOpt : l1menu->board(
"Topo1").connectorNames() ) {
317 auto outputOpt = globalOutput.
count_field(connOpt);
318 std::bitset<64> outputOpt_1(outputOpt.to_string());
319 std::bitset<64> outputOpt_2((outputOpt<<64).
to_string());
320 topoOutput2CTP->setOptCableWord( connOpt, outputOpt );
321 WriteEDM(outputHandle,connOpt,1,outputOpt_1.to_ulong());
322 WriteEDM(outputHandle,connOpt,0,outputOpt_2.to_ulong());
329 return StatusCode::SUCCESS;
336 return StatusCode::SUCCESS;
342 handle->push_back(std::make_unique<xAOD::L1TopoSimResults>());
344 handle->back()->setClock(clock);
345 handle->back()->setBitWidth(32);
346 handle->back()->setTopoWord(word);
348 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->back()->connectionId() <<
" Clock: " << handle->back()->clock() <<
" Decision: " << handle->back()->topoWord() );
354 handle->push_back(std::make_unique<xAOD::L1TopoSimResults>());
356 handle->back()->setClock(clock);
357 handle->back()->setBitWidth(32);
358 handle->back()->setTopoWordOverflow(word);
360 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->back()->connectionId() <<
" Clock: " << handle->back()->clock() <<
" Decision: " << handle->back()->topoWord() );
366 handle->push_back(std::make_unique<xAOD::L1TopoSimResults>());
368 handle->back()->setClock(clock);
369 handle->back()->setBitWidth(64);
370 handle->back()->setTopoWord64(word);
372 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->back()->connectionId() <<
" Clock: " << handle->back()->clock() <<
" Decision: " << handle->back()->topoWord() );
378 handle->push_back(std::make_unique<xAOD::L1TopoSimResults>());
380 handle->back()->setClock(clock);
381 handle->back()->setBitWidth(64);
382 handle->back()->setTopoWord64Overflow(word);
384 ATH_MSG_DEBUG(
"L1Topo EDM:: Connection Id: " << handle->back()->connectionId() <<
" Clock: " << handle->back()->clock() <<
" Decision: " << handle->back()->topoWord() );
399 StatusCode
sc = StatusCode::SUCCESS;
400 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
401 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
402 bool prescalForDAQROBAccess =
true;
403 if (prescalForDAQROBAccess){
404 std::vector<L1Topo::L1TopoTOB> daqTobsBC0;
405 std::vector<uint32_t> tobsbc0SourceIds;
408 if (
sc.isFailure() or 0 == rdos) {
409 ATH_MSG_INFO (
"Could not retrieve L1Topo DAQ RDO collection from StoreGate" );
410 }
else if (rdos->
empty()) {
414 const std::vector<uint32_t> cDataWords = rdo->getDataWords();
417 for (
const uint32_t word : cDataWords){
425 if (
header.bcn_offset()==0){
426 daqTobsBC0.push_back(tob);
427 tobsbc0SourceIds.push_back(rdo->getSourceID());
436 for(uint32_t iTob=0; iTob<daqTobsBC0.size(); ++iTob){
438 const uint32_t &sourceId = tobsbc0SourceIds[iTob];
439 for(
unsigned int i=0; i<8; ++i){
446 hardwareDaqRobOvrflowBits);
457 StatusCode
sc = StatusCode::SUCCESS;
459 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobTriggerBits;
460 std::bitset<TCS::TopoSteering::numberOfL1TopoBits> hardwareDaqRobOvrflowBits;
464 ATH_MSG_FATAL(
"Could not retrieve L1Topo RAW Data Container from the BS data.");
465 return StatusCode::FAILURE;
468 std::unique_ptr<L1Topo::L1TopoResult> l1topoResult = std::make_unique<L1Topo::L1TopoResult>(*cont);
469 if (!l1topoResult->getStatus()) {
471 return StatusCode::FAILURE;
473 hardwareDaqRobTriggerBits = l1topoResult->getDecisions();
474 hardwareDaqRobOvrflowBits = l1topoResult->getOverflows();
479 hardwareDaqRobOvrflowBits);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
bool empty() const noexcept
Returns true if the collection is empty.
Container of L1TopoRDOs (standard Athena boilerplate)
The class that represents the raw data received from an L1Topo board.
Represents the L1Topo TOB word of the L1Topo ROI data, with decode and encoder.
uint32_t overflow_bits() const
accessor method for overflow bits
uint32_t trigger_bits() const
accessor method for trigger bits
Gaudi::Property< unsigned int > m_prescale
virtual StatusCode start() override
StatusCode hardwareDecisionPhase1(const EventContext &ctx)
Gaudi::Property< bool > m_enableInputDump
SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_legacyTopoOverflowCTPLocation
SG key of overflow bits for CTP.
StatusCode hardwareDecisionLegacy()
StatusCode retrieveHardwareDecision(bool isLegacy, const EventContext &ctx)
Retrieve the L1Topo hardware bits from the DAQ RODs.
std::unique_ptr< TCS::TopoSteering > m_topoSteering
the topo steering
ToolHandle< IInputTOBConverter > m_energyInputProvider
SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_legacyL1topoKey
Gaudi::Property< bool > m_isLegacyTopo
SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > m_l1topoRawDataKey
virtual StatusCode finalize() override
void WriteEDM(SG::WriteHandle< xAOD::L1TopoSimResultsContainer > &handle, const std::string &name, unsigned int clock, uint32_t word)
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_topoOverflowCTPLocation
SG key of overflow bits for CTP.
virtual StatusCode execute() override
Gaudi::Property< unsigned int > m_prescaleForDAQROBAccess
void WriteEDM_Overflow(SG::WriteHandle< xAOD::L1TopoSimResultsContainer > &handle, const std::string &name, unsigned int clock, uint32_t word)
L1TopoSimulation(const std::string &name, ISvcLocator *pSvcLocator)
virtual bool isClonable() const override
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_topoCTPLocation
SG key of decision bits for CTP.
ToolHandle< IInputTOBConverter > m_muonInputProvider
Gaudi::Property< std::string > m_inputDumpFile
ToolHandle< IInputTOBConverter > m_emtauInputProvider
Gaudi::Property< bool > m_fillHistogramsBasedOnHardwareDecision
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_legacyTopoCTPLocation
SG key of decision bits for CTP.
std::unique_ptr< LVL1::PeriodicScaler > m_scaler
ToolHandle< IInputTOBConverter > m_jetInputProvider
Utility class to determine if a chain should be prescaled/passed-through using its PS/PT factor,...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::bitset< 128 > count_field(const std::string &l1connName) const
uint64_t decision_field(const std::string &l1connName) const
uint64_t ambiguity_field(const std::string &l1connName) const
uint64_t overflow_field(const std::string &l1connName) const
::StatusCode StatusCode
StatusCode definition for legacy code.
L1Topo::BlockTypes blockType(const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
Function to return the block type of a data word from L1Topo.
unsigned int triggerBitIndexNew(uint32_t moduleId, const L1Topo::L1TopoTOB &, unsigned int bitIdx)
Helper to calculate the index needed to pack trigger bits into the full 128-bit decision....
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
outputTopoType_t outputType(const std::string &output)