16 #include <Geant4/G4Box.hh>
17 #include <Geant4/G4DisplacedSolid.hh>
18 #include <Geant4/G4Exception.hh>
19 #include <Geant4/G4ExceptionSeverity.hh>
20 #include <Geant4/G4IntersectionSolid.hh>
21 #include <Geant4/G4LogicalVolume.hh>
22 #include <Geant4/G4Material.hh>
23 #include <Geant4/G4MaterialTable.hh>
24 #include <Geant4/G4PVPlacement.hh>
25 #include <Geant4/G4PhysicalConstants.hh>
26 #include <Geant4/G4Sphere.hh>
27 #include <Geant4/G4SystemOfUnits.hh>
28 #include <Geant4/G4ThreeVector.hh>
29 #include <Geant4/G4Transform3D.hh>
30 #include <Geant4/G4Tubs.hh>
31 #include <Geant4/G4Types.hh>
40 using namespace PHG4Sector;
44 : overlapcheck_sector(
false)
57 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (
name_base)).c_str(),
58 __FILE__, FatalException,
59 " detector configured with zero thickness!");
65 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (
name_base)).c_str(),
66 __FILE__, FatalException,
"min_polar_angle = max_polar_angle!");
71 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (
name_base)).c_str(),
72 __FILE__, JustWarning,
73 "min and max polar angle got reversed. Correcting them.");
82 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (
name_base)).c_str(),
83 __FILE__, FatalException,
84 "can NOT use flat edge for single or double sector detector!");
87 const G4Transform3D transform_Det_to_Hall =
91 const G4Transform3D transform_Hall_to_Det(transform_Det_to_Hall.inverse());
96 const double sph_min_polar_angle =
98 const double sph_max_polar_angle =
101 G4VSolid *SecConeBoundary_Hall =
new G4Sphere(
"SecConeBoundary_Hall",
104 sph_min_polar_angle, sph_max_polar_angle - sph_min_polar_angle
107 G4VSolid *SecConeBoundary_Det =
new G4DisplacedSolid(
"SecConeBoundary_Det",
108 SecConeBoundary_Hall, transform_Hall_to_Det);
110 G4VSolid *Boundary_Det = SecConeBoundary_Det;
116 const double sph_min_polar_size =
118 const double sph_max_polar_size =
121 G4VSolid *BoxBoundary_Det =
new G4Box(
"BoxBoundary_Det",
122 geom.
get_max_R(), (sph_min_polar_size + sph_max_polar_size) / 2,
124 G4VSolid *BoxBoundary_Det_Place =
new G4DisplacedSolid(
125 "BoxBoundary_Det_Place", BoxBoundary_Det, 0,
126 G4ThreeVector(0, (sph_max_polar_size - sph_min_polar_size) / 2, 0));
128 Boundary_Det =
new G4IntersectionSolid(
"Boundary_Det",
129 BoxBoundary_Det_Place, SecConeBoundary_Det);
138 G4LogicalVolume *DetectorLog_Det =
new G4LogicalVolume(DetectorBox_Det,
146 G4RotateZ3D(2 *
pi /
geom.
get_N_Sector() * sec) * transform_Det_to_Hall, DetectorLog_Det,
153 for (Sector_Geometry::t_layer_list::const_iterator
it =
157 const Layer &l = (*it);
162 s <<
name_base <<
" have invalid layer ";
166 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (name_base)).c_str(), __FILE__, FatalException,
175 G4LogicalVolume *LayerLog_Det =
new G4LogicalVolume(LayerSol_Det,
180 new G4PVPlacement(0, G4ThreeVector(), LayerLog_Det,
190 s <<
name_base <<
" - accumulated thickness = "
195 (
string(
"PHG4SectorConstructor::Construct_Sectors::") + (
name_base)).c_str(),
196 __FILE__, FatalException, s.str().c_str());
202 std::cout <<
"PHG4SectorConstructor::Construct_Sectors::" <<
name_base
205 std::cout <<
"PHG4SectorConstructor::Construct_Sectors::" <<
name_base <<
" - "
206 <<
map_log_vol.size() <<
" logical volume constructed" << std::endl;
207 std::cout <<
"PHG4SectorConstructor::Construct_Sectors::" <<
name_base <<
" - "
208 <<
map_phy_vol.size() <<
" physical volume constructed; "
215 const std::string &
name,
216 const double start_z,
218 G4VSolid *SecConeBoundary_Det
221 assert(SecConeBoundary_Det);
223 G4VSolid *Sol_Raw =
new G4Tubs(name +
"_Raw",
231 G4VSolid *Sol_Place =
new G4DisplacedSolid(name +
"_Place", Sol_Raw, 0,
232 G4ThreeVector(0, 0, start_z + thickness / 2));
234 G4VSolid *Sol =
new G4IntersectionSolid(name.c_str(), Sol_Place,
235 SecConeBoundary_Det);
269 <<
"PHG4SectorConstructor::RegisterVolume - Error - invalid volume!"
275 std::cout <<
"PHG4SectorConstructor::RegisterVolume - Warning - replacing "
276 << v->GetName() << std::endl;
291 <<
"PHG4SectorConstructor::RegisterPhysicalVolume - Error - invalid volume!"
301 <<
"PHG4SectorConstructor::RegisterPhysicalVolume - Warning - replacing "
302 << v->GetName() <<
"[" << v->GetCopyNo() <<
"]" << std::endl;
317 for (t_layer_list::const_iterator
it =
layer_list.begin();
338 s <<
"Geometry check failed. " << endl;
342 s <<
"cos(min_polar_angle + normal_polar_angle) = "
345 G4Exception(
"Sector_Geometry::get_max_R", __FILE__, FatalException,
351 s <<
"Geometry check failed. " << endl;
355 s <<
"cos(max_polar_angle + normal_polar_angle) = "
358 G4Exception(
"Sector_Geometry::get_max_R", __FILE__, FatalException,
362 const double max_tan_angle =
std::max(
386 AddLayer(
"EntranceWindow",
"G4_MYLAR", 25 *
um,
false, 100);
387 AddLayer(
"Cathode",
"G4_GRAPHITE", 10 *
um,
false, 100);
408 for (
int gem = 1; gem <= n_GEM_layers; gem++)
414 AddLayer(G4String(
"GEMFrontCu") + G4String(sid.str()),
"G4_Cu",
415 0.0005 *
cm,
false, 64);
418 AddLayer(G4String(
"GEMKapton") + G4String(sid.str()),
"G4_KAPTON",
419 0.005 *
cm,
false, 64);
422 AddLayer(G4String(
"GEMBackCu") + G4String(sid.str()),
"G4_Cu",
423 0.0005 *
cm,
false, 64);
426 AddLayer(G4String(
"Frame") + G4String(sid.str()),
"G10", 0.15 *
cm,
false,
431 AddLayer(G4String(
"PCBKapton"),
"G4_KAPTON", 0.005 *
cm,
false, 100);
434 AddLayer(G4String(
"PCBCu"),
"G4_Cu", 0.0005 *
cm,
false, 80);
437 AddLayer(
"Facesheet",
"G10", 0.025 * 2 *
cm,
false, 100);
453 AddLayer(G4String(
"ReadoutFR4"),
"G10", 0.05 *
cm,
false, 100);
454 AddLayer(G4String(
"ReadoutCu"),
"G4_Cu", 0.001 *
cm,
false, 100);
458 AddLayer(G4String(
"SocketsCu"),
"G4_Cu", 0.0005 *
cm,
false, 100);
466 const double expansion_length, std::string radiator)
468 if (radiator ==
"Default")
470 radiator =
"ePHENIX_AeroGel";
474 AddLayer(
"EntranceWindow",
"G10", 0.05 *
cm,
false, 100);
475 AddLayer(
"AeroGel", radiator, radiator_length,
false, 100);
476 AddLayer(
"ExpansionVol",
"G4_AIR", expansion_length,
false, 100);
479 AddLayer(G4String(
"ReadoutFR4"),
"G10", 0.05 *
cm,
false, 100);
480 AddLayer(G4String(
"ReadoutCu"),
"G4_Cu", 0.001 *
cm,
false, 100);
481 AddLayer(G4String(
"SocketsCu"),
"G4_Cu", 0.0005 *
cm,
false, 100);