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_InnerHcalSteelPlate(nullptr)
42 , m_InnerHcalAssembly(nullptr)
43 , m_SteelPlateCornerUpperLeft(1157.5 *
mm, -151.44 *
mm)
44 , m_SteelPlateCornerUpperRight(1308.5 *
mm, -286.96 *
mm)
45 , m_SteelPlateCornerLowerRight(1298.8 *
mm, -297.39 *
mm)
46 , m_SteelPlateCornerLowerLeft(1155.8 *
mm, -163.92 *
mm)
49 m_ScintiUoneFrontSize(105.9 *
mm)
50 , m_ScintiUoneCornerUpperLeft(0 *
mm, 0 *
mm)
51 , m_ScintiUoneCornerUpperRight(198.1 *
mm, 0 *
mm)
52 , m_ScintiUoneCornerLowerRight(198.1 *
mm, -121.3 *
mm)
53 , m_ScintiUoneCornerLowerLeft(0 *
mm, -m_ScintiUoneFrontSize)
56 m_ScintiU2CornerUpperLeft(0 *
mm, 0 *
mm)
57 , m_ScintiU2CornerUpperRight(198.1 *
mm, -15.4 *
mm)
58 , m_ScintiU2CornerLowerRight(198.1 *
mm, -141.5 *
mm)
59 , m_ScintiU2CornerLowerLeft(0 *
mm, -110.59 *
mm)
62 m_ScintiT9DistanceToCorner(26.44 *
mm)
63 , m_ScintiT9FrontSize(140.3 *
mm)
64 , m_ScintiT9CornerUpperLeft(0 *
mm, 0 *
mm)
65 , m_ScintiT9CornerUpperRight(198.1 *
mm, -134.4 *
mm)
66 , m_ScintiT9CornerLowerRight(198.1 *
mm, -198.1 *
mm / tan(52.02 / 180. * M_PI) - m_ScintiT9FrontSize)
67 , m_ScintiT9CornerLowerLeft(0 *
mm, -m_ScintiT9FrontSize)
70 m_ScintiT10FrontSize(149.2 *
mm)
71 , m_ScintiT10CornerUpperLeft(0 *
mm, 0 *
mm)
72 , m_ScintiT10CornerUpperRight(198.1 *
mm, -154.6 *
mm)
73 , m_ScintiT10CornerLowerRight(198.1 *
mm, -198.1 *
mm / tan(48.34 / 180. * M_PI) - m_ScintiT10FrontSize)
74 , m_ScintiT10CornerLowerLeft(0 *
mm, -m_ScintiT10FrontSize)
77 m_ScintiT11FrontSize(144.3 *
mm)
78 , m_ScintiT11CornerUpperLeft(0 *
mm, 0 *
mm)
79 , m_ScintiT11CornerUpperRight(198.1 *
mm, -176.2 *
mm)
80 , m_ScintiT11CornerLowerRight(198.1 *
mm, -198.1 *
mm / tan(45.14 / 180. * M_PI) - m_ScintiT11FrontSize)
81 , m_ScintiT11CornerLowerLeft(0 *
mm, -m_ScintiT11FrontSize)
84 m_ScintiT12FrontSize(186.6 *
mm)
85 , m_ScintiT12CornerUpperLeft(0 *
mm, 0 *
mm)
86 , m_ScintiT12CornerUpperRight(198.1 *
mm, -197.11 *
mm)
87 , m_ScintiT12CornerLowerRight(198.1 *
mm, -198.1 *
mm / tan(41.47 / 180. * M_PI) - m_ScintiT12FrontSize)
88 , m_ScintiT12CornerLowerLeft(0 *
mm, -m_ScintiT12FrontSize)
92 , m_SteelZ(901.7 *
mm)
94 , m_ScintiTileZ(m_SteelZ)
95 , m_ScintiTileThickness(7 *
mm)
96 , m_ScintiBoxSmaller(0.02 *
mm)
98 m_GapBetweenTiles(1 *
mm)
99 , m_ScintiGap(8.5 *
mm)
100 , m_DeltaPhi(2 * M_PI / 320.)
102 , m_VolumeScintillator(NAN)
103 , m_NScintiPlates(20)
104 , m_NSteelPlates(m_NScintiPlates + 1)
105 , m_ActiveFlag(m_Params->get_int_param(
"active"))
106 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
120 G4LogicalVolume* logvol = volume->GetLogicalVolume();
137 G4VSolid* steel_plate;
138 std::vector<G4TwoVector> vertexes;
143 G4TwoVector
zero(0, 0);
144 steel_plate =
new G4ExtrudedSolid(
"InnerHcalSteelPlateSolid",
152 G4VisAttributes visattchk;
153 visattchk.SetVisibility(
true);
154 visattchk.SetForceSolid(
false);
155 visattchk.SetColour(G4Colour::Blue());
168 G4LogicalVolume* scintiboxlogical =
new G4LogicalVolume(scintiboxsolid, G4Material::GetMaterial(
"G4_AIR"),
scintimothername, 0, 0, 0);
169 G4VisAttributes hcalVisAtt;
170 hcalVisAtt.SetVisibility(
true);
171 hcalVisAtt.SetForceSolid(
false);
172 hcalVisAtt.SetColour(G4Colour::Magenta());
174 scintit9_logic->SetVisAttributes(hcalVisAtt);
177 G4RotationMatrix* Rot;
178 Rot =
new G4RotationMatrix();
179 Rot->rotateX(90 *
deg);
180 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit9_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
182 hcalVisAtt.SetVisibility(
true);
183 hcalVisAtt.SetForceSolid(
false);
184 hcalVisAtt.SetColour(G4Colour::Blue());
186 scintit10_logic->SetVisAttributes(hcalVisAtt);
189 Rot =
new G4RotationMatrix();
190 Rot->rotateX(90 *
deg);
192 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit10_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
194 hcalVisAtt.SetVisibility(
true);
195 hcalVisAtt.SetForceSolid(
false);
196 hcalVisAtt.SetColour(G4Colour::Yellow());
198 scintit11_logic->SetVisAttributes(hcalVisAtt);
201 Rot =
new G4RotationMatrix();
202 Rot->rotateX(90 *
deg);
204 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit11_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
206 hcalVisAtt.SetVisibility(
true);
207 hcalVisAtt.SetForceSolid(
false);
208 hcalVisAtt.SetColour(G4Colour::Cyan());
210 scintit12_logic->SetVisAttributes(hcalVisAtt);
213 Rot =
new G4RotationMatrix();
214 Rot->rotateX(90 *
deg);
216 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit12_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
219 return scintiboxlogical;
228 G4LogicalVolume* scintiboxlogical =
new G4LogicalVolume(scintiboxsolid, G4Material::GetMaterial(
"G4_AIR"),
scintimothername, 0, 0, 0);
229 G4VisAttributes hcalVisAtt;
230 hcalVisAtt.SetVisibility(
true);
231 hcalVisAtt.SetForceSolid(
false);
232 hcalVisAtt.SetColour(G4Colour::Red());
234 scintiu1_logic->SetVisAttributes(hcalVisAtt);
236 hcalVisAtt.SetVisibility(
true);
237 hcalVisAtt.SetForceSolid(
false);
238 hcalVisAtt.SetColour(G4Colour::Cyan());
240 scintiu2_logic->SetVisAttributes(hcalVisAtt);
241 G4RotationMatrix* Rot;
242 Rot =
new G4RotationMatrix();
243 Rot->rotateX(-90 *
deg);
246 Rot =
new G4RotationMatrix();
247 Rot->rotateX(-90 *
deg);
251 Rot =
new G4RotationMatrix();
252 Rot->rotateX(90 *
deg);
256 Rot =
new G4RotationMatrix();
257 Rot->rotateX(90 *
deg);
261 return scintiboxlogical;
267 std::vector<G4TwoVector> vertexes;
272 G4TwoVector
zero(0, 0);
273 G4VSolid* scintiu1 =
new G4ExtrudedSolid(
"InnerHcalScintiU1",
279 G4LogicalVolume* scintiu1_logic =
new G4LogicalVolume(scintiu1, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiU1",
nullptr,
nullptr,
nullptr);
282 return scintiu1_logic;
288 std::vector<G4TwoVector> vertexes;
293 G4TwoVector
zero(0, 0);
294 G4VSolid* scintiu2 =
new G4ExtrudedSolid(
"InnerHcalScintiU2",
300 G4LogicalVolume* scintiu2_logic =
new G4LogicalVolume(scintiu2, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiU2",
nullptr,
nullptr,
nullptr);
303 return scintiu2_logic;
309 std::vector<G4TwoVector> vertexes;
314 G4TwoVector
zero(0, 0);
315 G4VSolid* scintit9 =
new G4ExtrudedSolid(
"InnerHcalScintiT9",
321 G4LogicalVolume* scintit9_logic =
new G4LogicalVolume(scintit9, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT9",
nullptr,
nullptr,
nullptr);
324 return scintit9_logic;
330 std::vector<G4TwoVector> vertexes;
335 G4TwoVector
zero(0, 0);
336 G4VSolid* scintit10 =
new G4ExtrudedSolid(
"InnerHcalScintiT10",
342 G4LogicalVolume* scintit10_logic =
new G4LogicalVolume(scintit10, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT10",
nullptr,
nullptr,
nullptr);
345 return scintit10_logic;
351 std::vector<G4TwoVector> vertexes;
356 G4TwoVector
zero(0, 0);
357 G4VSolid* scintit11 =
new G4ExtrudedSolid(
"InnerHcalScintiT11",
363 G4LogicalVolume* scintit11_logic =
new G4LogicalVolume(scintit11, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT11",
nullptr,
nullptr,
nullptr);
366 return scintit11_logic;
372 std::vector<G4TwoVector> vertexes;
377 G4TwoVector
zero(0, 0);
378 G4VSolid* scintit12 =
new G4ExtrudedSolid(
"InnerHcalScintiT12",
384 G4LogicalVolume* scintit12_logic =
new G4LogicalVolume(scintit12, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT12",
nullptr,
nullptr,
nullptr);
387 return scintit12_logic;
397 G4RotationMatrix Rot;
420 string volname = (*it)->GetName();
449 G4LogicalVolume* scintibox =
nullptr;
464 double middlerad = sqrt(bottom_xmiddle_steel_tile * bottom_xmiddle_steel_tile + bottom_ymiddle_steel_tile * bottom_ymiddle_steel_tile);
465 double philow = atan((bottom_ymiddle_steel_tile -
m_ScintiGap / 2. - 0.87 *
mm) / bottom_xmiddle_steel_tile);
469 G4RotationMatrix Rot;
470 Rot.rotateZ(phi *
rad);
471 G4ThreeVector g4vec(0, 0, 0);
475 double ypos = sin(phi + philow) * middlerad;
476 double xpos = cos(phi + philow) * middlerad;
477 G4RotationMatrix Rot1;
478 Rot1.rotateZ(scintiangle + phislat);
479 G4ThreeVector g4vecsc(xpos, ypos, 0);
495 double angle = atan(ylen / xlen);
501 cout <<
"Inner Hcal Detector:" << endl;
502 if (what ==
"ALL" || what ==
"VOLUME")
519 cout <<
"unknown scintillator volume name: " << volname << endl;
535 cout <<
"unknown steel volume name: " << volname << endl;