SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
Envelopes.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) CERN for the benefit of the SHiP Collaboration
3
4#pragma once
5
8
9#include <array>
10#include <string_view>
11
25
26using units::LengthMm;
27
28struct Envelope {
29 std::string_view name;
36
37 [[nodiscard]] constexpr checks::Span z() const { return {.lo = zStart, .hi = zEnd}; }
38 [[nodiscard]] constexpr LengthMm maxHalfWidth() const {
40 }
41 [[nodiscard]] constexpr LengthMm maxHalfHeight() const {
43 }
44};
45
46namespace detail {
47inline constexpr auto m = units::m;
48} // namespace detail
49
50// clang-format off
51inline constexpr Envelope kHadronStopper{.name="Magnetised hadron stopper", .zStart=2.14 * detail::m, .zEnd=4.44 * detail::m,
52 .halfWidthUp=0.0 * detail::m, .halfWidthDown=0.0 * detail::m, .halfHeightUp=0.0 * detail::m, .halfHeightDown=0.0 * detail::m};
53inline constexpr std::array<Envelope, 5> kMuonShield{{
54 {.name="Muon shield 1 (NC)", .zStart=4.74 * detail::m, .zEnd=12.14 * detail::m, .halfWidthUp=2.10 * detail::m, .halfWidthDown=2.00 * detail::m, .halfHeightUp=1.60 * detail::m, .halfHeightDown=1.60 * detail::m},
55 {.name="Muon shield 2 (NC)", .zStart=12.24 * detail::m, .zEnd=19.24 * detail::m, .halfWidthUp=0.35 * detail::m, .halfWidthDown=1.15 * detail::m, .halfHeightUp=0.35 * detail::m, .halfHeightDown=1.55 * detail::m},
56 {.name="Muon shield 3 (NC)", .zStart=19.34 * detail::m, .zEnd=24.34 * detail::m, .halfWidthUp=0.10 * detail::m, .halfWidthDown=1.65 * detail::m, .halfHeightUp=1.95 * detail::m, .halfHeightDown=2.30 * detail::m},
57 {.name="Muon shield 4 (NC)", .zStart=24.44 * detail::m, .zEnd=26.12 * detail::m, .halfWidthUp=0.10 * detail::m, .halfWidthDown=1.65 * detail::m, .halfHeightUp=1.95 * detail::m, .halfHeightDown=2.30 * detail::m},
58 {.name="Muon shield 5 (NC)", .zStart=26.22 * detail::m, .zEnd=32.22 * detail::m, .halfWidthUp=0.50 * detail::m, .halfWidthDown=1.60 * detail::m, .halfHeightUp=0.10 * detail::m, .halfHeightDown=2.15 * detail::m},
59}};
60inline constexpr Envelope kNeutrinoDetector{.name="Scattering and neutrino detector", .zStart=26.40 * detail::m, .zEnd=31.50 * detail::m,
61 .halfWidthUp=0.30 * detail::m, .halfWidthDown=0.40 * detail::m, .halfHeightUp=0.30 * detail::m, .halfHeightDown=0.40 * detail::m};
62inline constexpr Envelope kUpstreamTagger{.name="Upstream background tagger", .zStart=32.52 * detail::m, .zEnd=32.92 * detail::m,
63 .halfWidthUp=0.75 * detail::m, .halfWidthDown=0.75 * detail::m, .halfHeightUp=1.60 * detail::m, .halfHeightDown=1.60 * detail::m};
64inline constexpr Envelope kDecayVolume{.name="Decay volume", .zStart=32.92 * detail::m, .zEnd=83.32 * detail::m,
65 .halfWidthUp=0.70 * detail::m, .halfWidthDown=2.20 * detail::m, .halfHeightUp=1.55 * detail::m, .halfHeightDown=3.20 * detail::m};
66
68inline constexpr auto kSurroundTaggerThickness = 0.46 * detail::m;
69inline constexpr std::array<Envelope, 4> kTrackerStations{{
70 {.name="Straw Tracker station 1", .zStart=83.57 * detail::m, .zEnd=84.57 * detail::m, .halfWidthUp=3.00 * detail::m, .halfWidthDown=3.00 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
71 {.name="Straw Tracker station 2", .zStart=85.57 * detail::m, .zEnd=86.57 * detail::m, .halfWidthUp=3.00 * detail::m, .halfWidthDown=3.00 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
72 {.name="Straw Tracker station 3", .zStart=92.57 * detail::m, .zEnd=93.57 * detail::m, .halfWidthUp=3.00 * detail::m, .halfWidthDown=3.00 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
73 {.name="Straw Tracker station 4", .zStart=94.57 * detail::m, .zEnd=95.57 * detail::m, .halfWidthUp=3.00 * detail::m, .halfWidthDown=3.00 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
74}};
75inline constexpr Envelope kMagnet{.name="Main spectrometer magnet", .zStart=87.07 * detail::m, .zEnd=92.07 * detail::m,
76 .halfWidthUp=3.25 * detail::m, .halfWidthDown=3.25 * detail::m, .halfHeightUp=4.30 * detail::m, .halfHeightDown=4.30 * detail::m};
77inline constexpr Envelope kTimingDetector{.name="Timing detector", .zStart=95.82 * detail::m, .zEnd=96.32 * detail::m,
78 .halfWidthUp=2.75 * detail::m, .halfWidthDown=2.75 * detail::m, .halfHeightUp=3.25 * detail::m, .halfHeightDown=3.25 * detail::m};
79inline constexpr std::array<Envelope, 3> kCalorimeter{{
80 {.name="Split ECAL (front)", .zStart=96.87 * detail::m, .zEnd=97.07 * detail::m, .halfWidthUp=2.25 * detail::m, .halfWidthDown=2.25 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
81 {.name="Split ECAL (back)", .zStart=98.07 * detail::m, .zEnd=98.67 * detail::m, .halfWidthUp=2.75 * detail::m, .halfWidthDown=2.75 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
82 {.name="HCAL", .zStart=98.77 * detail::m, .zEnd=99.77 * detail::m, .halfWidthUp=3.00 * detail::m, .halfWidthDown=3.00 * detail::m, .halfHeightUp=3.50 * detail::m, .halfHeightDown=3.50 * detail::m},
83}};
84// clang-format on
85
88template <std::size_t N>
89[[nodiscard]] constexpr Envelope hull(std::string_view name, const std::array<Envelope, N>& parts) {
90 Envelope out{name,
91 parts.front().zStart,
92 parts.back().zEnd,
93 parts.front().maxHalfWidth(),
94 parts.front().maxHalfWidth(),
95 parts.front().maxHalfHeight(),
96 parts.front().maxHalfHeight()};
97 for (const auto& part : parts) {
98 out.zStart = part.zStart < out.zStart ? part.zStart : out.zStart;
99 out.zEnd = out.zEnd < part.zEnd ? part.zEnd : out.zEnd;
100 const auto w = part.maxHalfWidth();
101 const auto h = part.maxHalfHeight();
102 out.halfWidthUp = out.halfWidthDown = out.halfWidthUp < w ? w : out.halfWidthUp;
103 out.halfHeightUp = out.halfHeightDown = out.halfHeightUp < h ? h : out.halfHeightUp;
104 }
105 return out;
106}
107
108} // namespace SHiP::geometry::envelopes
Definition Envelopes.h:46
constexpr auto m
Definition Envelopes.h:47
Reference subsystem envelopes, for compile-time placement checks.
Definition Envelopes.h:24
constexpr Envelope kMagnet
Definition Envelopes.h:75
constexpr std::array< Envelope, 3 > kCalorimeter
Definition Envelopes.h:79
constexpr auto kSurroundTaggerThickness
Thickness of the SBT shell around the decay volume (the CSV lists it as a half-width/height of 0....
Definition Envelopes.h:68
constexpr Envelope kUpstreamTagger
Definition Envelopes.h:62
constexpr Envelope kNeutrinoDetector
Definition Envelopes.h:60
constexpr std::array< Envelope, 4 > kTrackerStations
Definition Envelopes.h:69
constexpr Envelope hull(std::string_view name, const std::array< Envelope, N > &parts)
Union of several consecutive envelopes, from the first start to the last end, with the largest transv...
Definition Envelopes.h:89
constexpr Envelope kTimingDetector
Definition Envelopes.h:77
constexpr Envelope kDecayVolume
Definition Envelopes.h:64
constexpr std::array< Envelope, 5 > kMuonShield
Definition Envelopes.h:53
constexpr Envelope kHadronStopper
Definition Envelopes.h:51
mp_units::quantity< mm > LengthMm
Spellings for struct members and function parameters.
Definition Units.h:39
constexpr auto m
Definition Units.h:29
Closed interval along one axis.
Definition StaticChecks.h:29
Definition Envelopes.h:28
LengthMm zStart
Definition Envelopes.h:30
LengthMm halfHeightDown
Definition Envelopes.h:35
LengthMm halfHeightUp
Definition Envelopes.h:34
constexpr LengthMm maxHalfWidth() const
Definition Envelopes.h:38
LengthMm zEnd
Definition Envelopes.h:31
constexpr LengthMm maxHalfHeight() const
Definition Envelopes.h:41
LengthMm halfWidthDown
Definition Envelopes.h:33
LengthMm halfWidthUp
Definition Envelopes.h:32
constexpr checks::Span z() const
Definition Envelopes.h:37
std::string_view name
Definition Envelopes.h:29