Commit df4c0a30 authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Adam Edward Barton
Browse files

Apply suggestion to...

Apply suggestion to Trigger/TrigConfiguration/TrigConfInterfaces/TrigConfInterfaces/ITrigConfigSvc.h
parent 395bb2a1
......@@ -26,7 +26,6 @@ atlas_depends_on_subdirs( PUBLIC
Trigger/TrigConfiguration/TrigConfHLTData
Trigger/TrigConfiguration/TrigConfInterfaces
Trigger/TrigConfiguration/TrigConfL1Data
Trigger/TrigConfiguration/TrigConfigSvc
Trigger/TrigEvent/TrigMonitoringEvent
Trigger/TrigT1/TrigT1Interfaces
Trigger/TrigT1/TrigT1Result )
......@@ -39,13 +38,13 @@ atlas_add_library( TriggerD3PDMakerLib
src/*.cxx
PUBLIC_HEADERS TriggerD3PDMaker
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigSteeringEvent TrigDecisionToolLib TrigObjectMatchingLib StoreGateLib SGtests TrigConfigSvcLib
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigSteeringEvent TrigDecisionToolLib TrigObjectMatchingLib StoreGateLib SGtests
PRIVATE_LINK_LIBRARIES xAODTrigger AnalysisTriggerEvent TrigConfHLTData TrigConfL1Data TrigMonitoringEvent TrigT1Interfaces TrigT1Result )
atlas_add_component( TriggerD3PDMaker
src/components/*.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigDecisionToolLib TrigObjectMatchingLib TrigSteeringEvent StoreGateLib SGtests xAODTrigger AnalysisTriggerEvent TrigConfHLTData TrigConfL1Data TrigConfigSvcLib TrigMonitoringEvent TrigT1Interfaces TrigT1Result TriggerD3PDMakerLib )
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigDecisionToolLib TrigObjectMatchingLib TrigSteeringEvent StoreGateLib SGtests xAODTrigger AnalysisTriggerEvent TrigConfHLTData TrigConfL1Data TrigMonitoringEvent TrigT1Interfaces TrigT1Result TriggerD3PDMakerLib )
# Install files from the package:
atlas_install_python_modules( python/*.py )
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
......@@ -106,9 +106,6 @@ public:
private:
/// Property: Trigger configuration service instance.
ServiceHandle<TrigConf::ITrigConfigSvc> m_trigConfigSvc;
/// Property: DS configuration instance (sometimes used when reading MC).
ServiceHandle< TrigConf::ITrigConfigSvc > m_dsSvc;
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: TrigDBKeysFillerTool.cxx 504000 2012-06-05 16:28:50Z ssnyder $
......@@ -8,9 +8,6 @@
#include "AthenaKernel/errorcheck.h"
#include "CxxUtils/crc64.h"
// Trigger include(s):
#include "TrigConfigSvc/DSConfigSvc.h"
// Local include(s):
#include "TrigDBKeysFillerTool.h"
......@@ -20,9 +17,7 @@ namespace D3PD {
const std::string& name,
const IInterface* parent )
: BlockFillerTool< void >( type, name, parent ),
m_configSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ),
m_dsSvc( "TrigConf::DSConfigSvc/DSConfigSvc", name ) {
m_configSvc( "TrigConf::TrigConfigSvc/TrigConfigSvc", name ) {
book().ignore(); // Avoid coverity warnings.
}
......@@ -60,25 +55,9 @@ namespace D3PD {
( static_cast< int >( *m_smk ) < 0 ) ||
( static_cast< int >( *m_l1psk ) < 0 ) ||
( static_cast< int >( *m_hltpsk ) < 0 ) ) {
// See if we are reading an AOD:
if( ! m_dsSvc ) {
REPORT_MESSAGE( MSG::FATAL )
<< "The trigger configuration keys don't seem to make sense, and we're not using "
<< "TrigConf::DSConfigSvc...";
return StatusCode::FAILURE;
}
TrigConf::DSConfigSvc* dsSvc = dynamic_cast< TrigConf::DSConfigSvc* >( m_dsSvc.operator->() );
if( ! dsSvc ) {
REPORT_MESSAGE( MSG::FATAL )
<< "The trigger configuration keys don't seem to make sense, and we're not using "
<< "TrigConf::DSConfigSvc...";
return StatusCode::FAILURE;
}
// Turn the configuration source name (probably an XML file in this case) into an
// imaginary Super Master Key:
*m_smk = CxxUtils::crc64( dsSvc->configurationSource() ) & 0xffff;
*m_smk = CxxUtils::crc64( m_configSvc->configurationSource() ) & 0xffff;
*m_l1psk = 0;
*m_hltpsk = 0;
}
......
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: TrigDBKeysFillerTool.h 587765 2014-03-14 20:17:12Z ssnyder $
......@@ -50,8 +50,6 @@ namespace D3PD {
private:
/// The trigger configuration service to get the information from
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc;
/// Handle used (sometimes) when reading MC files
ServiceHandle< TrigConf::IHLTConfigSvc > m_dsSvc;
uint32_t* m_smk; ///< Super Master Key
uint32_t* m_l1psk; ///< LVL1 Prescale Key
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
......@@ -13,7 +13,6 @@
#include "TriggerD3PDMaker/TriggerKeyTool.h"
#include "TrigConfInterfaces/ITrigConfigSvc.h"
#include "TrigConfigSvc/DSConfigSvc.h"
#include "CxxUtils/crc64.h"
#include "AthenaKernel/errorcheck.h"
#include <sstream>
......@@ -33,16 +32,12 @@ TriggerKeyTool::TriggerKeyTool (const std::string& type,
const std::string& name,
const IInterface* parent)
: AthAlgTool (type, name, parent),
m_trigConfigSvc ("TrigConf::TrigConfigSvc/TrigConfigSvc", name),
m_dsSvc ("TrigConf::DSConfigSvc/DSConfigSvc", name)
m_trigConfigSvc ("TrigConf::TrigConfigSvc/TrigConfigSvc", name)
{
declareInterface<TriggerKeyTool> (this);
declareProperty ("TrigConfigSvc", m_trigConfigSvc,
"Trigger configuration service instance.");
declareProperty ("DSSvc", m_dsSvc,
"DS configuration instance "
"(sometimes used when reading MC).");
}
......@@ -74,24 +69,11 @@ TriggerKeyTool::Keys TriggerKeyTool::getKeys() const
if ( (keys.first == 0 && keys.second.first == 0 && keys.second.second == 0) ||
keys.first < 0 || keys.second.first < 0 || keys.second.second < 0 )
{
// See if we are reading an AOD:
const TrigConf::DSConfigSvc* dsSvc = 0;
if (m_dsSvc)
dsSvc = dynamic_cast<const TrigConf::DSConfigSvc*> (&*m_dsSvc);
if( ! dsSvc ) {
REPORT_MESSAGE( MSG::ERROR )
<< "The trigger configuration keys don't seem to make sense, "
<< "and we're not using TrigConf::DSConfigSvc...";
keys.first = -1;
}
else {
// Turn the configuration source name (probably an XML file in this case)
// into an imaginary Super Master Key:
keys =
std::make_pair( ( CxxUtils::crc64( dsSvc->configurationSource() ) & 0xffff ),
// Turn the configuration source name (probably an XML file in this case)
// into an imaginary Super Master Key:
keys =
std::make_pair( ( CxxUtils::crc64( m_trigConfigSvc->configurationSource() ) & 0xffff ),
std::make_pair( 0, 0 ) );
}
}
return keys;
}
......@@ -111,15 +93,7 @@ std::string TriggerKeyTool::getString() const
ss << "SMK" << smk;
return ss.str();
}
if (m_dsSvc) {
const TrigConf::DSConfigSvc* dsSvc =
dynamic_cast<const TrigConf::DSConfigSvc*> (&*m_dsSvc);
if (dsSvc)
return dsSvc->configurationSource();
}
return "";
return m_trigConfigSvc->configurationSource();
}
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from future.utils import iteritems
####################################################################
......@@ -121,19 +122,10 @@ if TriggerFlags.doMT():
recoLog.info( "Configuring LVL1 simulation (MT)" )
from TriggerJobOpts.Lvl1SimulationConfig import Lvl1SimulationSequence
topSequence += Lvl1SimulationSequence(None)
recoLog.info( "Configuring HLT (MT)" )
# this configuration of the HLTConfigSvc is only temporary
if not hasattr(svcMgr, 'HLTConfigSvc'):
from TrigConfigSvc.TrigConfigSvcConfig import HLTConfigSvc
svcMgr += HLTConfigSvc()
if TriggerFlags.readHLTconfigFromXML():
hltJsonFile = TriggerFlags.inputHLTconfigFile().replace(".xml",".json").replace("HLTconfig", "HLTmenu")
else:
hltJsonFile = TriggerFlags.outputHLTconfigFile().replace(".xml",".json").replace("HLTconfig", "HLTmenu")
svcMgr.HLTConfigSvc.InputType = "file"
svcMgr.HLTConfigSvc.JsonFileName = hltJsonFile
recoLog.info("Configured HLTConfigSvc with InputType='file' and JsonFileName=%s" % hltJsonFile)
recoLog.info( "Configuring HLT (MT)" )
from TrigConfigSvc.TrigConfigSvcCfg import getHLTConfigSvc
svcMgr += getHLTConfigSvc()
from L1Decoder.L1DecoderConfig import L1Decoder
topSequence += L1Decoder()
......
......@@ -59,8 +59,8 @@ namespace TrigConf {
*/
void clear();
/** Access to the underlying data, if needed */
const ptree & data() const { return m_data; }
/** Access to the underlying data, if needed */
ptree data() const { return m_data; }
/** Check for attribute
* @return true if the structure is just a value
......@@ -122,6 +122,14 @@ namespace TrigConf {
**/
DataStructure getObject(const std::string & pathToChild, bool ignoreIfMissing = false) const;
/** Access to the keys of an DataStructure which presents a dictionary
*
* In case the DataStructure is a list or a simple attribute, an empty vector is returned
**/
std::vector<std::string> getKeys() const;
/** Access to initialized state */
explicit operator bool() const { return m_initialized; }
bool isValid() const { return m_initialized; }
......
......@@ -147,6 +147,24 @@ TrigConf::DataStructure::getObject(const std::string & pathToChild, bool ignoreI
}
std::vector<std::string>
TrigConf::DataStructure::getKeys() const
{
std::vector<std::string> keys;
if ( ! m_data.empty() &&
! m_data.front().first.empty() )
{
for( auto & entry : m_data ) {
keys.push_back(entry.first);
}
}
return keys;
}
void
TrigConf::DataStructure::print(ostream & os) const
{
......
......@@ -18,19 +18,19 @@ TrigConf::Chain::~Chain()
const std::string &
TrigConf::Chain::name() const
{
return data().get_child("name").data();
return m_data.get_child("name").data();
}
unsigned int
TrigConf::Chain::counter() const
{
return data().get_child("counter").get_value<unsigned int>();
return m_data.get_child("counter").get_value<unsigned int>();
}
const std::string &
TrigConf::Chain::l1item() const
{
return data().get_child("l1item").data();
return m_data.get_child("l1item").data();
}
......
......@@ -17,43 +17,43 @@ TrigConf::L1Item::~L1Item()
const std::string &
TrigConf::L1Item::name() const
{
return data().get_child("name").data();
return m_data.get_child("name").data();
}
unsigned int
TrigConf::L1Item::ctpId() const
{
return data().get_child("ctpId").get_value<unsigned int>();
return m_data.get_child("ctpId").get_value<unsigned int>();
}
const std::string &
TrigConf::L1Item::definition() const
{
return data().get_child("definition").data();
return m_data.get_child("definition").data();
}
unsigned int
TrigConf::L1Item::complexDeadtime() const
{
return data().get_child("complexDeadtime").get_value<unsigned int>();
return m_data.get_child("complexDeadtime").get_value<unsigned int>();
}
const std::string &
TrigConf::L1Item::monitor() const
{
return data().get_child("monitor").data();
return m_data.get_child("monitor").data();
}
unsigned int
TrigConf::L1Item::partition() const
{
return data().get_child("partition").get_value<unsigned int>();
return m_data.get_child("partition").get_value<unsigned int>();
}
const std::string &
TrigConf::L1Item::triggerType() const
{
return data().get_child("triggerType").data();
return m_data.get_child("triggerType").data();
}
TrigConf::DataStructure
......
......@@ -19,31 +19,31 @@ TrigConf::L1Threshold::~L1Threshold()
const std::string &
TrigConf::L1Threshold::name() const
{
return data().get_child("name").data();
return m_data.get_child("name").data();
}
const std::string &
TrigConf::L1Threshold::type() const
{
return data().get_child("type").data();
return m_data.get_child("type").data();
}
const std::string &
TrigConf::L1Threshold::input() const
{
return data().get_child("input").data();
return m_data.get_child("input").data();
}
unsigned int
TrigConf::L1Threshold::mapping() const
{
return data().get_child("mapping").get_value<unsigned int>();
return m_data.get_child("mapping").get_value<unsigned int>();
}
unsigned int
TrigConf::L1Threshold::id() const
{
return data().get_child("id").get_value<unsigned int>();
return m_data.get_child("id").get_value<unsigned int>();
}
std::vector<TrigConf::DataStructure>
......
......@@ -17,19 +17,19 @@ TrigConf::L1TopoAlgorithm::~L1TopoAlgorithm()
unsigned int
TrigConf::L1TopoAlgorithm::algId() const
{
return data().get_child("algId").get_value<unsigned int>();
return m_data.get_child("algId").get_value<unsigned int>();
}
const std::string &
TrigConf::L1TopoAlgorithm::name() const
{
return data().get_child("name").data();
return m_data.get_child("name").data();
}
const std::string &
TrigConf::L1TopoAlgorithm::type() const
{
return data().get_child("type").data();
return m_data.get_child("type").data();
}
......
......@@ -17,42 +17,42 @@ TrigConf::L1TopoOutput::~L1TopoOutput()
const std::string &
TrigConf::L1TopoOutput::algName() const
{
return data().get_child("algName").data();
return m_data.get_child("algName").data();
}
unsigned int
TrigConf::L1TopoOutput::algId() const
{
return data().get_child("algId").get_value<unsigned int>();
return m_data.get_child("algId").get_value<unsigned int>();
}
unsigned int
TrigConf::L1TopoOutput::clock() const
{
return data().get_child("clock").get_value<unsigned int>();
return m_data.get_child("clock").get_value<unsigned int>();
}
unsigned int
TrigConf::L1TopoOutput::firstBit() const
{
return data().get_child("firstBit").get_value<unsigned int>();
return m_data.get_child("firstBit").get_value<unsigned int>();
}
unsigned int
TrigConf::L1TopoOutput::fpga() const
{
return data().get_child("fpga").get_value<unsigned int>();
return m_data.get_child("fpga").get_value<unsigned int>();
}
unsigned int
TrigConf::L1TopoOutput::board() const
{
return data().get_child("board").get_value<unsigned int>();
return m_data.get_child("board").get_value<unsigned int>();
}
const std::string &
TrigConf::L1TopoOutput::triggerLines() const
{
return data().get_child("triggerLines").data();
return m_data.get_child("triggerLines").data();
}
......@@ -23,7 +23,7 @@ find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
# Component(s) in the package:
atlas_add_library( TrigConfIOLib
TrigConfIO/*.h src/JsonFileLoader.cxx src/TrigDBLoader.cxx
TrigConfIO/*.h src/JsonFileLoader.cxx src/TrigDBLoader.cxx src/TrigDBMenuLoader.cxx src/TrigDBJobOptionsLoader.cxx
PUBLIC_HEADERS TrigConfIO
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} TrigConfBase TrigConfData GaudiKernel
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file TrigConfIO/TrigDBJobOptionsLoader.h
* @author J. Stelzer
* @date Sep 2019
* @brief Loader class for Trigger configuration from the Trigger DB
*/
#ifndef TRIGCONFIO_TRIGDBJOBOPTIONSLOADER_H
#define TRIGCONFIO_TRIGDBJOBOPTIONSLOADER_H
#include "TrigConfData/DataStructure.h"
#include "boost/property_tree/ptree.hpp"
#include "TrigConfIO/TrigDBLoader.h"
namespace TrigConf {
/**
* @brief Loader of trigger configurations from Json files
*/
class TrigDBJobOptionsLoader : public TrigDBLoader {
public:
/** Constructor */
TrigDBJobOptionsLoader(const std::string & connection);
/** Destructor */
virtual ~TrigDBJobOptionsLoader();
/**
* @brief Load content from the Trigger DB into two ptrees for a given SuperMasterKey (SMK)
* @param smk [in] the SMK that should be loaded
* @param jobOptions [out] the loaded job options
*/
bool loadJobOptions ( unsigned int smk,
boost::property_tree::ptree & jobOptions ) const;
/**
* @brief Load content from the Trigger DB into an L1Menu and an HLTMenu for a given SuperMasterKey (SMK)
* @param smk [in] the SMK that should be loaded
* @param jobOptions [out] the loaded job options
*/
bool loadJobOptions ( unsigned int smk,
DataStructure & jobOptions ) const;
};
}
#endif
......@@ -9,16 +9,12 @@
* @brief Loader class for Trigger configuration from the Trigger DB
*/
#ifndef TRIGCONFSTORAGE_DBLOADER_H
#define TRIGCONFSTORAGE_DBLOADER_H
#ifndef TRIGCONFIO_TRIGDBLOADER_H
#define TRIGCONFIO_TRIGDBLOADER_H
#include "GaudiKernel/StatusCode.h"
#include "boost/property_tree/ptree.hpp"
#include "TrigConfBase/TrigConfMessaging.h"
#include "TrigConfData/DataStructure.h"
#include <memory>
namespace coral {
class ISessionProxy;
......@@ -33,53 +29,21 @@ namespace TrigConf {
public:
/** Constructor */
TrigDBLoader(const std::string & connection);
TrigDBLoader(const std::string & loaderName, const std::string & connection);
/** Destructor */
virtual ~TrigDBLoader();
/**
* @brief Load content from the Trigger DB into a ptree for a given SuperMasterKey (SMK)
* @param smk [in] the SMK
* @param data [out]
* @param pathToChild [in] Path to a sub structure for partial loading of data
*
* The file is searched for in the path list defined by the environment variable @c DATAPATH.
* If the optional parameter @c pathToChild is specified, one can load parts if the configuration
* from the file.
*@code
* TrigConf::TrigDBLoader fileLoader;
* TrigConf::DataStructure metSignificance;
* fileLoader.loadFile( l1_filename, metSignificance, "CaloInfo.METSignificance");
@endcode
*/
StatusCode loadMenu ( unsigned int smk,
boost::property_tree::ptree & l1data,
boost::property_tree::ptree & hltdata
);
/**
* @brief Load content of json file into a ptree
* @param filename [in] Name of the json file
* @param data [out]
* @param pathToChild [in] Path to a sub structure for partial loading of data
*/
StatusCode loadMenu ( unsigned int smk,
DataStructure & l1menu,
DataStructure & hltmenu);
void setLevel(MSGTC::Level lvl) { msg().setLevel(lvl); }
MSGTC::Level outputLevel() const { return msg().level(); }