46 TGeoVolume* tShield, Double_t dX, Double_t dY,
47 Double_t dZ, Double_t Z, Bool_t withSNDHole) {
48 LOG(
debug) <<
" Create a magnet of the MS ";
49 TGeoVolume* magVol =
nullptr;
53 TString shapeName = magnetName +
"_shape";
54 new TGeoBBox(shapeName, dX, dY, dZ);
58 constexpr double eps = 0.01;
59 TString voidName = magnetName +
"_void";
62 auto* compShape =
new TGeoCompositeShape(magnetName +
"_comp",
63 shapeName +
" - " + voidName);
64 magVol =
new TGeoVolume(magnetName, compShape, medium);
66 magVol = gGeoManager->MakeBox(magnetName, medium, dX, dY, dZ);
69 magVol->SetLineColor(45);
70 tShield->AddNode(magVol, 1,
new TGeoTranslation(0, 0, Z));
74 LOG(
debug) <<
" Construct Geometry of the MS ";
79 LOG(fatal) <<
"ShipMuonShield: expected " <<
nMagnets <<
" magnets x "
81 <<
" values. Is the geometry from an older version?";
83 TGeoVolume* top = gGeoManager->GetTopVolume();
84 TGeoVolume* tShield =
new TGeoVolumeAssembly(
"MuonShieldArea");
86 TGeoMedium* iron = gGeoManager->GetMedium(
"iron");
88 bool absorber_magnet =
false;
90 for (
size_t nM = 0; nM <
nMagnets; ++nM) {
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) {
107 const auto i =
static_cast<Int_t
>(nM);
110 absorber_magnet |= nM == 0;
114 top->AddNode(tShield, 1);
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.;
131 if (absorber_magnet) {
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;
141 TGeoVolume* absorber =
new TGeoVolume(
"AbsorberVol", absorberShape, iron);
142 absorber->SetLineColor(42);
145 new TGeoTranslation(shift_x, shift_y,
void CreateMagnet(const TString &magnetName, TGeoMedium *medium, TGeoVolume *tShield, Double_t dX, Double_t dY, Double_t dZ, Double_t Z, Bool_t withSNDHole)