ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkDetDescrAlgs
src
MaterialManipulation.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
// MaterialManipulation.cxx, (c) ATLAS Detector software
8
9
// Gaudi Units
10
#include "GaudiKernel/SystemOfUnits.h"
11
//TrkDetDescr Algs, Interfaces, Utils
12
#include "
MaterialManipulation.h
"
13
#include "
TrkDetDescrUtils/LayerIndex.h
"
14
#include "
TrkGeometry/LayerMaterialProperties.h
"
15
#include "
TrkGeometry/LayerMaterialMap.h
"
16
#include "
TrkGeometry/ElementTable.h
"
17
18
19
StatusCode
Trk::MaterialManipulation::initialize
()
20
{
21
ATH_MSG_INFO
(
"initialize()"
);
22
23
if
(!
m_layerMaterialManipulator
.empty() &&
m_layerMaterialManipulator
.retrieve().isFailure()){
24
ATH_MSG_FATAL
(
"Could not retrieve LayerMaterial manipulator - although configured. Aborting."
);
25
return
StatusCode::FAILURE;
26
}
27
return
StatusCode::SUCCESS;
28
}
29
30
31
StatusCode
Trk::MaterialManipulation::execute
(
const
EventContext&
/*ctx*/
)
32
{
33
ATH_MSG_VERBOSE
(
"MaterialManipulation execute() start"
);
34
35
Trk::LayerMaterialMap
* outputLayerMaterialMap =
nullptr
;
36
37
// make sure this is only done once
38
if
(!
m_inputLayerMaterialMap
){
39
40
// -------------------------------------------------------------------------------
41
if
(
detStore
()->retrieve(
m_inputLayerMaterialMap
,
m_inputLayerMaterialMapName
).isFailure()){
42
ATH_MSG_FATAL
(
"Could not retrieve LayerMaterialMap wiht name '"
<<
m_inputLayerMaterialMapName
<<
"'. Aborting."
);
43
return
StatusCode::FAILURE;
44
}
else
45
ATH_MSG_DEBUG
(
"Retrieved LayerMaterialMap wiht name '"
<<
m_inputLayerMaterialMapName
<<
"' for "
<<
m_inputLayerMaterialMap
->size() <<
" layers."
);
46
47
// create the output material map
48
outputLayerMaterialMap =
new
Trk::LayerMaterialMap
();
49
// now create the new one and manipulate
50
for
(
const
auto
& lmIter : (*
m_inputLayerMaterialMap
) ){
51
// copy the layer material
52
ATH_MSG_VERBOSE
(
" -> Found map for layer with index "
<< lmIter.first);
53
// use the virtual constructor
54
const
Trk::LayerMaterialProperties
* lmp =
nullptr
;
55
// manipulate it if needed
56
if
(!
m_layerMaterialManipulator
.empty())
57
lmp =
m_layerMaterialManipulator
->processLayerMaterial(lmIter.first,*(lmIter.second));
58
else
59
lmp = lmIter.second->
clone
();
60
// and insert into the map
61
(*outputLayerMaterialMap)[lmIter.first] = lmp;
62
}
63
64
// get the element table - and copy it over if there's none
65
const
ElementTable
* eTable =
m_inputLayerMaterialMap
->elementTable();
66
if
(eTable){
67
auto
tElementTable = std::make_shared<Trk::ElementTable>(*eTable);
68
outputLayerMaterialMap->
updateElementTable
(tElementTable);
69
}
70
// finally write it to StoreGate
71
if
( (
detStore
()->record(outputLayerMaterialMap,
m_outputLayerMaterialMapName
,
false
)).isFailure()){
72
ATH_MSG_ERROR
(
"Writing of LayerMaterialMap with name '"
<<
m_outputLayerMaterialMapName
<<
"' was not successful."
);
73
delete
outputLayerMaterialMap;
74
}
else
75
ATH_MSG_INFO
(
"Successfully wrote LayerMaterialMap with name '"
<<
m_outputLayerMaterialMapName
<<
"' to the detector store."
);
76
77
}
78
return
StatusCode::SUCCESS;
79
80
}
81
82
83
StatusCode
Trk::MaterialManipulation::finalize
()
84
{
85
86
ATH_MSG_INFO
(
"========================================================================================= "
);
87
ATH_MSG_INFO
(
"finalize() starts ..."
);
88
return
StatusCode::SUCCESS;
89
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
ElementTable.h
LayerIndex.h
LayerMaterialMap.h
LayerMaterialProperties.h
MaterialManipulation.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
Trk::ElementTable
Definition
ElementTable.h:24
Trk::LayerMaterialMap
This class extends the DataVector<Trk::LayerMaterialProperties> by an elementTable;.
Definition
LayerMaterialMap.h:32
Trk::LayerMaterialMap::updateElementTable
void updateElementTable(const std::shared_ptr< const ElementTable > &eTable)
update method
Definition
LayerMaterialMap.h:66
Trk::LayerMaterialProperties
This virtual base class encapsulates the logics to build pre/post/full update material for Layer stru...
Definition
LayerMaterialProperties.h:64
Trk::LayerMaterialProperties::clone
virtual LayerMaterialProperties * clone() const =0
Pseudo-Constructor clone().
Trk::MaterialManipulation::m_outputLayerMaterialMapName
Gaudi::Property< std::string > m_outputLayerMaterialMapName
Definition
MaterialManipulation.h:62
Trk::MaterialManipulation::m_inputLayerMaterialMapName
Gaudi::Property< std::string > m_inputLayerMaterialMapName
< input material properties
Definition
MaterialManipulation.h:57
Trk::MaterialManipulation::finalize
virtual StatusCode finalize() override
standard Athena-Algorithm method
Definition
MaterialManipulation.cxx:83
Trk::MaterialManipulation::m_layerMaterialManipulator
ToolHandle< ILayerMaterialManipulator > m_layerMaterialManipulator
Definition
MaterialManipulation.h:65
Trk::MaterialManipulation::m_inputLayerMaterialMap
const LayerMaterialMap * m_inputLayerMaterialMap
output material properties
Definition
MaterialManipulation.h:58
Trk::MaterialManipulation::execute
virtual StatusCode execute(const EventContext &ctx) override
standard Athena-Algorithm method
Definition
MaterialManipulation.cxx:31
Trk::MaterialManipulation::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
MaterialManipulation.cxx:19
Generated on
for ATLAS Offline Software by
1.17.0