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
ISurfaceMaterialTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ISurfaceMaterialTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2022 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
#include <boost/test/unit_test.hpp>
10
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Definitions/Common.hpp
"
13
#include "
Acts/Definitions/Direction.hpp
"
14
#include "
Acts/Material/ISurfaceMaterial.hpp
"
15
#include "
Acts/Material/MaterialSlab.hpp
"
16
17
#include <cstddef>
18
#include <ostream>
19
20
namespace
Acts {
21
22
namespace
Test {
23
24
class
SurfaceMaterialStub
:
public
ISurfaceMaterial
{
25
using
ISurfaceMaterial::ISurfaceMaterial
;
26
27
ISurfaceMaterial
&
operator*=
(
double
/*scale*/
)
override
{
return
*
this
; };
28
29
const
MaterialSlab
&
materialSlab
(
const
Vector2
&
/*lp*/
)
const override
{
30
return
m_fullMaterial
;
31
}
32
33
const
MaterialSlab
&
materialSlab
(
const
Vector3
&
/*gp*/
)
const override
{
34
return
m_fullMaterial
;
35
}
36
37
const
MaterialSlab
&
materialSlab
(
size_t
/*bin0*/
,
38
size_t
/*bin1*/
)
const override
{
39
return
m_fullMaterial
;
40
}
41
42
std::ostream&
toStream
(std::ostream& sl)
const override
{
43
sl <<
"SurfaceMaterialStub"
;
44
return
sl;
45
};
46
47
MaterialSlab
m_fullMaterial
{};
48
};
49
51
BOOST_AUTO_TEST_CASE
(ISurfaceMaterial_factor_test) {
52
double
splitFactor = 42.0;
53
SurfaceMaterialStub
stub{splitFactor};
54
55
BOOST_CHECK_EQUAL(
56
stub.factor(
Direction::Forward
, MaterialUpdateStage::FullUpdate), 1.0);
57
58
BOOST_CHECK_EQUAL(
59
stub.factor(
Direction::Backward
, MaterialUpdateStage::FullUpdate), 1.0);
60
61
BOOST_CHECK_EQUAL(
62
stub.factor(
Direction::Forward
, MaterialUpdateStage::PostUpdate),
63
splitFactor);
64
65
BOOST_CHECK_EQUAL(
66
stub.factor(
Direction::Backward
, MaterialUpdateStage::PreUpdate),
67
splitFactor);
68
69
BOOST_CHECK_EQUAL(
70
stub.factor(
Direction::Forward
, MaterialUpdateStage::PreUpdate),
71
1 - splitFactor);
72
73
BOOST_CHECK_EQUAL(
74
stub.factor(
Direction::Backward
, MaterialUpdateStage::PostUpdate),
75
1 - splitFactor);
76
}
77
78
}
// namespace Test
79
}
// namespace Acts
acts
blob
sPHENIX
Tests
UnitTests
Core
Material
ISurfaceMaterialTests.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:43
using
1.8.2 with
sPHENIX GitHub integration