ATLAS Offline Software
Loading...
Searching...
No Matches
MaterialMapper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// MaterialMapper.h, (c) ATLAS Detector software
8
9#ifndef TRKDETDESCRTOOLS_MATERIALMAPPER_H
10#define TRKDETDESCRTOOLS_MATERIALMAPPER_H
11
12// Amg
14// Gaudi & Athena
16#include "GaudiKernel/IIncidentListener.h"
17#include "GaudiKernel/ITHistSvc.h"
18// Trk
20// ROOT
21#include "TTree.h"
22#include "TString.h"
24
25#define TRKDETDESCRTOOLS_MAXSTEPS 8000
26#define TRKDETDESCRTOOLS_MAXLAYERHITS 5000
27
28class TTree;
29
30namespace Trk {
31
32 class TrackingVolume;
33 class Layer;
34
35
39
43
44 float eta;
45 float phi;
46 float path;
47 float pathInX0;
48 float pathInL0;
49 float pathZARho;
50 TTree* tree;
51
52 VolumeTreeObject(TString name, TString title)
53 : eta(0),
54 phi(0.),
55 path(0.),
56 pathInX0(0.),
57 pathInL0(0.),
58 pathZARho(0.),
59 tree(new TTree(name,title))
60 {
61 tree->Branch("Eta", &eta, "eta/F");
62 tree->Branch("Phi", &phi, "phi/F");
63 tree->Branch("Path", &path, "path/F");
64 tree->Branch("PathInX0", &pathInX0, "pathX0/F");
65 tree->Branch("PathInL0", &pathInL0, "pathL0/F");
66 tree->Branch("PathZARho", &pathZARho, "pathZARho/F");
67 }
68 };
69
73
74 // values for the full histo
82
84 float path;
85 float pathInX0;
86 float pathInL0;
87 float A;
88 float Z;
89 float rho;
90
98
99 TTree* tree;
100
101 LayerTreeObject(TString name, TString title)
102 : densedHitX(0.),
103 densedHitY(0.),
104 densedHitZ(0.),
105 densedHitR(0.),
106 densedHitPhi(0.),
107 densedHitTheta(0.),
108 densedHits(0),
110 path(0.),
111 pathInX0(0.),
112 pathInL0(0.),
113 A(0.),
114 Z(0.),
115 rho(0.),
116 layerHits(0),
117 tree(new TTree(name,title))
118 {
119 tree->Branch("DensedHits", &densedHits, "densedHits/I");
120 tree->Branch("DensedHitX", &densedHitX, "densedHitX/F");
121 tree->Branch("DensedHitY", &densedHitY, "densedHitY/F");
122 tree->Branch("DensedHitZ", &densedHitZ, "densedHitZ/F");
123 tree->Branch("DensedHitR", &densedHitR, "densedHitR/F");
124 tree->Branch("DensedHitPhi", &densedHitPhi, "densedHitPhi/F");
125 tree->Branch("DensedHitTheta", &densedHitTheta, "densedHitTheta/F");
126
127 tree->Branch("CorrFactor", &correctionFactor, "corrF/F");
128 tree->Branch("Path", &path, "pathInX0/F");
129 tree->Branch("PathInX0", &pathInX0, "pathInX0/F");
130 tree->Branch("PathInL0", &pathInL0, "pathInL0/F");
131 tree->Branch("A", &A, "a/F");
132 tree->Branch("Z", &Z, "z/F");
133 tree->Branch("Rho", &rho, "rho/F");
134 tree->Branch("Hits", &layerHits, "layerhits/I");
135 tree->Branch("HitPathInX0", &hitPathInX0, "layerhitpathInX0[layerhits]/F");
136 tree->Branch("HitPositionX", &hitPositionX, "layerhitsX[layerhits]/F");
137 tree->Branch("HitPositionY", &hitPositionY, "layerhitsY[layerhits]/F");
138 tree->Branch("HitPositionZ", &hitPositionZ, "layerhitsZ[layerhits]/F");
139 tree->Branch("HitPositionR", &hitPositionR, "layerhitsR[layerhits]/F");
140 tree->Branch("HitPositionEta", &hitPositionEta, "layerhitsR[layerhits]/F");
141 }
142 };
143
144
151
152 float loc1;
153 float loc2;
154 float eta;
156 float path;
157 float pathInX0;
158 float pathInL0;
159 float A;
160 float Z;
161 float rho;
162
164 TTree* tree;
165
166 SurfaceTreeObject(TString name, TString title)
167 : loc1(0.),
168 loc2(0.),
169 eta(0.),
171 path(0.),
172 pathInX0(0.),
173 pathInL0(0.),
174 A(0.),
175 Z(0.),
176 rho(0.),
177 surfaceHits(0),
178 tree(new TTree(name,title))
179 {
180 tree->Branch("Local1", &loc1, "local1/F");
181 tree->Branch("Local2", &loc2, "local2/F");
182 tree->Branch("Eta", &eta, "eta/F");
183 tree->Branch("CorrFactor", &correctionFactor, "corrF/F");
184 tree->Branch("Path", &path, "path/F");
185 tree->Branch("PathInX0", &pathInX0, "pathInX0/F");
186 tree->Branch("PathInL0", &pathInL0, "pathInL0/F");
187 tree->Branch("A", &A, "a/F");
188 tree->Branch("Z", &Z, "z/F");
189 tree->Branch("Rho", &rho, "rho/F");
190 }
191 };
192
193
203
205 public AthAlgTool, virtual public IMaterialMapper, virtual public IIncidentListener {
206
207 public:
208
210 MaterialMapper(const std::string&,
211 const std::string&,
212 const IInterface*);
213
215 virtual ~MaterialMapper();
216
218 StatusCode initialize();
219
221 StatusCode finalize();
222
224 void recordMaterialHit(const AssociatedMaterial& amhit, const Amg::Vector3D& projectedPosition) const;
225
227 void recordLayerHit(const AssociatedMaterial& amhit, bool full = false) const;
228
230 void recordSurfaceHit(const Amg::Vector2D& locpos, const AssociatedMaterial& amhit) const;
231
233 void handle( const Incident& inc );
234
235 private:
236
238 void finalizeVolumeHits(bool mapped=true) const;
239
241 void finalizeLayerHits() const;
242
244 void finalizeSurfaceHits() const;
245
247 void bookValidationTree();
248
250 VolumeTreeObject* volumeTreeObject(const Layer* lay=0, const TrackingVolume* tvol=0) const;
251
253 LayerTreeObject* layerTreeObject(const Layer& lay, bool full = false) const;
254
256 SurfaceTreeObject* surfaceTreeObject(const Layer& lay) const;
257
258
259 /* Services */
262
264
265 // (1) ------------------------- Tree name of the total material statistics
266 unsigned int m_maxMappingEvents;
267 mutable unsigned int m_processedEvents;
268
270
271 // (2) ------------------------ Ntuple output of material effects validation
276
277
278 // Spatial information
279 mutable int m_materialSteps;
280 mutable float m_averageEta;
281 mutable float m_averagePhi;
282 mutable float m_mappedPath;
283 mutable float m_mappedPathInX0;
284 mutable float m_mappedPathInL0;
285 mutable float m_mappedPathRho;
286 mutable float m_mappedPathZARho;
287 mutable float m_unmappedPathInX0;
306
307 // Per Volume Validation
310 mutable std::map< const Trk::TrackingVolume*, VolumeTreeObject* > m_volumeTrees;
311 mutable std::map< const Trk::TrackingVolume*, VolumeTreeObject* > m_volumeTreesUnmapped;
312
313 // Per Layer Validation
315 std::string m_layerTreePrefix;
316 mutable std::map< const Trk::Layer*, LayerTreeObject* > m_layerTrees;
317 mutable std::map< const Trk::Layer*, LayerTreeObject* > m_layerFullTrees;
318
319 // Per Surface Validation
322 mutable std::map< const Trk::Layer*, SurfaceTreeObject* > m_surfaceTrees;
323
324 };
325
326} // end of namespace
327
328#endif // TRKDETDESCRTOOLS_MATERIALMAPPER_H
329
#define TRKDETDESCRTOOLS_MAXSTEPS
#define TRKDETDESCRTOOLS_MAXLAYERHITS
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
It is used in the Mapping process ( using MaterialSteps ), the validation and recostruction ( using M...
Interface class IMaterialMapper.
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
std::string m_validationTreeFolder
stream/folder to for the TTree to be written out
std::string m_layerTreePrefix
float m_materialProjPositionY[TRKDETDESCRTOOLS_MAXSTEPS]
y position of the material recording when assigned to layer
float m_unmappedPathInX0
total path in x0 in these events lost
float m_materialStepPositionY[TRKDETDESCRTOOLS_MAXSTEPS]
y position of the material recording
void recordSurfaceHit(const Amg::Vector2D &locpos, const AssociatedMaterial &amhit) const
Record material hit on a surface.
void bookValidationTree()
Validation : book the Tree.
StatusCode finalize()
AlgTool finalize method.
float m_averageEta
average eta
float m_mappedPath
total mapped path
std::map< const Trk::Layer *, LayerTreeObject * > m_layerFullTrees
std::string m_surfaceTreePrefix
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTrees
float m_averagePhi
average ogu
void finalizeLayerHits() const
Finalize the SingleLayer Steps.
void recordLayerHit(const AssociatedMaterial &amhit, bool full=false) const
Record material hit - if various hits per uniform layer are recorded, or if you want to record one fu...
float m_mappedPathRho
total mapped path times rho
float m_mappedPathInL0
total mapped path in L0
ServiceHandle< ITHistSvc > m_histSvc
TTree * m_validationTree
The validation tree.
float m_materialAccumPathInX0[TRKDETDESCRTOOLS_MAXSTEPS]
accumulated path length in x0
LayerTreeObject * layerTreeObject(const Layer &lay, bool full=false) const
find (&&,||) create the LayerTreeObject
unsigned int m_processedEvents
float m_materialStepX0[TRKDETDESCRTOOLS_MAXSTEPS]
step x0
ServiceHandle< IIncidentSvc > m_incidentSvc
float m_materialProjPositionX[TRKDETDESCRTOOLS_MAXSTEPS]
x position of the material recording when assigned to layer
MaterialMapper(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
void finalizeVolumeHits(bool mapped=true) const
Finalize the Volume Steps.
float m_materialStepZ[TRKDETDESCRTOOLS_MAXSTEPS]
step Z
float m_materialStepPositionX[TRKDETDESCRTOOLS_MAXSTEPS]
x position of the material recording
SurfaceTreeObject * surfaceTreeObject(const Layer &lay) const
find (&&,||) create the LayerTreeObject
std::string m_validationTreeDescription
validation tree description - second argument in TTree
float m_materialProjDistance[TRKDETDESCRTOOLS_MAXSTEPS]
the distance to the projected hit
float m_mappedPathZARho
total mapped path times (Z/A)*rho
void finalizeSurfaceHits() const
Finalize the SingleLayer Steps.
void handle(const Incident &inc)
Handle the incident from the incident service.
unsigned int m_maxMappingEvents
int m_mapped[TRKDETDESCRTOOLS_MAXSTEPS]
mapped or not mapped
float m_materialStepRho[TRKDETDESCRTOOLS_MAXSTEPS]
step rho
std::map< const Trk::TrackingVolume *, VolumeTreeObject * > m_volumeTreesUnmapped
float m_materialAccumPathZARho[TRKDETDESCRTOOLS_MAXSTEPS]
accumulated path length times (Z/A)*rho
int m_materialSteps
number of update positions
float m_materialProjPositionR[TRKDETDESCRTOOLS_MAXSTEPS]
r value of the material recording when assigned to layer
float m_materialStepPositionR[TRKDETDESCRTOOLS_MAXSTEPS]
r value of the material recording
float m_materialStepA[TRKDETDESCRTOOLS_MAXSTEPS]
step A
VolumeTreeObject * volumeTreeObject(const Layer *lay=0, const TrackingVolume *tvol=0) const
find (&&,||) create a VolumeTreObject
float m_materialStepPath[TRKDETDESCRTOOLS_MAXSTEPS]
step path
float m_mappedPathInX0
total mapped path in X0
float m_materialStepL0[TRKDETDESCRTOOLS_MAXSTEPS]
step l0
std::string m_validationTreeName
validation tree name - to be accessed by this from root
void recordMaterialHit(const AssociatedMaterial &amhit, const Amg::Vector3D &projectedPosition) const
Record material hit along the recording.
std::string m_volumeTreePrefix
std::string m_totalMaterialTree
float m_materialProjPositionZ[TRKDETDESCRTOOLS_MAXSTEPS]
z position of the material recording when assigned to layer
float m_materialStepPositionZ[TRKDETDESCRTOOLS_MAXSTEPS]
z position of the material recording
std::map< const Trk::Layer *, LayerTreeObject * > m_layerTrees
std::map< const Trk::Layer *, SurfaceTreeObject * > m_surfaceTrees
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
std::vector< std::string > mapped
Definition hcg.cxx:54
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
void initialize()
float hitPositionEta[TRKDETDESCRTOOLS_MAXLAYERHITS]
LayerTreeObject & operator=(const LayerTreeObject &)=delete
float hitPositionR[TRKDETDESCRTOOLS_MAXLAYERHITS]
float hitPathInX0[TRKDETDESCRTOOLS_MAXLAYERHITS]
float hitPositionZ[TRKDETDESCRTOOLS_MAXLAYERHITS]
float hitPositionX[TRKDETDESCRTOOLS_MAXLAYERHITS]
float hitPositionY[TRKDETDESCRTOOLS_MAXLAYERHITS]
LayerTreeObject(const LayerTreeObject &)=delete
LayerTreeObject(TString name, TString title)
SurfaceTreeObject(const SurfaceTreeObject &)=delete
SurfaceTreeObject(TString name, TString title)
SurfaceTreeObject & operator=(const SurfaceTreeObject &)=delete
-> simple helper struct for filling the Volume objects
VolumeTreeObject & operator=(const VolumeTreeObject &)=delete
VolumeTreeObject(const VolumeTreeObject &)=delete
VolumeTreeObject(TString name, TString title)