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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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

const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecordecalDetIdAssociatorToken_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordfieldToken_
 Input tracks. More...
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordpropagatorToken_
 
const reco::TrackBase::TrackQuality trackQuality_
 
const edm::EDGetTokenT< reco::TrackCollectiontracksSrc_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 58 of file TrackExtrapolator.h.

Constructor & Destructor Documentation

◆ TrackExtrapolator()

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

Definition at line 8 of file TrackExtrapolator.cc.

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

9  : tracksSrc_(consumes(iConfig.getParameter<edm::InputTag>("trackSrc"))),
11  propagatorToken_(esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAlong"))),
12  ecalDetIdAssociatorToken_(esConsumes(edm::ESInputTag("", "EcalDetIdAssociator"))),
14  if (trackQuality_ == reco::TrackBase::undefQuality) { // we have a problem
15  throw cms::Exception("InvalidInput") << "Unknown trackQuality value '"
16  << iConfig.getParameter<std::string>("trackQuality")
17  << "'. See possible values in 'reco::TrackBase::qualityByName'";
18  }
19 
20  produces<std::vector<reco::TrackExtrapolation>>();
21 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_
Input tracks.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > ecalDetIdAssociatorToken_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const reco::TrackBase::TrackQuality trackQuality_

◆ ~TrackExtrapolator()

TrackExtrapolator::~TrackExtrapolator ( )
override

Definition at line 23 of file TrackExtrapolator.cc.

23 {}

Member Function Documentation

◆ produce()

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

Definition at line 30 of file TrackExtrapolator.cc.

References ecalDetIdAssociatorToken_, j2tParametersCALO_cfi::extrapolations, fieldToken_, edm::EventSetup::getData(), goodTracks_cfi::goodTracks, iEvent, eostools::move(), propagateTrackToVolume(), TrackCandidateProducer_cfi::propagator, propagatorToken_, StandaloneTrackMonitor_cfi::trackQuality, trackQuality_, and tracksSrc_.

30  {
31  // get stuff from Event Setup
32  auto const& field = iSetup.getData(fieldToken_);
33  auto const& propagator = iSetup.getData(propagatorToken_);
34  FiducialVolume const& ecalvolume = iSetup.getData(ecalDetIdAssociatorToken_).volume();
35 
36  // get stuff from Event
38  iEvent.getByToken(tracksSrc_, tracks_h);
39 
40  auto extrapolations = std::make_unique<std::vector<reco::TrackExtrapolation>>();
41 
42  // Get list of tracks we want to extrapolate
43  std::vector<reco::TrackRef> goodTracks;
44  for (reco::TrackCollection::const_iterator trkBegin = tracks_h->begin(), trkEnd = tracks_h->end(), itrk = trkBegin;
45  itrk != trkEnd;
46  ++itrk) {
48 
49  // Cut on track quality
50  if (itrk->quality(trackQuality)) {
51  goodTracks.push_back(reco::TrackRef(tracks_h, itrk - trkBegin));
52  }
53  }
54  std::vector<reco::TrackBase::Point> vresultPos(1);
55  std::vector<reco::TrackBase::Vector> vresultMom(1);
56 
57  // Now loop through the list of tracks and extrapolate them
58  for (std::vector<reco::TrackRef>::const_iterator trkBegin = goodTracks.begin(),
59  trkEnd = goodTracks.end(),
60  itrk = trkBegin;
61  itrk != trkEnd;
62  ++itrk) {
63  if (propagateTrackToVolume(**itrk, field, propagator, ecalvolume, vresultPos[0], vresultMom[0])) {
64  extrapolations->push_back(reco::TrackExtrapolation(*itrk, vresultPos, vresultMom));
65  }
66  }
68 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_
Input tracks.
TrackQuality
track quality
Definition: TrackBase.h:150
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
const edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > ecalDetIdAssociatorToken_
int iEvent
Definition: GenABIO.cc:224
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const reco::TrackBase::TrackQuality trackQuality_
def move(src, dest)
Definition: eostools.py:511

◆ 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 72 of file TrackExtrapolator.cc.

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().

77  {
78  GlobalPoint trackPosition(fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point
79  GlobalVector trackMomentum(fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum
80  if (fTrack.extra().isAvailable()) { // use outer point information, if available
81  trackPosition = GlobalPoint(fTrack.outerX(), fTrack.outerY(), fTrack.outerZ());
82  trackMomentum = GlobalVector(fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz());
83  }
84 
85  GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField);
86  FreeTrajectoryState trackState(trackParams);
87 
88  TrajectoryStateOnSurface propagatedInfo = fPropagator.propagate(
89  trackState, *Cylinder::build(volume.minR(), Surface::PositionType(0, 0, 0), Surface::RotationType()));
90 
91  // if the track went through either side of the endcaps, repropagate the track
92  double minz = volume.minZ();
93  if (propagatedInfo.isValid() && propagatedInfo.globalPosition().z() > minz) {
94  propagatedInfo =
95  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, minz), Surface::RotationType()));
96 
97  } else if (propagatedInfo.isValid() && propagatedInfo.globalPosition().z() < -minz) {
98  propagatedInfo =
99  fPropagator.propagate(trackState, *Plane::build(Surface::PositionType(0, 0, -minz), Surface::RotationType()));
100  }
101 
102  if (propagatedInfo.isValid()) {
103  resultPos = propagatedInfo.globalPosition();
104  resultMom = propagatedInfo.globalMomentum();
105  return true;
106  } else {
107  return false;
108  }
109 }
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:112
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:109
__constant__ float const minz[nPairs]
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:103
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:655
T z() const
Definition: PV3DBase.h:61
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:115
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
int charge() const
track electric charge
Definition: TrackBase.h:596
GlobalPoint globalPosition() const
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
bool isAvailable() const
Definition: Ref.h:537
Point3DBase< float, GlobalTag > PositionType
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:106
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
GlobalVector globalMomentum() const
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
TkRotation< float > RotationType
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:100
double minR(bool withTolerance=true) const
double minZ(bool withTolerance=true) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139

Member Data Documentation

◆ ecalDetIdAssociatorToken_

const edm::ESGetToken<DetIdAssociator, DetIdAssociatorRecord> TrackExtrapolator::ecalDetIdAssociatorToken_
private

Definition at line 71 of file TrackExtrapolator.h.

Referenced by produce().

◆ fieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackExtrapolator::fieldToken_
private

Input tracks.

Definition at line 69 of file TrackExtrapolator.h.

Referenced by produce().

◆ propagatorToken_

const edm::ESGetToken<Propagator, TrackingComponentsRecord> TrackExtrapolator::propagatorToken_
private

Definition at line 70 of file TrackExtrapolator.h.

Referenced by produce().

◆ trackQuality_

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

Definition at line 72 of file TrackExtrapolator.h.

Referenced by produce(), and TrackExtrapolator().

◆ tracksSrc_

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

Definition at line 68 of file TrackExtrapolator.h.

Referenced by produce().