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 // $Id: TriggerObject.h,v 1.14 2013/06/11 13:24:49 vadler Exp $
11 //
26 
27 #include <map>
28 #include <string>
29 #include <vector>
30 #include <algorithm>
31 
45 
46 
47 namespace pat {
48 
50 
52 
58  std::vector< trigger::TriggerObjectType > triggerObjectTypes_;
63 
64  public:
65 
67 
69  TriggerObject();
71  TriggerObject( const trigger::TriggerObject & trigObj );
73  TriggerObject( const reco::LeafCandidate & leafCand );
75  TriggerObject( const reco::CandidateBaseRef & candRef );
77  TriggerObject( const reco::Particle::LorentzVector & vec, int id = 0 );
78  TriggerObject( const reco::Particle::PolarLorentzVector & vec, int id = 0 );
79 
81  virtual ~TriggerObject() {};
82 
84 
86  void setCollection( const std::string & collName ) { collection_ = collName; };
87  void setCollection( const edm::InputTag & collName ) { collection_ = collName.encode(); };
89  void addTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) { if ( ! hasTriggerObjectType( triggerObjectType ) ) triggerObjectTypes_.push_back( triggerObjectType ); };
90  void addTriggerObjectType( int triggerObjectType ) { addTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); };
91  void addFilterId( trigger::TriggerObjectType triggerObjectType ) { addTriggerObjectType( triggerObjectType ); }; // for backward compatibility
92  void addFilterId( int triggerObjectType ) { addTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
94  const std::string & collection() const { return collection_; };
96 // std::vector< trigger::TriggerObjectType > triggerObjectTypes() const { return triggerObjectTypes_; };
97 // std::vector< trigger::TriggerObjectType > filterIds() const { return triggerObjectTypes(); }; // for backward compatibility
98  std::vector< int > triggerObjectTypes() const; // for backward compatibility
99  std::vector< int > filterIds() const { return triggerObjectTypes(); }; // for double backward compatibility
101  virtual bool hasCollection( const std::string & collName ) const;
102  virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
104  bool hasTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) const;
105  bool hasTriggerObjectType( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); };
106  bool hasFilterId( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); }; // for backward compatibility
107  bool hasFilterId( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
108 
110 
112  const reco::CandidateBaseRef & origObjRef() const { return refToOrig_; };
113  const reco::Candidate * origObjCand() const { return refToOrig_.get(); };
117  const L1GctEmCand * origL1GctEmCand() const { return origL1EmRef().isNonnull() ? origL1EmRef()->gctEmCand() : 0; };
120  const L1GctEtMiss * origL1GctEtMiss() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtMiss() : 0; };
121  const L1GctEtTotal * origL1GctEtTotal() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtTotal() : 0; };
122  const L1GctHtMiss * origL1GctHtMiss() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctHtMiss() : 0; };
123  const L1GctEtHad * origL1GctEtHad() const { return origL1EtMissRef().isNonnull() ? origL1EtMissRef()->gctEtHad() : 0; };
126  const L1GctJetCand * origL1GctJetCand() const { return origL1JetRef().isNonnull() ? origL1JetRef()->gctJetCand() : 0; };
129  const L1MuGMTExtendedCand * origL1GmtMuonCand() const { return origL1MuonRef().isNonnull() ? &( origL1MuonRef()->gmtMuonCand() ) : 0; };
130 
134 
136  virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
138  bool type( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); };
139  bool type( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType ( triggerObjectType ) ); };
140  bool id( trigger::TriggerObjectType triggerObjectType ) const { return hasTriggerObjectType( triggerObjectType ); }; // for backward compatibility
141  bool id( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType ( triggerObjectType ) ); }; // for backward compatibility
142 
143  };
144 
145 
147  typedef std::vector< TriggerObject > TriggerObjectCollection;
151  typedef std::map< std::string, TriggerObjectRef > TriggerObjectMatchMap;
163  typedef std::map< std::string, TriggerObjectMatchRefProd > TriggerObjectMatchContainer;
164 
165 }
166 
167 
168 #endif
std::string collection_
Data Members.
Definition: TriggerObject.h:54
edm::RefProd< TriggerObjectMatch > TriggerObjectMatchRefProd
Persistent reference to a TriggerObjectMatch product.
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:58
const l1extra::L1MuonParticleRef origL1MuonRef() const
bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const
Checks, if a certain trigger object type identifier is assigned.
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:87
bool type(int triggerObjectType) const
const L1GctEmCand * origL1GctEmCand() const
void addTriggerObjectType(int triggerObjectType)
Definition: TriggerObject.h:90
bool type(trigger::TriggerObjectType triggerObjectType) const
Calls &#39;hasTriggerObjectType(...)&#39;.
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
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
const l1extra::L1EmParticleRef origL1EmRef() const
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:49
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
std::string encode() const
Definition: InputTag.cc:164
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
TriggerObject()
Constructors and Destructor.
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:86
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:94
bool id(int triggerObjectType) const
virtual bool hasCollection(const edm::InputTag &collName) const
const L1GctJetCand * origL1GctJetCand() const
const L1MuGMTExtendedCand * origL1GmtMuonCand() const
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:18
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:81
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
void addFilterId(int triggerObjectType)
Definition: TriggerObject.h:92
const l1extra::L1JetParticleRef origL1JetRef() const
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:27
reco::CandidateBaseRef refToOrig_
Definition: TriggerObject.h:62
const reco::CandidateBaseRef & origObjRef() const
Special methods for &#39;l1extra&#39; particles.
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
const L1GctEtHad * origL1GctEtHad() const
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:89
bool hasFilterId(trigger::TriggerObjectType triggerObjectType) const
std::vector< int > filterIds() const
Definition: TriggerObject.h:99
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25
void addFilterId(trigger::TriggerObjectType triggerObjectType)
Definition: TriggerObject.h:91
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
value_type const * get() const
Definition: RefToBase.h:212
const L1GctEtTotal * origL1GctEtTotal() const