ATLAS Offline Software
TrkMaterialProviderTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 namespace Trk {
40  class Surface;
41 }
42 
43 namespace Rec {
44  class CaloMeas;
45 }
46 
47 class AtlasDetectorID;
48 
51 namespace Trk{
52 
53  class TrkMaterialProviderTool final: public AthAlgTool,
54  virtual public Trk::ITrkMaterialProviderTool {
55 
56  public:
57 
59  TrkMaterialProviderTool(const std::string&,const std::string&,const IInterface*);
60 
62  virtual ~TrkMaterialProviderTool() = default;
63 
68 
70  void updateCaloTSOS(const Trk::Track& idTrack, Trk::Track& extrapolatedTrack) const;
71 
73  void updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParamaters=nullptr) const;
74 
76  void getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots) const;
77 
79  std::vector<const Trk::TrackStateOnSurface*>*
80  getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track &muonTrack, const Trk::TrackParameters* parms=nullptr) const;
81 
84 
85  private:
86 
89  getCaloTSOS (const Trk::TrackParameters& parm,
90  const Trk::Track& muonTrack,
91  const Trk::Surface& surf,
93  Trk::ParticleHypothesis mateffects,
94  double& Eloss,
95  double& X0ScaleMS,
96  double& ElossScaleMS,
97  const Trk::TrackParameters* parms=nullptr,
98  bool boundaryCheck=false,
99  bool removeOoC=false) const;
100 
102  const Trk::TrackStateOnSurface* getCaloExitTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const;
103 
105  const Trk::TrackStateOnSurface* getCaloEntryTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const;
106 
108  void removeOutOfCalo(std::vector<const Trk::TrackStateOnSurface*>* caloTSOS) const;
110  void removeMS(std::vector<const Trk::TrackStateOnSurface*>* caloTSOS) const;
111 
113  static void updateVector(Trk::TrackStates* inputTSOS,
116  Trk::TrackStates* caloTSOS) ;
117 
119  void updateVectorMS(Trk::TrackStates* inputTSOS,
120  const Trk::TrackStates::iterator& firstMS,
121  double X0ScaleMS, double ElossScaleMS) const;
122 
123  //* Helper to indentify detector volume**/
124  unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface* m) const;
125 
126  /* Helper to delete TSOS (data)vectors
127  Note that DataVector ownership is taken and elements deleted!*/
128  static void deleteTSOS(const std::vector<const Trk::TrackStateOnSurface*>* vecTSOS) ;
129  static void deleteTSOS(Trk::TrackStates* vecTSOS) ;
130 
131  //** Helper to printout TSOS details*/
132  void printTSOS(const Trk::TrackStateOnSurface* m, const std::string& tag) const;
133 
136  modifyTSOSvector(const std::vector<const Trk::TrackStateOnSurface*>* matvec,
137  double scaleX0,
138  double scaleEloss,
139  bool reposition,
140  bool aggregate,
141  bool updateEloss,
142  double caloEnergy,
143  double caloEnergyError,
144  double fsrCaloEnergy,
145  double pCaloEntry,
146  double momentumError,
147  double& Eloss_tot,
148  bool useMeasuredEnergy=true,
149  double mopEloss=0., double meanElossIoni=0., double sigmaElossIoni=0.) const;
150 
152  void getMopAndIoniEnergyLoss(const std::vector<const Trk::TrackStateOnSurface*>* matvec,
153  double pCaloEntry,
154  double scaleEloss,
155  double& mopEloss,
156  double& meanElossIoni,
157  double& sigmaElossIoni) const;
158 
160  bool isIsolatedTrack(double eta, double phi) const;
161 
163  double getCaloMeasuredEnergy(double eta, double phi,
164  double mopEloss,
165  double meanElossIoni,
166  double& fsrCaloEnergy) const;
167 
169  double getFinalMeasuredEnergy(Rec::CaloMeas* caloMeas,
170  double mopEloss,
171  double meanElossIoni,
172  double eta,
173  double& fsrCaloEnergy) const;
174 
175  void throwFailedToGetTrackingGeomtry() const;
176  const TrackingGeometry* retrieveTrackingGeometry(const EventContext& ctx) const {
177 
178  if (m_trackingGeometryReadKey.key().empty()) {
179  return m_trackingGeometrySvc->trackingGeometry();
180  }
182  ctx);
183  if (!handle.isValid()) {
185  }
186  return handle.cptr();
187  }
188 
189  PublicToolHandle<Trk::IExtrapolator> m_muonExtrapolator
190  {this,"Extrapolator","Trk::Extrapolator/AtlasExtrapolator",""};
191  PublicToolHandle<Trk::IEnergyLossUpdator> m_elossupdator
192  {this,"EnergyLossUpdator","Trk::EnergyLossUpdator/AtlasEnergyLossUpdator",""};
194  {this, "TrackingVolumeSvc", "TrackingVolumesSvc/TrackingVolumesSvc"};
195  ServiceHandle<ITrackingGeometrySvc> m_trackingGeometrySvc {this, "TrackingGeometrySvc", "", ""};
196 
198  {this, "TrackingGeometryReadKey", "", "Key of the TrackingGeometry conditions data."};
199 
200  ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
201  {this, "MultipleScatteringTool",
202  "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator"};
203 
204  ToolHandle<Rec::IMuidCaloEnergyMeas> m_caloMeasTool
205  {this, "CaloMeasTool", "Rec::MuidCaloEnergyMeas/MuidCaloEnergyMeas"};
206  ToolHandle<Rec::IMuidCaloEnergyParam> m_caloParamTool
207  {this, "CaloParamTool", "Rec::MuidCaloEnergyParam/MuidCaloEnergyParam"};
208  ToolHandle<Rec::IMuidTrackIsolation> m_trackIsolationTool
209  {this, "TrackIsolationTool", "Rec::MuidTrackIsolation/MuidTrackIsolation"};
210  ToolHandle<Rec::IMuonCaloEnergyTool> m_muonCaloEnergyTool {this,
211  "MuonCaloEnergyTool", ""};
212 
216 
217  // Read handle for conditions object to get the field cache
218  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj",
219  "Name of the Magnetic Field conditions object key"};
220 
225 
227  double m_paramPtCut;
231 
232  };
233 } // end namespace
234 
235 #endif // TrkMaterialProviderTool_H
IMuonCaloEnergyTool.h
Trk::TrkMaterialProviderTool::m_caloParamTool
ToolHandle< Rec::IMuidCaloEnergyParam > m_caloParamTool
Definition: TrkMaterialProviderTool.h:207
Trk::TrkMaterialProviderTool::m_paramPtCut
double m_paramPtCut
Definition: TrkMaterialProviderTool.h:227
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:1862
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::TrkMaterialProviderTool::m_aggregateTSOS
bool m_aggregateTSOS
Definition: TrkMaterialProviderTool.h:223
Trk::TrkMaterialProviderTool::finalize
StatusCode finalize()
AlgTool finalize method.
Definition: TrkMaterialProviderTool.cxx:125
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:194
Trk::TrkMaterialProviderTool::removeOutOfCalo
void removeOutOfCalo(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove MS and ID TSOS.
Definition: TrkMaterialProviderTool.cxx:1010
AtlasFieldCacheCondObj.h
Trk::TrkMaterialProviderTool::m_calorimeterVolume
const Trk::Volume * m_calorimeterVolume
Definition: TrkMaterialProviderTool.h:214
IEnergyLossUpdator.h
Trk::TrkMaterialProviderTool::m_trackingGeometrySvc
ServiceHandle< ITrackingGeometrySvc > m_trackingGeometrySvc
Definition: TrkMaterialProviderTool.h:195
Trk::TrkMaterialProviderTool::m_caloMeasTool
ToolHandle< Rec::IMuidCaloEnergyMeas > m_caloMeasTool
Definition: TrkMaterialProviderTool.h:205
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:1089
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:206
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:952
Trk::TrkMaterialProviderTool::m_repositionTSOS
bool m_repositionTSOS
Definition: TrkMaterialProviderTool.h:222
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:1059
Trk::TrkMaterialProviderTool::retrieveTrackingGeometry
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
Definition: TrkMaterialProviderTool.h:176
Trk::TrkMaterialProviderTool::m_useMuonCaloEnergyTool
bool m_useMuonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:229
ITrkMaterialProviderTool.h
Trk::TrkMaterialProviderTool::m_muonExtrapolator
PublicToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: TrkMaterialProviderTool.h:190
Trk::TrkMaterialProviderTool::m_overwriteElossParam
bool m_overwriteElossParam
Definition: TrkMaterialProviderTool.h:230
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:516
Track.h
IMuidTrackIsolation.h
Trk::TrkMaterialProviderTool::deleteTSOS
static void deleteTSOS(const std::vector< const Trk::TrackStateOnSurface * > *vecTSOS)
Definition: TrkMaterialProviderTool.cxx:1235
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:367
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Trk::TrkMaterialProviderTool::m_scattool
ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
Definition: TrkMaterialProviderTool.h:201
Trk::PropDirection
PropDirection
Definition: PropDirection.h:19
Trk::TrkMaterialProviderTool::getParamCaloELoss
CaloEnergy * getParamCaloELoss(Trk::Track *track) const
Retrieve a clone of the parametrised energy loss.
Definition: TrkMaterialProviderTool.cxx:917
Trk::TrkMaterialProviderTool::throwFailedToGetTrackingGeomtry
void throwFailedToGetTrackingGeomtry() const
Definition: TrkMaterialProviderTool.cxx:2074
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:1965
Trk::TrkMaterialProviderTool::m_useCaloEnergyMeasurement
bool m_useCaloEnergyMeasurement
Definition: TrkMaterialProviderTool.h:228
Trk::TrkMaterialProviderTool::isIsolatedTrack
bool isIsolatedTrack(double eta, double phi) const
Function to check isolation.
Definition: TrkMaterialProviderTool.cxx:1937
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:192
Trk::TrkMaterialProviderTool::m_muonCaloEnergyTool
ToolHandle< Rec::IMuonCaloEnergyTool > m_muonCaloEnergyTool
Definition: TrkMaterialProviderTool.h:210
AthAlgTool.h
Trk::TrkMaterialProviderTool::m_trackingGeometryReadKey
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
Definition: TrkMaterialProviderTool.h:198
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:1034
Trk::TrkMaterialProviderTool::m_applyTGScaling
bool m_applyTGScaling
Definition: TrkMaterialProviderTool.h:221
beamspotman.dir
string dir
Definition: beamspotman.py:623
ReadCondHandleKey.h
Trk::TrkMaterialProviderTool::m_maxNTracksIso
int m_maxNTracksIso
Definition: TrkMaterialProviderTool.h:226
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::m_indetVolume
const Trk::Volume * m_indetVolume
Definition: TrkMaterialProviderTool.h:215
Trk::TrkMaterialProviderTool::printTSOS
void printTSOS(const Trk::TrackStateOnSurface *m, const std::string &tag) const
Definition: TrkMaterialProviderTool.cxx:1254
SG::ReadCondHandleKey
Definition: ReadCondHandleKey.h:20
TrackingVolume.h
ITrackingGeometrySvc.h
Trk::TrkMaterialProviderTool::m_updateTSOS
bool m_updateTSOS
Definition: TrkMaterialProviderTool.h:224
Trk::TrkMaterialProviderTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TrkMaterialProviderTool.h:218
Trk::TrkMaterialProviderTool::initialize
StatusCode initialize()
AlgTool initailize method.
Definition: TrkMaterialProviderTool.cxx:68
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:1949
Trk::TrkMaterialProviderTool::m_DetID
const AtlasDetectorID * m_DetID
Definition: TrkMaterialProviderTool.h:213
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::TrkMaterialProviderTool::getVolumeByGeo
unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface *m) const
Definition: TrkMaterialProviderTool.cxx:1213
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
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:1301
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:75
Trk::Volume
Definition: Volume.h:35
Trk::TrkMaterialProviderTool
Definition: TrkMaterialProviderTool.h:54
Trk::TrkMaterialProviderTool::m_trackIsolationTool
ToolHandle< Rec::IMuidTrackIsolation > m_trackIsolationTool
Definition: TrkMaterialProviderTool.h:209
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:981
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:245
ServiceHandle< Trk::ITrackingVolumesSvc >
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67