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
trigger::TriggerObjectType
TriggerObjectType
Definition: TriggerTypeDefs.h:23
edm::RefProd< TriggerObjectCollection >
L1GctHtMiss
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
pat::TriggerObjectRefVector
edm::RefVector< TriggerObjectCollection > TriggerObjectRefVector
Vector of persistent references to items in the same TriggerObjectCollection.
Definition: TriggerObject.h:181
TriggerObject
Definition: TriggerObject.py:1
L1GctJetCand
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
L1MuGMTExtendedCand
Definition: L1MuGMTExtendedCand.h:46
L1MuonParticleFwd.h
pat::TriggerObject::id
bool id(trigger::TriggerObjectType triggerObjectType) const
Definition: TriggerObject.h:164
pat::TriggerObject::refToOrig_
reco::CandidateBaseRef refToOrig_
Definition: TriggerObject.h:56
pat::TriggerObject::coll
virtual bool coll(const std::string &collName) const
Calls 'hasCollection(...)'.
Definition: TriggerObject.h:158
pat::TriggerObject::type
bool type(trigger::TriggerObjectType triggerObjectType) const
Calls 'hasTriggerObjectType(...)'.
Definition: TriggerObject.h:160
RefVectorIterator.h
trigObjTnPSource_cfi.collName
collName
Definition: trigObjTnPSource_cfi.py:66
L1GctEmCand
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
pat::TriggerObject::TriggerObject
TriggerObject()
Constructors and Destructor.
TriggerTypeDefs.h
pat::TriggerObject::origObjRef
const reco::CandidateBaseRef & origObjRef() const
Special methods for 'l1extra' particles.
Definition: TriggerObject.h:120
edm::RefVector
Definition: EDProductfwd.h:27
Association.h
pat::TriggerObject::origL1GctJetCand
const L1GctJetCand * origL1GctJetCand() const
Definition: TriggerObject.h:144
pat::TriggerObjectCollection
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
Definition: TriggerObject.h:173
pat::TriggerObject::hasTriggerObjectType
bool hasTriggerObjectType(int triggerObjectType) const
Definition: TriggerObject.h:107
pat::TriggerObject::type
bool type(int triggerObjectType) const
Definition: TriggerObject.h:161
pat::TriggerObject::origL1GctEtHad
const L1GctEtHad * origL1GctEtHad() const
Definition: TriggerObject.h:139
pat::TriggerObject::origL1GctEmCand
const L1GctEmCand * origL1GctEmCand() const
Definition: TriggerObject.h:125
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
edm::Ref
Definition: AssociativeIterator.h:58
pat::TriggerObject::hasTriggerObjectType
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
pat::TriggerObject::addFilterId
void addFilterId(int triggerObjectType)
Definition: TriggerObject.h:92
pat::TriggerObject::id
bool id(int triggerObjectType) const
Definition: TriggerObject.h:167
L1GctEtMiss
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:17
pat::TriggerObjectMatch
edm::Association< TriggerObjectCollection > TriggerObjectMatch
Association of TriggerObjects to store matches to Candidates.
Definition: TriggerObject.h:185
pat::TriggerObject::origL1EtMissRef
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
pat::TriggerObject::hasFilterId
bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const
Definition: TriggerObject.h:110
LeafCandidate.h
pat::TriggerObject::origL1GctEtMiss
const L1GctEtMiss * origL1GctEtMiss() const
Definition: TriggerObject.h:130
pat::TriggerObject::collection_
std::string collection_
Data Members.
Definition: TriggerObject.h:48
pat::TriggerObject::origL1GmtMuonCand
const L1MuGMTExtendedCand * origL1GmtMuonCand() const
Definition: TriggerObject.h:149
pat::TriggerObjectMatchContainer
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
Definition: TriggerObject.h:189
pat::TriggerObject::origL1GctEtTotal
const L1GctEtTotal * origL1GctEtTotal() const
Definition: TriggerObject.h:133
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
edm::RefToBase::get
value_type const * get() const
Definition: RefToBase.h:209
pat::TriggerObject::hasFilterId
bool hasFilterId(int triggerObjectType) const
Definition: TriggerObject.h:113
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
L1GctEtTotal
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:17
pat::TriggerObject::hasCollection
virtual bool hasCollection(const edm::InputTag &collName) const
Definition: TriggerObject.h:104
L1EmParticleFwd.h
pat::TriggerObjectMatchRefProd
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
Definition: TriggerObject.h:187
L1JetParticleFwd.h
pat::TriggerObject::filterIds
std::vector< int > filterIds() const
Definition: TriggerObject.h:101
L1EtMissParticleFwd.h
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::TriggerObject::addTriggerObjectType
void addTriggerObjectType(int triggerObjectType)
Definition: TriggerObject.h:86
pat::TriggerObject::addTriggerObjectType
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:82
pat::TriggerObjectRefProd
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
Definition: TriggerObject.h:179
pat::TriggerObject::triggerObjectTypes
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
pat::TriggerObject::addFilterId
void addFilterId(trigger::TriggerObjectType triggerObjectType)
Definition: TriggerObject.h:89
pat::TriggerObject::setCollection
void setCollection(const edm::InputTag &collName)
Definition: TriggerObject.h:80
edm::Association
Definition: Association.h:18
pat
Definition: HeavyIon.h:7
L1EmParticle.h
pat::TriggerObjectMatchMap
std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object)
Definition: TriggerObject.h:177
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TriggerObject.h
InputTag.h
reco::Candidate
Definition: Candidate.h:27
pat::TriggerObject::~TriggerObject
~TriggerObject() override
Destructor.
Definition: TriggerObject.h:74
pat::TriggerObject::triggerObjectTypes_
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:52
L1GctEtHad
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:17
pat::TriggerObjectRefVectorIterator
edm::RefVectorIterator< TriggerObjectCollection > TriggerObjectRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectCollection.
Definition: TriggerObject.h:183
L1MuonParticle.h
pat::TriggerObject::hasCollection
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
edm::RefVectorIterator
Definition: EDProductfwd.h:33
edm::RefToBase< Candidate >
pat::TriggerObject::origL1EmRef
const l1extra::L1EmParticleRef origL1EmRef() const
pat::TriggerObject::collection
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:96
reco::LeafCandidate
Definition: LeafCandidate.h:16
L1EtMissParticle.h
pat::TriggerObject::origL1JetRef
const l1extra::L1JetParticleRef origL1JetRef() const
pat::TriggerObjectRef
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
Definition: TriggerObject.h:175
pat::TriggerObject::origObjCand
const reco::Candidate * origObjCand() const
Definition: TriggerObject.h:121
L1JetParticle.h
pat::TriggerObject::origL1GctHtMiss
const L1GctHtMiss * origL1GctHtMiss() const
Definition: TriggerObject.h:136
pat::TriggerObject::setCollection
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:79
pat::TriggerObject::origL1MuonRef
const l1extra::L1MuonParticleRef origL1MuonRef() const
edm::InputTag
Definition: InputTag.h:15