Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointSteppingAction.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4AdjointSteppingAction
27//
28// Class description:
29//
30// Stepping action used in the adjoint simulation.
31// It is responsible to stop the adjoint tracking phase when:
32// a) The adjoint track reaches the external surface.
33// b) The being tracked adjoint dynamic particle get an energy higher than
34// the maximum energy of the external source.
35// c) The adjoint track enters the volume delimited by the adjoint source.
36// In the case a) the info (energy,weight,...) of the adjoint dynamic particle
37// associated to the track when crossing the external source is registered and
38// in the next event a forward primary is generated.
39// In the other cases b) and c) the next generated fwd particle is killed
40// before being tracked and the next tracking of an adjoint particle is
41// started directly.
42
43// Author: L. Desorgher, SpaceIT GmbH
44// Contract: ESA contract 21435/08/NL/AT
45// Customer: ESA/ESTEC
46// History:
47// - 15/01/2007 L.Desorgher, created.
48// - 04/11/2009 L.Desorgher, added possibility to use user stepping action.
49// - 20/11/2009 L.Desorgher, corrected stop of adjoint particles tracking
50// when reentering the adjoint source.
51//---------------------------------------------------------------------
52#ifndef G4AdjointSteppingAction_hh
53#define G4AdjointSteppingAction_hh 1
54
56#include "globals.hh"
57#include "G4ThreeVector.hh"
58
61
63{
64 public:
65
68
69 void UserSteppingAction(const G4Step*);
70
71 inline void SetExtSourceEMax(G4double Emax)
72 { ext_sourceEMax = Emax; }
73 inline void SetStartEvent(G4bool aBool)
74 { start_event = aBool; }
76 { return did_adj_part_reach_ext_source; }
78 { return last_momentum; }
80 { return last_pos; }
82 { return last_ekin; }
84 { return last_weight; }
85 inline void SetPrimWeight(G4double weight)
86 { prim_weight = weight; }
88 { return last_part_def; }
90 { theUserAdjointSteppingAction = anAction; }
92 { theUserFwdSteppingAction = anAction; }
93 inline void SetAdjointTrackingMode(G4bool aBool)
94 { is_adjoint_tracking_mode = aBool; }
96 { did_one_adj_part_reach_ext_source_during_event = false; }
98 { is_adjoint_geantino_tracking_mode = aBool; }
99
100 private:
101
102 G4double ext_sourceEMax = 0.0;
103 G4AdjointCrossSurfChecker* theG4AdjointCrossSurfChecker = nullptr;
104
105 G4ThreeVector last_momentum, last_pos;
106 G4double last_ekin = 0.0;
107 G4double last_weight = 0.0;
108 G4double prim_weight = 1.0;
109 G4ParticleDefinition* last_part_def = nullptr;
110 G4UserSteppingAction* theUserAdjointSteppingAction = nullptr;
111 G4UserSteppingAction* theUserFwdSteppingAction = nullptr;
112
113 G4bool start_event = false;
114 G4bool did_adj_part_reach_ext_source = false;
115 G4bool did_one_adj_part_reach_ext_source_during_event = false;
116 G4bool is_adjoint_tracking_mode = false;
117 G4bool is_adjoint_geantino_tracking_mode = false;
118};
119
120#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
void SetAdjointTrackingMode(G4bool aBool)
G4ParticleDefinition * GetLastPartDef()
void SetUserForwardSteppingAction(G4UserSteppingAction *anAction)
void SetAdjointGeantinoTrackingMode(G4bool aBool)
void SetExtSourceEMax(G4double Emax)
void UserSteppingAction(const G4Step *)
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)
void SetPrimWeight(G4double weight)
Definition: G4Step.hh:62