ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonDetDescr
ActsMuonDetector
src
MuonMaterialDecoratorTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MuonMaterialDecoratorTool.h
"
6
7
#include "
ActsInterop/LoggerUtils.h
"
8
#include "
PathResolver/PathResolver.h
"
9
#include "ActsPlugins/Root/RootMaterialDecorator.hpp"
10
#include "ActsPlugins/Json/JsonMaterialDecorator.hpp"
11
#include "ActsPlugins/Json/MaterialMapJsonConverter.hpp"
12
13
14
15
namespace
MuonGMR4
{
16
MuonMaterialDecoratorTool::~MuonMaterialDecoratorTool
() =
default
;
17
18
void
MuonMaterialDecoratorTool::visitSurface
(Acts::Surface& surface){
19
bool
hasMat = surface.hasMaterial();
20
m_matDecorator
->decorate(surface);
21
if
(hasMat != surface.hasMaterial()) {
22
ATH_MSG_DEBUG
(__func__<<
"() "
<<__LINE__<<
" Decorated "
<<surface.geometryId()<<
" with material"
);
23
}
24
}
25
26
StatusCode
MuonMaterialDecoratorTool::initialize
(){
27
const
Acts::Logging::Level level =
ActsTrk::actsLevelVector
(
msg
().level());
28
std::string fullPath = std::format(
"{:}/{:}"
,
m_materialMapFolder
.value() ,
m_materialMapFile
.value());
29
if
(fullPath.size() && fullPath[0] !=
'/'
) fullPath =
PathResolverFindCalibFile
(fullPath);
30
31
if
(fullPath.empty()){
32
ATH_MSG_ERROR
(__func__<<
"() "
<<__LINE__<<
" Could not find material map file: "
33
<<
m_materialMapFolder
.value() +
"/"
+
m_materialMapFile
.value());
34
return
StatusCode::FAILURE;
35
}
36
ATH_MSG_INFO
(
"Loading material map from "
<< fullPath);
37
38
// Json (or Cbor) maps are read with the Json reader, everything else keeps the Root reader
39
if
(fullPath.ends_with(
".json"
) || fullPath.ends_with(
".cbor"
)) {
40
Acts::MaterialMapJsonConverter::Config converterConfig;
41
m_matDecorator
= std::make_unique<Acts::JsonMaterialDecorator>(converterConfig, fullPath, level);
42
}
else
{
43
ActsPlugins::RootMaterialDecorator::Config decoratorConfig;
44
decoratorConfig.fileName = fullPath;
45
m_matDecorator
= std::make_unique<ActsPlugins::RootMaterialDecorator>(decoratorConfig, level);
46
}
47
return
StatusCode::SUCCESS;
48
}
49
50
StatusCode
MuonMaterialDecoratorTool::finalize
(){
51
m_matDecorator
.reset();
52
return
StatusCode::SUCCESS;
53
}
54
}
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_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
LoggerUtils.h
MuonMaterialDecoratorTool.h
PathResolver.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition
PathResolver.cxx:325
MuonGMR4::MuonMaterialDecoratorTool::m_materialMapFolder
Gaudi::Property< std::string > m_materialMapFolder
Definition
MuonMaterialDecoratorTool.h:32
MuonGMR4::MuonMaterialDecoratorTool::m_matDecorator
std::unique_ptr< Acts::IMaterialDecorator > m_matDecorator
Definition
MuonMaterialDecoratorTool.h:33
MuonGMR4::MuonMaterialDecoratorTool::visitSurface
virtual void visitSurface(Acts::Surface &surface) override final
Definition
MuonMaterialDecoratorTool.cxx:18
MuonGMR4::MuonMaterialDecoratorTool::initialize
virtual StatusCode initialize() override final
Definition
MuonMaterialDecoratorTool.cxx:26
MuonGMR4::MuonMaterialDecoratorTool::~MuonMaterialDecoratorTool
virtual ~MuonMaterialDecoratorTool()
MuonGMR4::MuonMaterialDecoratorTool::finalize
virtual StatusCode finalize() override final
Definition
MuonMaterialDecoratorTool.cxx:50
MuonGMR4::MuonMaterialDecoratorTool::m_materialMapFile
Gaudi::Property< std::string > m_materialMapFile
Material map file, read with the Json reader for '.json' / '.cbor' and with the Root reader otherwise...
Definition
MuonMaterialDecoratorTool.h:31
ActsTrk::actsLevelVector
Acts::Logging::Level actsLevelVector(MSG::Level lvl)
Definition
LoggerUtils.cxx:9
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition
MdtCalibInput.h:19
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0