Geant4 10.7.0
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 ()
 
void UserSteppingAction (const G4Step *)
 
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 ()
 
virtual void SetSteppingManagerPointer (G4SteppingManager *pValue)
 
virtual void UserSteppingAction (const G4Step *)
 

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 41 of file G4AdjointSteppingAction.cc.

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

◆ ~G4AdjointSteppingAction()

G4AdjointSteppingAction::~G4AdjointSteppingAction ( )

Definition at line 48 of file G4AdjointSteppingAction.cc.

49{
50}

Member Function Documentation

◆ GetDidAdjParticleReachTheExtSource()

G4bool G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource ( )
inline

Definition at line 75 of file G4AdjointSteppingAction.hh.

76 { 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 95 of file G4AdjointSteppingAction.hh.

96 { did_one_adj_part_reach_ext_source_during_event = false; }

Referenced by G4AdjointSimManager::ResetDidOneAdjPartReachExtSourceDuringEvent().

◆ SetAdjointGeantinoTrackingMode()

void G4AdjointSteppingAction::SetAdjointGeantinoTrackingMode ( G4bool  aBool)
inline

Definition at line 97 of file G4AdjointSteppingAction.hh.

98 { is_adjoint_geantino_tracking_mode = aBool; }

◆ SetAdjointTrackingMode()

void G4AdjointSteppingAction::SetAdjointTrackingMode ( G4bool  aBool)
inline

Definition at line 93 of file G4AdjointSteppingAction.hh.

94 { is_adjoint_tracking_mode = aBool; }

Referenced by G4AdjointTrackingAction::PreUserTrackingAction().

◆ SetExtSourceEMax()

void G4AdjointSteppingAction::SetExtSourceEMax ( G4double  Emax)
inline

Definition at line 71 of file G4AdjointSteppingAction.hh.

72 { ext_sourceEMax = Emax; }

Referenced by G4AdjointSimManager::SetExtSourceEmax().

◆ SetPrimWeight()

void G4AdjointSteppingAction::SetPrimWeight ( G4double  weight)
inline

◆ SetStartEvent()

void G4AdjointSteppingAction::SetStartEvent ( G4bool  aBool)
inline

Definition at line 73 of file G4AdjointSteppingAction.hh.

74 { start_event = aBool; }

◆ SetUserAdjointSteppingAction()

void G4AdjointSteppingAction::SetUserAdjointSteppingAction ( G4UserSteppingAction anAction)
inline

Definition at line 89 of file G4AdjointSteppingAction.hh.

90 { theUserAdjointSteppingAction = anAction; }

Referenced by G4AdjointSimManager::SetAdjointSteppingAction().

◆ SetUserForwardSteppingAction()

void G4AdjointSteppingAction::SetUserForwardSteppingAction ( G4UserSteppingAction anAction)
inline

Definition at line 91 of file G4AdjointSteppingAction.hh.

92 { theUserFwdSteppingAction = anAction; }

◆ UserSteppingAction()

void G4AdjointSteppingAction::UserSteppingAction ( const G4Step aStep)
virtual

Reimplemented from G4UserSteppingAction.

Definition at line 54 of file G4AdjointSteppingAction.cc.

55{
56 G4Track* aTrack = aStep->GetTrack();
57 if(!is_adjoint_tracking_mode) // forward tracking mode
58 {
59 if (!did_one_adj_part_reach_ext_source_during_event)
60 {
62 return;
63 }
64 if(theUserFwdSteppingAction)
65 {
66 theUserFwdSteppingAction->UserSteppingAction(aStep);
67 }
68 return;
69 }
70
71 // Apply first the user adjoint stepping action
72 // --------------------------------------------
73
74 did_adj_part_reach_ext_source = false;
75 if (theUserAdjointSteppingAction)
76 {
77 theUserAdjointSteppingAction->UserSteppingAction(aStep);
78 }
79
80 G4double nb_nuc = 1.;
81 G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
82
83 if (thePartDef->GetParticleType() == "adjoint_nucleus")
84 {
85 nb_nuc = G4double(thePartDef->GetBaryonNumber());
86 }
87
88 // Kill conditions for adjoint particles reaching the maximum energy
89 // -----------------------------------------------------------------
90
91 if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc)
92 {
94 did_adj_part_reach_ext_source = false;
95 return;
96 }
97
98 // Kill conditions for surface crossing
99 // --------------------------------------
100
101 G4String surface_name;
102 G4double cos_to_surface;
103 G4bool GoingIn;
104 G4ThreeVector crossing_pos;
105 if (theG4AdjointCrossSurfChecker
106 ->CrossingOneOfTheRegisteredSurface(aStep, surface_name,
107 crossing_pos, cos_to_surface, GoingIn))
108 {
109 if (surface_name == "ExternalSource")
110 {
111 // Registering still needed
112 did_adj_part_reach_ext_source = true;
113 did_one_adj_part_reach_ext_source_during_event = true;
115
116 // now register the adjoint particles reaching the external surface
117 last_momentum = aTrack->GetMomentum();
118 last_ekin = aTrack->GetKineticEnergy();
119 last_weight = aTrack->GetWeight();
120 last_part_def = aTrack->GetDefinition();
121 last_pos = crossing_pos;
122 return;
123 }
124 else if (surface_name == "AdjointSource" && GoingIn)
125 {
126 did_adj_part_reach_ext_source = false;
128 return;
129 }
130 }
131
132 // Check for reaching out of world
133 //
135 {
136 did_adj_part_reach_ext_source = true;
137 did_one_adj_part_reach_ext_source_during_event = true;
138 last_momentum =aTrack->GetMomentum();
139 last_ekin=aTrack->GetKineticEnergy();
140 last_weight = aTrack->GetWeight();
141 last_part_def = aTrack->GetDefinition();
142 last_pos = crossing_pos;
143 return;
144 }
145}
@ fWorldBoundary
Definition: G4StepStatus.hh:41
@ fStopAndKill
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
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: