FairShip
Loading...
Searching...
No Matches
shipDet_conf Namespace Reference

Functions

None configure_snd_old (str yaml_file, emulsion_target_z_end, cave_floorHeightMuonShield)
 
None configure_snd_mtc (str yaml_file, ship_geo)
 
None configure_snd_siliconTarget (str yaml_file, ship_geo)
 
None configure_veto (str yaml_file, z0)
 
None configure_strawtubes (str yaml_file, ship_geo)
 
def configure (run, ship_geo)
 

Variables

list detectorList = []
 

Function Documentation

◆ configure()

def shipDet_conf.configure (   run,
  ship_geo 
)

Definition at line 265 of file shipDet_conf.py.

265def configure(run, ship_geo):
266 # ---- for backward compatibility ----
267 if not hasattr(ship_geo, "DecayVolumeMedium"):
268 raise ValueError("DecayVolumeMedium is not defined, possibly old (incompatible) geometry!")
269 if not hasattr(ship_geo, "muShieldGeo"):
270 ship_geo.muShieldGeo = None
271 if not hasattr(ship_geo.Bfield, "x"):
272 ship_geo.Bfield.x = 3.0 * u.m
273 if not hasattr(ship_geo, "cave"):
274 ship_geo.cave = AttrDict(z=0 * u.cm)
275 ship_geo.cave.floorHeightMuonShield = 5 * u.m
276 ship_geo.cave.floorHeightTankA = 4.5 * u.m
277 ship_geo.cave.floorHeightTankB = 2.0 * u.m
278 if not hasattr(ship_geo, "SND"):
279 ship_geo.SND = True
280
281 # -----Create media-------------------------------------------------
282 run.SetMaterials("media.geo") # Materials
283 # ------------------------------------------------------------------------
284
285 # -----Create geometry----------------------------------------------
286 cave = ROOT.ShipCave(ship_geo.muShield.z)
287 cave.SetGeometryFileName("caveWithAir.geo")
288 detectorList.append(cave)
289
290 TargetStation = ROOT.ShipTargetStation(
291 "TargetStation",
292 ship_geo.target.length,
293 ship_geo.target.z,
294 ship_geo.target.nS,
295 ship_geo.target.HeT,
296 )
297
298 TargetStation.SetLayerPosMat(
299 ship_geo.target.xy, ship_geo.target.slices_length, ship_geo.target.slices_gap, ship_geo.target.slices_material
300 )
301 detectorList.append(TargetStation)
302
303 # For SND: support multiple designs
304 if ship_geo.SND:
305 for design in ship_geo.SND_design:
306 if design == 2:
307 # SND design 2 -- MTC/SiliconTarget
308 configure_snd_mtc(os.path.join(os.environ["FAIRSHIP"], "geometry", "MTC_config.yaml"), ship_geo)
309 configure_snd_siliconTarget(
310 os.path.join(os.environ["FAIRSHIP"], "geometry", "SiliconTarget_config.yaml"), ship_geo
311 )
312 elif design == 1:
313 configure_snd_old(
314 os.path.join(os.environ["FAIRSHIP"], "geometry", "snd_config_old.yaml"),
315 ship_geo.UpstreamTagger.Z_Position
316 - 8 * u.cm
317 - 5 * u.cm, # 16 cm width of UpstreamTagger (8 cm half-width)
318 ship_geo.cave.floorHeightMuonShield,
319 )
320 else:
321 print(f"Warning: SND design {design} is not recognized.")
322
323 in_params = list(ship_geo.muShield.params)
324
325 MuonShield = ROOT.ShipMuonShield(
326 in_params,
327 ship_geo.muShield.z,
328 ship_geo.muShield.WithConstField,
329 ship_geo.SC_mag,
330 )
331
332 if ship_geo.SND:
333 # If any SND design is 2 (MTC), set SNDSpace for MuonShield
334 if 2 in getattr(ship_geo, "SND_design", []):
335 MuonShield.SetSNDSpace(
336 hole=True,
337 hole_dx=(ship_geo.mtc_geo.width + 5.0 * u.cm) / 2.0,
338 hole_dy=(ship_geo.mtc_geo.height + 5.0 * u.cm) / 2.0,
339 )
340 detectorList.append(MuonShield)
341
342 if not hasattr(ship_geo, "magnetDesign"):
343 # backward compatibility
344 ship_geo.magnetDesign = 4
345 ship_geo.Bfield.YokeWidth = 200.0 * u.cm
346 ship_geo.Bfield.YokeDepth = 200.0 * u.cm
347 ship_geo.Bfield.CoilThick = 25.0 * u.cm
348 if ship_geo.strawDesign > 1:
349 if ship_geo.magnetDesign > 3:
350 B = ship_geo.Bfield
351 magnet = ROOT.ShipMagnet(
352 "Magnet",
353 "SHiP Magnet",
354 B.z,
355 ship_geo.magnetDesign,
356 B.x,
357 B.y,
358 ship_geo.cave.floorHeightTankB,
359 B.YokeWidth,
360 B.YokeDepth,
361 B.CoilThick,
362 )
363 # xaperture, yaperture
364 else:
365 magnet = ROOT.ShipMagnet(
366 "Magnet",
367 "SHiP Magnet",
368 ship_geo.Bfield.z,
369 ship_geo.magnetDesign,
370 ship_geo.Bfield.x,
371 ship_geo.Bfield.y,
372 ship_geo.cave.floorHeightTankB,
373 )
374 else:
375 magnet = ROOT.ShipMagnet("Magnet", "SHiP Magnet", ship_geo.Bfield.z)
376 detectorList.append(magnet)
377
378 fairship = os.environ["FAIRSHIP"]
379
380 configure_veto(
381 os.path.join(fairship, f"geometry/veto_config_{ship_geo.DecayVolumeMedium}.yaml"),
382 ship_geo.decayVolume.z0,
383 )
384
385 configure_strawtubes(
386 os.path.join(os.environ["FAIRSHIP"], "geometry", "strawtubes_config.yaml"),
387 ship_geo,
388 )
389
390 if ship_geo.EcalOption == 2: # splitCal with pointing information
391 SplitCal = ROOT.splitcal("SplitCal", ROOT.kTRUE)
392 x = ship_geo.SplitCal
393 SplitCal.SetThickness(
394 x.ActiveECALThickness,
395 x.ActiveHCALThickness,
396 x.FilterECALThickness,
397 x.FilterECALThickness_first,
398 x.FilterHCALThickness,
399 x.ActiveECAL_gas_Thickness,
400 )
401 SplitCal.SetMaterial(
402 x.ActiveECALMaterial,
403 x.ActiveHCALMaterial,
404 x.FilterECALMaterial,
405 x.FilterHCALMaterial,
406 )
407 SplitCal.SetNSamplings(x.nECALSamplings, x.nHCALSamplings, x.ActiveHCAL)
408 SplitCal.SetZStart(x.ZStart)
409 SplitCal.SetXMax(x.XMax)
410 SplitCal.SetYMax(x.YMax)
411 SplitCal.SetEmpty(
412 x.Empty,
413 x.BigGap,
414 x.ActiveECAL_gas_gap,
415 x.first_precision_layer,
416 x.second_precision_layer,
417 x.third_precision_layer,
418 x.num_precision_layers,
419 )
420 SplitCal.SetNModules(x.NModulesInX, x.NModulesInY)
421 SplitCal.SetNStrips(x.NStripsPerModule)
422 SplitCal.SetStripSize(x.StripHalfWidth, x.StripHalfLength)
423 detectorList.append(SplitCal)
424
425 upstreamTagger = ROOT.UpstreamTagger("UpstreamTagger", ROOT.kTRUE)
426 upstreamTagger.SetZposition(ship_geo.UpstreamTagger.Z_Position)
427 upstreamTagger.SetBoxDimensions(
428 ship_geo.UpstreamTagger.BoxX, ship_geo.UpstreamTagger.BoxY, ship_geo.UpstreamTagger.BoxZ
429 )
430 detectorList.append(upstreamTagger)
431
432 timeDet = ROOT.TimeDet("TimeDet", ROOT.kTRUE)
433 timeDet.SetZposition(ship_geo.TimeDet.z)
434 timeDet.SetBarZspacing(ship_geo.TimeDet.dzBarRow, ship_geo.TimeDet.dzBarCol)
435 timeDet.SetBarZ(ship_geo.TimeDet.zBar)
436 timeDet.SetSizeX(2 * ship_geo.TimeDet.DX)
437 timeDet.SetSizeY(2 * ship_geo.TimeDet.DY)
438 detectorList.append(timeDet)
439
440 # ----- Magnetic field -------------------------------------------
441 if not hasattr(ship_geo.Bfield, "fieldMap"):
442 if ship_geo.strawDesign == 4 or ship_geo.strawDesign == 10:
443 fMagField = ROOT.ShipBellField(
444 "wilfried",
445 ship_geo.Bfield.max,
446 ship_geo.Bfield.z,
447 2,
448 ship_geo.Yheight / 2.0 * u.m,
449 )
450 else:
451 fMagField = ROOT.ShipBellField(
452 "wilfried",
453 ship_geo.Bfield.max,
454 ship_geo.Bfield.z,
455 1,
456 ship_geo.Yheight / 2.0 * u.m,
457 )
458 run.SetField(fMagField)
459
460 exclusionList = []
461 # exclusionList = ["strawtubes","TargetTrackers","NuTauTarget",\
462 # "SiliconTarget","Veto","Magnet","MuonShield","TargetStation", "TimeDet", "UpstreamTagger"]
463
464 for x in detectorList:
465 if x.GetName() in exclusionList:
466 continue
467 run.AddModule(x)
468 # return list of detector elements
469 detElements = {}
470 for x in run.GetListOfModules():
471 detElements[x.GetName()] = x
472 return detElements

◆ configure_snd_mtc()

None shipDet_conf.configure_snd_mtc ( str  yaml_file,
  ship_geo 
)

Definition at line 120 of file shipDet_conf.py.

120def configure_snd_mtc(yaml_file: str, ship_geo) -> None:
121 with open(yaml_file) as file:
122 config = yaml.safe_load(file)
123
124 ship_geo.mtc_geo = AttrDict(config["MTC"])
125 # Initialize detector
126 if ship_geo.mtc_geo.zPosition == "auto":
127 # Get the the center of the *last* magnet
128 mtc_total_length = (
129 ship_geo.mtc_geo.ironThick + ship_geo.mtc_geo.sciFiThick + ship_geo.mtc_geo.scintThick
130 ) * ship_geo.mtc_geo.nLayers
131 ship_geo.mtc_geo.zPosition = ship_geo.muShield.Entrance[-1] + mtc_total_length / 2
132 mtc = ROOT.MTCDetector("MTC", ROOT.kTRUE)
133 mtc.SetMTCParameters(
134 ship_geo.mtc_geo.width,
135 ship_geo.mtc_geo.height,
136 ship_geo.mtc_geo.angle,
137 ship_geo.mtc_geo.ironThick,
138 ship_geo.mtc_geo.sciFiThick,
139 ship_geo.mtc_geo.num_of_agg_channels,
140 ship_geo.mtc_geo.scint_cell_size,
141 ship_geo.mtc_geo.scintThick,
142 ship_geo.mtc_geo.nLayers,
143 ship_geo.mtc_geo.zPosition,
144 ship_geo.mtc_geo.fieldY,
145 )
146 detectorList.append(mtc)
147
148
int open(const char *, int)
Opens a file descriptor.

◆ configure_snd_old()

None shipDet_conf.configure_snd_old ( str  yaml_file,
  emulsion_target_z_end,
  cave_floorHeightMuonShield 
)

Definition at line 15 of file shipDet_conf.py.

15def configure_snd_old(yaml_file: str, emulsion_target_z_end, cave_floorHeightMuonShield) -> None:
16 with open(yaml_file) as file:
17 config = yaml.safe_load(file)
18 nuTarget_geo = AttrDict(config["nuTarget"])
19 nuTauTT_geo = AttrDict(config["nuTauTT"])
20
21 # specific parameters
22 # nu Target Tracker
23 snd_nuTauTT_TTX = (
24 nuTauTT_geo.n_hor_planes * nuTauTT_geo.scifimat_width + 2.9 * u.cm
25 ) # endpieces (~2.9cm from previous geom)
26 snd_nuTauTT_TTY = (
27 nuTauTT_geo.n_vert_planes * nuTauTT_geo.scifimat_width + 2.9
28 ) # u.cm # endpieces (~2.9cm from previous geom)
29
30 snd_nuTauTT_TTZ = 2 * nuTauTT_geo.support_z + 2 * nuTauTT_geo.scifimat_z + nuTauTT_geo.honeycomb_z
31
32 # nuTau target
33 snd_nuTarget_BrZ = (
34 nuTarget_geo.n_plates * nuTarget_geo.LeadTh
35 + (nuTarget_geo.n_plates + 1) * (2 * nuTarget_geo.EmTh + nuTarget_geo.PBTh)
36 + nuTarget_geo.BrPackZ
37 )
38 snd_nuTarget_BrX = nuTarget_geo.BrPackX + nuTarget_geo.EmX
39 snd_nuTarget_BrY = nuTarget_geo.BrPackY + nuTarget_geo.EmY
40
41 snd_nuTarget_zdim = nuTarget_geo.wall * snd_nuTarget_BrZ + (nuTarget_geo.wall + 1) * snd_nuTauTT_TTZ
42 snd_nuTarget_xdim = snd_nuTauTT_TTX
43 snd_nuTarget_ydim = snd_nuTauTT_TTY
44
45 snd_nuTarget_zC = emulsion_target_z_end - snd_nuTarget_zdim / 2.0
46
47 snd_nuTarget_PillarY = (
48 10 * u.m - snd_nuTarget_ydim / 2 - nuTarget_geo.BaseY - 0.1 * u.mm - cave_floorHeightMuonShield
49 )
50 NuTauTarget = ROOT.Target("NuTauTarget", nuTarget_geo.Ydist, ROOT.kTRUE)
51 NuTauTarget.MakeNuTargetPassive(nuTarget_geo.nuTargetPassive)
52 NuTauTarget.MergeTopBot(nuTarget_geo.SingleEmFilm)
53 NuTauTarget.SetDetectorDesign(nuTarget_geo.Design)
54 NuTauTarget.SetCenterZ(snd_nuTarget_zC)
55 NuTauTarget.SetNumberBricks(
56 nuTarget_geo.col,
57 nuTarget_geo.row,
58 nuTarget_geo.wall,
59 )
60 NuTauTarget.SetDetectorDimension(
61 snd_nuTarget_xdim,
62 snd_nuTarget_ydim,
63 snd_nuTarget_zdim,
64 )
65 NuTauTarget.SetTargetWallDimension(
66 nuTarget_geo.col * snd_nuTarget_BrX,
67 nuTarget_geo.row * snd_nuTarget_BrY + (nuTarget_geo.row - 1) * nuTarget_geo.Ydist,
68 snd_nuTarget_BrZ,
69 )
70 NuTauTarget.SetEmulsionParam(
71 nuTarget_geo.EmTh,
72 nuTarget_geo.EmX,
73 nuTarget_geo.EmY,
74 nuTarget_geo.PBTh,
75 2 * nuTarget_geo.EmTh + nuTarget_geo.PBTh,
76 nuTarget_geo.LeadTh,
77 nuTarget_geo.LeadTh + 2 * nuTarget_geo.EmTh + nuTarget_geo.PBTh,
78 )
79 NuTauTarget.SetBrickParam(
80 snd_nuTarget_BrX,
81 snd_nuTarget_BrY,
82 snd_nuTarget_BrZ,
83 nuTarget_geo.BrPackX,
84 nuTarget_geo.BrPackY,
85 nuTarget_geo.BrPackZ,
86 nuTarget_geo.n_plates,
87 )
88 NuTauTarget.SetCellParam(snd_nuTarget_BrZ)
89 NuTauTarget.SetPillarDimension(nuTarget_geo.PillarX, snd_nuTarget_PillarY, nuTarget_geo.PillarZ)
90 NuTauTarget.SetBaseDimension(snd_nuTarget_xdim + 20, nuTarget_geo.BaseY, snd_nuTarget_zdim + 10)
91 # Target Tracker
92 NuTauTT = ROOT.TargetTracker(
93 "TargetTrackers",
94 snd_nuTauTT_TTX,
95 snd_nuTauTT_TTY,
96 snd_nuTauTT_TTZ,
97 ROOT.kTRUE,
98 )
99 NuTauTT.SetDesign(nuTauTT_geo.design)
100 NuTauTT.SetSciFiParam(
101 nuTauTT_geo.scifimat_width,
102 snd_nuTauTT_TTX,
103 snd_nuTauTT_TTY,
104 nuTauTT_geo.scifimat_z,
105 nuTauTT_geo.support_z,
106 nuTauTT_geo.honeycomb_z,
107 )
108 NuTauTT.SetNumberSciFi(nuTauTT_geo.n_hor_planes, nuTauTT_geo.n_vert_planes)
109 NuTauTT.SetTargetTrackerParam(snd_nuTauTT_TTX, snd_nuTauTT_TTY, snd_nuTauTT_TTZ)
110 NuTauTT.SetBrickParam(snd_nuTarget_BrZ)
111 NuTauTT.SetTotZDimension(snd_nuTarget_zdim)
112 NuTauTT.SetNumberTT(nuTarget_geo.wall + 1)
113 # method of nutau target that must be called after TT parameter definition
114 NuTauTarget.SetTTzdimension(snd_nuTauTT_TTZ)
115
116 detectorList.append(NuTauTarget)
117 detectorList.append(NuTauTT)
118
119

◆ configure_snd_siliconTarget()

None shipDet_conf.configure_snd_siliconTarget ( str  yaml_file,
  ship_geo 
)

Definition at line 149 of file shipDet_conf.py.

149def configure_snd_siliconTarget(yaml_file: str, ship_geo) -> None:
150 with open(yaml_file) as file:
151 config = yaml.safe_load(file)
152
153 ship_geo.SiliconTarget_geo = AttrDict(config["SiliconTarget"])
154 # Initialize detector
155 if ship_geo.SiliconTarget_geo.zPosition == "auto":
156 # Get the the center of the next to last magnet (temporary placement)
157 # Offset placement of detector by 140 cm, magnet is 2* 212.54 cm,
158 # 120 layers at 132 cm will fit, with 140 cm offset final layer within 10 cm of MTC.
159 SiliconTarget_total_length = ship_geo.SiliconTarget_geo.targetSpacing * ship_geo.SiliconTarget_geo.nLayers
160 ship_geo.SiliconTarget_geo.zPosition = (
161 ship_geo.muShield.Entrance[-1] - ship_geo.muShield.Zgap[-1] - SiliconTarget_total_length / 2
162 )
163 print("SiliconTarget zPosition set to ", ship_geo.SiliconTarget_geo.zPosition)
164 SiliconTarget = ROOT.SiliconTarget("SiliconTarget", ROOT.kTRUE)
166 ship_geo.SiliconTarget_geo.targetWidth,
167 ship_geo.SiliconTarget_geo.targetHeight,
168 ship_geo.SiliconTarget_geo.sensorWidth,
169 ship_geo.SiliconTarget_geo.sensorLength,
170 ship_geo.SiliconTarget_geo.nLayers,
171 ship_geo.SiliconTarget_geo.zPosition,
172 ship_geo.SiliconTarget_geo.targetThickness,
173 ship_geo.SiliconTarget_geo.targetSpacing,
174 ship_geo.SiliconTarget_geo.moduleOffset,
175 )
176 detectorList.append(SiliconTarget)
177
178
void SetSiliconTargetParameters(Double_t targetWidth, Double_t targetHeight, Double_t sensorWidth, Double_t sensorLength, Int_t nLayers, Double_t zPosition, Double_t targetThickness, Double_t targetSpacing, Double_t moduleOffset)

◆ configure_strawtubes()

None shipDet_conf.configure_strawtubes ( str  yaml_file,
  ship_geo 
)

Definition at line 211 of file shipDet_conf.py.

211def configure_strawtubes(yaml_file: str, ship_geo) -> None:
212 with open(yaml_file) as file:
213 config = yaml.safe_load(file)
214
215 ship_geo.strawtubes_geo = AttrDict(config["SST"])
216
217 # Straw tubes in decay vessel if vacuum, otherwise outside in air
218 ship_geo.strawtubes_geo.medium = "vacuums" if ship_geo.DecayVolumeMedium == "vacuums" else "air"
219
220 # Choose frame material
221 if ship_geo.strawDesign == 4:
222 ship_geo.strawtubes_geo.frame_material = "aluminium"
223 elif ship_geo.strawDesign == 10:
224 ship_geo.strawtubes_geo.frame_material = "steel"
225
226 strawtubes = ROOT.strawtubes(ship_geo.strawtubes_geo.medium)
228 ship_geo.TrackStation1.z,
229 ship_geo.TrackStation2.z,
230 ship_geo.TrackStation3.z,
231 ship_geo.TrackStation4.z,
232 )
234 ship_geo.strawtubes_geo.width,
235 ship_geo.strawtubes_geo.height,
236 )
238 ship_geo.strawtubes_geo.outer_straw_diameter,
239 ship_geo.strawtubes_geo.wall_thickness,
240 )
242 ship_geo.strawtubes_geo.straw_pitch,
243 ship_geo.strawtubes_geo.y_layer_offset,
244 )
245 strawtubes.SetDeltazLayer(ship_geo.strawtubes_geo.delta_z_layer)
246 strawtubes.SetStereoAngle(ship_geo.strawtubes_geo.view_angle)
247 strawtubes.SetWireThickness(ship_geo.strawtubes_geo.wire_thickness)
248 strawtubes.SetDeltazView(ship_geo.strawtubes_geo.delta_z_view)
249 strawtubes.SetFrameMaterial(ship_geo.strawtubes_geo.frame_material)
251 ship_geo.strawtubes_geo.station_width,
252 ship_geo.strawtubes_geo.station_height,
253 ship_geo.strawtubes_geo.station_length,
254 )
255
256 # For digitization
258 ship_geo.strawtubesDigi.v_drift,
259 ship_geo.strawtubesDigi.sigma_spatial,
260 )
261
262 detectorList.append(strawtubes)
263
264
void SetDeltazView(Double_t delta_z_view)
Definition: strawtubes.cxx:170
void SetStrawResolution(Double_t a, Double_t b)
Definition: strawtubes.h:50
void SetDeltazLayer(Double_t delta_z_layer)
Definition: strawtubes.cxx:158
void SetStrawDiameter(Double_t outer_straw_diameter, Double_t wall_thickness)
Definition: strawtubes.cxx:146
void SetzPositions(Double_t z1, Double_t z2, Double_t z3, Double_t z4)
Definition: strawtubes.cxx:133
void SetStrawPitch(Double_t straw_pitch, Double_t layer_offset)
Definition: strawtubes.cxx:153
void SetFrameMaterial(TString frame_material)
Definition: strawtubes.cxx:174
void SetStereoAngle(Double_t stereo_angle)
Definition: strawtubes.cxx:162
void SetWireThickness(Double_t wire_thickness)
Definition: strawtubes.cxx:166
void SetApertureArea(Double_t width, Double_t height)
Definition: strawtubes.cxx:141
void SetStationEnvelope(Double_t x, Double_t y, Double_t z)
Definition: strawtubes.cxx:178

◆ configure_veto()

None shipDet_conf.configure_veto ( str  yaml_file,
  z0 
)

Definition at line 179 of file shipDet_conf.py.

179def configure_veto(yaml_file: str, z0) -> None:
180 with open(yaml_file) as file:
181 config = yaml.safe_load(file)
182
183 veto_geo = AttrDict(config)
184
185 Veto = ROOT.veto()
186 Veto.SetVesselDimensions(
187 veto_geo.xstartInner,
188 veto_geo.xendInner,
189 veto_geo.ystartInner,
190 veto_geo.yendInner,
191 z0,
192 )
193
194 Veto.SetLiquidVeto(1)
195
196 Veto.SetVesselStructure(
197 veto_geo.innerSupport,
198 veto_geo.sensitiveThickness,
199 veto_geo.outerSupport,
200 veto_geo.innerSupportMed,
201 veto_geo.lidThickness,
202 veto_geo.sensitiveMed,
203 veto_geo.outerSupportMed,
204 veto_geo.decayMed,
205 veto_geo.rib,
206 )
207
208 detectorList.append(Veto)
209
210

Variable Documentation

◆ detectorList

list shipDet_conf.detectorList = []

Definition at line 12 of file shipDet_conf.py.