CMS 3D CMS Logo

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 
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
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
std::vector< int > filterIds() const
std::string collection_
Data Members.
Definition: TriggerObject.h:48
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
bool hasFilterId(int triggerObjectType) const
virtual bool hasCollection(const edm::InputTag &collName) const
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
const l1extra::L1EmParticleRef origL1EmRef() const
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const
void setCollection(const edm::InputTag &collName)
Definition: TriggerObject.h:80
const L1GctEtMiss * origL1GctEtMiss() const
void addTriggerObjectType(int triggerObjectType)
Definition: TriggerObject.h:86
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
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.
~TriggerObject() override
Destructor.
Definition: TriggerObject.h:74
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
const L1GctHtMiss * origL1GctHtMiss() const
edm::RefVector< TriggerObjectCollection > TriggerObjectRefVector
Vector of persistent references to items in the same TriggerObjectCollection.
const reco::Candidate * origObjCand() const
Definition: HeavyIon.h:7
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:52
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
const l1extra::L1JetParticleRef origL1JetRef() const
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:79
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:96
const l1extra::L1MuonParticleRef origL1MuonRef() const
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:17
bool type(trigger::TriggerObjectType triggerObjectType) const
Calls &#39;hasTriggerObjectType(...)&#39;.
bool id(trigger::TriggerObjectType triggerObjectType) const
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:17
virtual bool coll(const std::string &collName) const
Calls &#39;hasCollection(...)&#39;.
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
const L1GctJetCand * origL1GctJetCand() const
bool hasTriggerObjectType(int triggerObjectType) const
const l1extra::L1EtMissParticleRef origL1EtMissRef() 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
bool id(int triggerObjectType) const
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
reco::CandidateBaseRef refToOrig_
Definition: TriggerObject.h:56
TriggerObject()
Constructors and Destructor.
bool type(int triggerObjectType) const
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:82
const L1GctEtHad * origL1GctEtHad() const
const L1GctEmCand * origL1GctEmCand() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
void addFilterId(trigger::TriggerObjectType triggerObjectType)
Definition: TriggerObject.h:89
value_type const * get() const
Definition: RefToBase.h:211
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
const L1GctEtTotal * origL1GctEtTotal() const
const reco::CandidateBaseRef & origObjRef() const
Special methods for &#39;l1extra&#39; particles.
const L1MuGMTExtendedCand * origL1GmtMuonCand() const
std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object) ...