17 #include <phparameter/PHParameters.h>
21 #include <Geant4/G4AssemblyVolume.hh>
22 #include <Geant4/G4GDMLParser.hh>
23 #include <Geant4/G4GDMLReadStructure.hh>
24 #include <Geant4/G4LogicalVolume.hh>
25 #include <Geant4/G4Material.hh>
26 #include <Geant4/G4PVPlacement.hh>
27 #include <Geant4/G4RotationMatrix.hh>
28 #include <Geant4/G4String.hh>
29 #include <Geant4/G4SystemOfUnits.hh>
30 #include <Geant4/G4ThreeVector.hh>
31 #include <Geant4/G4VPhysicalVolume.hh>
32 #include <Geant4/G4VisAttributes.hh>
34 #include <CLHEP/Units/SystemOfUnits.h>
46 , m_GDMPath(parameters->get_string_param(
"GDMPath"))
47 , m_TopVolName(parameters->get_string_param(
"TopVolName"))
48 , m_placeX(parameters->get_double_param(
"place_x") *
cm)
49 , m_placeY(parameters->get_double_param(
"place_y") *
cm)
50 , m_placeZ(parameters->get_double_param(
"place_z") *
cm)
51 , m_rotationX(parameters->get_double_param(
"rot_x") *
degree)
52 , m_rotationY(parameters->get_double_param(
"rot_y") *
degree)
53 , m_rotationZ(parameters->get_double_param(
"rot_z") *
degree)
54 , m_skipDSTGeometryExport(parameters->get_int_param(
"skip_DST_geometry_export"))
55 , gdml_config(nullptr)
85 cout <<
" PHG4MapsDetector::Construct:";
107 cout <<
"PHG4GDMLDetector::Construct - Fatal Error - failed to find G4LogicalVolume " <<
m_TopVolName <<
" - Print: ";
114 G4RotationMatrix* rotm =
new G4RotationMatrix();
122 G4PVPlacement* gdml_phys =
123 new G4PVPlacement(rotm, placeVec,
141 std::vector<G4VPhysicalVolume*>::iterator
it = av->GetVolumesIterator();
143 int nDaughters = av->TotalImprintedVolumes();
144 for (
int i = 0; i < nDaughters; ++i, ++
it)
147 G4VPhysicalVolume* pv = (*it);
149 G4LogicalVolume* worldLogical = pv->GetLogicalVolume();
156 string material_name(
157 lv->GetMaterial()->GetName());
160 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" built with "
161 << material_name << endl;
163 G4VisAttributes* matVis =
new G4VisAttributes();
164 if (material_name.find(
"SI") != std::string::npos)
167 matVis->SetVisibility(
true);
168 matVis->SetForceSolid(
true);
170 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_Si" << endl;
172 else if (material_name.find(
"KAPTON") != std::string::npos)
175 matVis->SetVisibility(
true);
176 matVis->SetForceSolid(
true);
178 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_KAPTON" << endl;
180 else if (material_name.find(
"ALUMINUM") != std::string::npos)
183 matVis->SetVisibility(
true);
184 matVis->SetForceSolid(
true);
186 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with G4_Al" << endl;
188 else if (material_name.find(
"Carbon") != std::string::npos)
190 matVis->SetColour(0.5, 0.5, 0.5, .25);
191 matVis->SetVisibility(
true);
192 matVis->SetForceSolid(
true);
194 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with Gray" << endl;
196 else if (material_name.find(
"M60J3K") != std::string::npos)
198 matVis->SetColour(0.25, 0.25, 0.25, .25);
199 matVis->SetVisibility(
true);
200 matVis->SetForceSolid(
true);
202 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with Gray" << endl;
204 else if (material_name.find(
"WATER") != std::string::npos)
206 matVis->SetColour(0.0, 0.5, 0.0, .25);
207 matVis->SetVisibility(
true);
208 matVis->SetForceSolid(
true);
210 cout <<
"SetDisplayProperty - LV " << lv->GetName() <<
" display with WATER" << endl;
214 matVis->SetColour(.2, .2, .7, .25);
215 matVis->SetVisibility(
true);
216 matVis->SetForceSolid(
true);
218 lv->SetVisAttributes(matVis);
220 int nDaughters = lv->GetNoDaughters();
221 for (
int i = 0; i < nDaughters; ++i)
223 G4VPhysicalVolume* pv = lv->GetDaughter(i);
227 G4LogicalVolume* worldLogical = pv->GetLogicalVolume();