32 ATH_MSG_DEBUG(
"Extrapolator is None/Empty. Tool-dependent features will be disabled.");
37 return StatusCode::FAILURE;
43 return StatusCode::FAILURE;
50 return StatusCode::FAILURE;
53 return StatusCode::SUCCESS;
61 return estimate(ctx, &(track->perigeeParameters()),&(track->perigeeParameters()),vtx,doRemoval);
63 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
74 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
83 const EventContext &ctx,
87 return estimate(ctx, track,track,vtx,doRemoval);
89 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
96 const EventContext &ctx,
102 ATH_MSG_WARNING(
"Vertex is zero pointer. Will not estimate IP of track.");
110 if (newVertex ==
nullptr) {
111 ATH_MSG_WARNING(
"Unbiasing of vertex failed. Will not estimate IP of track.");
116 std::unique_ptr<ImpactParametersAndSigma> IPandSigma=
calculate(ctx, newtrack,*newVertex);
140 ->extrapolate(ctx, *track, perigeeSurface)
142 if (extrapolatedParameters && extrapolatedParameters->covariance()) {
145 const AmgVector(5) & par = extrapolatedParameters->parameters();
151 AmgSymMatrix(2) vrtXYCov = vtx.covariancePosition().block<2,2>(0,0);
153 const AmgSymMatrix(5) & perigeeCov = *(extrapolatedParameters->covariance());
160 auto newIPandSigma=std::make_unique<ImpactParametersAndSigma>();
161 newIPandSigma->IPd0=
d0;
162 double d0_PVcontrib=d0JacXY.transpose()*(vrtXYCov*d0JacXY);
165 newIPandSigma->sigmad0=sqrt(d0_PVcontrib+perigeeCov(
Trk::d0,
Trk::d0));
166 newIPandSigma->PVsigmad0=sqrt(d0_PVcontrib);
170 msg(MSG::WARNING) <<
" The contribution to d0_err: " << d0_PVcontrib <<
" from PV is negative: critical error in PV error matrix! Removing contribution from PV ... " <<
endmsg;
172 newIPandSigma->PVsigmad0=0;
181 double vrtZZCov = vtx.covariancePosition()(
Trk::z,
Trk::z);
186 newIPandSigma->IPz0SinTheta=
z0*sin(
theta);
187 newIPandSigma->sigmaz0SinTheta=
188 sqrt(IPz0JacZ0Theta.transpose()*(covPerigeeZ0Theta*IPz0JacZ0Theta)+sin(
theta)*vrtZZCov*sin(
theta));
189 newIPandSigma->PVsigmaz0SinTheta=sqrt(sin(
theta)*vrtZZCov*sin(
theta));
190 newIPandSigma->IPz0 =
z0;
191 newIPandSigma->sigmaz0 = std::sqrt( vrtZZCov + perigeeCov(
Trk::z0,
Trk::z0) );
192 newIPandSigma->PVsigmaz0 = std::sqrt( vrtZZCov );
196 ATH_MSG_WARNING(
" The contribution to z0_err: " << vrtZZCov <<
" from PV is negative: critical error in PV error matrix! Removing contribution from PV ... ");
197 newIPandSigma->IPz0SinTheta=
z0*sin(
theta);
198 double temp = (IPz0JacZ0Theta.transpose()*(covPerigeeZ0Theta*IPz0JacZ0Theta));
199 newIPandSigma->sigmaz0SinTheta=sqrt(
temp);
200 newIPandSigma->PVsigmaz0SinTheta=0;
202 newIPandSigma->IPz0 =
z0;
203 newIPandSigma->sigmaz0 = std::sqrt( perigeeCov(
Trk::z0,
Trk::z0) );
204 newIPandSigma->PVsigmaz0 = 0;
208 delete extrapolatedParameters;
209 return newIPandSigma;
211 ATH_MSG_DEBUG (
"Cannot extrapolate the trajectory state. Returning null. ");
225 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
227 ctx, track, perigeeSurface);
229 if (!extrapolatedParameters)
return 0.;
232 const Amg::Vector3D & trackPos=extrapolatedParameters->position();
233 const Amg::Vector3D & trackMom=extrapolatedParameters->momentum();
235 double sign=(jetMomentum.cross(trackMom)).dot(trackMom.cross(primaryPos-trackPos));
237 return sign>=0.?1.:-1;
248 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
250 ctx, track, perigeeSurface);
252 if (!extrapolatedParameters)
return 0.;
254 double trackD0 = extrapolatedParameters->parameters()[
Trk::d0];
255 double trackPhi = extrapolatedParameters->parameters()[
Trk::phi];
256 double vs = sinf( atan2(jetMomentum.y(),jetMomentum.x()) - trackPhi )*trackD0;
258 return (vs>=0. ? 1. : -1.);
271 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
273 ctx, track, perigeeSurface);
275 if (!extrapolatedParameters)
return 0.;
277 double trackTheta = extrapolatedParameters->parameters()[
Trk::theta];
278 double trackZ0 = extrapolatedParameters->parameters()[
Trk::z0];
279 double trackEta = -logf(tanf(trackTheta/2.));
280 double jetEta = jetMomentum.eta();
281 double zs = (jetEta - trackEta)*trackZ0;
282 return (zs>=0. ? 1. : -1.);
294 msg(MSG::INFO) <<
"Empty xAOD::TrackParticle pointer passed. Returning zero " <<
endmsg;
302 msg(MSG::INFO) <<
"Empty Trk::TrackParameter pointer passed. Returning zero " <<
endmsg;
306 msg(MSG::INFO) <<
"Empty xAOD::Vertex pointer passed. Returning zero " <<
endmsg;
312 ATH_MSG_DEBUG(
"This vertex has no associated tracks. Normal if beam spot is used. Vertex already unbiased");
321 bool tmpLinTrack =
false;
331 double trackWeight(0.0);
344 ATH_MSG_INFO(
"Failing to linearized track. Returning biased vertex.");
358 double trk_chi =
m_Updator->trackParametersChi2( reducedVertex, linTrack );
359 chi2 += -1 * (
m_Updator->vertexPositionChi2(*vtx, reducedVertex) + trackWeight * trk_chi);
363 ndf += -1 * trackWeight * (2.0);
372 if (tmpLinTrack)
delete linTrack;
393 return estimate(ctx, &(track->perigeeParameters()), vtx);
400 const EventContext &ctx,
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Class describing the Line to which the Perigee refers to.
~TrackToVertexIPEstimator()
ToolHandle< Trk::IVertexUpdator > m_Updator
virtual StatusCode initialize() override
Default Athena interface methods.
virtual double get2DLifetimeSignOfTrack(const EventContext &ctx, const TrackParameters &track, const Amg::Vector3D &jetDirection, const xAOD::Vertex &primaryVertex) const override
virtual xAOD::Vertex * getUnbiasedVertex(const xAOD::TrackParticle *track, const xAOD::Vertex *vtx) const override
virtual std::unique_ptr< ImpactParametersAndSigma > estimate(const EventContext &ctx, const xAOD::TrackParticle *track, const xAOD::Vertex *vtx, bool doRemoval) const override
Estimate methods returning a d0 and its calculated sigma.
ToolHandle< Trk::IExtrapolator > m_extrapolator
TrackToVertexIPEstimator(const std::string &t, const std::string &n, const IInterface *p)
Default Athena interface constructor and destructor.
ToolHandle< Trk::IVertexLinearizedTrackFactory > m_linFactory
virtual double get3DLifetimeSignOfTrack(const EventContext &ctx, const TrackParameters &track, const Amg::Vector3D &jetDirection, const xAOD::Vertex &primaryVertex) const override
virtual double getZLifetimeSignOfTrack(const EventContext &ctx, const TrackParameters &track, const Amg::Vector3D &jetDirection, const xAOD::Vertex &primaryVertex) const override
std::unique_ptr< ImpactParametersAndSigma > calculate(const EventContext &ctx, const TrackParameters *track, const xAOD::Vertex &vtx) const
A method calculating the do and its error.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
void clearTracks()
Remove all tracks from the vertex.
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
void addTrackAtVertex(const ElementLink< TrackParticleContainer > &tr, float weight=1.0)
Add a new track to the vertex.
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
float chiSquared() const
Returns the of the vertex fit as float.
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
const Amg::Vector3D & position() const
Returns the 3-pos.
float trackWeight(size_t i) const
Get the weight of a given track in the vertex reconstruction.
double chi2(TH1 *h0, TH1 *h1)
static std::string release
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ z
global position (cartesian)
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.