CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
JetTracksAssociationDRCalo Class Reference

#include <JetTracksAssociationDRCalo.h>

Inheritance diagram for JetTracksAssociationDRCalo:
JetTracksAssociationDR

Classes

struct  ImpactPoint
 Definition of track impact point. More...
 

Public Member Functions

void associateTracksToJet (reco::TrackRefVector &, const reco::Jet &, const TrackRefs &)
 Associate tracks to the given jet. More...
 
 JetTracksAssociationDRCalo (double dr_threshold)
 Constructor taking dR threshold as argument. More...
 
void produce (Association *, const Jets &, const Tracks &, const TrackQuality &, const MagneticField &, const Propagator &)
 Associates tracks to jets (using Handles as input) More...
 
void produce (Association *, const JetRefs &, const TrackRefs &, const MagneticField &, const Propagator &)
 Associates tracks to jets. More...
 
void propagateTracks (const TrackRefs &, const MagneticField &, const Propagator &)
 
 ~JetTracksAssociationDRCalo ()
 Destructor. More...
 
- Public Member Functions inherited from JetTracksAssociationDR
void associateTracksToJets (Association *, const JetRefs &, const TrackRefs &)
 
 JetTracksAssociationDR (double dr_threshold)
 Constructor taking dR threshold as argument. More...
 
virtual ~JetTracksAssociationDR ()
 Destructor. More...
 

Static Public Member Functions

static math::XYZPoint propagateTrackToCalorimeter (const reco::Track &, const MagneticField &, const Propagator &)
 Propagates track to calorimeter face. More...
 
- Static Public Member Functions inherited from JetTracksAssociationDR
static void createJetRefs (JetRefs &, const Jets &)
 
static void createTrackRefs (TrackRefs &, const Tracks &, const TrackQuality &)
 

Private Member Functions

 JetTracksAssociationDRCalo ()
 Private default constructor. More...
 

Static Private Member Functions

static GlobalPoint propagateTrackToCalo (const reco::Track &, const MagneticField &, const Propagator &)
 Propagates track to calorimeter face. More...
 

Private Attributes

std::vector< ImpactPointpropagatedTracks_
 Impact points of tracks at calorimeter face. More...
 

Additional Inherited Members

- Public Types inherited from JetTracksAssociationDR
typedef
reco::JetTracksAssociation::Container 
Association
 Container for jet-track associations. More...
 
typedef edm::RefToBase< reco::JetJetRef
 
typedef std::vector< JetRefJetRefs
 
typedef edm::Handle< edm::View
< reco::Jet > > 
Jets
 Handle to jet collection. More...
 
typedef
reco::TrackBase::TrackQuality 
TrackQuality
 
typedef std::vector
< reco::TrackRef
TrackRefs
 
typedef edm::Handle
< reco::TrackCollection
Tracks
 Handle to track collection. More...
 
- Protected Member Functions inherited from JetTracksAssociationDR
 JetTracksAssociationDR ()
 Private default constructor. More...
 
- Protected Attributes inherited from JetTracksAssociationDR
double mDeltaR2Threshold
 Threshold used to associate tracks to jets. More...
 

Detailed Description

Definition at line 17 of file JetTracksAssociationDRCalo.h.

Constructor & Destructor Documentation

JetTracksAssociationDRCalo::JetTracksAssociationDRCalo ( double  dr_threshold)
explicit

Constructor taking dR threshold as argument.

Definition at line 18 of file JetTracksAssociationDRCalo.cc.

21 {;}
JetTracksAssociationDR()
Private default constructor.
std::vector< ImpactPoint > propagatedTracks_
Impact points of tracks at calorimeter face.
JetTracksAssociationDRCalo::~JetTracksAssociationDRCalo ( )

Destructor.

Definition at line 25 of file JetTracksAssociationDRCalo.cc.

26 {;}
JetTracksAssociationDRCalo::JetTracksAssociationDRCalo ( )
private

Private default constructor.

Member Function Documentation

void JetTracksAssociationDRCalo::associateTracksToJet ( reco::TrackRefVector ,
const reco::Jet ,
const TrackRefs  
)
virtual

Associate tracks to the given jet.

Implements JetTracksAssociationDR.

Definition at line 59 of file JetTracksAssociationDRCalo.cc.

References edm::RefVector< C, T, F >::clear(), Geom::deltaR2(), reco::LeafCandidate::eta(), JetTracksAssociationDR::mDeltaR2Threshold, reco::LeafCandidate::phi(), propagatedTracks_, and edm::RefVector< C, T, F >::push_back().

62 {
63  associated.clear();
64  std::vector<ImpactPoint>::const_iterator ii = propagatedTracks_.begin();
65  std::vector<ImpactPoint>::const_iterator jj = propagatedTracks_.end();
66  for ( ; ii != jj; ++ii ) {
67  double dR2 = deltaR2( fJet.eta(), fJet.phi(), ii->eta, ii->phi );
68  if ( dR2 < mDeltaR2Threshold ) { associated.push_back( fTracks[ii->index] ); }
69  }
70 }
double mDeltaR2Threshold
Threshold used to associate tracks to jets.
std::vector< ImpactPoint > propagatedTracks_
Impact points of tracks at calorimeter face.
double deltaR2(const Vector1 &v1, const Vector2 &v2)
Definition: VectorUtil.h:78
void JetTracksAssociationDRCalo::produce ( Association fAssociation,
const Jets fJets,
const Tracks fTracks,
const TrackQuality fQuality,
const MagneticField fField,
const Propagator fPropagator 
)

Associates tracks to jets (using Handles as input)

Definition at line 30 of file JetTracksAssociationDRCalo.cc.

References JetTracksAssociationDR::createJetRefs(), JetTracksAssociationDR::createTrackRefs(), analyzePatCleaning_cfg::jets, and testEve_cfg::tracks.

36 {
37  JetRefs jets;
38  createJetRefs( jets, fJets );
40  createTrackRefs( tracks, fTracks, fQuality );
41  produce( fAssociation, jets, tracks, fField, fPropagator );
42 }
void produce(Association *, const Jets &, const Tracks &, const TrackQuality &, const MagneticField &, const Propagator &)
Associates tracks to jets (using Handles as input)
std::vector< reco::TrackRef > TrackRefs
std::vector< JetRef > JetRefs
tuple tracks
Definition: testEve_cfg.py:39
static void createJetRefs(JetRefs &, const Jets &)
static void createTrackRefs(TrackRefs &, const Tracks &, const TrackQuality &)
void JetTracksAssociationDRCalo::produce ( Association fAssociation,
const JetRefs fJets,
const TrackRefs fTracks,
const MagneticField fField,
const Propagator fPropagator 
)

Associates tracks to jets.

Definition at line 46 of file JetTracksAssociationDRCalo.cc.

References JetTracksAssociationDR::associateTracksToJets(), and propagateTracks().

51 {
52  //clear();
53  propagateTracks( fTracks, fField, fPropagator );
54  associateTracksToJets( fAssociation, fJets, fTracks );
55 }
void propagateTracks(const TrackRefs &, const MagneticField &, const Propagator &)
void associateTracksToJets(Association *, const JetRefs &, const TrackRefs &)
void JetTracksAssociationDRCalo::propagateTracks ( const TrackRefs fTracks,
const MagneticField fField,
const Propagator fPropagator 
)

Definition at line 74 of file JetTracksAssociationDRCalo.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), JetTracksAssociationDRCalo::ImpactPoint::eta, PV3DBase< T, PVType, FrameType >::eta(), spr::goodTrack(), JetTracksAssociationDRCalo::ImpactPoint::index, PV3DBase< T, PVType, FrameType >::mag(), JetTracksAssociationDRCalo::ImpactPoint::phi, propagatedTracks_, and propagateTrackToCalo().

Referenced by produce().

77 {
78  propagatedTracks_.clear();
79  propagatedTracks_.reserve( fTracks.size() );
80  TrackRefs::const_iterator ii = fTracks.begin();
81  TrackRefs::const_iterator jj = fTracks.end();
82  for ( ; ii != jj; ++ii ) {
83  GlobalPoint impact = JetTracksAssociationDRCalo::propagateTrackToCalo( **ii, fField, fPropagator );
84  if ( impact.mag() > 0 ) { //@@ successful extrapolation
85  ImpactPoint goodTrack;
86  goodTrack.index = ii - fTracks.begin(); //@@ index
87  goodTrack.eta = impact.eta();
88  goodTrack.phi = impact.barePhi();
89  propagatedTracks_.push_back( goodTrack );
90  }
91  }
92 }
std::vector< ImpactPoint > propagatedTracks_
Impact points of tracks at calorimeter face.
T barePhi() const
Definition: PV3DBase.h:62
T mag() const
Definition: PV3DBase.h:61
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
T eta() const
Definition: PV3DBase.h:70
static GlobalPoint propagateTrackToCalo(const reco::Track &, const MagneticField &, const Propagator &)
Propagates track to calorimeter face.
GlobalPoint JetTracksAssociationDRCalo::propagateTrackToCalo ( const reco::Track fTrack,
const MagneticField fField,
const Propagator fPropagator 
)
staticprivate

Propagates track to calorimeter face.

Definition at line 106 of file JetTracksAssociationDRCalo.cc.

References Plane::build(), Cylinder::build(), reco::TrackBase::charge(), JetTracksAssociationDRCalo::ImpactPoint::eta, funct::exp(), reco::Track::extra(), TrajectoryStateOnSurface::globalPosition(), JetTracksAssociationDRCalo::ImpactPoint::index, edm::Ref< C, T, F >::isAvailable(), TrajectoryStateOnSurface::isValid(), reco::Track::outerPx(), reco::Track::outerPy(), reco::Track::outerPz(), reco::Track::outerX(), reco::Track::outerY(), reco::Track::outerZ(), JetTracksAssociationDRCalo::ImpactPoint::phi, Propagator::propagate(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), query::result, funct::tan(), reco::btau::trackMomentum, reco::TrackBase::vx(), reco::TrackBase::vy(), and reco::TrackBase::vz().

Referenced by propagateTracks(), and propagateTrackToCalorimeter().

109 {
110 
111  // basic geometry constants, imported from Geometry/HcalTowerAlgo/src/CaloTowerHardcodeGeometryLoader.cc
112  const double rBarrel = 129.;
113  const double zEndcap = 320.;
114  const double zVF = 1100.;
115  const double rEndcapMin = zEndcap * tan ( 2*atan (exp (-3.)));
116  const double rVFMin = zEndcap * tan ( 2*atan (exp (-5.191)));
117 
118  struct ImpactPoint {
119  unsigned index;
120  double eta;
121  double phi;
122  };
123 
124  GlobalPoint trackPosition (fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point
125  GlobalVector trackMomentum (fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum
126  if (fTrack.extra().isAvailable() ) { // use outer point information, if available
127  trackPosition = GlobalPoint (fTrack.outerX(), fTrack.outerY(), fTrack.outerZ());
128  trackMomentum = GlobalVector (fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz());
129  }
130  // std::cout << "propagateTrackToCalo-> start propagating track"
131  // << " x/y/z: " << trackPosition.x() << '/' << trackPosition.y() << '/' << trackPosition.z()
132  // << ", pt/eta/phi: " << trackMomentum.perp() << '/' << trackMomentum.eta() << '/' << trackMomentum.barePhi()
133  // << std::endl;
134  GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField);
135  FreeTrajectoryState trackState (trackParams);
136 
137  // first propagate to barrel
139  propagatedInfo = fPropagator.propagate (trackState,
142  rBarrel)
143  );
144  if (propagatedInfo.isValid()) {
145  GlobalPoint result (propagatedInfo.globalPosition ());
146  if (fabs (result.z()) < zEndcap) {
147  // std::cout << "propagateTrackToCalo-> propagated to barrel:"
148  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
149  // << std::endl;
150  return result;
151  }
152  }
153 
154  // failed with barrel, try endcap
155  double zTarget = trackMomentum.z() > 0 ? zEndcap : -zEndcap;
156  propagatedInfo = fPropagator.propagate (trackState,
157  *Plane::build( Surface::PositionType(0, 0, zTarget),
159  );
160  if (propagatedInfo.isValid()) {
161  GlobalPoint result (propagatedInfo.globalPosition ());
162  if (fabs (result.perp()) > rEndcapMin) {
163  // std::cout << "propagateTrackToCalo-> propagated to endcap:"
164  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
165  // << std::endl;
166  return result;
167  }
168  }
169  // failed with endcap, try VF
170  zTarget = trackMomentum.z() > 0 ? zVF : -zVF;
171  propagatedInfo = fPropagator.propagate (trackState,
172  *Plane::build( Surface::PositionType(0, 0, zTarget),
174  );
175  if (propagatedInfo.isValid()) {
176  GlobalPoint result (propagatedInfo.globalPosition ());
177  if (fabs (result.perp()) > rVFMin) {
178  // std::cout << "propagateTrackToCalo-> propagated to VF:"
179  // << " x/y/z/r: " << result.x() << '/' << result.y() << '/' << result.z() << '/' << result.perp()
180  // << std::endl;
181  return result;
182  }
183  }
184  // no luck
185  // std::cout << "propagateTrackToCalo-> failed to propagate track to calorimeter" << std::endl;
186  return GlobalPoint (0, 0, 0);
187 }
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:73
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint globalPosition() const
static PlanePointer build(const PositionType &pos, const RotationType &rot, MediumProperties *mp=0)
Definition: Plane.h:25
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:132
bool isAvailable() const
Definition: Ref.h:278
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:81
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:77
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:75
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:136
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:146
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, MediumProperties *mp=0)
Definition: Cylinder.h:29
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:144
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:79
int charge() const
track electric charge
Definition: TrackBase.h:112
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:71
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:134
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:142
Global3DVector GlobalVector
Definition: GlobalVector.h:10
math::XYZPoint JetTracksAssociationDRCalo::propagateTrackToCalorimeter ( const reco::Track fTrack,
const MagneticField fField,
const Propagator fPropagator 
)
static

Propagates track to calorimeter face.

Definition at line 96 of file JetTracksAssociationDRCalo.cc.

References propagateTrackToCalo(), query::result, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by jptJetAnalysis::TrackPropagatorToCalo::impactPoint().

99 {
100  GlobalPoint result( JetTracksAssociationDRCalo::propagateTrackToCalo( fTrack, fField, fPropagator ) );
101  return math::XYZPoint( result.x(), result.y(), result.z() );
102 }
tuple result
Definition: query.py:137
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
static GlobalPoint propagateTrackToCalo(const reco::Track &, const MagneticField &, const Propagator &)
Propagates track to calorimeter face.

Member Data Documentation

std::vector<ImpactPoint> JetTracksAssociationDRCalo::propagatedTracks_
private

Impact points of tracks at calorimeter face.

Definition at line 75 of file JetTracksAssociationDRCalo.h.

Referenced by associateTracksToJet(), and propagateTracks().