CMS 3D CMS Logo

List of all members | Public Member Functions
pat::helper::TriggerMatchHelper Class Reference

#include <TriggerHelper.h>

Public Member Functions

reco::CandidateBaseRefVector triggerMatchCandidates (const pat::TriggerObjectRef &objectRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
 
reco::CandidateBaseRefVector triggerMatchCandidates (const pat::TriggerObjectRef &objectRef, const std::string &labelMatcher, const edm::Event &event, const TriggerEvent &triggerEvent) const
 ... by matcher module label More...
 
reco::CandidateBaseRefVector triggerMatchCandidates (const edm::Handle< TriggerObjectCollection > &trigCollHandle, const size_t iTrig, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
 
reco::CandidateBaseRefVector triggerMatchCandidates (const edm::Handle< TriggerObjectCollection > &trigCollHandle, const size_t iTrig, const std::string &labelMatcher, const edm::Event &event, const TriggerEvent &triggerEvent) const
 ... by matcher module label More...
 
 TriggerMatchHelper ()
 Constructors and Destructor. More...
 
TriggerObjectRef triggerMatchObject (const reco::CandidateBaseRef &candRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
 Methods. More...
 
TriggerObjectRef triggerMatchObject (const reco::CandidateBaseRef &candRef, const std::string &labelMatcher, const edm::Event &event, const TriggerEvent &triggerEvent) const
 ... by matcher module label More...
 
template<class C >
TriggerObjectRef triggerMatchObject (const edm::Handle< C > &candCollHandle, const size_t iCand, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
 
template<class C >
TriggerObjectRef triggerMatchObject (const edm::Handle< C > &candCollHandle, const size_t iCand, const std::string &labelMatcher, const edm::Event &event, const TriggerEvent &triggerEvent) const
 ... by matcher module label More...
 
TriggerObjectMatchMap triggerMatchObjects (const reco::CandidateBaseRef &candRef, const edm::Event &event, const TriggerEvent &triggerEvent) const
 Get a table of references to all trigger objects matched to a certain physics object given by a reference. More...
 
template<class C >
TriggerObjectMatchMap triggerMatchObjects (const edm::Handle< C > &candCollHandle, const size_t iCand, const edm::Event &event, const TriggerEvent &triggerEvent) const
 Get a table of references to all trigger objects matched to a certain physics object given by a collection and index. More...
 
 ~TriggerMatchHelper ()
 Destructor. More...
 

Detailed Description

Definition at line 32 of file TriggerHelper.h.

Constructor & Destructor Documentation

pat::helper::TriggerMatchHelper::TriggerMatchHelper ( )
inline

Constructors and Destructor.

Default constructor

Definition at line 37 of file TriggerHelper.h.

37 {};
pat::helper::TriggerMatchHelper::~TriggerMatchHelper ( )
inline

Member Function Documentation

reco::CandidateBaseRefVector TriggerMatchHelper::triggerMatchCandidates ( const pat::TriggerObjectRef objectRef,
const TriggerObjectMatch matchResult,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Get a vector of references to the phyics objects matched to a certain trigger object given by a reference for a certain matcher module ... by resulting association

Definition at line 58 of file TriggerHelper.cc.

References edm::RefToBaseVector< T >::end(), event(), and edm::RefToBaseVector< T >::push_back().

Referenced by triggerMatchCandidates(), and ~TriggerMatchHelper().

61  {
63  if (matchResult) {
64  auto it = edm::makeAssociativeIterator<reco::CandidateBaseRef>(*matchResult, event);
65  auto itEnd = it.end();
66  while (it != itEnd) {
67  if (it->first.isNonnull() && it->second.isNonnull() && it->second.isAvailable()) {
68  if (it->second == objectRef) {
69  theCands.push_back(it->first);
70  }
71  }
72  ++it;
73  }
74  }
75  return theCands;
76 }
const_iterator end() const
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
void push_back(const RefToBase< T > &)
reco::CandidateBaseRefVector TriggerMatchHelper::triggerMatchCandidates ( const pat::TriggerObjectRef objectRef,
const std::string &  labelMatcher,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

... by matcher module label

Definition at line 79 of file TriggerHelper.cc.

References event(), PDWG_DiPhoton_SD_cff::triggerEvent, triggerMatchCandidates(), and pat::TriggerEvent::triggerObjectMatchResult().

82  {
83  return triggerMatchCandidates(objectRef, triggerEvent.triggerObjectMatchResult(labelMatcher), event, triggerEvent);
84 }
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
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
reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef &objectRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
reco::CandidateBaseRefVector TriggerMatchHelper::triggerMatchCandidates ( const edm::Handle< TriggerObjectCollection > &  trigCollHandle,
const size_t  iTrig,
const TriggerObjectMatch matchResult,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Get a vector of references to the phyics objects matched to a certain trigger object given by a collection and index for a certain matcher module ... by resulting association

Definition at line 89 of file TriggerHelper.cc.

References triggerMatchCandidates().

94  {
95  return triggerMatchCandidates(TriggerObjectRef(trigCollHandle, iTrig), matchResult, event, triggerEvent);
96 }
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef &objectRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
reco::CandidateBaseRefVector TriggerMatchHelper::triggerMatchCandidates ( const edm::Handle< TriggerObjectCollection > &  trigCollHandle,
const size_t  iTrig,
const std::string &  labelMatcher,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

... by matcher module label

Definition at line 99 of file TriggerHelper.cc.

References event(), PDWG_DiPhoton_SD_cff::triggerEvent, triggerMatchCandidates(), and pat::TriggerEvent::triggerObjectMatchResult().

104  {
105  return triggerMatchCandidates(TriggerObjectRef(trigCollHandle, iTrig),
106  triggerEvent.triggerObjectMatchResult(labelMatcher),
107  event,
108  triggerEvent);
109 }
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
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::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef &objectRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
TriggerObjectRef TriggerMatchHelper::triggerMatchObject ( const reco::CandidateBaseRef candRef,
const TriggerObjectMatch matchResult,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Methods.

Get a reference to the trigger objects matched to a certain physics object given by a reference for a certain matcher module ... by resulting association

Definition at line 16 of file TriggerHelper.cc.

References event(), edm::RefToBase< T >::id(), and edm::RefToBase< T >::key().

Referenced by PatTriggerTagAndProbe::analyze(), triggerMatchObject(), triggerMatchObjects(), and ~TriggerMatchHelper().

19  {
20  if (matchResult) {
21  auto it = edm::makeAssociativeIterator<reco::CandidateBaseRef>(*matchResult, event);
22  auto itEnd = it.end();
23  while (it != itEnd) {
24  if (it->first.isNonnull() && it->second.isNonnull() && it->second.isAvailable()) {
25  if (it->first.id() == candRef.id() && it->first.key() == candRef.key()) {
26  return TriggerObjectRef(it->second);
27  }
28  }
29  ++it;
30  }
31  }
32  return TriggerObjectRef();
33 }
ProductID id() const
Definition: RefToBase.h:214
size_t key() const
Definition: RefToBase.h:219
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::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
TriggerObjectRef TriggerMatchHelper::triggerMatchObject ( const reco::CandidateBaseRef candRef,
const std::string &  labelMatcher,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

... by matcher module label

Definition at line 36 of file TriggerHelper.cc.

References event(), PDWG_DiPhoton_SD_cff::triggerEvent, triggerMatchObject(), and pat::TriggerEvent::triggerObjectMatchResult().

39  {
40  return triggerMatchObject(candRef, triggerEvent.triggerObjectMatchResult(labelMatcher), event, triggerEvent);
41 }
TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef &candRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
Methods.
const TriggerObjectMatch * triggerObjectMatchResult(const std::string &labelMatcher) const
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
template<class C >
TriggerObjectRef pat::helper::TriggerMatchHelper::triggerMatchObject ( const edm::Handle< C > &  candCollHandle,
const size_t  iCand,
const TriggerObjectMatch matchResult,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Get a reference to the trigger objects matched to a certain physics object given by a collection and index for a certain matcher module ... by resulting association

Definition at line 110 of file TriggerHelper.h.

References triggerMatchObject().

114  {
115  const reco::CandidateBaseRef candRef(edm::Ref<C>(candCollHandle, iCand));
116  return triggerMatchObject(candRef, matchResult, event, triggerEvent);
117  }
TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef &candRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
Methods.
template<class C >
TriggerObjectRef pat::helper::TriggerMatchHelper::triggerMatchObject ( const edm::Handle< C > &  candCollHandle,
const size_t  iCand,
const std::string &  labelMatcher,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

... by matcher module label

Definition at line 119 of file TriggerHelper.h.

References event(), PDWG_DiPhoton_SD_cff::triggerEvent, triggerMatchObject(), and pat::TriggerEvent::triggerObjectMatchResult().

123  {
124  return triggerMatchObject(
125  candCollHandle, iCand, triggerEvent.triggerObjectMatchResult(labelMatcher), event, triggerEvent);
126  }
TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef &candRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
Methods.
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
TriggerObjectMatchMap TriggerMatchHelper::triggerMatchObjects ( const reco::CandidateBaseRef candRef,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Get a table of references to all trigger objects matched to a certain physics object given by a reference.

Definition at line 44 of file TriggerHelper.cc.

References event(), PDWG_DiPhoton_SD_cff::triggerEvent, pat::TriggerEvent::triggerMatchers(), and triggerMatchObject().

Referenced by triggerMatchObjects(), and ~TriggerMatchHelper().

46  {
47  TriggerObjectMatchMap theContainer;
48  const std::vector<std::string> matchers(triggerEvent.triggerMatchers());
49  for (size_t iMatch = 0; iMatch < matchers.size(); ++iMatch) {
50  theContainer[matchers.at(iMatch)] = triggerMatchObject(candRef, matchers.at(iMatch), event, triggerEvent);
51  }
52  return theContainer;
53 }
TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef &candRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const
Methods.
std::vector< std::string > triggerMatchers() const
Get a list of all linked trigger matches.
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
std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object) ...
template<class C >
TriggerObjectMatchMap pat::helper::TriggerMatchHelper::triggerMatchObjects ( const edm::Handle< C > &  candCollHandle,
const size_t  iCand,
const edm::Event event,
const TriggerEvent triggerEvent 
) const

Get a table of references to all trigger objects matched to a certain physics object given by a collection and index.

Definition at line 130 of file TriggerHelper.h.

References triggerMatchObjects().

133  {
134  const reco::CandidateBaseRef candRef(edm::Ref<C>(candCollHandle, iCand));
135  return triggerMatchObjects(candRef, event, triggerEvent);
136  }
TriggerObjectMatchMap triggerMatchObjects(const reco::CandidateBaseRef &candRef, const edm::Event &event, const TriggerEvent &triggerEvent) const
Get a table of references to all trigger objects matched to a certain physics object given by a refer...