CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TriggerObject.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_TriggerObject_h
2 #define DataFormats_PatCandidates_TriggerObject_h
3 
4 // -*- C++ -*-
5 //
6 // Package: PatCandidates
7 // Class: pat::TriggerObject
8 //
9 //
22 
23 #include <map>
24 #include <string>
25 #include <vector>
26 #include <algorithm>
27 
41 
42 namespace pat {
43 
46 
52  std::vector<trigger::TriggerObjectType> triggerObjectTypes_;
57 
58  public:
60 
62  TriggerObject();
64  TriggerObject(const trigger::TriggerObject& trigObj);
66  TriggerObject(const reco::LeafCandidate& leafCand);
68  TriggerObject(const reco::CandidateBaseRef& candRef);
70  TriggerObject(const reco::Particle::LorentzVector& vec, int id = 0);
71  TriggerObject(const reco::Particle::PolarLorentzVector& vec, int id = 0);
72 
74  ~TriggerObject() override{};
75 
77 
79  void setCollection(const std::string& collName) { collection_ = collName; };
80  void setCollection(const edm::InputTag& collName) { collection_ = collName.encode(); };
83  if (!hasTriggerObjectType(triggerObjectType))
84  triggerObjectTypes_.push_back(triggerObjectType);
85  };
86  void addTriggerObjectType(int triggerObjectType) {
88  };
89  void addFilterId(trigger::TriggerObjectType triggerObjectType) {
90  addTriggerObjectType(triggerObjectType);
91  }; // for backward compatibility
92  void addFilterId(int triggerObjectType) {
94  }; // for backward compatibility
96  const std::string& collection() const { return collection_; };
98  // std::vector< trigger::TriggerObjectType > triggerObjectTypes() const { return triggerObjectTypes_; };
99  // std::vector< trigger::TriggerObjectType > filterIds() const { return triggerObjectTypes(); }; // for backward compatibility
100  std::vector<int> triggerObjectTypes() const; // for backward compatibility
101  std::vector<int> filterIds() const { return triggerObjectTypes(); }; // for double backward compatibility
103  virtual bool hasCollection(const std::string& collName) const;
104  virtual bool hasCollection(const edm::InputTag& collName) const { return hasCollection(collName.encode()); };
106  bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const;
107  bool hasTriggerObjectType(int triggerObjectType) const {
108  return hasTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
109  };
110  bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const {
111  return hasTriggerObjectType(triggerObjectType);
112  }; // for backward compatibility
113  bool hasFilterId(int triggerObjectType) const {
114  return hasTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
115  }; // for backward compatibility
116 
118 
120  const reco::CandidateBaseRef& origObjRef() const { return refToOrig_; };
121  const reco::Candidate* origObjCand() const { return refToOrig_.get(); };
125  const L1GctEmCand* origL1GctEmCand() const {
126  return origL1EmRef().isNonnull() ? origL1EmRef()->gctEmCand() : nullptr;
127  };
130  const L1GctEtMiss* origL1GctEtMiss() const {
131  return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtMiss() : nullptr;
132  };
134  return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtTotal() : nullptr;
135  };
136  const L1GctHtMiss* origL1GctHtMiss() const {
137  return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctHtMiss() : nullptr;
138  };
139  const L1GctEtHad* origL1GctEtHad() const {
140  return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtHad() : nullptr;
141  };
145  return origL1JetRef().isNonnull() ? origL1JetRef()->gctJetCand() : nullptr;
146  };
150  return origL1MuonRef().isNonnull() ? &(origL1MuonRef()->gmtMuonCand()) : nullptr;
151  };
152 
156 
158  virtual bool coll(const std::string& collName) const { return hasCollection(collName); };
160  bool type(trigger::TriggerObjectType triggerObjectType) const { return hasTriggerObjectType(triggerObjectType); };
161  bool type(int triggerObjectType) const {
162  return hasTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
163  };
164  bool id(trigger::TriggerObjectType triggerObjectType) const {
165  return hasTriggerObjectType(triggerObjectType);
166  }; // for backward compatibility
167  bool id(int triggerObjectType) const {
168  return hasTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
169  }; // for backward compatibility
170  };
171 
173  typedef std::vector<TriggerObject> TriggerObjectCollection;
177  typedef std::map<std::string, TriggerObjectRef> TriggerObjectMatchMap;
189  typedef std::map<std::string, TriggerObjectMatchRefProd> TriggerObjectMatchContainer;
190 
191 } // namespace pat
192 
193 #endif
value_type const * get() const
Definition: RefToBase.h:209
const l1extra::L1EmParticleRef origL1EmRef() const
std::string collection_
Data Members.
Definition: TriggerObject.h:48
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
bool id(trigger::TriggerObjectType triggerObjectType) const
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
void setCollection(const edm::InputTag &collName)
Definition: TriggerObject.h:80
bool type(int triggerObjectType) const
const L1GctEmCand * origL1GctEmCand() const
void addTriggerObjectType(int triggerObjectType)
Definition: TriggerObject.h:86
bool type(trigger::TriggerObjectType triggerObjectType) const
Calls &#39;hasTriggerObjectType(...)&#39;.
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:17
edm::RefVectorIterator< TriggerObjectCollection > TriggerObjectRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectCollection.
bool hasTriggerObjectType(int triggerObjectType) const
bool hasFilterId(int triggerObjectType) const
~TriggerObject() override
Destructor.
Definition: TriggerObject.h:74
Analysis-level trigger object class.
Definition: TriggerObject.h:44
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
std::string encode() const
Definition: InputTag.cc:159
edm::RefVector< TriggerObjectCollection > TriggerObjectRefVector
Vector of persistent references to items in the same TriggerObjectCollection.
const l1extra::L1JetParticleRef origL1JetRef() const
const l1extra::L1MuonParticleRef origL1MuonRef() const
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:52
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:79
std::vector< int > filterIds() const
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:17
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:96
bool id(int triggerObjectType) const
virtual bool hasCollection(const edm::InputTag &collName) const
const L1GctJetCand * origL1GctJetCand() const
const L1MuGMTExtendedCand * origL1GmtMuonCand() const
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:17
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
const reco::Candidate * origObjCand() const
const L1GctHtMiss * origL1GctHtMiss() const
edm::Association< TriggerObjectCollection > TriggerObjectMatch
Association of TriggerObjects to store matches to Candidates.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
void addFilterId(int triggerObjectType)
Definition: TriggerObject.h:92
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
reco::CandidateBaseRef refToOrig_
Definition: TriggerObject.h:56
TriggerObject()
Constructors and Destructor.
const reco::CandidateBaseRef & origObjRef() const
Special methods for &#39;l1extra&#39; particles.
const L1GctEtHad * origL1GctEtHad() const
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:82
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
void addFilterId(trigger::TriggerObjectType triggerObjectType)
Definition: TriggerObject.h:89
virtual bool coll(const std::string &collName) const
Calls &#39;hasCollection(...)&#39;.
const L1GctEtMiss * origL1GctEtMiss() const
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
const L1GctEtTotal * origL1GctEtTotal() const
std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object) ...