Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
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 "
ActsExamples/Framework/ProcessCode.hpp
"
12
#include <
Acts/Definitions/Algebra.hpp
>
13
#include <
Acts/Geometry/GeometryIdentifier.hpp
>
14
#include <
Acts/Geometry/TrackingVolume.hpp
>
15
#include <
Acts/Material/IMaterialDecorator.hpp
>
16
#include <
Acts/Material/ISurfaceMaterial.hpp
>
17
#include <
Acts/Material/IVolumeMaterial.hpp
>
18
#include <
Acts/Surfaces/Surface.hpp
>
19
#include <
Acts/Utilities/Logger.hpp
>
20
21
#include <map>
22
#include <memory>
23
#include <mutex>
24
#include <string>
25
#include <utility>
26
27
class
TFile;
28
29
namespace
Acts {
30
class
ISurfaceMaterial;
31
class
IVolumeMaterial;
32
33
using
SurfaceMaterialMap
=
34
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
35
using
VolumeMaterialMap
=
36
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
37
}
// namespace Acts
38
39
namespace
ActsExamples {
40
44
class
RootMaterialDecorator
:
public
Acts::IMaterialDecorator
{
45
public
:
48
class
Config
{
49
public
:
51
std::string
folderSurfaceNameBase
=
"SurfaceMaterial"
;
53
std::string
folderVolumeNameBase
=
"VolumeMaterial"
;
55
std::string
voltag
=
"_vol"
;
57
std::string
boutag
=
"_bou"
;
59
std::string
laytag
=
"_lay"
;
61
std::string
apptag
=
"_app"
;
63
std::string
sentag
=
"_sen"
;
65
std::string
ntag
=
"n"
;
67
std::string
vtag
=
"v"
;
69
std::string
otag
=
"o"
;
71
std::string
mintag
=
"min"
;
73
std::string
maxtag
=
"max"
;
75
std::string
ttag
=
"t"
;
77
std::string
x0tag
=
"x0"
;
79
std::string
l0tag
=
"l0"
;
81
std::string
atag
=
"A"
;
83
std::string
ztag
=
"Z"
;
85
std::string
rhotag
=
"rho"
;
87
std::string
fileName
=
"material-maps.root"
;
88
};
89
93
RootMaterialDecorator
(
const
Config
&
config
,
Acts::Logging::Level
level
);
94
96
~RootMaterialDecorator
()
override
;
97
101
void
decorate
(
Acts::Surface
&
surface
)
const
final
{
102
// Null out the material for this surface
103
if
(
m_clearSurfaceMaterial
) {
104
surface
.assignSurfaceMaterial(
nullptr
);
105
}
106
// Try to find the surface in the map
107
auto
sMaterial =
m_surfaceMaterialMap
.find(
surface
.geometryId());
108
if
(sMaterial !=
m_surfaceMaterialMap
.end()) {
109
surface
.assignSurfaceMaterial(sMaterial->second);
110
}
111
}
112
116
void
decorate
(
Acts::TrackingVolume
& volume)
const
final
{
117
// Null out the material for this volume
118
if
(
m_clearSurfaceMaterial
) {
119
volume.assignVolumeMaterial(
nullptr
);
120
}
121
// Try to find the surface in the map
122
auto
vMaterial =
m_volumeMaterialMap
.find(volume.geometryId());
123
if
(vMaterial !=
m_volumeMaterialMap
.end()) {
124
volume.assignVolumeMaterial(vMaterial->second);
125
}
126
}
127
129
const
Config
&
config
()
const
{
return
m_cfg
; }
130
131
private
:
133
Config
m_cfg
;
134
135
std::unique_ptr<const Acts::Logger>
m_logger
{
nullptr
};
136
138
TFile*
m_inputFile
{
nullptr
};
139
141
Acts::SurfaceMaterialMap
m_surfaceMaterialMap
;
142
144
Acts::VolumeMaterialMap
m_volumeMaterialMap
;
145
146
bool
m_clearSurfaceMaterial
{
true
};
147
149
const
Acts::Logger
&
logger
()
const
{
return
*
m_logger
; }
150
};
151
152
}
// namespace ActsExamples
acts
blob
sPHENIX
Examples
Io
Root
include
ActsExamples
Io
Root
RootMaterialDecorator.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration