BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Attributes
BDSNavigatorPlacements Class Reference

Extra G4Navigator to get coordinate transforms for placement world. More...

#include <BDSNavigatorPlacements.hh>

Inheritance diagram for BDSNavigatorPlacements:
Inheritance graph
Collaboration diagram for BDSNavigatorPlacements:
Collaboration graph

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.
 

Detailed Description

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.

Author
Laurie Nevay

Definition at line 49 of file BDSNavigatorPlacements.hh.

Constructor & Destructor Documentation

◆ BDSNavigatorPlacements()

BDSNavigatorPlacements::BDSNavigatorPlacements ( )

Definition at line 32 of file BDSNavigatorPlacements.cc.

◆ ~BDSNavigatorPlacements()

BDSNavigatorPlacements::~BDSNavigatorPlacements ( )

Definition at line 39 of file BDSNavigatorPlacements.cc.

Member Function Documentation

◆ AttachWorldVolumeToNavigator()

static void BDSNavigatorPlacements::AttachWorldVolumeToNavigator ( G4VPhysicalVolume *  worldPVIn)
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().

Here is the caller graph for this function:

◆ ConvertAxisToGlobal() [1/2]

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().

Here is the caller graph for this function:

◆ ConvertAxisToGlobal() [2/2]

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.

◆ ConvertToLocal()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConvertToLocalNoSetup()

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.

◆ GlobalToLocal()

const G4AffineTransform & BDSNavigatorPlacements::GlobalToLocal ( ) const
inlineprivate

Utility function to select appropriate transform.

Definition at line 92 of file BDSNavigatorPlacements.hh.

◆ InitialiseTransform()

G4bool BDSNavigatorPlacements::InitialiseTransform ( const G4ThreeVector &  globalPosition) const
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().

Here is the caller graph for this function:

◆ LocalToGlobal()

const G4AffineTransform & BDSNavigatorPlacements::LocalToGlobal ( ) const
inlineprivate

Utility function to select appropriate transform.

Definition at line 93 of file BDSNavigatorPlacements.hh.

◆ ResetNavigatorStates()

void BDSNavigatorPlacements::ResetNavigatorStates ( )
static

Definition at line 49 of file BDSNavigatorPlacements.cc.

Field Documentation

◆ globalToLocal

G4AffineTransform BDSNavigatorPlacements::globalToLocal
mutableprotected

Definition at line 83 of file BDSNavigatorPlacements.hh.

◆ localToGlobal

G4AffineTransform BDSNavigatorPlacements::localToGlobal
mutableprotected

Definition at line 84 of file BDSNavigatorPlacements.hh.

◆ navigator

G4Navigator * BDSNavigatorPlacements::navigator = new G4Navigator()
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().

◆ numberOfInstances

G4int BDSNavigatorPlacements::numberOfInstances = 0
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.

◆ worldPV

G4VPhysicalVolume * BDSNavigatorPlacements::worldPV = nullptr
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().


The documentation for this class was generated from the following files: