CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetTracksAssociationDRVertex.cc
Go to the documentation of this file.
1 // Associate jets with tracks by simple "dR" criteria
2 // Fedor Ratnikov (UMd), Aug. 28, 2007
3 // $Id: JetTracksAssociationDRVertex.cc,v 1.4 2010/03/18 12:17:58 bainbrid Exp $
4 
6 
9 
12 
13 
15 : mDeltaR2Threshold (fDr*fDr)
16 {}
17 
19  const std::vector <edm::RefToBase<reco::Jet> >& fJets,
20  const std::vector <reco::TrackRef>& fTracks) const
21 {
22  // cache tracks kinematics
23  std::vector <math::RhoEtaPhiVector> trackP3s;
24  trackP3s.reserve (fTracks.size());
25  for (unsigned i = 0; i < fTracks.size(); ++i) {
26  const reco::Track* track = &*(fTracks[i]);
27  trackP3s.push_back (math::RhoEtaPhiVector (track->p(),track->eta(), track->phi()));
28  }
29  //loop on jets and associate
30  for (unsigned j = 0; j < fJets.size(); ++j) {
31  reco::TrackRefVector assoTracks;
32  const reco::Jet* jet = &*(fJets[j]);
33  double jetEta = jet->eta();
34  double jetPhi = jet->phi();
35  for (unsigned t = 0; t < fTracks.size(); ++t) {
36  double dR2 = deltaR2 (jetEta, jetPhi, trackP3s[t].eta(), trackP3s[t].phi());
37  if (dR2 < mDeltaR2Threshold) assoTracks.push_back (fTracks[t]);
38  }
39  reco::JetTracksAssociation::setValue (fAssociation, fJets[j], assoTracks);
40  }
41 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:129
int i
Definition: DBlmapReader.cc:9
Base class for all types of Jets.
Definition: Jet.h:21
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
T eta() const
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:33
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
bool setValue(Container &, const reco::JetBaseRef &, reco::TrackRefVector)
associate jet with value. Returns false and associate nothing if jet is already associated ...
double mDeltaR2Threshold
fidutial dR between track in the vertex and jet&#39;s reference direction
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks) const
int j
Definition: DBlmapReader.cc:9
double deltaR2(const Vector1 &v1, const Vector2 &v2)
Definition: VectorUtil.h:78
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
Definition: DDAxes.h:10