FairShip
Loading...
Searching...
No Matches
test_cavern_layout.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: LGPL-3.0-or-later
2
# SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP Collaboration
3
4
"""Check that the ECN3 cross-section of the geometry configuration is that of ShipCave.
5
6
ShipCave builds the cavern from the constants in passive/ShipCavernLayout.h,
7
while geometry_config places the UBT and its scoring planes from its own copy
8
of the ECN3 floor and side walls. Nothing else ties the two together, so if one
9
changed without the other, the UBT would stand off the floor or the scoring
10
planes would cut into the walls without any error.
11
"""
12
13
from
pathlib
import
Path
14
15
import
geometry_config
16
import
pytest
17
import
shipunit
as
u
18
19
ROOT = pytest.importorskip(
"ROOT"
)
20
21
SOURCE = Path(__file__).resolve().parent.parent
22
23
# geometry_config name -> ShipCavernLayout constant
24
QUANTITIES = {
25
"ECN3LeftX"
:
"kECN3LeftX"
,
26
"ECN3RightX"
:
"kECN3RightX"
,
27
"ECN3FloorY"
:
"kECN3FloorY"
,
28
}
29
30
31
@pytest.fixture(scope="module")
32
def
layout
():
33
"""The ShipCavernLayout namespace, compiled by Cling from the header ShipCave uses."""
34
for
directory
in
(
"passive"
,
"shipdata"
):
35
ROOT.gInterpreter.AddIncludePath(str(SOURCE / directory))
36
assert
ROOT.gInterpreter.Declare(
'#include "ShipCavernLayout.h"'
)
37
return
ROOT.ShipCavernLayout
38
39
40
@pytest.mark.parametrize("quantity", QUANTITIES)
41
def
test_ecn3_cross_section_matches_ship_cave
(layout, quantity):
42
# Both are in the FairShip length unit.
43
cave =
geometry_config.create_config
().cave
44
assert
cave[quantity] == pytest.approx(getattr(layout, QUANTITIES[quantity]), abs=1.0e-6 * u.cm)
geometry_config.create_config
create_config(str DecayVolumeMedium="helium", float Yheight=6.0, int strawDesign=10, str shieldName="TRY_2026", int nuTargetPassive=1, bool SND=True, SND_design=None, TARGET_YAML=None)
Definition
geometry_config.py:133
test_cavern_layout.test_ecn3_cross_section_matches_ship_cave
test_ecn3_cross_section_matches_ship_cave(layout, quantity)
Definition
test_cavern_layout.py:41
test_cavern_layout.layout
layout()
Definition
test_cavern_layout.py:32
tests
test_cavern_layout.py
Generated by
Doxygen
1.15.0