CMS 3D CMS Logo

JetTracksAssociationDRCalo.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 
5 
8 
11 
14 
20 
21 namespace {
22  // basic geometry constants, imported from Geometry/HcalTowerAlgo/src/CaloTowerHardcodeGeometryLoader.cc
23  const double rBarrel = 129.;
24  const double zEndcap = 320.;
25  const double zVF = 1100.;
26  const double rEndcapMin = zEndcap * tan(2 * atan(exp(-3.)));
27  const double rVFMin = zEndcap * tan(2 * atan(exp(-5.191)));
28 
29  struct ImpactPoint {
30  unsigned index;
31  double eta;
32  double phi;
33  };
34 
35  GlobalPoint propagateTrackToCalo(const reco::Track& fTrack,
36  const MagneticField& fField,
37  const Propagator& fPropagator) {
38  GlobalPoint trackPosition(fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point
39  GlobalVector trackMomentum(fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum
40  if (fTrack.extra().isAvailable()) { // use outer point information, if available
41  trackPosition = GlobalPoint(fTrack.outerX(), fTrack.outerY(), fTrack.outerZ());
42  trackMomentum = GlobalVector(fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz());
43  }
44  // std::cout << "propagateTrackToCalo-> start propagating track"
45  // << " x/y/z: " << trackPosition.x() << '/' << trackPosition.y() << '/' << trackPosition.z()
46  // << ", pt/eta/phi: " << trackMomentum.perp() << '/' << trackMomentum.eta() << '/' << trackMomentum.barePhi()
47  // << std::endl;
48  GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField);
49  FreeTrajectoryState trackState(trackParams);
50 
51  // first propagate to barrel
52  TrajectoryStateOnSurface propagatedInfo = fPropagator.propagate(
53  trackState, *Cylinder::build(rBarrel, Surface::PositionType(0, 0, 0), Surface::RotationType()));
54  if (propagatedInfo.isValid()) {
55  GlobalPoint result(propagatedInfo.globalPosition());
56  if (fabs(result.z()) < zEndcap) {
57  // std::cout << "propagateTrackToCalo-> propagated to barrel:"
58  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
59  // << std::endl;
60  return result;
61  }
62  }
63 
64  // failed with barrel, try endcap
65  double zTarget = trackMomentum.z() > 0 ? zEndcap : -zEndcap;
66  propagatedInfo =
67  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, zTarget), Surface::RotationType()));
68  if (propagatedInfo.isValid()) {
69  GlobalPoint result(propagatedInfo.globalPosition());
70  if (fabs(result.perp()) > rEndcapMin) {
71  // std::cout << "propagateTrackToCalo-> propagated to endcap:"
72  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
73  // << std::endl;
74  return result;
75  }
76  }
77  // failed with endcap, try VF
78  zTarget = trackMomentum.z() > 0 ? zVF : -zVF;
79  propagatedInfo =
80  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, zTarget), Surface::RotationType()));
81  if (propagatedInfo.isValid()) {
82  GlobalPoint result(propagatedInfo.globalPosition());
83  if (fabs(result.perp()) > rVFMin) {
84  // std::cout << "propagateTrackToCalo-> propagated to VF:"
85  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
86  // << std::endl;
87  return result;
88  }
89  }
90  // no luck
91  // std::cout << "propagateTrackToCalo-> failed to propagate track to calorimeter" << std::endl;
92  return GlobalPoint(0, 0, 0);
93  }
94 } // namespace
95 
96 JetTracksAssociationDRCalo::JetTracksAssociationDRCalo(double fDr) : mDeltaR2Threshold(fDr * fDr) {}
97 
100  const std::vector<reco::TrackRef>& fTracks,
101  const MagneticField& fField,
102  const Propagator& fPropagator) const {
103  // cache track parameters
104  std::vector<ImpactPoint> impacts;
105  for (unsigned t = 0; t < fTracks.size(); ++t) {
106  GlobalPoint impact = propagateTrackToCalo(*(fTracks[t]), fField, fPropagator);
107  if (impact.mag() > 0) { // successful extrapolation
108  ImpactPoint goodTrack;
109  goodTrack.index = t;
110  goodTrack.eta = impact.eta();
111  goodTrack.phi = impact.barePhi();
112  impacts.push_back(goodTrack);
113  }
114  }
115 
116  for (unsigned j = 0; j < fJets.size(); ++j) {
117  reco::TrackRefVector assoTracks;
118  const reco::Jet* jet = &*(fJets[j]);
119  double jetEta = jet->eta();
120  double jetPhi = jet->phi();
121  for (unsigned t = 0; t < impacts.size(); ++t) {
122  double dR2 = deltaR2(jetEta, jetPhi, impacts[t].eta, impacts[t].phi);
123  if (dR2 < mDeltaR2Threshold)
124  assoTracks.push_back(fTracks[impacts[t].index]);
125  }
126  reco::JetTracksAssociation::setValue(fAssociation, fJets[j], assoTracks);
127  }
128 }
129 
131  const MagneticField& fField,
132  const Propagator& fPropagator) {
133  GlobalPoint result(propagateTrackToCalo(fTrack, fField, fPropagator));
134  return math::XYZPoint(result.x(), result.y(), result.z());
135 }
Vector3DBase
Definition: Vector3DBase.h:8
Propagator.h
TkRotation< float >
TrajectoryStateOnSurface.h
reco::Track::outerPy
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:103
JetTracksAssociationDRCalo::propagateTrackToCalorimeter
static math::XYZPoint propagateTrackToCalorimeter(const reco::Track &fTrack, const MagneticField &fField, const Propagator &fPropagator)
propagating the track to the Calorimeter
Definition: JetTracksAssociationDRCalo.cc:130
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
FreeTrajectoryState.h
GlobalTrajectoryParameters.h
Cylinder.h
reco::Track::outerPx
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:100
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
reco::TrackBase::vx
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:655
JetTracksAssociationDRCalo::mDeltaR2Threshold
double mDeltaR2Threshold
fidutial dR between track in the vertex and jet's reference direction
Definition: JetTracksAssociationDRCalo.h:32
reco::Track::outerX
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:109
Jet.h
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
spr::goodTrack
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
Definition: TrackSelection.cc:10
edm::RefVector< TrackCollection >
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
JetTracksAssociationDRCalo::JetTracksAssociationDRCalo
JetTracksAssociationDRCalo(double fDr)
Definition: JetTracksAssociationDRCalo.cc:96
reco::Track::extra
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139
reco::Track::outerPz
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:106
Propagator
Definition: Propagator.h:44
Plane.h
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::Track::outerZ
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:115
Track.h
reco::TrackBase::py
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
reco::TrackBase::vz
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
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::trackMomentum
Definition: TaggingVariable.h:41
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:596
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
edm::AssociationVector
Definition: AssociationVector.h:67
Plane::build
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
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
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
deltaR.h
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Cylinder::build
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
MagneticField.h
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
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
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
JetTracksAssociationDRCalo.h
reco::TrackBase::vy
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
metsig::jet
Definition: SignAlgoResolutions.h:47
JetTracksAssociationDRCalo::produce
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks, const MagneticField &fField, const Propagator &fPropagator) const
Definition: JetTracksAssociationDRCalo.cc:98
edm::RefToBase< reco::Jet >
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
mps_fire.result
result
Definition: mps_fire.py:311
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
Vector3D.h
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MagneticField
Definition: MagneticField.h:19
reco::Track::outerY
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:112
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54