BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Extra G4Navigator to get coordinate transforms for placement world. More...
#include <BDSNavigatorPlacements.hh>
Public Member Functions | |
G4ThreeVector | ConvertToLocal (const G4ThreeVector &globalPosition, G4bool &foundAPlacementVolume) const |
G4ThreeVector | ConvertToLocalNoSetup (const G4ThreeVector &globalPosition) const |
Similar to above function but does NOT initialise the transforms. | |
G4ThreeVector | ConvertAxisToGlobal (const G4ThreeVector &localAxis) const |
std::pair< G4ThreeVector, G4ThreeVector > | ConvertAxisToGlobal (const std::pair< G4ThreeVector, G4ThreeVector > &localAxis) const |
Static Public Member Functions | |
static void | AttachWorldVolumeToNavigator (G4VPhysicalVolume *worldPVIn) |
Setup the navigator w.r.t. to a world volume - typically real world. | |
static void | ResetNavigatorStates () |
Protected Attributes | |
G4AffineTransform | globalToLocal |
G4AffineTransform | localToGlobal |
Static Protected Attributes | |
static G4Navigator * | navigator = new G4Navigator() |
Private Member Functions | |
G4bool | InitialiseTransform (const G4ThreeVector &globalPosition) const |
const G4AffineTransform & | GlobalToLocal () const |
Utility function to select appropriate transform. | |
const G4AffineTransform & | LocalToGlobal () const |
Utility function to select appropriate transform. | |
Static Private Attributes | |
static G4int | numberOfInstances = 0 |
static G4VPhysicalVolume * | worldPV = nullptr |
Cache of world PV to test if we're getting the wrong volume for the transform. | |
Extra G4Navigator to get coordinate transforms for placement world.
This class provides a simple transform to the frame of a volume found at a point in the provided world as long as it is not the world volume. No special advancing or boundary checking is done - simple yes or no.
This class provides a static auxiliary navigator that each derived class can use. Making the auxiliary navigator static is not done to reduce memory usage but because navigating from an unknown place to anywhere in the geometry is much more costly than a relative move in the geometry.
See InitialiseTransform() documentation for why we have mutable variables.
Definition at line 49 of file BDSNavigatorPlacements.hh.
BDSNavigatorPlacements::BDSNavigatorPlacements | ( | ) |
Definition at line 32 of file BDSNavigatorPlacements.cc.
BDSNavigatorPlacements::~BDSNavigatorPlacements | ( | ) |
Definition at line 39 of file BDSNavigatorPlacements.cc.
|
inlinestatic |
Setup the navigator w.r.t. to a world volume - typically real world.
Definition at line 56 of file BDSNavigatorPlacements.hh.
References navigator, and worldPV.
Referenced by BDSParallelWorldPlacementFields::Construct().
G4ThreeVector BDSNavigatorPlacements::ConvertAxisToGlobal | ( | const G4ThreeVector & | localAxis | ) | const |
Convert a vector (axis) from local to global coordinates. NOTE this function must only be used once the instance of this class has been initialised, setting up the transforms. It is up to the developer to ensure this, otherwise you'll find a bad access.
Definition at line 68 of file BDSNavigatorPlacements.cc.
Referenced by BDSFieldEGlobalPlacement::GetField(), BDSFieldEMGlobalPlacement::GetField(), and BDSFieldMagGlobalPlacement::GetField().
std::pair< G4ThreeVector, G4ThreeVector > BDSNavigatorPlacements::ConvertAxisToGlobal | ( | const std::pair< G4ThreeVector, G4ThreeVector > & | localAxis | ) | const |
Convert a vector (axis) from local to global coordinates. Note this function must only be used once the instance of this class has been initialised, setting up the transforms. It is up to the developer to ensure this. This utility function operates on two threevectors in a pair.
Definition at line 73 of file BDSNavigatorPlacements.cc.
G4ThreeVector BDSNavigatorPlacements::ConvertToLocal | ( | const G4ThreeVector & | globalPosition, |
G4bool & | foundAPlacementVolume | ||
) | const |
Locate the point and setup transforms. If the point is not in a volume that's not the world volume (i.e. a placement volume) then the bool reference variable will be set to false and a 0,0,0 3 vector returned.
Definition at line 54 of file BDSNavigatorPlacements.cc.
References InitialiseTransform().
Referenced by BDSFieldEGlobalPlacement::GetField(), BDSFieldEMGlobalPlacement::GetField(), and BDSFieldMagGlobalPlacement::GetField().
G4ThreeVector BDSNavigatorPlacements::ConvertToLocalNoSetup | ( | const G4ThreeVector & | globalPosition | ) | const |
Similar to above function but does NOT initialise the transforms.
Definition at line 63 of file BDSNavigatorPlacements.cc.
|
inlineprivate |
Utility function to select appropriate transform.
Definition at line 92 of file BDSNavigatorPlacements.hh.
|
private |
Locate the supplied point the in the geometry and get and store the transform to that volume in the member variable. This function has to be const as it's called the first time in GetField which is a pure virtual const function from G4MagneticField that we have to implement and have to keep const. This function doesn't change the const pointer but does change the contents of what it points to.
Definition at line 80 of file BDSNavigatorPlacements.cc.
References navigator, and worldPV.
Referenced by ConvertToLocal().
|
inlineprivate |
Utility function to select appropriate transform.
Definition at line 93 of file BDSNavigatorPlacements.hh.
|
static |
Definition at line 49 of file BDSNavigatorPlacements.cc.
|
mutableprotected |
Definition at line 83 of file BDSNavigatorPlacements.hh.
|
mutableprotected |
Definition at line 84 of file BDSNavigatorPlacements.hh.
|
staticprotected |
Navigator object for safe navigation in the real (mass) world without affecting tracking of the particle.
Definition at line 88 of file BDSNavigatorPlacements.hh.
Referenced by AttachWorldVolumeToNavigator(), and InitialiseTransform().
|
staticprivate |
Counter to keep track of when the last instance of the class is deleted and therefore when the navigators can be safely deleted without affecting
Definition at line 106 of file BDSNavigatorPlacements.hh.
|
staticprivate |
Cache of world PV to test if we're getting the wrong volume for the transform.
Definition at line 109 of file BDSNavigatorPlacements.hh.
Referenced by AttachWorldVolumeToNavigator(), and InitialiseTransform().