Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:26

0001 #ifndef MACRO_G4WORLD_C
0002 #define MACRO_G4WORLD_C
0003 
0004 #include <GlobalVariables.C>
0005 
0006 #include <g4main/PHG4Reco.h>
0007 
0008 #include <cmath>
0009 
0010 R__LOAD_LIBRARY(libg4testbench.so)
0011 
0012 namespace G4WORLD
0013 {
0014   double AddSpace = 100.;                 // add this much space in cm around edge of detector
0015   std::string WorldMaterial = "G4_AIR";   // default world material, use G4_Galactic for material scan
0016   std::string PhysicsList = "FTFP_BERT";  // for calorimeters use HP lists
0017 }  // namespace G4WORLD
0018 
0019 void WorldInit(PHG4Reco *g4Reco)
0020 {
0021   g4Reco->SetWorldMaterial(G4WORLD::WorldMaterial);
0022   g4Reco->SetPhysicsList(G4WORLD::PhysicsList);
0023 }
0024 
0025 void WorldSize(PHG4Reco *g4Reco, double radius)
0026 {
0027   double world_radius = std::max((BlackHoleGeometry::max_radius + BlackHoleGeometry::gap), radius);
0028   g4Reco->SetWorldSizeY(std::max(g4Reco->GetWorldSizeY(), world_radius + G4WORLD::AddSpace));
0029   // our world is a symmetric cylinder so the center is at 0/0/0, pick the largest of abs(min_z) || abs(max_z)
0030   double min_zval = std::min((BlackHoleGeometry::min_z - BlackHoleGeometry::gap), -((g4Reco->GetWorldSizeZ() - 100) / 2.));
0031   double max_zval = std::max((BlackHoleGeometry::max_z + BlackHoleGeometry::gap), (g4Reco->GetWorldSizeZ() - 100) / 2.);
0032   double final_zval = std::max(std::fabs(min_zval), std::fabs(max_zval) + G4WORLD::AddSpace);
0033   g4Reco->SetWorldSizeZ(std::max(g4Reco->GetWorldSizeZ(), 2 * (final_zval)));
0034   return;
0035 }
0036 #endif