ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialMapping.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 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"
20#include <fstream>
21#include <iostream>
22#include <map>
23#include <string>
24// TrkDetDescr Algs, Interfaces, Utils
28// TrkExtrapolation
30// TrkGeometry
32
33#ifdef TRKDETDESCR_MEMUSAGE
35#endif
36
37#ifndef UCHARCONV
38#define UCHARCONV
39#define ucharbin 0.00392157 // 1./double(1.*UCHAR_MAX)
40// int to unsigned char and vv
41#define uchar2uint(uchar) static_cast<unsigned int>(uchar)
42#define uint2uchar(unint) static_cast<unsigned char>(unint)
43// double to unsigned char and vv
44#define uchar2dfrac(uchar) double(uchar * ucharbin)
45#define dfrac2uchar(dfrac) lrint(dfrac* UCHAR_MAX)
46#endif
47
48class TTree;
49
50namespace Trk {
51
52class Layer;
53class TrackingVolume;
54class SurfaceMaterialRecord;
55class LayerMaterialRecord;
56class LayerMaterialMap;
57class Material;
58class MaterialProperties;
59class BinnedLayerMaterial;
60class CompressedLayerMaterial;
61class ElementTable;
62
71
73{
74
75public:
77 MaterialMapping(const std::string& name, ISvcLocator* pSvcLocator);
78
81
83 StatusCode initialize();
84
86 StatusCode execute();
87
89 StatusCode finalize();
90
91private:
93 bool associateHit(const Trk::Layer& tvol,
94 const Amg::Vector3D& pos,
95 const Amg::Vector3D& layerHitPosition,
96 double stepl,
97 const Trk::Material& mat);
98
100 void registerVolume(const Trk::TrackingVolume& tvol, int lvl);
101
104 Trk::LayerMaterialMap* propSet);
105
107 void insertLayerMaterialRecord(const Trk::Layer& lay);
108
110 StatusCode handleTrackingGeometry();
111
112 const TrackingGeometry& trackingGeometry() const;
113
114 bool
116 ToolHandle<IExtrapolationEngine> m_extrapolationEngine{
117 this,
118 "ExtrapolationEngine",
119 "",
120 "Extrapolation Engine"
121 };
122
125
129
135
136 ToolHandle<ILayerMaterialAnalyser> m_layerMaterialRecordAnalyser{
137 this,
138 "LayerMaterialRecordAnalyser",
139 "",
140 "Layer material analyser for the layer material record"
141 };
142 ToolHandleArray<ILayerMaterialAnalyser> m_layerMaterialAnalysers{
143 this,
144 "LayerMaterialAnalysers",
145 {},
146 "Layer material analysers per creator (if wanted)"
147 };
148 ToolHandleArray<ILayerMaterialCreator> m_layerMaterialCreators{
149 this,
150 "LayerMaterialCreators",
151 {},
152 "Layer material creators"
153 };
154
157 ToolHandle<IMaterialMapper> m_materialMapper{ this,
158 "MaterialMapper",
159 "",
160 "IMaterialMapper algTool" };
164
168
169 // the material maps ordered with layer keys
170 std::map<const Layer*, LayerMaterialRecord>
172 std::map<const Layer*, bool>
177
178 // statistics for steps
179 size_t m_mapped;
182
184
187 const EventContext& ctx) const
188 {
190 if (!handle.isValid()) {
191 ATH_MSG_FATAL("Could not load TrackingGeometry with name '"
192 << m_trackingGeometryReadKey.key() << "'. Aborting.");
194 }
195 return handle.cptr();
196 }
197
199 this,
200 "TrackingGeometryReadKey",
201 "",
202 "Key of the TrackingGeometry conditions data."
203 };
204
205#ifdef TRKDETDESCR_MEMUSAGE
206 MemoryLogger m_memoryLogger;
207#endif
208};
209
210inline const Trk::TrackingGeometry&
212{
213 const Trk::TrackingGeometry* tracking_geometry =
214 retrieveTrackingGeometry(Gaudi::Hive::currentContext());
215 if (!tracking_geometry) {
216 ATH_MSG_FATAL("Did not get valid TrackingGeometry. Aborting.");
217 throw GaudiException("MaterialMapping",
218 "Problem with TrackingGeometry loading.",
219 StatusCode::FAILURE);
220 }
221 return *tracking_geometry;
222}
223}
224
225#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 with parameters:
const_pointer_type cptr()
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
std::map< const Layer *, LayerMaterialRecord > m_layerRecords
this is the general record for the search
bool m_useLayerThickness
use the actual layer thickness
MaterialMapping(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
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
ToolHandle< IMaterialMapper > m_materialMapper
void throwFailedToGetTrackingGeometry() const
std::string m_outputLayerMaterialSetName
void registerVolume(const Trk::TrackingVolume &tvol, int lvl)
Output information with Level.
double m_minCompositionFraction
minimal fraction to be accounted for the composition recording
SG::ReadHandleKey< Trk::ElementTable > m_inputEventElementTable
input event table
int m_etaSide
needed for debugging: -1 negative | 0 all | 1 positive
StatusCode finalize()
standard Athena-Algorithm method
ToolHandleArray< ILayerMaterialAnalyser > m_layerMaterialAnalysers
Trk::ElementTable * m_elementTable
the accumulated element table
bool m_mapMaterial
Mapper and Inspector.
void insertLayerMaterialRecord(const Trk::Layer &lay)
const Trk::TrackingVolume * m_mappingVolume
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
StatusCode initialize()
standard Athena-Algorithm method
SG::ReadHandleKey< MaterialStepCollection > m_inputMaterialStepCollection
output / input steering
const TrackingGeometry & trackingGeometry() const
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
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
~MaterialMapping()
Default Destructor.
StatusCode execute()
standard Athena-Algorithm method
ToolHandle< IExtrapolationEngine > m_extrapolationEngine
std::string m_mappingVolumeName
double m_etaCutOff
general steering
bool m_mapComposition
map the composition of the material
bool m_checkForEmptyHits
use extrapoaltion engine to check for empty hits
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.