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 }
trigger::TriggerObjectType
TriggerObjectType
Definition: TriggerTypeDefs.h:23
edm::errors::InvalidReference
Definition: EDMException.h:39
X
#define X(str)
Definition: MuonsGrabber.cc:38
trigObjTnPSource_cfi.collName
collName
Definition: trigObjTnPSource_cfi.py:66
pat::TriggerObject::TriggerObject
TriggerObject()
Constructors and Destructor.
pat::TriggerObject::origObjRef
const reco::CandidateBaseRef & origObjRef() const
Special methods for 'l1extra' particles.
Definition: TriggerObject.h:120
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
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.
edm::Exception
Definition: EDMException.h:77
EDMException.h
pat::TriggerObject::origL1EtMissRef
const l1extra::L1EtMissParticleRef origL1EtMissRef() const
pat::TriggerObject::collection_
std::string collection_
Data Members.
Definition: TriggerObject.h:48
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
trigger::TriggerObject
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
p4
double p4[4]
Definition: TauolaWrapper.h:92
pat::TriggerObject::triggerObjectTypes
std::vector< int > triggerObjectTypes() const
Get all trigger object type identifiers.
pat
Definition: HeavyIon.h:7
edm::RefToBase::castTo
REF castTo() const
Definition: RefToBase.h:257
pat::TriggerObject::triggerObjectTypes_
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerObject.h:52
pat::TriggerFilter::triggerObjectTypes_
std::vector< trigger::TriggerObjectType > triggerObjectTypes_
Definition: TriggerFilter.h:46
pat::TriggerObject::hasCollection
virtual bool hasCollection(const std::string &collName) const
Checks, if a certain label of original collection is assigned.
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Particle
Definition: Particle.py:1
edm::RefToBase< Candidate >
pat::TriggerObject::origL1EmRef
const l1extra::L1EmParticleRef origL1EmRef() const
reco::LeafCandidate
Definition: LeafCandidate.h:16
pat::TriggerObject::origL1JetRef
const l1extra::L1JetParticleRef origL1JetRef() const
pat::TriggerObject::origL1MuonRef
const l1extra::L1MuonParticleRef origL1MuonRef() const
edm::InputTag
Definition: InputTag.h:15
TriggerObject.h