ATLAS Offline Software
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
21 Trk::InputLayerMaterialProvider::InputLayerMaterialProvider(const std::string& t, const std::string& n, const IInterface* p)
22 : AthAlgTool(t,n,p),
23  m_constantMaterialToAllLayers(true),
24  m_constantThicknessInX0(0.02),
25  m_constantThicknessInL0(0.06),
26  m_constantAverageA(14.),
27  m_constantAverageZ(7.),
28  m_constantAverageRho(0.00233)
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 
47 
48  m_constantMaterialProperties = Trk::MaterialProperties(1.,
49  1./m_constantThicknessInX0,
50  1./m_constantThicknessInL0,
51  m_constantAverageA,
52  m_constantAverageZ,
53  m_constantAverageRho);
54 
55  return StatusCode::SUCCESS;
56 }
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
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) {
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
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 
137  Trk::HomogeneousLayerMaterial hLayerMaterial = Trk::HomogeneousLayerMaterial(m_constantMaterialProperties, 1.);
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 
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Surface.h
Trk::InputLayerMaterialProvider::m_constantAverageA
float m_constantAverageA
constant material specifications
Definition: InputLayerMaterialProvider.h:65
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::InputLayerMaterialProvider::InputLayerMaterialProvider
InputLayerMaterialProvider(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: InputLayerMaterialProvider.cxx:21
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
HomogeneousLayerMaterial.h
Layer.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
Trk::InputLayerMaterialProvider::process
virtual StatusCode process(TrackingGeometry &tgeo) const
Processor Action to work on TrackingGeometry& tgeo.
Definition: InputLayerMaterialProvider.cxx:59
Trk::TrackingVolume::confinedLayers
const LayerArray * confinedLayers() const
Return the subLayer array.
Trk::Layer::assignMaterialProperties
void assignMaterialProperties(const LayerMaterialProperties &, double scale=1.0)
assignMaterialPropeties
Definition: Layer.cxx:191
Trk::TrackingGeometry::highestTrackingVolume
const TrackingVolume * highestTrackingVolume() const
return the world
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::InputLayerMaterialProvider::m_constantAverageRho
float m_constantAverageRho
constant material specifications
Definition: InputLayerMaterialProvider.h:67
Trk::LayerIndex
Definition: LayerIndex.h:37
beamspotman.n
n
Definition: beamspotman.py:731
Trk::InputLayerMaterialProvider::m_constantThicknessInX0
float m_constantThicknessInX0
constant material specifications
Definition: InputLayerMaterialProvider.h:63
Trk::TrackingGeometry
Definition: TrackingGeometry.h:67
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::InputLayerMaterialProvider::m_constantMaterialToAllLayers
bool m_constantMaterialToAllLayers
just assign a dummy material to all layers
Definition: InputLayerMaterialProvider.h:62
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::InputLayerMaterialProvider::m_constantAverageZ
float m_constantAverageZ
constant material specifications
Definition: InputLayerMaterialProvider.h:66
Trk::LayerIndex::value
int value() const
layerIndex expressed in an integer
Definition: LayerIndex.h:71
Trk::InputLayerMaterialProvider::initialize
virtual StatusCode initialize()
Framework initialize()
Definition: InputLayerMaterialProvider.cxx:46
Trk::TrackingVolume::volumeName
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
Trk::BinnedArray::arrayObjects
virtual BinnedArraySpan< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
LayerMaterialMap.h
InputLayerMaterialProvider.h
Trk::MaterialProperties
Definition: MaterialProperties.h:40
TrackingVolume.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::TrackingVolume::confinedVolumes
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
Trk::Layer::layerMaterialProperties
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
TrackingGeometry.h
Trk::BinnedArray
Definition: BinnedArray.h:38
AthAlgTool
Definition: AthAlgTool.h:26
Trk::HomogeneousLayerMaterial
Definition: HomogeneousLayerMaterial.h:53
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::InputLayerMaterialProvider::~InputLayerMaterialProvider
virtual ~InputLayerMaterialProvider()
Destructor.
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Trk::InputLayerMaterialProvider::m_constantThicknessInL0
float m_constantThicknessInL0
constant material specifications
Definition: InputLayerMaterialProvider.h:64
Trk::BinnedArraySpan
std::span< T > BinnedArraySpan
Definition: BinnedArray.h:34
Trk::Layer
Definition: Layer.h:73
Trk::Layer::layerIndex
const LayerIndex & layerIndex() const
get the layerIndex