CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerResultsFilter.cc
Go to the documentation of this file.
1 
12 #include <vector>
13 #include <string>
14 #include <sstream>
15 #include <iostream>
16 #include <iomanip>
17 #include <boost/foreach.hpp>
18 
24 
28 
29 //
30 // constructors and destructor
31 //
33  m_expression(0),
34  m_eventCache(config)
35 {
36  const std::vector<std::string> & expressions = config.getParameter<std::vector<std::string> >("triggerConditions");
37  parse( expressions );
38 }
39 
41 {
42  delete m_expression;
43 }
44 
45 void TriggerResultsFilter::parse(const std::vector<std::string> & expressions) {
46  // parse the logical expressions into functionals
47  if (expressions.size() == 0) {
48  edm::LogWarning("Configuration") << "Empty trigger results expression";
49  } else if (expressions.size() == 1) {
50  parse( expressions[0] );
51  } else {
52  std::stringstream expression;
53  expression << "(" << expressions[0] << ")";
54  for (unsigned int i = 1; i < expressions.size(); ++i)
55  expression << " OR (" << expressions[i] << ")";
56  parse( expression.str() );
57  }
58 }
59 
60 void TriggerResultsFilter::parse(const std::string & expression) {
61  // parse the logical expressions into functionals
62  m_expression = triggerExpression::parse( expression );
63 
64  // check if the expressions were parsed correctly
65  if (not m_expression)
66  edm::LogWarning("Configuration") << "Couldn't parse trigger results expression \"" << expression << "\"";
67 }
68 
70 {
71  if (not m_expression)
72  // no valid expression has been parsed
73  return false;
74 
75  if (not m_eventCache.setEvent(event, setup))
76  // couldn't properly access all information from the Event
77  return false;
78 
79  // if the L1 or HLT configurations have changed, (re)initialize the filters (including during the first event)
81  m_expression->init(m_eventCache);
82 
83  // log the expanded configuration
84  edm::LogInfo("Configuration") << "TriggerResultsFilter configuration updated: " << *m_expression;
85  }
86 
87  // run the trigger results filter
88  return (*m_expression)(m_eventCache);
89 }
90 
91 // register as framework plugin
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
void parse(const std::string &expression)
parse the logical expression into functionals
virtual bool filter(edm::Event &, const edm::EventSetup &)
Evaluator * parse(const T &text)
triggerExpression::Data m_eventCache
cache some data from the Event for faster access by the m_expression
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TriggerResultsFilter(const edm::ParameterSet &)
triggerExpression::Evaluator * m_expression
evaluator for the trigger condition
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
bool setEvent(const edm::Event &event, const edm::EventSetup &setup)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")