9 #include <phparameter/PHParameters.h>
25 #include <Geant4/G4Tubs.hh>
26 #include <Geant4/G4Color.hh>
27 #include <Geant4/G4LogicalVolume.hh>
28 #include <Geant4/G4Material.hh>
29 #include <Geant4/G4PVPlacement.hh>
30 #include <Geant4/G4SystemOfUnits.hh>
31 #include <Geant4/G4VisAttributes.hh>
32 #include <Geant4/G4String.hh>
33 #include <Geant4/G4ThreeVector.hh>
34 #include <Geant4/G4Types.hh>
35 #include <Geant4/G4VPhysicalVolume.hh>
36 #include <Geant4/G4VSolid.hh>
48 , m_Params(parameters)
73 std::cout <<
"PHG4Micromegas Detector:" << std::endl;
74 if (what ==
"ALL" || what ==
"VOLUME")
76 std::cout <<
"Version 0.1" << std::endl;
77 std::cout <<
"Parameters:" << std::endl;
109 mmg_FR4->AddMaterial( G4_C, 0.43550 );
110 mmg_FR4->AddMaterial( G4_H, 0.03650 );
111 mmg_FR4->AddMaterial( G4_O, 0.28120 );
112 mmg_FR4->AddMaterial( G4_Si, 0.24680 );
119 mmg_Kapton->AddMaterial( G4_C, 0.6911330 );
120 mmg_Kapton->AddMaterial( G4_H, 0.0263620 );
121 mmg_Kapton->AddMaterial( G4_N, 0.0732700 );
122 mmg_Kapton->AddMaterial( G4_O, 0.2092350);
129 mmg_Gas->AddMaterial( G4_Ar, 0.900 );
130 mmg_Gas->AddMaterial( G4_C, 0.0826586 );
131 mmg_Gas->AddMaterial( G4_H, 0.0173414 );
138 mmg_Mesh->AddMaterial( G4_Cr, 0.1900 );
139 mmg_Mesh->AddMaterial( G4_Fe, 0.6800 );
140 mmg_Mesh->AddMaterial( G4_Mn, 0.0200 );
141 mmg_Mesh->AddMaterial( G4_Ni, 0.1000 );
142 mmg_Mesh->AddMaterial( G4_Si, 0.0100 );
179 const std::map<Component,float> layer_thickness =
181 { Component::PCB, 1.*
mm },
184 { Component::ResistiveStrips, 20.*
micrometer },
187 { Component::Gas2, 3.*
mm },
188 { Component::DriftCuElectrode, 15.*
micrometer },
190 { Component::DriftCarbon, 1.*
mm }
194 const std::map<Component,G4Material*> layer_material =
209 const std::map<Component, G4Colour> layer_color =
220 { Component::DriftCarbon,
G4Colour(150/255., 75/255., 0)}
225 using LayerDefinition = std::tuple<Component,std::string>;
226 const std::vector<LayerDefinition> layer_definitions =
229 std::make_tuple( Component::DriftCarbon,
"DriftCarbon_inner" ),
230 std::make_tuple( Component::DriftKapton,
"DriftKapton_inner" ),
231 std::make_tuple( Component::DriftCuElectrode,
"DriftCuElectrode_inner" ),
232 std::make_tuple( Component::Gas2,
"Gas2_inner" ),
233 std::make_tuple( Component::Mesh,
"Mesh_inner" ),
234 std::make_tuple( Component::Gas1,
"Gas1_inner" ),
235 std::make_tuple( Component::ResistiveStrips,
"ResistiveStrips_inner" ),
236 std::make_tuple( Component::KaptonStrips,
"KaptonStrips_inner" ),
237 std::make_tuple( Component::CuStrips,
"CuStrips_inner" ),
240 std::make_tuple( Component::PCB,
"PCB" ),
243 std::make_tuple( Component::CuStrips,
"CuStrips_outer" ),
244 std::make_tuple( Component::KaptonStrips,
"KaptonStrips_outer" ),
245 std::make_tuple( Component::ResistiveStrips,
"ResistiveStrips_outer" ),
246 std::make_tuple( Component::Gas1,
"Gas1_outer" ),
247 std::make_tuple( Component::Mesh,
"Mesh_outer" ),
248 std::make_tuple( Component::Gas2,
"Gas2_outer" ),
249 std::make_tuple( Component::DriftCuElectrode,
"DriftCuElectrode_outer" ),
250 std::make_tuple( Component::DriftKapton,
"DriftKapton_outer" ),
251 std::make_tuple( Component::DriftCarbon,
"DriftCarbon_outer" )
260 const double thickness = std::accumulate(
261 layer_definitions.begin(), layer_definitions.end(), 0.,
262 [layer_thickness](
double value, LayerDefinition
layer )
263 {
return value + layer_thickness.at(std::get<0>(
layer)); } );
265 std::cout <<
"PHG4MicromegasDetector::ConstructMe - detector thickness is " << thickness/
cm <<
" cm" << std::endl;
273 vis->SetForceSolid(
true);
274 vis->SetVisibility(
false);
275 cylinder_logic->SetVisAttributes(vis);
285 auto current_radius =
radius;
286 for(
const auto&
layer:layer_definitions )
288 const Component& type = std::get<0>(
layer);
289 const std::string&
name = std::get<1>(
layer);
295 const auto thickness = layer_thickness.at(type);
296 const auto material = layer_material.at(type);
297 const auto color = layer_color.at(type);
299 auto component_solid =
new G4Tubs(cname+
"_solid", current_radius, current_radius+thickness, length/2, 0,
M_PI*2);
302 vis->SetForceSolid(
true);
303 vis->SetVisibility(
true);
304 component_logic->SetVisAttributes(vis);
309 if( type == Component::Gas2 )
m_activeVolumes.insert( std::make_pair( component_phys, layer_index++ ) );
317 std::cout <<
"PHG4MicromegasDetector::ConstructMe - first layer: " <<
m_FirstLayer << std::endl;
319 { std::cout <<
"PHG4MicromegasDetector::ConstructMe - layer: " << pair.second <<
" volume: " << pair.first->GetName() << std::endl; }
331 std::string geonode_name = std::string(
"CYLINDERGEOM_" ) +
m_SuperDetector;
332 auto geonode = findNode::getClass<PHG4CylinderGeomContainer>(
topNode(), geonode_name);
339 runNode->addNode(newNode);
347 const int layer = pair.second;
356 cylinder->set_radius( (tub->GetInnerRadius()/
cm + tub->GetOuterRadius()/
cm)/2 );
357 cylinder->set_thickness( tub->GetOuterRadius()/
cm - tub->GetInnerRadius()/
cm );
358 cylinder->set_zmin( -tub->GetZHalfLength()/
cm );
359 cylinder->set_zmax( tub->GetZHalfLength()/
cm );
360 geonode->AddLayerGeom(layer, cylinder);