Commit d5b204ea authored by Joerg Stelzer's avatar Joerg Stelzer
Browse files

First version of HLTPrescaleCondAlg (no caching yet)

parent 9dbff6c2
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "./HLTPrescaleCondAlg.h"
#include "TrigConfIO/TrigDBHLTPrescalesSetLoader.h"
#include "CoolKernel/types.h"
TrigConf::HLTPrescaleCondAlg::HLTPrescaleCondAlg(const std::string& name, ISvcLocator* pSvcLocator) :
AthReentrantAlgorithm(name, pSvcLocator)
{}
StatusCode
TrigConf::HLTPrescaleCondAlg::initialize() {
ATH_MSG_INFO("initialize");
ATH_CHECK(m_pskFolderInputKey.initialize());
ATH_CHECK(m_hltPrescaleSetOutputKey.initialize());
return StatusCode::SUCCESS;
}
StatusCode
TrigConf::HLTPrescaleCondAlg::execute(const EventContext& ctx) const {
SG::ReadCondHandle<AthenaAttributeList> readH(m_pskFolderInputKey, ctx);
const AthenaAttributeList * pskAL{ *readH };
if ( pskAL == nullptr ) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_pskFolderInputKey.key());
return StatusCode::FAILURE;
}
EventIDRange range;
if (not readH.range(range)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readH.key());
return StatusCode::FAILURE;
}
// get the prescale key from the cool folder
unsigned int hltPsk = (*pskAL)["HltPrescaleKey"].data<cool::UInt32>();
// load the HLT psk into HLT prescales set
TrigConf::TrigDBHLTPrescalesSetLoader psLoader(m_dbConnection);
psLoader.setLevel(TrigConf::MSGTC::WARNING);
TrigConf::HLTPrescalesSet * pss = new TrigConf::HLTPrescalesSet;
if( psLoader.loadHLTPrescales( hltPsk, *pss ) ) {
ATH_MSG_INFO( "HLT prescales set successfully loaded from db with key " << m_psk.value() );
} else {
ATH_MSG_ERROR( "Failed loading HLT prescales set from db with key " << m_psk.value() );
return StatusCode::FAILURE;
}
// recording HLT prescales set
SG::WriteCondHandle<TrigConf::HLTPrescalesSet> writeCondHandle(m_hltPrescaleSetOutputKey, ctx);
ATH_MSG_INFO("Recording HLT prescales set with range " << range);
ATH_CHECK(writeCondHandle.record( range, pss ));
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGCONFIGSVC__HLTPRESCALECONDALG
#define TRIGCONFIGSVC__HLTPRESCALECONDALG
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "TrigConfData/HLTPrescalesSet.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
namespace TrigConf {
/**
* @brief Condition algorithm to provide the L1 trigger menu
*
* The algorithm will provide the menu configuration through a conditions handle using \c TrigConf::L1Menu to present the data
*
* It is able to load the configuration in the following 3 ways
* * File-based menu description: for most test environments: for test jobs with no database involved
* * DB-based menu description where the DB keys are provided as algorithm job-properties: for reprocessing grid jobs with new menus
* * DB-based menu description where the DB keys are taken from COOL: for offline reconstruction jobs
*/
class HLTPrescaleCondAlg : public AthReentrantAlgorithm {
public:
HLTPrescaleCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~HLTPrescaleCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
private:
// input key to the HLT Prescale Key folder
SG::ReadCondHandleKey<AthenaAttributeList> m_pskFolderInputKey{ this, "PSKFolder", "/TRIGGER/HLT/HLTPrescaleKey", "SG Key of AthenaAttributeList containing hlt psk"};
// output key to store the HLTPrescalesSet
SG::WriteCondHandleKey<TrigConf::HLTPrescalesSet> m_hltPrescaleSetOutputKey{ this, "HLTPrescales", "HLTPrescales", "HLT prescales"};
// other properties
Gaudi::Property< std::string > m_dbConnection { this, "TriggerDB", "TRIGGERDB", "DB connection alias" };
Gaudi::Property< unsigned int > m_psk { this, "PSK", 0, "HLT prescale key" };
};
}
#endif
......@@ -6,6 +6,8 @@
#include "../TrigConfigSvc.h"
#include "../TrigConfDataIOVChanger.h"
#include "../HLTPrescaleCondAlg.h"
DECLARE_COMPONENT( TrigConf::TrigConfDataIOVChanger )
DECLARE_COMPONENT( TrigConf::L1TopoConfigSvc )
DECLARE_COMPONENT( TrigConf::LVL1ConfigSvc )
......@@ -14,3 +16,4 @@ DECLARE_COMPONENT( TrigConf::JobOptionsSvc )
DECLARE_COMPONENT( TrigConf::DSConfigSvc )
DECLARE_COMPONENT( TrigConf::TrigConfigSvc )
DECLARE_COMPONENT( TrigConf::HLTPrescaleCondAlg )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment