14 #include <boost/foreach.hpp> 40 inputTag_ (iConfig.getParameter<
edm::InputTag> (
"TriggerResultsTag")),
41 inputToken_ (consumes<
edm::TriggerResults>(inputTag_)),
43 andOr_ (iConfig.getParameter<bool> (
"andOr")),
44 throw_ (iConfig.getParameter<bool> (
"throw")),
45 eventSetupPathsKey_(iConfig.getParameter<
std::
string>(
"eventSetupPathsKey")),
46 watchAlCaRecoTriggerBitsRcd_(
nullptr),
47 HLTPatterns_ (iConfig.getParameter<
std::vector<
std::
string> >(
"HLTPaths")),
60 <<
"\n configured with " <<
HLTPatterns_.size() <<
" HLTPaths and\n" 80 std::vector<std::string>
hltPaths(0);
82 desc.
add<std::vector<std::string> >(
"HLTPaths",
hltPaths);
86 desc.
add<
bool>(
"andOr",
true);
88 desc.
add<
bool>(
"throw",
true);
89 descriptions.
add(
"hltHighLevel", desc);
117 for (
unsigned int i = 0;
i <
n; ++
i) {
127 if (matches.empty()) {
130 throw cms::Exception(
"Configuration") <<
"requested pattern \"" << pattern <<
"\" does not match any HLT paths";
132 edm::LogInfo(
"Configuration") <<
"requested pattern \"" << pattern <<
"\" does not match any HLT paths";
135 BOOST_FOREACH(
auto match, matches)
164 edm::LogWarning(
"Configuration") <<
"none of the requested paths and pattern match any HLT path - no events will be selected";
171 <<
" - Number of paths: " << n
172 <<
" - andOr mode: " <<
andOr_ 173 <<
" - throw mode: " <<
throw_;
175 LogTrace(
"HLTHighLevel") <<
"The HLT trigger paths (# index name):";
176 for (
unsigned int i = 0;
i <
n; ++
i)
185 std::vector<std::string>
191 typedef std::map<std::string, std::string> TriggerMap;
194 auto listIter = triggerMap.find(key);
195 if (listIter == triggerMap.end()) {
198 <<
"]: No triggerList with key " << key <<
" in AlCaRecoTriggerBitsRcd";
203 return triggerBits->
decompose(listIter->second);
217 LogDebug(
"HLTHighLevel") <<
"TriggerResults found, number of HLT paths: " << trh->
size();
219 LogError(
"HLTHighLevel") <<
"TriggerResults product " <<
inputTag_.
encode() <<
" not found - returning result=false!";
225 bool config_changed =
false;
228 config_changed =
true;
236 this->
init(*trh, iEvent, iSetup, triggerNames);
239 unsigned int nbad = 0;
240 unsigned int fired = 0;
243 for (
unsigned int i = 0;
i <
n;
i++)
249 if ((nbad > 0) and (config_changed
or throw_)) {
253 for (
unsigned int i = 0; i <
n; i++)
257 if (config_changed) {
261 <<
"] configured with " << nbad
263 <<
" unknown HLT path names: " <<
message;
270 <<
"] configured with " << nbad
272 <<
" unknown HLT path names: " <<
message;
277 const bool accept( (fired > 0) and (
andOr_ or (fired == n-nbad) ) );
278 LogDebug(
"HLTHighLevel") <<
"Accept = " << std::boolalpha <<
accept;
285 return event.moduleCallingContext()->placeInPathContext()->pathContext()->pathName();
T getParameter(std::string const &) const
std::map< std::string, std::string > m_alcarecoToTrig
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void init(const edm::TriggerResults &results, const edm::Event &, const edm::EventSetup &iSetup, const edm::TriggerNames &triggerNames)
initialize the trigger conditions (call this if the trigger paths have changed)
bool accept() const
Has at least one path accepted the event?
bool is_glob(std::string const &pattern)
std::vector< std::string > decompose(const std::string &concatPaths) const
Decompose one value of map from concatenated string.
bool andOr_
false = and-mode (all requested triggers), true = or-mode (at least one)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::string const & moduleLabel() const
Strings const & triggerNames() const
std::string const & moduleLabel() const
ParameterSetID const & parameterSetID() const
unsigned int triggerIndex(std::string const &name) const
unsigned int size() const
Get number of paths stored.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< unsigned int > HLTPathsByIndex_
list of required HLT triggers by HLT index
edm::ParameterSetID triggerNamesID_
HLT trigger names.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::TriggerResults > inputToken_
const std::string eventSetupPathsKey_
not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
std::string const & triggerName(unsigned int index) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
virtual bool filter(edm::Event &, const edm::EventSetup &)
std::vector< std::string > pathsFromSetup(const std::string &key, const edm::Event &, const edm::EventSetup &iSetup) const
get HLTPaths with key 'key' from EventSetup (AlCaRecoTriggerBitsRcd)
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const ®exp)
bool throw_
throw on any requested trigger being unknown
HLTHighLevel(const edm::ParameterSet &)
ModuleDescription const & moduleDescription() const
std::string const & pathName(const edm::Event &) const
stolen from HLTFilter
std::vector< std::string > HLTPathsByName_
list of required HLT triggers by HLT name
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::string > HLTPatterns_
input patterns that will be expanded into trigger names
edm::InputTag inputTag_
HLT TriggerResults EDProduct.
edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchAlCaRecoTriggerBitsRcd_
Watcher to be created and used if 'eventSetupPathsKey_' non empty: