G4Root Version 6.6
Loading...
Searching...
No Matches
TG4RootNavigator Class Reference

GEANT4 navigator using directly a TGeo geometry. More...

#include <TG4RootNavigator.h>

Inheritance diagram for TG4RootNavigator:

Public Member Functions

 TG4RootNavigator ()
 
 TG4RootNavigator (TG4RootDetectorConstruction *dc)
 
virtual ~TG4RootNavigator ()
 
void SetDetectorConstruction (TG4RootDetectorConstruction *dc)
 
G4NavigationHistory * GetHistory ()
 Return the navigation history.
 
virtual G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
 
virtual G4VPhysicalVolume * ResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
 
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
 
virtual void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
 
virtual G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength)
 
virtual G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength, const G4bool keepState)
 
virtual G4TouchableHandle CreateTouchableHistoryHandle () const
 
virtual G4ThreeVector GetLocalExitNormal (G4bool *valid)
 
virtual G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &point, G4bool *valid)
 
void SetG4TrackingManager (G4TrackingManager *trackingManager)
 Set current G4TrackingManager.
 
void SetGeometryRestoreFunction (std::function< Bool_t(Int_t)> restoreGeoStateFunction)
 

Protected Attributes

TGeoManager * fGeometry
 TGeo geometry manager.
 
TGeoNavigator * fNavigator
 TGeo navigator.
 
TG4RootDetectorConstructionfDetConstruction
 
Bool_t fStepEntering
 Next step is entering daughter.
 
Bool_t fStepExiting
 Next step is exiting current volume.
 
G4ThreeVector fNextPoint
 Crossing point with next boundary.
 
G4ThreeVector fSafetyOrig
 Last computed safety origin.
 
G4double fLastSafety
 Last computed safety.
 
Int_t fNzeroSteps
 Number of zero steps in ComputeStep.
 
G4TrackingManager * fG4TrackingManager
 Store pointer to G4TrackingManager.
 
std::function< Bool_t(Int_t)> fRestoreGeoStateFunction
 

Private Member Functions

G4VPhysicalVolume * SynchronizeHistory ()
 
TGeoNode * SynchronizeGeoManager ()
 

Detailed Description

GEANT4 navigator using directly a TGeo geometry.

All navigation methods requred by G4 tracking are implemented by this class by invoking the corresponding functionality of ROOT geometry modeler.

Author
A. Gheata; CERN

Definition at line 40 of file TG4RootNavigator.h.

Constructor & Destructor Documentation

◆ TG4RootNavigator() [1/2]

TG4RootNavigator::TG4RootNavigator ( )

Dummy ctor.

Definition at line 35 of file TG4RootNavigator.cxx.

◆ TG4RootNavigator() [2/2]

TG4RootNavigator::TG4RootNavigator ( TG4RootDetectorConstruction * dc)

Default ctor.

Definition at line 53 of file TG4RootNavigator.cxx.

◆ ~TG4RootNavigator()

TG4RootNavigator::~TG4RootNavigator ( )
virtual

Destructor.

Definition at line 74 of file TG4RootNavigator.cxx.

Member Function Documentation

◆ SynchronizeHistory()

G4VPhysicalVolume * TG4RootNavigator::SynchronizeHistory ( )
private

Synchronize the current navigation history according the state of TGeoManager Do the minimum possible work in case states are already (or almost) in sync. Returns current physical volume

Definition at line 299 of file TG4RootNavigator.cxx.

Referenced by LocateGlobalPointAndSetup(), and ResetHierarchyAndLocate().

◆ SynchronizeGeoManager()

TGeoNode * TG4RootNavigator::SynchronizeGeoManager ( )
private

Synchronize the current state of TGeoManager with the current navigation history. Do the minimum possible work in case states are already (or almost) in sync. Returns current logical node.

Definition at line 248 of file TG4RootNavigator.cxx.

Referenced by ResetHierarchyAndLocate().

◆ SetDetectorConstruction()

void TG4RootNavigator::SetDetectorConstruction ( TG4RootDetectorConstruction * dc)

Setter for detector construction. Root geometry manager pointer is taken from it and must be valid.

Definition at line 80 of file TG4RootNavigator.cxx.

Referenced by TG4RootDetectorConstruction::Construct(), and TG4RootNavigator().

◆ GetHistory()

G4NavigationHistory * TG4RootNavigator::GetHistory ( )
inline

Return the navigation history.

Definition at line 70 of file TG4RootNavigator.h.

Referenced by TG4RootNavMgr::PrintG4State().

◆ ComputeStep()

G4double TG4RootNavigator::ComputeStep ( const G4ThreeVector & pGlobalPoint,
const G4ThreeVector & pDirection,
const G4double pCurrentProposedStepLength,
G4double & pNewSafety )
virtual

Calculate the distance to the next boundary intersected along the specified NORMALISED vector direction and from the specified point in the global coordinate system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume must have been called with the same global point prior to this call. The isotropic distance to the nearest boundary is also calculated (usually an underestimate). The current proposed Step length is used to avoid intersection calculations: if it can be determined that the nearest boundary is >pCurrentProposedStepLength away, kInfinity is returned together with the computed isotropic safety distance. Geometry must be closed.

Definition at line 97 of file TG4RootNavigator.cxx.

◆ ResetHierarchyAndLocate()

G4VPhysicalVolume * TG4RootNavigator::ResetHierarchyAndLocate ( const G4ThreeVector & point,
const G4ThreeVector & direction,
const G4TouchableHistory & h )
virtual

Resets the geometrical hierarchy and search for the volumes deepest in the hierarchy containing the point in the global coordinate space. The direction is used to check if a volume is entered. The search begin is the geometrical hierarchy at the location of the last located point, or the endpoint of the previous Step if SetGeometricallyLimitedStep() has been called immediately before.

Important Note: In order to call this the geometry MUST be closed.

In case of TGeo-based geometry all volumes look as normal positioned, so there is no need to reset the hierarchy. The state of TGeo needs however to be synchronized.

Definition at line 213 of file TG4RootNavigator.cxx.

◆ LocateGlobalPointAndSetup()

G4VPhysicalVolume * TG4RootNavigator::LocateGlobalPointAndSetup ( const G4ThreeVector & point,
const G4ThreeVector * direction = 0,
const G4bool pRelativeSearch = true,
const G4bool ignoreDirection = true )
virtual

Locate the point in the hierarchy return 0 if outside The direction is required

  • if on an edge shared by more than two surfaces (to resolve likely looping in tracking)
  • at initial location of a particle (to resolve potential ambiguity at boundary)

Flags on exit: (comments to be completed) fEntering - True if entering ‘daughter’ volume (or replica) whether daughter of last mother directly or daughter of that volume's ancestor.

Definition at line 342 of file TG4RootNavigator.cxx.

Referenced by TG4RootNavMgr::LocateGlobalPointAndSetup().

◆ LocateGlobalPointWithinVolume()

void TG4RootNavigator::LocateGlobalPointWithinVolume ( const G4ThreeVector & position)
virtual

Notify the Navigator that a track has moved to the new Global point 'position', that is known to be within the current safety. No check is performed to ensure that it is within the volume. This method can be called instead of LocateGlobalPointAndSetup ONLY if the caller is certain that the new global point (position) is inside the same volume as the previous position. Usually this can be guaranteed only if the point is within safety. fLastLocatedPointLocal = ComputeLocalPoint(pGlobalPoint); G4cout << "LocateGlobalPointWithinVolume: POINT: " << pGlobalPoint << G4endl;

Definition at line 433 of file TG4RootNavigator.cxx.

◆ ComputeSafety() [1/2]

G4double TG4RootNavigator::ComputeSafety ( const G4ThreeVector & globalpoint,
const G4double pProposedMaxLength )
virtual

Calculate the isotropic distance to the nearest boundary from the specified point in the global coordinate system. The globalpoint utilised must be within the current volume. The value returned is usually an underestimate. The proposed maximum length is used to avoid volume safety calculations. The geometry must be closed.

TO CHANGE TGeoManager::Safety To take into account pProposedMaxLength fEnteredDaughter = kFALSE; fExitedMother = kFALSE; fStepEntering = kFALSE; fStepExiting = kFALSE;

Definition at line 468 of file TG4RootNavigator.cxx.

Referenced by ComputeSafety().

◆ ComputeSafety() [2/2]

G4double TG4RootNavigator::ComputeSafety ( const G4ThreeVector & globalpoint,
const G4double pProposedMaxLength,
const G4bool keepState )
virtual

Compute safety and keep state on demand.

Definition at line 459 of file TG4RootNavigator.cxx.

◆ CreateTouchableHistoryHandle()

G4TouchableHandle TG4RootNavigator::CreateTouchableHistoryHandle ( ) const
virtual

Returns a reference counted handle to a touchable history.

Definition at line 515 of file TG4RootNavigator.cxx.

◆ GetLocalExitNormal()

G4ThreeVector TG4RootNavigator::GetLocalExitNormal ( G4bool * valid)
virtual

Returns Exit Surface Normal and validity too. It can only be called if the Navigator's last Step has crossed a volume geometrical boundary. It returns the Normal to the surface pointing out of the volume that was left behind and/or into the volume that was entered. (The normal is in the coordinate system of the final volume.) This function takes full care about how to calculate this normal, but if the surfaces are not convex it will return valid=false.

Definition at line 522 of file TG4RootNavigator.cxx.

◆ GetGlobalExitNormal()

G4ThreeVector TG4RootNavigator::GetGlobalExitNormal ( const G4ThreeVector & point,
G4bool * valid )
virtual

Definition at line 551 of file TG4RootNavigator.cxx.

◆ SetG4TrackingManager()

void TG4RootNavigator::SetG4TrackingManager ( G4TrackingManager * trackingManager)

Set current G4TrackingManager.

Definition at line 583 of file TG4RootNavigator.cxx.

Referenced by TG4RootNavMgr::SetG4TrackingManager().

◆ SetGeometryRestoreFunction()

void TG4RootNavigator::SetGeometryRestoreFunction ( std::function< Bool_t(Int_t)> restoreGeoStateFunction)

Store and call the given function to request the restoring of the geometry status. Returns true if the geometry was restored, otherwise the node has to be found manually.

Definition at line 589 of file TG4RootNavigator.cxx.

Referenced by TG4RootNavMgr::SetGeometryRestoreFunction().

Member Data Documentation

◆ fGeometry

TGeoManager* TG4RootNavigator::fGeometry
protected

TGeo geometry manager.

Definition at line 44 of file TG4RootNavigator.h.

Referenced by SetDetectorConstruction().

◆ fNavigator

◆ fDetConstruction

TG4RootDetectorConstruction* TG4RootNavigator::fDetConstruction
protected

G4Root detector construction

Definition at line 46 of file TG4RootNavigator.h.

Referenced by SetDetectorConstruction(), SynchronizeGeoManager(), and SynchronizeHistory().

◆ fStepEntering

Bool_t TG4RootNavigator::fStepEntering
protected

Next step is entering daughter.

Definition at line 49 of file TG4RootNavigator.h.

Referenced by ComputeStep(), LocateGlobalPointAndSetup(), LocateGlobalPointWithinVolume(), and ResetHierarchyAndLocate().

◆ fStepExiting

Bool_t TG4RootNavigator::fStepExiting
protected

Next step is exiting current volume.

Definition at line 50 of file TG4RootNavigator.h.

Referenced by ComputeStep(), LocateGlobalPointAndSetup(), LocateGlobalPointWithinVolume(), and ResetHierarchyAndLocate().

◆ fNextPoint

G4ThreeVector TG4RootNavigator::fNextPoint
protected

Crossing point with next boundary.

Definition at line 51 of file TG4RootNavigator.h.

Referenced by ComputeSafety(), ComputeStep(), and LocateGlobalPointAndSetup().

◆ fSafetyOrig

G4ThreeVector TG4RootNavigator::fSafetyOrig
protected

Last computed safety origin.

Definition at line 52 of file TG4RootNavigator.h.

Referenced by ComputeSafety(), ComputeStep(), and TG4RootNavigator().

◆ fLastSafety

G4double TG4RootNavigator::fLastSafety
protected

Last computed safety.

Definition at line 53 of file TG4RootNavigator.h.

Referenced by ComputeSafety(), and ComputeStep().

◆ fNzeroSteps

Int_t TG4RootNavigator::fNzeroSteps
protected

Number of zero steps in ComputeStep.

Definition at line 54 of file TG4RootNavigator.h.

Referenced by ComputeStep().

◆ fG4TrackingManager

G4TrackingManager* TG4RootNavigator::fG4TrackingManager
protected

Store pointer to G4TrackingManager.

Definition at line 55 of file TG4RootNavigator.h.

Referenced by LocateGlobalPointAndSetup(), and SetG4TrackingManager().

◆ fRestoreGeoStateFunction

std::function<Bool_t(Int_t)> TG4RootNavigator::fRestoreGeoStateFunction
protected

Function pointer to restore geometry

Definition at line 56 of file TG4RootNavigator.h.

Referenced by LocateGlobalPointAndSetup(), and SetGeometryRestoreFunction().


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