33 return StatusCode::FAILURE;
39 return StatusCode::FAILURE;
46 return StatusCode::FAILURE;
49 return StatusCode::SUCCESS;
57 return estimate(&(
track->perigeeParameters()),&(
track->perigeeParameters()),vtx,doRemoval);
59 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
70 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
83 ATH_MSG_INFO(
"Empty TrackParticle or Vertex pointer passed. Returning zero " );
94 ATH_MSG_WARNING(
"Vertex is zero pointer. Will not estimate IP of track.");
102 if (newVertex ==
nullptr) {
103 ATH_MSG_WARNING(
"Unbiasing of vertex failed. Will not estimate IP of track.");
108 std::unique_ptr<ImpactParametersAndSigma> IPandSigma=
calculate(newtrack,*newVertex);
132 ->extrapolate(Gaudi::Hive::currentContext(), *
track, perigeeSurface)
134 if (extrapolatedParameters && extrapolatedParameters->covariance()) {
137 const AmgVector(5) &
par = extrapolatedParameters->parameters();
143 AmgSymMatrix(2) vrtXYCov = vtx.covariancePosition().block<2,2>(0,0);
145 const AmgSymMatrix(5) & perigeeCov = *(extrapolatedParameters->covariance());
152 auto newIPandSigma=std::make_unique<ImpactParametersAndSigma>();
153 newIPandSigma->IPd0=
d0;
154 double d0_PVcontrib=d0JacXY.transpose()*(vrtXYCov*d0JacXY);
157 newIPandSigma->sigmad0=sqrt(d0_PVcontrib+perigeeCov(
Trk::d0,
Trk::d0));
158 newIPandSigma->PVsigmad0=sqrt(d0_PVcontrib);
162 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;
164 newIPandSigma->PVsigmad0=0;
173 double vrtZZCov = vtx.covariancePosition()(
Trk::z,
Trk::z);
179 newIPandSigma->sigmaz0SinTheta=
180 sqrt(IPz0JacZ0Theta.transpose()*(covPerigeeZ0Theta*IPz0JacZ0Theta)+
sin(
theta)*vrtZZCov*
sin(
theta));
182 newIPandSigma->IPz0 =
z0;
183 newIPandSigma->sigmaz0 = std::sqrt( vrtZZCov + perigeeCov(
Trk::z0,
Trk::z0) );
184 newIPandSigma->PVsigmaz0 = std::sqrt( vrtZZCov );
188 ATH_MSG_WARNING(
" The contribution to z0_err: " << vrtZZCov <<
" from PV is negative: critical error in PV error matrix! Removing contribution from PV ... ");
190 double temp = (IPz0JacZ0Theta.transpose()*(covPerigeeZ0Theta*IPz0JacZ0Theta));
191 newIPandSigma->sigmaz0SinTheta=sqrt(
temp);
192 newIPandSigma->PVsigmaz0SinTheta=0;
194 newIPandSigma->IPz0 =
z0;
195 newIPandSigma->sigmaz0 = std::sqrt( perigeeCov(
Trk::z0,
Trk::z0) );
196 newIPandSigma->PVsigmaz0 = 0;
200 delete extrapolatedParameters;
201 return newIPandSigma;
203 ATH_MSG_DEBUG (
"Cannot extrapolate the trajectory state. Returning null. ");
214 const CLHEP::Hep3Vector & jetMomentum,
217 Amg::Vector3D eigenJetMomentum(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
228 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
230 Gaudi::Hive::currentContext(),
track, perigeeSurface);
232 if (!extrapolatedParameters)
return 0.;
238 double sign=(jetMomentum.cross(trackMom)).
dot(trackMom.cross(primaryPos-trackPos));
240 return sign>=0.?1.:-1;
246 const CLHEP::Hep3Vector & jetMomentum,
249 Amg::Vector3D eigenJetMomentum(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
260 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
262 Gaudi::Hive::currentContext(),
track, perigeeSurface);
264 if (!extrapolatedParameters)
return 0.;
266 double trackD0 = extrapolatedParameters->parameters()[
Trk::d0];
268 double vs = sinf( atan2(jetMomentum.y(),jetMomentum.x()) -
trackPhi )*trackD0;
270 return (vs>=0. ? 1. : -1.);
277 const CLHEP::Hep3Vector & jetMomentum,
280 Amg::Vector3D eigenJetMomentum(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
292 std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
294 Gaudi::Hive::currentContext(),
track, perigeeSurface);
296 if (!extrapolatedParameters)
return 0.;
298 double trackTheta = extrapolatedParameters->parameters()[
Trk::theta];
299 double trackZ0 = extrapolatedParameters->parameters()[
Trk::z0];
300 double trackEta = -logf(tanf(trackTheta/2.));
301 double jetEta = jetMomentum.eta();
302 double zs = (jetEta -
trackEta)*trackZ0;
303 return (zs>=0. ? 1. : -1.);
315 msg(MSG::INFO) <<
"Empty xAOD::TrackParticle pointer passed. Returning zero " <<
endmsg;
323 msg(MSG::INFO) <<
"Empty Trk::TrackParameter pointer passed. Returning zero " <<
endmsg;
327 msg(MSG::INFO) <<
"Empty xAOD::Vertex pointer passed. Returning zero " <<
endmsg;
333 ATH_MSG_DEBUG(
"This vertex has no associated tracks. Normal if beam spot is used. Vertex already unbiased");
342 bool tmpLinTrack =
false;
349 if ((testTP.position() ==
pos) and (testTP.momentum() ==
mom)) {
352 double trackWeight(0.0);
365 ATH_MSG_INFO(
"Failing to linearized track. Returning biased vertex.");
379 double trk_chi =
m_Updator->trackParametersChi2( reducedVertex, linTrack );
380 chi2 += -1 * (
m_Updator->vertexPositionChi2(*vtx, reducedVertex) + trackWeight * trk_chi);
384 ndf += -1 * trackWeight * (2.0);
393 if (tmpLinTrack)
delete linTrack;