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
G4DynamicParticle.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// $Id$
28//
29//
30// ------------------------------------------------------------
31// GEANT 4 class header file
32//
33// History: first implementation, based on object model of
34// 2nd December 1995, G.Cosmo
35// ---------------- G4DynamicParticle ----------------
36// first implementation by Makoto Asai, 29 January 1996
37// revised by G.Cosmo, 29 February 1996
38// revised by Hisaya Kurashige, 24 July 1996
39// revised by Hisaya Kurashige, 19 Oct 1996
40// revised by Hisaya Kurashige, 19 Feb 1997
41// ------------------------
42// Add theDynamicCharge and theElectronOccupancy
43// 17 AUg. 1999 H.Kurashige
44// Add thePreAssignedDecayTime 18 Jan. 2001 H.Kurashige
45// Added MagneticMoment Mar. 2007
46// ------------------------------------------------------------
47
48#ifndef G4DynamicParticle_h
49#define G4DynamicParticle_h 1
50
51#include <cmath>
53
54#include "globals.hh"
55#include "G4ios.hh"
56
58#include "G4Allocator.hh"
59#include "G4LorentzVector.hh"
60
61#include "G4ParticleMomentum.hh"
62// G4ParticleMomentum is "momentum direction" not "momentum vector"
63// The name is miss-leading so you should not use G4ParticleMomentum
64// and you are recommended to use G4ThreeVector instead
65
67
68
70class G4VProcess;
71class G4DecayProducts;
72
74{
75 // Class Description
76 // The dynamic particle is a class which contains the purely
77 // dynamic aspects of a moving particle. It also has a
78 // pointer to a G4ParticleDefinition object, which holds
79 // all the static information.
80 //
81
82 public: // With Description
83 //- constructors
85
86 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
87 const G4ThreeVector& aMomentumDirection,
88 G4double aKineticEnergy);
89 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
90 const G4ThreeVector& aParticleMomentum);
91 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
92 const G4LorentzVector &aParticleMomentum);
93 G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
94 G4double aTotalEnergy,
95 const G4ThreeVector &aParticleMomentum);
96
98
99 //- destructor
101
102 //- operators
104 G4int operator==(const G4DynamicParticle &right) const;
105 G4int operator!=(const G4DynamicParticle &right) const;
106
107 // new/delete operators are oberloded to use G4Allocator
108 inline void *operator new(size_t);
109 inline void operator delete(void *aDynamicParticle);
110
111 //- Set/Get methods
112
114 // Returns the normalized direction of the momentum
115 void SetMomentumDirection(const G4ThreeVector &aDirection);
116 // Sets the normalized direction of the momentum
118 // Sets the normalized direction of the momentum by coordinates
119
121 // Returns the current particle momentum vector
122 void SetMomentum( const G4ThreeVector &momentum);
123 // set the current particle momentum vector
124
126 // Returns the current particle energy-momentum 4vector
127 void Set4Momentum( const G4LorentzVector &momentum);
128 // Set the current particle energy-momentum 4vector
129
130
132 // Returns the module of the momentum vector
134 // Returns the total energy of the particle
135
137 // Returns the kinetic energy of a particle
139 // Sets the kinetic energy of a particle
140
141
143 // Returns the current particle proper time
145 // Set the current particle Proper Time
146
147
150 // Set/Get polarization vector
151
152
154 void SetMass(G4double mass);
155 // set/get dynamical mass
156 // the dynamical mass is set to PDG mass in default
157
158
160 void SetCharge(G4double charge);
161 void SetCharge(G4int chargeInUnitOfEplus);
162 // set/get dynamical charge
163 // the dynamical mass is set to PDG charge in default
164
166 void SetSpin(G4double spin);
167 void SetSpin(G4int spinInUnitOfHalfInteger);
168 // set/get dynamical spin
169 // the dynamical spin is set to PDG spin in default
170
172 void SetMagneticMoment(G4double magneticMoment);
173 // set/get dynamical MagneticMoment
174 // the dynamical mass is set to PDG MagneticMoment in default
175
176
178 // Get electron occupancy
179 // ElectronOccupancy is valid only if the particle is ion
182 void AddElectron(G4int orbit, G4int number = 1);
183 void RemoveElectron(G4int orbit, G4int number = 1);
184
185
187 void SetDefinition(const G4ParticleDefinition * aParticleDefinition);
188 // Set/Get particle definition
189 // following method of GetDefinition remains
190 // because of backward compatiblity. It will be removed in future
192
193
196 // Set/Get pre-assigned decay channel
197
200 // Set/Get pre-assigned proper time when the particle will decay
201
202
203 //- print out information
204 void DumpInfo(G4int mode= 0) const;
205 // mode 0 : default )(minimum)
206 // mode 1 : 0 + electron occupancy
207
208 protected:
211
212 protected:
214 // The normalized momentum vector
215
217 // Contains the static information of this particle.
218
220
222
224
226
228
230
232
234
236
238
239 protected:
241
242 public: // With Description
245 // Set/Get controle flag for output message
246 // 0: Silent
247 // 1: Warning message
248 // 2: More
249
250 protected:
252 // This void pointer is used by G4EventManager to maintain the
253 // link between pre-assigned decay products and corresponding
254 // primary particle.
255
256 public:
259
260 public: // With Description
262 // Return the pointer to the corresponding G4PrimaryParticle object
263 // if this particle is a primary particle OR is defined as a pre-assigned
264 // decay product. Otherwise return null.
265
267 // Return the PDG code of this particle. If the particle is known to Geant4
268 // its PDG code defined in G4ParticleDefinition is returned. If it is unknown
269 // (i.e. PDG code in G4ParticleDefinition is 0), PDG code defined in the
270 // corresponding primary particle or pre-assigned decay product will be
271 // returned if available. Otherwise (e.g. for geantino) returns 0.
272
273 protected:
275};
276
277#include "G4DynamicParticle.icc"
278
279#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4int GetTotalOccupancy() const
G4double GetMass() const
void SetPreAssignedDecayProducts(G4DecayProducts *aDecayProducts)
G4double thePreAssignedDecayTime
G4ThreeVector thePolarization
void SetCharge(G4double charge)
void SetMomentumDirection(const G4ThreeVector &aDirection)
void DumpInfo(G4int mode=0) const
G4int GetOccupancy(G4int orbit) const
void SetPDGcode(G4int c)
const G4ThreeVector & GetMomentumDirection() const
void SetProperTime(G4double)
G4PrimaryParticle * GetPrimaryParticle() const
G4double GetSpin() const
G4double GetCharge() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetSpin(G4int spinInUnitOfHalfInteger)
void SetMagneticMoment(G4double magneticMoment)
const G4ParticleDefinition * theParticleDefinition
G4int operator==(const G4DynamicParticle &right) const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void SetMass(G4double mass)
const G4DecayProducts * GetPreAssignedDecayProducts() const
void SetCharge(G4int chargeInUnitOfEplus)
G4int operator!=(const G4DynamicParticle &right) const
const G4ParticleDefinition * GetParticleDefinition() const
G4ParticleDefinition * GetDefinition() const
void SetSpin(G4double spin)
void SetMomentumDirection(G4double px, G4double py, G4double pz)
G4LorentzVector Get4Momentum() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4ElectronOccupancy * theElectronOccupancy
void Set4Momentum(const G4LorentzVector &momentum)
void SetMomentum(const G4ThreeVector &momentum)
G4int GetVerboseLevel() const
G4DecayProducts * thePreAssignedDecayProducts
G4double GetProperTime() const
void SetPrimaryParticle(G4PrimaryParticle *p)
G4double theDynamicalMagneticMoment
G4ThreeVector theMomentumDirection
G4ThreeVector GetMomentum() const
void SetPreAssignedDecayProperTime(G4double)
G4DynamicParticle & operator=(const G4DynamicParticle &right)
G4double GetPreAssignedDecayProperTime() const
G4double GetMagneticMoment() const
G4double GetTotalMomentum() const
void AddElectron(G4int orbit, G4int number=1)
G4double GetElectronMass() const
const G4ThreeVector & GetPolarization() const
void RemoveElectron(G4int orbit, G4int number=1)
void SetKineticEnergy(G4double aEnergy)
G4int GetPDGcode() const
const G4ElectronOccupancy * GetElectronOccupancy() const
G4PrimaryParticle * primaryParticle
void SetVerboseLevel(G4int value)