CMS 3D CMS Logo

TriggerExpressionData.cc
Go to the documentation of this file.
1 #include <boost/shared_ptr.hpp>
2 
15 
16 namespace triggerExpression {
17 
18 template <typename T>
19 static
20 const T * get(const edm::Event & event, const edm::EDGetTokenT<T> & token) {
22  event.getByToken(token, handle);
23  if (not handle.isValid()) {
24  auto const & error = handle.whyFailed();
25  edm::LogWarning(error->category()) << error->what();
26  return nullptr;
27  } else {
28  return handle.product();
29  }
30 }
31 
32 template <typename R, typename T>
33 static
34 const T * get(const edm::EventSetup & setup) {
36  setup.get<R>().get(handle);
37  return handle.product();
38 }
39 
40 bool Data::setEvent(const edm::Event & event, const edm::EventSetup & setup) {
41 
42  // cache the event number
43  m_eventNumber = event.id().event();
44 
45  // access L1 objects only if L1 is used
46  if (hasL1T()) {
47  // cache the L1 GT results objects
48  auto l1t = get<GlobalAlgBlkBxCollection>(event, m_l1tResultsToken);
49  if (not l1t or l1t->size() == 0 or l1t->isEmpty(0)) {
50  m_l1tResults = nullptr;
51  return false;
52  }
54  m_l1tResults = & l1t->at(0, 0).getAlgoDecisionInitial();
55  else
56  m_l1tResults = & l1t->at(0, 0).getAlgoDecisionFinal();
57 
58  // cache the L1 trigger menu
59  unsigned long long l1tCacheID = setup.get<L1TUtmTriggerMenuRcd>().cacheIdentifier();
60  if (m_l1tCacheID == l1tCacheID) {
61  m_l1tUpdated = false;
62  } else {
63  m_l1tMenu = get<L1TUtmTriggerMenuRcd, L1TUtmTriggerMenu>(setup);
64  m_l1tCacheID = l1tCacheID;
65  m_l1tUpdated = true;
66  }
67  }
68 
69  // access HLT objects only if HLT is used
70  if (hasHLT()) {
71  // cache the HLT TriggerResults
72  m_hltResults = get<edm::TriggerResults>(event, m_hltResultsToken);
73  if (not m_hltResults)
74  return false;
75 
76  // access the TriggerNames, and check if it has changed
77  m_hltMenu = & event.triggerNames(* m_hltResults);
79  m_hltUpdated = false;
80  } else {
82  m_hltUpdated = true;
83  }
84  }
85 
86  return true;
87 }
88 
89 } // namespace triggerExpression
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tResultsToken
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
delete x;
Definition: CaloConfig.h:22
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
ParameterSetID const & parameterSetID() const
Definition: TriggerNames.cc:42
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
Definition: Activities.doc:12
const edm::TriggerResults * m_hltResults
edm::EDGetTokenT< edm::TriggerResults > m_hltResultsToken
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:74
bool setEvent(const edm::Event &event, const edm::EventSetup &setup)
const L1TUtmTriggerMenu * m_l1tMenu
const std::vector< bool > * m_l1tResults
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
edm::ParameterSetID m_hltCacheID
edm::EventNumber_t m_eventNumber
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:106
long double T
T const * product() const
Definition: ESHandle.h:86
unsigned long long m_l1tCacheID