FairShip
Loading...
Searching...
No Matches
ShipCave.cxx
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5/* Generated by Together */
6#include "ShipCave.h"
7
8#include "FairGeoBuilder.h"
9#include "FairGeoInterface.h" // for FairGeoInterface
10#include "FairGeoLoader.h" // for FairGeoLoader
11#include "FairGeoMedia.h"
12#include "ShipCavernLayout.h"
13#include "ShipGeoCave.h" // for ShipGeoCave
14#include "ShipGeoUtil.h"
15#include "ShipUnit.h"
16#include "TGeoBBox.h"
17#include "TGeoCompositeShape.h"
18#include "TGeoManager.h"
19
20using ShipUnit::m;
21using ShipUnit::mm;
22using ShipUnit::tesla;
23
25 FairGeoLoader* loader = FairGeoLoader::Instance();
26 FairGeoInterface* GeoInterface = loader->getGeoInterface();
27 ShipGeoCave* MGeo = new ShipGeoCave();
28 MGeo->setGeomFile(GetGeometryFileName());
29 GeoInterface->addGeoModule(MGeo);
30 Bool_t rc = GeoInterface->readSet(MGeo);
31 if (rc) {
32 MGeo->create(loader->getGeoBuilder());
33 }
34 TGeoVolume* top = gGeoManager->GetTopVolume();
35 ShipGeo::InitMedium("Concrete");
36 TGeoMedium* concrete = gGeoManager->GetMedium("Concrete");
37
47 // All positions below are relative to the TCC8/ECN3 step at z_transition,
48 // the end of the TCC8 floor, where the Cavern volume is placed.
49 Double_t TCC8_length = fTCC8Length;
50 // Short intermediate floor between TCC8 and ECN3
51 Double_t stair_step_length = fStairStepLength;
52 Double_t ECN3_length = fECN3Length;
53 Double_t z_transition = fZTransition;
54 // Rock around the modelled tunnel and hall, closed 5 m beyond both ends
55 Double_t rock_half_length = (TCC8_length + ECN3_length) / 2. + 5 * m;
56 Double_t rock_centre = (ECN3_length - TCC8_length) / 2.;
57 [[maybe_unused]] auto* rock =
58 new TGeoBBox("rock", 20 * m, 20 * m, rock_half_length);
59 auto* rock_shift = new TGeoTranslation("rock_shift", 0, 0, rock_centre);
60 rock_shift->RegisterYourself();
61
62 [[maybe_unused]] auto* muon_shield_cavern =
63 new TGeoBBox("muon_shield_cavern", (kTCC8RightX - kTCC8LeftX) / 2.,
64 (kTCC8CeilingY - kTCC8FloorY) / 2., TCC8_length / 2.);
65 auto* TCC8_shift = new TGeoTranslation(
66 "TCC8_shift", (kTCC8RightX + kTCC8LeftX) / 2.,
67 (kTCC8CeilingY + kTCC8FloorY) / 2., -TCC8_length / 2.);
68 TCC8_shift->RegisterYourself();
69
70 [[maybe_unused]] auto* stair_step =
71 new TGeoBBox("stair_step", (kTCC8RightX - kTCC8LeftX) / 2.,
72 (kTCC8CeilingY - kStairFloorY) / 2., stair_step_length / 2.);
73 auto* stair_step_shift = new TGeoTranslation(
74 "stair_step_shift", (kTCC8RightX + kTCC8LeftX) / 2.,
75 (kTCC8CeilingY + kStairFloorY) / 2., stair_step_length / 2.);
76 stair_step_shift->RegisterYourself();
77
78 // ECN3 hall around the decay vessel, from the stair step to the end wall
79 [[maybe_unused]] auto* experiment_cavern =
80 new TGeoBBox("experiment_cavern", (kECN3RightX - kECN3LeftX) / 2.,
81 (kECN3SpringlineY - kECN3FloorY) / 2.,
82 ECN3_length / 2. - stair_step_length / 2.);
83 auto* ECN3_shift =
84 new TGeoTranslation("ECN3_shift", (kECN3RightX + kECN3LeftX) / 2.,
85 (kECN3SpringlineY + kECN3FloorY) / 2.,
86 ECN3_length / 2. + stair_step_length / 2.);
87 ECN3_shift->RegisterYourself();
88
89 // Spectrometer yoke pit: 1 m deep, 9 m long, centred on the magnet
90 [[maybe_unused]] auto* yoke_pit =
91 new TGeoBBox("yoke_pit", 4.2 * m, 0.5 * m, 4.5 * m);
92 auto* yoke_pit_shift =
93 new TGeoTranslation("yoke_pit_shift", 0, kECN3FloorY - 0.5 * m,
94 fZSpectrometer - z_transition);
95 yoke_pit_shift->RegisterYourself();
96
97 auto* compRock = new TGeoCompositeShape("compRock",
98 "rock:rock_shift"
99 "- muon_shield_cavern:TCC8_shift"
100 "- experiment_cavern:ECN3_shift"
101 "- stair_step:stair_step_shift"
102 "- yoke_pit:yoke_pit_shift");
103 auto* Cavern = new TGeoVolume("Cavern", compRock, concrete);
104 Cavern->SetLineColor(11); // grey
105 Cavern->SetTransparency(50);
106 top->AddNode(Cavern, 1, new TGeoTranslation(0, 0, z_transition));
107}
108ShipCave::ShipCave() : FairModule() {}
109
110ShipCave::~ShipCave() = default;
111ShipCave::ShipCave(const char* name, const char* Title)
112 : FairModule(name, Title), world{} {}
constexpr Double_t m
Double_t fStairStepLength
Definition ShipCave.h:35
~ShipCave() override
Double_t fZSpectrometer
Definition ShipCave.h:37
Double_t fTCC8Length
Definition ShipCave.h:33
void ConstructGeometry() override
Definition ShipCave.cxx:24
Double_t world[3]
Definition ShipCave.h:38
Double_t fZTransition
Definition ShipCave.h:36
Double_t fECN3Length
Definition ShipCave.h:34
const Double_t kECN3FloorY
const Double_t kECN3RightX
const Double_t kECN3LeftX
const Double_t kStairFloorY
const Double_t kTCC8RightX
const Double_t kTCC8LeftX
const Double_t kTCC8CeilingY
const Double_t kECN3SpringlineY
const Double_t kTCC8FloorY
Int_t InitMedium(const char *name)
Definition ShipGeoUtil.h:22
constexpr double mm
Definition ShipUnit.h:25
constexpr double m
Definition ShipUnit.h:24
constexpr double tesla
Definition ShipUnit.h:41