CMS 3D CMS Logo

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

#include <RecoTracker/TrackExtrapolator/src/TrackExtrapolator.cc>

Inheritance diagram for TrackExtrapolator:
edm::stream::EDProducer<>

Public Member Functions

 TrackExtrapolator (const edm::ParameterSet &)
 
 ~TrackExtrapolator () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
bool propagateTrackToVolume (const reco::Track &fTrack, const MagneticField &fField, const Propagator &fPropagator, const FiducialVolume &volume, reco::TrackBase::Point &resultPos, reco::TrackBase::Vector &resultMom)
 track quality of the tracks we care about More...
 

Private Attributes

reco::TrackBase::TrackQuality trackQuality_
 Input tracks. More...
 
edm::EDGetTokenT< reco::TrackCollectiontracksSrc_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: Extrapolates tracks to Calo Face. Migrating this functionality from RecoJets/JetAssociationAlgorithms/JetTracksAssociatorDRCalo.h, which will now essentially be defunct.

Implementation:

Definition at line 57 of file TrackExtrapolator.h.

Constructor & Destructor Documentation

◆ TrackExtrapolator()

TrackExtrapolator::TrackExtrapolator ( const edm::ParameterSet iConfig)
explicit

Definition at line 10 of file TrackExtrapolator.cc.

10  {
11  tracksSrc_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackSrc"));
13  if (trackQuality_ == reco::TrackBase::undefQuality) { // we have a problem
14  throw cms::Exception("InvalidInput") << "Unknown trackQuality value '"
15  << iConfig.getParameter<std::string>("trackQuality")
16  << "'. See possible values in 'reco::TrackBase::qualityByName'";
17  }
18 
19  produces<std::vector<reco::TrackExtrapolation>>();
20 }

References Exception, edm::ParameterSet::getParameter(), reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, trackQuality_, tracksSrc_, and reco::TrackBase::undefQuality.

◆ ~TrackExtrapolator()

TrackExtrapolator::~TrackExtrapolator ( )
override

Definition at line 22 of file TrackExtrapolator.cc.

22 {}

Member Function Documentation

◆ produce()

void TrackExtrapolator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 29 of file TrackExtrapolator.cc.

29  {
30  // get stuff from Event Setup
32  iSetup.get<IdealMagneticFieldRecord>().get(field_h);
33  edm::ESHandle<Propagator> propagator_h;
34  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator_h);
35  edm::ESHandle<DetIdAssociator> ecalDetIdAssociator_h;
36  iSetup.get<DetIdAssociatorRecord>().get("EcalDetIdAssociator", ecalDetIdAssociator_h);
37  FiducialVolume const& ecalvolume = ecalDetIdAssociator_h->volume();
38 
39  // get stuff from Event
41  iEvent.getByToken(tracksSrc_, tracks_h);
42 
43  auto extrapolations = std::make_unique<std::vector<reco::TrackExtrapolation>>();
44 
45  // Get list of tracks we want to extrapolate
46  std::vector<reco::TrackRef> goodTracks;
47  for (reco::TrackCollection::const_iterator trkBegin = tracks_h->begin(), trkEnd = tracks_h->end(), itrk = trkBegin;
48  itrk != trkEnd;
49  ++itrk) {
51 
52  // Cut on track quality
53  if (itrk->quality(trackQuality)) {
54  goodTracks.push_back(reco::TrackRef(tracks_h, itrk - trkBegin));
55  }
56  }
57  std::vector<reco::TrackBase::Point> vresultPos(1);
58  std::vector<reco::TrackBase::Vector> vresultMom(1);
59 
60  // Now loop through the list of tracks and extrapolate them
61  for (std::vector<reco::TrackRef>::const_iterator trkBegin = goodTracks.begin(),
62  trkEnd = goodTracks.end(),
63  itrk = trkBegin;
64  itrk != trkEnd;
65  ++itrk) {
66  if (propagateTrackToVolume(**itrk, *field_h, *propagator_h, ecalvolume, vresultPos[0], vresultMom[0])) {
67  extrapolations->push_back(reco::TrackExtrapolation(*itrk, vresultPos, vresultMom));
68  }
69  }
71 }

References j2tParametersCALO_cfi::extrapolations, edm::EventSetup::get(), get, goodTracks_cfi::goodTracks, iEvent, eostools::move(), propagateTrackToVolume(), StandaloneTrackMonitor_cfi::trackQuality, trackQuality_, tracksSrc_, and DetIdAssociator::volume().

◆ propagateTrackToVolume()

bool TrackExtrapolator::propagateTrackToVolume ( const reco::Track fTrack,
const MagneticField fField,
const Propagator fPropagator,
const FiducialVolume volume,
reco::TrackBase::Point resultPos,
reco::TrackBase::Vector resultMom 
)
private

track quality of the tracks we care about

Propagate a track to a given radius, given the magnetic field and the propagator. Store the resulting position, momentum, and direction.

Definition at line 75 of file TrackExtrapolator.cc.

80  {
81  GlobalPoint trackPosition(fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point
82  GlobalVector trackMomentum(fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum
83  if (fTrack.extra().isAvailable()) { // use outer point information, if available
84  trackPosition = GlobalPoint(fTrack.outerX(), fTrack.outerY(), fTrack.outerZ());
85  trackMomentum = GlobalVector(fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz());
86  }
87 
88  GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField);
89  FreeTrajectoryState trackState(trackParams);
90 
91  TrajectoryStateOnSurface propagatedInfo = fPropagator.propagate(
92  trackState, *Cylinder::build(volume.minR(), Surface::PositionType(0, 0, 0), Surface::RotationType()));
93 
94  // if the track went through either side of the endcaps, repropagate the track
95  double minz = volume.minZ();
96  if (propagatedInfo.isValid() && propagatedInfo.globalPosition().z() > minz) {
97  propagatedInfo =
98  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, minz), Surface::RotationType()));
99 
100  } else if (propagatedInfo.isValid() && propagatedInfo.globalPosition().z() < -minz) {
101  propagatedInfo =
102  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, -minz), Surface::RotationType()));
103  }
104 
105  if (propagatedInfo.isValid()) {
106  resultPos = propagatedInfo.globalPosition();
107  resultMom = propagatedInfo.globalMomentum();
108  return true;
109  } else {
110  return false;
111  }
112 }

References Plane::build(), Cylinder::build(), reco::TrackBase::charge(), reco::Track::extra(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), edm::Ref< C, T, F >::isAvailable(), TrajectoryStateOnSurface::isValid(), FiducialVolume::minR(), FiducialVolume::minZ(), gpuPixelDoublets::minz, reco::Track::outerPx(), reco::Track::outerPy(), reco::Track::outerPz(), reco::Track::outerX(), reco::Track::outerY(), reco::Track::outerZ(), Propagator::propagate(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::btau::trackMomentum, reco::TrackBase::vx(), reco::TrackBase::vy(), reco::TrackBase::vz(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

Member Data Documentation

◆ trackQuality_

reco::TrackBase::TrackQuality TrackExtrapolator::trackQuality_
private

Input tracks.

Definition at line 68 of file TrackExtrapolator.h.

Referenced by produce(), and TrackExtrapolator().

◆ tracksSrc_

edm::EDGetTokenT<reco::TrackCollection> TrackExtrapolator::tracksSrc_
private

Definition at line 67 of file TrackExtrapolator.h.

Referenced by produce(), and TrackExtrapolator().

Vector3DBase
Definition: Vector3DBase.h:8
TkRotation< float >
DetIdAssociator::volume
const FiducialVolume & volume() const
get active detector volume
Definition: DetIdAssociator.cc:352
reco::Track::outerPy
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:103
StandaloneTrackMonitor_cfi.trackQuality
trackQuality
Definition: StandaloneTrackMonitor_cfi.py:11
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
TrackExtrapolator::tracksSrc_
edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
Definition: TrackExtrapolator.h:67
reco::TrackBase::undefQuality
Definition: TrackBase.h:151
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
FiducialVolume::minR
double minR(bool withTolerance=true) const
Definition: FiducialVolume.h:37
reco::TrackBase::vx
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:655
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
reco::Track::outerX
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:109
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
edm::Handle< reco::TrackCollection >
GloballyPositioned< float >::RotationType
TkRotation< float > RotationType
Definition: GloballyPositioned.h:22
reco::Track::extra
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139
edm::Ref< TrackCollection >
reco::Track::outerPz
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:106
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::Track::outerZ
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:115
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
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
edm::ESHandle< MagneticField >
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 >
TrackExtrapolator::trackQuality_
reco::TrackBase::TrackQuality trackQuality_
Input tracks.
Definition: TrackExtrapolator.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Plane::build
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
FiducialVolume::minZ
double minZ(bool withTolerance=true) const
Definition: FiducialVolume.h:49
Cylinder::build
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
iEvent
int iEvent
Definition: GenABIO.cc:224
FiducialVolume
Definition: FiducialVolume.h:25
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
get
#define get
DetIdAssociatorRecord
Definition: DetIdAssociatorRecord.h:13
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::TrackBase::vy
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
GloballyPositioned< float >::PositionType
Point3DBase< float, GlobalTag > PositionType
Definition: GloballyPositioned.h:21
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
goodTracks_cfi.goodTracks
goodTracks
Definition: goodTracks_cfi.py:3
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
reco::TrackExtrapolation
Definition: TrackExtrapolation.h:22
j2tParametersCALO_cfi.extrapolations
extrapolations
Definition: j2tParametersCALO_cfi.py:6
edm::InputTag
Definition: InputTag.h:15
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
TrackExtrapolator::propagateTrackToVolume
bool propagateTrackToVolume(const reco::Track &fTrack, const MagneticField &fField, const Propagator &fPropagator, const FiducialVolume &volume, reco::TrackBase::Point &resultPos, reco::TrackBase::Vector &resultMom)
track quality of the tracks we care about
Definition: TrackExtrapolator.cc:75
gpuPixelDoublets::minz
__constant__ const float minz[nPairs]
Definition: gpuPixelDoublets.h:53
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12