ATLAS Offline Software
Loading...
Searching...
No Matches
InputLayerMaterialProvider.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 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)
22: AthAlgTool(t,n,p),
29
30{
31 declareInterface<Trk::IGeometryProcessor>(this);
32
33 declareProperty("AssignConstantMaterial", m_constantMaterialToAllLayers);
34 declareProperty("ConstantMaterialInX0", m_constantThicknessInX0);
35 declareProperty("ConstantMaterialInL0", m_constantThicknessInL0);
36 declareProperty("ConstantMaterialA", m_constantAverageA);
37 declareProperty("ConstantMaterialZ", m_constantAverageZ);
38 declareProperty("ConstantMaterialRho", m_constantAverageRho);
39
40}
41
42// destructor
44= default;
45
57
58// Processor Action to work on TrackingGeometry
60
61 ATH_MSG_VERBOSE("Start processing the TrackingGeometry recursively");
62 // retrieve the highest tracking volume
63 Trk::TrackingVolume* worldVolume = tgeo.highestTrackingVolume();
64 if (worldVolume){
65 ATH_MSG_VERBOSE("TrackingVolume '" << worldVolume->volumeName() << "' retrieved as highest level node.");
66 return process(*worldVolume, 0);
67 }
68 // abort job
69 ATH_MSG_FATAL("No highest level TrackingVolume found. Stopping recursive parsing, abort job.");
70 return StatusCode::FAILURE;
71}
72
73// Processor Action to work on TrackingVolumes
75
76 std::stringstream displayBuffer;
77 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
78 // formatted screen output
79 ATH_MSG_VERBOSE(displayBuffer.str() << "TrackingVolume '" << tvol.volumeName() << "'");
80
81 // Process the contained layers if they exist
82 Trk::LayerArray* layerArray = tvol.confinedLayers();
83 if (layerArray) {
84 // display output
85 std::span<Trk::Layer * const> layers = layerArray->arrayObjects();
86 auto layIter = layers.begin();
87 auto layIterE = layers.end();
88 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." );
89 for ( ; layIter != layIterE; ++layIter){
90 if (!(*layIter))
91 ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !");
92 if ((*layIter) && process(**layIter, level).isFailure()){
93 ATH_MSG_FATAL("Failed to call process(const Layer&) on confined layers. Aborting.");
94 return StatusCode::FAILURE;
95 }
96 }
97 }
98
99 // Process the contained TrackingVolumes (recursively) if they exist
101 // register the next round
102 if (confinedVolumes) {
103 std::span<Trk::TrackingVolume * const> volumes = confinedVolumes->arrayObjects();
104 auto volumesIter = volumes.begin();
105 for (; volumesIter != volumes.end(); ++volumesIter){
106 if (!(*volumesIter))
107 ATH_MSG_WARNING("Zero-pointer found in VolumeArray - indicates problem !");
108 if ((*volumesIter) && process(**volumesIter, ++level).isFailure() ){
109 ATH_MSG_FATAL("Failed to call process(const TrackingVolume&) on confined volumes. Aborting.");
110 return StatusCode::FAILURE;
111 }
112 }
113 }
114
115 // return
116 return StatusCode::SUCCESS;
117
118}
119
120// Processor Action to work on Layers
121StatusCode Trk::InputLayerMaterialProvider::process(Trk::Layer& lay, size_t level) const {
122
123 // skip Layers w/o material
124 if (!lay.layerMaterialProperties())
125 return StatusCode::SUCCESS;
126
127 // get the layer index for assignment
128 Trk::LayerIndex lIndex = lay.layerIndex();
129
130 // display
131 std::stringstream displayBuffer;
132 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
133
134 ATH_MSG_DEBUG(displayBuffer.str() << " assigning material for Layer with Index: " << lIndex.value());
135 ATH_MSG_VERBOSE(displayBuffer.str() << " Layer memory adress is : " << &lay);
136
138 lay.assignMaterialProperties(hLayerMaterial);
139
140 return StatusCode::SUCCESS;
141}
142
143// Processor Action to work on Surfaces
145 return StatusCode::SUCCESS;
146}
147
148
#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:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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.
virtual ~InputLayerMaterialProvider()
Destructor.
float m_constantThicknessInX0
constant material specifications
MaterialProperties m_constantMaterialProperties
the set together material
float m_constantAverageZ
constant material specifications
float m_constantAverageA
constant material specifications
bool m_constantMaterialToAllLayers
just assign a dummy material to all layers
float m_constantThicknessInL0
constant material specifications
float m_constantAverageRho
constant material specifications
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.
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