Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MoleculeLocator Class Referencefinal

#include <G4MoleculeLocator.hh>

Public Member Functions

 ~G4MoleculeLocator ()=default
void LocateMoleculeSetStateAndTouchable (G4Track *)
G4TouchableHandle LocateMoleculeTrack (const G4Track *)

Static Public Member Functions

static G4MoleculeLocatorInstance ()

Friends

class G4ThreadLocalSingleton< G4MoleculeLocator >

Detailed Description

Definition at line 41 of file G4MoleculeLocator.hh.

Constructor & Destructor Documentation

◆ ~G4MoleculeLocator()

G4MoleculeLocator::~G4MoleculeLocator ( )
default

Member Function Documentation

◆ Instance()

G4MoleculeLocator * G4MoleculeLocator::Instance ( )
static

Definition at line 42 of file G4MoleculeLocator.cc.

43{
44 if (fpInstance == nullptr) {
46 fpInstance = instance.Instance();
47 }
48 if (!fpInstance->fIsInitialized) {
49 fpInstance->Initialize();
50 }
51 return fpInstance;
52}
G4TemplateRNGHelper< G4long > * G4TemplateRNGHelper< G4long >::instance
friend class G4ThreadLocalSingleton< G4MoleculeLocator >

Referenced by G4Molecule::BuildTrack(), and G4ThreadLocalSingleton< G4MoleculeLocator >.

◆ LocateMoleculeSetStateAndTouchable()

void G4MoleculeLocator::LocateMoleculeSetStateAndTouchable ( G4Track * pTrack)

Definition at line 88 of file G4MoleculeLocator.cc.

89{
90 G4IT* pITrack = GetIT(pTrack);
91
92 if (pITrack == nullptr) {
93 G4Exception("G4MoleculeLocator::LocateMoleculeSetStateAndTouchable", "NOT_AN_IT", FatalErrorInArgument,
94 "The track passed to this method appears to not hold an IT (molecule) object!");
95 }
96
97 fNavigator->NewNavigatorState();
98 GetIT(pTrack)->GetTrackingInfo()->SetNavigatorState(fNavigator->GetNavigatorState());
99
100 G4ThreeVector direction = pTrack->GetMomentumDirection();
101
102 fNavigator->LocateGlobalPointAndSetup(pTrack->GetPosition(), &direction, false, false);
103
104 G4TouchableHandle touchable = fNavigator->CreateTouchableHistory();
105 pTrack->SetTouchableHandle(touchable);
106 pTrack->SetNextTouchableHandle(touchable);
107}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4IT * GetIT(const G4Track *track)
Definition G4IT.cc:48
CLHEP::Hep3Vector G4ThreeVector
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4TouchableHandle is a type providing reference counting mechanism for any kind of touchable objects....
G4TrackingInformation * GetTrackingInfo()
Definition G4IT.hh:143
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetMomentumDirection() const
void SetNavigatorState(G4ITNavigatorState_Lock *)

Referenced by G4Molecule::BuildTrack().

◆ LocateMoleculeTrack()

G4TouchableHandle G4MoleculeLocator::LocateMoleculeTrack ( const G4Track * pTrack)

Definition at line 62 of file G4MoleculeLocator.cc.

63{
64 G4IT* pITrack = GetIT(pTrack);
65
66 if (pITrack == nullptr) {
67 G4Exception("G4MoleculeLocator::LocateMoleculeSetStateAndTouchable", "NOT_AN_IT", FatalErrorInArgument,
68 "The track passed to this method appears to not hold an IT (molecule) object!");
69 }
70
71 std::unique_ptr<G4ITNavigatorState_Lock> tmpStateHolder;
72 if (pITrack->GetTrackingInfo()->GetNavigatorState() != nullptr)
73 fNavigator->SetNavigatorState(pITrack->GetTrackingInfo()->GetNavigatorState());
74 else {
75 fNavigator->NewNavigatorState();
76 tmpStateHolder = std::unique_ptr<G4ITNavigatorState_Lock>(fNavigator->GetNavigatorState());
77 // will be deleted once method goes out of scope
78 }
79
80 G4ThreeVector direction = pTrack->GetMomentumDirection();
81
82 fNavigator->LocateGlobalPointAndSetup(pTrack->GetPosition(), &direction, false, false);
83
84 G4TouchableHandle touchable = fNavigator->CreateTouchableHistory();
85 return touchable;
86}
G4ITNavigatorState_Lock * GetNavigatorState() const

◆ G4ThreadLocalSingleton< G4MoleculeLocator >

friend class G4ThreadLocalSingleton< G4MoleculeLocator >
friend

Definition at line 41 of file G4MoleculeLocator.hh.


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