17 #include <phparameter/PHParameters.h>
22 #include <Geant4/G4AssemblyVolume.hh>
23 #include <Geant4/G4LogicalVolume.hh>
24 #include <Geant4/G4Material.hh>
25 #include <Geant4/G4PVPlacement.hh>
26 #include <Geant4/G4RotationMatrix.hh>
27 #include <Geant4/G4String.hh>
28 #include <Geant4/G4SystemOfUnits.hh>
29 #include <Geant4/G4ThreeVector.hh>
30 #include <Geant4/G4VPhysicalVolume.hh>
31 #include <Geant4/G4VisAttributes.hh>
34 #pragma GCC diagnostic push
35 #pragma GCC diagnostic ignored "-Wshadow"
36 #include <Geant4/G4GDMLParser.hh>
37 #include <Geant4/G4GDMLReadStructure.hh>
38 #pragma GCC diagnostic pop
40 #include <CLHEP/Units/SystemOfUnits.h>
50 , m_GDMPath(parameters->get_string_param(
"GDMPath"))
51 , m_TopVolName(parameters->get_string_param(
"TopVolName"))
52 , m_placeX(parameters->get_double_param(
"place_x") *
cm)
53 , m_placeY(parameters->get_double_param(
"place_y") *
cm)
54 , m_placeZ(parameters->get_double_param(
"place_z") *
cm)
55 , m_rotationX(parameters->get_double_param(
"rot_x") *
degree)
56 , m_rotationY(parameters->get_double_param(
"rot_y") *
degree)
57 , m_rotationZ(parameters->get_double_param(
"rot_z") *
degree)
58 , m_skipDSTGeometryExport(parameters->get_int_param(
"skip_DST_geometry_export"))
86 std::cout <<
" PHG4MapsDetector::Construct:";
96 std::unique_ptr<G4GDMLReadStructure>
reader(
new G4GDMLReadStructure());
97 G4GDMLParser gdmlParser(reader.get());
108 std::cout <<
"PHG4GDMLDetector::Construct - Fatal Error - failed to find G4LogicalVolume " <<
m_TopVolName <<
" - Print: ";
115 G4RotationMatrix* rotm =
new G4RotationMatrix();
123 G4PVPlacement* gdml_phys =
124 new G4PVPlacement(rotm, placeVec,
142 std::vector<G4VPhysicalVolume*>::iterator
it = av->GetVolumesIterator();
144 int nDaughters = av->TotalImprintedVolumes();
145 for (
int i = 0;
i < nDaughters; ++
i, ++
it)
150 G4LogicalVolume* worldLogical = pv->GetLogicalVolume();
158 lv->GetMaterial()->GetName());
161 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" built with "
162 << material_name << std::endl;
164 G4VisAttributes* matVis =
new G4VisAttributes();
165 if (material_name.find(
"SI") != std::string::npos)
168 matVis->SetVisibility(
true);
169 matVis->SetForceSolid(
true);
171 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_Si" << std::endl;
173 else if (material_name.find(
"KAPTON") != std::string::npos)
176 matVis->SetVisibility(
true);
177 matVis->SetForceSolid(
true);
179 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_KAPTON" << std::endl;
181 else if (material_name.find(
"ALUMINUM") != std::string::npos)
184 matVis->SetVisibility(
true);
185 matVis->SetForceSolid(
true);
187 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_Al" << std::endl;
189 else if (material_name.find(
"Carbon") != std::string::npos)
191 matVis->SetColour(0.5, 0.5, 0.5, .25);
192 matVis->SetVisibility(
true);
193 matVis->SetForceSolid(
true);
195 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with Gray" << std::endl;
197 else if (material_name.find(
"M60J3K") != std::string::npos)
199 matVis->SetColour(0.25, 0.25, 0.25, .25);
200 matVis->SetVisibility(
true);
201 matVis->SetForceSolid(
true);
203 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with Gray" << std::endl;
205 else if (material_name.find(
"WATER") != std::string::npos)
207 matVis->SetColour(0.0, 0.5, 0.0, .25);
208 matVis->SetVisibility(
true);
209 matVis->SetForceSolid(
true);
211 std::cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with WATER" << std::endl;
215 matVis->SetColour(.2, .2, .7, .25);
216 matVis->SetVisibility(
true);
217 matVis->SetForceSolid(
true);
219 lv->SetVisAttributes(matVis);
221 int nDaughters = lv->GetNoDaughters();
222 for (
int i = 0;
i < nDaughters; ++
i)
228 G4LogicalVolume* worldLogical = pv->GetLogicalVolume();