File indexing completed on 2025-01-18 09:57:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 #ifndef G4AdjointSteppingAction_hh
0053 #define G4AdjointSteppingAction_hh 1
0054
0055 #include "G4ThreeVector.hh"
0056 #include "G4UserSteppingAction.hh"
0057 #include "globals.hh"
0058
0059 class G4AdjointCrossSurfChecker;
0060 class G4ParticleDefinition;
0061
0062 class G4AdjointSteppingAction : public G4UserSteppingAction
0063 {
0064 public:
0065 G4AdjointSteppingAction();
0066 ~G4AdjointSteppingAction() override = default;
0067
0068 void UserSteppingAction(const G4Step*) override;
0069
0070 inline void SetExtSourceEMax(G4double Emax) { ext_sourceEMax = Emax; }
0071 inline void SetStartEvent(G4bool aBool) { start_event = aBool; }
0072 inline G4bool GetDidAdjParticleReachTheExtSource() { return did_adj_part_reach_ext_source; }
0073 inline G4ThreeVector GetLastMomentum() { return last_momentum; }
0074 inline G4ThreeVector GetLastPosition() { return last_pos; }
0075 inline G4double GetLastEkin() { return last_ekin; }
0076 inline G4double GetLastWeight() { return last_weight; }
0077 inline void SetPrimWeight(G4double weight) { prim_weight = weight; }
0078 inline G4ParticleDefinition* GetLastPartDef() { return last_part_def; }
0079 inline void SetUserAdjointSteppingAction(G4UserSteppingAction* anAction)
0080 {
0081 theUserAdjointSteppingAction = anAction;
0082 }
0083 inline void SetUserForwardSteppingAction(G4UserSteppingAction* anAction)
0084 {
0085 theUserFwdSteppingAction = anAction;
0086 }
0087 inline void SetAdjointTrackingMode(G4bool aBool) { is_adjoint_tracking_mode = aBool; }
0088 inline void ResetDidOneAdjPartReachExtSourceDuringEvent()
0089 {
0090 did_one_adj_part_reach_ext_source_during_event = false;
0091 }
0092 inline void SetAdjointGeantinoTrackingMode(G4bool aBool)
0093 {
0094 is_adjoint_geantino_tracking_mode = aBool;
0095 }
0096
0097 private:
0098 G4double ext_sourceEMax = 0.0;
0099 G4AdjointCrossSurfChecker* theG4AdjointCrossSurfChecker = nullptr;
0100
0101 G4ThreeVector last_momentum, last_pos;
0102 G4double last_ekin = 0.0;
0103 G4double last_weight = 0.0;
0104 G4double prim_weight = 1.0;
0105 G4ParticleDefinition* last_part_def = nullptr;
0106 G4UserSteppingAction* theUserAdjointSteppingAction = nullptr;
0107 G4UserSteppingAction* theUserFwdSteppingAction = nullptr;
0108
0109 G4bool start_event = false;
0110 G4bool did_adj_part_reach_ext_source = false;
0111 G4bool did_one_adj_part_reach_ext_source_during_event = false;
0112 G4bool is_adjoint_tracking_mode = false;
0113 G4bool is_adjoint_geantino_tracking_mode = false;
0114 };
0115
0116 #endif