Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointSteppingAction Class Reference

#include <G4AdjointSteppingAction.hh>

+ Inheritance diagram for G4AdjointSteppingAction:

Public Member Functions

 G4AdjointSteppingAction ()
 
 ~G4AdjointSteppingAction () override=default
 
void UserSteppingAction (const G4Step *) override
 
void SetExtSourceEMax (G4double Emax)
 
void SetStartEvent (G4bool aBool)
 
G4bool GetDidAdjParticleReachTheExtSource ()
 
G4ThreeVector GetLastMomentum ()
 
G4ThreeVector GetLastPosition ()
 
G4double GetLastEkin ()
 
G4double GetLastWeight ()
 
void SetPrimWeight (G4double weight)
 
G4ParticleDefinitionGetLastPartDef ()
 
void SetUserAdjointSteppingAction (G4UserSteppingAction *anAction)
 
void SetUserForwardSteppingAction (G4UserSteppingAction *anAction)
 
void SetAdjointTrackingMode (G4bool aBool)
 
void ResetDidOneAdjPartReachExtSourceDuringEvent ()
 
void SetAdjointGeantinoTrackingMode (G4bool aBool)
 
- Public Member Functions inherited from G4UserSteppingAction
 G4UserSteppingAction ()
 
virtual ~G4UserSteppingAction ()=default
 
virtual void SetSteppingManagerPointer (G4SteppingManager *pValue)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserSteppingAction
G4SteppingManagerfpSteppingManager = nullptr
 

Detailed Description

Definition at line 62 of file G4AdjointSteppingAction.hh.

Constructor & Destructor Documentation

◆ G4AdjointSteppingAction()

G4AdjointSteppingAction::G4AdjointSteppingAction ( )

Definition at line 42 of file G4AdjointSteppingAction.cc.

43{
44 theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
45}
static G4AdjointCrossSurfChecker * GetInstance()

◆ ~G4AdjointSteppingAction()

G4AdjointSteppingAction::~G4AdjointSteppingAction ( )
overridedefault

Member Function Documentation

◆ GetDidAdjParticleReachTheExtSource()

G4bool G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource ( )
inline

Definition at line 72 of file G4AdjointSteppingAction.hh.

72{ return did_adj_part_reach_ext_source; }

Referenced by G4AdjointTrackingAction::PostUserTrackingAction().

◆ GetLastEkin()

G4double G4AdjointSteppingAction::GetLastEkin ( )
inline

◆ GetLastMomentum()

G4ThreeVector G4AdjointSteppingAction::GetLastMomentum ( )
inline

◆ GetLastPartDef()

G4ParticleDefinition * G4AdjointSteppingAction::GetLastPartDef ( )
inline

◆ GetLastPosition()

G4ThreeVector G4AdjointSteppingAction::GetLastPosition ( )
inline

◆ GetLastWeight()

G4double G4AdjointSteppingAction::GetLastWeight ( )
inline

◆ ResetDidOneAdjPartReachExtSourceDuringEvent()

void G4AdjointSteppingAction::ResetDidOneAdjPartReachExtSourceDuringEvent ( )
inline

Definition at line 88 of file G4AdjointSteppingAction.hh.

89 {
90 did_one_adj_part_reach_ext_source_during_event = false;
91 }

Referenced by G4AdjointSimManager::ResetDidOneAdjPartReachExtSourceDuringEvent().

◆ SetAdjointGeantinoTrackingMode()

void G4AdjointSteppingAction::SetAdjointGeantinoTrackingMode ( G4bool aBool)
inline

Definition at line 92 of file G4AdjointSteppingAction.hh.

93 {
94 is_adjoint_geantino_tracking_mode = aBool;
95 }

◆ SetAdjointTrackingMode()

void G4AdjointSteppingAction::SetAdjointTrackingMode ( G4bool aBool)
inline

Definition at line 87 of file G4AdjointSteppingAction.hh.

87{ is_adjoint_tracking_mode = aBool; }

Referenced by G4AdjointTrackingAction::PreUserTrackingAction().

◆ SetExtSourceEMax()

void G4AdjointSteppingAction::SetExtSourceEMax ( G4double Emax)
inline

Definition at line 70 of file G4AdjointSteppingAction.hh.

70{ ext_sourceEMax = Emax; }

Referenced by G4AdjointSimManager::SetExtSourceEmax().

◆ SetPrimWeight()

void G4AdjointSteppingAction::SetPrimWeight ( G4double weight)
inline

◆ SetStartEvent()

void G4AdjointSteppingAction::SetStartEvent ( G4bool aBool)
inline

Definition at line 71 of file G4AdjointSteppingAction.hh.

71{ start_event = aBool; }

◆ SetUserAdjointSteppingAction()

void G4AdjointSteppingAction::SetUserAdjointSteppingAction ( G4UserSteppingAction * anAction)
inline

Definition at line 79 of file G4AdjointSteppingAction.hh.

80 {
81 theUserAdjointSteppingAction = anAction;
82 }

Referenced by G4AdjointSimManager::SetAdjointSteppingAction().

◆ SetUserForwardSteppingAction()

void G4AdjointSteppingAction::SetUserForwardSteppingAction ( G4UserSteppingAction * anAction)
inline

Definition at line 83 of file G4AdjointSteppingAction.hh.

84 {
85 theUserFwdSteppingAction = anAction;
86 }

◆ UserSteppingAction()

void G4AdjointSteppingAction::UserSteppingAction ( const G4Step * aStep)
overridevirtual

Reimplemented from G4UserSteppingAction.

Definition at line 49 of file G4AdjointSteppingAction.cc.

50{
51 G4Track* aTrack = aStep->GetTrack();
52 if (! is_adjoint_tracking_mode) // forward tracking mode
53 {
54 if (! did_one_adj_part_reach_ext_source_during_event) {
56 return;
57 }
58 if (theUserFwdSteppingAction != nullptr) {
59 theUserFwdSteppingAction->UserSteppingAction(aStep);
60 }
61 return;
62 }
63
64 // Apply first the user adjoint stepping action
65 // --------------------------------------------
66
67 did_adj_part_reach_ext_source = false;
68 if (theUserAdjointSteppingAction != nullptr) {
69 theUserAdjointSteppingAction->UserSteppingAction(aStep);
70 }
71
72 G4double nb_nuc = 1.;
73 G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
74
75 if (thePartDef->GetParticleType() == "adjoint_nucleus") {
76 nb_nuc = G4double(thePartDef->GetBaryonNumber());
77 }
78
79 // Kill conditions for adjoint particles reaching the maximum energy
80 // -----------------------------------------------------------------
81
82 if (aTrack->GetKineticEnergy() >= ext_sourceEMax * nb_nuc) {
84 did_adj_part_reach_ext_source = false;
85 return;
86 }
87
88 // Kill conditions for surface crossing
89 // --------------------------------------
90
91 G4String surface_name;
92 G4double cos_to_surface;
93 G4bool GoingIn;
94 G4ThreeVector crossing_pos;
95 if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(
96 aStep, surface_name, crossing_pos, cos_to_surface, GoingIn))
97 {
98 if (surface_name == "ExternalSource") {
99 // Registering still needed
100 did_adj_part_reach_ext_source = true;
101 did_one_adj_part_reach_ext_source_during_event = true;
103
104 // now register the adjoint particles reaching the external surface
105 last_momentum = aTrack->GetMomentum();
106 last_ekin = aTrack->GetKineticEnergy();
107 last_weight = aTrack->GetWeight();
108 last_part_def = aTrack->GetDefinition();
109 last_pos = crossing_pos;
110 return;
111 }
112 if (surface_name == "AdjointSource" && GoingIn) {
113 did_adj_part_reach_ext_source = false;
115 return;
116 }
117 }
118
119 // Check for reaching out of world
120 //
121 if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary) {
122 did_adj_part_reach_ext_source = true;
123 did_one_adj_part_reach_ext_source_during_event = true;
124 last_momentum = aTrack->GetMomentum();
125 last_ekin = aTrack->GetKineticEnergy();
126 last_weight = aTrack->GetWeight();
127 last_part_def = aTrack->GetDefinition();
128 last_pos = crossing_pos;
129 return;
130 }
131}
@ fWorldBoundary
@ fStopAndKill
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
G4bool CrossingOneOfTheRegisteredSurface(const G4Step *aStep, G4String &surface_name, G4ThreeVector &cross_pos, G4double &cos_to_surface, G4bool &GoingIn)
const G4String & GetParticleType() const
G4StepStatus GetStepStatus() const
G4Track * GetTrack() const
G4StepPoint * GetPostStepPoint() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4double GetWeight() const
G4ThreeVector GetMomentum() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
virtual void UserSteppingAction(const G4Step *)

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