SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
TargetFactory.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
10#include <array>
11#include <cstddef>
12
13class GeoPhysVol;
14class GeoLogVol;
15class GeoShape;
16
17namespace SHiP::geometry {
18
19class Materials;
20
47 public:
48 explicit TargetFactory(Materials& materials);
49 ~TargetFactory() = default;
50
58 static constexpr SubsystemDescriptor descriptor() {
59 using units::gm;
60 return {.name = "Target",
61 .node = "/SHiP/target",
62 .id = 1,
63 .x_mm = 0.0,
64 .y_mm = gm(-s_targetAreaPosY),
65 .z_mm = gm(-s_targetAreaPosZ),
66 .isWorld = false};
67 }
68
73 [[nodiscard]] GeoPhysVol* build();
74
75 // Unit shorthands (typed; constants below deduce their quantity type)
76 static constexpr auto cm = units::cm;
77 static constexpr auto mm = units::mm;
78 static constexpr auto deg = units::deg;
79
80 // Target vacuum box dimensions (half-sizes)
81 static constexpr auto s_vacuumBoxHalfX = 80.0 * cm;
82 static constexpr auto s_vacuumBoxHalfY = 113.55 * cm;
83 static constexpr auto s_vacuumBoxHalfZ = 150.0 * cm;
84
85 // TargetArea position within vacuum box: the target frame (z = 0 at the
86 // front face of the first disk) sits at this offset in the vacuum box
87 static constexpr auto s_targetAreaPosY = 14.45 * cm;
88 static constexpr auto s_targetAreaPosZ = -43.25 * cm;
89
90 private:
91 Materials& m_materials;
92
93 // Helper methods
94 GeoPhysVol* createProximityShielding();
95 GeoPhysVol* createTopShielding();
96 GeoPhysVol* createBottomShielding();
97 GeoPhysVol* createShieldingPedestal();
98 GeoPhysVol* createHeVolume();
99 const GeoShape* createSteelCoreShape();
100
101 // Proximity shielding
102 static constexpr auto s_proxEnvHalfX = 80.0 * cm;
103 static constexpr auto s_proxEnvHalfY = 56.3 * cm;
104 static constexpr auto s_proxEnvHalfZ = 150.0 * cm;
105 static constexpr auto s_proxInnerHalfX = 55.0 * cm;
106 static constexpr auto s_proxInnerHalfY = 56.3 * cm;
107 static constexpr auto s_proxInnerHalfZ = 110.0 * cm;
108 static constexpr auto s_proxInnerOffsetZ = 15.0 * cm;
109 static constexpr auto s_proxHoleRadius = 10.0 * cm;
110 static constexpr auto s_proxHoleHalfZ = 27.5 * cm;
111 static constexpr auto s_proxHoleOffsetY = 17.2 * cm;
112 static constexpr auto s_proxHoleOffsetZ = -122.5 * cm;
113 static constexpr auto s_proxPosY = -2.75 * cm;
114
115 // Top shielding
116 static constexpr auto s_topShieldHalfX = 80.0 * cm;
117 static constexpr auto s_topShieldHalfY = 30.0 * cm;
118 static constexpr auto s_topShieldHalfZ = 150.0 * cm;
119 static constexpr auto s_topShieldPosY = 83.55 * cm;
120
121 // Bottom shielding
122 static constexpr auto s_bottomShieldHalfX = 80.0 * cm;
123 static constexpr auto s_bottomShieldHalfY = 27.25 * cm;
124 static constexpr auto s_bottomShieldHalfZ = 150.0 * cm;
125 static constexpr auto s_bottomShieldPosY = -86.3 * cm;
126
127 // Shielding pedestal
128 static constexpr auto s_pedestalHalfX = 53.5 * cm;
129 static constexpr auto s_pedestalHalfY = 7.5 * cm;
130 static constexpr auto s_pedestalHalfZ = 108.5 * cm;
131 static constexpr auto s_pedestalPosY = -51.55 * cm;
132 static constexpr auto s_pedestalPosZ = 15.0 * cm;
133
134 // ---- 2026 BDF target (CATIA ST1A07710_01_AB.02) ----
135 // All z values below are in the target frame (z = 0 at disk-1 front face).
136
137 // HeVolume: container for disks, steel core, jacket, flanges, beam
138 // window, cover-plate bore rings and endcap
139 static constexpr auto s_heRadius = 237.0 * mm;
140 static constexpr auto s_heZMin = -37.8 * mm; // upstream face of the cover plate
141 static constexpr auto s_heZMax = 1509.7 * mm; // downstream end of rear endcap
142 static constexpr auto s_heCentreZ = 0.5 * (s_heZMin + s_heZMax);
143
144 // Tungsten disks: [z start, z end] per disk; 4-5 mm He slits in between
145 static constexpr int s_numDisks = 33;
146 static constexpr auto s_diskRadius = 125.0 * mm;
147 static constexpr auto s_lastDiskRadius = 157.0 * mm; // rear block
148 static constexpr std::array<std::array<units::LengthMm, 2>, s_numDisks> s_diskZ = {{
149 {0.0 * mm, 30.0 * mm}, {34.0 * mm, 44.0 * mm}, {48.0 * mm, 56.0 * mm},
150 {60.0 * mm, 68.0 * mm}, {72.0 * mm, 80.0 * mm}, {84.0 * mm, 92.0 * mm},
151 {96.0 * mm, 104.0 * mm}, {108.0 * mm, 116.0 * mm}, {120.0 * mm, 128.0 * mm},
152 {132.0 * mm, 140.0 * mm}, {144.0 * mm, 152.0 * mm}, {156.0 * mm, 164.0 * mm},
153 {168.0 * mm, 176.0 * mm}, {180.0 * mm, 188.0 * mm}, {192.0 * mm, 200.0 * mm},
154 {204.0 * mm, 212.0 * mm}, {216.0 * mm, 224.0 * mm}, {228.0 * mm, 237.0 * mm},
155 {241.0 * mm, 252.0 * mm}, {256.0 * mm, 268.0 * mm}, {272.0 * mm, 285.0 * mm},
156 {289.0 * mm, 302.0 * mm}, {306.0 * mm, 322.0 * mm}, {326.0 * mm, 346.0 * mm},
157 {350.0 * mm, 370.0 * mm}, {375.0 * mm, 396.0 * mm}, {401.0 * mm, 431.0 * mm},
158 {435.0 * mm, 475.0 * mm}, {479.0 * mm, 534.0 * mm}, {538.0 * mm, 611.0 * mm},
159 {615.0 * mm, 721.0 * mm}, {725.0 * mm, 1001.0 * mm}, {1005.0 * mm, 1460.0 * mm},
160 }};
161
162 // Steel core (two clamp halves modelled as one axisymmetric piece)
163 static constexpr auto s_coreZMin = 7.2 * mm;
164 static constexpr auto s_coreZMax = 1443.7 * mm;
165 static constexpr auto s_coreBoreR1 = 125.0 * mm; // matches disks 1..32
166 static constexpr auto s_coreBoreR2 = 157.0 * mm; // matches the rear block
167 static constexpr auto s_coreBoreStepZ = 1005.0 * mm; // bore radius change
168 static constexpr auto s_coreOuterR = 207.0 * mm;
169 static constexpr auto s_coreFrontOuterR = 195.0 * mm; // front, inside the flange
170 static constexpr auto s_coreFrontZMax = 55.2 * mm; // end of front step
171 static constexpr auto s_coreRearOuterR = 190.0 * mm; // rear, inside rear flange
172 static constexpr auto s_coreRearZMin = 1233.7 * mm; // start of rear step
173
174 // Serpentine He cooling grooves: arcs in the bore, centred on the vertical
175 // axis, staggered between the upper and lower half; He flows between them
176 // through the inter-disk slits
177 static constexpr auto s_grooveRmin = 120.0 * mm; // below bore: clean subtraction
178 static constexpr auto s_grooveRmax = 153.0 * mm;
179 static constexpr auto s_groovePhiWidth = 61.0 * deg;
180 static constexpr std::array<std::array<units::LengthMm, 2>, 5> s_groovesTop = {{
181 {12.2 * mm, 57.0 * mm},
182 {95.0 * mm, 153.0 * mm},
183 {191.0 * mm, 257.0 * mm},
184 {300.0 * mm, 464.0 * mm},
185 {559.0 * mm, 933.2 * mm},
186 }};
187 static constexpr std::array<std::array<units::LengthMm, 2>, 4> s_groovesBottom = {{
188 {45.0 * mm, 104.7 * mm},
189 {142.7 * mm, 200.7 * mm},
190 {238.7 * mm, 334.7 * mm},
191 {385.7 * mm, 1005.0 * mm},
192 }};
193 // Groove around the rear block (upper half only), ends 2 mm before the
194 // core rear face
195 static constexpr auto s_rearGrooveRmin = 152.0 * mm; // below bore R2
196 static constexpr auto s_rearGrooveRmax = 182.0 * mm;
197 static constexpr auto s_rearGroovePhiWidth = 49.0 * deg;
198 static constexpr auto s_rearGrooveZMin = 1005.0 * mm;
199 static constexpr auto s_rearGrooveZMax = 1441.7 * mm;
200
201 // Jacket tube and flanges; He annulus between core (207) and jacket (217).
202 // The flange bore matches the core front step, so the flange/jacket
203 // boundary is placed at the end of the step. The flange proper starts at
204 // the cover-plate step; upstream of it the outer radius is the r 195
205 // nose that slides into the cover-plate bore.
206 static constexpr auto s_jacketRmin = 217.0 * mm;
207 static constexpr auto s_jacketRmax = 225.0 * mm;
208 static constexpr auto s_jacketZMin = s_coreFrontZMax;
209 static constexpr auto s_jacketZMax = 1198.7 * mm;
210 static constexpr auto s_flangeFrontRmin = 195.0 * mm;
211 static constexpr auto s_flangeFrontZMin = -23.8 * mm; // cover-plate step
212 static constexpr auto s_noseZMin = -35.8 * mm; // upstream face of the vessel
213 static constexpr auto s_flangeRearRmax = 237.0 * mm;
214 static constexpr auto s_flangeRearZMax = 1263.7 * mm;
215
216 // Beam window: dished membrane closing the bore, simplified to a flat
217 // disc preserving the 8 mm of steel on the beam axis; the r 141-195 nose
218 // ring connects the window rim to the flange
219 static constexpr auto s_windowRmax = 141.0 * mm;
220 static constexpr auto s_windowZMin = -33.5 * mm;
221 static constexpr auto s_windowZMax = -25.5 * mm;
222
223 // Upstream cover plate (600 x 650 x 20 mm, stepped bore r 196/226 mm,
224 // asymmetric about the beam axis: +250 mm above, -400 mm below): the
225 // part within the He container is modelled as two bore rings, the
226 // rectangular remainder as a box-minus-tube outside it
227 static constexpr auto s_coverRing1Rmin = 196.0 * mm;
228 static constexpr auto s_coverRing2Rmin = 226.0 * mm;
229 static constexpr auto s_coverZMax = -17.8 * mm;
230 static constexpr auto s_coverPlateHalfX = 300.0 * mm;
231 static constexpr auto s_coverPlateHalfY = 325.0 * mm;
232 static constexpr auto s_coverPlateHalfZ = 10.0 * mm;
233 static constexpr auto s_coverPlateOffsetY = -75.0 * mm; // plate centre below the axis
234
235 // Rear endcap: 8 mm shell, cylindrical section closed by a domed head;
236 // polycone planes (z, rmin, rmax) approximating the dome with three cone
237 // segments and an apex disc
238 static constexpr std::array<std::array<units::LengthMm, 3>, 6> s_endcapPlanes = {{
239 {1263.7 * mm, 229.0 * mm, 237.0 * mm},
240 {1413.7 * mm, 229.0 * mm, 237.0 * mm},
241 {1450.0 * mm, 212.0 * mm, 223.0 * mm},
242 {1480.0 * mm, 142.0 * mm, 166.5 * mm},
243 {1505.0 * mm, 0.0 * mm, 67.0 * mm},
244 {1509.7 * mm, 0.0 * mm, 67.0 * mm},
245 }};
246
247 // ── Compile-time validation ─────────────────────────────────────────
248 // Target frame: disks, core, grooves, vessel and endcap.
249 static_assert(s_diskZ.front()[0] == 0.0 * mm,
250 "the target frame origin is the front face of the first disk");
251 static_assert(
252 [] {
253 for (std::size_t i = 0; i < s_diskZ.size(); ++i) {
254 if (!(s_diskZ[i][0] < s_diskZ[i][1]) ||
255 (i > 0 && !(s_diskZ[i - 1][1] < s_diskZ[i][0]))) {
256 return false;
257 }
258 }
259 return true;
260 }(),
261 "disks must have positive thickness and He slits between them");
262 static_assert(
263 [] {
264 auto front = 0.0 * mm;
265 for (std::size_t i = 0; i + 1 < s_diskZ.size(); ++i) {
266 front += s_diskZ[i][1] - s_diskZ[i][0];
267 }
268 return front == 875.0 * mm && s_diskZ.back()[1] - s_diskZ.back()[0] == 455.0 * mm;
269 }(),
270 "transcription guard: 875 mm of tungsten in disks 1-32 and a 455 mm rear block");
271 static_assert(s_heZMin <= s_noseZMin && s_noseZMin <= s_windowZMin &&
272 s_windowZMin < s_windowZMax && s_windowZMax < s_diskZ.front()[0] &&
273 s_diskZ.back()[1] < s_heZMax,
274 "beam window, disks and endcap out of order inside the He vessel");
275 static_assert(s_diskRadius <= s_lastDiskRadius && s_lastDiskRadius < s_heRadius);
276 static_assert(s_coreBoreR1 == s_diskRadius && s_coreBoreR2 == s_lastDiskRadius &&
277 s_coreBoreStepZ == s_diskZ.back()[0],
278 "the core bore must follow the disk radii and step at the rear block");
279 static_assert(s_heZMin <= s_coreZMin && s_coreZMax <= s_heZMax &&
280 s_coreFrontZMax < s_coreRearZMin,
281 "the steel core does not fit the He vessel");
282 static_assert(s_coreFrontOuterR <= s_coreOuterR && s_coreRearOuterR <= s_coreOuterR &&
283 s_coreOuterR < s_jacketRmin && s_jacketRmin < s_jacketRmax &&
284 s_jacketRmax <= s_heRadius && s_flangeRearRmax <= s_heRadius,
285 "core, He annulus, jacket and flanges must nest radially inside the vessel");
286 static_assert(s_flangeFrontRmin == s_coreFrontOuterR,
287 "the front flange bore must match the core front step");
288 static_assert(s_jacketZMax < s_flangeRearZMax &&
289 s_flangeRearZMax == s_endcapPlanes.front()[0] &&
290 s_endcapPlanes.back()[0] == s_heZMax,
291 "the endcap must run from the rear flange to the end of the He vessel");
292 static_assert(
293 [] {
294 for (std::size_t i = 0; i < s_endcapPlanes.size(); ++i) {
295 const auto& p = s_endcapPlanes[i];
296 if (!(p[1] < p[2]) || p[2] > s_heRadius ||
297 (i > 0 && s_endcapPlanes[i - 1][0] > p[0])) {
298 return false;
299 }
300 }
301 return true;
302 }(),
303 "endcap planes must be ordered in z with rmin < rmax inside the vessel");
304 static_assert(
305 [] {
306 const auto ok = [](const auto& grooves) {
307 for (std::size_t i = 0; i < grooves.size(); ++i) {
308 if (!(grooves[i][0] < grooves[i][1]) || grooves[i][0] < s_coreZMin ||
309 grooves[i][1] > s_coreBoreStepZ ||
310 (i > 0 && grooves[i - 1][1] > grooves[i][0])) {
311 return false;
312 }
313 }
314 return true;
315 };
316 return ok(s_groovesTop) && ok(s_groovesBottom);
317 }(),
318 "cooling grooves must be ordered and lie along the disk bore of the core");
319 static_assert(s_grooveRmin < s_coreBoreR1 && s_grooveRmax < s_coreOuterR &&
320 s_rearGrooveRmin < s_coreBoreR2 && s_rearGrooveRmax < s_coreRearOuterR &&
321 s_rearGrooveZMin == s_coreBoreStepZ && s_rearGrooveZMax < s_coreZMax,
322 "cooling grooves must open into the bore and stay inside the core wall");
323
324 // Vacuum-box frame: the He vessel and the cover plate sit in the cavity
325 // of the proximity shielding.
326 static_assert(
327 [] {
328 const auto cavity = checks::box(0.0 * mm, s_proxPosY, s_proxInnerOffsetZ,
329 s_proxInnerHalfX, s_proxInnerHalfY, s_proxInnerHalfZ);
330 const auto he = checks::box(0.0 * mm, s_targetAreaPosY, s_targetAreaPosZ + s_heCentreZ,
331 s_heRadius, s_heRadius, 0.5 * (s_heZMax - s_heZMin));
332 const auto cover = checks::box(0.0 * mm, s_targetAreaPosY + s_coverPlateOffsetY,
333 s_targetAreaPosZ + 0.5 * (s_heZMin + s_coverZMax),
334 s_coverPlateHalfX, s_coverPlateHalfY, s_coverPlateHalfZ);
335 return checks::contains(cavity, he) && checks::contains(cavity, cover);
336 }(),
337 "the He vessel or the cover plate does not fit the proximity-shielding cavity");
338 static_assert(
339 [] {
340 const auto d = (s_coverZMax - s_heZMin) - 2.0 * s_coverPlateHalfZ;
341 return -1e-9 * mm < d && d < 1e-9 * mm;
342 }(),
343 "the cover plate must span from the vessel front face to s_coverZMax");
344};
345
346} // namespace SHiP::geometry
Central material manager for the SHiP detector.
Definition Materials.h:22
static constexpr auto s_targetAreaPosZ
Definition TargetFactory.h:88
static constexpr auto cm
Definition TargetFactory.h:76
GeoPhysVol * build()
Build the Target geometry.
Definition TargetFactory.cpp:30
static constexpr auto deg
Definition TargetFactory.h:78
static constexpr auto s_vacuumBoxHalfY
Definition TargetFactory.h:82
static constexpr SubsystemDescriptor descriptor()
This subsystem's self-description (name, node, id, placement).
Definition TargetFactory.h:58
static constexpr auto s_targetAreaPosY
Definition TargetFactory.h:87
static constexpr auto s_vacuumBoxHalfZ
Definition TargetFactory.h:83
TargetFactory(Materials &materials)
Definition TargetFactory.cpp:28
static constexpr auto mm
Definition TargetFactory.h:77
static constexpr auto s_vacuumBoxHalfX
Definition TargetFactory.h:81
constexpr bool contains(Span outer, Span inner, LengthMm tol=0.0 *units::mm)
inner lies within outer, allowing tol of slack at either end.
Definition StaticChecks.h:40
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
constexpr auto deg
Definition Units.h:30
constexpr double gm(mp_units::quantity< U, Rep > q)
Length quantity -> GeoModel raw double (GeoModel native unit: mm).
Definition Units.h:47
constexpr auto cm
Definition Units.h:28
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
constexpr auto mm
Definition Units.h:27
A subsystem's self-description: everything the assembler needs.
Definition SubsystemDescriptor.h:20
constexpr auto mm
Definition Units.h:27