14 #include "GaudiKernel/PhysicalConstants.h"
25 using namespace SegmentFit;
36 return StatusCode::SUCCESS;
43 const double timeDelay)
const {
48 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint);
60 const double timeDelay)
const {
62 sp =
calibrate(ctx, *sp, segPos, segDir, timeDelay);
71 const double timeOffset)
const {
81 : spPos + Amg::intersect<3>(posInChamb, dirInChamb, spPos, chDir).value_or(0) * chDir;
84 switch (spacePoint->
type()) {
87 + Amg::intersect<3>(spPos, chDir,
88 posInChamb, dirInChamb).value_or(0) * dirInChamb;
91 const double timeOfArrival = closestApproach.mag() * c_inv + timeOffset;
100 calibInput.setTimeOfFlight(timeOfArrival);
101 calibInput.setClosestApproach(std::move(closestApproach));
110 <<std::endl<<calibInput<<std::endl<<calibOutput);
120 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), std::move(chDir), fitState);
121 calibSP->setCovariance<2>(jac.inverse()*diagCov*jac);
122 calibSP->setDriftRadius(calibOutput.
driftRadius());
127 calibInput.setTimeOfFlight(timeOfArrival);
129 MdtCalibInput twinInput{dc->twinIdentify(), dc->twinAdc(), dc->twinTdc(), dc->readoutElement(), *gctx};
131 twinInput.setTimeOfFlight(timeOfArrival);
134 std::move(calibInput),
135 std::move(twinInput));
141 <<std::endl<<calibOutput);
149 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), std::move(chDir), fitState);
150 calibSP->setCovariance<2>(jac.inverse()*diagCov*jac);
159 const Amg::Transform3D toGasGap{strip->readoutElement()->globalToLocalTrans(*gctx, strip->layerHash()) * locToGlob};
162 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), std::move(chDir));
164 cov.block<2,2>(0, 0) = spacePoint->covariance();
168 const double time1 = strip->time()
169 - strip->readoutElement()->distanceToEdge(strip->layerHash(),
170 lPos.block<2,1>(0,0),
176 const double time2 = strip2->
time() -
177 strip2->readoutElement()->distanceToEdge(strip2->layerHash(),
178 Eigen::Rotation2D{M_PI_2}*lPos.block<2,1>(0,0),
181 calibSP->setTimeMeasurement(0.5*(time1 + time2));
188 calibSP->setTimeMeasurement(time1);
189 if (strip->measuresPhi()) {
195 calibSP->setCovariance<3>(std::move(
cov));
198 <<
", at "<<
Amg::toString(calibSP->positionInChamber())<<
", uncalib time: "
199 <<strip->time()<<
", calib time: "<<calibSP->time()<<
" cov " <<
toString(calibSP->covariance()));
204 calibSP = std::make_unique<CalibratedSpacePoint>(spacePoint, std::move(calibSpPos), std::move(chDir));
205 calibSP->setCovariance<2>(spacePoint->covariance());
215 const std::vector<const SpacePoint*>& spacePoints,
218 const double timeOffset)
const {
220 calibSpacePoints.reserve(spacePoints.size());
221 for(
const SpacePoint* spacePoint : spacePoints) {
223 if (hit) calibSpacePoints.push_back(std::move(hit));
225 return calibSpacePoints;