Skip to content
Snippets Groups Projects
Commit 677540d9 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'trigconf_ioptsvc' into 'master'

TrigConfigSvc: remove usage of IJobOptionsSvc

See merge request atlas/athena!36139
parents 8d635472 ffe78f72
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// $Id: DSConfigSvc.cxx 742408 2016-04-23 18:55:57Z stelzer $
#include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/Incident.h" #include "GaudiKernel/Incident.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "AthenaKernel/errorcheck.h" #include "AthenaKernel/errorcheck.h"
#include "AthenaKernel/IIOVDbSvc.h"
#include "CoolKernel/Record.h" #include "CoolKernel/Record.h"
...@@ -84,8 +83,7 @@ TrigConf::DSConfigSvc::DSConfigSvc( const std::string& name, ...@@ -84,8 +83,7 @@ TrigConf::DSConfigSvc::DSConfigSvc( const std::string& name,
m_hltPsKey( 0 ), m_hltPsKey( 0 ),
m_lvl1BgKey( 0 ), m_lvl1BgKey( 0 ),
m_configSrc( "" ), m_configSrc( "" ),
m_detstore( "StoreGateSvc/DetectorStore", name ), m_detstore( "StoreGateSvc/DetectorStore", name )
m_folders( "" )
{ {
m_configSourceString="dblookup"; m_configSourceString="dblookup";
m_dbServer="TRIGGERDB"; m_dbServer="TRIGGERDB";
...@@ -105,14 +103,14 @@ TrigConf::DSConfigSvc::initialize() { ...@@ -105,14 +103,14 @@ TrigConf::DSConfigSvc::initialize() {
// get detector store // get detector store
CHECK( m_detstore.retrieve() ); CHECK( m_detstore.retrieve() );
ServiceHandle< IJobOptionsSvc > jobOptionsSvc( "JobOptionsSvc", name() ); ServiceHandle< IIOVDbSvc > iovDbSvc( "IOVDbSvc", name() );
if( jobOptionsSvc.retrieve().isFailure() ) { if( iovDbSvc.retrieve().isFailure() ) {
ATH_MSG_WARNING( "Cannot retrieve JobOptionsSvc" ); ATH_MSG_WARNING( "Cannot retrieve IOVDbSvc" );
} else { } else {
const Gaudi::Details::PropertyBase* p = IIOVDbSvc::KeyInfo info;
Gaudi::Utils::getProperty( jobOptionsSvc->getProperties( "IOVDbSvc" ), "Folders" ); for ( const std::string& key : iovDbSvc->getKeyList() ) {
if( p ) m_folders = p->toString(); if ( iovDbSvc->getKeyInfo(key, info) ) m_folders.insert(info.folderName);
ATH_MSG_DEBUG( "The string 'folders' is: " << m_folders ); }
} }
const bool multichannel = true; const bool multichannel = true;
...@@ -891,11 +889,5 @@ TrigConf::DSConfigSvc::assignPrescalesToChains(uint /*lumiblock*/) { ...@@ -891,11 +889,5 @@ TrigConf::DSConfigSvc::assignPrescalesToChains(uint /*lumiblock*/) {
bool bool
TrigConf::DSConfigSvc::hasFolder( const std::string& folder_name ){ TrigConf::DSConfigSvc::hasFolder( const std::string& folder_name ){
return m_folders.find( folder_name ) != m_folders.end();
if( m_folders.find( folder_name ) != string::npos ) {
return true;
} else {
return false;
}
} }
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef TrigConfig_DSConfigSvc #ifndef TrigConfig_DSConfigSvc
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "TrigConfInterfaces/ITrigConfigSvc.h" #include "TrigConfInterfaces/ITrigConfigSvc.h"
#include <memory> #include <memory>
#include <set>
namespace TXC { namespace TXC {
class L1TopoMenu; class L1TopoMenu;
...@@ -156,8 +157,8 @@ namespace TrigConf { ...@@ -156,8 +157,8 @@ namespace TrigConf {
ServiceHandle< StoreGateSvc > m_detstore; ServiceHandle< StoreGateSvc > m_detstore;
///to avoid crashes when a folder is not present and allow for lvl1/htl separation : ///to avoid crashes when a folder is not present and allow for lvl1/htl separation :
/// /* std::string folders will take the info on folders from IOVDbSvc*/ /// /* m_folders will take the info on folders from IOVDbSvc*/
std::string m_folders; std::set<std::string> m_folders;
// hasFolder(folder_name) will return true if folder_name is found in the string returned by IOVDbSvc, false otherwise // hasFolder(folder_name) will return true if folder_name is found in the string returned by IOVDbSvc, false otherwise
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/Incident.h" #include "GaudiKernel/Incident.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "GaudiKernel/ITHistSvc.h" #include "GaudiKernel/ITHistSvc.h"
#include "GaudiKernel/Timing.h" #include "GaudiKernel/Timing.h"
...@@ -67,8 +66,6 @@ HLTConfigSvc::HLTConfigSvc( const string& name, ISvcLocator* pSvcLocator ) : ...@@ -67,8 +66,6 @@ HLTConfigSvc::HLTConfigSvc( const string& name, ISvcLocator* pSvcLocator ) :
"List of HLT Prescale keys associated with start Lumiblocks LB1uPSK1cLB2uPSK2" ); "List of HLT Prescale keys associated with start Lumiblocks LB1uPSK1cLB2uPSK2" );
declareProperty( "HistTimePrescaleUpdate", m_histProp_timePrescaleUpdate, declareProperty( "HistTimePrescaleUpdate", m_histProp_timePrescaleUpdate,
"Histogram of time for prescale update"); "Histogram of time for prescale update");
declareProperty( "PartitionName", m_PartitionName,
"Name of the partition for the trigger prescale update mechanism");
declareProperty( "doMergedHLT", m_setMergedHLT, declareProperty( "doMergedHLT", m_setMergedHLT,
"Set true to run the merged HLT processing"); "Set true to run the merged HLT processing");
declareProperty( "doMonitoring", m_doMon, declareProperty( "doMonitoring", m_doMon,
...@@ -195,28 +192,12 @@ HLTConfigSvc::initialize() { ...@@ -195,28 +192,12 @@ HLTConfigSvc::initialize() {
ATH_MSG_INFO("xml file set to NONE, will not load HLT Menu"); ATH_MSG_INFO("xml file set to NONE, will not load HLT Menu");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
// get the partition name
// non-empty job-property overwrite value from DataFlowConfig
if(m_PartitionName.value() !="") {
m_partition = m_PartitionName;
} else {
ServiceHandle<::IJobOptionsSvc> jobOptionsSvc("JobOptionsSvc", name());
if (jobOptionsSvc.retrieve().isFailure()) {
ATH_MSG_WARNING("Cannot retrieve JobOptionsSvc");
} else {
const Gaudi::Details::PropertyBase* p=Gaudi::Utils::getProperty( jobOptionsSvc->getProperties("DataFlowConfig"), "DF_PartitionName");
if (p != 0) m_partition = p->toString();
}
}
if( fromDB() ) { if( fromDB() ) {
ATH_MSG_INFO(" DB HLT PrescaleKey = " << m_dbHLTPSKey); ATH_MSG_INFO(" DB HLT PrescaleKey = " << m_dbHLTPSKey);
ATH_MSG_INFO(" DB HLT PrescaleKeys = " << m_dbHLTPSKeySet); ATH_MSG_INFO(" DB HLT PrescaleKeys = " << m_dbHLTPSKeySet);
} }
ATH_MSG_INFO(" Partition = " << m_partition); ATH_MSG_INFO(" Run merged HLT = " << m_setMergedHLT);
ATH_MSG_INFO(" Run merged HLT = " << m_setMergedHLT);
if( fromDB() && m_dbHLTPSKey!=0 && !m_dbconfig->m_hltkeys.empty() ) if( fromDB() && m_dbHLTPSKey!=0 && !m_dbconfig->m_hltkeys.empty() )
...@@ -447,106 +428,26 @@ TrigConf::HLTConfigSvc::setL2LowerChainCounter(const CTPConfig* ctpcfg) { ...@@ -447,106 +428,26 @@ TrigConf::HLTConfigSvc::setL2LowerChainCounter(const CTPConfig* ctpcfg) {
// query the TriggerDB for the list of lumiblocks and corresponding prescalekeys // query the TriggerDB for the list of lumiblocks and corresponding prescalekeys
// will then load the and prescaleSets that have not yet been loaded // will then load the and prescaleSets that have not yet been loaded
StatusCode StatusCode
TrigConf::HLTConfigSvc::updatePrescaleSets(uint requestcount) { TrigConf::HLTConfigSvc::updatePrescaleSets(uint /*requestcount*/) {
if( ! fromDB() ) { // xml if( ! fromDB() ) { // xml
ATH_MSG_WARNING("Configured to not run from the database!"); ATH_MSG_WARNING("Configured to not run from the database!");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
if( !m_dbconfig->m_hltkeys.empty() ) {
ATH_MSG_WARNING("Has list of [(lb1,psk1), (lb2,psk2),...] defined!");
return StatusCode::SUCCESS;
}
// Start timer
longlong t1_ms = System::currentTime(System::milliSec);
// Load prescale set
CHECK(initStorageMgr());
bool loadSuccess = dynamic_cast<TrigConf::StorageMgr*>
(m_storageMgr)->hltPrescaleSetCollectionLoader().load( m_HLTFrame.thePrescaleSetCollection(), requestcount, m_partition );
CHECK(freeStorageMgr());
// Stop timer and fill histogram
uint64_t t2_ms = System::currentTime(System::milliSec);
if (m_hist_timePrescaleUpdate) m_hist_timePrescaleUpdate->Fill(t2_ms-t1_ms);
if(!loadSuccess) {
ATH_MSG_WARNING("HLTConfigSvc::updatePrescaleSets(): loading failed");
return StatusCode::FAILURE;
} else {
ATH_MSG_INFO ( m_HLTFrame.thePrescaleSetCollection() );
}
return StatusCode::SUCCESS;
}
// Helper for assignPrescalesToChains ATH_MSG_ERROR("Running from DB is no longer supported in legacy trigger");
namespace { return StatusCode::FAILURE;
inline void fillPrescaleHist(TH2I* h, uint lb, int psk) {
if (h==0) return;
// Use alpha-numeric bin labels to ensure correct gathering
char buf_psk[12], buf_lb[12];
snprintf(buf_psk, sizeof(buf_psk), "%d", psk); // faster than stringstream
snprintf(buf_lb, sizeof(buf_lb), "%03d", lb);
// Save number of bins and perform a locked Fill
int xbins = h->GetNbinsX();
int ybins = h->GetNbinsY();
oh_lock_histogram<TH2I> locked_hist(h);
locked_hist->Fill(buf_lb, buf_psk, 1);
// Need to make sure that all bins have labels (see Savannah #58243)
// Label additional bins on x-axis
if ( h->GetNbinsX()!=xbins ) {
const int N = h->GetNbinsX();
for (int b=xbins+2; b<=N; ++b) {
snprintf(buf_lb, sizeof(buf_lb), "%03d", ++lb);
locked_hist->GetXaxis()->SetBinLabel(b, buf_lb);
}
}
// Remove additional bins on y-axis
if ( h->GetNbinsY()!=ybins ) locked_hist->LabelsDeflate("Y");
}
} }
// Assigns the prescales that are valid for a given lumiblock to the chains // Assigns the prescales that are valid for a given lumiblock to the chains
// This method is called by TrigSteer on *every* event (keep it fast) // This method is called by TrigSteer on *every* event (keep it fast)
StatusCode StatusCode
TrigConf::HLTConfigSvc::assignPrescalesToChains(uint lumiblock) { TrigConf::HLTConfigSvc::assignPrescalesToChains(uint /*lumiblock*/) {
if(! fromDB() ) // xml if(! fromDB() ) // xml
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
if(lumiblock == m_currentLumiblock) { ATH_MSG_ERROR("Running from DB is no longer supported in legacy trigger");
fillPrescaleHist(m_hist_prescaleLB, lumiblock, m_currentPSS); return StatusCode::FAILURE;
return StatusCode::SUCCESS;
}
m_currentLumiblock = lumiblock;
// get the HLTPrescaleSet
const HLTPrescaleSet* pss = m_HLTFrame.getPrescaleSetCollection().prescaleSet(lumiblock);
if (pss == 0) {
ATH_MSG_ERROR("Could not retrieve HLT prescale set for lumiblock = " << lumiblock);
return StatusCode::FAILURE;
}
fillPrescaleHist(m_hist_prescaleLB, lumiblock, pss->id());
// still the same HLTPSS -> nothing to do
if(pss->id() == m_currentPSS) {
return StatusCode::SUCCESS;
}
ATH_MSG_INFO("Changing PSK from " << m_currentPSS << " to " << pss->id()
<< " for lumiblock " << lumiblock);
applyPrescaleSet(*pss);
return StatusCode::SUCCESS;
} }
...@@ -92,15 +92,11 @@ namespace TrigConf { ...@@ -92,15 +92,11 @@ namespace TrigConf {
// Properties: // Properties:
bool m_setMergedHLT { true }; bool m_setMergedHLT { true };
bool m_doMon { false }; bool m_doMon { false };
std::string m_partition { "" };
Histo1DProperty m_histProp_timePrescaleUpdate; Histo1DProperty m_histProp_timePrescaleUpdate;
// Histograms: // Histograms:
TH1F* m_hist_timePrescaleUpdate { nullptr }; TH1F* m_hist_timePrescaleUpdate { nullptr };
TH2I* m_hist_prescaleLB { nullptr }; TH2I* m_hist_prescaleLB { nullptr };
StringProperty m_PartitionName { "" }; // non-empty job-property overwrite value from DataFlowConfig
}; };
} }
......
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