Celeritas 0.6.0-67+develop.47f47c88
|
Shared Geant4 geometry model wrapper. More...
#include <GeantGeoParams.hh>
Public Types | |
Type aliases | |
using | ReplicaId = GeantPhysicalInstance::ReplicaId |
![]() | |
using | SpanConstVolumeId = Span< VolumeId const > |
using | VolumeMap = LabelIdMultiMap< VolumeId > |
using | VolInstanceMap = LabelIdMultiMap< VolumeInstanceId > |
![]() | |
using | HostRef = HostCRef< GeantGeoParamsData > |
using | DeviceRef = DeviceCRef< GeantGeoParamsData > |
Public Member Functions | |
GeantGeoParams (std::string const &gdml_filename) | |
Construct from a GDML input. | |
GeantGeoParams (G4VPhysicalVolume const *world) | |
Use an existing loaded Geant4 geometry. | |
CELER_DEFAULT_MOVE_DELETE_COPY (GeantGeoParams) | |
~GeantGeoParams () final | |
Clean up on destruction. | |
bool | supports_safety () const final |
Whether safety distance calculations are accurate and precise. | |
BBox const & | bbox () const final |
Outer bounding box of geometry. | |
LevelId::size_type | max_depth () const final |
Maximum nested volume instance depth. | |
inp::Model | make_model_input () const final |
Create model params from a Geant4 world volume. | |
VolumeMap const & | volumes () const final |
Get volume metadata. | |
VolInstanceMap const & | volume_instances () const final |
Get volume instance metadata. | |
VolumeId | find_volume (G4LogicalVolume const *volume) const final |
Locate the volume ID corresponding to a Geant4 logical volume. | |
GeantPhysicalInstance | id_to_geant (VolumeInstanceId vol_id) const final |
Get the Geant4 physical volume corresponding to a volume instance ID. | |
G4LogicalVolume const * | id_to_geant (VolumeId vol_id) const |
Get the Geant4 logical volume corresponding to a volume ID. | |
SurfaceId::size_type | num_surfaces () const |
Get the number of surfaces (TODO: maybe live in surface params?) | |
G4LogicalSurface const * | id_to_geant (SurfaceId surf_id) const |
Get the Geant4 logical surface corresponding to a surface ID. | |
VolumeId::size_type | lv_offset () const |
Offset of logical volume ID after reloading geometry. | |
VolumeInstanceId::size_type | pv_offset () const |
Offset of physical volume ID after reloading geometry. | |
GeoMatId::size_type | mat_offset () const |
Offset of material index after reloading geometry. | |
VolumeId | geant_to_id (G4LogicalVolume const &volume) const |
Get the volume ID corresponding to a Geant4 logical volume. | |
VolumeInstanceId | geant_to_id (G4VPhysicalVolume const &volume) const |
Get the volume ID corresponding to a Geant4 physical volume. | |
ReplicaId | replica_id (G4VPhysicalVolume const &volume) const |
Get the replica ID corresponding to a Geant4 physical volume. | |
BoundingBox< double > | get_clhep_bbox () const |
Get the world bbox. | |
void | reset_replica_data () const |
Initialize thread-local mutable copy numbers for "replica" volumes. | |
HostRef const & | host_ref () const final |
Access geometry data on host. | |
DeviceRef const & | device_ref () const final |
No GPU support code. | |
virtual VolumeId | find_volume (G4LogicalVolume const *volume) const=0 |
Get the volume ID corresponding to a Geant4 logical volume. | |
G4VPhysicalVolume const * | world () const |
G4VPhysicalVolume * | world () |
![]() | |
virtual | ~GeoParamsInterface ()=0 |
Default virtual destructor. | |
![]() | |
GeantGeoParamsData< Ownership::const_reference, M > const & | ref () const |
GeantGeoParamsData< Ownership::const_reference, M > const & | ref () const |
Dispatch a "ref" call to host or device data. | |
Static Public Member Functions | |
static std::shared_ptr< GeantGeoParams > | from_tracking_manager () |
Create from a running Geant4 application. | |
Additional Inherited Members | |
![]() | |
CELER_DEFAULT_COPY_MOVE (GeoParamsInterface) | |
![]() | |
CELER_DEFAULT_COPY_MOVE (ParamsDataInterface) | |
Shared Geant4 geometry model wrapper.
This can be constructed directly by loading a GDML file, or in-memory using an existing physical volume. The make_model_input
function returns the geometry hierarchy including surface definitions for optical physics.
The VolumeId
used by Celeritas is equal to the index of a G4LogicalVolume
in the G4LogicalVolumeStore
. Due to potential resetting of the geometry, the "volume instance ID" for the logical volume may be offset from this index.
Analogously, the G4VPhysicalVolume
is equivalent to the index in its store. Due to the way Geant4 represents "parameterised" and "replicated" placements, a single PV may correspond to multiple spatial placements and is disambiguated with ReplicaId
, which corresponds to the PV's "copy
number".
Each SurfaceId
maps to a G4LogicalSurface
instance, which is ether a G4LogicalBorderSurface
(an "interface" surface between two volume instances) or a G4LogicalSkinSurface
(a "boundary" surrounding a single logical volume). To ensure reproducible surface IDs across runs, we put boundaries before interfaces, and sort within each set by volume IDs (not by Geant4 object pointers, which is what the Geant4 implementation stores in a table). Surface labels are accessed via the SurfaceParams object, which can be created by the model input returned by this class.
|
explicit |
Construct from a GDML input.
This assumes that Celeritas is driving and will manage Geant4 logging and exceptions.
Outer bounding box of geometry.
Implements celeritas::GeoParamsInterface.
|
inlinefinalvirtual |
No GPU support code.
Implements celeritas::ParamsDataInterface< GeantGeoParamsData >.
|
finalvirtual |
Locate the volume ID corresponding to a Geant4 logical volume.
Implements celeritas::GeoParamsInterface.
|
virtual |
Get the volume ID corresponding to a Geant4 logical volume.
Implements celeritas::GeoParamsInterface.
VolumeInstanceId celeritas::GeantGeoParams::geant_to_id | ( | G4VPhysicalVolume const & | volume | ) | const |
Get the volume ID corresponding to a Geant4 physical volume.
BoundingBox< double > celeritas::GeantGeoParams::get_clhep_bbox | ( | ) | const |
Get the world bbox.
This assumes no transformation on the global PV.
|
inlinefinalvirtual |
Access geometry data on host.
Implements celeritas::ParamsDataInterface< GeantGeoParamsData >.
G4LogicalVolume const * celeritas::GeantGeoParams::id_to_geant | ( | VolumeId | id | ) | const |
Get the Geant4 logical volume corresponding to a volume ID.
If the input volume ID is unassigned, a null pointer will be returned.
|
finalvirtual |
Get the Geant4 physical volume corresponding to a volume instance ID.
Implements celeritas::GeoParamsInterface.
|
finalvirtual |
Create model params from a Geant4 world volume.
Implements celeritas::GeoParamsInterface.
|
inlinefinalvirtual |
Maximum nested volume instance depth.
Implements celeritas::GeoParamsInterface.
auto celeritas::GeantGeoParams::replica_id | ( | G4VPhysicalVolume const & | volume | ) | const |
Get the replica ID corresponding to a Geant4 physical volume.
If the volume is not parameterized or replicated, the result is false.
void celeritas::GeantGeoParams::reset_replica_data | ( | ) | const |
Initialize thread-local mutable copy numbers for "replica" volumes.
Copy numbers for "replica" volumes (where one instance pretends to be many different volumes) are uninitialized (older Geant4) or initialized to -1. To avoid reading invalid or returning an invalid instance, set all the replica copy numbers to zero.
|
inlinefinalvirtual |
Whether safety distance calculations are accurate and precise.
Implements celeritas::GeoParamsInterface.
|
inlinefinalvirtual |
Get volume instance metadata.
Volume instances correspond directly to Geant4 physical volumes.
Implements celeritas::GeoParamsInterface.
|
inlinefinalvirtual |
Get volume metadata.
Volumes correspond directly to Geant4 logical volumes.
Implements celeritas::GeoParamsInterface.
|
inline |
Access the world volume
|
inline |
Access the world volume