Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 50 of file G4CascadParticle.hh.

Constructor & Destructor Documentation

G4CascadParticle::G4CascadParticle ( )

Definition at line 47 of file G4CascadParticle.cc.

48  : verboseLevel(G4CascadeParameters::verbose()),
49  current_zone(-1), current_path(-1.), movingIn(false),
50  reflectionCounter(0), reflected(false), generation(-1), historyId(-1) {
51  if (verboseLevel > 3) {
52  G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
53  }
54 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4CascadParticle::G4CascadParticle ( const G4InuclElementaryParticle particle,
const G4ThreeVector pos,
G4int  izone,
G4double  cpath,
G4int  gen 
)

Definition at line 57 of file G4CascadParticle.cc.

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

Here is the call graph for this function:

G4CascadParticle::~G4CascadParticle ( )
inline

Definition at line 60 of file G4CascadParticle.hh.

60 {;} // No subclasses allowed
G4CascadParticle::G4CascadParticle ( const G4CascadParticle cpart)
inline

Definition at line 64 of file G4CascadParticle.hh.

64 { *this = cpart; }

Member Function Documentation

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

Definition at line 92 of file G4CascadParticle.cc.

94  {
95  if (verboseLevel > 3) G4cout << " >>> G4CascadParticle::fill" << G4endl;
96 
97  theParticle = particle;
98  position = pos;
99  current_zone = izone;
100  current_path = cpath;
101  movingIn = true;
102  reflectionCounter = 0;
103  reflected = false;
104  generation = gen;
105  historyId = -1; // New particle, no history entry yet
106 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static const G4double pos
G4double G4CascadParticle::getCurrentPath ( ) const
inline

Definition at line 105 of file G4CascadParticle.hh.

105 { return current_path; }
G4int G4CascadParticle::getCurrentZone ( ) const
inline

Definition at line 108 of file G4CascadParticle.hh.

108 { return current_zone; }

Here is the caller graph for this function:

G4int G4CascadParticle::getGeneration ( ) const
inline

Definition at line 77 of file G4CascadParticle.hh.

77 { return generation; }

Here is the caller graph for this function:

G4int G4CascadParticle::getHistoryId ( ) const
inline

Definition at line 80 of file G4CascadParticle.hh.

80 { return historyId; }

Here is the caller graph for this function:

G4LorentzVector G4CascadParticle::getMomentum ( ) const
inline

Definition at line 83 of file G4CascadParticle.hh.

83  { // Can't return ref; temporary
84  return theParticle.getMomentum();
85  }
G4LorentzVector getMomentum() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4int G4CascadParticle::getNumberOfReflections ( ) const
inline

Definition at line 98 of file G4CascadParticle.hh.

98 { return reflectionCounter; }

Here is the caller graph for this function:

const G4InuclElementaryParticle& G4CascadParticle::getParticle ( ) const
inline

Definition at line 74 of file G4CascadParticle.hh.

74 { return theParticle; }

Here is the caller graph for this function:

G4InuclElementaryParticle& G4CascadParticle::getParticle ( )
inline

Definition at line 75 of file G4CascadParticle.hh.

75 { return theParticle; }
G4double G4CascadParticle::getPathToTheNextZone ( G4double  rz_in,
G4double  rz_out 
)

Definition at line 109 of file G4CascadParticle.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

const G4ThreeVector& G4CascadParticle::getPosition ( ) const
inline

Definition at line 91 of file G4CascadParticle.hh.

91 { return position; }
#define position
Definition: xmlparse.cc:622

Here is the caller graph for this function:

void G4CascadParticle::incrementCurrentPath ( G4double  npath)
inline

Definition at line 104 of file G4CascadParticle.hh.

104 { current_path += npath; }

Here is the caller graph for this function:

void G4CascadParticle::incrementReflectionCounter ( )
inline

Definition at line 94 of file G4CascadParticle.hh.

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

Here is the caller graph for this function:

void G4CascadParticle::initializePath ( G4double  npath)
inline

Definition at line 103 of file G4CascadParticle.hh.

103 { current_path = npath; }

Here is the caller graph for this function:

G4bool G4CascadParticle::movingInsideNuclei ( ) const
inline

Definition at line 111 of file G4CascadParticle.hh.

111 { return movingIn; }

Here is the caller graph for this function:

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

Definition at line 73 of file G4CascadParticle.cc.

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

Definition at line 187 of file G4CascadParticle.cc.

187  {
188  os << " pos " << position << " zone " << current_zone
189  << " current_path " << current_path
190  << " reflectionCounter " << reflectionCounter << G4endl
191  << theParticle << G4endl;
192 }
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4CascadParticle::propagateAlongThePath ( G4double  path)

Definition at line 171 of file G4CascadParticle.cc.

171  {
172  if (verboseLevel > 3) {
173  G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
174  }
175 
176  position += getMomentum().vect().unit()*path;
177 }
G4LorentzVector getMomentum() const
Hep3Vector vect() const
G4GLOB_DLL std::ostream G4cout
Hep3Vector unit() const
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4CascadParticle::reflectedNow ( ) const
inline

Definition at line 101 of file G4CascadParticle.hh.

101 { return reflected; }

Here is the caller graph for this function:

void G4CascadParticle::resetReflection ( )
inline

Definition at line 100 of file G4CascadParticle.hh.

100 { reflected = false; }

Here is the caller graph for this function:

void G4CascadParticle::setGeneration ( G4int  gen)
inline

Definition at line 78 of file G4CascadParticle.hh.

78 { generation = gen; }

Here is the caller graph for this function:

void G4CascadParticle::setHistoryId ( G4int  id)
inline

Definition at line 81 of file G4CascadParticle.hh.

81 { historyId = id; }

Here is the caller graph for this function:

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

Definition at line 110 of file G4CascadParticle.hh.

110 { movingIn = isMovingIn; }

Here is the caller graph for this function:

void G4CascadParticle::updateParticleMomentum ( const G4LorentzVector mom)
inline

Definition at line 87 of file G4CascadParticle.hh.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void G4CascadParticle::updatePosition ( const G4ThreeVector pos)
inline

Definition at line 92 of file G4CascadParticle.hh.

92 { position = pos; }
static const G4double pos

Here is the caller graph for this function:

void G4CascadParticle::updateZone ( G4int  izone)
inline

Definition at line 107 of file G4CascadParticle.hh.

107 { current_zone = izone; }

Here is the caller graph for this function:

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

Definition at line 116 of file G4CascadParticle.hh.

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

Here is the caller graph for this function:


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