ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialAllocator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6// MaterialAllocator.h
7// Header file for class MaterialAllocator
8//
9// (c) ATLAS Detector software
11
12#ifndef TRKIPATFITTER_MATERIALALLOCATOR_H
13#define TRKIPATFITTER_MATERIALALLOCATOR_H
14
15//<<<<<< INCLUDES a>>>>>>
16
17#include <memory>
18#include <mutex>
19
21#include "GaudiKernel/ServiceHandle.h"
22#include "GaudiKernel/ToolHandle.h"
34
35//<<<<<< CLASS DECLARATIONS >>>>>>
36
37class MessageHelper;
38namespace Trk {
39class FitMeasurement;
40class FitParameters;
41class IExtrapolator;
42class IIntersector;
43class TrackingVolume;
45class Volume;
46
50class MaterialAllocator : public AthAlgTool, virtual public IMaterialAllocator {
51 public:
52 // standard AlgTool methods
53 MaterialAllocator(const std::string& type, const std::string& name,
54 const IInterface* parent);
55 virtual ~MaterialAllocator() = default; // destructor
56
57 // standard Athena methods
58 virtual StatusCode initialize() override;
59 virtual StatusCode finalize() override;
60
61 // add leading material effects to track
62 virtual void addLeadingMaterial(std::vector<FitMeasurement*>& measurements,
63 ParticleHypothesis particleHypothesis,
64 FitParameters& fitParameters,
65 Garbage_t& garbage) const override;
66
67 // allocate material
68 virtual void allocateMaterial(std::vector<FitMeasurement*>& measurements,
69 ParticleHypothesis particleHypothesis,
70 FitParameters& fitParameters,
71 const TrackParameters& startParameters,
72 Garbage_t& garbage) const override;
73
74 // initialize scattering (needs to know X0 integral)
75 virtual void initializeScattering(
76 std::vector<FitMeasurement*>& measurements) const override;
77
78 // material TSOS between spectrometer entrance surface and parameters given in
79 // spectrometer */
80 virtual std::vector<const TrackStateOnSurface*>* leadingSpectrometerTSOS(
81 const TrackParameters& spectrometerParameters,
82 Garbage_t& garbage) const override;
83
84 // order measurements by distance from startPosition
85 virtual void orderMeasurements(std::vector<FitMeasurement*>& measurements,
86 Amg::Vector3D startDirection,
87 Amg::Vector3D startPosition) const override;
88
89 // has material been reallocated?
90 virtual bool reallocateMaterial(std::vector<FitMeasurement*>& measurements,
91 FitParameters& fitParameters,
92 Garbage_t& garbage) const override;
93
94 private:
95 // add material delimiters to control aggregation
97 std::vector<FitMeasurement*>& measurements) const;
98
99 // memory management
100 static void deleteMaterial(
101 const std::vector<const TrackStateOnSurface*>* material,
102 Garbage_t& garbage);
103
104 // extrapolateM wrapper
105 const std::vector<const TrackStateOnSurface*>* extrapolatedMaterial(
106 const ToolHandle<IExtrapolator>& extrapolator,
107 const TrackParameters& parameters, const Surface& surface,
108 PropDirection dir, const BoundaryCheck& boundsCheck,
109 ParticleHypothesis particleHypothesis, Garbage_t& garbage) const;
110
111 // allocate material in inner detector
112 void indetMaterial(std::vector<FitMeasurement*>& measurements,
113 ParticleHypothesis particleHypothesis,
114 const TrackParameters& startParameters,
115 Garbage_t& garbage) const;
116
117 // material aggregation
118 std::pair<FitMeasurement*, FitMeasurement*> materialAggregation(
119 const std::vector<const TrackStateOnSurface*>& material,
120 std::vector<FitMeasurement*>& measurements, double particleMass) const;
121
122 void materialAggregation(std::vector<FitMeasurement*>& measurements,
123 double particleMass) const;
124
125 // material measurement corresponding to TrackStateOnSurface
127 double outwardsEnergy,
128 double particleMass);
129
130 // VERBOSE print of measurements
131 void printMeasurements(std::vector<FitMeasurement*>& measurements) const;
132
133 // allocate material in spectrometer
134 void spectrometerMaterial(std::vector<FitMeasurement*>& measurements,
135 ParticleHypothesis particleHypothesis,
136 FitParameters& fitParameters,
137 const TrackParameters& startParameters,
138 Garbage_t& garbage) const;
139
140 // configurables (svc/tools then options)
141 ToolHandle<IExtrapolator> m_extrapolator{
142 this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator", ""};
143 ToolHandle<IIntersector> m_intersector{
144 this, "Intersector", "Trk::RungeKuttaIntersector/RungeKuttaIntersector",
145 ""};
147 this, "TrackingGeometrySvc","", ""};
149 this, "TrackingVolumesSvc", "Trk::TrackingVolumesSvc/TrackingVolumesSvc",
150 ""};
151 ToolHandle<IPropagator> m_stepPropagator{
152 this, "STEP_Propagator", "Trk::STEP_Propagator/AtlasSTEP_Propagator", ""};
153
155 this, "TrackingGeometryReadKey", "AtlasTrackingGeometry",
156 "Key of the TrackingGeometry conditions data."};
157
159 static const std::string vol_name = "MuonSpectrometerEntrance";
161 if (m_trackingGeometryReadKey.empty()) {
162 return m_trackingGeometrySvc->trackingGeometry()->trackingVolume(
163 vol_name);
164 }
166 m_trackingGeometryReadKey, Gaudi::Hive::currentContext());
167 if (!handle.isValid()) {
168 ATH_MSG_WARNING("Could not retrieve a valid tracking geometry");
169 return nullptr;
170 }
171 return handle.cptr()->trackingVolume(vol_name);
172 }
173
178
179 // configurable parameters and tolerances (for aggregation rules and Coulomb
180 // scattering constants)
187
188 // constants
191
193
194 // count warnings
195 std::unique_ptr<MessageHelper> m_messageHelper;
196
198 public:
199 bool operator()(const std::pair<double, FitMeasurement*>& x,
200 const std::pair<double, FitMeasurement*>& y) const {
201 return x.first < y.first;
202 }
203 };
204};
205
206} // namespace Trk
207
208#endif // TRKIPATFITTER_MATERIALALLOCATOR_H
#define ATH_MSG_WARNING(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const_pointer_type cptr()
The BoundaryCheck class allows to steer the way surface boundaries are used for inside/outside checks...
Interface class for the extrapolation AlgTool, it inherits from IAlgTool Detailed information about p...
Base class for Intersector AlgTools.
Base class for MaterialAllocator AlgTool.
std::vector< std::unique_ptr< const TrackStateOnSurface > > Garbage_t
magnetic field properties to steer the behavior of the extrapolation
bool operator()(const std::pair< double, FitMeasurement * > &x, const std::pair< double, FitMeasurement * > &y) const
void addSpectrometerDelimiters(std::vector< FitMeasurement * > &measurements) const
MaterialAllocator(const std::string &type, const std::string &name, const IInterface *parent)
const Trk::Volume * m_calorimeterVolume
ToolHandle< IPropagator > m_stepPropagator
ToolHandle< IIntersector > m_intersector
virtual void orderMeasurements(std::vector< FitMeasurement * > &measurements, Amg::Vector3D startDirection, Amg::Vector3D startPosition) const override
IMaterialAllocator interface: clear temporary TSOS.
virtual ~MaterialAllocator()=default
virtual StatusCode initialize() override
const Trk::TrackingVolume * getSpectrometerEntrance() const
void spectrometerMaterial(std::vector< FitMeasurement * > &measurements, ParticleHypothesis particleHypothesis, FitParameters &fitParameters, const TrackParameters &startParameters, Garbage_t &garbage) const
Trk::MagneticFieldProperties m_stepField
virtual bool reallocateMaterial(std::vector< FitMeasurement * > &measurements, FitParameters &fitParameters, Garbage_t &garbage) const override
IMaterialAllocator interface: has material been reallocated?
void printMeasurements(std::vector< FitMeasurement * > &measurements) const
ServiceHandle< ITrackingVolumesSvc > m_trackingVolumesSvc
const std::vector< const TrackStateOnSurface * > * extrapolatedMaterial(const ToolHandle< IExtrapolator > &extrapolator, const TrackParameters &parameters, const Surface &surface, PropDirection dir, const BoundaryCheck &boundsCheck, ParticleHypothesis particleHypothesis, Garbage_t &garbage) const
std::pair< FitMeasurement *, FitMeasurement * > materialAggregation(const std::vector< const TrackStateOnSurface * > &material, std::vector< FitMeasurement * > &measurements, double particleMass) const
void indetMaterial(std::vector< FitMeasurement * > &measurements, ParticleHypothesis particleHypothesis, const TrackParameters &startParameters, Garbage_t &garbage) const
virtual StatusCode finalize() override
const Trk::Volume * m_indetVolume
static void deleteMaterial(const std::vector< const TrackStateOnSurface * > *material, Garbage_t &garbage)
static FitMeasurement * measurementFromTSOS(const TrackStateOnSurface &tsos, double outwardsEnergy, double particleMass)
virtual void initializeScattering(std::vector< FitMeasurement * > &measurements) const override
IMaterialAllocator interface: initialize scattering (needs to know X0 integral)
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
virtual void addLeadingMaterial(std::vector< FitMeasurement * > &measurements, ParticleHypothesis particleHypothesis, FitParameters &fitParameters, Garbage_t &garbage) const override
IMaterialAllocator interface: add leading material effects to fit measurements and parameters.
ToolHandle< IExtrapolator > m_extrapolator
virtual void allocateMaterial(std::vector< FitMeasurement * > &measurements, ParticleHypothesis particleHypothesis, FitParameters &fitParameters, const TrackParameters &startParameters, Garbage_t &garbage) const override
IMaterialAllocator interface: allocate material.
ServiceHandle< ITrackingGeometrySvc > m_trackingGeometrySvc
virtual std::vector< const TrackStateOnSurface * > * leadingSpectrometerTSOS(const TrackParameters &spectrometerParameters, Garbage_t &garbage) const override
IMaterialAllocator interface: material TSOS between spectrometer entrance surface and parameters give...
std::unique_ptr< MessageHelper > m_messageHelper
Abstract Base Class for tracking surfaces.
represents the track state (measurement, material, fit parameters and quality) at a surface.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
@ x
Definition ParamDefs.h:55
@ y
Definition ParamDefs.h:56
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters