ATLAS Offline Software
MdtDriftCircleOnTrackCreator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_MDTDRIFTCIRCLEONTRACKCREATOR_H
6 #define MUON_MDTDRIFTCIRCLEONTRACKCREATOR_H
7 
8 #include <bitset>
9 #include <memory>
10 #include <string>
11 
13 #include "GaudiKernel/PhysicalConstants.h"
23 
24 class MdtCalibToolInput;
25 
26 namespace Muon {
27 
28 class MdtPrepData;
29 
70  public:
71  enum TimingMode {
74  ATLTIME =0,
77  NO_CORRECTIONS = 1,
87 
89  };
90 
91  public:
92  MdtDriftCircleOnTrackCreator(const std::string&, const std::string&, const IInterface*);
93  virtual ~MdtDriftCircleOnTrackCreator() = default;
94 
95  virtual StatusCode initialize() override final;
96 
110  const Amg::Vector3D& globalPos,
111  const Amg::Vector3D* gdir = nullptr,
112  const double t0Shift = 0.,
114  const double beta = 1,
115  const double tTrack = 1) const override final;
116 
126  virtual void updateSign(MdtDriftCircleOnTrack& rot,
127  const Trk::DriftCircleSide si) const override final;
128 
139  const Trk::TrackParameters* pars = nullptr,
140  const MuonDriftCircleErrorStrategy* strategy = nullptr) const override;
141 
142 
144  virtual Trk::RIO_OnTrack* correct(const Trk::PrepRawData& prd,
145  const Trk::TrackParameters& tp, const EventContext& /*ctx*/) const override;
146 
156  virtual MdtRotPtr correct(const MdtPrepData& prd,
159  const double beta,
160  const double tTrack) const override final;
161 
164  return m_errorStrategy;
165  };
166 
170  Amg::MatrixX le,
171  double t,
172  bool ok)
173  : locPars(lp), locErr(le), driftTime(t), calibOk(ok) {}
176  double driftTime;
177  bool calibOk;
178  };
179 
180 
181 
182  private:
183 
184  double timeOfFlight(const Amg::Vector3D& pos,
185  const double beta,
186  const double tTrack,
187  const double tShift) const;
188 
190  CalibrationOutput getLocalMeasurement(const EventContext& ctx,
191  const MdtPrepData& DC,
192  const MdtCalibInput& calibInput,
194 
196  double getTriggerTime() const { return 0.; }
197 
198  // parametrised error function
199  static double parametrisedSigma(double r);
200 
201  double mooreErrorStrategy(const MuonDriftCircleErrorStrategy& myStrategy,
202  double sigmaR,
203  const Identifier& id) const;
204 
205  double mooreErrorStrategyMC(const MuonDriftCircleErrorStrategy& myStrategy,
206  double sigmaR,
207  const Identifier& id) const;
208 
209  double mooreErrorStrategyLoose(const MuonDriftCircleErrorStrategy& myStrategy,
210  double sigmaR,
211  const Identifier& id) const;
212 
213  double mooreErrorStrategyTight(const MuonDriftCircleErrorStrategy& myStrategy,
214  double sigmaR,
215  const Identifier& id) const;
216 
217  double muonErrorStrategy(const MuonDriftCircleErrorStrategy& myStrategy,
218  double sigmaR,
219  const Identifier& id) const;
220 
221  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
222 
223  ToolHandle<IMdtCalibrationTool> m_mdtCalibrationTool{this, "CalibrationTool", ""};
224 
225  // Configuration variables
226  Gaudi::Property<bool> m_doMdt{this, "doMDT", true};
227  Gaudi::Property<int> m_timeCorrectionType{this, "TimingMode", 0};
229  // Constants for use during calculations
231  Gaudi::Property<double> m_fixedError{this, "FixedError", 1.};
232 
233  Gaudi::Property<double> m_globalToLocalTolerance{this, "GlobalToLocalTolerance", 1000.,
234  "Tolerance used for the Surface::globalToLocal"};
235 
236  // Member variables used to fill the default error strategy
239 
241  Gaudi::Property<std::string> m_defaultStrategy{this, "DefaultErrorStrategy", "Muon",
242  "Default error strategy to be used in calculating errors"};
243 
246  Gaudi::Property<bool> m_createTubeHits{this, "CreateTubeHit", false};
248  Gaudi::Property<bool> m_scaleMdtCov{this, "DoErrorScaling", true};
250  Gaudi::Property<bool> m_doFixedError{this, "DoFixedError", true};
252  Gaudi::Property<bool> m_useErrorParametrisation{this, "UseParametrisedError", false};
257  Gaudi::Property<bool> m_errorAtPredictedPosition{this, "UseErrorAtPredictedPosition", false};
259  Gaudi::Property<bool> m_stationError{this, "DoStationError", false};
261  Gaudi::Property<bool> m_t0Refit{this, "T0RefitError", false};
263  Gaudi::Property<bool> m_doSegments{this, "DoSegmentErrors", true};
265  Gaudi::Property<bool> m_doIndividualChamberReweights{this, "DeweightIndividualChambers", true};
267  Gaudi::Property<bool> m_isMC{this, "IsMC", false};
269  Gaudi::Property<bool> m_applyToF{this, "ApplyToF", true};
272  Gaudi::Property<bool> m_looseErrors{this, "UseLooseErrors", false,
273  "Use error strategy for MC"};
274  Gaudi::Property<bool> m_wasConfigured{this, "WasConfigured", false,
275  "This tool is too complicated to rely on defaults. Will fail if not configured."};
276 
277  static constexpr double s_inverseSpeedOfLight{1. / Gaudi::Units::c_light};
278 
279  int m_BME_idx{-1};
280 
281 };
282 
283 } // namespace Muon
284 
285 #endif
Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyTight
double mooreErrorStrategyTight(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Definition: MdtDriftCircleOnTrackCreator.cxx:673
Muon::MdtDriftCircleOnTrackCreator::parametrisedSigma
static double parametrisedSigma(double r)
Definition: MdtDriftCircleOnTrackCreator.cxx:477
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategy
double mooreErrorStrategy(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Definition: MdtDriftCircleOnTrackCreator.cxx:482
beamspotman.r
def r
Definition: beamspotman.py:676
Trk::LocalParameters
Definition: LocalParameters.h:98
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput::calibOk
bool calibOk
Definition: MdtDriftCircleOnTrackCreator.h:177
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
Trk::PrepRawDataType::MdtPrepData
@ MdtPrepData
MuonDriftCircleErrorStrategy.h
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput::locPars
Trk::LocalParameters locPars
Definition: MdtDriftCircleOnTrackCreator.h:174
Muon::MdtDriftCircleOnTrackCreator::m_errorAtPredictedPosition
Gaudi::Property< bool > m_errorAtPredictedPosition
Add a term to the error to account for very poorly aligned stations.
Definition: MdtDriftCircleOnTrackCreator.h:257
Muon::MdtDriftCircleOnTrackCreator::COSMICS_TRIGGERTIME
@ COSMICS_TRIGGERTIME
case for normal cosmic data with rpc trigger or simulation including TOF.
Definition: MdtDriftCircleOnTrackCreator.h:82
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Muon::MdtDriftCircleOnTrackCreator::m_stationError
Gaudi::Property< bool > m_stationError
Add a special error to account for the T0 refit.
Definition: MdtDriftCircleOnTrackCreator.h:259
MdtCalibInput
Definition: MdtCalibInput.h:35
Muon::MdtDriftCircleOnTrackCreator::errorStrategy
virtual const MuonDriftCircleErrorStrategy & errorStrategy() const override
Returns the default error strategy object.
Definition: MdtDriftCircleOnTrackCreator.h:163
Muon::MdtDriftCircleOnTrackCreator::~MdtDriftCircleOnTrackCreator
virtual ~MdtDriftCircleOnTrackCreator()=default
MdtCalibDataContainer.h
IMdtCalibrationTool.h
ParticleTest.tp
tp
Definition: ParticleTest.py:25
Muon::MdtDriftCircleOnTrackCreator::m_doMdt
Gaudi::Property< bool > m_doMdt
Process MDT ROTs.
Definition: MdtDriftCircleOnTrackCreator.h:226
Muon::MdtDriftCircleOnTrackCreator::m_globalToLocalTolerance
Gaudi::Property< double > m_globalToLocalTolerance
Definition: MdtDriftCircleOnTrackCreator.h:233
Muon::MdtDriftCircleOnTrackCreator::ATLTIME
@ ATLTIME
normal time of flight corrections assuming IP + light speed to be used for simulated data and collisi...
Definition: MdtDriftCircleOnTrackCreator.h:74
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput::CalibrationOutput
CalibrationOutput(Trk::LocalParameters lp, Amg::MatrixX le, double t, bool ok)
Definition: MdtDriftCircleOnTrackCreator.h:169
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Muon::MdtDriftCircleOnTrackCreator::NO_CORRECTIONS
@ NO_CORRECTIONS
special case for cosmics taken with scintilator trigger which is read out so the offset with respect ...
Definition: MdtDriftCircleOnTrackCreator.h:77
MdtDriftCircleOnTrack.h
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Muon::MdtDriftCircleOnTrackCreator::muonErrorStrategy
double muonErrorStrategy(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Definition: MdtDriftCircleOnTrackCreator.cxx:775
SpaceTimePoint.h
Muon::MdtDriftCircleOnTrackCreator::MdtDriftCircleOnTrackCreator
MdtDriftCircleOnTrackCreator(const std::string &, const std::string &, const IInterface *)
Definition: MdtDriftCircleOnTrackCreator.cxx:27
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MdtDriftCircleOnTrackCreator::m_BME_idx
int m_BME_idx
Definition: MdtDriftCircleOnTrackCreator.h:279
Muon::MdtDriftCircleOnTrackCreator::updateSign
virtual void updateSign(MdtDriftCircleOnTrack &rot, const Trk::DriftCircleSide si) const override final
Update of the sign of the drift radius.
Definition: MdtDriftCircleOnTrackCreator.cxx:278
Muon::IMdtDriftCircleOnTrackCreator
Interface for tools calibrating MdtPrepData, turning them into Muon::MdtDriftCircleOnTrack object.
Definition: IMdtDriftCircleOnTrackCreator.h:24
Muon::MdtDriftCircleOnTrackCreator::m_mdtCalibrationTool
ToolHandle< IMdtCalibrationTool > m_mdtCalibrationTool
Definition: MdtDriftCircleOnTrackCreator.h:223
xAOD::TrackParameters
TrackParameters_v1 TrackParameters
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParameters.h:11
Muon::MdtDriftCircleOnTrackCreator::m_errorStrategy
MuonDriftCircleErrorStrategy m_errorStrategy
< Error strategy for created ROTs
Definition: MdtDriftCircleOnTrackCreator.h:238
Muon::MdtDriftCircleOnTrackCreator::COSMICS_TOF
@ COSMICS_TOF
Definition: MdtDriftCircleOnTrackCreator.h:86
Muon::MuonDriftCircleErrorStrategyInput
std::bitset< 23 > MuonDriftCircleErrorStrategyInput
Definition: MuonDriftCircleErrorStrategy.h:13
Muon::MdtDriftCircleOnTrackCreator::initialize
virtual StatusCode initialize() override final
Definition: MdtDriftCircleOnTrackCreator.cxx:36
Muon::MdtDriftCircleOnTrackCreator::m_looseErrors
Gaudi::Property< bool > m_looseErrors
Definition: MdtDriftCircleOnTrackCreator.h:272
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Muon::MdtDriftCircleOnTrackCreator::m_t0Refit
Gaudi::Property< bool > m_t0Refit
Use error strategy for segments by default.
Definition: MdtDriftCircleOnTrackCreator.h:261
Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyLoose
double mooreErrorStrategyLoose(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Definition: MdtDriftCircleOnTrackCreator.cxx:578
Muon::MdtDriftCircleOnTrackCreator::m_doIndividualChamberReweights
Gaudi::Property< bool > m_doIndividualChamberReweights
toggle between MC and data alignment errors (to be removed in rel.
Definition: MdtDriftCircleOnTrackCreator.h:265
Muon::MdtDriftCircleOnTrackCreator::s_inverseSpeedOfLight
static constexpr double s_inverseSpeedOfLight
Definition: MdtDriftCircleOnTrackCreator.h:277
Muon::MdtDriftCircleOnTrackCreator::mooreErrorStrategyMC
double mooreErrorStrategyMC(const MuonDriftCircleErrorStrategy &myStrategy, double sigmaR, const Identifier &id) const
Definition: MdtDriftCircleOnTrackCreator.cxx:495
Muon::MdtDriftCircleOnTrackCreator::TimingMode
TimingMode
Definition: MdtDriftCircleOnTrackCreator.h:71
ReadCondHandleKey.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Muon::MdtDriftCircleOnTrackCreator::m_doSegments
Gaudi::Property< bool > m_doSegments
Deweight individual chambers.
Definition: MdtDriftCircleOnTrackCreator.h:263
IMdtDriftCircleOnTrackCreator.h
Muon::MdtDriftCircleOnTrackCreator::m_useErrorParametrisation
Gaudi::Property< bool > m_useErrorParametrisation
Use the predicted track position to correct the Error.
Definition: MdtDriftCircleOnTrackCreator.h:252
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Muon::MdtDriftCircleOnTrackCreator::getLocalMeasurement
CalibrationOutput getLocalMeasurement(const EventContext &ctx, const MdtPrepData &DC, const MdtCalibInput &calibInput, const MuonDriftCircleErrorStrategy &strategy) const
preform the mdt calibration
Definition: MdtDriftCircleOnTrackCreator.cxx:296
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
LocalParameters.h
Trk::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Muon::MdtDriftCircleOnTrackCreator::timeOfFlight
double timeOfFlight(const Amg::Vector3D &pos, const double beta, const double tTrack, const double tShift) const
Definition: MdtDriftCircleOnTrackCreator.cxx:469
Trk::DriftCircleSide
DriftCircleSide
Enumerates the 'side' of the wire on which the tracks passed (i.e.
Definition: DriftCircleSide.h:16
Muon::MdtDriftCircleOnTrackCreator::m_isMC
Gaudi::Property< bool > m_isMC
toggle whether the time of flight is included in the t0 shifts
Definition: MdtDriftCircleOnTrackCreator.h:267
Muon::MdtDriftCircleOnTrackCreator::m_wasConfigured
Gaudi::Property< bool > m_wasConfigured
Definition: MdtDriftCircleOnTrackCreator.h:274
Muon::MdtDriftCircleOnTrackCreator::m_createTubeHits
Gaudi::Property< bool > m_createTubeHits
Scale ROTs depending on local alignment (i.e.
Definition: MdtDriftCircleOnTrackCreator.h:246
Muon::MdtDriftCircleOnTrackCreator::getTriggerTime
double getTriggerTime() const
currently returns 0.
Definition: MdtDriftCircleOnTrackCreator.h:196
Muon::MdtDriftCircleOnTrackCreator::m_applyToF
Gaudi::Property< bool > m_applyToF
toggle between loose errors (initial before alignment) and tight after alignment
Definition: MdtDriftCircleOnTrackCreator.h:269
Muon::MdtDriftCircleOnTrackCreator::correct
virtual Trk::RIO_OnTrack * correct(const Trk::PrepRawData &prd, const Trk::TrackParameters &tp, const EventContext &) const override
Base class method for correct.
Definition: MdtDriftCircleOnTrackCreator.cxx:385
Muon::MdtDriftCircleOnTrackCreator::m_timeCorrectionType
Gaudi::Property< int > m_timeCorrectionType
Definition: MdtDriftCircleOnTrackCreator.h:228
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput::locErr
Amg::MatrixX locErr
Definition: MdtDriftCircleOnTrackCreator.h:175
Muon::MdtDriftCircleOnTrackCreator
Interface for the reconstruction to MDT calibration and alignment corrections.
Definition: MdtDriftCircleOnTrackCreator.h:69
Muon::MdtDriftCircleOnTrackCreator::createRIO_OnTrack
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.
Definition: MdtDriftCircleOnTrackCreator.cxx:140
Muon::MdtDriftCircleOnTrackCreator::m_scaleMdtCov
Gaudi::Property< bool > m_scaleMdtCov
Fixed error (not tube radius)
Definition: MdtDriftCircleOnTrackCreator.h:248
AthAlgTool
Definition: AthAlgTool.h:26
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
Muon::MdtDriftCircleOnTrackCreator::NumberOfTimingModes
@ NumberOfTimingModes
Definition: MdtDriftCircleOnTrackCreator.h:88
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput
struct to hold output of calibration
Definition: MdtDriftCircleOnTrackCreator.h:168
Muon::MdtDriftCircleOnTrackCreator::updateError
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.
Definition: MdtDriftCircleOnTrackCreator.cxx:397
Muon::MdtDriftCircleOnTrackCreator::CalibrationOutput::driftTime
double driftTime
Definition: MdtDriftCircleOnTrackCreator.h:176
IMuonIdHelperSvc.h
Muon::MdtDriftCircleOnTrackCreator::m_doFixedError
Gaudi::Property< bool > m_doFixedError
Use parameterised errors.
Definition: MdtDriftCircleOnTrackCreator.h:250
Muon::MdtDriftCircleOnTrackCreator::m_defaultStrategy
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...
Definition: MdtDriftCircleOnTrackCreator.h:241
ServiceHandle< Muon::IMuonIdHelperSvc >
Muon::MdtDriftCircleOnTrackCreator::m_fixedError
Gaudi::Property< double > m_fixedError
< Error used when m_doFixed error =true or m_scaleErrorManually = true
Definition: MdtDriftCircleOnTrackCreator.h:231
Identifier
Definition: IdentifierFieldParser.cxx:14
Muon::MdtDriftCircleOnTrackCreator::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtDriftCircleOnTrackCreator.h:221