Transform the space point into the local frame to calculate the propagation time towards the readout
99 {
100
101 const ActsTrk::GeometryContext* gctx{nullptr};
103 return nullptr;
104 }
106 const Amg::Transform3D& locToGlob{spacePoint->msSector()->localToGlobalTransform(*gctx)};
108
109
110
111 Amg::Vector3D calibSpPos = spacePoint->dimension() == 2 ? spPos
112 : spPos +
Amg::intersect<3>(posInChamb, dirInChamb, spPos, chDir).value_or(0) * chDir;
113
117 switch (spacePoint->type()) {
121 posInChamb, dirInChamb).value_or(0) * dirInChamb;
122
123 Amg::Vector3D closestApproach{locToGlob* locClosestApproach};
124 const double timeOfArrival = closestApproach.mag() * c_inv + timeOffset;
125
126 if (
ATH_LIKELY(spacePoint->dimension() == 1)) {
128 MdtCalibInput calibInput{*dc, *gctx};
130 Acts::abs(dirInChamb.phi() - 90._degree) > 1.e-7 );
136 State fitState{State::Valid};
138 if (calibOutput.
status() != Muon::MdtDriftCircleStatus::MdtStatusDriftTime) {
140 <<std::endl<<calibInput<<std::endl<<calibOutput);
141 fitState = State::FailedCalib;
142 cov[Acts::toUnderlying(AxisDefs::etaCov)] = dc->readoutElement()->innerTubeRadius();
143 } else {
145 }
146 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), fitState);
147 calibSP->setCovariance(cov);
148 calibSP->setDriftRadius(calibOutput.
driftRadius());
149 } else {
151 MdtCalibInput calibInput{*dc, *gctx};
154
155 MdtCalibInput twinInput{dc->twinIdentify(), dc->twinAdc(), dc->twinTdc(), dc->readoutElement(), *gctx};
158
160 std::move(calibInput),
161 std::move(twinInput));
162
163 State fitState{State::Valid};
164 if (calibOutput.
primaryStatus() != Muon::MdtDriftCircleStatus::MdtStatusDriftTime) {
166 <<std::endl<<calibOutput);
167 cov[Acts::toUnderlying(AxisDefs::etaCov)] = Acts::square(dc->readoutElement()->innerTubeRadius());
168 cov[Acts::toUnderlying(AxisDefs::phiCov)] = Acts::square(0.5* dc->readoutElement()->activeTubeLength(dc->measurementHash()));
169 fitState = State::FailedCalib;
170 } else {
171 cov[Acts::toUnderlying(AxisDefs::etaCov)] = Acts::square(calibOutput.
uncertPrimaryR());
172 cov[Acts::toUnderlying(AxisDefs::phiCov)] = Acts::square(calibOutput.
sigmaZ());
173 }
174 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), fitState);
175 calibSP->setCovariance(cov);
177 }
178 break;
179 }
182
187 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos));
188
190
191 const double time1 =
strip->time()
192 -
strip->readoutElement()->distanceToEdge(
strip->layerHash(), lPos,
194
195 if (spacePoint->dimension() == 2) {
197
198 const double time2 = strip2->
time() -
199 strip2->readoutElement()->distanceToEdge(strip2->layerHash(),lPos, EdgeSide::readOut)/
m_rpcSignalVelocity;
201 calibSP->setTimeMeasurement(0.5*(time1 + time2));
203 cov[Acts::toUnderlying(AxisDefs::timeCov)] += Acts::square(0.5*(time1 - time2));
204 }
205 calibSP->setCovariance(cov);
207 <<
", at "<<
Amg::toString(calibSP->localPosition())<<
", uncalib time: "
208 <<
strip->time()<<
", calib time: "<<calibSP->time()<<
" cov " <<calibSP->covariance());
209 break;
210 }
212 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos));
213 calibSP->setCovariance(cov);
214 break;
215 }
220
221 std::pair<double, double> calibPosCov {
calibrateMM(ctx, *gctx, *cluster, globalPos, globalDir)};
222
223 ATH_MSG_DEBUG(
"Calibrated pos and cov" << calibPosCov.first <<
" " << calibPosCov.second);
224 cov[Acts::toUnderlying(AxisDefs::etaCov)] = calibPosCov.second;
226
227
228 Amg::Vector3D calibSpPosInLayer = toChamberTrans.inverse() * calibSpPos;
230 calibSpPosInLayer.x() = calibPosCov.first;
232 calibSpPos = toChamberTrans * calibSpPosInLayer;
233
234 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos));
235 calibSP->setCovariance(cov);
237
238 break;
239 }
242
243
246 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos));
247 calibSP->setCovariance(cov);
248 break;
249 }
250
251 std::optional<double> posAlongTheStrip{std::nullopt};
252
253
254 if(spacePoint->secondaryMeasurement()) {
257
258 if (secMeas->numDimensions() == 2) {
259 posAlongTheStrip = static_cast<double>(secMeas->localPosition<2>()[0]);
260 } else {
261 posAlongTheStrip = static_cast<double>(secMeas->localPosition<1>()[0]);
262 }
263 } else {
265 }
266
269
271 const auto [calibPos, calibCov] =
calibratesTGC(ctx, *gctx, *stripClus, posAlongTheStrip, globalPos, globalDir);
272
273 ATH_MSG_DEBUG(
"Calibrated pos and cov" << calibPos <<
" " << calibCov);
274 cov[Acts::toUnderlying(AxisDefs::etaCov)] = calibCov;
276
277
278 Amg::Vector3D calibSpPosInLayer = toChamberTrans.inverse() * calibSpPos;
280 calibSpPosInLayer.x() = calibPos;
282 calibSpPos = toChamberTrans * calibSpPosInLayer;
283
284 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos));
285 calibSP->setCovariance(cov);
287 break;
288 }
289
290 default:
292 }
293 return calibSP;
294 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double driftRadiusUncert() const
Returns the uncertainty on the drift radius.
double driftRadius() const
Returns the drift radius of the calibrated object.
MdtDriftCircleStatus status() const
Status of the calibration.
MdtDriftCircleStatus primaryStatus() const
double primaryDriftR() const
double uncertPrimaryR() const
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &ctx) const
Returns the transformation from the local coordinate system of the readout element into the global AT...
std::pair< double, double > calibratesTGC(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const xAOD::sTgcStripCluster &cluster, std::optional< double > posAlongTheStrip, const Amg::Vector3D &globalPos, const Amg::Vector3D &globalDir) const
Calibrates the position and covariance of an sTGC (small-strip Thin Gap Chamber) cluster.
ToolHandle< IMdtCalibrationTool > m_mdtCalibrationTool
Gaudi::Property< double > m_rpcSignalVelocity
How fast does an electron signal travel along an rpc strip.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
access to the ACTS geometry context
Gaudi::Property< double > m_rpcTimeResolution
std::pair< double, double > calibrateMM(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, const xAOD::MMCluster &cluster, const Amg::Vector3D &globalPos, const Amg::Vector3D &globalDir) const
Calibrates the position and covariance of a MicroMegas (MM) cluster.
std::array< double, 3 > Cov_t
Abrivation of the covariance type.
const Identifier & identify() const
: Returns the Athena identifier of the micro mega cluster It's constructed from the measurementHash &...
IdentifierHash layerHash() const
Returns the hash of the associated layer (Needed for surface retrieval)
const MuonGMR4::MmReadoutElement * readoutElement() const
Retrieve the associated MmReadoutElement.
float time() const
Returns the time.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
CalibratedSpacePoint::State State
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MdtDriftCircle_v1 MdtDriftCircle
MdtTwinDriftCircle_v1 MdtTwinDriftCircle
sTgcStripCluster_v1 sTgcStripCluster
RpcMeasurement_v1 RpcMeasurement
sTgcMeasurement_v1 sTgcMeasurement