SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
TimingDetectorFactory.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
9
10class GeoPhysVol;
11
12namespace SHiP::geometry {
13
14class Materials;
15
30 public:
31 explicit TimingDetectorFactory(Materials& materials);
33
39 static constexpr SubsystemDescriptor descriptor() {
40 using units::gm;
41 using units::m;
42 return {.name = "TimingDetector",
43 .node = "/SHiP/timing_detector",
44 .id = 7,
45 .x_mm = 0.0,
46 .y_mm = 0.0,
47 .z_mm = gm(95.902 * m),
48 .isWorld = false};
49 }
50
52 [[nodiscard]] GeoPhysVol* build();
53
55 int barCount() const { return m_barCount; }
56
57 // Container dimensions
58 static constexpr auto s_containerHalfX = 2750.0 * units::mm;
59 static constexpr auto s_containerHalfY = 3250.0 * units::mm;
60 static constexpr auto s_containerHalfZ = 250.0 * units::mm;
61
62 // Bar dimensions
63 static constexpr auto s_barHalfX = 700.0 * units::mm; // 140 cm full length
64 static constexpr auto s_barHalfY = 30.0 * units::mm; // 6 cm full width
65 static constexpr auto s_barHalfZ = 5.0 * units::mm; // 1 cm full thickness
66
67 // Bar grid layout
68 static constexpr int s_nColumns = 3;
69 static constexpr int s_nRows = 110;
70 static constexpr auto s_columnPitchX = 1300.0 * units::mm; // column spacing in X
71 static constexpr auto s_rowY0 = -3220.0 * units::mm; // first-row Y
72 static constexpr auto s_rowStepY = 6440.0 / 109.0 * units::mm; // row pitch ≈ 59.083 mm
73 static constexpr auto s_zStaggerRow = 12.0 * units::mm; // odd-row Z offset
74 static constexpr auto s_zStaggerCol = 90.0 * units::mm; // odd-column Z offset
75
76 struct BarCentre {
78 };
79
84 static constexpr BarCentre barCentre(int ic, int ir) {
85 return {.x = (ic - 1) * s_columnPitchX,
86 .y = s_rowY0 + ir * s_rowStepY,
87 .z = (ir % 2) * s_zStaggerRow + (ic % 2) * s_zStaggerCol};
88 }
89
90 static constexpr checks::Box barBox(int ic, int ir) {
91 const auto c = barCentre(ic, ir);
92 return checks::box(c.x, c.y, c.z, s_barHalfX, s_barHalfY, s_barHalfZ);
93 }
94
95 private:
96 Materials& m_materials;
97 int m_barCount{0};
98};
99
100} // namespace SHiP::geometry
Central material manager for the SHiP detector.
Definition Materials.h:22
static constexpr BarCentre barCentre(int ic, int ir)
Centre of the bar in column ic, row ir: x = (ic - 1) * pitch → -1300, 0, +1300 mm y = y0 + ir * step ...
Definition TimingDetectorFactory.h:84
static constexpr auto s_zStaggerCol
Definition TimingDetectorFactory.h:74
static constexpr int s_nColumns
Definition TimingDetectorFactory.h:68
static constexpr auto s_containerHalfZ
Definition TimingDetectorFactory.h:60
static constexpr auto s_containerHalfX
Definition TimingDetectorFactory.h:58
static constexpr auto s_zStaggerRow
Definition TimingDetectorFactory.h:73
static constexpr auto s_rowStepY
Definition TimingDetectorFactory.h:72
static constexpr checks::Box barBox(int ic, int ir)
Definition TimingDetectorFactory.h:90
static constexpr auto s_barHalfX
Definition TimingDetectorFactory.h:63
static constexpr auto s_barHalfZ
Definition TimingDetectorFactory.h:65
TimingDetectorFactory(Materials &materials)
Definition TimingDetectorFactory.cpp:82
GeoPhysVol * build()
Build the TimingDetector geometry and return the container volume.
Definition TimingDetectorFactory.cpp:84
static constexpr auto s_columnPitchX
Definition TimingDetectorFactory.h:70
static constexpr SubsystemDescriptor descriptor()
This subsystem's self-description (name, node, id, placement).
Definition TimingDetectorFactory.h:39
int barCount() const
Number of bars placed during the last build() call.
Definition TimingDetectorFactory.h:55
static constexpr auto s_rowY0
Definition TimingDetectorFactory.h:71
static constexpr int s_nRows
Definition TimingDetectorFactory.h:69
static constexpr auto s_barHalfY
Definition TimingDetectorFactory.h:64
static constexpr auto s_containerHalfY
Definition TimingDetectorFactory.h:59
constexpr Box box(LengthMm cx, LengthMm cy, LengthMm cz, LengthMm hx, LengthMm hy, LengthMm hz)
Box with centre (cx, cy, cz) and the given half-lengths.
Definition StaticChecks.h:57
mp_units::quantity< mm > LengthMm
Spellings for struct members and function parameters.
Definition Units.h:39
constexpr auto m
Definition Units.h:29
constexpr double gm(mp_units::quantity< U, Rep > q)
Length quantity -> GeoModel raw double (GeoModel native unit: mm).
Definition Units.h:47
constexpr auto mm
Definition Units.h:27
Definition DetectorBuilder.h:8
constexpr double gm(mp_units::quantity< U, Rep > q)
Length quantity -> GeoModel raw double (GeoModel native unit: mm).
Definition Units.h:47
A subsystem's self-description: everything the assembler needs.
Definition SubsystemDescriptor.h:20
Definition TimingDetectorFactory.h:76
units::LengthMm z
Definition TimingDetectorFactory.h:77
units::LengthMm y
Definition TimingDetectorFactory.h:77
units::LengthMm x
Definition TimingDetectorFactory.h:77
Axis-aligned box.
Definition StaticChecks.h:50