CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerExpressionData.cc
Go to the documentation of this file.
1 #include <boost/shared_ptr.hpp>
2 
18 
19 namespace triggerExpression {
20 
21 template <typename T>
22 static
23 const T * get(const edm::Event & event, const edm::EDGetTokenT<T> & token) {
25  event.getByToken(token, handle);
26  if (not handle.isValid()) {
27  auto const & error = handle.whyFailed();
28  edm::LogWarning(error->category()) << error->what();
29  return 0;
30  } else {
31  return handle.product();
32  }
33 }
34 
35 template <typename R, typename T>
36 static
37 const T * get(const edm::EventSetup & setup) {
39  setup.get<R>().get(handle);
40  return handle.product();
41 }
42 
44 
45  // cache the event number
46  m_eventNumber = event.id().event();
47 
48  // access L1 objects only if L1 is used
49  if (hasL1T()) {
50  // cache the L1 GT results objects
51  m_l1tResults = get<L1GlobalTriggerReadoutRecord>(event, m_l1tResultsToken);
52  if (not m_l1tResults)
53  return false;
54 
55  // cache the L1 trigger masks
56  m_l1tAlgoMask = get<L1GtTriggerMaskAlgoTrigRcd, L1GtTriggerMask>(setup);
57  m_l1tTechMask = get<L1GtTriggerMaskTechTrigRcd, L1GtTriggerMask>(setup);
58 
59  // cache the L1 trigger menu
60  unsigned long long l1tCacheID = setup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
61  if (m_l1tCacheID == l1tCacheID) {
62  m_l1tUpdated = false;
63  } else {
64  m_l1tMenu = get<L1GtTriggerMenuRcd, L1GtTriggerMenu>(setup);
65  m_l1tCacheID = l1tCacheID;
66  m_l1tUpdated = true;
67  }
68  }
69 
70  // access HLT objects only if HLT is used
71  if (hasHLT()) {
72  // cache the HLT TriggerResults
73  m_hltResults = get<edm::TriggerResults>(event, m_hltResultsToken);
74  if (not m_hltResults)
75  return false;
76 
77  // access the TriggerNames, and check if it has changed
78  m_hltMenu = & event.triggerNames(* m_hltResults);
80  m_hltUpdated = false;
81  } else {
83  m_hltUpdated = true;
84  }
85  }
86 
87  return true;
88 }
89 
90 } // namespace triggerExpression
const L1GtTriggerMask * m_l1tTechMask
const L1GtTriggerMask * m_l1tAlgoMask
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:42
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
tuple handle
Definition: patZpeak.py:22
const edm::TriggerNames * m_hltMenu
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 isValid() const
Definition: HandleBase.h:75
const L1GlobalTriggerReadoutRecord * m_l1tResults
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
bool setEvent(const edm::Event &event, const edm::EventSetup &setup)
edm::ParameterSetID m_hltCacheID
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1tResultsToken
edm::EventNumber_t m_eventNumber
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:110
long double T
const L1GtTriggerMenu * m_l1tMenu
unsigned long long m_l1tCacheID
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")