3 #include <phparameter/PHParameters.h>
10 #include <Geant4/G4AssemblyVolume.hh>
11 #include <Geant4/G4Box.hh>
12 #include <Geant4/G4Colour.hh>
13 #include <Geant4/G4ExtrudedSolid.hh>
14 #include <Geant4/G4LogicalVolume.hh>
15 #include <Geant4/G4Material.hh>
16 #include <Geant4/G4PVPlacement.hh>
17 #include <Geant4/G4RotationMatrix.hh>
18 #include <Geant4/G4String.hh>
19 #include <Geant4/G4SystemOfUnits.hh>
20 #include <Geant4/G4ThreeVector.hh>
21 #include <Geant4/G4TwoVector.hh>
22 #include <Geant4/G4VPhysicalVolume.hh>
23 #include <Geant4/G4VSolid.hh>
24 #include <Geant4/G4VisAttributes.hh>
26 #include <boost/format.hpp>
44 , m_InnerHcalSteelPlate(nullptr)
45 , m_InnerHcalAssembly(nullptr)
46 , m_scintibox(nullptr)
47 , m_SteelPlateCornerUpperLeft(1154.49 *
mm, -189.06 *
mm)
48 , m_SteelPlateCornerUpperRight(1297.94 *
mm, -349.22 *
mm)
49 , m_SteelPlateCornerLowerRight(1288.18 *
mm, -357.8 *
mm)
50 , m_SteelPlateCornerLowerLeft(1157.3 *
mm, -205.56 *
mm)
52 , m_ScintiTile9DistanceToCorner(26.44 *
mm)
53 , m_ScintiTile9FrontSize(140.3 *
mm)
54 , m_ScintiTile9CornerUpperLeft(0 *
mm, 0 *
mm)
55 , m_ScintiTile9CornerUpperRight(191. *
mm, -134.4 * 191. / 198.1 *
mm)
56 , m_ScintiTile9CornerLowerRight(191. *
mm, -191. *
mm / tan(52.02 / 180. * M_PI) - m_ScintiTile9FrontSize)
57 , m_ScintiTile9CornerLowerLeft(0 *
mm, -m_ScintiTile9FrontSize)
59 , m_ScintiTile10FrontSize(149.2 *
mm)
60 , m_ScintiTile10CornerUpperLeft(0 *
mm, 0 *
mm)
61 , m_ScintiTile10CornerUpperRight(191. *
mm, -154.6 * 191. / 198.1 *
mm)
62 , m_ScintiTile10CornerLowerRight(191. *
mm, -191. *
mm / tan(48.34 / 180. * M_PI) - m_ScintiTile10FrontSize)
63 , m_ScintiTile10CornerLowerLeft(0 *
mm, -m_ScintiTile10FrontSize)
65 , m_ScintiTile11FrontSize(144.3 *
mm)
66 , m_ScintiTile11CornerUpperLeft(0 *
mm, 0 *
mm)
67 , m_ScintiTile11CornerUpperRight(191. *
mm, -176.2 * 191. / 198.1 *
mm)
68 , m_ScintiTile11CornerLowerRight(191. *
mm, -191. *
mm / tan(45.14 / 180. * M_PI) - m_ScintiTile11FrontSize)
69 , m_ScintiTile11CornerLowerLeft(0 *
mm, -m_ScintiTile11FrontSize)
71 , m_ScintiTile12FrontSize(186.6 *
mm)
72 , m_ScintiTile12CornerUpperLeft(0 *
mm, 0 *
mm)
73 , m_ScintiTile12CornerUpperRight(191. *
mm, -197.11 * 191. / 198.1 *
mm)
74 , m_ScintiTile12CornerLowerRight(191. *
mm, -191. *
mm / tan(41.47 / 180. * M_PI) - m_ScintiTile12FrontSize)
75 , m_ScintiTile12CornerLowerLeft(0 *
mm, -m_ScintiTile12FrontSize)
77 , m_ScintiX(198.1 *
mm)
78 , m_SteelZ(901.7 *
mm)
79 , m_ScintiTileZ(m_SteelZ)
80 , m_ScintiTileThickness(7 *
mm)
81 , m_GapBetweenTiles(1 *
mm)
82 , m_ScintiGap(10 *
mm)
83 , m_DeltaPhi(2 * M_PI / 256.)
85 , m_VolumeScintillator(0)
86 , m_ScintiCornerLowerLeft(45.573 *
inch, -7.383 *
inch)
87 , m_ScintiCornerLowerRight(50.604 *
inch, -12.972 *
inch)
91 , m_NumScintiPlates(16)
92 , m_NumSteelPlates(m_NumScintiPlates + 1)
93 , m_Active(
m_params->get_int_param(
"active"))
94 , m_AbsorberActive(
m_params->get_int_param(
"absorberactive"))
110 G4LogicalVolume *logvol = volume->GetLogicalVolume();
127 G4VSolid *steel_plate;
129 std::vector<G4TwoVector> vertexes;
134 G4TwoVector
zero(0, 0);
135 steel_plate =
new G4ExtrudedSolid(
"InnerHcalSteelPlateSolid",
143 G4VisAttributes visattchk;
144 visattchk.SetVisibility(
true);
145 visattchk.SetForceSolid(
false);
146 visattchk.SetColour(G4Colour::Blue());
159 G4LogicalVolume *scintiboxlogical =
new G4LogicalVolume(scintiboxsolid, G4Material::GetMaterial(
"G4_AIR"), G4String(
scintimothername), 0, 0, 0);
160 G4VisAttributes hcalVisAtt;
161 hcalVisAtt.SetVisibility(
true);
162 hcalVisAtt.SetForceSolid(
false);
163 hcalVisAtt.SetColour(G4Colour::Magenta());
165 scintit9_logic->SetVisAttributes(hcalVisAtt);
167 G4RotationMatrix *Rot;
168 Rot =
new G4RotationMatrix();
169 Rot->rotateX(90 *
deg);
170 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit9_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
172 hcalVisAtt.SetVisibility(
true);
173 hcalVisAtt.SetForceSolid(
false);
174 hcalVisAtt.SetColour(G4Colour::Blue());
176 scintit10_logic->SetVisAttributes(hcalVisAtt);
179 Rot =
new G4RotationMatrix();
180 Rot->rotateX(90 *
deg);
182 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit10_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
184 hcalVisAtt.SetVisibility(
true);
185 hcalVisAtt.SetForceSolid(
false);
186 hcalVisAtt.SetColour(G4Colour::Yellow());
188 scintit11_logic->SetVisAttributes(hcalVisAtt);
191 Rot =
new G4RotationMatrix();
192 Rot->rotateX(90 *
deg);
194 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit11_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
196 hcalVisAtt.SetVisibility(
true);
197 hcalVisAtt.SetForceSolid(
false);
198 hcalVisAtt.SetColour(G4Colour::Cyan());
200 scintit12_logic->SetVisAttributes(hcalVisAtt);
203 Rot =
new G4RotationMatrix();
204 Rot->rotateX(90 *
deg);
206 new G4PVPlacement(Rot, G4ThreeVector(-
m_ScintiX / 2., 0, distance_to_corner), scintit12_logic, (
boost::format(
"InnerScinti_%d") % copynum).
str(), scintiboxlogical,
false, copynum,
OverlapCheck());
208 return scintiboxlogical;
214 std::vector<G4TwoVector> vertexes;
219 G4TwoVector
zero(0, 0);
220 G4VSolid *scintit9 =
new G4ExtrudedSolid(
"InnerHcalScintiT9",
227 G4LogicalVolume *scintit9_logic =
new G4LogicalVolume(scintit9, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT9",
nullptr,
nullptr,
nullptr);
230 return scintit9_logic;
236 std::vector<G4TwoVector> vertexes;
241 G4TwoVector
zero(0, 0);
242 G4VSolid *scintit10 =
new G4ExtrudedSolid(
"InnerHcalScintiT10",
249 G4LogicalVolume *scintit10_logic =
new G4LogicalVolume(scintit10, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT10",
nullptr,
nullptr,
nullptr);
252 return scintit10_logic;
258 std::vector<G4TwoVector> vertexes;
263 G4TwoVector
zero(0, 0);
264 G4VSolid *scintit11 =
new G4ExtrudedSolid(
"InnerHcalScintiT11",
271 G4LogicalVolume *scintit11_logic =
new G4LogicalVolume(scintit11, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT11",
nullptr,
nullptr,
nullptr);
274 return scintit11_logic;
280 std::vector<G4TwoVector> vertexes;
285 G4TwoVector
zero(0, 0);
286 G4VSolid *scintit12 =
new G4ExtrudedSolid(
"InnerHcalScintiT12",
293 G4LogicalVolume *scintit12_logic =
new G4LogicalVolume(scintit12, G4Material::GetMaterial(
"G4_POLYSTYRENE"),
"InnerHcalScintiT12",
nullptr,
nullptr,
nullptr);
296 return scintit12_logic;
306 G4RotationMatrix Rot;
323 string volname = (*it)->GetName();
360 cout <<
"midrapidity scintillator not implemented" << endl;
373 double middlerad = sqrt(bottom_xmiddle_steel_tile * bottom_xmiddle_steel_tile + bottom_ymiddle_steel_tile * bottom_ymiddle_steel_tile) - 0.14 *
cm;
375 double philow = atan((bottom_ymiddle_steel_tile - (
m_ScintiGap * 25. / 32.)) / bottom_xmiddle_steel_tile);
381 double xoff = 0.015 *
cm;
384 G4RotationMatrix Rot;
385 Rot.rotateZ(phi *
rad);
386 G4ThreeVector g4vec(xstart, 0, 0);
390 double ypos = sin(phi + philow) * middlerad;
391 double xpos = cos(phi + philow) * middlerad;
392 G4RotationMatrix Rot1;
393 Rot1.rotateZ(scintiangle + phislat);
394 G4ThreeVector g4vecsc(xpos + xstart, ypos, 0);
411 double angle = atan(ylen / xlen);
417 cout <<
"Inner Hcal Detector:" << endl;
418 if (what ==
"ALL" || what ==
"VOLUME")
436 cout <<
"unknown scintillator volume name: " << volname << endl;
452 cout <<
"unknown steel volume name: " << volname << endl;