ATLAS Offline Software
Loading...
Searching...
No Matches
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
41namespace Trk {
42 class Surface;
43}
44
45namespace Rec {
46 class CaloMeas;
47}
48
49class AtlasDetectorID;
50
53namespace 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
67 StatusCode initialize();
69 StatusCode finalize();
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
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
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
233
234 };
235} // end namespace
236
237#endif // TrkMaterialProviderTool_H
Scalar eta() const
pseudorapidity method
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition CaloEnergy.h:28
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_pointer_type cptr()
Interface for tool to add alignmenties to a global chi2 fit.
Abstract Base Class for tracking surfaces.
represents the track state (measurement, material, fit parameters and quality) at a surface.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
static void deleteTSOS(const std::vector< const Trk::TrackStateOnSurface * > *vecTSOS)
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.
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
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.
double getCaloMeasuredEnergy(double eta, double phi, double mopEloss, double meanElossIoni, double &fsrCaloEnergy) const
Function to get calorimeter measured energy loss.
PublicToolHandle< Trk::IEnergyLossUpdator > m_elossupdator
static void updateVector(Trk::TrackStates *inputTSOS, Trk::TrackStates::iterator lastID, Trk::TrackStates::iterator firstMS, Trk::TrackStates *caloTSOS)
Helper to update entries in the vector.
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
TrkMaterialProviderTool(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
void printTSOS(const Trk::TrackStateOnSurface *m, const std::string &tag) const
ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
std::unique_ptr< Trk::Volume > m_calorimeterVolume
virtual ~TrkMaterialProviderTool()=default
Virtual destructor.
double getFinalMeasuredEnergy(Rec::CaloMeas *caloMeas, double mopEloss, double meanElossIoni, double eta, double &fsrCaloEnergy) const
Function to get corrected (final) calorimeter measured energy loss.
const Trk::TrackStateOnSurface * getCaloEntryTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get first calo TSOS with TP.
ServiceHandle< ITrackingGeometrySvc > m_trackingGeometrySvc
CaloEnergy * getParamCaloELoss(Trk::Track *track) const
Retrieve a clone of the parametrised energy loss.
void updateCaloTSOS(const Trk::Track &idTrack, Trk::Track &extrapolatedTrack) const
Update Calorimeter TSOS from input ID and MS tracks.
StatusCode finalize()
AlgTool finalize method.
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.
void removeMS(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove only MS TSOS.
ToolHandle< Rec::IMuidTrackIsolation > m_trackIsolationTool
const Trk::TrackStateOnSurface * getCaloExitTSOS(const std::vector< const Trk::TrackStateOnSurface * > *caloTSOS, Trk::PropDirection dir) const
Helper to get last calo TSOS with TP.
void getCaloMEOT(const Trk::Track &idTrack, const Trk::Track &msTrack, std::vector< MaterialEffectsOnTrack > &calomeots) const
Get Calorimeter MEOT.
bool isIsolatedTrack(double eta, double phi) const
Function to check isolation.
ToolHandle< Rec::IMuonCaloEnergyTool > m_muonCaloEnergyTool
PublicToolHandle< Trk::IExtrapolator > m_muonExtrapolator
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
void removeOutOfCalo(std::vector< const Trk::TrackStateOnSurface * > *caloTSOS) const
Helper to remove MS and ID TSOS.
ToolHandle< Rec::IMuidCaloEnergyParam > m_caloParamTool
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
ToolHandle< Rec::IMuidCaloEnergyMeas > m_caloMeasTool
unsigned int getVolumeByGeo(const Trk::TrackStateOnSurface *m) const
std::unique_ptr< Trk::Volume > m_indetVolume
StatusCode initialize()
AlgTool initailize method.
Gaudi Tools.
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
DataVector< const Trk::TrackStateOnSurface > TrackStates
@ phi
Definition ParamDefs.h:75
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters