Skip to content
Snippets Groups Projects
Commit 63ee86e1 authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Vakhtang Tsulaia
Browse files

TrigPSC: Fix for running athenaHLT from DB with HLTPSK

When running from the DB in athenaHLT, the HLTPSK needs to be read from
the database directly, `HLTPrescaleCondAlg.Source` needs to be changed
to `DB` to avoid trying to read the key from COOL.

Relates to ATR-22143.
parent 05957fd6
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
############################################################### ###############################################################
## @file TrigPSCPythonDbSetup.py ## @file TrigPSCPythonDbSetup.py
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
## @author Frank Winklmeier ## @author Frank Winklmeier
############################################################### ###############################################################
## This is a very minimal Python setup. It is only included when ## This is a very minimal Python setup. It is only used when running
## the POSTCOMMAND is non-empty while running from the DB. ## with athenaHLT from the DB. It is not used in a partition!
## Besides providing basic python bindings it also takes care of ## Besides providing basic python bindings it also takes care of
## switching the OutputLevel in case the "-l" option was used. ## switching the OutputLevel in case the "-l" option was used.
...@@ -39,6 +39,10 @@ from GaudiPython import * ...@@ -39,6 +39,10 @@ from GaudiPython import *
from GaudiPython.Bindings import iProperty from GaudiPython.Bindings import iProperty
from TrigCommon.TrigPyHelper import trigApp from TrigCommon.TrigPyHelper import trigApp
## If HLT PSK is set on command line read it from DB (and not COOL)
if 'hltkey' in PscConfig.optmap['JOBOPTIONSPATH']:
trigApp.changeJobProperties('HLTPrescaleCondAlg', 'Source', 'DB')
## Set OutputLevel in JobOptionsSvc if "-l" option was used in athenaHLT ## Set OutputLevel in JobOptionsSvc if "-l" option was used in athenaHLT
if logLevel!="INFO": if logLevel!="INFO":
outputLevel = int(locals()[logLevel]) outputLevel = int(locals()[logLevel])
......
...@@ -27,7 +27,6 @@ TrigConf::HLTPrescaleCondAlg::createFromFile( const std::string & filename ) con ...@@ -27,7 +27,6 @@ TrigConf::HLTPrescaleCondAlg::createFromFile( const std::string & filename ) con
if( psLoader.loadFile( filename, *pss) ) { if( psLoader.loadFile( filename, *pss) ) {
ATH_MSG_INFO( "HLT prescales set successfully loaded from file " << filename ); ATH_MSG_INFO( "HLT prescales set successfully loaded from file " << filename );
} else { } else {
ATH_MSG_WARNING( "Failed loading HLT prescales set from file " << filename ); // will be made an error later
pss = nullptr; pss = nullptr;
} }
return pss; return pss;
...@@ -71,15 +70,17 @@ TrigConf::HLTPrescaleCondAlg::initialize() { ...@@ -71,15 +70,17 @@ TrigConf::HLTPrescaleCondAlg::initialize() {
ATH_CHECK(m_hltPrescalesSetOutputKey.initialize()); ATH_CHECK(m_hltPrescalesSetOutputKey.initialize());
if( m_configSource == "COOL" && m_dbConnection == "JOSVC" ) { if( m_dbConnection == "JOSVC" ) {
if( auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>( "JobOptionsSvc" ) ) { if( m_configSource == "COOL" || m_configSource == "DB" ) {
if( joSvc->hltPrescaleKey()>0 ) { if( auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>( "JobOptionsSvc" ) ) {
m_psk = joSvc->hltPrescaleKey(); if( joSvc->hltPrescaleKey()>0 ) {
m_dbConnection = joSvc->server(); m_psk = joSvc->hltPrescaleKey();
ATH_MSG_INFO("Set psk to " << m_psk << " and db connection to " << m_dbConnection ); m_dbConnection = joSvc->server();
ATH_MSG_INFO("Set psk to " << m_psk << " and db connection to " << m_dbConnection );
}
} else {
ATH_MSG_DEBUG("Did not locate TrigConf::IJobOptionsSvc");
} }
} else {
ATH_MSG_DEBUG("Did not locate TrigConf::IJobOptionsSvc");
} }
} }
...@@ -92,15 +93,24 @@ TrigConf::HLTPrescaleCondAlg::initialize() { ...@@ -92,15 +93,24 @@ TrigConf::HLTPrescaleCondAlg::initialize() {
// index 0 indicates that the configuration is from a file, a DB // index 0 indicates that the configuration is from a file, a DB
// PSK is greater than 0 // PSK is greater than 0
m_pssMap[0] = createFromFile( m_filename ); std::shared_ptr<HLTPrescalesSet> pss = createFromFile( m_filename );
if( pss == nullptr ) {
ATH_MSG_ERROR( "Failed loading HLT prescales set from the file " << m_filename );
return StatusCode::FAILURE;
}
m_pssMap[0] = pss;
} else if( m_psk != 0u ) { } else if( m_psk != 0u ) {
// this is for the case where the reading from the DB was // this is for the case where the reading from the DB was
// configured and also when we read from COOL online and get a // configured and also when we read from COOL online and get a
// PSK through the JobOptionsSvc // PSK through the JobOptionsSvc
m_pssMap[m_psk] = createFromDB( m_psk, true ); std::shared_ptr<HLTPrescalesSet> pss = createFromDB( m_psk, true );
if( pss == nullptr ) {
ATH_MSG_ERROR( "Failed loading HLT prescales set " << m_psk << " from the database" );
return StatusCode::FAILURE;
}
m_pssMap[m_psk] = pss;
} }
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
...@@ -156,11 +166,16 @@ TrigConf::HLTPrescaleCondAlg::execute(const EventContext& ctx) const { ...@@ -156,11 +166,16 @@ TrigConf::HLTPrescaleCondAlg::execute(const EventContext& ctx) const {
auto pssi = m_pssMap.find( hltPsk ); auto pssi = m_pssMap.find( hltPsk );
if( pssi == m_pssMap.end()) { if( pssi == m_pssMap.end()) {
bool isRun3 = range.start().run_number()>350000; bool isRun3 = range.start().run_number()>350000;
pss = m_pssMap[hltPsk] = createFromDB( hltPsk, isRun3 ); pss = m_pssMap[hltPsk] = createFromDB( hltPsk, isRun3 );
if( pss == nullptr ) {
ATH_MSG_ERROR( "Failed loading HLT prescales set from the database" );
return StatusCode::FAILURE;
}
} else { } else {
pss = pssi->second; pss = pssi->second;
...@@ -181,7 +196,7 @@ TrigConf::HLTPrescaleCondAlg::execute(const EventContext& ctx) const { ...@@ -181,7 +196,7 @@ TrigConf::HLTPrescaleCondAlg::execute(const EventContext& ctx) const {
ATH_MSG_INFO("Recording empty HLT prescales set with range " << range); ATH_MSG_INFO("Recording empty HLT prescales set with range " << range);
ATH_CHECK( writeCondHandle.record( range, new HLTPrescalesSet ) ); ATH_CHECK( writeCondHandle.record( range, new HLTPrescalesSet ) );
} else { } else {
ATH_MSG_INFO("Recording HLT prescales set with range " << range); ATH_MSG_INFO("Recording HLT prescales set with range " << range << " (key = " << hltPsk << ")");
ATH_CHECK( writeCondHandle.record( range, new HLTPrescalesSet(*pss) ) ); ATH_CHECK( writeCondHandle.record( range, new HLTPrescalesSet(*pss) ) );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment