ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RootMaterialDecorator.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RootMaterialDecorator.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2017-2019 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#pragma once
10
11
#include <
Acts/Geometry/GeometryID.hpp
>
12
#include <
Acts/Geometry/TrackingVolume.hpp
>
13
#include <
Acts/Material/IMaterialDecorator.hpp
>
14
#include <
Acts/Material/ISurfaceMaterial.hpp
>
15
#include <
Acts/Material/IVolumeMaterial.hpp
>
16
#include <
Acts/Surfaces/Surface.hpp
>
17
#include <
Acts/Utilities/Definitions.hpp
>
18
#include <
Acts/Utilities/Logger.hpp
>
19
#include <map>
20
#include <mutex>
21
22
#include "
ACTFW/Framework/ProcessCode.hpp
"
23
24
class
TFile;
25
26
namespace
Acts {
27
using
SurfaceMaterialMap
=
28
std::map<GeometryID, std::shared_ptr<const ISurfaceMaterial>>;
29
using
VolumeMaterialMap
=
30
std::map<GeometryID, std::shared_ptr<const IVolumeMaterial>>;
31
}
// namespace Acts
32
33
namespace
FW {
34
38
class
RootMaterialDecorator
:
public
Acts::IMaterialDecorator
{
39
public
:
42
class
Config
{
43
public
:
45
std::string
folderNameBase
=
"Material"
;
47
std::string
voltag
=
"_vol"
;
49
std::string
boutag
=
"_bou"
;
51
std::string
laytag
=
"_lay"
;
53
std::string
apptag
=
"_app"
;
55
std::string
sentag
=
"_sen"
;
57
std::string
ntag
=
"n"
;
59
std::string
vtag
=
"v"
;
61
std::string
otag
=
"o"
;
63
std::string
mintag
=
"min"
;
65
std::string
maxtag
=
"max"
;
67
std::string
ttag
=
"t"
;
69
std::string
x0tag
=
"x0"
;
71
std::string
l0tag
=
"l0"
;
73
std::string
atag
=
"A"
;
75
std::string
ztag
=
"Z"
;
77
std::string
rhotag
=
"rho"
;
79
std::string
fileName
=
"material-maps.root"
;
81
std::shared_ptr<const Acts::Logger>
logger
;
82
// The name of the writer
83
std::string
name
=
""
;
84
89
Config
(
const
std::string& lname =
"MaterialReader"
,
90
Acts::Logging::Level
lvl =
Acts::Logging::INFO
)
91
:
logger
(Acts::
getDefaultLogger
(lname, lvl)),
name
(lname) {}
92
};
93
97
RootMaterialDecorator
(
const
Config
& cfg);
98
100
~RootMaterialDecorator
();
101
105
void
decorate
(
Acts::Surface
&
surface
)
const
final
{
106
// Null out the material for this surface
107
if
(
m_clearSurfaceMaterial
) {
108
surface
.assignSurfaceMaterial(
nullptr
);
109
}
110
// Try to find the surface in the map
111
auto
sMaterial =
m_surfaceMaterialMap
.find(
surface
.geoID());
112
if
(sMaterial !=
m_surfaceMaterialMap
.end()) {
113
surface
.assignSurfaceMaterial(sMaterial->second);
114
}
115
}
116
120
void
decorate
(
Acts::TrackingVolume
&
volume
)
const
final
{
121
// Null out the material for this volume
122
if
(
m_clearSurfaceMaterial
) {
123
volume
.assignVolumeMaterial(
nullptr
);
124
}
125
// Try to find the surface in the map
126
auto
vMaterial =
m_volumeMaterialMap
.find(
volume
.geoID());
127
if
(vMaterial !=
m_volumeMaterialMap
.end()) {
128
volume
.assignVolumeMaterial(vMaterial->second);
129
}
130
}
131
132
private
:
134
Config
m_cfg
;
135
137
TFile*
m_inputFile
{
nullptr
};
138
140
Acts::SurfaceMaterialMap
m_surfaceMaterialMap
;
141
143
Acts::VolumeMaterialMap
m_volumeMaterialMap
;
144
145
bool
m_clearSurfaceMaterial
{
true
};
146
148
const
Acts::Logger
&
logger
()
const
{
return
*
m_cfg
.
logger
; }
149
};
150
151
}
// namespace FW
acts
blob
master
Examples
Io
Root
include
ACTFW
Io
Root
RootMaterialDecorator.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:24
using
1.8.2 with
ECCE GitHub integration