#include <TriggerExpressionHLTReader.h>
Public Member Functions | |
void | dump (std::ostream &out) const |
HLTReader (const std::string &pattern) | |
void | init (const Data &data) |
bool | operator() (const Data &data) const |
Private Attributes | |
std::string | m_pattern |
std::vector< std::pair < std::string, unsigned int > > | m_triggers |
Definition at line 11 of file TriggerExpressionHLTReader.h.
triggerExpression::HLTReader::HLTReader | ( | const std::string & | pattern | ) | [inline] |
Definition at line 13 of file TriggerExpressionHLTReader.h.
: m_pattern(pattern), m_triggers() { }
void triggerExpression::HLTReader::dump | ( | std::ostream & | out | ) | const [virtual] |
Implements triggerExpression::Evaluator.
Definition at line 27 of file TriggerExpressionHLTReader.cc.
References first, i, and m_triggers.
{ if (m_triggers.size() == 0) { out << "FALSE"; } else if (m_triggers.size() == 1) { out << m_triggers[0].first; } else { out << "(" << m_triggers[0].first; for (unsigned int i = 1; i < m_triggers.size(); ++i) out << " OR " << m_triggers[i].first; out << ")"; } }
void triggerExpression::HLTReader::init | ( | const Data & | data | ) | [virtual] |
Reimplemented from triggerExpression::Evaluator.
Definition at line 41 of file TriggerExpressionHLTReader.cc.
References triggerExpression::Data::hltMenu(), getHLTprescales::index, edm::is_glob(), m_pattern, m_triggers, match(), lumiQueryAPI::msg, AlCaHLTBitMon_ParallelJobs::p, edm::regexMatch(), triggerExpression::Data::shouldThrow(), edm::TriggerNames::size(), edm::TriggerNames::triggerIndex(), and edm::TriggerNames::triggerNames().
{ // clear the previous configuration m_triggers.clear(); // check if the pattern has is a glob expression, or a single trigger name const edm::TriggerNames & hltMenu = data.hltMenu(); if (not edm::is_glob(m_pattern)) { // no wildcard expression unsigned int index = hltMenu.triggerIndex(m_pattern); if (index < hltMenu.size()) m_triggers.push_back( std::make_pair(m_pattern, index) ); else { std::stringstream msg; msg << "requested HLT path \"" << m_pattern << "\" does not exist - known paths are:"; if (hltMenu.triggerNames().empty()) msg << " (none)"; else BOOST_FOREACH(const std::string & p, hltMenu.triggerNames()) msg << "\n\t" << p; if (data.shouldThrow()) throw cms::Exception("Configuration") << msg.str(); else edm::LogWarning("Configuration") << msg.str(); } } else { // expand wildcards in the pattern const std::vector< std::vector<std::string>::const_iterator > & matches = edm::regexMatch(hltMenu.triggerNames(), m_pattern); if (matches.empty()) { // m_pattern does not match any trigger paths std::stringstream msg; msg << "requested pattern \"" << m_pattern << "\" does not match any HLT paths - known paths are:"; if (hltMenu.triggerNames().empty()) msg << " (none)"; else BOOST_FOREACH(const std::string & p, hltMenu.triggerNames()) msg << "\n\t" << p; if (data.shouldThrow()) throw cms::Exception("Configuration") << msg.str(); else edm::LogWarning("Configuration") << msg.str(); } else { // store indices corresponding to the matching triggers BOOST_FOREACH(const std::vector<std::string>::const_iterator & match, matches) { unsigned int index = hltMenu.triggerIndex(*match); assert(index < hltMenu.size()); m_triggers.push_back( std::make_pair(*match, index) ); } } } }
bool triggerExpression::HLTReader::operator() | ( | const Data & | data | ) | const [virtual] |
Implements triggerExpression::Evaluator.
Definition at line 15 of file TriggerExpressionHLTReader.cc.
References edm::HLTGlobalStatus::accept(), triggerExpression::Data::hasHLT(), triggerExpression::Data::hltResults(), and m_triggers.
{ if (not data.hasHLT()) return false; typedef std::pair<std::string, unsigned int> value_type; BOOST_FOREACH(const value_type & trigger, m_triggers) if (data.hltResults().accept(trigger.second)) return true; return false; }
std::string triggerExpression::HLTReader::m_pattern [private] |
Definition at line 25 of file TriggerExpressionHLTReader.h.
Referenced by init().
std::vector<std::pair<std::string, unsigned int> > triggerExpression::HLTReader::m_triggers [private] |
Definition at line 26 of file TriggerExpressionHLTReader.h.
Referenced by dump(), init(), and operator()().