Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4AdjointSteppingAction Class Reference

#include <G4AdjointSteppingAction.hh>

Inheritance diagram for G4AdjointSteppingAction:
G4UserSteppingAction

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)
 
- Public Member Functions inherited from G4UserSteppingAction
 G4UserSteppingAction ()
 
virtual ~G4UserSteppingAction ()
 
void SetSteppingManagerPointer (G4SteppingManager *pValue)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserSteppingAction
G4SteppingManagerfpSteppingManager
 

Detailed Description

Definition at line 69 of file G4AdjointSteppingAction.hh.

Constructor & Destructor Documentation

G4AdjointSteppingAction::G4AdjointSteppingAction ( )

Definition at line 44 of file G4AdjointSteppingAction.cc.

References G4AdjointCrossSurfChecker::GetInstance().

45  : ext_sourceEMax(0.), start_event(false),
46  did_adj_part_reach_ext_source(false), last_ekin(0.), last_weight(0.),
47  prim_weight(0.), last_part_def(0), theUserAdjointSteppingAction(0),
48  theUserFwdSteppingAction(0)
49 {
50  theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
51 }
static G4AdjointCrossSurfChecker * GetInstance()
G4AdjointSteppingAction::~G4AdjointSteppingAction ( )

Definition at line 54 of file G4AdjointSteppingAction.cc.

55 {;}

Member Function Documentation

G4bool G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource ( )
inline

Definition at line 79 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::GetDidAdjParticleReachTheExtSource(), and G4AdjointTrackingAction::PostUserTrackingAction().

79 {return did_adj_part_reach_ext_source;}
G4double G4AdjointSteppingAction::GetLastEkin ( )
inline
G4ThreeVector G4AdjointSteppingAction::GetLastMomentum ( )
inline
G4ParticleDefinition* G4AdjointSteppingAction::GetLastPartDef ( )
inline
G4ThreeVector G4AdjointSteppingAction::GetLastPosition ( )
inline
G4double G4AdjointSteppingAction::GetLastWeight ( )
inline
void G4AdjointSteppingAction::SetAdjointTrackingMode ( G4bool  aBool)
inline

Definition at line 90 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointTrackingAction::PreUserTrackingAction().

90 {is_adjoint_tracking_mode =aBool;}
void G4AdjointSteppingAction::SetExtSourceEMax ( G4double  Emax)
inline

Definition at line 77 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::SetExtSourceEmax().

77 {ext_sourceEMax=Emax;}
void G4AdjointSteppingAction::SetPrimWeight ( G4double  weight)
inline
void G4AdjointSteppingAction::SetStartEvent ( G4bool  aBool)
inline

Definition at line 78 of file G4AdjointSteppingAction.hh.

78 {start_event =aBool;}
void G4AdjointSteppingAction::SetUserAdjointSteppingAction ( G4UserSteppingAction anAction)
inline

Definition at line 86 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::SetAdjointSteppingAction().

86  {
87  theUserAdjointSteppingAction = anAction;}
void G4AdjointSteppingAction::SetUserForwardSteppingAction ( G4UserSteppingAction anAction)
inline

Definition at line 88 of file G4AdjointSteppingAction.hh.

88  {
89  theUserFwdSteppingAction = anAction;}
void G4AdjointSteppingAction::UserSteppingAction ( const G4Step aStep)
virtual

Reimplemented from G4UserSteppingAction.

Definition at line 59 of file G4AdjointSteppingAction.cc.

References G4AdjointCrossSurfChecker::CrossingOneOfTheRegisteredSurface(), fStopAndKill, fWorldBoundary, G4ParticleDefinition::GetBaryonNumber(), G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4Track::GetMomentum(), G4ParticleDefinition::GetParticleType(), G4Step::GetPostStepPoint(), G4StepPoint::GetStepStatus(), G4Step::GetTrack(), G4Track::GetWeight(), G4Track::SetTrackStatus(), and G4UserSteppingAction::UserSteppingAction().

60 {
61  G4Track* aTrack =aStep->GetTrack();
62  //forward tracking mode
63  if(!is_adjoint_tracking_mode){
64  //check if last adjoint did reach the external source
65  if (!did_adj_part_reach_ext_source) {
67  return;
68  }
69  if(theUserFwdSteppingAction)
70  theUserFwdSteppingAction->UserSteppingAction(aStep);
71  return;
72  }
73 
74 
75  //Apply first the user adjoint stepping action
76  //---------------------------
77  if (theUserAdjointSteppingAction) theUserAdjointSteppingAction->UserSteppingAction(aStep);
78 
79 
80  G4double nb_nuc=1.;
81  G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
82 
83  if (thePartDef->GetParticleType() == "adjoint_nucleus"){
84  nb_nuc=double(thePartDef->GetBaryonNumber());
85  }
86  //Kill conditions for adjoint particles reaching the maximum energy
87  //-----------------------------------------------------------------
88  if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc){
90  did_adj_part_reach_ext_source=false;
91  return;
92  }
93 
94  G4double weight_factor = aTrack->GetWeight()/prim_weight;
95  if ( (weight_factor>0 && weight_factor<=0) || weight_factor<= 1e-290 || weight_factor>1.e200)
96  {
97  //std::cout<<"Weight_factor problem! Value = "<<weight_factor<<std::endl;
99  did_adj_part_reach_ext_source=false;
100  return;
101  }
102 
103 
104  //Kill conditions for surface crossing
105  //--------------------------------------
106 
107  G4String surface_name;
108  G4double cos_to_surface;
109  G4bool GoingIn;
110  G4ThreeVector crossing_pos;
111  if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(aStep, surface_name, crossing_pos, cos_to_surface, GoingIn) ){
112 
113  //G4cout<<"Test_step11"<<std::endl;
114  if (surface_name == "ExternalSource") {
115  //Registering still needed
116  did_adj_part_reach_ext_source=true;
117  aTrack->SetTrackStatus(fStopAndKill);
118  //now register the adjoint particles reaching the external surface
119  last_momentum =aTrack->GetMomentum();
120  last_ekin=aTrack->GetKineticEnergy();
121  last_weight = aTrack->GetWeight();
122  last_part_def = aTrack->GetDefinition();
123  last_pos = crossing_pos;
124  return;
125  }
126  else if (surface_name == "AdjointSource" && GoingIn) {
127  did_adj_part_reach_ext_source=false;
128  aTrack->SetTrackStatus(fStopAndKill);
129  return;
130  }
131  }
132  //Check for reaching out of world
133  if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary) {
134  did_adj_part_reach_ext_source=true;
135  last_momentum =aTrack->GetMomentum();
136  last_ekin=aTrack->GetKineticEnergy();
137  last_weight = aTrack->GetWeight();
138  last_part_def = aTrack->GetDefinition();
139  last_pos = crossing_pos;
140  return;
141 
142  }
143 
144 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4StepStatus GetStepStatus() const
virtual void UserSteppingAction(const G4Step *)
G4double GetKineticEnergy() const
bool G4bool
Definition: G4Types.hh:79
const G4String & GetParticleType() const
G4ThreeVector GetMomentum() const
G4bool CrossingOneOfTheRegisteredSurface(const G4Step *aStep, G4String &surface_name, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
G4StepPoint * GetPostStepPoint() const
G4double GetWeight() const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const

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