CMS 3D CMS Logo

TriggerObject.cc
Go to the documentation of this file.
1 //
2 //
3 
5 
7 
8 using namespace pat;
9 
10 // Constructors and Destructor
11 
12 // Default constructor
13 TriggerObject::TriggerObject() : reco::LeafCandidate() { triggerObjectTypes_.clear(); }
14 
15 // Constructor from trigger::TriggerObject
17  : reco::LeafCandidate(0, trigObj.particle().p4(), reco::Particle::Point(0., 0., 0.), trigObj.id()), refToOrig_() {
18  triggerObjectTypes_.clear();
19 }
20 
21 // Constructors from base class object
22 TriggerObject::TriggerObject(const reco::LeafCandidate& leafCand) : reco::LeafCandidate(leafCand), refToOrig_() {
23  triggerObjectTypes_.clear();
24 }
25 
26 // Constructors from base candidate reference (for 'l1extra' particles)
28  : reco::LeafCandidate(*candRef), refToOrig_(candRef) {
29  triggerObjectTypes_.clear();
30 }
31 
32 // Constructors from Lorentz-vectors and (optional) PDG ID
34  : reco::LeafCandidate(0, vec, reco::Particle::Point(0., 0., 0.), id), refToOrig_() {
35  triggerObjectTypes_.clear();
36 }
38  : reco::LeafCandidate(0, vec, reco::Particle::Point(0., 0., 0.), id), refToOrig_() {
39  triggerObjectTypes_.clear();
40 }
41 
42 // Methods
43 
44 // Get all trigger object type identifiers
45 std::vector<int> TriggerObject::triggerObjectTypes() const {
46  std::vector<int> triggerObjectTypes;
47  for (size_t iTo = 0; iTo < triggerObjectTypes_.size(); ++iTo) {
48  triggerObjectTypes.push_back(triggerObjectTypes_.at(iTo));
49  }
50  return triggerObjectTypes;
51 }
52 
53 // Checks, if a certain label of original collection is assigned
55  // True, if collection name is simply fine
56  if (collName == collection_)
57  return true;
58  // Check, if collection name possibly fits in an edm::InputTag approach
59  const edm::InputTag collectionTag(collection_);
60  const edm::InputTag collTag(collName);
61  // If evaluated collection tag contains a process name, it must have been found already by identity check
62  if (collTag.process().empty()) {
63  // Check instance ...
64  if ((collTag.instance().empty() && collectionTag.instance().empty()) ||
65  collTag.instance() == collectionTag.instance()) {
66  // ... and label
67  return (collTag.label() == collectionTag.label());
68  }
69  }
70  return false;
71 }
72 
73 // Checks, if a certain trigger object type identifier is assigned
75  for (size_t iF = 0; iF < triggerObjectTypes_.size(); ++iF) {
76  if (triggerObjectType == triggerObjectTypes_.at(iF))
77  return true;
78  }
79  return false;
80 }
81 
82 // Special methods for 'l1extra' particles
83 
84 // Getters specific to the 'l1extra' particle types
85 // Exceptions of type 'edm::errors::InvalidReference' are thrown,
86 // if wrong particle type is requested
87 
88 // EM
91  try {
93  } catch (edm::Exception const& X) {
94  if (X.categoryCode() != edm::errors::InvalidReference)
95  throw X;
96  }
97  return l1Ref;
98 }
99 
100 // EtMiss
103  try {
105  } catch (edm::Exception const& X) {
106  if (X.categoryCode() != edm::errors::InvalidReference)
107  throw X;
108  }
109  return l1Ref;
110 }
111 
112 // Jet
115  try {
117  } catch (edm::Exception const& X) {
118  if (X.categoryCode() != edm::errors::InvalidReference)
119  throw X;
120  }
121  return l1Ref;
122 }
123 
124 // Muon
127  try {
129  } catch (edm::Exception const& X) {
130  if (X.categoryCode() != edm::errors::InvalidReference)
131  throw X;
132  }
133  return l1Ref;
134 }
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
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.
const l1extra::L1EmParticleRef origL1EmRef() const
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerFilter.h:46
#define X(str)
Definition: MuonsGrabber.cc:38
REF castTo() const
Definition: RefToBase.h:243
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
const l1extra::L1MuonParticleRef origL1MuonRef() const
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
TriggerObject()
Constructors and Destructor.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
const reco::CandidateBaseRef & origObjRef() const
Special methods for &#39;l1extra&#39; particles.