ATLAS Offline Software
Loading...
Searching...
No Matches
TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6// MaterialMapping.h, (c) ATLAS Detector software
8
9#ifndef TRKDETDESCRALGS_MATERIALMAPPING_H
10#define TRKDETDESCRALGS_MATERIALMAPPING_H
11
12// Athena & Gaudi includes
14#include "GaudiKernel/ServiceHandle.h"
15#include "GaudiKernel/ToolHandle.h"
18#include "TString.h"
19#include <fstream>
20#include <iostream>
21#include <map>
22#include <string>
23// TrkDetDescr Algs, Interfaces, Utils
27// TrkExtrapolation
29// TrkGeometry
34
35#ifdef TRKDETDESCR_MEMUSAGE
37#endif
38
39#ifndef UCHARCONV
40#define UCHARCONV
41#define ucharbin 0.00392157 // 1./double(1.*UCHAR_MAX)
42// int to unsigned char and vv
43#define uchar2uint(uchar) static_cast<unsigned int>(uchar)
44#define uint2uchar(unint) static_cast<unsigned char>(unint)
45// double to unsigned char and vv
46#define uchar2dfrac(uchar) double(uchar * ucharbin)
47#define dfrac2uchar(dfrac) lrint(dfrac* UCHAR_MAX)
48#endif
49
50class TTree;
51
52namespace Trk {
53
54class Layer;
55class TrackingVolume;
56class SurfaceMaterialRecord;
57class LayerMaterialMap;
58class Material;
59class MaterialProperties;
60class BinnedLayerMaterial;
61class CompressedLayerMaterial;
62
71
73{
74
75public:
78
80 StatusCode initialize();
81
83 StatusCode execute(const EventContext& ctx);
84
86 StatusCode finalize();
87
88private:
90 bool associateHit(const Trk::Layer& tvol,
91 const Amg::Vector3D& pos,
92 const Amg::Vector3D& layerHitPosition,
93 double stepl,
94 const Trk::Material& mat);
95
97 void registerVolume(const Trk::TrackingVolume& tvol, int lvl);
98
101 Trk::LayerMaterialMap* propSet);
102
104 void insertLayerMaterialRecord(const Trk::Layer& lay);
105
107 StatusCode handleTrackingGeometry();
108
109 const TrackingGeometry& trackingGeometry() const;
110
111 Gaudi::Property <bool> m_checkForEmptyHits{
112 this, "CheckForEmptyHits", true,
113 "use extrapoaltion engine to check for empty hits"};
114 ToolHandle<IExtrapolationEngine> m_extrapolationEngine{
115 this, "ExtrapolationEngine", "", "Extrapolation Engine"};
116
117 Gaudi::Property<std::string> m_mappingVolumeName{
118 this, "MappingVolumeName", "Atlas"};
120
123 this, "InputMaterialStepCollection", "MaterialStepRecords"};
125
127 Gaudi::Property<double> m_etaCutOff{this, "EtaCutOff", 6.0};
128 Gaudi::Property<int> m_etaSide{this, "EtaSide", 0};
129 Gaudi::Property<double> m_useLayerThickness{
130 this, "UseActualLayerThicknesss", false,
131 "use the actual layer thickness"};
132 Gaudi::Property<int> m_associationType{this, "MaterialAssociationType", 1};
133
134 ToolHandle<ILayerMaterialAnalyser> m_layerMaterialRecordAnalyser{
135 this, "LayerMaterialRecordAnalyser", "",
136 "Layer material analyser for the layer material record"};
137 ToolHandleArray<ILayerMaterialAnalyser> m_layerMaterialAnalysers{
138 this, "LayerMaterialAnalysers", {},
139 "Layer material analysers per creator (if wanted)"};
140 ToolHandleArray<ILayerMaterialCreator> m_layerMaterialCreators{
141 this, "LayerMaterialCreators", {}, "Layer material creators"};
142
144 Gaudi::Property<bool> m_mapMaterial{this, "MapMaterial", true};
145 ToolHandle<IMaterialMapper> m_materialMapper{
146 this, "MaterialMapper", "", "IMaterialMapper algTool" };
147 Gaudi::Property<bool> m_mapComposition{this, "MapComposition", false,
148 "map the composition of the material"};
149
152 this, "InputElementTable", "ElementTable", "input event table"};
153
154 // the material maps ordered with layer keys
155 std::map<const Layer*, LayerMaterialRecord>
157 std::map<const Layer*, bool>
161 double m_accumulatedRhoS = 0.;
162
163 // statistics for steps
164 size_t m_mapped = 0;
165 size_t m_unmapped = 0;
167
170 const EventContext& ctx) const
171 {
173 if (!handle.isValid()) {
174 ATH_MSG_FATAL("Could not load TrackingGeometry with name '"
175 << m_trackingGeometryReadKey.key() << "'. Aborting.");
177 }
178 return handle.cptr();
179 }
180
182 this,
183 "TrackingGeometryReadKey",
184 "",
185 "Key of the TrackingGeometry conditions data."
186 };
187
188#ifdef TRKDETDESCR_MEMUSAGE
189 MemoryLogger m_memoryLogger{};
190#endif
191};
192
193inline const Trk::TrackingGeometry&
195{
196 const Trk::TrackingGeometry* tracking_geometry =
197 retrieveTrackingGeometry(Gaudi::Hive::currentContext());
198 if (!tracking_geometry) {
199 ATH_MSG_FATAL("Did not get valid TrackingGeometry. Aborting.");
200 throw GaudiException("MaterialMapping",
201 "Problem with TrackingGeometry loading.",
202 StatusCode::FAILURE);
203 }
204 return *tracking_geometry;
205}
206}
207
208#endif
#define ATH_MSG_FATAL(x)
@ Material
Property holding a SG store/key/clid from which a ReadHandle is made.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Property holding a SG store/key/clid from which a ReadHandle is made.
This class extends the DataVector<Trk::LayerMaterialProperties> by an elementTable;.
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
A simple algorithm that throws random points through detector and associates them with the given/foun...
std::map< const Layer *, LayerMaterialRecord > m_layerRecords
this is the general record for the search
double m_accumulatedMaterialXX0
the accumulated material information
std::map< const Layer *, bool > m_layersRecordedPerEvent
these are the layers hit per event - for empty hit scaling
void registerVolume(const Trk::TrackingVolume &tvol, int lvl)
Output information with Level.
Gaudi::Property< double > m_etaCutOff
general steering
SG::ReadHandleKey< Trk::ElementTable > m_inputEventElementTable
StatusCode finalize()
standard Athena-Algorithm method
ToolHandleArray< ILayerMaterialAnalyser > m_layerMaterialAnalysers
Trk::ElementTable * m_elementTable
the accumulated element table
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
StatusCode initialize()
standard Athena-Algorithm method
Gaudi::Property< int > m_etaSide
needed for debugging: -1 negative | 0 all | 1 positive
SG::ReadHandleKey< MaterialStepCollection > m_inputMaterialStepCollection
output / input steering
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
StatusCode handleTrackingGeometry()
Retrieve the TrackingGeometry and its informations.
void assignLayerMaterialProperties(Trk::TrackingVolume &tvol, Trk::LayerMaterialMap *propSet)
create the LayerMaterialRecord *‍/
ToolHandleArray< ILayerMaterialCreator > m_layerMaterialCreators
StatusCode execute(const EventContext &ctx)
standard Athena-Algorithm method
bool associateHit(const Trk::Layer &tvol, const Amg::Vector3D &pos, const Amg::Vector3D &layerHitPosition, double stepl, const Trk::Material &mat)
Associate the Step to the Layer.
ToolHandle< ILayerMaterialAnalyser > m_layerMaterialRecordAnalyser
ToolHandle< IExtrapolationEngine > m_extrapolationEngine
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Gaudi::Property< bool > m_mapMaterial
Mapper and Inspector.
A common object to be contained by.
Definition Material.h:117
A small helper class looking at /proc/<PID>status.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.