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

◆ TriggerMatchHelper()

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

Constructors and Destructor.

Default constructor

Definition at line 37 of file TriggerHelper.h.

37 {};

◆ ~TriggerMatchHelper()

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

Destructor.

Definition at line 40 of file TriggerHelper.h.

40 {};

Member Function Documentation

◆ triggerMatchCandidates() [1/4]

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(), edmPickEvents::event, and edm::RefToBaseVector< T >::push_back().

Referenced by triggerMatchCandidates().

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
void push_back(const RefToBase< T > &)

◆ triggerMatchCandidates() [2/4]

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 edmPickEvents::event, PDWG_DiPhoton_SD_cff::triggerEvent, and triggerMatchCandidates().

82  {
83  return triggerMatchCandidates(objectRef, triggerEvent.triggerObjectMatchResult(labelMatcher), event, triggerEvent);
84 }
reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef &objectRef, const TriggerObjectMatch *matchResult, const edm::Event &event, const TriggerEvent &triggerEvent) const

◆ triggerMatchCandidates() [3/4]

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 PDWG_DiPhoton_SD_cff::triggerEvent, and 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
Definition: event.py:1

◆ triggerMatchCandidates() [4/4]

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 edmPickEvents::event, PDWG_DiPhoton_SD_cff::triggerEvent, and triggerMatchCandidates().

104  {
105  return triggerMatchCandidates(TriggerObjectRef(trigCollHandle, iTrig),
106  triggerEvent.triggerObjectMatchResult(labelMatcher),
107  event,
108  triggerEvent);
109 }
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

◆ triggerMatchObject() [1/4]

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 edmPickEvents::event, edm::RefToBase< T >::id(), and edm::RefToBase< T >::key().

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

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:216
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
size_t key() const
Definition: RefToBase.h:221

◆ triggerMatchObject() [2/4]

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 edmPickEvents::event, PDWG_DiPhoton_SD_cff::triggerEvent, and triggerMatchObject().

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.

◆ triggerMatchObject() [3/4]

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 PDWG_DiPhoton_SD_cff::triggerEvent, and 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.
Definition: event.py:1

◆ triggerMatchObject() [4/4]

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 edmPickEvents::event, PDWG_DiPhoton_SD_cff::triggerEvent, and triggerMatchObject().

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.

◆ triggerMatchObjects() [1/2]

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 edmPickEvents::event, PDWG_DiPhoton_SD_cff::triggerEvent, and triggerMatchObject().

Referenced by triggerMatchObjects().

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::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object) ...

◆ triggerMatchObjects() [2/2]

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 PDWG_DiPhoton_SD_cff::triggerEvent, and 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...
Definition: event.py:1