 |
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "CoolKernel/types.h"
22 std::shared_ptr<TrigConf::HLTPrescalesSet>
24 auto pss = std::make_shared<HLTPrescalesSet>();
41 std::shared_ptr<TrigConf::HLTPrescalesSet>
44 ATH_MSG_WARNING(
"Currently it is not possible to load run 2 prescale sets from the database. Will not load HLT psk " << psk );
47 auto pss = std::make_shared<HLTPrescalesSet>();
49 ATH_MSG_DEBUG(
"Setting up TrigDBHLTPrescalesSetLoader with DB connection " << m_dbConnection.value() );
52 std::string crest_api(
"");
64 ATH_MSG_WARNING(
"Failed loading HLT prescales set from db with key " << psk );
78 ATH_CHECK(m_pskFolderInputKey.initialize());
79 if( m_configSource ==
"FILE" || m_configSource ==
"DB" ) {
80 renounce( m_pskFolderInputKey );
83 ATH_CHECK(m_hltPrescalesSetOutputKey.initialize());
85 if( m_dbConnection ==
"JOSVC" ) {
86 if( m_configSource ==
"COOL" || m_configSource ==
"DB" ) {
87 if(
auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>(
"JobOptionsSvc" ) ) {
88 if( joSvc->hltPrescaleKey()>0 ) {
89 m_psk = joSvc->hltPrescaleKey();
90 m_dbConnection = joSvc->server();
91 ATH_MSG_INFO(
"Set psk to " << m_psk <<
" and db connection to " << m_dbConnection );
104 if( m_configSource ==
"FILE" ) {
108 std::shared_ptr<HLTPrescalesSet> pss = createFromFile( m_filename );
109 if( pss ==
nullptr ) {
110 ATH_MSG_ERROR(
"Failed loading HLT prescales set from the file " << m_filename );
111 return StatusCode::FAILURE;
113 m_pssMap.insert(std::make_pair(0
u, std::move(pss)));
115 }
else if( m_psk != 0
u ) {
120 std::shared_ptr<HLTPrescalesSet> pss =
createFromDB( m_psk,
true );
121 if( pss ==
nullptr ) {
122 ATH_MSG_ERROR(
"Failed loading HLT prescales set " << m_psk <<
" from the database" );
123 return StatusCode::FAILURE;
125 m_pssMap.insert(std::make_pair(m_psk.value(), std::move(pss)));
128 return StatusCode::SUCCESS;
134 ATH_MSG_DEBUG(
"HLTPrescaleCondAlg::execute with lb " << ctx.eventID().lumi_block());
137 if (writeCondHandle.
isValid()) {
138 return StatusCode::SUCCESS;
141 unsigned int hltPsk = m_psk;
144 if(m_configSource ==
"COOL") {
148 if ( pskAL ==
nullptr ) {
149 ATH_MSG_FATAL(
"Null pointer to the read conditions object of " << m_pskFolderInputKey.key());
150 return StatusCode::FAILURE;
154 return StatusCode::FAILURE;
159 hltPsk = (*pskAL)[
"HltPrescaleKey"].data<cool::UInt32>();
160 ATH_MSG_INFO(
"Extracted the HLT PSK " << hltPsk <<
" for run " << ctx.eventID().run_number()
161 <<
" and lb " << ctx.eventID().lumi_block() );
168 start.set_lumi_block(0);
170 stop.set_lumi_block(0);
175 std::shared_ptr<const HLTPrescalesSet> pss;
177 if( m_configSource ==
"FILE" ) {
179 pss = m_pssMap.at(0);
181 }
else if ( hltPsk != 0 ) {
183 auto pssi = m_pssMap.find( hltPsk );
185 if( pssi == m_pssMap.end()) {
187 bool isRun3 =
range.start().run_number()>350000;
191 if( pss ==
nullptr ) {
192 ATH_MSG_ERROR(
"Failed loading HLT prescales set from the database" );
193 return StatusCode::FAILURE;
196 const auto p = m_pssMap.insert(std::make_pair( hltPsk, pss ));
197 pss =
p.first->second;
207 ATH_MSG_ERROR(
"Failed loading HLT prescales set (not reading from FILE and no psk known)" );
208 return StatusCode::FAILURE;
213 if( pss ==
nullptr ) {
218 ATH_MSG_INFO(
"Recording HLT prescales set with range " <<
range <<
" (key = " << pss->
psk() <<
")");
222 return StatusCode::SUCCESS;
HLTPrescaleCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
virtual StatusCode execute(const EventContext &ctx) const override
bool range(EventIDRange &r)
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
bool loadHLTPrescales(unsigned int hltpsk, HLTPrescalesSet &hltpss, const std::string &outFileName="") const
Load content from the Trigger DB into an HLTPrescalesSet for a given HLTPrescaleKey (HLTPSK)
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.
virtual StatusCode initialize() override
::StatusCode StatusCode
StatusCode definition for legacy code.
Loader class for Trigger configuration (HLT prescales set) from the Trigger DB.
void setCrestTrigDB(const std::string &crestTrigDB)
set trigger db for the crest connection
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
void setLevel(MSGTC::Level lvl)
std::shared_ptr< HLTPrescalesSet > createFromDB(unsigned int psk, bool isRun3) const
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
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.
Loader of trigger configurations from Json files.
Loader of trigger configurations from Json files.
std::shared_ptr< HLTPrescalesSet > createFromFile(const std::string &filename) const
unsigned int psk() const
setter and getter for the HLT prescale key
const std::string & key() const