ATLAS Offline Software
Loading...
Searching...
No Matches
Reco::TrackToVertex Class Reference

#include <TrackToVertex.h>

Inheritance diagram for Reco::TrackToVertex:
Collaboration diagram for Reco::TrackToVertex:

Public Member Functions

 TrackToVertex (const std::string &, const std::string &, const IInterface *)
 AlgTool like constructor.
virtual ~TrackToVertex ()=default
 Virtual destructor.
virtual StatusCode initialize () override final
 AlgTool initailize method.
virtual std::unique_ptr< Trk::StraightLineSurfaceGetBeamLine (const InDet::BeamSpotData *) const override final
 Use this for MT Coding.
virtual std::unique_ptr< Trk::PerigeeperigeeAtVertex (const EventContext &ctx, const xAOD::TrackParticle &tp, const Amg::Vector3D &gp) const override final
 Interface method for use with xAOD::Trackparticle and given vertex position.
virtual std::unique_ptr< Trk::PerigeeperigeeAtVertex (const EventContext &ctx, const xAOD::TrackParticle &tp) const override final
 Interface method for use with TrackParticle and default primary vertex from TrackParticle - xAOD.
virtual std::unique_ptr< Trk::PerigeeperigeeAtVertex (const EventContext &ctx, const Trk::Track &trk, const Amg::Vector3D &gp) const override final
 Interface method for use with Track and given vertex position - ESD.
virtual std::unique_ptr< Trk::PerigeeperigeeAtBeamline (const EventContext &ctx, const Trk::Track &trk, const InDet::BeamSpotData *) const override final
 Interface method for use with Track and the beamline.
virtual std::unique_ptr< Trk::TrackParameterstrackAtBeamline (const EventContext &ctx, const xAOD::TrackParticle &tp, const InDet::BeamSpotData *) const override final
 Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - xAOD.
virtual std::unique_ptr< Trk::TrackParameterstrackAtBeamline (const EventContext &ctx, const Trk::Track &trk, const Trk::StraightLineSurface *beamline) const override final
 Interface method for use with Track and the beamline from the BeamSpotSvc - ESD.
virtual std::unique_ptr< Trk::TrackParameterstrackAtBeamline (const EventContext &ctx, const Trk::TrackParameters &tpars, const Trk::StraightLineSurface *beamline) const override final
 Interface method for use with Track and the beamline from the BeamSpotSvc - TrackParameters.

Private Member Functions

bool startAtOriginalPerigee (const Trk::Track &track) const

Private Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator
 ToolHandle for Extrapolator.
Gaudi::Property< bool > m_startTRTSAAtPerigee

Static Private Attributes

static const Amg::Vector3D s_origin
 static origin

Detailed Description

Definition at line 39 of file TrackToVertex.h.

Constructor & Destructor Documentation

◆ TrackToVertex()

TrackToVertex::TrackToVertex ( const std::string & t,
const std::string & n,
const IInterface * p )

AlgTool like constructor.

Definition at line 23 of file TrackToVertex.cxx.

23 :
24 base_class(t,n,p)
25{
26}

◆ ~TrackToVertex()

virtual Reco::TrackToVertex::~TrackToVertex ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ GetBeamLine()

std::unique_ptr< Trk::StraightLineSurface > TrackToVertex::GetBeamLine ( const InDet::BeamSpotData * beamSpotHandle) const
finaloverridevirtual

Use this for MT Coding.

Definition at line 35 of file TrackToVertex.cxx.

36 {
37 // get the transform
38 Amg::Transform3D beamTransform = Amg::Transform3D(Amg::AngleAxis3D(beamSpotHandle->beamTilt(0),Amg::Vector3D(0.,1.,0.)));
39 beamTransform *= Amg::AngleAxis3D(beamSpotHandle->beamTilt(1),Amg::Vector3D(1.,0.,0.));
40 beamTransform.pretranslate(beamSpotHandle->beamPos());
41 // create the new beam line
42 return std::make_unique< Trk::StraightLineSurface >(beamTransform);
43}
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt')
const Amg::Vector3D & beamPos() const noexcept
Eigen::AngleAxisd AngleAxis3D
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D

◆ initialize()

StatusCode TrackToVertex::initialize ( )
finaloverridevirtual

AlgTool initailize method.

Definition at line 29 of file TrackToVertex.cxx.

30{
31 ATH_CHECK(m_extrapolator.retrieve());
32 return StatusCode::SUCCESS;
33}
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle for Extrapolator.

◆ perigeeAtBeamline()

std::unique_ptr< Trk::Perigee > TrackToVertex::perigeeAtBeamline ( const EventContext & ctx,
const Trk::Track & trk,
const InDet::BeamSpotData * beamspotptr ) const
finaloverridevirtual

Interface method for use with Track and the beamline.

Definition at line 104 of file TrackToVertex.cxx.

108{
109
110 Amg::Vector3D beamspot(s_origin);
111 float tiltx = 0.0;
112 float tilty = 0.0;
113 if (beamspotptr) {
114 beamspot = Amg::Vector3D(beamspotptr->beamVtx().position());
115 tiltx = beamspotptr->beamTilt(0);
116 tilty = beamspotptr->beamTilt(1);
117 }
118 Amg::Translation3D amgtranslation(beamspot);
119 Amg::Transform3D pAmgTransf =
120 amgtranslation * Amg::RotationMatrix3D::Identity();
121 pAmgTransf *= Amg::AngleAxis3D(tilty, Amg::Vector3D(0., 1., 0.));
122 pAmgTransf *= Amg::AngleAxis3D(tiltx, Amg::Vector3D(1., 0., 0.));
123 // preparation
124 Trk::PerigeeSurface persf(pAmgTransf);
125
126 std::unique_ptr<Trk::Perigee> vertexPerigee;
127 if(track.perigeeParameters() && std::abs(track.perigeeParameters()->position().z())>5000.){
128 ATH_MSG_DEBUG("Perigee well outside of tracking detector, skipping extrapolation");
129 }
130 else{
131 std::unique_ptr<Trk::TrackParameters> extrapResult =
133 ? m_extrapolator->extrapolateTrack(ctx,track, persf)
134 : m_extrapolator->extrapolate(ctx,*(track.perigeeParameters()), persf);
135 if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
136 vertexPerigee.reset(static_cast<Trk::Perigee*>(extrapResult.release()));
137 }
138 }
139 if (!vertexPerigee) {
140 // workaround.
141 // try again using the first track parameter set, since the current extrapolator will
142 // use "the closest" track parameter set which is not necessarily the most useful one to
143 // start the extrapolation with.
144 const DataVector<const Trk::TrackParameters> *track_parameter_list= track.trackParameters();
145 if (track_parameter_list) {
146 for(const Trk::TrackParameters *trk_params: *track_parameter_list) {
147 if (!trk_params || std::abs(trk_params->position().z())>5000.) {
148 continue;
149 }
150 std::unique_ptr<Trk::TrackParameters> extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf);
151 if (extrapResult &&
152 extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
153 vertexPerigee.reset(static_cast<Trk::Perigee*>(extrapResult.release()));
154 }
155 break;
156 }
157 }
158 }
159 if (!vertexPerigee) {
160 const Trk::Perigee* trackPerigee = track.perigeeParameters();
161 if (trackPerigee && trackPerigee->associatedSurface() == persf) {
162 ATH_MSG_DEBUG("Perigee of Track is already expressed to given vertex, a "
163 "copy is returned.");
164 vertexPerigee.reset(trackPerigee->clone());
165 } else {
167 "Extrapolation to Beamline Perigee failed, NULL pointer is returned.");
168 }
169 }
170 return (vertexPerigee);
171}
#define ATH_MSG_DEBUG(x)
const Trk::RecVertex & beamVtx() const noexcept
bool startAtOriginalPerigee(const Trk::Track &track) const
static const Amg::Vector3D s_origin
static origin
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
virtual const S & associatedSurface() const override final
Access to the Surface method.
const Amg::Vector3D & position() const
return position of vertex
Definition Vertex.cxx:63
Eigen::Translation< double, 3 > Translation3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ perigeeAtVertex() [1/3]

std::unique_ptr< Trk::Perigee > TrackToVertex::perigeeAtVertex ( const EventContext & ctx,
const Trk::Track & trk,
const Amg::Vector3D & gp ) const
finaloverridevirtual

Interface method for use with Track and given vertex position - ESD.

Definition at line 76 of file TrackToVertex.cxx.

78 {
79
80 Trk::PerigeeSurface persf(gp);
81 std::unique_ptr<Trk::Perigee> vertexPerigee;
82 std::unique_ptr<Trk::TrackParameters> extrapResult =
84 ? m_extrapolator->extrapolateTrack(ctx,track, persf)
85 : m_extrapolator->extrapolate(ctx, *(track.perigeeParameters()), persf);
86 if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
87 vertexPerigee.reset( static_cast<Trk::Perigee*>(extrapResult.release()));
88 }
89 if (!vertexPerigee) {
90 const Trk::Perigee* trackPerigee = track.perigeeParameters();
91 if (trackPerigee && trackPerigee->associatedSurface() == persf) {
92 ATH_MSG_DEBUG("Perigee of Track is already expressed to given vertex, a "
93 "copy is returned.");
94 vertexPerigee.reset(trackPerigee->clone());
95 } else{
97 "Extrapolation to Perigee failed, NULL pointer is returned.");
98 }
99 }
100 return (vertexPerigee);
101}

◆ perigeeAtVertex() [2/3]

std::unique_ptr< Trk::Perigee > TrackToVertex::perigeeAtVertex ( const EventContext & ctx,
const xAOD::TrackParticle & tp ) const
finaloverridevirtual

Interface method for use with TrackParticle and default primary vertex from TrackParticle - xAOD.

Definition at line 45 of file TrackToVertex.cxx.

46 {
47 return perigeeAtVertex(ctx, tp, Amg::Vector3D(tp.vx(), tp.vy(), tp.vz()));
48}
virtual std::unique_ptr< Trk::Perigee > perigeeAtVertex(const EventContext &ctx, const xAOD::TrackParticle &tp, const Amg::Vector3D &gp) const override final
Interface method for use with xAOD::Trackparticle and given vertex position.

◆ perigeeAtVertex() [3/3]

std::unique_ptr< Trk::Perigee > TrackToVertex::perigeeAtVertex ( const EventContext & ctx,
const xAOD::TrackParticle & tp,
const Amg::Vector3D & gp ) const
finaloverridevirtual

Interface method for use with xAOD::Trackparticle and given vertex position.

Definition at line 50 of file TrackToVertex.cxx.

52 {
53
54 // preparation
55 Trk::PerigeeSurface persf(gp);
56 std::unique_ptr<Trk::Perigee> vertexPerigee;
57 // retrieve the Perigee from the track particle
58 const Trk::Perigee& trackparPerigee = tp.perigeeParameters();
59 if (trackparPerigee.associatedSurface() == persf) {
60 ATH_MSG_DEBUG("Perigee of TrackParticle is already expressed to given "
61 "vertex, a copy is returned.");
62 return std::unique_ptr<Trk::Perigee>(trackparPerigee.clone());
63 } else {
64 std::unique_ptr<Trk::TrackParameters> extrapResult =
65 m_extrapolator->extrapolateDirectly(ctx,trackparPerigee, persf);
66 if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
67 vertexPerigee.reset(static_cast<Trk::Perigee*>(extrapResult.release()));
68 }
69 }
70 if (!vertexPerigee)
72 "Extrapolation to Perigee failed, a NULL pointer is returned.");
73 return vertexPerigee;
74}

◆ startAtOriginalPerigee()

bool Reco::TrackToVertex::startAtOriginalPerigee ( const Trk::Track & track) const
inlineprivate

Definition at line 104 of file TrackToVertex.h.

104 {
105 return m_startTRTSAAtPerigee.value() &&
106 track.info().patternRecognition().test(
108 track.perigeeParameters();
109 }
Gaudi::Property< bool > m_startTRTSAAtPerigee

◆ trackAtBeamline() [1/3]

std::unique_ptr< Trk::TrackParameters > TrackToVertex::trackAtBeamline ( const EventContext & ctx,
const Trk::Track & trk,
const Trk::StraightLineSurface * beamline ) const
finaloverridevirtual

Interface method for use with Track and the beamline from the BeamSpotSvc - ESD.

Definition at line 206 of file TrackToVertex.cxx.

208 {
209
210 return !startAtOriginalPerigee(trk)
211 ? m_extrapolator->extrapolateTrack(ctx, trk, *beamline)
212 : m_extrapolator->extrapolate(ctx,*(trk.perigeeParameters()), *beamline);
213}
const Perigee * perigeeParameters() const
return Perigee.

◆ trackAtBeamline() [2/3]

std::unique_ptr< Trk::TrackParameters > TrackToVertex::trackAtBeamline ( const EventContext & ctx,
const Trk::TrackParameters & tpars,
const Trk::StraightLineSurface * beamline ) const
finaloverridevirtual

Interface method for use with Track and the beamline from the BeamSpotSvc - TrackParameters.

Definition at line 215 of file TrackToVertex.cxx.

217 {
218 return m_extrapolator->extrapolate(ctx, tpars, *beamline);
219}

◆ trackAtBeamline() [3/3]

std::unique_ptr< Trk::TrackParameters > TrackToVertex::trackAtBeamline ( const EventContext & ctx,
const xAOD::TrackParticle & tp,
const InDet::BeamSpotData * beamspotptr ) const
finaloverridevirtual

Interface method for use with TrackParticle and the beamline from the BeamSpotSvc - xAOD.

Definition at line 173 of file TrackToVertex.cxx.

175 {
176
177 Amg::Vector3D beamspot(s_origin);
178 float tiltx = 0.0;
179 float tilty = 0.0;
180 if (beamspotptr) {
181 beamspot = Amg::Vector3D(beamspotptr->beamVtx().position());
182 tiltx = beamspotptr->beamTilt(0);
183 tilty = beamspotptr->beamTilt(1);
184 }
185 Amg::Transform3D amgTransf;
186 Amg::Translation3D amgtranslation(beamspot);
187 amgTransf = amgtranslation * Amg::RotationMatrix3D::Identity();
188 amgTransf *= Amg::AngleAxis3D(tilty, Amg::Vector3D(0.,1.,0.));
189 amgTransf *= Amg::AngleAxis3D(tiltx, Amg::Vector3D(1.,0.,0.));
190 // preparation
191 Trk::PerigeeSurface persf(amgTransf);
192 std::unique_ptr<Trk::TrackParameters> vertexPerigee;
193 // retrieve the Perigee from the track particle
194 const Trk::Perigee& trackparPerigee = tp.perigeeParameters();
195 if ( trackparPerigee.associatedSurface() == persf) {
196 ATH_MSG_DEBUG("Perigee of TrackParticle is already expressed to given vertex, a copy is returned.");
197 return std::unique_ptr<Trk::TrackParameters>(trackparPerigee.clone());
198 } else
199 vertexPerigee = m_extrapolator->extrapolateDirectly(ctx,trackparPerigee, persf);
200 if (!vertexPerigee){
201 ATH_MSG_DEBUG("Extrapolation to Beam Line failed, a NULL pointer is returned.");
202 }
203 return vertexPerigee;
204}

Member Data Documentation

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> Reco::TrackToVertex::m_extrapolator
private
Initial value:
{
this, "Extrapolator",
"Trk::Extrapolator/AtlasExtrapolator"}

ToolHandle for Extrapolator.

Definition at line 111 of file TrackToVertex.h.

111 {
112 this, "Extrapolator",
113 "Trk::Extrapolator/AtlasExtrapolator"};

◆ m_startTRTSAAtPerigee

Gaudi::Property<bool> Reco::TrackToVertex::m_startTRTSAAtPerigee
private
Initial value:
{
this, "StartTRTStandaloneTracksAtOriginalPerigee", false,
"When extrapolating TRT standalone start at their original perigee "
"which may have a more realistic covariance"}

Definition at line 115 of file TrackToVertex.h.

115 {
116 this, "StartTRTStandaloneTracksAtOriginalPerigee", false,
117 "When extrapolating TRT standalone start at their original perigee "
118 "which may have a more realistic covariance"};

◆ s_origin

const Amg::Vector3D TrackToVertex::s_origin
staticprivate

static origin

Definition at line 120 of file TrackToVertex.h.


The documentation for this class was generated from the following files: