Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
27// 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
28// 20100126 M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
29// move ::print() to .cc file, fix uninitialized data members
30// 20100915 M. Kelsey -- Make getGeneration() const
31// 20110729 M. Kelsey -- Add initializer for _all_ data members (path, gen),
32// re-organize declarations, with set/get pairs together
33// 20110806 M. Kelsey -- Add fill() function to replicate ctor/op=() action
34// 20110922 M. Kelsey -- Add stream argument to print(), add operator<<().
35// 20120306 M. Kelsey -- Add access for cumulative path through nucleus.
36// 20130221 M. Kelsey -- Move constructor to .cc file for parameter access.
37// 20130304 M. Kelsey -- Add index data member, for use with G4CascadeHistory,
38// and explicit copy operations and destructor.
39
40#ifndef G4CASCAD_PARTICLE_HH
41#define G4CASCAD_PARTICLE_HH
42
44#include "G4LorentzVector.hh"
45#include "G4ThreeVector.hh"
46#include <iosfwd>
47
48
50
51public:
52 // NOTE: Default constructor does not make a functional object!
54
56 const G4ThreeVector& pos, G4int izone, G4double cpath,
57 G4int gen);
58
59 ~G4CascadParticle() {;} // No subclasses allowed
60
61 // Allow copying of object data (for use with history and elsewhere)
62 // NOTE: history index IS copied (to avoid double counting)
63 G4CascadParticle(const G4CascadParticle& cpart) { *this = cpart; }
65
66 // Analogue to operator=() to support filling vectors w/o temporaries
67 // NOTE: history index IS NOT copied (new particle is being made)
68 void fill(const G4InuclElementaryParticle& particle,
69 const G4ThreeVector& pos, G4int izone, G4double cpath,
70 G4int gen);
71
72 // Data accessors
73 const G4InuclElementaryParticle& getParticle() const { return theParticle; }
74 G4InuclElementaryParticle& getParticle() { return theParticle; }
75
76 G4int getGeneration() const { return generation; }
77 void setGeneration(G4int gen) { generation = gen; }
78
79 G4int getHistoryId() const { return historyId; }
80 void setHistoryId(G4int id) { historyId = id; }
81
82 G4LorentzVector getMomentum() const { // Can't return ref; temporary
83 return theParticle.getMomentum();
84 }
85
87 theParticle.setMomentum(mom);
88 }
89
90 const G4ThreeVector& getPosition() const { return position; }
91 void updatePosition(const G4ThreeVector& pos) { position = pos; }
92
94 reflectionCounter++;
95 reflected = true;
96 }
97 G4int getNumberOfReflections() const { return reflectionCounter; }
98
99 void resetReflection() { reflected = false; }
100 G4bool reflectedNow() const { return reflected; }
101
102 void initializePath(G4double npath) { current_path = npath; }
103 void incrementCurrentPath(G4double npath) { current_path += npath; }
104 G4double getCurrentPath() const { return current_path; }
105
106 void updateZone(G4int izone) { current_zone = izone; }
107 G4int getCurrentZone() const { return current_zone; }
108
109 void setMovingInsideNuclei(G4bool isMovingIn=true) { movingIn = isMovingIn; }
110 G4bool movingInsideNuclei() const { return movingIn; }
111
114
115 G4bool young(G4double young_path_cut, G4double cpath) const {
116 return ((current_path < 1000.) && (cpath < young_path_cut));
117 }
118
119 void print(std::ostream& os) const;
120
121private:
122 G4int verboseLevel;
123 G4InuclElementaryParticle theParticle;
125 G4int current_zone;
126 G4double current_path;
127 G4bool movingIn;
128 G4int reflectionCounter;
129 G4bool reflected;
130 G4int generation;
131 G4int historyId;
132};
133
134// Proper stream output (just calls print())
135
136std::ostream& operator<<(std::ostream& os, const G4CascadParticle& part);
137
138#endif // G4CASCAD_PARTICLE_HH
std::ostream & operator<<(std::ostream &os, const G4CascadParticle &part)
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4bool reflectedNow() const
G4int getHistoryId() 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
G4CascadParticle(const G4CascadParticle &cpart)
G4CascadParticle & operator=(const G4CascadParticle &cpart)
void propagateAlongThePath(G4double path)
void setMovingInsideNuclei(G4bool isMovingIn=true)
G4int getNumberOfReflections() const
void setHistoryId(G4int id)
G4LorentzVector getMomentum() const
G4bool young(G4double young_path_cut, G4double cpath) const
void initializePath(G4double npath)
void incrementReflectionCounter()
G4int getCurrentZone() const
G4double getPathToTheNextZone(G4double rz_in, G4double rz_out)
const G4ThreeVector & getPosition() const
G4LorentzVector getMomentum() const
void setMomentum(const G4LorentzVector &mom)