FairShip
Loading...
Searching...
No Matches
ShipMuonShield Class Reference

#include <ShipMuonShield.h>

Inheritance diagram for ShipMuonShield:
[legend]
Collaboration diagram for ShipMuonShield:
[legend]

Public Member Functions

 ShipMuonShield (std::vector< double > in_params, size_t n_magnets, Double_t z)
 ShipMuonShield ()
 ~ShipMuonShield () override
void ConstructGeometry () override
void SetSNDSpace (Bool_t hole, Double_t hole_dx, Double_t hole_dy, Int_t first_magnet, Int_t last_magnet)

Static Public Attributes

static constexpr size_t nParams = 4

Protected Member Functions

void CreateMagnet (const TString &magnetName, TGeoMedium *medium, TGeoVolume *tShield, Double_t dX, Double_t dY, Double_t dZ, Double_t Z, Bool_t withSNDHole)

Protected Attributes

Double_t z_end_of_proximity_shielding {0.}
size_t nMagnets {0}
std::vector< Double_t > shield_params
Bool_t snd_hole {false}
Double_t snd_hole_dx = 0.
Double_t snd_hole_dy = 0.
Int_t snd_first_magnet {-1}
Int_t snd_last_magnet {-1}

Detailed Description

Definition at line 25 of file ShipMuonShield.h.

Constructor & Destructor Documentation

◆ ShipMuonShield() [1/2]

ShipMuonShield::ShipMuonShield ( std::vector< double > in_params,
size_t n_magnets,
Double_t z )

Definition at line 25 of file ShipMuonShield.cxx.

27 : FairModule("MuonShield", "ShipMuonShield") {
28 LOG(debug) << " Function ShipMuonShield MS ";
29 std::ranges::copy(in_params, std::back_inserter(shield_params));
31
33}
const Int_t debug
Double_t z_end_of_proximity_shielding
std::vector< Double_t > shield_params

◆ ShipMuonShield() [2/2]

ShipMuonShield::ShipMuonShield ( )

Definition at line 23 of file ShipMuonShield.cxx.

23: FairModule("ShipMuonShield", "") {}

◆ ~ShipMuonShield()

ShipMuonShield::~ShipMuonShield ( )
overridedefault

Member Function Documentation

◆ ConstructGeometry()

void ShipMuonShield::ConstructGeometry ( )
override

Definition at line 73 of file ShipMuonShield.cxx.

73 {
74 LOG(debug) << " Construct Geometry of the MS ";
75 // A list in the old 15-value format also divides evenly by nParams, so
76 // check the size against the expected number of magnets. At least one
77 // magnet is needed, since the absorber is sized from the first one.
78 if (nMagnets == 0 || shield_params.size() != nMagnets * nParams) {
79 LOG(fatal) << "ShipMuonShield: expected " << nMagnets << " magnets x "
80 << nParams << " parameters, got " << shield_params.size()
81 << " values. Is the geometry from an older version?";
82 }
83 TGeoVolume* top = gGeoManager->GetTopVolume();
84 TGeoVolume* tShield = new TGeoVolumeAssembly("MuonShieldArea");
85 ShipGeo::InitMedium("iron");
86 TGeoMedium* iron = gGeoManager->GetMedium("iron");
87
88 bool absorber_magnet = false;
90 for (size_t nM = 0; nM < nMagnets; ++nM) {
91 const Double_t Zgap = shield_params[nM * nParams + 0];
92 const Double_t dZ = shield_params[nM * nParams + 1];
93 const Double_t dX = shield_params[nM * nParams + 2];
94 const Double_t dY = shield_params[nM * nParams + 3];
95 // Subsequent magnets are placed relative to the previous one
96 if (nM > 0) {
97 Z += shield_params[(nM - 1) * nParams + 1];
98 }
99 Z += Zgap + dZ;
100
101 TString name = nM == 0 ? TString("MagnAbsorb") : Form("Magn%zu", nM);
102 LOG(debug) << "Magnet " << name << ": Zgap=" << Zgap << ", dZ=" << dZ
103 << ", dX=" << dX << ", dY=" << dY << ", Z=" << Z;
104 if (dZ < 1e-5 || dX == 0) {
105 continue;
106 }
107 const auto i = static_cast<Int_t>(nM);
108 CreateMagnet(name, iron, tShield, dX, dY, dZ, Z,
110 absorber_magnet |= nM == 0;
111 }
112
113 // Place in origin of SHiP coordinate system as subnodes placed correctly
114 top->AddNode(tShield, 1);
115
116 Double_t absorber_offset = shield_params[0];
117 Double_t absorber_half_length = shield_params[1];
118
119 // Absorber: iron filling the TCC8 cross-section around the hadron stopper
120
125 TGeoShape* absorberShape = new TGeoBBox(
126 "absorber", (kTCC8RightX - kTCC8LeftX) / 2. - 0.002 * m,
127 (kTCC8CeilingY - kTCC8FloorY) / 2., absorber_half_length - 0.002 * m);
128 Double_t shift_x = (kTCC8RightX + kTCC8LeftX) / 2.;
129 Double_t shift_y = (kTCC8CeilingY + kTCC8FloorY) / 2.;
130
131 if (absorber_magnet) {
132 // Leave room for the magnet of the hadron absorber
133 auto* absorber_shift =
134 new TGeoTranslation("absorber_shift", shift_x, shift_y, 0);
135 absorber_shift->RegisterYourself();
136 absorberShape = new TGeoCompositeShape(
137 "Absorber", "absorber:absorber_shift - MagnAbsorb");
138 shift_x = shift_y = 0;
139 }
140
141 TGeoVolume* absorber = new TGeoVolume("AbsorberVol", absorberShape, iron);
142 absorber->SetLineColor(42); // brown / light red
143 tShield->AddNode(
144 absorber, 1,
145 new TGeoTranslation(shift_x, shift_y,
146 z_end_of_proximity_shielding + absorber_half_length +
147 absorber_offset)); // - Passive?
148}
constexpr Double_t m
static constexpr size_t nParams
void CreateMagnet(const TString &magnetName, TGeoMedium *medium, TGeoVolume *tShield, Double_t dX, Double_t dY, Double_t dZ, Double_t Z, Bool_t withSNDHole)
int i
Definition ShipAna.py:108
const Double_t kTCC8RightX
const Double_t kTCC8LeftX
const Double_t kTCC8CeilingY
const Double_t kTCC8FloorY
Int_t InitMedium(const char *name)
Definition ShipGeoUtil.h:22

◆ CreateMagnet()

void ShipMuonShield::CreateMagnet ( const TString & magnetName,
TGeoMedium * medium,
TGeoVolume * tShield,
Double_t dX,
Double_t dY,
Double_t dZ,
Double_t Z,
Bool_t withSNDHole )
protected

Definition at line 45 of file ShipMuonShield.cxx.

47 {
48 LOG(debug) << " Create a magnet of the MS ";
49 TGeoVolume* magVol = nullptr;
50
51 if (withSNDHole) {
52 // Solid box minus a void box along the beam axis
53 TString shapeName = magnetName + "_shape";
54 new TGeoBBox(shapeName, dX, dY, dZ);
55
56 // Void 0.1 mm smaller than the hole transversally (anti-overlap with the
57 // SND) and longer than the magnet, so that no faces coincide
58 constexpr double eps = 0.01;
59 TString voidName = magnetName + "_void";
60 new TGeoBBox(voidName, snd_hole_dx - eps, snd_hole_dy - eps, dZ + eps);
61
62 auto* compShape = new TGeoCompositeShape(magnetName + "_comp",
63 shapeName + " - " + voidName);
64 magVol = new TGeoVolume(magnetName, compShape, medium);
65 } else {
66 magVol = gGeoManager->MakeBox(magnetName, medium, dX, dY, dZ);
67 }
68
69 magVol->SetLineColor(45);
70 tShield->AddNode(magVol, 1, new TGeoTranslation(0, 0, Z));
71}
Double_t snd_hole_dy
Double_t snd_hole_dx

◆ SetSNDSpace()

void ShipMuonShield::SetSNDSpace ( Bool_t hole,
Double_t hole_dx,
Double_t hole_dy,
Int_t first_magnet,
Int_t last_magnet )

Definition at line 35 of file ShipMuonShield.cxx.

37 {
38 snd_hole = hole;
39 snd_first_magnet = first_magnet;
40 snd_last_magnet = last_magnet;
41 snd_hole_dx = hole_dx;
42 snd_hole_dy = hole_dy;
43}

Member Data Documentation

◆ nMagnets

size_t ShipMuonShield::nMagnets {0}
protected

Definition at line 40 of file ShipMuonShield.h.

40{0};

◆ nParams

size_t ShipMuonShield::nParams = 4
staticconstexpr

Definition at line 36 of file ShipMuonShield.h.

◆ shield_params

std::vector<Double_t> ShipMuonShield::shield_params
protected

Definition at line 41 of file ShipMuonShield.h.

◆ snd_first_magnet

Int_t ShipMuonShield::snd_first_magnet {-1}
protected

Definition at line 44 of file ShipMuonShield.h.

44{-1}, snd_last_magnet{-1};

◆ snd_hole

Bool_t ShipMuonShield::snd_hole {false}
protected

Definition at line 42 of file ShipMuonShield.h.

42{false};

◆ snd_hole_dx

Double_t ShipMuonShield::snd_hole_dx = 0.
protected

Definition at line 43 of file ShipMuonShield.h.

◆ snd_hole_dy

Double_t ShipMuonShield::snd_hole_dy = 0.
protected

Definition at line 43 of file ShipMuonShield.h.

◆ snd_last_magnet

Int_t ShipMuonShield::snd_last_magnet {-1}
protected

Definition at line 44 of file ShipMuonShield.h.

44{-1}, snd_last_magnet{-1};

◆ z_end_of_proximity_shielding

Double_t ShipMuonShield::z_end_of_proximity_shielding {0.}
protected

Definition at line 39 of file ShipMuonShield.h.

39{0.};

The documentation for this class was generated from the following files: