EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_World.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_World.C
1 #ifndef MACRO_G4WORLD_C
2 #define MACRO_G4WORLD_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <g4main/PHG4Reco.h>
7 
8 R__LOAD_LIBRARY(libg4testbench.so)
9 
10 namespace G4WORLD
11 {
12  double AddSpace = 100.; // add this much space in cm around edge of detector
13  string WorldMaterial = "G4_AIR"; // default world material, use G4_Galactic for material scan
14  string PhysicsList = "FTFP_BERT"; // for calorimeters use HP lists
15 } // namespace G4WORLD
16 
17 void WorldInit(PHG4Reco *g4Reco)
18 {
21 }
22 
23 void WorldSize(PHG4Reco *g4Reco, double radius)
24 {
25  double world_radius = std::max((BlackHoleGeometry::max_radius + BlackHoleGeometry::gap), radius);
26  g4Reco->SetWorldSizeY(std::max(g4Reco->GetWorldSizeY(), world_radius + G4WORLD::AddSpace));
27  // our world is a symmetric cylinder so the center is at 0/0/0, pick the largest of abs(min_z) || abs(max_z)
28  double min_zval = std::min((BlackHoleGeometry::min_z - BlackHoleGeometry::gap), -((g4Reco->GetWorldSizeZ() - 100) / 2.));
29  double max_zval = std::max((BlackHoleGeometry::max_z + BlackHoleGeometry::gap), (g4Reco->GetWorldSizeZ() - 100) / 2.);
30  double final_zval = std::max(fabs(min_zval), fabs(max_zval) + G4WORLD::AddSpace);
31  g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2 * (final_zval)));
32  return;
33 }
34 #endif