Geant4 11.1.1
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;
57
59
61{
63
64 public:
65
66 // Only one type of constructor can be used for G4ParticleDefinition.
67 // If you want to create new particle, you must set name of the particle
68 // at construction. Most of members seen as arguments of the constructor
69 // (except last 3 arguments concerning with decay ) are "constant"
70 // and can not be changed later. (No "SET" methods are available)
71 // Each type of particle must be constructed as a unique object
72 // of special class derived from G4ParticleDefinition.
73 // See G4ParticleTypes for detail
74
75 G4ParticleDefinition(const G4String& aName,
76 G4double mass,
77 G4double width,
78 G4double charge,
79 G4int iSpin,
80 G4int iParity,
81 G4int iConjugation,
82 G4int iIsospin,
83 G4int iIsospinZ,
84 G4int gParity,
85 const G4String& pType,
86 G4int lepton,
87 G4int baryon,
89 G4bool stable,
90 G4double lifetime,
91 G4DecayTable* decaytable,
92 G4bool shortlived = false,
93 const G4String& subType = "",
94 G4int anti_encoding = 0,
95 G4double magneticMoment = 0.0);
96
97 virtual ~G4ParticleDefinition();
98
101 // Can not use "copy constructor", equality nor "default constructor"!
102
103 G4bool operator==(const G4ParticleDefinition& right) const;
104 G4bool operator!=(const G4ParticleDefinition& right) const;
105
106 // With the following Getxxxx methods, one can get values
107 // for members which can not be changed
108
109 const G4String& GetParticleName() const { return theParticleName; }
110
111 G4double GetPDGMass() const { return thePDGMass; }
112 G4double GetPDGWidth() const { return thePDGWidth; }
113 G4double GetPDGCharge() const { return thePDGCharge; }
114
115 G4double GetPDGSpin() const { return thePDGSpin; }
116 G4int GetPDGiSpin() const { return thePDGiSpin; }
117 G4int GetPDGiParity() const { return thePDGiParity; }
118 G4int GetPDGiConjugation() const { return thePDGiConjugation; }
119 G4double GetPDGIsospin() const { return thePDGIsospin; }
120 G4double GetPDGIsospin3() const { return thePDGIsospin3; }
121 G4int GetPDGiIsospin() const { return thePDGiIsospin; }
122 G4int GetPDGiIsospin3() const { return thePDGiIsospin3; }
123 G4int GetPDGiGParity() const { return thePDGiGParity; }
124
125 G4double GetPDGMagneticMoment() const { return thePDGMagneticMoment; }
126 inline void SetPDGMagneticMoment(G4double mageticMoment);
128 // Gives the anomaly of magnetic moment for spin 1/2 particles
129
130 const G4String& GetParticleType() const { return theParticleType; }
131 const G4String& GetParticleSubType() const { return theParticleSubType; }
132 G4int GetLeptonNumber() const { return theLeptonNumber; }
133 G4int GetBaryonNumber() const { return theBaryonNumber; }
134
135 G4int GetPDGEncoding() const { return thePDGEncoding; }
136 G4int GetAntiPDGEncoding() const { return theAntiPDGEncoding; }
137 inline void SetAntiPDGEncoding(G4int aEncoding);
138
139 inline G4int GetQuarkContent(G4int flavor) const;
140 inline G4int GetAntiQuarkContent(G4int flavor) const;
141 // Returns the number of quark with flavor contained in this particle.
142 // The value of flavor is assigned as follows
143 // 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
144
145 G4bool IsShortLived() const { return fShortLivedFlag; }
146
147 inline G4bool GetPDGStable() const;
148 void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
149
150 inline G4double GetPDGLifeTime() const;
151 void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime=aLifeTime; }
152
153 inline G4double GetIonLifeTime() const;
154 // Get life time of a generic ion through G4NuclideTable.
155
157 inline void SetDecayTable(G4DecayTable* aDecayTable);
158 // Set/Get Decay Table
159 // !! Decay Table can be modified !!
160
162 void SetProcessManager(G4ProcessManager* aProcessManager);
163 // Set/Get Process Manager
164 // !! Process Manager can be modified !!
165
167 void SetTrackingManager(G4VTrackingManager* aTrackingManager);
168 // Set/Get Tracking Manager; nullptr means the default
169 // !! Tracking Manager can be modified !!
170
172 // Get pointer to the particle table
173
174 inline G4int GetAtomicNumber() const;
175 inline G4int GetAtomicMass() const;
176 // Get AtomicNumber and AtomicMass
177 // These properties are defined for nucleus
178
179 void DumpTable() const;
180 // Prints information of data members.
181
182 inline void SetVerboseLevel(G4int value);
183 inline G4int GetVerboseLevel() const;
184 // Control flag for output message
185 // 0: Silent
186 // 1: Warning message
187 // 2: More
188
190 inline G4bool GetApplyCutsFlag() const;
191
192 inline G4bool IsGeneralIon() const;
193 // True only if the particle is G4Ions
194 // (it means that theProcessManager is same as one for G4GenricIon)
195
196 inline G4bool IsMuonicAtom() const;
197 // True only if the particle is a G4MuonicAtom
198 // (it means that theProcessManager is same as the one for G4MuonicAtom)
199
201 // Returns the process manager master pointer.
203 // Sets the shadow master pointer (not to be used by user)
204
205 inline G4int GetInstanceID() const;
206 // Returns the instance ID
207
208 static const G4PDefManager& GetSubInstanceManager();
209 // Returns the private data instance manager
210
211 static void Clean();
212 // Clear memory allocated by sub-instance manager
213
214 void SetParticleDefinitionID(G4int id=-1);
216
217 inline G4bool IsHypernucleus() const;
221 // The first two methods return "false" and 0, respectively,
222 // if the particle is not an hypernucleus; else, they return
223 // "true" and the number of Lambdas bound in the nucleus.
224 // Similarly, the last two methods return "false" and 0,
225 // respectively, if the particle is not an anti-hypernucleus;
226 // else, they return "true" and the number of anti-Lambdas
227 // bound in the anti-nucleus.
228 // Notice that, for the time being, we are assuming that
229 // (anti-)Lambda is the only type of (anti-)hyperon present
230 // in all (anti-)hypernuclei.
231
232 protected:
233
235 // Cannot be used
236
238 // Calculates quark and anti-quark contents
239 // return value is the PDG encoding for this particle.
240 // It means error if the return value is different from
241 // this->thePDGEncoding.
242
243 inline void SetParticleSubType(const G4String& subtype);
244
245 inline void SetAtomicNumber(G4int);
246 inline void SetAtomicMass(G4int);
247
249
252 // the number of quark (minus Sign means anti-quark) contents
253 // The value of flavor is assigned as follows
254 // 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
255
256 protected:
257
260
261 private:
262
263 // --- Shadow of master pointers
264
265 G4ProcessManager* theProcessManagerShadow = nullptr;
266 // Each worker thread can access this field from the master thread
267 // through this pointer.
268
269 G4int g4particleDefinitionInstanceID = 0;
270 // This field is used as instance ID.
271
272 G4PART_DLL static G4PDefManager subInstanceManager;
273 // This field helps to use the class G4PDefManager introduced above.
274
275 // --- Following values can not be changed
276 // --- i.e. No Setxxxx Methods for them
277
278 G4String theParticleName = "";
279 // The name of the particle.
280 // Each object must have its specific name!!
281
282 // --- Following member values must be defined with Units
283
284 G4double thePDGMass = 0.0;
285 // The mass of the particle, in units of equivalent energy.
286
287 G4double thePDGWidth = 0.0;
288 // The decay width of the particle, usually the width of a
289 // Breit-Wigner function, assuming that you are near the
290 // mass center anyway. (in units of equivalent energy)
291
292 G4double thePDGCharge = 0.0;
293 // The charge of the particle.(in units of Coulomb)
294
295 // --- Following members are quantum number
296 // i.e. discrete numbers can be allowed
297 // So, you can define them only by using integer in constructor
298
299 G4int thePDGiSpin = 0;
300 // The total spin of the particle, also often denoted as
301 // capital J, in units of 1/2.
302 G4double thePDGSpin = 0.0;
303 // The total spin of the particle, in units of 1.
304
305 G4int thePDGiParity = 0;
306 // The parity quantum number, in units of 1. If the parity
307 // is not defined for this particle, we will set this to 0.
308
309 G4int thePDGiConjugation = 0;
310 // This charge conjugation quantum number in units of 1.
311
312 G4int thePDGiGParity = 0;
313 // The value of the G-parity quantum number.
314
315 G4int thePDGiIsospin = 0;
316 G4int thePDGiIsospin3 = 0;
317 // The isospin and its 3rd-component in units of 1/2.
318 G4double thePDGIsospin = 0.0;
319 G4double thePDGIsospin3 = 0.0;
320 // The isospin quantum number in units of 1.
321
322 G4double thePDGMagneticMoment = 0.0;
323 // The magnetic moment.
324
325 G4int theLeptonNumber = 0;
326 // The lepton quantum number.
327
328 G4int theBaryonNumber = 0;
329 // The baryon quantum number.
330
331 G4String theParticleType = "";
332 // More general textual type description of the particle.
333
334 G4String theParticleSubType = "";
335 // Textual type description of the particle
336 // eg. pion, lamda etc.
337
338 G4int thePDGEncoding = 0;
339 // The Particle Data Group integer identifier of this particle
340
341 G4int theAntiPDGEncoding = 0;
342 // The Particle Data Group integer identifier of the anti-particle
343
344 // --- Following members can be changed after construction
345
346 G4bool fShortLivedFlag = false;
347 // Particles which have true value of this flag
348 // will not be tracked by TrackingManager
349
350 G4bool thePDGStable = false;
351 // Is an indicator that this particle is stable. It must
352 // not decay. If the user tries to assign a kind of decay
353 // object to it, it will refuse to take it.
354
355 G4double thePDGLifeTime = 0.0;
356 // Is related to the decay width of the particle. The mean
357 // life time is given in seconds.
358
359 G4DecayTable* theDecayTable = nullptr;
360 // Points DecayTable
361
362 G4ParticleTable* theParticleTable = nullptr;
363
364 G4int theAtomicNumber = 0;
365 G4int theAtomicMass = 0;
366
367 G4int verboseLevel = 1;
368 G4bool fApplyCutsFlag = false;
369};
370
371#include "G4ParticleDefinition.icc"
372
373#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
G4VTrackingManager * GetTrackingManager() 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)
void SetTrackingManager(G4VTrackingManager *aTrackingManager)
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
G4int GetNumberOfLambdasInHypernucleus() const
G4bool IsHypernucleus() const
G4DecayTable * GetDecayTable() const
G4bool IsAntiHypernucleus() 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
G4int GetNumberOfAntiLambdasInAntiHypernucleus() 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