32 declareProperty(
"Extrapolator",m_extrapolator);
33 declareProperty(
"MaxIterations",m_maxiterations);
34 declareProperty(
"Precision",m_precision);
49 return StatusCode::SUCCESS;
55 return StatusCode::SUCCESS;
60 std::unique_ptr<PlaneSurface>
65 const Amg::Vector3D momentumUnit = thePerigee->momentum().unit();
66 double pathLength = ( *theVertex - thePerigee->position() ).
dot( momentumUnit )
67 / ( momentumUnit.dot( momentumUnit )) ;
71 Amg::Vector3D POCA = thePerigee->position() + pathLength * momentumUnit;
81 if ((
DeltaR-DeltaRcorrected).mag()>1
e-4)
93 ATH_MSG_VERBOSE(
"plane to which to extrapolate X " << DeltaRcorrected <<
" Y " << YDir <<
" Z " << momentumUnit);
97 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
98 std::cout <<
"the translation is, directly from Transform3d: " << thePlane->getTranslation() <<
endmsg;
101 return std::make_unique<PlaneSurface>(thePlane);
105 std::unique_ptr<PlaneSurface>
110 ATH_MSG_DEBUG(
"Neutral particle -- propagate like a straight line");
114 std::unique_ptr<PlaneSurface>
123 fieldCondObj->getInitializedCache (fieldCache);
125 double magnFieldVect[3];
127 if(magnFieldVect[2] == 0 ){
128 ATH_MSG_DEBUG(
"Magnetic field in the Z direction is 0 -- propagate like a straight line");
133 if (thePerigee==
nullptr)
136 " ImpactPoint3dEstimator didn't get a Perigee* as ParametersBase*: "
137 "cast not possible. Need to EXTRAPOLATE...");
139 std::unique_ptr<const Trk::TrackParameters>
tmp =
141 Gaudi::Hive::currentContext(), *trackPerigee, perigeeSurface);
145 if (thePerigee ==
nullptr){
150 ATH_MSG_VERBOSE(
" Now running ImpactPoint3dEstimator::Estimate3dIP" );
156 double d0=thePerigee->parameters()[
Trk::d0];
159 double Bz=magnFieldVect[2]*299.792;
166 if (thePerigee!=trackPerigee) {
171 double xc=theVertex->x();
172 double yc=theVertex->y();
173 double zc=theVertex->z();
175 double phiActual=
phi0;
176 double dCosPhiActual=-
std::sin(phiActual);
177 double dSinPhiActual=
std::cos(phiActual);
179 double secderivative=0.;
187 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
188 std::cout << std::setprecision(25) <<
"actual distance before cycle is: " << std::hypot(x0-xc+Rt*dCosPhiActual,
189 y0-yc+Rt*dSinPhiActual,
195 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
196 ATH_MSG_VERBOSE(
"Cycle number: " << ncycle <<
" old phi: " << phiActual );
201 secderivative=Rt*(-(x0-xc)*dCosPhiActual-(y0-yc)*dSinPhiActual+Rt*
cotTheta*
cotTheta);
202 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
208 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
209 std::cout << std::setprecision(25) <<
"deltaphi: " << deltaphi << std::endl;
216 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
218 std::cout << std::setprecision(25) << std::hypot(x0-xc+Rt*dCosPhiActual, y0-yc+Rt*dSinPhiActual,
220 ATH_MSG_VERBOSE(
"actual distance is: " << std::hypot(x0-xc+Rt*dCosPhiActual,
221 y0-yc+Rt*dSinPhiActual,
231 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
245 ATH_MSG_WARNING(
"DeltaR is zero in ImpactPoint3dEstimator::Estimate3dIP, returning nullptr");
255 if ((
DeltaR-DeltaRcorrected).mag()>1
e-4)
266 ATH_MSG_VERBOSE(
"final minimal distance is: " << std::hypot(x0-xc+Rt*dCosPhiActual,
267 y0-yc+Rt*dSinPhiActual,
274 ATH_MSG_VERBOSE(
"plane to which to extrapolate X " << DeltaRcorrected <<
" Y " << YDir <<
" Z " << MomentumDir );
278 #ifdef IMPACTPOINT3DESTIMATOR_DEBUG
279 std::cout <<
"the translation is, directly from Transform3d: " << thePlane.getTranslation() <<
endmsg;
281 return std::make_unique<PlaneSurface>(thePlane);
309 if (!vtxTrack.initialPerigee() && vtxTrack.initialNeutralPerigee())
310 ATH_MSG_WARNING(
"Calling ImpactPoint3dEstimator::IP3dAtaPlane cannot return NeutralAtaPlane" );
311 std::unique_ptr<PlaneSurface> theSurfaceAtIP;
319 ATH_MSG_WARNING(
" ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " <<
err.p );
323 ATH_MSG_WARNING(
" ImpactPoint3dEstimator failed to find minimum distance and returned 0 " );
326 #ifdef ImpactPoint3dAtaPlaneFactory_DEBUG
327 ATH_MSG_VERBOSE(
"Original perigee was: " << *(vtxTrack.initialPerigee()) );
331 Gaudi::Hive::currentContext(),
332 *(vtxTrack.initialPerigee()),
333 *theSurfaceAtIP).release();
337 ATH_MSG_DEBUG(
"TrackParameters ptr returned from extrapolate could not be cast to Trk::AtaPlane* in IP3dAtaPlane(..)");
345 std::unique_ptr<PlaneSurface> theSurfaceAtIP;
354 ATH_MSG_WARNING(
" ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " <<
err.p );
358 ATH_MSG_WARNING(
" ImpactPoint3dEstimator failed to find minimum distance and returned 0 " );
361 #ifdef ImpactPoint3dAtaPlaneFactory_DEBUG
362 ATH_MSG_VERBOSE(
"Original neutral perigee was: " << *initNeutPerigee );
367 std::unique_ptr<const Trk::NeutralParameters>
tmp =
m_extrapolator->extrapolate(*initNeutPerigee,*theSurfaceAtIP);