ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4DynamicParticle.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4DynamicParticle.hh
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 //
28 //
29 // ------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // History: first implementation, based on object model of
33 // 2nd December 1995, G.Cosmo
34 // ---------------- G4DynamicParticle ----------------
35 // first implementation by Makoto Asai, 29 January 1996
36 // revised by G.Cosmo, 29 February 1996
37 // revised by Hisaya Kurashige, 24 July 1996
38 // revised by Hisaya Kurashige, 19 Oct 1996
39 // revised by Hisaya Kurashige, 19 Feb 1997
40 // ------------------------
41 // Add theDynamicCharge and theElectronOccupancy
42 // 17 AUg. 1999 H.Kurashige
43 // Add thePreAssignedDecayTime 18 Jan. 2001 H.Kurashige
44 // Added MagneticMoment Mar. 2007
45 // Added GetLogKineticEnergy: the log-kinetic energy value is computed only
46  // on demand if its stored value is not up-to-date. 15 March 2019 M. Novak
47 // ------------------------------------------------------------
48 
49 #ifndef G4DynamicParticle_h
50 #define G4DynamicParticle_h 1
51 
52 #include <cmath>
55 
56 #include "globals.hh"
57 #include "G4ios.hh"
58 
59 #include "G4ParticleDefinition.hh"
60 #include "G4Allocator.hh"
61 #include "G4LorentzVector.hh"
62 #include "G4Log.hh"
63 
64 #include "G4ParticleMomentum.hh"
65 // G4ParticleMomentum is "momentum direction" not "momentum vector"
66 // The name is miss-leading so you should not use G4ParticleMomentum
67 // and you are recommended to use G4ThreeVector instead
68 
69 #include "G4ElectronOccupancy.hh"
70 
71 class G4PrimaryParticle;
72 class G4DecayProducts;
73 
75 {
76  // Class Description
77  // The dynamic particle is a class which contains the purely
78  // dynamic aspects of a moving particle. It also has a
79  // pointer to a G4ParticleDefinition object, which holds
80  // all the static information.
81  //
82 
83  public: // With Description
84  //- constructors
86 
87  G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
88  const G4ThreeVector& aMomentumDirection,
89  G4double aKineticEnergy);
90  G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
91  const G4ThreeVector& aParticleMomentum);
92  G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
93  const G4LorentzVector &aParticleMomentum);
94  G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
95  G4double aTotalEnergy,
96  const G4ThreeVector &aParticleMomentum);
97  G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
98  const G4ThreeVector& aMomentumDirection,
99  G4double aKineticEnergy,
100  const G4double dynamicalMass);
101 
103 
104  //- destructor
106 
107  //- operators
109  G4bool operator==(const G4DynamicParticle &right) const;
110  G4bool operator!=(const G4DynamicParticle &right) const;
111 
112  // new/delete operators are oberloded to use G4Allocator
113  inline void *operator new(size_t);
114  inline void operator delete(void *aDynamicParticle);
115 
116  //- Set/Get methods
117 
118  inline const G4ThreeVector& GetMomentumDirection() const;
119  // Returns the normalized direction of the momentum
120  inline void SetMomentumDirection(const G4ThreeVector &aDirection);
121  // Sets the normalized direction of the momentum
122  inline void SetMomentumDirection(G4double px, G4double py, G4double pz);
123  // Sets the normalized direction of the momentum by coordinates
124 
125  inline G4ThreeVector GetMomentum() const;
126  // Returns the current particle momentum vector
127  void SetMomentum( const G4ThreeVector &momentum);
128  // set the current particle momentum vector
129 
130  inline G4LorentzVector Get4Momentum() const;
131  // Returns the current particle energy-momentum 4vector
132  void Set4Momentum( const G4LorentzVector &momentum);
133  // Set the current particle energy-momentum 4vector
134 
135  inline G4double GetTotalMomentum() const;
136  // Returns the module of the momentum vector
137  inline G4double GetTotalEnergy() const;
138  // Returns the total energy of the particle
139 
140  inline G4double GetKineticEnergy() const;
141  // Returns the kinetic energy of a particle
142  inline G4double GetLogKineticEnergy() const;
143  // Returns:
144  // - natural logarithm of the particle kinetic energy (E_k) if E_k > 0
145  // - LOG_EKIN_MIN otherwise
146  inline void SetKineticEnergy(G4double aEnergy);
147  // Sets the kinetic energy of a particle
148 
149  inline G4double GetProperTime() const;
150  // Returns the current particle proper time
151  inline void SetProperTime( G4double );
152  // Set the current particle Proper Time
153 
154  inline const G4ThreeVector& GetPolarization() const;
155  inline void SetPolarization(const G4ThreeVector&);
156  inline void SetPolarization(G4double polX, G4double polY, G4double polZ);
157  // Set/Get polarization vector
158 
159  inline G4double GetMass() const;
160  inline void SetMass(G4double mass);
161  // set/get dynamical mass
162  // the dynamical mass is set to PDG mass in default
163 
164  inline G4double GetCharge() const;
165  inline void SetCharge(G4double charge);
166  inline void SetCharge(G4int chargeInUnitOfEplus);
167  // set/get dynamical charge
168  // the dynamical mass is set to PDG charge in default
169 
170  inline G4double GetSpin() const;
171  inline void SetSpin(G4double spin);
172  inline void SetSpin(G4int spinInUnitOfHalfInteger);
173  // set/get dynamical spin
174  // the dynamical spin is set to PDG spin in default
175 
176  inline G4double GetMagneticMoment() const;
177  inline void SetMagneticMoment(G4double magneticMoment);
178  // set/get dynamical MagneticMoment
179  // the dynamical mass is set to PDG MagneticMoment in default
180 
181  inline const G4ElectronOccupancy* GetElectronOccupancy() const;
182  // Get electron occupancy
183  // ElectronOccupancy is valid only if the particle is ion
184  inline G4int GetTotalOccupancy() const;
185  inline G4int GetOccupancy(G4int orbit) const;
186  inline void AddElectron(G4int orbit, G4int number = 1);
187  inline void RemoveElectron(G4int orbit, G4int number = 1);
188 
189  inline const G4ParticleDefinition* GetParticleDefinition() const;
190  void SetDefinition(const G4ParticleDefinition * aParticleDefinition);
191  // Set/Get particle definition
192  // following method of GetDefinition remains
193  // because of backward compatiblity. It will be removed in future
194  inline G4ParticleDefinition* GetDefinition() const;
195 
196  inline const G4DecayProducts *GetPreAssignedDecayProducts() const;
197  inline void SetPreAssignedDecayProducts(G4DecayProducts *aDecayProducts);
198  // Set/Get pre-assigned decay channel
199 
202  // Set/Get pre-assigned proper time when the particle will decay
203 
204  //- print out information
205  void DumpInfo(G4int mode= 0) const;
206  // mode 0 : default )(minimum)
207  // mode 1 : 0 + electron occupancy
208 
209  protected:
211  G4double GetElectronMass() const;
212 
213  public: // With Description
214  inline void SetVerboseLevel(G4int value);
215  inline G4int GetVerboseLevel() const;
216  // Set/Get controle flag for output message
217  // 0: Silent
218  // 1: Warning message
219  // 2: More
220 
221  inline void SetPrimaryParticle(G4PrimaryParticle* p);
222  inline void SetPDGcode(G4int c);
223 
224  public: // With Description
225  inline G4PrimaryParticle* GetPrimaryParticle() const;
226  // Return the pointer to the corresponding G4PrimaryParticle object
227  // if this particle is a primary particle OR is defined as a pre-assigned
228  // decay product. Otherwise return null.
229 
230  inline G4int GetPDGcode() const;
231  // Return the PDG code of this particle. If the particle is known to Geant4
232  // its PDG code defined in G4ParticleDefinition is returned. If it is unknown
233  // (i.e. PDG code in G4ParticleDefinition is 0), PDG code defined in the
234  // corresponding primary particle or pre-assigned decay product will be
235  // returned if available. Otherwise (e.g. for geantino) returns 0.
236 
237  private:
238 
240  // The normalized momentum vector
241 
243 
245  // Contains the static information of this particle.
246 
248 
250 
252  // This void pointer is used by G4EventManager to maintain the
253  // link between pre-assigned decay products and corresponding
254  // primary particle.
255 
257 
259 
261 
263 
265 
267 
269 
271 
273 
275 };
276 
277 #include "G4DynamicParticle.icc"
278 
279 #endif