10# include "GaudiKernel/IIncidentSvc.h"
11# include "GaudiKernel/ServiceHandle.h"
24#define BOOST_BIND_GLOBAL_PLACEHOLDERS
25#include <boost/property_tree/ptree.hpp>
26#include <boost/property_tree/json_parser.hpp>
116#ifndef XAOD_STANDALONE
122 incSvc->addListener(
this, IncidentType::BeginInputFile, 0,
true );
123 incSvc->addListener(
this, IncidentType::EndInputFile, 0,
true );
127 return StatusCode::SUCCESS;
132 if(
m_impl->m_ctpConfig.menu().size() == 0 ) {
134 throw std::runtime_error(
"Tool not initialised correctly" );
138 return &
m_impl->m_ctpConfig;
143 if(
m_impl->m_bgSet.bunchGroups().size() == 0 ) {
145 throw std::runtime_error(
"Tool not initialised correctly" );
156 ATH_MSG_FATAL(
"Trigger configuration not loaded for the current event" );
157 throw std::runtime_error(
"Tool not initialised correctly" );
166 throw std::runtime_error(
"Tool not initialised correctly" );
178 return m_impl->m_currentBg.bgsk();
180 ATH_MSG_DEBUG(
"There's no way to access the bunch group set key from a legacy AOD!");
181 return std::numeric_limits<uint32_t>::max();
187 if(
m_impl->m_chainList.size() == 0 ) {
189 throw std::runtime_error(
"Tool not initialised correctly" );
193 return m_impl->m_chainList;
198 if(
m_impl->m_sequenceList.size() == 0 ) {
200 throw std::runtime_error(
"Tool not initialised correctly" );
204 return m_impl->m_sequenceList;
211 ATH_MSG_FATAL(
"Trigger configuration not loaded for the current event" );
212 throw std::runtime_error(
"Tool not initialised correctly" );
221 throw std::runtime_error(
"Tool not initialised correctly" );
234 ATH_MSG_FATAL(
"Trigger configuration not loaded for the current event" );
235 throw std::runtime_error(
"Tool not initialised correctly" );
244 throw std::runtime_error(
"Tool not initialised correctly" );
256 throw std::runtime_error(
"Tool not initialised correctly" );
258 return m_impl->m_currentHlt;
264 throw std::runtime_error(
"Tool not initialised correctly" );
266 return m_impl->m_currentHltmonitoring;
272 throw std::runtime_error(
"Tool not initialised correctly" );
274 return m_impl->m_currentL1;
280 throw std::runtime_error(
"Tool not initialised correctly" );
282 return m_impl->m_currentHltps;
288 throw std::runtime_error(
"Tool not initialised correctly" );
290 return m_impl->m_currentL1ps;
296 throw std::runtime_error(
"Tool not initialised correctly" );
298 return m_impl->m_currentBg;
304 ATH_MSG_DEBUG(
"Loading the trigger menu from a new input file" );
359 return StatusCode::SUCCESS;
372 return StatusCode::SUCCESS;
420 return StatusCode::SUCCESS;
425 if(
m_tmc->size() == 0 ) {
431 return StatusCode::SUCCESS;
441 return StatusCode::SUCCESS;
444 ATH_MSG_ERROR(
"Both m_menuJSONContainerAvailable and m_triggerMenuContainerAvailable are false");
445 return StatusCode::FAILURE;
449#ifndef XAOD_STANDALONE
450 ATH_MSG_DEBUG(
"Input file closed, invalidating the cached trigger configuration" );
466 return StatusCode::SUCCESS;
495 ATH_MSG_ERROR(
"Both m_menuJSONContainerAvailable and m_triggerMenuContainerAvailable are false");
496 return StatusCode::FAILURE;
503 return StatusCode::SUCCESS;
507 ATH_MSG_ERROR(
"Trigger menu metadata not loaded for the current input file" );
508 return StatusCode::FAILURE;
514 for( ; menu_itr != menu_end; ++menu_itr ) {
525 return StatusCode::SUCCESS;
529 ATH_MSG_ERROR(
"Couldn't find configuration for current event (SMK:"
530 << keys->smk() <<
", L1PSK:" << keys->l1psk()
531 <<
", HLTPSK:" << keys->hltpsk() <<
")" );
532 return StatusCode::FAILURE;
538 return StatusCode::FAILURE;
542 bool validConfig =
true;
565 return StatusCode::SUCCESS;
570 ATH_MSG_ERROR(
"Trigger menu metadata not loaded for the current input file" );
571 return StatusCode::FAILURE;
614 return StatusCode::SUCCESS;
619 const uint32_t keyToCheck,
624 for( ; menu_itr != menu_end; ++menu_itr ) {
626 if( keyToCheck != (*menu_itr)->key() )
continue;
627 ptrToSet = *menu_itr;
628 return StatusCode::SUCCESS;
631 ATH_MSG_FATAL(
"Couldn't find configuration for current event"
632 <<
", Requested key=" << keyToCheck
633 <<
", Requested menu=" << humanName);
634 return StatusCode::FAILURE;
648 return StatusCode::SUCCESS;
655 std::stringstream rawData;
656 rawData <<
menu->payload();
657 dataStructure.
clear();
659 boost::property_tree::ptree pt;
660 boost::property_tree::read_json(rawData, pt);
661 dataStructure.
setData(std::move(pt));
662 }
catch (
const boost::property_tree::json_parser_error& e) {
663 ATH_MSG_FATAL(
"Unable to decode a JSON trigger menu metadata payload for " << humanName <<
" with key " <<
menu->key());
665 return StatusCode::FAILURE;
667 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Base class for Trigger configuration data and wrapper around underlying representation.
void setData(const ptree &data)
Setting the configuration data.
virtual void clear()
Clearing the configuration data.
list of all HLT chains in a trigger menu
HLT monitoring configuration.
uint32_t id() const
Get the 32-bit identifier of the bunch configuration.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
Forward iterator to traverse the main components of the trigger configuration.
StatusCode prepareTriggerMenu(const xAOD::TriggerMenu *menu, CTPConfig &ctpConfig, HLTChainList &chainList, HLTSequenceList &sequenceList, BunchGroupSet &bgSet, MsgStream &msg)
In order to avoid duplicating code between how the dual-use and the Athena-only code translates the x...
bool xAODKeysMatch(const xAOD::TrigConfKeys *keys, const xAOD::TriggerMenu *menu)
Since this is used in a couple of places, it seemed to make sense to put this simple code into a cent...
TriggerMenuJson_v1 TriggerMenuJson
Define the latest version of the trigger menu JSON class.
BunchConfKey_v1 BunchConfKey
Declare the current version of the bunch configuration key type.
TriggerMenuJsonContainer_v1 TriggerMenuJsonContainer
TrigConfKeys_v1 TrigConfKeys
Declare the current version of the trigger configuration keys type.