23using CLHEP::micrometer;
31 (
const std::string &t,
const std::string &n,
const IInterface *p) :
33 declareInterface<IRIO_OnTrackCreator>(
this);
42 StatusCode
sc = AlgTool::initialize();
52 default:
ATH_MSG_ERROR(
" -- NO, UNKNOWN. Pls check jobOptions!");
53 return StatusCode::FAILURE;
55 ATH_MSG_DEBUG(
" will be applied during ITkStripClusterOnTrack making");
59 case -1:
ATH_MSG_DEBUG(
"keep the global position as evaluated");
62 default:
ATH_MSG_ERROR(
" -- NO, UNKNOWN. Pls check jobOptions!");
63 return StatusCode::FAILURE;
65 ATH_MSG_DEBUG(
" will be applied during ITkStripClusterOnTrack making");
87 ATH_MSG_WARNING(
"Attempt to correct RIO which is not SCT_Cluster with ITk::StripClusterOnTrackTool: returning nullptr");
91 ATH_MSG_VERBOSE(
"STARTING CLUSTER ON TRACK CORRECTION... " << __func__ <<
" " << __LINE__);
101 if (!detectorElement) {
109 double cosAlpha = std::sqrt(1 - sinAlpha * sinAlpha);
111 ATH_MSG_VERBOSE(
"STRIP DIRECTION = " << localstripdir[0] <<
", " << localstripdir[1]);
119 ATH_MSG_VERBOSE(
"TRACK PAR LOCAL POS = " << loct[0] <<
", " << loct[1]);
123 double phiPitchInRad = 0.;
131 ATH_MSG_VERBOSE(
"BARREL ====>>>> DISTANCE*COSALPHA / HALF LENGTH --> " << distance*cosAlpha <<
" / " << boundsy);
135 if (distance*cosAlpha > boundsy){
136 ATH_MSG_VERBOSE(
"DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM");
137 distance = boundsy/cosAlpha - 1.;
140 distance = -distance;
149 double striphalflength = design->
stripLength(siCellId) / 2.0;
150 ATH_MSG_VERBOSE(
"ENDCAP ====>>>> DISTANCE / STRIP HALF LENGTH --> " << distance <<
" / " << striphalflength);
156 if (distance > striphalflength) {
157 ATH_MSG_VERBOSE(
"DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM");
158 distance = striphalflength - 1.;
165 constexpr double ONE_TWELFTH= 1.0/12.;
173 mat(0, 0) = std::pow(
width.phiR(), 2) * ONE_TWELFTH;
174 mat(1, 1) = std::pow(
width.z(), 2) * ONE_TWELFTH;
182 ATH_MSG_VERBOSE(
"CLUSTER ON TRACK COVARIANCE = " << mat(0, 0) <<
", " << mat(0, 1) );
186 if (not detectorElement->
isBarrel()) {
206 double sinAlpha2 = sinAlpha * sinAlpha;
207 double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha);;
209 double v0 = mat(0, 0) * weight * weight;
210 double v1 = mat(1, 1);
211 mat(0, 0) = (cosAlpha2 * v0 + sinAlpha2 * v1);
212 mat(1, 0) = (sinAlpha * std::sqrt(cosAlpha2) * (v0 - v1));
213 mat(0, 1) = mat(1, 0);
214 mat(1, 1) = (sinAlpha2 * v0 + cosAlpha2 * v1);
217 ATH_MSG_VERBOSE(
"sinAlpha / sinAlpha2 / cosAlpha2 / weight = " << sinAlpha <<
" / " << sinAlpha2 <<
" / " << cosAlpha2 <<
" / " << weight);
219 ATH_MSG_VERBOSE(
"ROTATED CLUSTER COVARIANCE = " << mat(0, 0) <<
", " << mat(0, 1) );
236 covariance(0, 0) = prevCov(0, 0);
241 ->getScaledCovariance(std::move(covariance),
false, 0.0);
249 ->getScaledCovariance(std::move(covariance),
true,
258 double sinAlpha2 = sinAlpha * sinAlpha;
259 double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha);
260 double sinAlphaCosAlpha = sinAlpha * std::sqrt(cosAlpha2);
263 double radiusAtLocPos = std::hypot(loct.x(), loct.y());
264 double phiPitchAtLocPos = phiPitchInRad*radiusAtLocPos;
265 double weight = phiPitchAtLocPos / detectorElement->
phiPitch();
268 double dV0 = (cosAlpha2 * covariance(0, 0) + sinAlpha2 * covariance(1, 1) +
269 2. * sinAlphaCosAlpha * covariance(1, 0)) * (weight * weight - 1.);
282 covariance(0, 0) += (cosAlpha2 * dV0);
283 covariance(1, 0) += (sinAlphaCosAlpha * dV0);
284 covariance(0, 1) = covariance(1, 0);
285 covariance(1, 1) += (sinAlpha2 * dV0);
288 ATH_MSG_VERBOSE(
"sinAlpha / sinAlpha2 / cosAlpha2 / weight = " << sinAlpha <<
" / " << sinAlpha2 <<
" / " << cosAlpha2 <<
" / " << weight );
290 << sinAlpha2 * covariance(1, 1) <<
" + "
291 << 2. * sinAlphaCosAlpha * covariance(1, 0)
292 <<
" ) * " << (weight * weight - 1.) <<
" = "
294 ATH_MSG_VERBOSE(
"SCALED CLUSTER COVARIANCE = " << covariance(0, 0) <<
", "
295 << covariance(0, 1));
301 detectorElement->
identifyHash(), globalPosition, isbroad);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Identifier for the strip or pixel cell.
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
double phiPitch() const
Pitch (inline methods)
double sinStereoLocal(const Amg::Vector2D &localPos) const
Angle of strip in local frame with respect to the etaAxis.
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
double stripLength(const SiCellId &cellId) const
virtual int diodesInRow(const int row) const override
Specific class to represent the SCT measurements.
const Amg::Vector3D & globalPosition() const
return global position reference
const InDet::SiWidth & width() const
return width class reference
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Amg::Vector2D localPosition() const
Access method for the local coordinates, local parameter definitions differ for each surface type.
const Amg::Vector2D & localPosition() const
return the local position reference
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Bounds for a rectangular, planar surface.
Abstract base class for surface bounds to be specified.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
std::pair< double, ParamDefs > DefinedParameter
Typedef to of a std::pair<double, ParamDefs> to identify a passed-through double as a specific type o...
ParametersBase< TrackParametersDim, Charged > TrackParameters
const T_res * ErrorScalingCast(const T_src *src)