53 """Set the UBT (c.UpstreamTagger) and its scoring planes (c.UpstreamTaggerScoringPlane).
55 Needs c.cave (with the ECN3 cavern), c.decayVolume.z0, c.muShield.z and c.muShield.length.
65 c.UpstreamTagger.Top = 1.7 * u.m
68 c.UpstreamTagger.FloorMargin = 2.4 * u.cm
69 c.UpstreamTagger.BoxX = 3.4 * u.m
70 c.UpstreamTagger.BoxY = c.UpstreamTagger.Top - c.cave.ECN3FloorY - c.UpstreamTagger.FloorMargin
71 c.UpstreamTagger.BoxCenterX = 0.0 * u.m
72 c.UpstreamTagger.BoxCenterY = (
73 c.UpstreamTagger.Top + c.cave.ECN3FloorY + c.UpstreamTagger.FloorMargin
75 c.UpstreamTagger.BoxZ = 16.0 * u.cm
81 c.UpstreamTagger.TileThickness = {2: 0.5 * u.cm, 4: 1.0 * u.cm}
83 c.UpstreamTagger.DecayVesselGap = 32.0 * u.cm
85 c.UpstreamTagger.z = c.decayVolume.z0 - c.UpstreamTagger.DecayVesselGap - c.UpstreamTagger.BoxZ / 2.0
86 c.UpstreamTagger.z0 = c.UpstreamTagger.z - c.UpstreamTagger.BoxZ / 2.0
87 c.UpstreamTagger.TimeResolution = 0.3
88 c.UpstreamTagger.ADCTriggerThreshold = 100
92 c.UpstreamTaggerScoringPlane =
AttrDict()
93 c.UpstreamTaggerScoringPlane.Z = 1.0 * u.mm
96 dv = c.UpstreamTaggerScoringPlane.DecayVessel =
AttrDict()
98 dv.Y = -2.0 * c.cave.ECN3FloorY
99 dv.CenterX = 0.0 * u.m
100 dv.CenterY = 0.0 * u.m
101 dv.z = c.decayVolume.z0 - c.UpstreamTaggerScoringPlane.Z / 2.0
108 dv.KeepTracks =
False
112 ms = c.UpstreamTaggerScoringPlane.MuonShield =
AttrDict()
114 ms.ShieldGap = 10.0 * u.cm
115 ms.X = 2.0 * c.cave.ECN3WallDistance
116 ms.Y = ms.Top - c.cave.ECN3FloorY
117 ms.CenterX = 0.0 * u.m
118 ms.CenterY = (ms.Top + c.cave.ECN3FloorY) / 2.0
119 ms.z = c.muShield.z + c.muShield.length + ms.ShieldGap
125 DecayVolumeMedium: str =
"helium",
126 Yheight: float = 6.0,
127 strawDesign: int = 10,
128 shieldName: str =
"TRY_2026",
129 nuTargetPassive: int = 1,
135 Create geometry configuration with specified parameters.
138 DecayVolumeMedium: Medium in decay volume ("helium" or "vacuums"), default: "helium"
139 Yheight: Height of vacuum tank in meters, default: 6.0
140 strawDesign: Straw tube design (4=Aluminium frame, 10=steel frame), default: 10
141 shieldName: Name of shield configuration, default: "TRY_2026"
142 nuTargetPassive: Target type (0=with active layers, 1=only passive), default: 1
143 SND: Enable SND detector, default: True
144 SND_design: SND design options (list of design numbers), default: [2]
145 TARGET_YAML: Path to target YAML configuration file, default: "$FAIRSHIP/geometry/target_config.yaml"
148 Config: Geometry configuration object
151 if SND_design
is None:
153 if TARGET_YAML
is None:
154 TARGET_YAML = os.path.expandvars(
"$FAIRSHIP/geometry/target_config.yaml")
158 c.DecayVolumeMedium = DecayVolumeMedium
161 if not isinstance(SND_design, list):
162 SND_design = [SND_design]
163 c.SND_design = SND_design
164 c.target_yaml = TARGET_YAML
165 print(
"Info: Target using configuration:", c.target_yaml)
168 raise ValueError(
"shieldName must not be empty!")
170 c.shieldName = shieldName
173 c.Yheight = Yheight * u.m
174 extraVesselLength = 10 * u.m
175 windowBulge = 25 * u.cm
176 c.strawDesign = strawDesign
180 c.cave.floorHeightMuonShield = 5 * u.m
181 c.cave.floorHeightTankA = 4.2 * u.m
182 if strawDesign == 10:
183 c.cave.floorHeightMuonShield = c.cave.floorHeightTankA
184 c.cave.floorHeightTankB = 2 * u.m
186 c.cave.TCC8_length = 170 * u.m
187 c.cave.ECN3_length = 100.81 * u.m
188 c.cave.stair_step_length = 0.82 * u.m
191 c.cave.z_transition = 21.37 * u.m
192 c.cave.zEnd = c.cave.z_transition + c.cave.ECN3_length
195 with open(c.target_yaml)
as file:
196 targetconfig = yaml.safe_load(file)
197 c.target =
AttrDict(targetconfig[
"target"])
198 if "version" not in c.target:
201 c.target.slices_length = []
202 c.target.slices_gap = []
203 c.target.slices_material = []
205 for i
in range(c.target.Nplates):
206 for j
in range(c.target.N[i]):
207 if len(c.target.L) == 1:
208 c.target.slices_length.append(c.target.L[0])
210 c.target.slices_length.append(c.target.L[i])
211 if len(c.target.G) == 1:
212 c.target.slices_gap.append(c.target.G[0])
214 c.target.slices_gap.append(c.target.G[i])
215 if len(c.target.M) == 1:
216 c.target.slices_material.append(c.target.M[0])
218 c.target.slices_material.append(c.target.M[i])
220 c.target.slices_gap[c.target.nS - 1] = 0
221 print(c.target.slices_material, c.target.slices_length, c.target.slices_gap)
224 for width, gap
in zip(c.target.slices_length, c.target.slices_gap):
225 target_length += width + gap
226 c.target.length = target_length
230 c.target.z = c.target.z0 + c.target.length / 2.0
239 c.target.length_fixed = 158.64 * u.cm
241 c.hadronAbsorber.z = (
243 + c.target.length_fixed
252 c.muShield.z = c.hadronAbsorber.z
254 params = shield_db[shieldName][
"params"]
255 c.muShield.params = params
258 c.muShield.length = sum(line[0] + line[1] * 2
for line
in params)
259 c.muShield.nMagnets = len(params)
262 c.muShield.half_length = []
263 c.muShield.Entrance = []
266 c.muShield.Zgap.append(line[0])
267 c.muShield.half_length.append(line[1])
270 for i
in range(len(c.muShield.Zgap)):
273 c.muShield.Entrance.append(c.muShield.z + c.muShield.Zgap[i])
276 c.muShield.Entrance.append(
277 c.muShield.Entrance[i - 1] + c.muShield.half_length[i - 1] * 2 + c.muShield.Zgap[i]
280 c.muShield.params = [item
for sublist
in params
for item
in sublist]
285 c.decayVolume.length = 50 * u.m
290 c.decayVolume.z = c.z - 31.450 * u.m
291 c.decayVolume.z0 = c.decayVolume.z - c.decayVolume.length / 2.0
292 veto_yaml = os.path.expandvars(f
"$FAIRSHIP/geometry/veto_config_{DecayVolumeMedium}.yaml")
293 with open(veto_yaml)
as f:
294 veto_config = yaml.safe_load(f)
295 c.decayVolume.xEndInner = veto_config[
"xendInner"] * u.cm
296 c.decayVolume.yEndInner = veto_config[
"yendInner"] * u.cm
299 magnetIncrease = 100.0 * u.cm
301 if strawDesign != 4
and strawDesign != 10:
302 raise ValueError(f
"straw design {strawDesign} is not supported, use strawDesign = 4 or 10")
304 c.chambers.Tub1length = 2.5 * u.m
305 c.chambers.Tub2length = 17.68 * u.m + extraVesselLength / 2.0
306 c.chambers.Tub3length = 0.8 * u.m
307 c.chambers.Tub4length = 2.0 * u.m + magnetIncrease / 2.0
308 c.chambers.Tub5length = 0.8 * u.m
309 c.chambers.Tub6length = 0.1 * u.m + windowBulge / 2.0
310 c.chambers.Rmin = 245.0 * u.cm
311 c.chambers.Rmax = 250.0 * u.cm
317 z4 = c.z + TrMagGap + TrGap
323 z1 = c.z - TrMagGap - TrGap
328 c.Chamber1 =
AttrDict(z=c.decayVolume.z0 + c.chambers.Tub1length)
329 c.Chamber6 =
AttrDict(z=z4 + 30.0 * u.cm + windowBulge / 2.0)
334 c.Bfield.y = c.Yheight
335 c.Bfield.x = 2.4 * u.m
336 c.Bfield.fieldMap =
"files/2026_07_02_MainSpectrometerField_V21_2455.root"
337 if c.magnetDesign > 3:
338 c.Bfield.YokeWidth = 0.8 * u.m
339 c.Bfield.YokeDepth = 1.4 * u.m
340 c.Bfield.CoilThick = 25.0 * u.cm
341 c.Bfield.x = 2.2 * u.m
342 c.Bfield.y = 3.5 * u.m
346 c.TimeDet.dzBarRow = 1.2 * u.cm
347 c.TimeDet.dzBarCol = 9.0 * u.cm
348 c.TimeDet.zBar = 1 * u.cm
349 c.TimeDet.DZ = (c.TimeDet.dzBarRow + c.TimeDet.dzBarCol + c.TimeDet.zBar) / 2
350 c.TimeDet.DX = 275 * u.cm
351 c.TimeDet.DY = 325 * u.cm
354 c.TimeDet.z = 37.870 * u.m + c.decayVolume.z + c.TimeDet.zBar / 2
359 c.CaloScoringPlane.DX = 4 * u.m
360 c.CaloScoringPlane.DY = 6 * u.m
361 c.CaloScoringPlane.DZ = 1 * u.mm
364 c.CaloScoringPlane.PositionResolution = 0.0 * u.cm
365 c.CaloScoringPlane.TimeResolution = 0.0
366 c.CaloScoringPlane.ForwardOnly =
True
367 c.CaloScoringPlane.IgnoredPdg = [12, 14, 16]
370 c.CaloScoringPlane.z = 38.900 * u.m + c.decayVolume.z + c.CaloScoringPlane.DZ / 2
371 if c.CaloScoringPlane.z + c.CaloScoringPlane.DZ / 2 >= c.cave.zEnd:
373 f
"CaloScoringPlane ends at z = {c.CaloScoringPlane.z + c.CaloScoringPlane.DZ / 2} cm, "
374 f
"beyond the downstream ECN3 wall at {c.cave.zEnd} cm"
379 c.strawtubesDigi.v_drift = 1.0 / (30 * u.ns / u.mm)
380 c.strawtubesDigi.sigma_spatial = 0.012 * u.cm
384 c.tauMudet.Ztot = 3 * u.m
385 c.tauMudet.zMudetC = c.muShield.z + c.muShield.length / 2.0 - c.tauMudet.Ztot / 2.0 - 70 * u.cm
390 c.nuTargetPassive = nuTargetPassive