14 #include <boost/foreach.hpp>
40 inputTag_ (iConfig.getParameter<edm::InputTag> (
"TriggerResultsTag")),
43 andOr_ (iConfig.getParameter<bool> (
"andOr")),
44 throw_ (iConfig.getParameter<bool> (
"throw")),
45 eventSetupPathsKey_(iConfig.getParameter<std::
string>(
"eventSetupPathsKey")),
46 watchAlCaRecoTriggerBitsRcd_(0),
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(std::vector<std::string>::const_iterator
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;
192 const TriggerMap &triggerMap = triggerBits->m_alcarecoToTrig;
194 TriggerMap::const_iterator 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;
278 LogDebug(
"HLTHighLevel") <<
"Accept = " << std::boolalpha <<
accept;
285 return event.moduleCallingContext()->placeInPathContext()->pathContext()->pathName();
T getParameter(std::string const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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 is_glob(std::string const &pattern)
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
unsigned int triggerIndex(std::string const &name) const
unsigned int size() const
Get number of paths stored.
std::vector< unsigned int > HLTPathsByIndex_
list of required HLT triggers by HLT index
edm::ParameterSetID triggerNamesID_
HLT trigger names.
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, boost::regex const ®exp)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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)
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: