File indexing completed on 2024-09-07 04:37:23
0001 #ifndef PhysicsTools_PatUtils_TriggerHelper_h
0002 #define PhysicsTools_PatUtils_TriggerHelper_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <string>
0023
0024 #include "DataFormats/PatCandidates/interface/TriggerEvent.h"
0025 #include "DataFormats/Candidate/interface/Candidate.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027
0028 namespace pat {
0029
0030 namespace helper {
0031
0032 class TriggerMatchHelper {
0033 public:
0034
0035
0036
0037 TriggerMatchHelper() {}
0038
0039
0040 ~TriggerMatchHelper() {}
0041
0042
0043
0044
0045
0046 TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef& candRef,
0047 const TriggerObjectMatch* matchResult,
0048 const edm::Event& event,
0049 const TriggerEvent& triggerEvent) const;
0050
0051 TriggerObjectRef triggerMatchObject(const reco::CandidateBaseRef& candRef,
0052 const std::string& labelMatcher,
0053 const edm::Event& event,
0054 const TriggerEvent& triggerEvent) const;
0055
0056
0057 template <class C>
0058 TriggerObjectRef triggerMatchObject(const edm::Handle<C>& candCollHandle,
0059 const size_t iCand,
0060 const TriggerObjectMatch* matchResult,
0061 const edm::Event& event,
0062 const TriggerEvent& triggerEvent) const;
0063
0064 template <class C>
0065 TriggerObjectRef triggerMatchObject(const edm::Handle<C>& candCollHandle,
0066 const size_t iCand,
0067 const std::string& labelMatcher,
0068 const edm::Event& event,
0069 const TriggerEvent& triggerEvent) const;
0070
0071 TriggerObjectMatchMap triggerMatchObjects(const reco::CandidateBaseRef& candRef,
0072 const edm::Event& event,
0073 const TriggerEvent& triggerEvent) const;
0074
0075 template <class C>
0076 TriggerObjectMatchMap triggerMatchObjects(const edm::Handle<C>& candCollHandle,
0077 const size_t iCand,
0078 const edm::Event& event,
0079 const TriggerEvent& triggerEvent) const;
0080
0081
0082 reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef& objectRef,
0083 const TriggerObjectMatch* matchResult,
0084 const edm::Event& event,
0085 const TriggerEvent& triggerEvent) const;
0086
0087 reco::CandidateBaseRefVector triggerMatchCandidates(const pat::TriggerObjectRef& objectRef,
0088 const std::string& labelMatcher,
0089 const edm::Event& event,
0090 const TriggerEvent& triggerEvent) const;
0091
0092
0093 reco::CandidateBaseRefVector triggerMatchCandidates(const edm::Handle<TriggerObjectCollection>& trigCollHandle,
0094 const size_t iTrig,
0095 const TriggerObjectMatch* matchResult,
0096 const edm::Event& event,
0097 const TriggerEvent& triggerEvent) const;
0098
0099 reco::CandidateBaseRefVector triggerMatchCandidates(const edm::Handle<TriggerObjectCollection>& trigCollHandle,
0100 const size_t iTrig,
0101 const std::string& labelMatcher,
0102 const edm::Event& event,
0103 const TriggerEvent& triggerEvent) const;
0104 };
0105
0106
0107
0108
0109 template <class C>
0110 TriggerObjectRef TriggerMatchHelper::triggerMatchObject(const edm::Handle<C>& candCollHandle,
0111 const size_t iCand,
0112 const TriggerObjectMatch* matchResult,
0113 const edm::Event& event,
0114 const TriggerEvent& triggerEvent) const {
0115 const reco::CandidateBaseRef candRef(edm::Ref<C>(candCollHandle, iCand));
0116 return triggerMatchObject(candRef, matchResult, event, triggerEvent);
0117 }
0118 template <class C>
0119 TriggerObjectRef TriggerMatchHelper::triggerMatchObject(const edm::Handle<C>& candCollHandle,
0120 const size_t iCand,
0121 const std::string& labelMatcher,
0122 const edm::Event& event,
0123 const TriggerEvent& triggerEvent) const {
0124 return triggerMatchObject(
0125 candCollHandle, iCand, triggerEvent.triggerObjectMatchResult(labelMatcher), event, triggerEvent);
0126 }
0127
0128
0129 template <class C>
0130 TriggerObjectMatchMap TriggerMatchHelper::triggerMatchObjects(const edm::Handle<C>& candCollHandle,
0131 const size_t iCand,
0132 const edm::Event& event,
0133 const TriggerEvent& triggerEvent) const {
0134 const reco::CandidateBaseRef candRef(edm::Ref<C>(candCollHandle, iCand));
0135 return triggerMatchObjects(candRef, event, triggerEvent);
0136 }
0137
0138 }
0139
0140 }
0141
0142 #endif