7 #include "CoolKernel/types.h"
23 ATH_CHECK(m_bgkFolderInputKey.initialize());
24 if( m_configSource ==
"FILE" || m_configSource ==
"DB" ) {
25 renounce( m_bgkFolderInputKey );
28 ATH_CHECK(m_l1BunchGroupSetOutputKey.initialize());
35 if( m_configSource ==
"FILE" ) {
39 m_BgsMap.insert(std::make_pair(0
u, createFromFile(m_filename)));
41 }
else if( m_bgk != 0
u ) {
46 m_BgsMap.insert(std::make_pair(m_bgk,
createFromDB(m_bgk)));
50 return StatusCode::SUCCESS;
53 std::shared_ptr<TrigConf::L1BunchGroupSet>
55 auto bgs = std::make_shared<L1BunchGroupSet>();
72 std::shared_ptr<TrigConf::L1BunchGroupSet>
74 auto bgs = std::make_shared<L1BunchGroupSet>();
75 ATH_MSG_DEBUG(
"Setting up TrigDBL1BunchGroupSetLoader with DB connection " << m_dbConnection.value() );
82 ATH_MSG_WARNING(
"Failed loading L1BunchGroup set from db with key " << bgk );
93 ATH_MSG_DEBUG(
"BunchGroupCondAlg::execute with lb " << ctx.eventID().lumi_block());
96 if (writeCondHandle.
isValid()) {
97 return StatusCode::SUCCESS;
100 unsigned int l1Ggk = m_bgk;
103 if(m_configSource ==
"COOL") {
108 if ( bgkAL ==
nullptr ) {
109 ATH_MSG_FATAL(
"Null pointer to the read conditions object of " << m_bgkFolderInputKey.key());
110 return StatusCode::FAILURE;
114 return StatusCode::FAILURE;
119 l1Ggk = (*bgkAL)[
"Lvl1BunchGroupConfigurationKey"].data<cool::UInt32>();
120 ATH_MSG_INFO(
"Extracted the L1 bgk " << l1Ggk <<
" for run " << ctx.eventID().run_number()
121 <<
" and lb " << ctx.eventID().lumi_block() );
128 start.set_lumi_block(0);
130 stop.set_lumi_block(0);
135 std::shared_ptr<const L1BunchGroupSet> bgs;
137 if( m_configSource ==
"FILE" ) {
139 bgs = m_BgsMap.at(0);
141 }
else if ( l1Ggk != 0 ) {
143 auto bgsi = m_BgsMap.find( l1Ggk );
145 if( bgsi == m_BgsMap.end()) {
149 if( bgs ==
nullptr ) {
150 ATH_MSG_ERROR(
"Failed loading bunchgroup set from the database" );
151 return StatusCode::FAILURE;
154 const auto p = m_BgsMap.insert(std::make_pair( l1Ggk, bgs ));
155 bgs =
p.first->second;
165 ATH_MSG_ERROR(
"Failed loading L1 BunchGroup set (not reading from FILE and no bgk known)" );
166 return StatusCode::FAILURE;
170 if( bgs ==
nullptr ) {
174 ATH_MSG_INFO(
"Recording L1BunchGroupSet set with range " <<
range <<
" (key = " << bgs->
bgsk() <<
")");
178 return StatusCode::SUCCESS;