 |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "CoolKernel/types.h"
22 std::shared_ptr<TrigConf::L1PrescalesSet>
24 auto pss = std::make_shared<L1PrescalesSet>();
42 std::shared_ptr<TrigConf::L1PrescalesSet>
45 ATH_MSG_WARNING(
"Currently it is not possible to load run 2 prescale sets from the database. Will not load L1 psk " << psk );
48 auto pss = std::make_shared<L1PrescalesSet>();
50 ATH_MSG_DEBUG(
"Setting up TrigDBL1PrescalesSetLoader with DB connection " << m_dbConnection.value() );
53 std::string crest_api(
"");
65 ATH_MSG_WARNING(
"Failed loading L1 prescales set from db with key " << psk );
79 ATH_CHECK(m_pskFolderInputKey.initialize());
80 if( m_configSource ==
"FILE" || m_configSource ==
"DB" ) {
81 renounce( m_pskFolderInputKey );
84 ATH_CHECK(m_l1PrescalesSetOutputKey.initialize());
86 if( m_configSource ==
"COOL" && m_dbConnection ==
"JOSVC" ) {
87 if(
auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>(
"JobOptionsSvc" ) ) {
88 if( joSvc->l1PrescaleKey()>0 ) {
89 m_psk = joSvc->l1PrescaleKey();
90 m_dbConnection = joSvc->server();
91 ATH_MSG_INFO(
"Set psk to " << m_psk <<
" and db connection to " << m_dbConnection );
103 if( m_configSource ==
"FILE" ) {
107 m_pssMap.insert(std::make_pair(0
u, createFromFile(m_filename)));
109 }
else if( m_psk != 0
u ) {
114 m_pssMap.insert(std::make_pair(m_psk,
createFromDB(m_psk,
true)));
118 return StatusCode::SUCCESS;
124 ATH_MSG_DEBUG(
"L1PrescaleCondAlg::execute with lb " << ctx.eventID().lumi_block());
127 if (writeCondHandle.
isValid()) {
128 return StatusCode::SUCCESS;
131 unsigned int l1Psk = m_psk;
134 if(m_configSource ==
"COOL") {
138 if ( pskAL ==
nullptr ) {
139 ATH_MSG_FATAL(
"Null pointer to the read conditions object of " << m_pskFolderInputKey.key());
140 return StatusCode::FAILURE;
144 return StatusCode::FAILURE;
149 l1Psk = (*pskAL)[
"Lvl1PrescaleConfigurationKey"].data<cool::UInt32>();
150 ATH_MSG_INFO(
"Extracted the L1 PSK " << l1Psk <<
" for run " << ctx.eventID().run_number()
151 <<
" and lb " << ctx.eventID().lumi_block() );
158 start.set_lumi_block(0);
160 stop.set_lumi_block(0);
165 std::shared_ptr<const L1PrescalesSet> pss;
167 if( m_configSource ==
"FILE" ) {
169 pss = m_pssMap.at(0);
171 }
else if ( l1Psk != 0 ) {
173 auto pssi = m_pssMap.find( l1Psk );
175 if( pssi == m_pssMap.end()) {
177 bool isRun3 =
range.start().run_number()>350000;
181 if( pss ==
nullptr ) {
182 ATH_MSG_ERROR(
"Failed loading L1 prescales set from the database" );
183 return StatusCode::FAILURE;
186 const auto p = m_pssMap.insert(std::make_pair( l1Psk, pss ));
187 pss =
p.first->second;
197 ATH_MSG_ERROR(
"Failed loading L1 prescales set (not reading from FILE and no psk known)" );
198 return StatusCode::FAILURE;
203 if( pss ==
nullptr ) {
207 ATH_MSG_INFO(
"Recording L1 prescales set with range " <<
range <<
" (key = " << pss->
psk() <<
")");
211 return StatusCode::SUCCESS;
std::shared_ptr< L1PrescalesSet > createFromFile(const std::string &filename) const
bool loadL1Prescales(unsigned int l1psk, L1PrescalesSet &l1pss, const std::string &outFileName="") const
Load content from the Trigger DB into an L1PrescalesSet for a given L1PrescaleKey (L1PSK)
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
bool range(EventIDRange &r)
std::shared_ptr< L1PrescalesSet > createFromDB(unsigned int psk, bool isRun3) const
void setCrestConnection(const std::string &server, const std::string &version="")
declare CREST as the source of the configuration An empty crest server makes it use Oracle
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
@ u
Enums for curvilinear frames.
An algorithm that can be simultaneously executed in multiple threads.
Loader class for Trigger configuration (L1 prescales set) from the Trigger DB.
::StatusCode StatusCode
StatusCode definition for legacy code.
void setCrestTrigDB(const std::string &crestTrigDB)
set trigger db for the crest connection
unsigned int psk() const
setter and getter for the L1 prescale key
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
void setLevel(MSGTC::Level lvl)
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
void createFromDB(GeoFullPhysVol *envelope, IRDBAccessSvc *rdbAccess, IGeoModelSvc *geoModel, StoredMaterialManager *materialManager)
#define ATH_MSG_WARNING(x)
void setLevel(MSGTC::Level lvl)
bool isCrestConnection(const std::string &db_connection_string, std::string &crest_server, std::string &crest_api, std::string &dbname)
Function to interpret the trigger connection string for CREST connections Format of the connections s...
Loader class for Trigger configuration from Json.
L1PrescaleCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Loader of trigger configurations from Json files.
const std::string & key() const
Loader of trigger configurations from Json files.