ATLAS Offline Software
TrkMaterialProviderTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrkMaterialProviderTool_H
6 #define TrkMaterialProviderTool_H
7 
8 //#define protected public
11 #include "TrkTrack/Track.h"
12 
13 // Gaudi
15 #include "GaudiKernel/ServiceHandle.h"
16 #include "GaudiKernel/ToolHandle.h"
17 
18 #include "TrkSurfaces/Surface.h"
21 
30 // For magneticfield
32 
34 
38 
39 #include<memory>
40 
41 namespace Trk {
42  class Surface;
43 }
44 
45 namespace Rec {
46  class CaloMeas;
47 }
48 
49 class AtlasDetectorID;
50 
53 namespace Trk{
54 
56  virtual public Trk::ITrkMaterialProviderTool {
57 
58  public:
59 
61  TrkMaterialProviderTool(const std::string&,const std::string&,const IInterface*);
62 
64  virtual ~TrkMaterialProviderTool() = default;
65 
70 
72  void updateCaloTSOS(const Trk::Track& idTrack, Trk::Track& extrapolatedTrack) const;
73 
75  void updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParamaters=nullptr) const;
76 
78  void getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots) const;
79 
81  std::vector<const Trk::TrackStateOnSurface*>*
82  getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track &muonTrack, const Trk::TrackParameters* parms=nullptr) const;
83 
86 
87  private:
88 
91  getCaloTSOS (const Trk::TrackParameters& parm,
92  const Trk::Track& muonTrack,
93  const Trk::Surface& surf,
95  Trk::ParticleHypothesis mateffects,
96  double& Eloss,
97  double& X0ScaleMS,
98  double& ElossScaleMS,
99  const Trk::TrackParameters* parms=nullptr,
100  bool boundaryCheck=false,
101  bool removeOoC=false) const;
102 
104  const Trk::TrackStateOnSurface* getCaloExitTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const;
105 
107  const Trk::TrackStateOnSurface* getCaloEntryTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const;
108 
110  void removeOutOfCalo(std::vector<const Trk::TrackStateOnSurface*>* caloTSOS) const;
112  void removeMS(std::vector<const Trk::TrackStateOnSurface*>* caloTSOS) const;
113 
115  static void updateVector(Trk::TrackStates* inputTSOS,
118  Trk::TrackStates* caloTSOS) ;
119 
121  void updateVectorMS(Trk::TrackStates* inputTSOS,
122  const Trk::TrackStates::iterator& firstMS,
123  double X0ScaleMS, double ElossScaleMS) const;
124 
125  //* Helper to indentify detector volume**/
126  unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface* m) const;
127 
128  /* Helper to delete TSOS (data)vectors
129  Note that DataVector ownership is taken and elements deleted!*/
130  static void deleteTSOS(const std::vector<const Trk::TrackStateOnSurface*>* vecTSOS) ;
131  static void deleteTSOS(Trk::TrackStates* vecTSOS) ;
132 
133  //** Helper to printout TSOS details*/
134  void printTSOS(const Trk::TrackStateOnSurface* m, const std::string& tag) const;
135 
138  modifyTSOSvector(const std::vector<const Trk::TrackStateOnSurface*>* matvec,
139  double scaleX0,
140  double scaleEloss,
141  bool reposition,
142  bool aggregate,
143  bool updateEloss,
144  double caloEnergy,
145  double caloEnergyError,
146  double fsrCaloEnergy,
147  double pCaloEntry,
148  double momentumError,
149  double& Eloss_tot,
150  bool useMeasuredEnergy=true,
151  double mopEloss=0., double meanElossIoni=0., double sigmaElossIoni=0.) const;
152 
154  void getMopAndIoniEnergyLoss(const std::vector<const Trk::TrackStateOnSurface*>* matvec,
155  double pCaloEntry,
156  double scaleEloss,
157  double& mopEloss,
158  double& meanElossIoni,
159  double& sigmaElossIoni) const;
160 
162  bool isIsolatedTrack(double eta, double phi) const;
163 
165  double getCaloMeasuredEnergy(double eta, double phi,
166  double mopEloss,
167  double meanElossIoni,
168  double& fsrCaloEnergy) const;
169 
171  double getFinalMeasuredEnergy(Rec::CaloMeas* caloMeas,
172  double mopEloss,
173  double meanElossIoni,
174  double eta,
175  double& fsrCaloEnergy) const;
176 
177  void throwFailedToGetTrackingGeomtry() const;
178  const TrackingGeometry* retrieveTrackingGeometry(const EventContext& ctx) const {
179 
180  if (m_trackingGeometryReadKey.key().empty()) {
181  return m_trackingGeometrySvc->trackingGeometry();
182  }
184  ctx);
185  if (!handle.isValid()) {
187  }
188  return handle.cptr();
189  }
190 
191  PublicToolHandle<Trk::IExtrapolator> m_muonExtrapolator
192  {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""};
193  PublicToolHandle<Trk::IEnergyLossUpdator> m_elossupdator
194  {this,"EnergyLossUpdator","Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",""};
196  {this, "TrackingVolumeSvc", "Trk::TrackingVolumesSvc/TrackingVolumesSvc"};
197  ServiceHandle<ITrackingGeometrySvc> m_trackingGeometrySvc {this, "TrackingGeometrySvc", "", ""};
198 
200  {this, "TrackingGeometryReadKey", "", "Key of the TrackingGeometry conditions data."};
201 
202  ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
203  {this, "MultipleScatteringTool",
204  "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator"};
205 
206  ToolHandle<Rec::IMuidCaloEnergyMeas> m_caloMeasTool
207  {this, "CaloMeasTool", "Rec::MuidCaloEnergyMeas/MuidCaloEnergyMeas"};
208  ToolHandle<Rec::IMuidCaloEnergyParam> m_caloParamTool
209  {this, "CaloParamTool", "Rec::MuidCaloEnergyParam/MuidCaloEnergyParam"};
210  ToolHandle<Rec::IMuidTrackIsolation> m_trackIsolationTool
211  {this, "TrackIsolationTool", "Rec::MuidTrackIsolation/MuidTrackIsolation"};
212  ToolHandle<Rec::IMuonCaloEnergyTool> m_muonCaloEnergyTool {this,
213  "MuonCaloEnergyTool", ""};
214 
216  std::unique_ptr<Trk::Volume> m_calorimeterVolume;
217  std::unique_ptr<Trk::Volume> m_indetVolume;
218 
219  // Read handle for conditions object to get the field cache
220  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj",
221  "Name of the Magnetic Field conditions object key"};
222 
227 
229  double m_paramPtCut;
233 
234  };
235 } // end namespace
236 
237 #endif // TrkMaterialProviderTool_H
IMuonCaloEnergyTool.h
Trk::TrkMaterialProviderTool::m_caloParamTool
ToolHandle< Rec::IMuidCaloEnergyParam > m_caloParamTool
Definition: TrkMaterialProviderTool.h:209
Trk::TrkMaterialProviderTool::m_paramPtCut
double m_paramPtCut
Definition: TrkMaterialProviderTool.h:229
Trk::TrkMaterialProviderTool::getMopAndIoniEnergyLoss
void getMopAndIoniEnergyLoss(const std::vector< const Trk::TrackStateOnSurface * > *matvec, double pCaloEntry, double scaleEloss, double &mopEloss, double &meanElossIoni, double &sigmaElossIoni) const
Function to get mop and mean (ionization) energy loss.
Definition: TrkMaterialProviderTool.cxx:1860
Trk::TrkMaterialProviderTool::m_aggregateTSOS
bool m_aggregateTSOS
Definition: TrkMaterialProviderTool.h:225
Trk::TrkMaterialProviderTool::finalize
StatusCode finalize()
AlgTool finalize method.
Definition: TrkMaterialProviderTool.cxx:123
TrackParameters.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloEnergy
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition: CaloEnergy.h:28
Surface.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::TrkMaterialProviderTool::m_trackingVolumesSvc
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
Definition: TrkMaterialProviderTool.h:196
Trk::TrkMaterialProviderTool::removeOutOfCalo
void removeOutOfCalo(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove MS and ID TSOS.
Definition: TrkMaterialProviderTool.cxx:1008
AtlasFieldCacheCondObj.h
IEnergyLossUpdator.h
Trk::TrkMaterialProviderTool::m_trackingGeometrySvc
ServiceHandle< ITrackingGeometrySvc > m_trackingGeometrySvc
Definition: TrkMaterialProviderTool.h:197
Trk::TrkMaterialProviderTool::m_caloMeasTool
ToolHandle< Rec::IMuidCaloEnergyMeas > m_caloMeasTool
Definition: TrkMaterialProviderTool.h:207
Trk::TrkMaterialProviderTool::updateVectorMS
void updateVectorMS(Trk::TrackStates *inputTSOS, const Trk::TrackStates::iterator &firstMS, double X0ScaleMS, double ElossScaleMS) const
update the TSOS vector for the Muon Spectrometer applying X0 and Eloss scaling
Definition: TrkMaterialProviderTool.cxx:1087
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:210
Trk::TrkMaterialProviderTool::getCaloExitTSOS
const Trk::TrackStateOnSurface * getCaloExitTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get last calo TSOS with TP.
Definition: TrkMaterialProviderTool.cxx:950
Trk::TrkMaterialProviderTool::m_repositionTSOS
bool m_repositionTSOS
Definition: TrkMaterialProviderTool.h:224
IExtrapolator.h
Trk::TrkMaterialProviderTool::updateVector
static void updateVector(Trk::TrackStates *inputTSOS, Trk::TrackStates::iterator lastID, Trk::TrackStates::iterator firstMS, Trk::TrackStates *caloTSOS)
Helper to update entries in the vector.
Definition: TrkMaterialProviderTool.cxx:1057
Trk::TrkMaterialProviderTool::retrieveTrackingGeometry
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
Definition: TrkMaterialProviderTool.h:178
Trk::TrkMaterialProviderTool::m_useMuonCaloEnergyTool
bool m_useMuonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:231
ITrkMaterialProviderTool.h
Trk::TrkMaterialProviderTool::m_muonExtrapolator
PublicToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: TrkMaterialProviderTool.h:192
Trk::TrkMaterialProviderTool::m_overwriteElossParam
bool m_overwriteElossParam
Definition: TrkMaterialProviderTool.h:232
Trk::TrkMaterialProviderTool::getCaloTSOS
std::vector< const Trk::TrackStateOnSurface * > * getCaloTSOS(const Trk::TrackParameters &parm, const Trk::Track &muonTrack, const Trk::TrackParameters *parms=nullptr) const
Retrieve Calorimeter TSOS from TG and apply corrections.
Definition: TrkMaterialProviderTool.cxx:514
Track.h
IMuidTrackIsolation.h
Trk::TrkMaterialProviderTool::deleteTSOS
static void deleteTSOS(const std::vector< const Trk::TrackStateOnSurface * > *vecTSOS)
Definition: TrkMaterialProviderTool.cxx:1233
MagneticFieldProperties.h
Trk::TrkMaterialProviderTool::getCaloMEOT
void getCaloMEOT(const Trk::Track &idTrack, const Trk::Track &msTrack, std::vector< MaterialEffectsOnTrack > &calomeots) const
Get Calorimeter MEOT.
Definition: TrkMaterialProviderTool.cxx:365
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:28
Trk::TrkMaterialProviderTool::m_scattool
ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
Definition: TrkMaterialProviderTool.h:203
Trk::PropDirection
PropDirection
Definition: PropDirection.h:19
Trk::TrkMaterialProviderTool::m_indetVolume
std::unique_ptr< Trk::Volume > m_indetVolume
Definition: TrkMaterialProviderTool.h:217
Trk::TrkMaterialProviderTool::getParamCaloELoss
CaloEnergy * getParamCaloELoss(Trk::Track *track) const
Retrieve a clone of the parametrised energy loss.
Definition: TrkMaterialProviderTool.cxx:915
Trk::TrkMaterialProviderTool::throwFailedToGetTrackingGeomtry
void throwFailedToGetTrackingGeomtry() const
Definition: TrkMaterialProviderTool.cxx:2072
Trk::TrkMaterialProviderTool::getFinalMeasuredEnergy
double getFinalMeasuredEnergy(Rec::CaloMeas *caloMeas, double mopEloss, double meanElossIoni, double eta, double &fsrCaloEnergy) const
Function to get corrected (final) calorimeter measured energy loss.
Definition: TrkMaterialProviderTool.cxx:1963
Trk::TrkMaterialProviderTool::m_useCaloEnergyMeasurement
bool m_useCaloEnergyMeasurement
Definition: TrkMaterialProviderTool.h:230
Trk::TrkMaterialProviderTool::isIsolatedTrack
bool isIsolatedTrack(double eta, double phi) const
Function to check isolation.
Definition: TrkMaterialProviderTool.cxx:1935
Rec::CaloMeas
Definition: CaloMeas.h:19
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
Rec
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
Definition: FakeTrackBuilder.h:10
Trk::TrackingGeometry
Definition: TrackingGeometry.h:67
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::TrkMaterialProviderTool::m_elossupdator
PublicToolHandle< Trk::IEnergyLossUpdator > m_elossupdator
Definition: TrkMaterialProviderTool.h:194
Trk::TrkMaterialProviderTool::m_muonCaloEnergyTool
ToolHandle< Rec::IMuonCaloEnergyTool > m_muonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:212
AthAlgTool.h
Trk::TrkMaterialProviderTool::m_trackingGeometryReadKey
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
Definition: TrkMaterialProviderTool.h:200
Trk::ParametersBase
Definition: ParametersBase.h:55
DataVector< const Trk::TrackStateOnSurface >
Trk::TrkMaterialProviderTool::removeMS
void removeMS(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove only MS TSOS.
Definition: TrkMaterialProviderTool.cxx:1032
columnar::final
CM final
Definition: ColumnAccessor.h:106
Trk::TrkMaterialProviderTool::m_applyTGScaling
bool m_applyTGScaling
Definition: TrkMaterialProviderTool.h:223
beamspotman.dir
string dir
Definition: beamspotman.py:621
ReadCondHandleKey.h
Trk::TrkMaterialProviderTool::m_maxNTracksIso
int m_maxNTracksIso
Definition: TrkMaterialProviderTool.h:228
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
IMultipleScatteringUpdator.h
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
IMuidCaloEnergyParam.h
Trk::TrkMaterialProviderTool::~TrkMaterialProviderTool
virtual ~TrkMaterialProviderTool()=default
Virtual destructor.
Trk::TrkMaterialProviderTool::printTSOS
void printTSOS(const Trk::TrackStateOnSurface *m, const std::string &tag) const
Definition: TrkMaterialProviderTool.cxx:1252
SG::ReadCondHandleKey
Definition: ReadCondHandleKey.h:20
TrackingVolume.h
ITrackingGeometrySvc.h
Trk::TrkMaterialProviderTool::m_updateTSOS
bool m_updateTSOS
Definition: TrkMaterialProviderTool.h:226
Trk::TrkMaterialProviderTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TrkMaterialProviderTool.h:220
Trk::TrkMaterialProviderTool::m_calorimeterVolume
std::unique_ptr< Trk::Volume > m_calorimeterVolume
Definition: TrkMaterialProviderTool.h:216
Trk::TrkMaterialProviderTool::initialize
StatusCode initialize()
AlgTool initailize method.
Definition: TrkMaterialProviderTool.cxx:66
TrackingGeometry.h
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::TrkMaterialProviderTool::getCaloMeasuredEnergy
double getCaloMeasuredEnergy(double eta, double phi, double mopEloss, double meanElossIoni, double &fsrCaloEnergy) const
Function to get calorimeter measured energy loss.
Definition: TrkMaterialProviderTool.cxx:1947
Trk::TrkMaterialProviderTool::m_DetID
const AtlasDetectorID * m_DetID
Definition: TrkMaterialProviderTool.h:215
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
Trk::TrkMaterialProviderTool::getVolumeByGeo
unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface *m) const
Definition: TrkMaterialProviderTool.cxx:1211
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:23
AthAlgTool
Definition: AthAlgTool.h:26
Trk::TrkMaterialProviderTool::modifyTSOSvector
Trk::TrackStates * modifyTSOSvector(const std::vector< const Trk::TrackStateOnSurface * > *matvec, double scaleX0, double scaleEloss, bool reposition, bool aggregate, bool updateEloss, double caloEnergy, double caloEnergyError, double fsrCaloEnergy, double pCaloEntry, double momentumError, double &Eloss_tot, bool useMeasuredEnergy=true, double mopEloss=0., double meanElossIoni=0., double sigmaElossIoni=0.) const
Function to modify TSOS doing repositioning, aggregation and corrections.
Definition: TrkMaterialProviderTool.cxx:1299
Trk::TrkMaterialProviderTool::TrkMaterialProviderTool
TrkMaterialProviderTool(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
Definition: TrkMaterialProviderTool.cxx:39
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:79
Trk::TrkMaterialProviderTool
Definition: TrkMaterialProviderTool.h:56
Trk::TrkMaterialProviderTool::m_trackIsolationTool
ToolHandle< Rec::IMuidTrackIsolation > m_trackIsolationTool
Definition: TrkMaterialProviderTool.h:211
IMuidCaloEnergyMeas.h
ITrackingVolumesSvc.h
Trk::TrkMaterialProviderTool::getCaloEntryTSOS
const Trk::TrackStateOnSurface * getCaloEntryTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get first calo TSOS with TP.
Definition: TrkMaterialProviderTool.cxx:979
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
Trk::ITrkMaterialProviderTool
Interface for tool to add alignmenties to a global chi2 fit.
Definition: ITrkMaterialProviderTool.h:30
TrackStateOnSurface.h
Trk::TrkMaterialProviderTool::updateCaloTSOS
void updateCaloTSOS(const Trk::Track &idTrack, Trk::Track &extrapolatedTrack) const
Update Calorimeter TSOS from input ID and MS tracks.
Definition: TrkMaterialProviderTool.cxx:243
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
ServiceHandle< Trk::ITrackingVolumesSvc >
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:71