CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerObject.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_TriggerObject_h
2 #define DataFormats_PatCandidates_TriggerObject_h
3 
4 
5 // -*- C++ -*-
6 //
7 // Package: PatCandidates
8 // Class: pat::TriggerObject
9 //
10 //
24 
25 #include <map>
26 #include <string>
27 #include <vector>
28 #include <algorithm>
29 
43 
44 
45 namespace pat {
46 
48 
50 
56  std::vector< trigger::TriggerObjectType > triggerObjectTypes_;
61 
62  public:
63 
65 
67  TriggerObject();
69  TriggerObject( const trigger::TriggerObject & trigObj );
71  TriggerObject( const reco::LeafCandidate & leafCand );
73  TriggerObject( const reco::CandidateBaseRef & candRef );
75  TriggerObject( const reco::Particle::LorentzVector & vec, int id = 0 );
76  TriggerObject( const reco::Particle::PolarLorentzVector & vec, int id = 0 );
77 
79  virtual ~TriggerObject() {};
80 
82 
84  void setCollection( const std::string & collName ) { collection_ = collName; };
85  void setCollection( const edm::InputTag & collName ) { collection_ = collName.encode(); };
87  void addTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) { if ( ! hasTriggerObjectType( triggerObjectType ) ) triggerObjectTypes_.push_back( triggerObjectType ); };
88  void addTriggerObjectType( int triggerObjectType ) { addTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); };
89  void addFilterId( trigger::TriggerObjectType triggerObjectType ) { addTriggerObjectType( triggerObjectType ); }; // for backward compatibility
90  void addFilterId( int triggerObjectType ) { addTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
92  const std::string & collection() const { return collection_; };
94 // std::vector< trigger::TriggerObjectType > triggerObjectTypes() const { return triggerObjectTypes_; };
95 // std::vector< trigger::TriggerObjectType > filterIds() const { return triggerObjectTypes(); }; // for backward compatibility
96  std::vector< int > triggerObjectTypes() const; // for backward compatibility
97  std::vector< int > filterIds() const { return triggerObjectTypes(); }; // for double backward compatibility
99  virtual bool hasCollection( const std::string & collName ) const;
100  virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
102  bool hasTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) const;
103  bool hasTriggerObjectType( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); };
104  bool hasFilterId( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); }; // for backward compatibility
105  bool hasFilterId( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
106 
108 
110  const reco::CandidateBaseRef & origObjRef() const { return refToOrig_; };
111  const reco::Candidate * origObjCand() const { return refToOrig_.get(); };
115  const L1GctEmCand * origL1GctEmCand() const { return origL1EmRef().isNonnull() ? origL1EmRef()->gctEmCand() : 0; };
118  const L1GctEtMiss * origL1GctEtMiss() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtMiss() : 0; };
119  const L1GctEtTotal * origL1GctEtTotal() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtTotal() : 0; };
120  const L1GctHtMiss * origL1GctHtMiss() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctHtMiss() : 0; };
121  const L1GctEtHad * origL1GctEtHad() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtHad() : 0; };
124  const L1GctJetCand * origL1GctJetCand() const { return origL1JetRef().isNonnull() ? origL1JetRef()->gctJetCand() : 0; };
127  const L1MuGMTExtendedCand * origL1GmtMuonCand() const { return origL1MuonRef().isNonnull() ? &( origL1MuonRef()->gmtMuonCand() ) : 0; };
128 
132 
134  virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
136  bool type( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); };
137  bool type( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType ( triggerObjectType ) ); };
138  bool id( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); }; // for backward compatibility
139  bool id( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType ( triggerObjectType ) ); }; // for backward compatibility
140 
141  };
142 
143 
145  typedef std::vector< TriggerObject > TriggerObjectCollection;
149  typedef std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap;
161  typedef std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer;
162 
163 }
164 
165 
166 #endif
value_type const * get() const
Definition: RefToBase.h:213
const l1extra::L1EmParticleRef origL1EmRef() const
std::string collection_
Data Members.
Definition: TriggerObject.h:52
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:56
bool id(trigger::TriggerObjectType triggerObjectType) const
edm::Association< TriggerObjectCollection > TriggerObjectMatch
Association of TriggerObjects to store matches to Candidates.
void setCollection(const edm::InputTag &collName)
Definition: TriggerObject.h:85
bool type(int triggerObjectType) const
const L1GctEmCand * origL1GctEmCand() const
void addTriggerObjectType(int triggerObjectType)
Definition: TriggerObject.h:88
bool type(trigger::TriggerObjectType triggerObjectType) const
Calls &#39;hasTriggerObjectType(...)&#39;.
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
edm::RefProd< TriggerObjectCollection > TriggerObjectRefProd
Persistent reference to a TriggerObjectCollection product.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:18
std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap
Container to store match references from different producers (for one PAT object) ...
bool hasTriggerObjectType(int triggerObjectType) const
bool hasFilterId(int triggerObjectType) const
Analysis-level trigger object class.
Definition: TriggerObject.h:47
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
std::string encode() const
Definition: InputTag.cc:164
const l1extra::L1JetParticleRef origL1JetRef() const
const l1extra::L1MuonParticleRef origL1MuonRef() const
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:84
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:18
edm::Ref< TriggerObjectCollection > TriggerObjectRef
Persistent reference to an item in a TriggerObjectCollection.
const std::string & collection() const
Get the label of the collection the trigger object originates from.
Definition: TriggerObject.h:92
bool id(int triggerObjectType) const
virtual bool hasCollection(const edm::InputTag &collName) const
const L1GctJetCand * origL1GctJetCand() const
const L1MuGMTExtendedCand * origL1GmtMuonCand() const
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:18
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
edm::RefVectorIterator< TriggerObjectCollection > TriggerObjectRefVectorIterator
Const iterator over vector of persistent references to items in the same TriggerObjectCollection.
const reco::Candidate * origObjCand() const
const L1GctHtMiss * origL1GctHtMiss() const
virtual ~TriggerObject()
Destructor.
Definition: TriggerObject.h:79
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
void addFilterId(int triggerObjectType)
Definition: TriggerObject.h:90
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
edm::RefVector< TriggerObjectCollection > TriggerObjectRefVector
Vector of persistent references to items in the same TriggerObjectCollection.
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:29
reco::CandidateBaseRef refToOrig_
Definition: TriggerObject.h:60
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:87
bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const
std::vector< int > filterIds() const
Definition: TriggerObject.h:97
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:27
void addFilterId(trigger::TriggerObjectType triggerObjectType)
Definition: TriggerObject.h:89
std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer
Container to store references to matches from different producers in the trigger event.
virtual bool coll(const std::string &collName) const
Calls &#39;hasCollection(...)&#39;.
const L1GctEtMiss * origL1GctEtMiss() const
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
const L1GctEtTotal * origL1GctEtTotal() const