ATLAS Offline Software
Loading...
Searching...
No Matches
InputLayerMaterialProvider.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6// InputLayerMaterialProvider.cxx, (c) ATLAS Detector software
8
9// STL
10#include <sstream>
11// Trk include
15#include "TrkGeometry/Layer.h"
16#include "TrkSurfaces/Surface.h"
19
20// constructor
21Trk::InputLayerMaterialProvider::InputLayerMaterialProvider(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p)
22{
23 declareInterface<Trk::IGeometryProcessor>(this);
24}
25
26
38
39// Processor Action to work on TrackingGeometry
41
42 ATH_MSG_VERBOSE("Start processing the TrackingGeometry recursively");
43 // retrieve the highest tracking volume
44 Trk::TrackingVolume* worldVolume = tgeo.highestTrackingVolume();
45 if (worldVolume){
46 ATH_MSG_VERBOSE("TrackingVolume '" << worldVolume->volumeName() << "' retrieved as highest level node.");
47 return process(*worldVolume, 0);
48 }
49 // abort job
50 ATH_MSG_FATAL("No highest level TrackingVolume found. Stopping recursive parsing, abort job.");
51 return StatusCode::FAILURE;
52}
53
54// Processor Action to work on TrackingVolumes
56
57 std::stringstream displayBuffer;
58 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
59 // formatted screen output
60 ATH_MSG_VERBOSE(displayBuffer.str() << "TrackingVolume '" << tvol.volumeName() << "'");
61
62 // Process the contained layers if they exist
63 Trk::LayerArray* layerArray = tvol.confinedLayers();
64 if (layerArray) {
65 // display output
66 std::span<Trk::Layer * const> layers = layerArray->arrayObjects();
67 auto layIter = layers.begin();
68 auto layIterE = layers.end();
69 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." );
70 for ( ; layIter != layIterE; ++layIter){
71 if (!(*layIter))
72 ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !");
73 if ((*layIter) && process(**layIter, level).isFailure()){
74 ATH_MSG_FATAL("Failed to call process(const Layer&) on confined layers. Aborting.");
75 return StatusCode::FAILURE;
76 }
77 }
78 }
79
80 // Process the contained TrackingVolumes (recursively) if they exist
82 // register the next round
83 if (confinedVolumes) {
84 std::span<Trk::TrackingVolume * const> volumes = confinedVolumes->arrayObjects();
85 auto volumesIter = volumes.begin();
86 for (; volumesIter != volumes.end(); ++volumesIter){
87 if (!(*volumesIter))
88 ATH_MSG_WARNING("Zero-pointer found in VolumeArray - indicates problem !");
89 if ((*volumesIter) && process(**volumesIter, ++level).isFailure() ){
90 ATH_MSG_FATAL("Failed to call process(const TrackingVolume&) on confined volumes. Aborting.");
91 return StatusCode::FAILURE;
92 }
93 }
94 }
95
96 // return
97 return StatusCode::SUCCESS;
98
99}
100
101// Processor Action to work on Layers
102StatusCode Trk::InputLayerMaterialProvider::process(Trk::Layer& lay, size_t level) const {
103
104 // skip Layers w/o material
105 if (!lay.layerMaterialProperties())
106 return StatusCode::SUCCESS;
107
108 // get the layer index for assignment
109 Trk::LayerIndex lIndex = lay.layerIndex();
110
111 // display
112 std::stringstream displayBuffer;
113 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
114
115 ATH_MSG_DEBUG(displayBuffer.str() << " assigning material for Layer with Index: " << lIndex.value());
116 ATH_MSG_VERBOSE(displayBuffer.str() << " Layer memory adress is : " << &lay);
117
119 lay.assignMaterialProperties(hLayerMaterial);
120
121 return StatusCode::SUCCESS;
122}
123
124// Processor Action to work on Surfaces
126 return StatusCode::SUCCESS;
127}
128
129
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
It extends the LayerMaterialProperties base class.
virtual StatusCode initialize()
Framework initialize().
virtual StatusCode process(TrackingGeometry &tgeo) const
Processor Action to work on TrackingGeometry& tgeo.
Gaudi::Property< float > m_constantThicknessInL0
Gaudi::Property< float > m_constantAverageRho
MaterialProperties m_constantMaterialProperties
the set together material
Gaudi::Property< float > m_constantThicknessInX0
InputLayerMaterialProvider(const std::string &, const std::string &, const IInterface *)
Constructor.
LayerIndex for the identification of layers in a simplified detector geometry of Cylinders and Discs.
Definition LayerIndex.h:37
int value() const
layerIndex expressed in an integer
Definition LayerIndex.h:71
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
void assignMaterialProperties(const LayerMaterialProperties &, double scale=1.0)
assignMaterialPropeties
Definition Layer.cxx:177
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
const LayerIndex & layerIndex() const
get the layerIndex
Material with information about thickness of material.
Abstract Base Class for tracking surfaces.
Definition Surface.h:79
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
const TrackingVolume * highestTrackingVolume() const
return the world
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
const LayerArray * confinedLayers() const
Return the subLayer array.
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
const std::string process
BinnedArray< Layer > LayerArray
simply for the eye