Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4CascadParticle.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// $Id$
27//
28// 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
29// 20100126 M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
30// move ::print() to .cc file, fix uninitialized data members
31// 20100915 M. Kelsey -- Make getGeneration() const
32// 20110729 M. Kelsey -- Add initializer for _all_ data members (path, gen),
33// re-organize declarations, with set/get pairs together
34// 20110806 M. Kelsey -- Add fill() function to replicate ctor/op=() action
35// 20110922 M. Kelsey -- Add stream argument to print(), add operator<<().
36// 20120306 M. Kelsey -- Add access for cumulative path through nucleus.
37
38#ifndef G4CASCAD_PARTICLE_HH
39#define G4CASCAD_PARTICLE_HH
40
42#include "G4LorentzVector.hh"
43#include "G4ThreeVector.hh"
44#include <iosfwd>
45
46
48
49public:
50 // NOTE: Default constructor does not make a functional object!
52
54 const G4ThreeVector& pos, G4int izone, G4double cpath,
55 G4int gen)
56 : verboseLevel(0), theParticle(particle), position(pos),
57 current_zone(izone), current_path(cpath), movingIn(true),
58 reflectionCounter(0), reflected(false), generation(gen) {}
59
60 // Analogue to operator=() to support filling vectors w/o temporaries
61 void fill(const G4InuclElementaryParticle& particle,
62 const G4ThreeVector& pos, G4int izone, G4double cpath,
63 G4int gen);
64
65 const G4InuclElementaryParticle& getParticle() const { return theParticle; }
66 G4InuclElementaryParticle& getParticle() { return theParticle; }
67
68 G4int getGeneration() const { return generation; }
69 void setGeneration(G4int gen) { generation = gen; }
70
71 G4LorentzVector getMomentum() const { // Can't return ref; temporary
72 return theParticle.getMomentum();
73 }
74
76 theParticle.setMomentum(mom);
77 }
78
79 const G4ThreeVector& getPosition() const { return position; }
80 void updatePosition(const G4ThreeVector& pos) { position = pos; }
81
83 reflectionCounter++;
84 reflected = true;
85 }
86 G4int getNumberOfReflections() const { return reflectionCounter; }
87
88 void resetReflection() { reflected = false; }
89 G4bool reflectedNow() const { return reflected; }
90
91 void initializePath(G4double npath) { current_path = npath; }
92 void incrementCurrentPath(G4double npath) { current_path += npath; }
93 G4double getCurrentPath() const { return current_path; }
94
95 void updateZone(G4int izone) { current_zone = izone; }
96 G4int getCurrentZone() const { return current_zone; }
97
98 void setMovingInsideNuclei(G4bool isMovingIn=true) { movingIn = isMovingIn; }
99 G4bool movingInsideNuclei() const { return movingIn; }
100
103
104 G4bool young(G4double young_path_cut, G4double cpath) const {
105 return ((current_path < 1000.) && (cpath < young_path_cut));
106 }
107
108 void print(std::ostream& os) const;
109
110private:
111 G4int verboseLevel;
112 G4InuclElementaryParticle theParticle;
114 G4int current_zone;
115 G4double current_path;
116 G4bool movingIn;
117 G4int reflectionCounter;
118 G4bool reflected;
119 G4int generation;
120};
121
122// Proper stream output (just calls print())
123
124std::ostream& operator<<(std::ostream& os, const G4CascadParticle& part);
125
126#endif // G4CASCAD_PARTICLE_HH
std::ostream & operator<<(std::ostream &os, const G4CascadParticle &part)
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4bool reflectedNow() const
G4double getCurrentPath() const
void fill(const G4InuclElementaryParticle &particle, const G4ThreeVector &pos, G4int izone, G4double cpath, G4int gen)
G4int getGeneration() const
void print(std::ostream &os) const
void updateZone(G4int izone)
void incrementCurrentPath(G4double npath)
const G4InuclElementaryParticle & getParticle() const
void setGeneration(G4int gen)
void updateParticleMomentum(const G4LorentzVector &mom)
G4InuclElementaryParticle & getParticle()
void updatePosition(const G4ThreeVector &pos)
G4bool movingInsideNuclei() const
void propagateAlongThePath(G4double path)
void setMovingInsideNuclei(G4bool isMovingIn=true)
G4int getNumberOfReflections() const
G4LorentzVector getMomentum() const
G4bool young(G4double young_path_cut, G4double cpath) const
void initializePath(G4double npath)
void incrementReflectionCounter()
G4int getCurrentZone() const
G4CascadParticle(const G4InuclElementaryParticle &particle, const G4ThreeVector &pos, G4int izone, G4double cpath, G4int gen)
G4double getPathToTheNextZone(G4double rz_in, G4double rz_out)
const G4ThreeVector & getPosition() const
G4LorentzVector getMomentum() const
void setMomentum(const G4LorentzVector &mom)