27 const std::string& na,
31 declareInterface<IMdtDriftCircleOnTrackCreator>(
this);
32 declareInterface<IRIO_OnTrackCreator>(
this);
50 using Property = ToolSettings::Property;
53 calibSettings.isActive(Property::TofCorrection));
55 calibSettings.isActive(Property::PropCorrection));
57 calibSettings.isActive(Property::TempCorrection));
59 calibSettings.isActive(Property::MagFieldCorrection));
61 calibSettings.isActive(Property::SlewCorrection));
63 calibSettings.isActive(Property::BackgroundCorrection));
74 return StatusCode::FAILURE;
76 if (msgLevel(MSG::INFO)) {
78 ss <<
"Constructed default MuonDriftCircleErrorStrategy:";
109 ss <<
"Using Data Loose error tuning";
111 ss <<
"Using Data Tight error tuning";
121 ATH_MSG_ERROR(
"Detected bad default configuration, using Cosmic TOF without "
122 <<
"time of flight corrections does not work");
123 return StatusCode::FAILURE;
129 return StatusCode::FAILURE;
133 ATH_MSG_ERROR(
"This tool is too complicated to rely on defaults. Potential configuration issue.");
134 return StatusCode::FAILURE;
136 return StatusCode::SUCCESS;
142 const double t0Shift,
145 const double tTrack)
const {
147 const EventContext& ctx{Gaudi::Hive::currentContext()};
174 ATH_MSG_VERBOSE(
" running in COSMICS_TRIGGERTIME mode, triggerOffset: "
181 <<
" t0Shift: " << t0Shift
186 ATH_MSG_WARNING(
"No valid mode selected, cannot apply tof correction");
196 if (!posOnIdealWire) {
197 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" globalToLocal() failed for ideal surface");
200 posOnWire = std::move(*posOnIdealWire);
202 double positionAlongWire = posOnWire[
Trk::locZ];
217 std::unique_ptr<MdtDriftCircleOnTrack> rot{};
227 ATH_MSG_WARNING(
"Unexpected globalToLocal failure, cannot create MDT ROT ");
234 rot = std::make_unique<MdtDriftCircleOnTrack>(&mdtPrd,
235 std::move(calibOutput.
locPars),
236 std::move(calibOutput.
locErr),
249 rot = std::make_unique<MdtDriftCircleOnTrack>(&mdtPrd,
250 std::move(calibOutput.
locPars),
251 std::move(calibOutput.
locErr),
259 rot = std::make_unique<MdtDriftCircleOnTrack>(&mdtPrd,
260 std::move(calibOutput.
locPars),
261 std::move(calibOutput.
locErr),
274 return rot.release();
301 ATH_MSG_VERBOSE(
"getLocalMeasurement "<<calibInput<<
" with m_doMdt=" <<
m_doMdt <<
" and " << myStrategy);
305 double sigmaR{1.}, driftTime{0.}, radius{0.}, errRadius{0.};
311 ATH_MSG_VERBOSE(
"getLocalMeasurement() - Calibrated output "<<calibOutput);
318 std::optional<Amg::Vector2D> myLocalPosition = surf.
globalToLocal(gpos, gdir);
319 if (myLocalPosition) {
322 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" ErrorAtPredictedPosition failed because local position "<<
323 "transformation didn't succeed. Using measured radius instead.");
348 <<
" SigmaR = " << sigmaR);
349 double sigmaR2 = 0.0;
353 ATH_MSG_DEBUG(
"After scaling etc:\t Moore sigmaR2 = " << sigmaR2);
356 ATH_MSG_DEBUG(
"After scaling etc:\t Muon ErrorStrategy sigmaR2 = " << sigmaR2);
366 newLocalCov(0, 0) = sigmaR2;
378 const double tTrack)
const {
381 return createRIO_OnTrack(prd, tp.position(), &momentum, 0, strategy, beta, tTrack);
386 const EventContext& )
const {
389 <<
" Trk::PrepRawData not a MdtPrepData!! No rot created ");
421 ATH_MSG_WARNING(
"updateError: ErrorAtPredictedPosition is not yet supported!");
429 <<
" for radius=" << radius);
432 const EventContext& ctx{Gaudi::Hive::currentContext()};
436 if (sigmaR < 0.0001 || sigmaR * sigmaR < 0.0001) {
439 <<
" reso " << sigmaR <<
" sigma2 "
440 << sigmaR * sigmaR <<
" drift time " << t
448 double sigmaR2 = 0.0;
454 ATH_MSG_DEBUG(
"After scaling etc:\t Muon ErrorStrategy sigmaR2 = " << sigmaR2);
456 std::unique_ptr<MdtDriftCircleOnTrack> rot{DCT.
clone()};
457 rot->m_localCovariance(0, 0) = sigmaR2;
458 rot->setErrorStrategy(myStrategy);
465 return rot.release();
471 const double tShift)
const {
478 return 0.23 * std::exp(-std::abs(
r) / 6.06) + 0.0362;
506 return sigmaR2 + 0.005;
509 return 4 * sigmaR2 + 0.16;
512 return sigmaR2 + 0.005;
521 if (stIdx == StIndex::BE) {
523 return 1.44 * sigmaR2 + 1.44;
524 }
else if (stIdx == StIndex::EE) {
527 return 1.44 * sigmaR2 + 0.16;
528 return 1.44 * sigmaR2 + 1.;
529 }
else if (
m_idHelperSvc->chamberIndex(
id) == ChIndex::BIS &&
533 return 1.44 * sigmaR2 + 1.;
535 return 4 * sigmaR2 + 25;
538 return 1.44 * sigmaR2 + 1.;
544 return 4 * sigmaR2 + 49.;
547 return 4 * sigmaR2 + 4.;
554 return 2.25 * sigmaR2 + 0.09;
557 double fixedTerm = (stIdx == StIndex::BI || stIdx == StIndex::BM || stIdx == StIndex::BO)
569 return 1.44 * sigmaR2 + fixedTerm;
588 return sigmaR2 + 0.005;
592 return 4 * sigmaR2 + 0.16;
595 return sigmaR2 + 0.005;
604 if (stIdx == StIndex::BE) {
606 return 1.44 * sigmaR2 + 4;
607 }
else if (stIdx == StIndex::EE) {
609 return 1.44 * sigmaR2 + 0.04;
610 }
else if (
m_idHelperSvc->chamberIndex(
id) == ChIndex::BIS &&
614 return 1.44 * sigmaR2 + 1.;
615 return 4 * sigmaR2 + 25;
619 return 1.44 * sigmaR2 + 0.25;
625 return 1.44 * sigmaR2 + 0.25;
628 return 1.44 * sigmaR2 + 0.04;
635 return 4 * sigmaR2 + 4.;
638 return 4 * sigmaR2 + 4.;
645 return 2.25 * sigmaR2 + 0.09;
648 double fixedTerm = (stIdx == StIndex::BI || stIdx == StIndex::BM || stIdx == StIndex::BO)
659 return 1.44 * sigmaR2 + fixedTerm;
678 return sigmaR2 + 0.005;
681 return 4 * sigmaR2 + 0.16;
684 return sigmaR2 + 0.005;
692 if (stIdx == StIndex::BE) {
694 return 1.44 * sigmaR2 + 0.04;
695 }
else if (stIdx == StIndex::EE) {
698 return 1.21 * sigmaR2 + 0.01;
700 return 1.21 * sigmaR2 + 0.01;
701 }
else if (
m_idHelperSvc->chamberIndex(
id) == ChIndex::BIS &&
705 return 1.44 * sigmaR2 + 1.;
707 return 4 * sigmaR2 + 1.;
708 }
else if (stIdx == StIndex::BM &&
712 return 1.21 * sigmaR2 + 0.25;
718 return 1.21 * sigmaR2 + 0.25;
722 return 1.21 * sigmaR2 + 25.;
725 return 1.21 * sigmaR2 + 0.04;
731 return 4 * sigmaR2 + 4.;
734 return 4 * sigmaR2 + 4.;
741 return 2.25 * sigmaR2 + 0.09;
746 double fixedTerm = 0.01;
757 return 1.21 * sigmaR2 + fixedTerm;
786 return sigmaR2 + 0.005;
789 return 4 * sigmaR2 + 0.16;
792 return sigmaR2 + 0.005;
798 return 1.21 * sigmaR2;
805 return 2.25 * sigmaR2;
808 return 1.21 * sigmaR2;
#define ATH_CHECK
Evaluate an expression and check for errors.
#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.
double driftTime() const
Returns the drift time inside the tube.
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
MdtDriftCircleOnTrack * MdtRotPtr
virtual MdtRotPtr createRIO_OnTrack(const MdtPrepData &prd, const Amg::Vector3D &globalPos, const Amg::Vector3D *gdir=nullptr, const double t0Shift=0., const MuonDriftCircleErrorStrategy *strategy=nullptr, const double beta=1, const double tTrack=1) const override final
Calibrate a MdtPrepData object.
virtual MdtRotPtr updateError(const MdtDriftCircleOnTrack &DCT, const Trk::TrackParameters *pars=nullptr, const MuonDriftCircleErrorStrategy *strategy=nullptr) const override
Update error of a ROT without changing the drift radius.
Gaudi::Property< bool > m_doFixedError
Use parameterised errors.
Gaudi::Property< bool > m_scaleMdtCov
Fixed error (not tube radius)
Gaudi::Property< bool > m_t0Refit
Use error strategy for segments by default.
virtual void updateSign(MdtDriftCircleOnTrack &rot, const Trk::DriftCircleSide si) const override final
Update of the sign of the drift radius.
MdtDriftCircleOnTrackCreator(const std::string &, const std::string &, const IInterface *)
MuonDriftCircleErrorStrategy m_errorStrategy
< Error strategy for created ROTs
virtual StatusCode initialize() override final
CalibrationOutput getLocalMeasurement(const EventContext &ctx, const MdtPrepData &DC, const MdtCalibInput &calibInput, const MuonDriftCircleErrorStrategy &strategy) const
preform the mdt calibration
double mooreErrorStrategyMC(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
double getTriggerTime() const
currently returns 0.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
static double parametrisedSigma(double r)
Gaudi::Property< bool > m_applyToF
toggle between loose errors (initial before alignment) and tight after alignment
Gaudi::Property< std::string > m_defaultStrategy
if set to true, the ROT creator create 'tube' hits with a local position of 0 and an error of tube ra...
virtual Trk::RIO_OnTrack * correct(const Trk::PrepRawData &prd, const Trk::TrackParameters &tp, const EventContext &) const override
Base class method for correct.
Gaudi::Property< bool > m_doIndividualChamberReweights
toggle between MC and data alignment errors (to be removed in rel.
Gaudi::Property< bool > m_looseErrors
double mooreErrorStrategyLoose(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
double muonErrorStrategy(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Gaudi::Property< bool > m_doSegments
Deweight individual chambers.
double mooreErrorStrategy(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
static constexpr double s_inverseSpeedOfLight
Gaudi::Property< bool > m_errorAtPredictedPosition
Add a term to the error to account for very poorly aligned stations.
Gaudi::Property< int > m_timeCorrectionType
ToolHandle< IMdtCalibrationTool > m_mdtCalibrationTool
@ ATLTIME
normal time of flight corrections assuming IP + light speed to be used for simulated data and collisi...
@ NO_CORRECTIONS
special case for cosmics taken with scintilator trigger which is read out so the offset with respect ...
@ COSMICS_TRIGGERTIME
case for normal cosmic data with rpc trigger or simulation including TOF.
Gaudi::Property< bool > m_createTubeHits
Scale ROTs depending on local alignment (i.e.
Gaudi::Property< double > m_globalToLocalTolerance
Gaudi::Property< bool > m_wasConfigured
double mooreErrorStrategyTight(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Gaudi::Property< bool > m_stationError
Add a special error to account for the T0 refit.
double timeOfFlight(const Amg::Vector3D &pos, const double beta, const double tTrack, const double tShift) const
Gaudi::Property< bool > m_useErrorParametrisation
Use the predicted track position to correct the Error.
Gaudi::Property< bool > m_doMdt
Process MDT ROTs.
Gaudi::Property< bool > m_isMC
toggle whether the time of flight is included in the t0 shifts
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
double driftRadius() const
Returns the value of the drift radius.
double driftTime() const
Returns the value of the drift time used to obtain the drift radius.
virtual void setLocalParameters(const Trk::LocalParameters &locPos)
Sets the local parameters.
Trk::DriftCircleStatus m_status
information on the status of the Mdt measurement - see Trk::DriftCircleStatus for definitions
virtual MdtDriftCircleOnTrack * clone() const override final
Pseudo-constructor, needed to avoid excessive RTTI.
virtual const MuonGM::MdtReadoutElement * detectorElement() const override final
Returns the detector element, assoicated with the PRD of this class.
Class to represent measurements from the Monitored Drift Tubes.
bool creationParameter(CreationParameter) const
Strategy strategy() const
const MuonDriftCircleErrorStrategyInput & getBits() const
void setParameter(CreationParameter, bool value)
@ StationError
A term is added to account for misaligned.
@ T0Refit
A special error was applied to account for the T0 refit (user defined via jobProperties)
@ FixedError
A fixed error is given to this hit (user defined via jobProperties)
@ MagFieldCorrection
Magnetic field correction was applied in calibration.
@ ParameterisedErrors
Use parameterised errors.
@ SlewCorrection
Slewing correction was applied in calibration.
@ TofCorrection
Time of flight correction was applied in calibration.
@ BackgroundCorrection
Background correction was applied in calibration.
@ ErrorAtPredictedPosition
@ PropCorrection
Propagation correction was applied in calibration.
@ Segment
Treating a segment or a track.
@ TempCorrection
Temperature correction was applied in calibration.
Support class for PropertyMgr.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
virtual bool type(PrepRawDataType type) const
Interface method checking the type.
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Identifier identify() const
return the identifier -extends MeasurementBase
Abstract Base Class for tracking surfaces.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
StIndex
enum to classify the different station layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MdtDriftCircleOnTrackCreator::CalibrationOutput CalibrationOutput
MdtDriftCircleOnTrackCreator::MdtRotPtr MdtRotPtr
DriftCircleSide
Enumerates the 'side' of the wire on which the tracks passed (i.e.
@ LEFT
the drift radius is negative (see Trk::AtaStraightLine)
DriftCircleStatus
Enumerates the 'status' of the wire on which the tracks passed (based on the TRT_Side enum,...
@ NODRIFTTIME
drift time was not used - drift radius is 0.
@ DECIDED
sign of drift radius has been determined
@ UNDECIDED
sign of drift radius has not been determined
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
struct to hold output of calibration
Trk::LocalParameters locPars