11 #include <phparameter/PHParameters.h>
15 #include <Geant4/G4LogicalVolume.hh>
16 #include <Geant4/G4Material.hh>
17 #include <Geant4/G4PVPlacement.hh>
18 #include <Geant4/G4String.hh>
19 #include <Geant4/G4SystemOfUnits.hh>
20 #include <Geant4/G4ThreeVector.hh>
21 #include <Geant4/G4Tubs.hh>
22 #include <Geant4/G4UserLimits.hh>
23 #include <Geant4/G4VPhysicalVolume.hh>
38 , m_Params(parameters)
39 , m_ActiveFlag(m_Params->get_int_param(
"active"))
40 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
41 , m_InnerCageRadius(m_Params->get_double_param(
"gas_inner_radius") *
cm - m_Params->get_double_param(
"cage_layer_9_thickness") *
cm - m_Params->get_double_param(
"cage_layer_8_thickness") *
cm - m_Params->get_double_param(
"cage_layer_7_thickness") *
cm - m_Params->get_double_param(
"cage_layer_6_thickness") *
cm - m_Params->get_double_param(
"cage_layer_5_thickness") *
cm - m_Params->get_double_param(
"cage_layer_4_thickness") *
cm - m_Params->get_double_param(
"cage_layer_3_thickness") *
cm - m_Params->get_double_param(
"cage_layer_2_thickness") *
cm - m_Params->get_double_param(
"cage_layer_1_thickness") *
cm)
42 , m_OuterCageRadius(m_Params->get_double_param(
"gas_outer_radius") *
cm + m_Params->get_double_param(
"cage_layer_9_thickness") *
cm + m_Params->get_double_param(
"cage_layer_8_thickness") *
cm + m_Params->get_double_param(
"cage_layer_7_thickness") *
cm + m_Params->get_double_param(
"cage_layer_6_thickness") *
cm + m_Params->get_double_param(
"cage_layer_5_thickness") *
cm + m_Params->get_double_param(
"cage_layer_4_thickness") *
cm + m_Params->get_double_param(
"cage_layer_3_thickness") *
cm + m_Params->get_double_param(
"cage_layer_2_thickness") *
cm + m_Params->get_double_param(
"cage_layer_1_thickness") *
cm)
101 tpc_envelope_logic,
"tpc_envelope",
107 static std::map<int, std::string> tpcgasvolname =
119 material.push_back(
"G4_Ni");
120 thickness.push_back(.240 *
cm);
121 material.push_back(
"G4_Au");
122 thickness.push_back(.008 *
cm);
149 tpc_window_logic,
"tpc_window",
158 double tpc_window_surface2_core_thickness = tpc_window_thickness - 2 * tpc_window_surface1_thickness;
159 double tpc_window_core_thickness = tpc_window_surface2_core_thickness - 2 * (tpc_window_surface2_thickness);
161 G4VSolid *tpc_window_surface2_core =
163 tpc_window_surface2_core_thickness / 2., 0., 2 *
M_PI);
166 "tpc_window_surface2_core");
175 tpc_window_surface2_core_logic,
"tpc_window_surface2_core",
183 tpc_window_core_thickness / 2., 0., 2 *
M_PI);
190 tpc_window_core_logic,
"tpc_window_core",
206 tpc_envelope,
false, PHG4TpcDefs::North,
OverlapCheck());
207 std::cout <<
"north copy no: " << tpc_gas_phys->
GetCopyNo() << std::endl;
212 tpc_envelope,
false, PHG4TpcDefs::South,
OverlapCheck());
214 std::cout <<
"south copy no: " << tpc_gas_phys->
GetCopyNo() << std::endl;
217 #if G4VERSION_NUMBER >= 1033
220 tpc_gas_logic->SetRegion(tpcregion);
242 double hangerAngle=41.39*
M_PI/180.;
243 double hangerRadius=32.05*
inch;
244 double hangerX=std::sin(hangerAngle)*hangerRadius;
245 double hangerY=std::cos(hangerAngle)*hangerRadius;
246 double hangerDiameter=2.*
inch;
255 hangerBeamLogic,
"tpc_hanger_beam_left",
258 hangerBeamLogic,
"tpc_hanger_beam_right",
269 double rodAngleStart=
M_PI/12.;
270 double rodAngularSpacing=2*
M_PI/12.;
271 double rodRadius=31.5*
inch;
272 double rodWallThickness=1./8.*
inch;
273 double rodDiameter=3./4.*
inch;
279 G4VPhysicalVolume *tpc_tie_rod_phys[12]={
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
280 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
282 std::ostringstream
name;
283 for (
int i=0;i<12;i++){
284 double ang=rodAngleStart+rodAngularSpacing*i;
286 name <<
"tpc_tie_rod_" << i;
288 tieRodLogic, name.str(),
313 static const int nlayers = 9;
339 std::ostringstream
name;
340 for (
int i = 0; i < nlayers; i++)
344 name <<
"tpc_cage_layer_" << layerno;
351 tpc_cage_layer_logic, name.str(),
354 tpc_cage_radius += thickness[i];
359 for (
int i = 0; i < nlayers; i++)
361 tpc_cage_radius -= thickness[i];
363 int layerno = 10 + 1 + i;
364 name <<
"tpc_cage_layer_" << layerno;
371 tpc_cage_layer_logic, name.str(),
381 std::string compositeName,
382 std::vector<std::string> materialName,
389 std::cout << __PRETTY_FUNCTION__ <<
" NOTICE: Checking if material " << compositeName <<
" exists. This will return a warning if it doesn't, but that is okay." << std::endl;
392 if (tempmat !=
nullptr)
394 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error: composite material " << compositeName <<
" already exists" << std::endl;
399 assert(materialName.size() == thickness.size());
402 double totalArealDensity = 0, totalThickness = 0;
403 for (std::vector<double>::size_type i = 0; i < thickness.size(); i++)
406 if (tempmat ==
nullptr)
408 std::cout << __PRETTY_FUNCTION__ <<
" Fatal Error: component material " << materialName[i] <<
" does not exist." << std::endl;
412 totalArealDensity += tempmat->
GetDensity() * thickness[i];
413 totalThickness += thickness[i];
417 double compositeDensity = totalArealDensity / totalThickness;
421 for (std::vector<double>::size_type i = 0; i < thickness.size(); i++)