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
AccumulatedMaterialProperties.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file AccumulatedMaterialProperties.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2018-2020 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/Material/MaterialProperties.hpp
"
12
13
namespace
Acts {
14
34
class
AccumulatedMaterialProperties
{
35
public
:
37
AccumulatedMaterialProperties
() =
default
;
38
40
~AccumulatedMaterialProperties
() =
default
;
41
44
AccumulatedMaterialProperties
(
const
AccumulatedMaterialProperties
& amp) =
45
default
;
46
49
AccumulatedMaterialProperties
(
AccumulatedMaterialProperties
&& amp) =
default
;
50
53
AccumulatedMaterialProperties
&
operator=
(
54
const
AccumulatedMaterialProperties
& amp) =
default
;
55
58
AccumulatedMaterialProperties
&
operator=
(
59
AccumulatedMaterialProperties
&& amp) =
default
;
60
74
void
accumulate
(
const
MaterialProperties
& amp,
double
pathCorrection = 1.);
75
79
void
trackAverage
(
bool
emptyHit =
false
);
80
91
std::pair<MaterialProperties, unsigned int>
totalAverage
();
92
93
private
:
94
double
m_eventPathInX0
{0.};
95
double
m_eventPathInL0
{0.};
96
double
m_eventAr
{0.};
97
double
m_eventZ
{0.};
98
double
m_eventRho
{0.};
99
double
m_eventPath
{0.};
100
double
m_eventPathCorrection
{0.};
101
102
double
m_totalPathInX0
{0.};
103
double
m_totalPathInL0
{0.};
104
double
m_totalAr
{0.};
105
double
m_totalZ
{0.};
106
double
m_totalRho
{0.};
107
108
unsigned
int
m_totalEvents
{0};
109
};
110
111
inline
void
AccumulatedMaterialProperties::accumulate
(
112
const
MaterialProperties
& amp,
double
pathCorrection) {
113
m_eventPathInX0
+= amp.
thicknessInX0
();
114
m_eventPathInL0
+= amp.
thicknessInL0
();
115
double
t
= amp.
thickness
();
116
double
r
= amp.
material
().
massDensity
();
117
m_eventPath
+=
t
;
118
m_eventRho
+= r *
t
;
119
120
m_eventAr
+= amp.
material
().
Ar
() * r *
t
;
121
m_eventZ
+= amp.
material
().
Z
() * r *
t
;
122
123
m_eventPathCorrection
+= pathCorrection *
t
;
124
}
125
126
inline
void
AccumulatedMaterialProperties::trackAverage
(
bool
emptyHit) {
127
// Increase the total event count either for empty hit or by touched hit
128
if
(emptyHit ||
m_eventPath
> 0.) {
129
++
m_totalEvents
;
130
}
131
132
// Average the event quantities
133
if
(
m_eventPath
> 0. &&
m_eventRho
> 0.) {
134
m_eventPathCorrection
/=
m_eventPath
;
135
m_totalPathInX0
+=
m_eventPathInX0
/
m_eventPathCorrection
;
136
m_totalPathInL0
+=
m_eventPathInL0
/
m_eventPathCorrection
;
137
m_totalAr
+= (
m_eventAr
/
m_eventRho
);
138
m_totalZ
+= (
m_eventZ
/
m_eventRho
);
139
m_totalRho
+= (
m_eventRho
);
140
}
141
m_eventPathInX0
= 0.;
142
m_eventPathInL0
= 0.;
143
m_eventAr
= 0.;
144
m_eventZ
= 0.;
145
m_eventRho
= 0.;
146
m_eventPath
= 0.;
147
m_eventPathCorrection
= 0.;
148
}
149
150
inline
std::pair<MaterialProperties, unsigned int>
151
AccumulatedMaterialProperties::totalAverage
() {
152
if
(
m_totalEvents
> 0 &&
m_totalPathInX0
> 0.) {
153
double
eventScalor = 1. /
m_totalEvents
;
154
m_totalPathInX0
*= eventScalor;
155
m_totalPathInL0
*= eventScalor;
156
m_totalRho
*= eventScalor;
157
m_totalAr
*= eventScalor;
158
m_totalZ
*= eventScalor;
159
// Create the material
160
double
X0 = 1. /
m_totalPathInX0
;
161
double
L0 = 1. /
m_totalPathInL0
;
162
// Create the material properties - fixed to unit path length
163
MaterialProperties
averageMat(X0, L0,
m_totalAr
,
m_totalZ
,
m_totalRho
, 1.);
164
return
std::pair<MaterialProperties, unsigned int>(std::move(averageMat),
165
m_totalEvents
);
166
}
167
return
std::pair<MaterialProperties, unsigned int>(
168
MaterialProperties
{
Material
(), 0.},
m_totalEvents
);
169
}
170
171
}
// end of namespace Acts
acts
blob
master
Core
include
Acts
Material
AccumulatedMaterialProperties.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:20
using
1.8.2 with
ECCE GitHub integration