ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
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. More...
 
virtual ~TrackToVertex ()=default
 Virtual destructor. More...
 
virtual StatusCode initialize () override final
 AlgTool initailize method. More...
 
virtual std::unique_ptr< Trk::StraightLineSurfaceGetBeamLine (const InDet::BeamSpotData *) const override final
 Use this for MT Coding. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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
More...
 

Private Member Functions

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

Private Attributes

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

Static Private Attributes

static const Amg::Vector3D s_origin
 static origin More...
 

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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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  }

◆ 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 }

◆ 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.

◆ 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.

◆ 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:
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Reco::TrackToVertex::m_startTRTSAAtPerigee
Gaudi::Property< bool > m_startTRTSAAtPerigee
Definition: TrackToVertex.h:115
Trk::ParametersBase::surfaceType
constexpr virtual SurfaceType surfaceType() const override=0
Returns the Surface Type enum for the surface used to define the derived class.
ParticleTest.tp
tp
Definition: ParticleTest.py:25
Reco::TrackToVertex::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle for Extrapolator.
Definition: TrackToVertex.h:111
InDet::BeamSpotData::beamVtx
const Trk::RecVertex & beamVtx() const noexcept
Definition: BeamSpotData.h:79
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Reco::TrackToVertex::startAtOriginalPerigee
bool startAtOriginalPerigee(const Trk::Track &track) const
Definition: TrackToVertex.h:104
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
Reco::TrackToVertex::s_origin
static const Amg::Vector3D s_origin
static origin
Definition: TrackToVertex.h:120
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
beamspotman.n
n
Definition: beamspotman.py:729
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
InDet::BeamSpotData::beamPos
const Amg::Vector3D & beamPos() const noexcept
Definition: BeamSpotData.h:68
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Trk::SurfaceType::Perigee
@ Perigee
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Reco::TrackToVertex::perigeeAtVertex
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.
Definition: TrackToVertex.cxx:50
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition: GeoPrimitives.h:44
Amg::AngleAxis3D
Eigen::AngleAxisd AngleAxis3D
Definition: GeoPrimitives.h:45
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
Trk::ParametersT::clone
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
InDet::BeamSpotData::beamTilt
float beamTilt(int i) const noexcept
Returns the beam sigma for the i+3-th error matrix element (the 'tilt')
Definition: BeamSpotData.h:74
Trk::TrackInfo::TRTStandalone
@ TRTStandalone
TRT Standalone.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:162