3 #include <phparameter/PHParameters.h>
7 #include <Geant4/G4AssemblyVolume.hh>
8 #include <Geant4/G4Box.hh>
9 #include <Geant4/G4Colour.hh>
10 #include <Geant4/G4ExtrudedSolid.hh>
11 #include <Geant4/G4LogicalVolume.hh>
12 #include <Geant4/G4Material.hh>
13 #include <Geant4/G4PVPlacement.hh>
14 #include <Geant4/G4RotationMatrix.hh>
15 #include <Geant4/G4String.hh>
16 #include <Geant4/G4SystemOfUnits.hh>
17 #include <Geant4/G4ThreeVector.hh>
18 #include <Geant4/G4TwoVector.hh>
19 #include <Geant4/G4VPhysicalVolume.hh>
20 #include <Geant4/G4VSolid.hh>
21 #include <Geant4/G4VisAttributes.hh>
23 #include <boost/format.hpp>
40 , m_Params(parameters)
41 , m_OuterHcalSteelPlate(nullptr)
42 , m_OuterHcalAssembly(nullptr)
43 , m_SteelPlateCornerUpperLeft(1777.6 *
mm, -433.5 *
mm)
44 , m_SteelPlateCornerUpperRight(2600.4 *
mm, -417.4 *
mm)
45 , m_SteelPlateCornerLowerRight(2601.2 *
mm, -459.8 *
mm)
46 , m_SteelPlateCornerLowerLeft(1770.9 *
mm, -459.8 *
mm)
49 m_ScintiUoneFrontSize(166.2 *
mm)
50 , m_ScintiUoneCornerUpperLeft(0 *
mm, 0 *
mm)
51 , m_ScintiUoneCornerUpperRight(828.9 *
mm, 0 *
mm)
52 , m_ScintiUoneCornerLowerRight(828.9 *
mm, -240.54 *
mm)
53 , m_ScintiUoneCornerLowerLeft(0 *
mm, -m_ScintiUoneFrontSize)
56 m_ScintiU2CornerUpperLeft(0 *
mm, 0 *
mm)
57 , m_ScintiU2CornerUpperRight(828.9 *
mm, -74.3 *
mm)
58 , m_ScintiU2CornerLowerRight(828.9 *
mm, -320.44 *
mm)
59 , m_ScintiU2CornerLowerLeft(0 *
mm, -171.0 *
mm)
62 m_ScintiT9DistanceToCorner(0.86 *
mm)
63 , m_ScintiT9FrontSize(241.5 *
mm)
64 , m_ScintiT9CornerUpperLeft(0 *
mm, 0 *
mm)
65 , m_ScintiT9CornerUpperRight(697.4 *
mm, -552.2 *
mm)
66 , m_ScintiT9CornerLowerRight(697.4 *
mm, -697.4 *
mm / tan(47.94 / 180. * M_PI) - m_ScintiT9FrontSize)
67 , m_ScintiT9CornerLowerLeft(0 *
mm, -m_ScintiT9FrontSize)
70 m_ScintiT10FrontSize(241.4 *
mm)
71 , m_ScintiT10CornerUpperLeft(0 *
mm, 0 *
mm)
72 , m_ScintiT10CornerUpperRight(697.4 *
mm, -629.3 *
mm)
73 , m_ScintiT10CornerLowerRight(697.4 *
mm, -697.4 *
mm / tan(44.2 / 180. * M_PI) - m_ScintiT10FrontSize)
74 , m_ScintiT10CornerLowerLeft(0 *
mm, -m_ScintiT10FrontSize)
77 m_ScintiT11FrontSize(241.4 *
mm)
78 , m_ScintiT11CornerUpperLeft(0 *
mm, 0 *
mm)
79 , m_ScintiT11CornerUpperRight(697.4 *
mm, -717.1 *
mm)
80 , m_ScintiT11CornerLowerRight(697.4 *
mm, -697.4 *
mm / tan(42.47 / 180. * M_PI) - m_ScintiT11FrontSize)
81 , m_ScintiT11CornerLowerLeft(0 *
mm, -m_ScintiT11FrontSize)
84 m_ScintiT12FrontSize(312.7 *
mm)
85 , m_ScintiT12CornerUpperLeft(0 *
mm, 0 *
mm)
86 , m_ScintiT12CornerUpperRight(697.4 *
mm, -761.8 *
mm)
87 , m_ScintiT12CornerLowerRight(392.9 *
mm, -827.7)
88 , m_ScintiT12CornerLowerLeft(0 *
mm, -m_ScintiT12FrontSize)
92 , m_ScintiXHiEta(697.4 *
mm + 121.09 *
mm)
93 , m_SteelZ(1600. *
mm)
95 , m_ScintiTileZ(m_SteelZ)
96 , m_ScintiTileThickness(7 *
mm)
97 , m_ScintiBoxSmaller(0.02 *
mm)
99 m_GapBetweenTiles(1 *
mm)
100 , m_ScintiGap(8.5 *
mm)
101 , m_TiltAngle(12 *
deg)
102 , m_DeltaPhi(2 * M_PI / 320.)
104 , m_VolumeScintillator(NAN)
105 , m_NScintiPlates(20)
106 , m_NSteelPlates(m_NScintiPlates + 1)
107 , m_ActiveFlag(m_Params->get_int_param(
"active"))
108 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
122 G4LogicalVolume* logvol = volume->GetLogicalVolume();
139 G4VSolid* steel_plate;
140 std::vector<G4TwoVector> vertexes;
145 G4TwoVector
zero(0, 0);
146 steel_plate =
new G4ExtrudedSolid(
"OuterHcalSteelPlateSolid",
153 m_OuterHcalSteelPlate =
new G4LogicalVolume(steel_plate, G4Material::GetMaterial(
"Steel_A36"),
"OuterHcalSteelPlate", 0, 0, 0);
154 G4VisAttributes visattchk;
155 visattchk.SetVisibility(
true);
156 visattchk.SetForceSolid(
false);
157 visattchk.SetColour(G4Colour::Blue());
169 G4LogicalVolume* scintiboxlogical =
new G4LogicalVolume(scintiboxsolid, G4Material::GetMaterial(
"G4_AIR"), G4String(
scintimothername), 0, 0, 0);
170 G4VisAttributes* hcalVisAtt =
new G4VisAttributes();
171 hcalVisAtt->SetVisibility(
true);
172 hcalVisAtt->SetForceSolid(
false);
173 hcalVisAtt->SetColour(G4Colour::Red());
175 scintiu1_logic->SetVisAttributes(hcalVisAtt);
177 hcalVisAtt =
new G4VisAttributes();
178 hcalVisAtt->SetVisibility(
true);
179 hcalVisAtt->SetForceSolid(
false);
180 hcalVisAtt->SetColour(G4Colour::Cyan());
182 scintiu2_logic->SetVisAttributes(hcalVisAtt);
183 G4RotationMatrix* Rot;
184 Rot =
new G4RotationMatrix();
185 Rot->rotateX(-90 *
deg);
188 Rot =
new G4RotationMatrix();
189 Rot->rotateX(-90 *
deg);
193 Rot =
new G4RotationMatrix();
194 Rot->rotateX(90 *
deg);
198 Rot =
new G4RotationMatrix();
199 Rot->rotateX(90 *
deg);
203 return scintiboxlogical;
209 std::vector<G4TwoVector> vertexes;
214 G4TwoVector
zero(0, 0);
215 G4VSolid* scintiu1 =
new G4ExtrudedSolid(
"OuterHcalScintiU1",
221 G4LogicalVolume* scintiu1_logic =
new G4LogicalVolume(scintiu1, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiU1",
nullptr,
nullptr,
nullptr);
224 return scintiu1_logic;
230 std::vector<G4TwoVector> vertexes;
235 G4TwoVector
zero(0, 0);
236 G4VSolid* scintiu2 =
new G4ExtrudedSolid(
"OuterHcalScintiU2",
242 G4LogicalVolume* scintiu2_logic =
new G4LogicalVolume(scintiu2, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiU2",
nullptr,
nullptr,
nullptr);
245 return scintiu2_logic;
254 G4LogicalVolume* scintiboxlogical =
new G4LogicalVolume(scintiboxsolid, G4Material::GetMaterial(
"G4_AIR"), G4String(
scintimothername), 0, 0, 0);
256 G4VisAttributes hcalVisAtt;
257 hcalVisAtt.SetVisibility(
true);
258 hcalVisAtt.SetForceSolid(
false);
259 hcalVisAtt.SetColour(G4Colour::Magenta());
261 scintit9_logic->SetVisAttributes(hcalVisAtt);
264 G4RotationMatrix* Rot;
265 Rot =
new G4RotationMatrix();
266 Rot->rotateX(90 *
deg);
269 hcalVisAtt.SetVisibility(
true);
270 hcalVisAtt.SetForceSolid(
false);
271 hcalVisAtt.SetColour(G4Colour::Blue());
273 scintit10_logic->SetVisAttributes(hcalVisAtt);
276 Rot =
new G4RotationMatrix();
277 Rot->rotateX(90 *
deg);
281 hcalVisAtt.SetVisibility(
true);
282 hcalVisAtt.SetForceSolid(
false);
283 hcalVisAtt.SetColour(G4Colour::Yellow());
285 scintit11_logic->SetVisAttributes(hcalVisAtt);
288 Rot =
new G4RotationMatrix();
289 Rot->rotateX(90 *
deg);
293 hcalVisAtt.SetVisibility(
true);
294 hcalVisAtt.SetForceSolid(
false);
295 hcalVisAtt.SetColour(G4Colour::Cyan());
297 scintit12_logic->SetVisAttributes(hcalVisAtt);
300 Rot =
new G4RotationMatrix();
301 Rot->rotateX(90 *
deg);
305 return scintiboxlogical;
310 std::vector<G4TwoVector> vertexes;
315 G4TwoVector
zero(0, 0);
316 G4VSolid* scintit9 =
new G4ExtrudedSolid(
"OuterHcalScintiT9",
322 G4LogicalVolume* scintit9_logic =
new G4LogicalVolume(scintit9, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiT9",
nullptr,
nullptr,
nullptr);
325 return scintit9_logic;
331 std::vector<G4TwoVector> vertexes;
336 G4TwoVector
zero(0, 0);
337 G4VSolid* scintit10 =
new G4ExtrudedSolid(
"OuterHcalScintiT10",
343 G4LogicalVolume* scintit10_logic =
new G4LogicalVolume(scintit10, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiT10",
nullptr,
nullptr,
nullptr);
346 return scintit10_logic;
352 std::vector<G4TwoVector> vertexes;
357 G4TwoVector
zero(0, 0);
358 G4VSolid* scintit11 =
new G4ExtrudedSolid(
"OuterHcalScintiT11",
364 G4LogicalVolume* scintit11_logic =
new G4LogicalVolume(scintit11, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiT11",
nullptr,
nullptr,
nullptr);
367 return scintit11_logic;
373 std::vector<G4TwoVector> vertexes;
378 G4TwoVector
zero(0, 0);
379 G4VSolid* scintit12 =
new G4ExtrudedSolid(
"OuterHcalScintiT12",
385 G4LogicalVolume* scintit12_logic =
new G4LogicalVolume(scintit12, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"OuterHcalScintiT12",
nullptr,
nullptr,
nullptr);
388 return scintit12_logic;
398 G4RotationMatrix Rot;
418 string volname = (*it)->GetName();
448 G4LogicalVolume* scintibox =
nullptr;
463 double middlerad = sqrt(bottom_xmiddle_steel_tile * bottom_xmiddle_steel_tile + bottom_ymiddle_steel_tile * bottom_ymiddle_steel_tile);
464 double philow = atan((bottom_ymiddle_steel_tile -
m_ScintiGap / 2.) / bottom_xmiddle_steel_tile);
468 G4RotationMatrix Rot;
469 Rot.rotateZ(phi *
rad);
470 G4ThreeVector g4vec(0, 0, 0);
474 double ypos = sin(phi + philow) * middlerad;
475 double xpos = cos(phi + philow) * middlerad;
481 G4RotationMatrix Rota;
482 Rota.rotateZ(scintiangle + phislat);
483 G4ThreeVector g4vec(xpos, ypos, 0);
500 double angle = atan(ylen / xlen);
506 cout <<
"Outer Hcal Detector:" << endl;
507 if (what ==
"ALL" || what ==
"VOLUME")
525 cout <<
"unknown scintillator volume name: " << volname << endl;
541 cout <<
"unknown steel volume name: " << volname << endl;