ATLAS Offline Software
MuonRefitTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONREFITTOOL_H
6 #define MUONREFITTOOL_H
7 
8 #include <atomic>
9 #include <set>
10 #include <string>
11 #include <vector>
12 
14 #include "GaudiKernel/ServiceHandle.h"
15 #include "GaudiKernel/ToolHandle.h"
31 
32 namespace Muon {
33 
34  class MuonRefitTool : virtual public IMuonRefitTool, public AthAlgTool {
35  public:
36  MuonRefitTool(const std::string& ty, const std::string& na, const IInterface* pa);
37  virtual ~MuonRefitTool() = default;
38  virtual StatusCode initialize() override;
39  virtual StatusCode finalize() override;
40 
42  std::unique_ptr<Trk::Track> refit(const Trk::Track& track, const EventContext& ctx, const Settings* settings) const override;
43 
45  std::vector<std::unique_ptr<Trk::Track> > refit(const std::vector<Trk::Track*>& tracks, const EventContext& ctx,
46  const Settings* settings) const override;
47 
48  protected:
50  std::unique_ptr<Trk::Track> updateErrors(const Trk::Track& track, const EventContext& ctx, const Settings& settings) const;
51 
52  std::unique_ptr<Trk::Track> updateMdtErrors(const Trk::Track& track, const EventContext& ctx, const Settings& settings) const;
53 
54  std::unique_ptr<Trk::Track> updateAlignmentErrors(const Trk::Track& track, const EventContext& ctx, const Settings& settings) const;
55 
56  std::unique_ptr<Trk::Track> makeAEOTs(const Trk::Track& track) const;
57 
58  std::unique_ptr<Trk::Track> makeSimpleAEOTs(const Trk::Track& track) const;
59 
60  std::unique_ptr<Trk::Track> removeOutliers(const Trk::Track& track, const Settings& settings) const;
61 
62  bool removeMdtOutliers(const Trk::TrackParameters& pars, const std::vector<const MdtDriftCircleOnTrack*>& hits,
63  std::set<Identifier>& removedIdentifiers, const Settings& settings) const;
64 
65  struct State {
66  State() = default;
69  bool copyOriginal{true};
70  };
71 
72  private:
73  ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
74  "Handle to the service providing the IMuonEDMHelperSvc interface"};
75  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
76 
78  ToolHandle<Trk::ITrkAlignmentDeviationTool> m_alignErrorTool{this, "AlignmentErrorTool", "MuonAlign::AlignmentErrorTool"};
79  PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
80 
81  ToolHandle<Trk::ITrackFitter> m_trackFitter{this, "Fitter", "Trk::GlobalChi2Fitter/MCTBFitterMaterialFromTrack"};
82  ToolHandle<Trk::IExtrapolator> m_muonExtrapolator{this, "MuonExtrapolator", "Trk::Extrapolator/MuonExtrapolator"};
83  ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtRotCreator{this, "MdtRotCreator",
84  "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"};
85  ToolHandle<IMuonCompetingClustersOnTrackCreator> m_compClusterCreator{
86  this, "CompClusterCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator"};
87  ToolHandle<IDCSLFitProvider> m_t0Fitter{this, "T0Fitter", ""};
88  ToolHandle<Muon::IMuonTrackExtrapolationTool> m_muonEntryTrackExtrapolator{this, "MuonEntryExtrapolationTool", ""};
89 
90  Gaudi::Property<int> m_finderDebugLevel{this, "FinderDebugLevel", -1};
91 
92  Gaudi::Property<double> m_minMuonMomentum{this, "MinMuonMom", 4000};
93  Gaudi::Property<double> m_fixedError{this, "UsedFixedError", 1};
94  Gaudi::Property<double> m_flagT0FitRange{this, "FlagT0FitRange", 0.00005};
95 
96  Gaudi::Property<float> m_alignmentDelta{this, "AlignmentDelta", 0};
97  Gaudi::Property<float> m_alignmentAngle{this, "AlignmentAngle", 0};
98  Gaudi::Property<float> m_alignmentDeltaError{this, "AlignmentDeltaError", 0.1};
99  Gaudi::Property<float> m_alignmentAngleError{this, "AlignmentAngleError", 0.001};
100 
101  Gaudi::Property<bool> m_alignmentErrors{this, "AlignmentErrors", false};
102  Gaudi::Property<bool> m_simpleAEOTs{this, "SimpleAEOTs", false};
103  Gaudi::Property<bool> m_addAll{this, "AddAll", false};
104  Gaudi::Property<bool> m_addInner{this, "AddInner", false};
105  Gaudi::Property<bool> m_addMiddle{this, "AddMiddle", false};
106  Gaudi::Property<bool> m_addTwo{this, "AddTwo", false};
107  Gaudi::Property<bool> m_deweightBEE{this, "DeweightBEE", false};
108  Gaudi::Property<bool> m_deweightEE{this, "DeweightEE", false};
109  Gaudi::Property<bool> m_deweightBIS78{this, "DeweightBIS78", true};
110  Gaudi::Property<bool> m_deweightBME{this, "DeweightBME", true};
111  Gaudi::Property<bool> m_deweightBOE{this, "DeweightBOE", true};
112  Gaudi::Property<bool> m_deweightEEL1C05{this, "DeweightEEL1C05", false};
113  Gaudi::Property<bool> m_deweightTwoStationTracks{this, "DeweightTwoStationTracks", false};
114 
125 
127 
128  mutable std::atomic<unsigned int> m_nrefits{0};
129  mutable std::atomic<unsigned int> m_ngoodRefits{0};
130  mutable std::atomic<unsigned int> m_failedOutlierRemoval{0};
131  mutable std::atomic<unsigned int> m_failedErrorUpdate{0};
132  mutable std::atomic<unsigned int> m_failedRefit{0};
133  mutable std::atomic<unsigned int> m_failedExtrapolationMuonEntry{0};
134 
135  std::unique_ptr<Trk::Perigee> createPerigee(const Trk::TrackParameters& pars, const EventContext& ctx) const;
136 
138  };
139 } // namespace Muon
140 
141 #endif
Muon::MuonRefitTool::m_defaultSettings
Settings m_defaultSettings
Definition: MuonRefitTool.h:126
Muon::MuonRefitTool::State::copyOriginal
bool copyOriginal
Definition: MuonRefitTool.h:69
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Muon::MuonRefitTool::m_deweightBEE
Gaudi::Property< bool > m_deweightBEE
Definition: MuonRefitTool.h:107
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
Muon::MuonRefitTool::m_alignmentAngle
Gaudi::Property< float > m_alignmentAngle
Definition: MuonRefitTool.h:97
MuonDriftCircleErrorStrategy.h
Muon::MuonRefitTool::updateErrors
std::unique_ptr< Trk::Track > updateErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
update errors on a muon track
Definition: MuonRefitTool.cxx:630
Muon::MuonRefitTool::m_deweightBME
Gaudi::Property< bool > m_deweightBME
Definition: MuonRefitTool.h:110
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
TrackParameters.h
Muon::MuonRefitTool::m_errorStrategySL
MuonDriftCircleErrorStrategy m_errorStrategySL
Definition: MuonRefitTool.h:121
Muon::MuonRefitTool::removeMdtOutliers
bool removeMdtOutliers(const Trk::TrackParameters &pars, const std::vector< const MdtDriftCircleOnTrack * > &hits, std::set< Identifier > &removedIdentifiers, const Settings &settings) const
Definition: MuonRefitTool.cxx:1311
Muon::MuonRefitTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonRefitTool.h:79
Muon::MuonRefitTool::m_deweightBOE
Gaudi::Property< bool > m_deweightBOE
Definition: MuonRefitTool.h:111
IMuonRefitTool.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Muon::MuonRefitTool::m_addAll
Gaudi::Property< bool > m_addAll
Definition: MuonRefitTool.h:103
MuonEDMPrinterTool.h
Muon::MuonRefitTool::m_errorStrategyBIS78
MuonDriftCircleErrorStrategy m_errorStrategyBIS78
Definition: MuonRefitTool.h:117
SegmentFinder.h
Muon::MuonRefitTool::State::originalState
const Trk::TrackStateOnSurface * originalState
Definition: MuonRefitTool.h:67
Muon::MuonRefitTool::m_failedOutlierRemoval
std::atomic< unsigned int > m_failedOutlierRemoval
Definition: MuonRefitTool.h:130
Muon::IMuonRefitTool::Settings
Definition: IMuonRefitTool.h:21
Muon::MuonRefitTool::m_addTwo
Gaudi::Property< bool > m_addTwo
Definition: MuonRefitTool.h:106
IMuonCompetingClustersOnTrackCreator.h
Muon::MuonRefitTool::State::State
State()=default
IExtrapolator.h
DCSLFitter.h
Muon::MuonRefitTool
Definition: MuonRefitTool.h:34
Muon::MuonRefitTool::m_BME_station
int m_BME_station
Definition: MuonRefitTool.h:137
Muon::MuonRefitTool::m_deweightEE
Gaudi::Property< bool > m_deweightEE
Definition: MuonRefitTool.h:108
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonRefitTool::m_failedErrorUpdate
std::atomic< unsigned int > m_failedErrorUpdate
Definition: MuonRefitTool.h:131
Muon::MuonRefitTool::m_deweightTwoStationTracks
Gaudi::Property< bool > m_deweightTwoStationTracks
Definition: MuonRefitTool.h:113
Muon::MuonRefitTool::m_errorStrategyBarEnd
MuonDriftCircleErrorStrategy m_errorStrategyBarEnd
Definition: MuonRefitTool.h:120
Muon::MuonRefitTool::m_failedRefit
std::atomic< unsigned int > m_failedRefit
Definition: MuonRefitTool.h:132
Muon::MuonRefitTool::m_ngoodRefits
std::atomic< unsigned int > m_ngoodRefits
Definition: MuonRefitTool.h:129
Muon::MuonRefitTool::removeOutliers
std::unique_ptr< Trk::Track > removeOutliers(const Trk::Track &track, const Settings &settings) const
Definition: MuonRefitTool.cxx:1203
Muon::MuonRefitTool::m_muonExtrapolator
ToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: MuonRefitTool.h:82
Muon::MuonRefitTool::updateAlignmentErrors
std::unique_ptr< Trk::Track > updateAlignmentErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
Definition: MuonRefitTool.cxx:221
Muon::MuonRefitTool::m_mdtRotCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
Definition: MuonRefitTool.h:83
Muon::IMuonRefitTool
The IMuonSegmentMaker is a pure virtual interface for tools to find tracks starting from MuonSegmentC...
Definition: IMuonRefitTool.h:19
Muon::MuonRefitTool::State::newState
const Trk::TrackStateOnSurface * newState
Definition: MuonRefitTool.h:68
Muon::MuonRefitTool::m_muonErrorStrategy
MuonDriftCircleErrorStrategy m_muonErrorStrategy
Definition: MuonRefitTool.h:124
Muon::MuonRefitTool::m_errorStrategyBXE
MuonDriftCircleErrorStrategy m_errorStrategyBXE
Definition: MuonRefitTool.h:118
Muon::MuonRefitTool::m_errorStrategyEE
MuonDriftCircleErrorStrategy m_errorStrategyEE
Definition: MuonRefitTool.h:116
Muon::MuonRefitTool::m_alignmentErrors
Gaudi::Property< bool > m_alignmentErrors
Definition: MuonRefitTool.h:101
Muon::MuonRefitTool::m_fixedError
Gaudi::Property< double > m_fixedError
Definition: MuonRefitTool.h:93
Muon::MuonRefitTool::m_errorStrategyEEL1C05
MuonDriftCircleErrorStrategy m_errorStrategyEEL1C05
Definition: MuonRefitTool.h:119
Muon::MuonRefitTool::m_simpleAEOTs
Gaudi::Property< bool > m_simpleAEOTs
Definition: MuonRefitTool.h:102
Muon::MuonRefitTool::m_alignmentDeltaError
Gaudi::Property< float > m_alignmentDeltaError
Definition: MuonRefitTool.h:98
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuonRefitTool::finalize
virtual StatusCode finalize() override
Definition: MuonRefitTool.cxx:135
Muon::MuonRefitTool::initialize
virtual StatusCode initialize() override
Definition: MuonRefitTool.cxx:45
Muon::MuonRefitTool::m_nrefits
std::atomic< unsigned int > m_nrefits
Definition: MuonRefitTool.h:128
AthAlgTool.h
Muon::MuonRefitTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonRefitTool.h:75
Muon::MuonRefitTool::m_compClusterCreator
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compClusterCreator
Definition: MuonRefitTool.h:85
Muon::MuonRefitTool::m_errorStrategy
MuonDriftCircleErrorStrategy m_errorStrategy
Definition: MuonRefitTool.h:123
Muon::MuonRefitTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonRefitTool.h:73
Trk::ParametersBase
Definition: ParametersBase.h:55
Muon::MuonRefitTool::m_alignmentDelta
Gaudi::Property< float > m_alignmentDelta
Definition: MuonRefitTool.h:96
Muon::MuonRefitTool::m_minMuonMomentum
Gaudi::Property< double > m_minMuonMomentum
Definition: MuonRefitTool.h:92
Muon::MuonRefitTool::m_deweightBIS78
Gaudi::Property< bool > m_deweightBIS78
Definition: MuonRefitTool.h:109
Muon::MuonRefitTool::m_deweightEEL1C05
Gaudi::Property< bool > m_deweightEEL1C05
Definition: MuonRefitTool.h:112
Muon::MuonRefitTool::makeAEOTs
std::unique_ptr< Trk::Track > makeAEOTs(const Trk::Track &track) const
Definition: MuonRefitTool.cxx:232
IMuonEDMHelperSvc.h
Muon::MuonRefitTool::m_alignmentAngleError
Gaudi::Property< float > m_alignmentAngleError
Definition: MuonRefitTool.h:99
Muon::MuonRefitTool::m_errorStrategyBEE
MuonDriftCircleErrorStrategy m_errorStrategyBEE
Definition: MuonRefitTool.h:115
Muon::MuonRefitTool::m_failedExtrapolationMuonEntry
std::atomic< unsigned int > m_failedExtrapolationMuonEntry
Definition: MuonRefitTool.h:133
Muon::MuonRefitTool::m_addInner
Gaudi::Property< bool > m_addInner
Definition: MuonRefitTool.h:104
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
Muon::MuonRefitTool::m_muonEntryTrackExtrapolator
ToolHandle< Muon::IMuonTrackExtrapolationTool > m_muonEntryTrackExtrapolator
Definition: MuonRefitTool.h:88
IMdtDriftCircleOnTrackCreator.h
Muon::MuonRefitTool::~MuonRefitTool
virtual ~MuonRefitTool()=default
Muon::MuonRefitTool::m_addMiddle
Gaudi::Property< bool > m_addMiddle
Definition: MuonRefitTool.h:105
Muon::MuonRefitTool::m_finderDebugLevel
Gaudi::Property< int > m_finderDebugLevel
Definition: MuonRefitTool.h:90
Muon::MuonRefitTool::State
Definition: MuonRefitTool.h:65
Muon::MuonRefitTool::m_t0Fitter
ToolHandle< IDCSLFitProvider > m_t0Fitter
Definition: MuonRefitTool.h:87
Muon::MuonRefitTool::m_trackFitter
ToolHandle< Trk::ITrackFitter > m_trackFitter
Definition: MuonRefitTool.h:81
Muon::MuonRefitTool::createPerigee
std::unique_ptr< Trk::Perigee > createPerigee(const Trk::TrackParameters &pars, const EventContext &ctx) const
Definition: MuonRefitTool.cxx:1477
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Muon::MuonRefitTool::updateMdtErrors
std::unique_ptr< Trk::Track > updateMdtErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
Definition: MuonRefitTool.cxx:980
IDCSLFitProvider.h
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonRefitTool::makeSimpleAEOTs
std::unique_ptr< Trk::Track > makeSimpleAEOTs(const Trk::Track &track) const
Definition: MuonRefitTool.cxx:479
Muon::MuonRefitTool::m_alignErrorTool
ToolHandle< Trk::ITrkAlignmentDeviationTool > m_alignErrorTool
Does not provide any method with EventContext yet.
Definition: MuonRefitTool.h:78
Muon::MuonRefitTool::refit
std::unique_ptr< Trk::Track > refit(const Trk::Track &track, const EventContext &ctx, const Settings *settings) const override
refit a track
Definition: MuonRefitTool.cxx:146
ITrackFitter.h
Muon::MuonRefitTool::m_errorStrategyTwoStations
MuonDriftCircleErrorStrategy m_errorStrategyTwoStations
Definition: MuonRefitTool.h:122
ITrkAlignmentDeviationTool.h
IMuonTrackExtrapolationTool.h
Muon::MuonRefitTool::MuonRefitTool
MuonRefitTool(const std::string &ty, const std::string &na, const IInterface *pa)
Definition: MuonRefitTool.cxx:30
IMuonIdHelperSvc.h
ServiceHandle
Definition: ClusterMakerTool.h:37
Muon::MuonRefitTool::m_flagT0FitRange
Gaudi::Property< double > m_flagT0FitRange
Definition: MuonRefitTool.h:94