Celeritas 0.6.0-rc.2.13+develop.285b9112
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
GeantGeoUtils.hh File Reference
#include <iosfwd>
#include <string>
#include <unordered_set>
#include "corecel/Config.hh"
#include "corecel/Assert.hh"
#include "corecel/cont/Span.hh"
#include "corecel/io/Label.hh"
This graph shows which files directly or indirectly include this file:

Classes

struct  celeritas::PrintableNavHistory
 Wrap around a touchable to get a descriptive output. More...
 
struct  celeritas::PrintableLV
 Wrap around a G4LogicalVolume to get a descriptive output. More...
 

Typedefs

using celeritas::GeantTouchableBase = G4VTouchable
 

Functions

std::ostream & celeritas::operator<< (std::ostream &os, PrintableNavHistory const &pnh)
 Print detailed information about the touchable history.
 
std::ostream & celeritas::operator<< (std::ostream &os, PrintableLV const &plv)
 Print the logical volume name, ID, and address.
 
void celeritas::save_gdml (G4VPhysicalVolume const *world, std::string const &out_filename)
 Write a GDML file to the given filename.
 
void celeritas::reset_geant_geometry ()
 Reset all Geant4 geometry stores if not using RunManager.
 
Span< G4LogicalVolume * > celeritas::geant_logical_volumes ()
 Get a view to the Geant4 LV store.
 
G4VPhysicalVolume constceleritas::geant_world_volume ()
 Get the world volume for the primary geometry.
 
bool celeritas::is_replica (G4VPhysicalVolume const &pv)
 Whether a physical volume is parameterized or replicated.
 
std::unordered_set< G4LogicalVolume const * > celeritas::find_geant_volumes (std::unordered_set< std::string > names)
 Find Geant4 logical volumes corresponding to a list of names.
 
std::vector< Labelceleritas::make_logical_vol_labels (G4VPhysicalVolume const &world)
 Get a reproducible vector of LV instance ID -> label from the given world.
 
std::vector< Labelceleritas::make_physical_vol_labels (G4VPhysicalVolume const &world)
 Get a reproducible vector of PV instance ID -> label from the given world.
 
void celeritas::set_history (Span< GeantPhysicalInstance const > stack, G4NavigationHistory *nav)
 Update a nav history to match the given pv stack.
 

Function Documentation

◆ find_geant_volumes()

std::unordered_set< G4LogicalVolume const * > celeritas::find_geant_volumes ( std::unordered_set< std::string >  names)
inline

Find Geant4 logical volumes corresponding to a list of names.

If logical volumes with duplicate names are present, they will all show up in the output and a warning will be emitted. If one is missing, a RuntimeError will be raised.

static std::string_view const labels[] = {"Vol1", "Vol2"};
auto vols = find_geant_volumes(make_span(labels));

◆ geant_logical_volumes()

Span< G4LogicalVolume * > celeritas::geant_logical_volumes ( )
inline

Get a view to the Geant4 LV store.

This includes all volumes, potentially null ones as well.

◆ geant_world_volume()

G4VPhysicalVolume const * celeritas::geant_world_volume ( )

Get the world volume for the primary geometry.

Returns
World volume if geometry has been initialized, nullptr otherwise.

◆ operator<<()

std::ostream & celeritas::operator<< ( std::ostream &  os,
PrintableNavHistory const pnh 
)
inline

Print detailed information about the touchable history.

For brevity, this does not print the world volume.

◆ reset_geant_geometry()

void celeritas::reset_geant_geometry ( )
inline

Reset all Geant4 geometry stores if not using RunManager.

Use this function if reading geometry and cleaning up without doing any transport in between (useful for geometry conversion testing).

◆ set_history()

void celeritas::set_history ( Span< GeantPhysicalInstance const stack,
G4NavigationHistory nav 
)

Update a nav history to match the given pv stack.

The resulting nav history always has at least one level (i.e. GetDepth is zero). An empty input stack, corresponding to "outside" the world, results in a nav history with one level but a nullptr physical volume as the top.

Note
The stack should have the same semantics as LevelId, i.e. the initial entry is the "most global" level.