This method is a factory, so the client has to take care of management/deletion of the SCT_ClusterOnTrack.
83 {
84 const InDet::SCT_Cluster *cluster = nullptr;
85
86 if (!(cluster = dynamic_cast<const InDet::SCT_Cluster *> (&rio))) {
87 ATH_MSG_WARNING(
"Attempt to correct RIO which is not SCT_Cluster with ITk::StripClusterOnTrackTool: returning nullptr");
88 return nullptr;
89 }
90
91 ATH_MSG_VERBOSE(
"STARTING CLUSTER ON TRACK CORRECTION... " << __func__ <<
" " << __LINE__);
97
98
99
100 const InDetDD::SiDetectorElement *detectorElement = cluster->
detectorElement();
101 if (!detectorElement) {
102 return nullptr;
103 }
104
105
106
109 double cosAlpha = std::sqrt(1 - sinAlpha * sinAlpha);
111 ATH_MSG_VERBOSE(
"STRIP DIRECTION = " << localstripdir[0] <<
", " << localstripdir[1]);
113
114
115
117
119 ATH_MSG_VERBOSE(
"TRACK PAR LOCAL POS = " << loct[0] <<
", " << loct[1]);
121
122
123 double phiPitchInRad = 0.;
124
125
127
128
130 double boundsy = (static_cast<const Trk::RectangleBounds *>(bounds))->halflengthY();
131 ATH_MSG_VERBOSE(
"BARREL ====>>>> DISTANCE*COSALPHA / HALF LENGTH --> " << distance*cosAlpha <<
" / " << boundsy);
132
133
134
135 if (distance*cosAlpha > boundsy){
136 ATH_MSG_VERBOSE(
"DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM");
138
139 if (loct.y() < 0)
141 }
142 } else {
143
144
145
146 const InDetDD::StripStereoAnnulusDesign * design =
147 static_cast<const InDetDD::StripStereoAnnulusDesign *
> (&detectorElement->
design());
149 double striphalflength = design->
stripLength(siCellId) / 2.0;
150 ATH_MSG_VERBOSE(
"ENDCAP ====>>>> DISTANCE / STRIP HALF LENGTH --> " << distance <<
" / " << striphalflength);
151
153
154
155
156 if (distance > striphalflength) {
157 ATH_MSG_VERBOSE(
"DISTANCE TO LARGE COMPARED TO BOUNDS, SETTING TO MAXIMUM");
159 }
160 }
161
163
164
169 const InDet::SiWidth
width = cluster->
width();
171 case 0:
172
175 break;
176
177 default:
178
179 break;
180 }
181
184
185
186 if (not detectorElement->
isBarrel()) {
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
206 double sinAlpha2 = sinAlpha * sinAlpha;
207 double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha);;
210 double v1 =
mat(1, 1);
211 mat(0, 0) = (cosAlpha2 *
v0 + sinAlpha2 * v1);
212 mat(1, 0) = (sinAlpha * std::sqrt(cosAlpha2) * (
v0 - v1));
214 mat(1, 1) = (sinAlpha2 *
v0 + cosAlpha2 * v1);
215
217 ATH_MSG_VERBOSE(
"sinAlpha / sinAlpha2 / cosAlpha2 / weight = " << sinAlpha <<
" / " << sinAlpha2 <<
" / " << cosAlpha2 <<
" / " << weight);
221
222 }
223
225 }
226
227 Trk::LocalParameters localParameters;
230
231
234 localParameters = Trk::LocalParameters(lpos1dim);
236 covariance(0, 0) = prevCov(0, 0);
237
241 ->getScaledCovariance(std::move(covariance), false, 0.0);
242 }
243 } else {
244 localParameters = Trk::LocalParameters(cluster->
localPosition());
245
249 ->getScaledCovariance(std::move(covariance), true,
251 }
252
253
254
255
256
258 double sinAlpha2 = sinAlpha * sinAlpha;
259 double cosAlpha2 = (1. - sinAlpha) * (1. + sinAlpha);
260 double sinAlphaCosAlpha = sinAlpha * std::sqrt(cosAlpha2);
261
262
263 double radiusAtLocPos = std::hypot(loct.x(), loct.y());
264 double phiPitchAtLocPos = phiPitchInRad*radiusAtLocPos;
266
267
268 double dV0 = (cosAlpha2 * covariance(0, 0) + sinAlpha2 * covariance(1, 1) +
269 2. * sinAlphaCosAlpha * covariance(1, 0)) * (weight * weight - 1.);
270
271
272
273
274
275
276
277
278
279
280
281
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);
286
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.) << " = "
293 << dV0);
294 ATH_MSG_VERBOSE(
"SCALED CLUSTER COVARIANCE = " << covariance(0, 0) <<
", "
295 << covariance(0, 1));
297 }
298
300 return new InDet::SCT_ClusterOnTrack(cluster, std::move(localParameters), std::move(covariance),
301 detectorElement->
identifyHash(), globalPosition, isbroad);
302}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
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
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
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
constexpr double ONE_TWELFTH
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
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...
const T_res * ErrorScalingCast(const T_src *src)