CMS 3D CMS Logo

TrackJet.cc
Go to the documentation of this file.
1 
3 
6 
8 
9 reco::TrackJet::TrackJet(const LorentzVector& fP4, const Point& fVertex) : reco::Jet(fP4, fVertex) {}
10 
11 reco::TrackJet::TrackJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents)
12  : reco::Jet(fP4, fVertex, fConstituents) {
13  this->resetCharge();
14 }
15 
16 reco::TrackJet* reco::TrackJet::clone() const { return new reco::TrackJet(*this); }
17 
19  Constituent dau = daughterPtr(i);
20  // check the daughter to be ok
21  if (dau.isNonnull() && dau.isAvailable()) {
22  // convert to concrete candidate type
23  const RecoChargedRefCandidate* trkCand = dynamic_cast<const RecoChargedRefCandidate*>(dau.get());
24  // check the candidate is of the right type
25  if (trkCand) {
26  // check the track link in the recochargedcandidate to be there
27  if (trkCand->track().get()) {
28  // ok, return pointer to the originating track
29  return edm::Ptr<reco::Track>(trkCand->track().id(), trkCand->track().get(), trkCand->track().key());
30  } else {
31  throw cms::Exception("TrackRef unavailable") << "TrackJet consituent track not in the event.";
32  }
33  } else {
34  throw cms::Exception("Invalid Constituent") << "TrackJet constituent is not of RecoChargedRefCandidate type";
35  }
36  // otherwise return empty ptr
37  } else {
38  return edm::Ptr<reco::Track>();
39  }
40 }
41 
42 std::vector<edm::Ptr<reco::Track> > reco::TrackJet::tracks() const {
43  std::vector<edm::Ptr<reco::Track> > result;
44  for (unsigned i = 0; i < numberOfDaughters(); i++)
45  result.push_back(track(i));
46  return result;
47 }
48 
51  for (reco::Candidate::const_iterator ida = this->begin(); ida != this->end(); ++ida) {
52  charge += ida->charge();
53  }
54  this->setCharge(charge);
55 }
56 
57 const reco::VertexRef reco::TrackJet::primaryVertex() const { return vtx_; }
58 
60 
61 bool reco::TrackJet::overlap(const Candidate& dummy) const { return false; }
62 
64  std::ostringstream out;
65  out << Jet::print() // generic jet info
66  << " TrackJet specific:" << std::endl;
67  if (primaryVertex().get()) {
68  out << " Associated PV:"
69  << " x=" << primaryVertex()->x() << " y=" << primaryVertex()->y() << " z=" << primaryVertex()->z() << std::endl;
70  } else {
71  out << " Associated PV not available on the event" << std::endl;
72  }
73  std::vector<edm::Ptr<reco::Track> > thetracks = tracks();
74  for (unsigned i = 0; i < thetracks.size(); i++) {
75  if (thetracks[i].get()) {
76  out << " #" << i << " px=" << thetracks[i]->px() << " py=" << thetracks[i]->py()
77  << " pz=" << thetracks[i]->pz() << " eta=" << thetracks[i]->eta() << " phi=" << thetracks[i]->phi()
78  << std::endl;
79  } else {
80  out << " #" << i << " track is not available in the event" << std::endl;
81  }
82  }
83  return out.str();
84 }
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
reco::RecoChargedRefCandidate
Definition: RecoChargedRefCandidate.h:12
reco::TrackJet::print
std::string print() const override
Print object.
Definition: TrackJet.cc:63
reco::Jet::Constituents
std::vector< Constituent > Constituents
Definition: Jet.h:23
reco::candidate::const_iterator
Definition: const_iterator.h:14
reco::TrackJet::setPrimaryVertex
void setPrimaryVertex(const reco::VertexRef &vtx)
set associated primary vertex
Definition: TrackJet.cc:59
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
reco::TrackJet::tracks
std::vector< edm::Ptr< reco::Track > > tracks() const
Return pointers to all track costituents.
Definition: TrackJet.cc:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::TrackJet::primaryVertex
const reco::VertexRef primaryVertex() const
get associated primary vertex
Definition: TrackJet.cc:57
TrackJet.h
end
#define end
Definition: vmac.h:39
reco::TrackJet
Jets made out of tracks.
Definition: TrackJet.h:24
edm::Ref< VertexCollection >
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
Jet
Definition: Jet.py:1
reco::Jet::print
virtual std::string print() const
Print object.
reco::LeafCandidate::Charge
int Charge
electric charge type
Definition: LeafCandidate.h:21
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
reco::TrackJet::TrackJet
TrackJet()
Default constructor.
Definition: TrackJet.cc:7
reco::get
T get(const Candidate &c)
Definition: component.h:60
edm::Ptr< reco::Track >
reco::Candidate
Definition: Candidate.h:27
reco::TrackJet::overlap
bool overlap(const Candidate &dummy) const override
Polymorphic overlap.
Definition: TrackJet.cc:61
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
reco::TrackJet::resetCharge
void resetCharge()
calculate and set the charge by adding up the constituting track charges
Definition: TrackJet.cc:49
RecoChargedCandidate.h
Exception
Definition: hltDiff.cc:246
reco::TrackJet::clone
TrackJet * clone() const override
Polymorphic clone.
Definition: TrackJet.cc:16
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::Ptr::isAvailable
bool isAvailable() const
Definition: Ptr.h:229
reco::RecoChargedRefCandidate::track
reco::TrackRef track() const
Definition: RecoChargedRefCandidate.h:21
mps_fire.result
result
Definition: mps_fire.py:303
dummy
Definition: DummySelector.h:38
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::TrackJet::track
virtual edm::Ptr< reco::Track > track(size_t i) const
Return Ptr to the track costituent.
Definition: TrackJet.cc:18
begin
#define begin
Definition: vmac.h:32