Geant4 9.6.0
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)
 
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)
 
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 47 of file G4CascadParticle.hh.

Constructor & Destructor Documentation

◆ G4CascadParticle() [1/2]

G4CascadParticle::G4CascadParticle ( )

Definition at line 43 of file G4CascadParticle.cc.

44 : verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false),
45 reflectionCounter(0), reflected(false), generation(-1) {
46 if (verboseLevel > 3) {
47 G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
48 }
49}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout

◆ G4CascadParticle() [2/2]

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

Definition at line 53 of file G4CascadParticle.hh.

56 : verboseLevel(0), theParticle(particle), position(pos),
57 current_zone(izone), current_path(cpath), movingIn(true),
58 reflectionCounter(0), reflected(false), generation(gen) {}

Member Function Documentation

◆ fill()

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

Definition at line 53 of file G4CascadParticle.cc.

55 {
56 if (verboseLevel > 3) G4cout << " >>> G4CascadParticle::fill" << G4endl;
57
58 theParticle = particle;
59 position = pos;
60 current_zone = izone;
61 current_path = cpath;
62 movingIn = true;
63 reflectionCounter = 0;
64 reflected = false;
65 generation = gen;
66}

◆ getCurrentPath()

G4double G4CascadParticle::getCurrentPath ( ) const
inline

Definition at line 93 of file G4CascadParticle.hh.

93{ return current_path; }

Referenced by G4NucleiModel::isProjectile().

◆ getCurrentZone()

G4int G4CascadParticle::getCurrentZone ( ) const
inline

◆ getGeneration()

G4int G4CascadParticle::getGeneration ( ) const
inline

Definition at line 68 of file G4CascadParticle.hh.

68{ return generation; }

Referenced by G4IntraNucleiCascader::decayTrappedParticle().

◆ getMomentum()

G4LorentzVector G4CascadParticle::getMomentum ( ) const
inline

Definition at line 71 of file G4CascadParticle.hh.

71 { // Can't return ref; temporary
72 return theParticle.getMomentum();
73 }
G4LorentzVector getMomentum() const

Referenced by getPathToTheNextZone(), and propagateAlongThePath().

◆ getNumberOfReflections()

G4int G4CascadParticle::getNumberOfReflections ( ) const
inline

Definition at line 86 of file G4CascadParticle.hh.

86{ return reflectionCounter; }

Referenced by G4IntraNucleiCascader::generateCascade(), and G4NucleiModel::isProjectile().

◆ getParticle() [1/2]

G4InuclElementaryParticle & G4CascadParticle::getParticle ( )
inline

Definition at line 66 of file G4CascadParticle.hh.

66{ return theParticle; }

◆ getParticle() [2/2]

◆ getPathToTheNextZone()

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

Definition at line 69 of file G4CascadParticle.cc.

70 {
71 if (verboseLevel > 3) {
72 G4cout << " >>> G4CascadParticle::getPathToTheNextZone rz_in " << rz_in
73 << " rz_out " << rz_out << G4endl;
74 }
75
76 const G4LorentzVector& mom = getMomentum();
77
78 G4double path = -1.0;
79 G4double rp = mom.vect().dot(position);
80 G4double rr = position.mag2();
81 G4double pp = mom.vect().mag2();
82
83 if (std::abs(pp) < 1e-9) { // Cut-off for "at rest" is 1 eV momentum
84 if (verboseLevel > 3) G4cout << " at rest; path length is zero" << G4endl;
85 return 0.;
86 }
87
88 G4double ra = rr - rp * rp / pp;
89 pp = std::sqrt(pp);
90 G4double ds;
91 G4double d2;
92
93 if (verboseLevel > 3) {
94 G4cout << " current_zone " << current_zone << " rr " << rr
95 << " rp " << rp << " pp " << pp << " ra " << ra << G4endl;
96 }
97
98 if (current_zone == 0 || rp > 0.0) {
99 d2 = rz_out * rz_out - ra;
100 if (d2 > 0.0) {
101 ds = 1.0;
102 movingIn = false;
103 } else {
104 d2 = rz_in * rz_in - ra;
105 ds = -1.0;
106 movingIn = true;
107 }
108 } else {
109 d2 = rz_in * rz_in - ra;
110 if (d2 > 0.0) {
111 ds = -1.0;
112 movingIn = true;
113 } else {
114 d2 = rz_out * rz_out - ra;
115 ds = 1.0;
116 movingIn = false;
117 }
118 }
119
120 if (verboseLevel > 3) G4cout << " ds " << ds << " d2 " << d2 << G4endl;
121
122 if (d2 < 0.0 && d2 > -1e-6) d2 = 0.; // Account for round-off
123
124 if (d2 > 0.0) path = ds * std::sqrt(d2) - rp / pp; // Avoid FPE failure
125
126 return path;
127}
double G4double
Definition: G4Types.hh:64
double mag2() const
double dot(const Hep3Vector &) const
Hep3Vector vect() const
G4LorentzVector getMomentum() const

◆ getPosition()

const G4ThreeVector & G4CascadParticle::getPosition ( ) const
inline

◆ incrementCurrentPath()

void G4CascadParticle::incrementCurrentPath ( G4double  npath)
inline

Definition at line 92 of file G4CascadParticle.hh.

92{ current_path += npath; }

Referenced by G4NucleiModel::generateParticleFate().

◆ incrementReflectionCounter()

void G4CascadParticle::incrementReflectionCounter ( )
inline

Definition at line 82 of file G4CascadParticle.hh.

82 {
83 reflectionCounter++;
84 reflected = true;
85 }

◆ initializePath()

void G4CascadParticle::initializePath ( G4double  npath)
inline

Definition at line 91 of file G4CascadParticle.hh.

91{ current_path = npath; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ movingInsideNuclei()

G4bool G4CascadParticle::movingInsideNuclei ( ) const
inline

Definition at line 99 of file G4CascadParticle.hh.

99{ return movingIn; }

Referenced by G4NucleiModel::isProjectile().

◆ print()

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

Definition at line 145 of file G4CascadParticle.cc.

145 {
146 os << theParticle << G4endl
147 << " zone " << current_zone << " current_path " << current_path
148 << " reflectionCounter " << reflectionCounter << G4endl
149 << " x " << position.x() << " y " << position.y()
150 << " z " << position.z() << G4endl;
151}

Referenced by operator<<().

◆ propagateAlongThePath()

void G4CascadParticle::propagateAlongThePath ( G4double  path)

Definition at line 129 of file G4CascadParticle.cc.

129 {
130 if (verboseLevel > 3) {
131 G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
132 }
133
134 position += getMomentum().vect().unit()*path;
135}
Hep3Vector unit() const

Referenced by G4NucleiModel::generateParticleFate().

◆ reflectedNow()

G4bool G4CascadParticle::reflectedNow ( ) const
inline

Definition at line 89 of file G4CascadParticle.hh.

89{ return reflected; }

Referenced by G4NucleiModel::worthToPropagate().

◆ resetReflection()

void G4CascadParticle::resetReflection ( )
inline

Definition at line 88 of file G4CascadParticle.hh.

88{ reflected = false; }

◆ setGeneration()

void G4CascadParticle::setGeneration ( G4int  gen)
inline

Definition at line 69 of file G4CascadParticle.hh.

69{ generation = gen; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ setMovingInsideNuclei()

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

Definition at line 98 of file G4CascadParticle.hh.

98{ movingIn = isMovingIn; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ updateParticleMomentum()

void G4CascadParticle::updateParticleMomentum ( const G4LorentzVector mom)
inline

Definition at line 75 of file G4CascadParticle.hh.

75 {
76 theParticle.setMomentum(mom);
77 }
void setMomentum(const G4LorentzVector &mom)

◆ updatePosition()

void G4CascadParticle::updatePosition ( const G4ThreeVector pos)
inline

◆ updateZone()

void G4CascadParticle::updateZone ( G4int  izone)
inline

Definition at line 95 of file G4CascadParticle.hh.

95{ current_zone = izone; }

Referenced by G4IntraNucleiCascader::processSecondary().

◆ young()

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

Definition at line 104 of file G4CascadParticle.hh.

104 {
105 return ((current_path < 1000.) && (cpath < young_path_cut));
106 }

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