Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleDefinition.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// G4ParticleDefinition
27//
28// Class description:
29//
30// This class contains all the static data of a particle.
31// It uses the process manager in order to collect all the processes
32// this kind of particle can undertake.
33
34// Authors: G.Cosmo, 2 December 1995 - Design, based on object model
35// M.Asai, 29 January 1996 - First implementation
36// History:
37// - 1996-2003, H.Kurashige - Revisions
38// - 11.03.2003, H.Kurashige - Restructuring for Cuts per Region
39// - 25.01.2013, G.Cosmo, A.Dotti - Introduced thread-safety for MT
40// - 15.06.2017, K.L.Genser - Added support for MuonicAtom
41// --------------------------------------------------------------------
42#ifndef G4ParticleDefinition_hh
43#define G4ParticleDefinition_hh 1
44
45#include <vector>
47
48#include "globals.hh"
49#include "G4ios.hh"
50#include "G4PDefManager.hh"
51
53class G4DecayTable;
54class G4ParticleTable;
56
58
60{
62
63 public:
64
65 // Only one type of constructor can be used for G4ParticleDefinition.
66 // If you want to create new particle, you must set name of the particle
67 // at construction. Most of members seen as arguments of the constructor
68 // (except last 3 arguments concerning with decay ) are "constant"
69 // and can not be changed later. (No "SET" methods are available)
70 // Each type of particle must be constructed as a unique object
71 // of special class derived from G4ParticleDefinition.
72 // See G4ParticleTypes for detail
73
74 G4ParticleDefinition(const G4String& aName,
75 G4double mass,
76 G4double width,
77 G4double charge,
78 G4int iSpin,
79 G4int iParity,
80 G4int iConjugation,
81 G4int iIsospin,
82 G4int iIsospinZ,
83 G4int gParity,
84 const G4String& pType,
85 G4int lepton,
86 G4int baryon,
88 G4bool stable,
89 G4double lifetime,
90 G4DecayTable* decaytable,
91 G4bool shortlived = false,
92 const G4String& subType = "",
93 G4int anti_encoding = 0,
94 G4double magneticMoment = 0.0);
95
96 virtual ~G4ParticleDefinition();
97
100 // Can not use "copy constructor", equality nor "default constructor"!
101
102 G4bool operator==(const G4ParticleDefinition& right) const;
103 G4bool operator!=(const G4ParticleDefinition& right) const;
104
105 // With the following Getxxxx methods, one can get values
106 // for members which can not be changed
107
108 const G4String& GetParticleName() const { return theParticleName; }
109
110 G4double GetPDGMass() const { return thePDGMass; }
111 G4double GetPDGWidth() const { return thePDGWidth; }
112 G4double GetPDGCharge() const { return thePDGCharge; }
113
114 G4double GetPDGSpin() const { return thePDGSpin; }
115 G4int GetPDGiSpin() const { return thePDGiSpin; }
116 G4int GetPDGiParity() const { return thePDGiParity; }
117 G4int GetPDGiConjugation() const { return thePDGiConjugation; }
118 G4double GetPDGIsospin() const { return thePDGIsospin; }
119 G4double GetPDGIsospin3() const { return thePDGIsospin3; }
120 G4int GetPDGiIsospin() const { return thePDGiIsospin; }
121 G4int GetPDGiIsospin3() const { return thePDGiIsospin3; }
122 G4int GetPDGiGParity() const { return thePDGiGParity; }
123
124 G4double GetPDGMagneticMoment() const { return thePDGMagneticMoment; }
125 inline void SetPDGMagneticMoment(G4double mageticMoment);
127 // Gives the anomaly of magnetic moment for spin 1/2 particles
128
129 const G4String& GetParticleType() const { return theParticleType; }
130 const G4String& GetParticleSubType() const { return theParticleSubType; }
131 G4int GetLeptonNumber() const { return theLeptonNumber; }
132 G4int GetBaryonNumber() const { return theBaryonNumber; }
133
134 G4int GetPDGEncoding() const { return thePDGEncoding; }
135 G4int GetAntiPDGEncoding() const { return theAntiPDGEncoding; }
136 inline void SetAntiPDGEncoding(G4int aEncoding);
137
138 inline G4int GetQuarkContent(G4int flavor) const;
139 inline G4int GetAntiQuarkContent(G4int flavor) const;
140 // Returns the number of quark with flavor contained in this particle.
141 // The value of flavor is assigned as follows
142 // 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
143
144 G4bool IsShortLived() const { return fShortLivedFlag; }
145
146 inline G4bool GetPDGStable() const;
147 void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
148
149 inline G4double GetPDGLifeTime() const;
150 void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime=aLifeTime; }
151
152 inline G4double GetIonLifeTime() const;
153 // Get life time of a generic ion through G4NuclideTable.
154
156 inline void SetDecayTable(G4DecayTable* aDecayTable);
157 // Set/Get Decay Table
158 // !! Decay Table can be modified !!
159
161 void SetProcessManager(G4ProcessManager* aProcessManager);
162 // Set/Get Process Manager
163 // !! Process Manager can be modified !!
164
166 // Get pointer to the particle table
167
168 inline G4int GetAtomicNumber() const;
169 inline G4int GetAtomicMass() const;
170 // Get AtomicNumber and AtomicMass
171 // These properties are defined for nucleus
172
173 void DumpTable() const;
174 // Prints information of data members.
175
176 inline void SetVerboseLevel(G4int value);
177 inline G4int GetVerboseLevel() const;
178 // Control flag for output message
179 // 0: Silent
180 // 1: Warning message
181 // 2: More
182
184 inline G4bool GetApplyCutsFlag() const;
185
186 inline G4bool IsGeneralIon() const;
187 // True only if the particle is G4Ions
188 // (it means that theProcessManager is same as one for G4GenricIon)
189
190 inline G4bool IsMuonicAtom() const;
191 // True only if the particle is a G4MuonicAtom
192 // (it means that theProcessManager is same as the one for G4MuonicAtom)
193
195 // Returns the process manager master pointer.
197 // Sets the shadow master pointer (not to be used by user)
198
199 inline G4int GetInstanceID() const;
200 // Returns the instance ID
201
202 static const G4PDefManager& GetSubInstanceManager();
203 // Returns the private data instance manager
204
205 static void Clean();
206 // Clear memory allocated by sub-instance manager
207
208 void SetParticleDefinitionID(G4int id=-1);
210
211 protected:
212
214 // Cannot be used
215
217 // Calculates quark and anti-quark contents
218 // return value is the PDG encoding for this particle.
219 // It means error if the return value is different from
220 // this->thePDGEncoding.
221
222 inline void SetParticleSubType(const G4String& subtype);
223
224 inline void SetAtomicNumber(G4int);
225 inline void SetAtomicMass(G4int);
226
228
231 // the number of quark (minus Sign means anti-quark) contents
232 // The value of flavor is assigned as follows
233 // 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
234
235 protected:
236
239
240 private:
241
242 // --- Shadow of master pointers
243
244 G4ProcessManager* theProcessManagerShadow = nullptr;
245 // Each worker thread can access this field from the master thread
246 // through this pointer.
247
248 G4int g4particleDefinitionInstanceID = 0;
249 // This field is used as instance ID.
250
251 G4PART_DLL static G4PDefManager subInstanceManager;
252 // This field helps to use the class G4PDefManager introduced above.
253
254 // --- Following values can not be changed
255 // --- i.e. No Setxxxx Methods for them
256
257 G4String theParticleName = "";
258 // The name of the particle.
259 // Each object must have its specific name!!
260
261 // --- Following member values must be defined with Units
262
263 G4double thePDGMass = 0.0;
264 // The mass of the particle, in units of equivalent energy.
265
266 G4double thePDGWidth = 0.0;
267 // The decay width of the particle, usually the width of a
268 // Breit-Wigner function, assuming that you are near the
269 // mass center anyway. (in units of equivalent energy)
270
271 G4double thePDGCharge = 0.0;
272 // The charge of the particle.(in units of Coulomb)
273
274 // --- Following members are quantum number
275 // i.e. discrete numbers can be allowed
276 // So, you can define them only by using integer in constructor
277
278 G4int thePDGiSpin = 0;
279 // The total spin of the particle, also often denoted as
280 // capital J, in units of 1/2.
281 G4double thePDGSpin = 0.0;
282 // The total spin of the particle, in units of 1.
283
284 G4int thePDGiParity = 0;
285 // The parity quantum number, in units of 1. If the parity
286 // is not defined for this particle, we will set this to 0.
287
288 G4int thePDGiConjugation = 0;
289 // This charge conjugation quantum number in units of 1.
290
291 G4int thePDGiGParity = 0;
292 // The value of the G-parity quantum number.
293
294 G4int thePDGiIsospin = 0;
295 G4int thePDGiIsospin3 = 0;
296 // The isospin and its 3rd-component in units of 1/2.
297 G4double thePDGIsospin = 0.0;
298 G4double thePDGIsospin3 = 0.0;
299 // The isospin quantum number in units of 1.
300
301 G4double thePDGMagneticMoment = 0.0;
302 // The magnetic moment.
303
304 G4int theLeptonNumber = 0;
305 // The lepton quantum number.
306
307 G4int theBaryonNumber = 0;
308 // The baryon quantum number.
309
310 G4String theParticleType = "";
311 // More general textual type description of the particle.
312
313 G4String theParticleSubType = "";
314 // Textual type description of the particle
315 // eg. pion, lamda etc.
316
317 G4int thePDGEncoding = 0;
318 // The Particle Data Group integer identifier of this particle
319
320 G4int theAntiPDGEncoding = 0;
321 // The Particle Data Group integer identifier of the anti-particle
322
323 // --- Following members can be changed after construction
324
325 G4bool fShortLivedFlag = false;
326 // Particles which have true value of this flag
327 // will not be tracked by TrackingManager
328
329 G4bool thePDGStable = false;
330 // Is an indicator that this particle is stable. It must
331 // not decay. If the user tries to assign a kind of decay
332 // object to it, it will refuse to take it.
333
334 G4double thePDGLifeTime = 0.0;
335 // Is related to the decay width of the particle. The mean
336 // life time is given in seconds.
337
338 G4DecayTable* theDecayTable = nullptr;
339 // Points DecayTable
340
341 G4ParticleTable* theParticleTable = nullptr;
342
343 G4int theAtomicNumber = 0;
344 G4int theAtomicMass = 0;
345
346 G4int verboseLevel = 1;
347 G4bool fApplyCutsFlag = false;
348};
349
350#include "G4ParticleDefinition.icc"
351
352#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4int GetInstanceID() const
G4double GetPDGMagneticMoment() const
G4ProcessManager * GetProcessManager() const
G4bool GetPDGStable() const
G4double GetPDGIsospin() const
void SetMasterProcessManager(G4ProcessManager *aNewPM)
G4int GetAtomicNumber() const
static const G4PDefManager & GetSubInstanceManager()
G4bool IsGeneralIon() const
G4ParticleDefinition(const G4ParticleDefinition &)=delete
const G4String & GetParticleType() const
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4int GetVerboseLevel() const
void SetPDGMagneticMoment(G4double mageticMoment)
void SetParticleDefinitionID(G4int id=-1)
G4ProcessManager * GetMasterProcessManager() const
G4int GetAtomicMass() const
G4bool IsMuonicAtom() const
void SetPDGStable(const G4bool aFlag)
G4int GetQuarkContent(G4int flavor) const
void SetVerboseLevel(G4int value)
G4double GetPDGWidth() const
void SetParticleSubType(const G4String &subtype)
G4double GetPDGCharge() const
void SetPDGLifeTime(G4double aLifeTime)
G4bool operator==(const G4ParticleDefinition &right) const
G4DecayTable * GetDecayTable() const
G4int theQuarkContent[NumberOfQuarkFlavor]
void SetAtomicMass(G4int)
G4double GetIonLifeTime() const
G4bool operator!=(const G4ParticleDefinition &right) const
G4ParticleTable * GetParticleTable() const
void SetAntiPDGEncoding(G4int aEncoding)
void SetDecayTable(G4DecayTable *aDecayTable)
G4double CalculateAnomaly() const
G4double GetPDGLifeTime() const
G4bool GetApplyCutsFlag() const
G4int GetParticleDefinitionID() const
G4ParticleDefinition & operator=(const G4ParticleDefinition &)=delete
const G4String & GetParticleName() const
G4double GetPDGIsospin3() const
void SetProcessManager(G4ProcessManager *aProcessManager)
void SetAtomicNumber(G4int)
const G4String & GetParticleSubType() const
G4int GetAntiQuarkContent(G4int flavor) const
#define G4PART_DLL
Definition: pwdefs.hh:45