Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: G4CascadParticle.hh 67738 2013-03-05 05:54:30Z mkelsey $
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 // 20130221 M. Kelsey -- Move constructor to .cc file for parameter access.
38 // 20130304 M. Kelsey -- Add index data member, for use with G4CascadeHistory,
39 // and explicit copy operations and destructor.
40 
41 #ifndef G4CASCAD_PARTICLE_HH
42 #define G4CASCAD_PARTICLE_HH
43 
45 #include "G4LorentzVector.hh"
46 #include "G4ThreeVector.hh"
47 #include <iosfwd>
48 
49 
51 
52 public:
53  // NOTE: Default constructor does not make a functional object!
55 
57  const G4ThreeVector& pos, G4int izone, G4double cpath,
58  G4int gen);
59 
60  ~G4CascadParticle() {;} // No subclasses allowed
61 
62  // Allow copying of object data (for use with history and elsewhere)
63  // NOTE: history index IS copied (to avoid double counting)
64  G4CascadParticle(const G4CascadParticle& cpart) { *this = cpart; }
66 
67  // Analogue to operator=() to support filling vectors w/o temporaries
68  // NOTE: history index IS NOT copied (new particle is being made)
69  void fill(const G4InuclElementaryParticle& particle,
70  const G4ThreeVector& pos, G4int izone, G4double cpath,
71  G4int gen);
72 
73  // Data accessors
74  const G4InuclElementaryParticle& getParticle() const { return theParticle; }
75  G4InuclElementaryParticle& getParticle() { return theParticle; }
76 
77  G4int getGeneration() const { return generation; }
78  void setGeneration(G4int gen) { generation = gen; }
79 
80  G4int getHistoryId() const { return historyId; }
81  void setHistoryId(G4int id) { historyId = id; }
82 
83  G4LorentzVector getMomentum() const { // Can't return ref; temporary
84  return theParticle.getMomentum();
85  }
86 
88  theParticle.setMomentum(mom);
89  }
90 
91  const G4ThreeVector& getPosition() const { return position; }
92  void updatePosition(const G4ThreeVector& pos) { position = pos; }
93 
95  reflectionCounter++;
96  reflected = true;
97  }
98  G4int getNumberOfReflections() const { return reflectionCounter; }
99 
100  void resetReflection() { reflected = false; }
101  G4bool reflectedNow() const { return reflected; }
102 
103  void initializePath(G4double npath) { current_path = npath; }
104  void incrementCurrentPath(G4double npath) { current_path += npath; }
105  G4double getCurrentPath() const { return current_path; }
106 
107  void updateZone(G4int izone) { current_zone = izone; }
108  G4int getCurrentZone() const { return current_zone; }
109 
110  void setMovingInsideNuclei(G4bool isMovingIn=true) { movingIn = isMovingIn; }
111  G4bool movingInsideNuclei() const { return movingIn; }
112 
114  void propagateAlongThePath(G4double path);
115 
116  G4bool young(G4double young_path_cut, G4double cpath) const {
117  return ((current_path < 1000.) && (cpath < young_path_cut));
118  }
119 
120  void print(std::ostream& os) const;
121 
122 private:
123  G4int verboseLevel;
124  G4InuclElementaryParticle theParticle;
126  G4int current_zone;
127  G4double current_path;
128  G4bool movingIn;
129  G4int reflectionCounter;
130  G4bool reflected;
131  G4int generation;
132  G4int historyId;
133 };
134 
135 // Proper stream output (just calls print())
136 
137 std::ostream& operator<<(std::ostream& os, const G4CascadParticle& part);
138 
139 #endif // G4CASCAD_PARTICLE_HH
void print(std::ostream &os) const
void updateParticleMomentum(const G4LorentzVector &mom)
G4bool reflectedNow() const
G4double getCurrentPath() const
G4LorentzVector getMomentum() const
void incrementReflectionCounter()
void incrementCurrentPath(G4double npath)
G4bool movingInsideNuclei() const
G4LorentzVector getMomentum() const
G4int getGeneration() const
void initializePath(G4double npath)
void setHistoryId(G4int id)
void fill(const G4InuclElementaryParticle &particle, const G4ThreeVector &pos, G4int izone, G4double cpath, G4int gen)
void propagateAlongThePath(G4double path)
G4double getPathToTheNextZone(G4double rz_in, G4double rz_out)
void updatePosition(const G4ThreeVector &pos)
G4InuclElementaryParticle & getParticle()
G4bool young(G4double young_path_cut, G4double cpath) const
void setGeneration(G4int gen)
int G4int
Definition: G4Types.hh:78
const G4InuclElementaryParticle & getParticle() const
void updateZone(G4int izone)
bool G4bool
Definition: G4Types.hh:79
G4CascadParticle(const G4CascadParticle &cpart)
void setMovingInsideNuclei(G4bool isMovingIn=true)
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
G4int getCurrentZone() const
G4int getHistoryId() const
const G4ThreeVector & getPosition() const
void setMomentum(const G4LorentzVector &mom)
double G4double
Definition: G4Types.hh:76
G4CascadParticle & operator=(const G4CascadParticle &cpart)
G4int getNumberOfReflections() const
static const G4double pos