ATLAS Offline Software
CombinedMuonTrackFitter.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // CombinedMuonTrackFitter
7 // AlgTool gathering material effects along a combined muon track, in
8 // particular the TSOS'es representing the calorimeter energy deposit and
9 // Coulomb scattering.
10 // The resulting track is fitted at the IP
11 //
13 #ifndef MUIDTRACKBUILDER_COMBINEDMUONTRACKFITTER_H
14 #define MUIDTRACKBUILDER_COMBINEDMUONTRACKFITTER_H
15 
16 #include <atomic>
17 
19 #include "GaudiKernel/ServiceHandle.h"
20 #include "GaudiKernel/ToolHandle.h"
36 #include "TrkTrack/TrackInfo.h"
39 
40 
41 namespace Rec {
42 
44  public:
45  CombinedMuonTrackFitter(const std::string& type, const std::string& name, const IInterface* parent);
47 
48  virtual StatusCode initialize() override;
49  virtual StatusCode finalize() override;
50 
51  /*refit a track */
52  virtual std::unique_ptr<Trk::Track> fit(const EventContext& ctx, const Trk::Track& track, const Trk::RunOutlierRemoval runOutlier,
53  const Trk::ParticleHypothesis particleHypothesis) const override;
54  protected:
57  std::unique_ptr<Trk::Track> fit(const EventContext& ctx, const Trk::MeasurementSet& measurementSet,
58  const Trk::TrackParameters& perigeeStartValue, const Trk::RunOutlierRemoval runOutlier,
59  const Trk::ParticleHypothesis particleHypothesis) const;
60 
63  std::unique_ptr<Trk::Track> fit(const EventContext& ctx, const Trk::Track& indetTrack, Trk::Track& extrapolatedTrack,
64  const Trk::RunOutlierRemoval runOutlier,
65  const Trk::ParticleHypothesis particleHypothesis) const;
66 
67  double normalizedChi2(const Trk::Track& track) const;
68 
69 
70  bool checkTrack(std::string_view txt, const Trk::Track* newTrack) const;
71 
72 
73  unsigned int countAEOTs(const Trk::Track& track, const std::string& txt) const;
74 
75  bool loadMagneticField(const EventContext& ctx, MagField::AtlasFieldCache& field_cache) const;
76 
77  private:
78 
79  bool optimizeErrors(const EventContext& ctx, Trk::Track& track) const;
80 
81  // helpers, managers, tools
82  ToolHandle<Muon::IMuonTrackCleaner> m_cleaner{
83  this,
84  "Cleaner",
85  "Muon::MuonTrackCleaner/MuidTrackCleaner",
86  };
87  ToolHandle<Trk::ITrackFitter> m_fitter{
88  this,
89  "Fitter",
90  "Trk::iPatFitter/iPatFitter",
91  }; // curved track fitter
92  ToolHandle<Trk::ITrackFitter> m_fitterSL{
93  this,
94  "SLFitter",
95  "Trk::iPatFitter/iPatSLFitter",
96  }; // straight line fitter
97 
98  protected:
99  ToolHandle<Rec::IMuidCaloTrackStateOnSurface> m_caloTSOS{
100  this,
101  "CaloTSOS",
102  "",
103  };
104  ToolHandle<Muon::IMuonErrorOptimisationTool> m_muonErrorOptimizer{
105  this,
106  "MuonErrorOptimizer",
107  "",
108  };
109  PublicToolHandle<Muon::MuonEDMPrinterTool> m_printer{
110  this,
111  "Printer",
112  "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
113  };
114  ToolHandle<Rec::IMuonTrackQuery> m_trackQuery{
115  this,
116  "TrackQuery",
117  "Rec::MuonTrackQuery/MuonTrackQuery",
118  };
119  ToolHandle<Trk::ITrackSummaryTool> m_trackSummary{
120  this,
121  "TrackSummaryTool",
122  "Trk::TrackSummaryTool/MuidTrackSummaryTool",
123  };
124  ToolHandle<Trk::ITrkMaterialProviderTool> m_materialUpdator{
125  this,
126  "CaloMaterialProvider",
127  "",
128  };
129  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
130 
131  private:
132  // // Read handle for conditions object to get the field cache
133  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey{this, "AtlasFieldCacheCondObj", "fieldCondObj",
134  "Name of the Magnetic Field conditions object key"};
135 
136  ServiceHandle<Trk::ITrackingVolumesSvc> m_trackingVolumesSvc{this, "TrackingVolumesSvc", "TrackingVolumesSvc/TrackingVolumesSvc"};
137 
138 
139  Gaudi::Property<bool> m_allowCleanerVeto{this, "AllowCleanerVeto", true};
140  Gaudi::Property<unsigned> m_maxWarnings{this, "MaxNumberOfWarnings", 10,
141  "Maximum number of permitted WARNING messages per message type."};
142 
143  protected:
144  Gaudi::Property<double> m_badFitChi2{this, "BadFitChi2", 2.5};
145 
146  Gaudi::Property<double> m_zECToroid{this, "zECToroid", 10. * Gaudi::Units::meter};
147  Gaudi::Property<bool> m_updateWithCaloTG{this, "UpdateWithCaloTG", false};
148  Gaudi::Property<bool> m_useCaloTG{this, "UseCaloTG", false};
149 
150  // // constants
151  std::unique_ptr<const Trk::Volume> m_indetVolume{nullptr};
152  std::unique_ptr<const Trk::Volume> m_calorimeterVolume{nullptr};
153 
154  // // count warnings
155  std::unique_ptr<MessageHelper> m_messageHelper{std::make_unique<MessageHelper>(*this, 50)};
156 
157  private:
158  mutable std::atomic_uint m_countCombinedCleanerVeto{0};
159  mutable std::atomic_uint m_countExtensionCleanerVeto{0};
160  mutable std::atomic_uint m_countStandaloneCleanerVeto{0};
161  }; // end of class CombinedMuonTrackFitter
162 
163 } // end of namespace Rec
164 
165 #endif // MUIDTRACKBUILDER_COMBINEDMUONTRACKBUILDER_H
ITrackSummaryTool.h
IMuonTrackCleaner.h
TrackParameters.h
IMuidCaloTrackStateOnSurface.h
IMuonTrackQuery.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
MuonEDMPrinterTool.h
Rec::CombinedMuonTrackFitter::m_trackingVolumesSvc
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
Definition: CombinedMuonTrackFitter.h:136
AtlasFieldCacheCondObj.h
Rec::CombinedMuonTrackFitter::m_messageHelper
std::unique_ptr< MessageHelper > m_messageHelper
Definition: CombinedMuonTrackFitter.h:155
Rec::CombinedMuonTrackFitter::fit
virtual std::unique_ptr< Trk::Track > fit(const EventContext &ctx, const Trk::Track &track, const Trk::RunOutlierRemoval runOutlier, const Trk::ParticleHypothesis particleHypothesis) const override
Definition: CombinedMuonTrackFitter.cxx:154
Rec::CombinedMuonTrackFitter::m_updateWithCaloTG
Gaudi::Property< bool > m_updateWithCaloTG
Definition: CombinedMuonTrackFitter.h:147
Rec::CombinedMuonTrackFitter::m_badFitChi2
Gaudi::Property< double > m_badFitChi2
Definition: CombinedMuonTrackFitter.h:144
Rec::CombinedMuonTrackFitter::m_muonErrorOptimizer
ToolHandle< Muon::IMuonErrorOptimisationTool > m_muonErrorOptimizer
Definition: CombinedMuonTrackFitter.h:104
Rec::CombinedMuonTrackFitter::initialize
virtual StatusCode initialize() override
Definition: CombinedMuonTrackFitter.cxx:56
ITrkMaterialProviderTool.h
Trk::RunOutlierRemoval
bool RunOutlierRemoval
switch to toggle quality processing after fit
Definition: FitterTypes.h:22
MessageHelper.h
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Rec::CombinedMuonTrackFitter::checkTrack
bool checkTrack(std::string_view txt, const Trk::Track *newTrack) const
Definition: CombinedMuonTrackFitter.cxx:603
Rec::CombinedMuonTrackFitter::CombinedMuonTrackFitter
CombinedMuonTrackFitter(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CombinedMuonTrackFitter.cxx:49
python.SystemOfUnits.meter
int meter
Definition: SystemOfUnits.py:61
Rec::CombinedMuonTrackFitter::loadMagneticField
bool loadMagneticField(const EventContext &ctx, MagField::AtlasFieldCache &field_cache) const
Definition: CombinedMuonTrackFitter.cxx:537
IMuonErrorOptimisationTool.h
Rec::CombinedMuonTrackFitter
Definition: CombinedMuonTrackFitter.h:43
Rec
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
Definition: FakeTrackBuilder.h:10
Rec::CombinedMuonTrackFitter::m_trackSummary
ToolHandle< Trk::ITrackSummaryTool > m_trackSummary
Definition: CombinedMuonTrackFitter.h:119
Rec::CombinedMuonTrackFitter::m_indetVolume
std::unique_ptr< const Trk::Volume > m_indetVolume
Definition: CombinedMuonTrackFitter.h:151
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Rec::CombinedMuonTrackFitter::m_countExtensionCleanerVeto
std::atomic_uint m_countExtensionCleanerVeto
Definition: CombinedMuonTrackFitter.h:159
Rec::CombinedMuonTrackFitter::m_fitterSL
ToolHandle< Trk::ITrackFitter > m_fitterSL
Definition: CombinedMuonTrackFitter.h:92
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Rec::CombinedMuonTrackFitter::m_calorimeterVolume
std::unique_ptr< const Trk::Volume > m_calorimeterVolume
Definition: CombinedMuonTrackFitter.h:152
Rec::CombinedMuonTrackFitter::m_trackQuery
ToolHandle< Rec::IMuonTrackQuery > m_trackQuery
Definition: CombinedMuonTrackFitter.h:114
Trk::ParametersBase
Definition: ParametersBase.h:55
Rec::CombinedMuonTrackFitter::m_caloTSOS
ToolHandle< Rec::IMuidCaloTrackStateOnSurface > m_caloTSOS
Definition: CombinedMuonTrackFitter.h:99
Rec::ICombinedMuonTrackFitter
Interface ID for ICombinedMuonTrackFitter.
Definition: ICombinedMuonTrackFitter.h:35
Rec::CombinedMuonTrackFitter::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: CombinedMuonTrackFitter.h:133
Rec::CombinedMuonTrackFitter::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CombinedMuonTrackFitter.h:129
ReadCondHandleKey.h
Trk::MeasurementSet
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition: FitterTypes.h:30
Rec::CombinedMuonTrackFitter::m_allowCleanerVeto
Gaudi::Property< bool > m_allowCleanerVeto
Definition: CombinedMuonTrackFitter.h:139
IMuonEDMHelperSvc.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrackInfo.h
Rec::CombinedMuonTrackFitter::optimizeErrors
bool optimizeErrors(const EventContext &ctx, Trk::Track &track) const
Definition: CombinedMuonTrackFitter.cxx:546
Rec::CombinedMuonTrackFitter::m_countCombinedCleanerVeto
std::atomic_uint m_countCombinedCleanerVeto
Definition: CombinedMuonTrackFitter.h:158
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
Rec::CombinedMuonTrackFitter::m_zECToroid
Gaudi::Property< double > m_zECToroid
Definition: CombinedMuonTrackFitter.h:146
Rec::CombinedMuonTrackFitter::m_fitter
ToolHandle< Trk::ITrackFitter > m_fitter
Definition: CombinedMuonTrackFitter.h:87
Rec::CombinedMuonTrackFitter::finalize
virtual StatusCode finalize() override
Definition: CombinedMuonTrackFitter.cxx:145
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Rec::CombinedMuonTrackFitter::m_countStandaloneCleanerVeto
std::atomic_uint m_countStandaloneCleanerVeto
Definition: CombinedMuonTrackFitter.h:160
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
Rec::CombinedMuonTrackFitter::~CombinedMuonTrackFitter
virtual ~CombinedMuonTrackFitter()
TrackingGeometry.h
Rec::CombinedMuonTrackFitter::m_materialUpdator
ToolHandle< Trk::ITrkMaterialProviderTool > m_materialUpdator
Definition: CombinedMuonTrackFitter.h:124
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
Rec::CombinedMuonTrackFitter::m_printer
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
Definition: CombinedMuonTrackFitter.h:109
ITrackingVolumesSvc.h
Rec::CombinedMuonTrackFitter::normalizedChi2
double normalizedChi2(const Trk::Track &track) const
Definition: CombinedMuonTrackFitter.cxx:524
ITrackFitter.h
IMuonIdHelperSvc.h
Rec::CombinedMuonTrackFitter::countAEOTs
unsigned int countAEOTs(const Trk::Track &track, const std::string &txt) const
Definition: CombinedMuonTrackFitter.cxx:649
Rec::CombinedMuonTrackFitter::m_useCaloTG
Gaudi::Property< bool > m_useCaloTG
Definition: CombinedMuonTrackFitter.h:148
ServiceHandle< Muon::IMuonIdHelperSvc >
Rec::CombinedMuonTrackFitter::m_maxWarnings
Gaudi::Property< unsigned > m_maxWarnings
Definition: CombinedMuonTrackFitter.h:140
Rec::CombinedMuonTrackFitter::m_cleaner
ToolHandle< Muon::IMuonTrackCleaner > m_cleaner
Definition: CombinedMuonTrackFitter.h:82
ICombinedMuonTrackFitter.h