CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
JetTracksAssociationDRVertexAssigned Class Reference

#include <JetTracksAssociationDRVertexAssigned.h>

Public Member Functions

 JetTracksAssociationDRVertexAssigned (double fDr)
 
void produce (reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks, const reco::VertexCollection &vertices) const
 
 ~JetTracksAssociationDRVertexAssigned ()
 

Private Attributes

double mDeltaR2Threshold
 fidutial dR between track in the vertex and jet's reference direction More...
 

Detailed Description

Definition at line 13 of file JetTracksAssociationDRVertexAssigned.h.

Constructor & Destructor Documentation

◆ JetTracksAssociationDRVertexAssigned()

JetTracksAssociationDRVertexAssigned::JetTracksAssociationDRVertexAssigned ( double  fDr)

Definition at line 14 of file JetTracksAssociationDRVertexAssigned.cc.

14 : mDeltaR2Threshold(fDr * fDr) {}

◆ ~JetTracksAssociationDRVertexAssigned()

JetTracksAssociationDRVertexAssigned::~JetTracksAssociationDRVertexAssigned ( )
inline

Definition at line 16 of file JetTracksAssociationDRVertexAssigned.h.

16 {}

Member Function Documentation

◆ produce()

void JetTracksAssociationDRVertexAssigned::produce ( reco::JetTracksAssociation::Container fAssociation,
const std::vector< edm::RefToBase< reco::Jet > > &  fJets,
const std::vector< reco::TrackRef > &  fTracks,
const reco::VertexCollection vertices 
) const

Definition at line 16 of file JetTracksAssociationDRVertexAssigned.cc.

19  {
20  // cache tracks kinematics
21  std::vector<math::RhoEtaPhiVector> trackP3s;
22  std::map<int, double> trackvert;
23 
24  // std::cout<<" Number of vertices "<<vertices.size()<<std::endl;
25 
26  trackP3s.reserve(fTracks.size());
27  for (unsigned i = 0; i < fTracks.size(); ++i) {
28  const reco::Track* track = &*(fTracks[i]);
29  trackP3s.push_back(math::RhoEtaPhiVector(track->p(), track->eta(), track->phi()));
30 
31  // OK: Look for the tracks not associated with vertices
32 
33  const reco::TrackBaseRef ttr1(fTracks[i]);
34 
35  int trackhasvert = -1;
36  for (reco::VertexCollection::const_iterator iv = vertices.begin(); iv != vertices.end(); iv++) {
37  std::vector<reco::TrackBaseRef>::const_iterator rr = find((*iv).tracks_begin(), (*iv).tracks_end(), ttr1);
38  if (rr != (*iv).tracks_end()) {
39  trackhasvert = 1;
40  trackvert[i] = (*iv).position().z();
41  // std::cout<<" Z "<<i<<" "<<trackhasvert<<" "<<(*iv).position().z()<<std::endl;
42  break;
43  }
44  } // all vertices
45  if (trackhasvert < 0) {
46  // Take impact parameter of the track as vertex position
47  math::XYZPoint ppt(0., 0., 0.);
48  trackvert[i] = track->dz(ppt);
49  // std::cout<<" Z "<<i<<" "<<trackhasvert<<" "<<track->dz(ppt)<<" "<<track->vz()<<" "<<track->vx()<<" "<<
50  // track->vy()<<" "<<track->pz()<<std::endl;
51  }
52  // OK
53  } // tracks
54 
55  for (unsigned j = 0; j < fJets.size(); ++j) {
56  reco::TrackRefVector assoTracks;
57  const reco::Jet* jet = &*(fJets[j]);
58  double jetEta = jet->eta();
59  double jetPhi = jet->phi();
60  double neweta = 0;
61  for (unsigned t = 0; t < fTracks.size(); ++t) {
62  std::map<int, double>::iterator cur = trackvert.find(t);
63  if (cur != trackvert.end()) {
64  neweta = jet->physicsEta((*cur).second, jetEta);
65  } else {
66  neweta = jetEta;
67  //std::cout<<" Lost track - not in map "<<std::endl;
68  }
69 
70  //std::cout<<" Old eta-new eta "<<(*cur).second<<" "<<jetEta<<" "<<neweta<<" Track "<<t<<" "<<trackP3s[t].eta()<<std::endl;
71 
72  double dR2 = deltaR2(neweta, jetPhi, trackP3s[t].eta(), trackP3s[t].phi());
73  if (dR2 < mDeltaR2Threshold)
74  assoTracks.push_back(fTracks[t]);
75  }
76 
77  reco::JetTracksAssociation::setValue(fAssociation, fJets[j], assoTracks);
78  }
79 }

References HLTMuonOfflineAnalyzer_cfi::deltaR2, PVValHelper::eta, spr::find(), mps_fire::i, gpuVertexFinder::iv, dqmiolumiharvest::j, metsig::jet, reco::btau::jetEta, reco::btau::jetPhi, mDeltaR2Threshold, phi, edm::RefVector< C, T, F >::push_back(), findQualityFiles::rr, reco::JetTracksAssociation::setValue(), submitPVValidationJobs::t, HLT_FULL_cff::track, and pwdgSkimBPark_cfi::vertices.

Referenced by JetTracksAssociatorAtVertex::produce().

Member Data Documentation

◆ mDeltaR2Threshold

double JetTracksAssociationDRVertexAssigned::mDeltaR2Threshold
private

fidutial dR between track in the vertex and jet's reference direction

Definition at line 25 of file JetTracksAssociationDRVertexAssigned.h.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
edm::RefVector< TrackCollection >
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
math::RhoEtaPhiVector
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:33
PVValHelper::eta
Definition: PVValidationHelpers.h:70
reco::JetTracksAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, reco::TrackRefVector)
associate jet with value. Returns false and associate nothing if jet is already associated
Definition: JetTracksAssociation.cc:41
reco::Track
Definition: Track.h:27
reco::btau::jetPhi
Definition: TaggingVariable.h:36
reco::btau::jetEta
Definition: TaggingVariable.h:34
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
DDAxes::phi
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::RefToBase< reco::Track >
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
JetTracksAssociationDRVertexAssigned::mDeltaR2Threshold
double mDeltaR2Threshold
fidutial dR between track in the vertex and jet's reference direction
Definition: JetTracksAssociationDRVertexAssigned.h:25
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7