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

#include <G4CascadParticle.hh>

Public Member Functions

 G4CascadParticle ()
 
 G4CascadParticle (const G4InuclElementaryParticle &particle, const G4ThreeVector &pos, G4int izone, G4double cpath, G4int gen)
 
 ~G4CascadParticle ()
 
 G4CascadParticle (const G4CascadParticle &cpart)
 
G4CascadParticleoperator= (const G4CascadParticle &cpart)
 
void fill (const G4InuclElementaryParticle &particle, const G4ThreeVector &pos, G4int izone, G4double cpath, G4int gen)
 
const G4InuclElementaryParticlegetParticle () const
 
G4InuclElementaryParticlegetParticle ()
 
G4int getGeneration () const
 
void setGeneration (G4int gen)
 
G4int getHistoryId () const
 
void setHistoryId (G4int id)
 
G4LorentzVector getMomentum () const
 
void updateParticleMomentum (const G4LorentzVector &mom)
 
const G4ThreeVectorgetPosition () const
 
void updatePosition (const G4ThreeVector &pos)
 
void incrementReflectionCounter ()
 
G4int getNumberOfReflections () const
 
void resetReflection ()
 
G4bool reflectedNow () const
 
void initializePath (G4double npath)
 
void incrementCurrentPath (G4double npath)
 
G4double getCurrentPath () const
 
void updateZone (G4int izone)
 
G4int getCurrentZone () const
 
void setMovingInsideNuclei (G4bool isMovingIn=true)
 
G4bool movingInsideNuclei () const
 
G4double getPathToTheNextZone (G4double rz_in, G4double rz_out)
 
void propagateAlongThePath (G4double path)
 
G4bool young (G4double young_path_cut, G4double cpath) const
 
void print (std::ostream &os) const
 

Detailed Description

Definition at line 49 of file G4CascadParticle.hh.

Constructor & Destructor Documentation

◆ G4CascadParticle() [1/3]

G4CascadParticle::G4CascadParticle ( )

Definition at line 46 of file G4CascadParticle.cc.

47 : verboseLevel(G4CascadeParameters::verbose()),
48 current_zone(-1), current_path(-1.), movingIn(false),
49 reflectionCounter(0), reflected(false), generation(-1), historyId(-1) {
50 if (verboseLevel > 3) {
51 G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
52 }
53}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

◆ G4CascadParticle() [2/3]

G4CascadParticle::G4CascadParticle ( const G4InuclElementaryParticle & particle,
const G4ThreeVector & pos,
G4int izone,
G4double cpath,
G4int gen )

Definition at line 55 of file G4CascadParticle.cc.

59 : verboseLevel(G4CascadeParameters::verbose()),
60 theParticle(particle), position(pos),
61 current_zone(izone), current_path(cpath), movingIn(true),
62 reflectionCounter(0), reflected(false), generation(gen), historyId(-1) {
63 if (verboseLevel > 3) {
64 G4cout << " >>> G4CascadParticle::G4CascadParticle "
65 << particle.getDefinition()->GetParticleName()
66 << " @ " << pos << G4endl;
67 }
68}
const G4ParticleDefinition * getDefinition() const
const G4String & GetParticleName() const

◆ ~G4CascadParticle()

G4CascadParticle::~G4CascadParticle ( )
inline

Definition at line 59 of file G4CascadParticle.hh.

59{;} // No subclasses allowed

◆ G4CascadParticle() [3/3]

G4CascadParticle::G4CascadParticle ( const G4CascadParticle & cpart)
inline

Definition at line 63 of file G4CascadParticle.hh.

63{ *this = cpart; }

Member Function Documentation

◆ fill()

void G4CascadParticle::fill ( const G4InuclElementaryParticle & particle,
const G4ThreeVector & pos,
G4int izone,
G4double cpath,
G4int gen )

Definition at line 91 of file G4CascadParticle.cc.

93 {
94 if (verboseLevel > 3) G4cout << " >>> G4CascadParticle::fill" << G4endl;
95
96 theParticle = particle;
97 position = pos;
98 current_zone = izone;
99 current_path = cpath;
100 movingIn = true;
101 reflectionCounter = 0;
102 reflected = false;
103 generation = gen;
104 historyId = -1; // New particle, no history entry yet
105}

◆ getCurrentPath()

G4double G4CascadParticle::getCurrentPath ( ) const
inline

Definition at line 104 of file G4CascadParticle.hh.

104{ return current_path; }

◆ getCurrentZone()

◆ getGeneration()

G4int G4CascadParticle::getGeneration ( ) const
inline

◆ getHistoryId()

G4int G4CascadParticle::getHistoryId ( ) const
inline

Definition at line 79 of file G4CascadParticle.hh.

79{ return historyId; }

Referenced by G4CascadeHistory::AddEntry(), G4CascadeHistory::AssignHistoryID(), and G4CascadeHistory::DropEntry().

◆ getMomentum()

G4LorentzVector G4CascadParticle::getMomentum ( ) const
inline

◆ getNumberOfReflections()

G4int G4CascadParticle::getNumberOfReflections ( ) const
inline

Definition at line 97 of file G4CascadParticle.hh.

97{ return reflectionCounter; }

Referenced by G4IntraNucleiCascader::generateCascade().

◆ getParticle() [1/2]

G4InuclElementaryParticle & G4CascadParticle::getParticle ( )
inline

Definition at line 74 of file G4CascadParticle.hh.

74{ return theParticle; }

◆ getParticle() [2/2]

◆ getPathToTheNextZone()

G4double G4CascadParticle::getPathToTheNextZone ( G4double rz_in,
G4double rz_out )

Definition at line 108 of file G4CascadParticle.cc.

109 {
110 if (verboseLevel > 3) {
111 G4cout << " >>> G4CascadParticle::getPathToTheNextZone rz_in " << rz_in
112 << " rz_out " << rz_out << G4endl;
113 }
114
115 const G4LorentzVector& mom = getMomentum();
116
117 G4double path = -1.0;
118 G4double rp = mom.vect().dot(position);
119 G4double rr = position.mag2();
120 G4double pp = mom.vect().mag2();
121
122 if (std::abs(pp) < 1e-9) { // Cut-off for "at rest" is 1 eV momentum
123 if (verboseLevel > 3) G4cout << " at rest; path length is zero" << G4endl;
124
125 if (current_zone == 0) movingIn = false; // Allow 'stuck' to escape
126 return 0.;
127 }
128
129 G4double ra = rr - rp * rp / pp;
130 pp = std::sqrt(pp);
131 G4double ds;
132 G4double d2;
133
134 if (verboseLevel > 3) {
135 G4cout << " current_zone " << current_zone << " rr " << rr
136 << " rp " << rp << " pp " << pp << " ra " << ra << G4endl;
137 }
138
139 if (current_zone == 0 || rp > 0.0) {
140 d2 = rz_out * rz_out - ra;
141 if (d2 > 0.0) {
142 ds = 1.0;
143 movingIn = false;
144 } else {
145 d2 = rz_in * rz_in - ra;
146 ds = -1.0;
147 movingIn = true;
148 }
149 } else {
150 d2 = rz_in * rz_in - ra;
151 if (d2 > 0.0) {
152 ds = -1.0;
153 movingIn = true;
154 } else {
155 d2 = rz_out * rz_out - ra;
156 ds = 1.0;
157 movingIn = false;
158 }
159 }
160
161 if (verboseLevel > 3) G4cout << " ds " << ds << " d2 " << d2 << G4endl;
162
163 if (d2 < 0.0 && d2 > -1e-6) d2 = 0.; // Account for round-off
164
165 if (d2 > 0.0) path = ds * std::sqrt(d2) - rp / pp; // Avoid FPE failure
166
167 return path;
168}
double G4double
Definition G4Types.hh:83
double mag2() const
double dot(const Hep3Vector &) const
Hep3Vector vect() const
G4LorentzVector getMomentum() const

Referenced by G4NucleiModel::generateInteractionPartners().

◆ getPosition()

◆ incrementCurrentPath()

void G4CascadParticle::incrementCurrentPath ( G4double npath)
inline

Definition at line 103 of file G4CascadParticle.hh.

103{ current_path += npath; }

Referenced by G4NucleiModel::generateParticleFate().

◆ incrementReflectionCounter()

void G4CascadParticle::incrementReflectionCounter ( )
inline

Definition at line 93 of file G4CascadParticle.hh.

93 {
94 reflectionCounter++;
95 reflected = true;
96 }

Referenced by G4NucleiModel::boundaryTransition().

◆ initializePath()

void G4CascadParticle::initializePath ( G4double npath)
inline

Definition at line 102 of file G4CascadParticle.hh.

102{ current_path = npath; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ movingInsideNuclei()

G4bool G4CascadParticle::movingInsideNuclei ( ) const
inline

Definition at line 110 of file G4CascadParticle.hh.

110{ return movingIn; }

Referenced by G4NucleiModel::boundaryTransition().

◆ operator=()

G4CascadParticle & G4CascadParticle::operator= ( const G4CascadParticle & cpart)

Definition at line 72 of file G4CascadParticle.cc.

72 {
73 if (&cpart != this) { // Avoid unnecessary work
74 verboseLevel = cpart.verboseLevel;
75 theParticle = cpart.theParticle;
76 position = cpart.position;
77 current_zone = cpart.current_zone;
78 current_path = cpart.current_path;
79 movingIn = cpart.movingIn;
80 reflectionCounter = cpart.reflectionCounter;
81 reflected = cpart.reflected;
82 generation = cpart.generation;
83 historyId = cpart.historyId;
84 }
85
86 return *this;
87}

◆ print()

void G4CascadParticle::print ( std::ostream & os) const

Definition at line 186 of file G4CascadParticle.cc.

186 {
187 os << " pos " << position << " zone " << current_zone
188 << " current_path " << current_path
189 << " reflectionCounter " << reflectionCounter << G4endl
190 << theParticle << G4endl;
191}

Referenced by operator<<().

◆ propagateAlongThePath()

void G4CascadParticle::propagateAlongThePath ( G4double path)

Definition at line 170 of file G4CascadParticle.cc.

170 {
171 if (verboseLevel > 3) {
172 G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
173 }
174
175 position += getMomentum().vect().unit()*path;
176}
Hep3Vector unit() const

Referenced by G4NucleiModel::generateParticleFate().

◆ reflectedNow()

G4bool G4CascadParticle::reflectedNow ( ) const
inline

Definition at line 100 of file G4CascadParticle.hh.

100{ return reflected; }

Referenced by G4NucleiModel::worthToPropagate().

◆ resetReflection()

void G4CascadParticle::resetReflection ( )
inline

Definition at line 99 of file G4CascadParticle.hh.

99{ reflected = false; }

Referenced by G4NucleiModel::boundaryTransition().

◆ setGeneration()

void G4CascadParticle::setGeneration ( G4int gen)
inline

Definition at line 77 of file G4CascadParticle.hh.

77{ generation = gen; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ setHistoryId()

void G4CascadParticle::setHistoryId ( G4int id)
inline

Definition at line 80 of file G4CascadParticle.hh.

80{ historyId = id; }

Referenced by G4CascadeHistory::AssignHistoryID().

◆ setMovingInsideNuclei()

void G4CascadParticle::setMovingInsideNuclei ( G4bool isMovingIn = true)
inline

Definition at line 109 of file G4CascadParticle.hh.

109{ movingIn = isMovingIn; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ updateParticleMomentum()

void G4CascadParticle::updateParticleMomentum ( const G4LorentzVector & mom)
inline

Definition at line 86 of file G4CascadParticle.hh.

86 {
87 theParticle.setMomentum(mom);
88 }
void setMomentum(const G4LorentzVector &mom)

Referenced by G4NucleiModel::boundaryTransition().

◆ updatePosition()

void G4CascadParticle::updatePosition ( const G4ThreeVector & pos)
inline

◆ updateZone()

void G4CascadParticle::updateZone ( G4int izone)
inline

◆ young()

G4bool G4CascadParticle::young ( G4double young_path_cut,
G4double cpath ) const
inline

Definition at line 115 of file G4CascadParticle.hh.

115 {
116 return ((current_path < 1000.) && (cpath < young_path_cut));
117 }

Referenced by G4NucleiModel::generateInteractionLength().


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