Geant4_10
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 //
27 // $Id: G4ParticleDefinition.hh 73598 2013-09-02 09:18:28Z gcosmo $
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 // ---------------- G4ParticleDefinition ----------------
36 // first implementation by Makoto Asai - 29 January 1996
37 // revised - G.Cosmo - 29 February 1996
38 // revised - H.Kurashige - 19 April 1996
39 // revised - H.Kurashige - 4 July 1996
40 // added GetEnergyCuts() and GetLengthCuts() - G.Cosmo - 11 July 1996
41 // added Set/GetVerboseLevel() - H.Kurashige - 11 November 1997
42 // added SetCuts() and ResetCuts - H.Kurashige - 15 November 1996
43 // change SetProcessManager as public - H.Kurashige - 06 June 1998
44 // added GetEnergyThreshold - H.Kurashige - 08 June 1998
45 // added ShortLived flag and ApplyCuts flag - H.Kurashige - 27 June 1998
46 // fixed some improper codings - H.Kurashige - 08 April 1999
47 // added sub-type - H.Kurashige - 15 February 2000
48 // added RestoreCuts - H.Kurashige - 09 March 2001
49 // restructuring for Cuts per Region - H.Kurashige - 11 March 2003
50 // added MagneticMoment - H.Kurashige - March 2007
51 // modified for thread-safety for MT - G.Cosmo, A.Dotti - January 2013
52 // ------------------------------------------------------------
53 
54 #ifndef G4ParticleDefinition_h
55 #define G4ParticleDefinition_h 1
56 
57 #include <vector>
59 
60 #include "globals.hh"
61 #include "G4ios.hh"
62 #include "G4PDefSplitter.hh"
63 
64 class G4ProcessManager;
65 class G4DecayTable;
66 class G4ParticleTable;
68 
70 {
71  // Encapsulates the fields of the class G4ParticleDefinition
72  // that may not be read-only.
73 
74  public:
75 
76  void initialize()
77  {
78  theProcessManager = 0;
79  }
80 
82 };
83 
84 // The type G4PDefManager is introduced to encapsulate the methods used by
85 // both the master thread and worker threads to allocate memory space for
86 // the fields encapsulated by the class G4PDefData. When each thread
87 // changes the value for these fields, it refers to them using a macro
88 // definition defined below. For every G4ParticleDefinition instance,
89 // there is a corresponding G4PDefData instance. All G4PDefData instances
90 // are organized by the class G4PDefManager as an array.
91 // The field "int g4particleDefinitionInstanceID" is added to the class G4ParticleDefinition.
92 // The value of this field in each G4ParticleDefinition instance is the
93 // subscript of the corresponding G4PDefData instance.
94 // In order to use the class G4PDefManager, we add a static member in the class
95 // G4ParticleDefinition as follows: "static G4PDefManager subInstanceManager".
96 // Both the master thread and worker threads change the length of the array
97 // for G4PDefData instances mutually along with G4ParticleDefinition
98 // instances are created. For each worker thread, it dynamically creates ions.
99 // Consider any thread A, if there is any other thread which creates an ion.
100 // This ion is shared by the thread A. So the thread A leaves an empty space
101 // in the array of G4PDefData instances for the ion.
102 //
105 
106 // This macro changes the references to fields that are now encapsulated
107 // in the class G4PDefData.
108 //
109 #define G4MT_pmanager ((subInstanceManager.offset[g4particleDefinitionInstanceID]).theProcessManager)
110 
112 {
113  // Class Description:
114  //
115  // This class containes all the static data of a particle.
116  // It also has uses a process manager in order to collect
117  // all the processes this kind of particle can undertake.
118 
120 
121  public: // With Description
122 
123  // Only one type of constructor can be used for G4ParticleDefinition.
124  // If you want to create new particle, you must set name of the particle
125  // at construction. Most of members seen as arguments of the constructor
126  // (except last 3 arguments concerning with decay ) are "constant"
127  // and can not be changed later. (No "SET" methods are available)
128  // Each type of particle must be constructed as a unique object
129  // of special class derived from G4ParticleDefinition.
130  // see G4ParticleTypes for detail
131 
132  G4ParticleDefinition(const G4String& aName,
133  G4double mass,
134  G4double width,
135  G4double charge,
136  G4int iSpin,
137  G4int iParity,
138  G4int iConjugation,
139  G4int iIsospin,
140  G4int iIsospinZ,
141  G4int gParity,
142  const G4String& pType,
143  G4int lepton,
144  G4int baryon,
145  G4int encoding,
146  G4bool stable,
147  G4double lifetime,
148  G4DecayTable *decaytable,
149  G4bool shortlived = false,
150  const G4String& subType ="",
151  G4int anti_encoding =0,
152  G4double magneticMoment = 0.0);
153 
154  virtual ~G4ParticleDefinition();
155 
156  // With the following Getxxxx methods, one can get values
157  // for members which can not be changed
158 
159  const G4String& GetParticleName() const { return theParticleName; }
160 
161  G4double GetPDGMass() const { return thePDGMass; }
162  G4double GetPDGWidth() const { return thePDGWidth; }
163  G4double GetPDGCharge() const { return thePDGCharge; }
164 
165  G4double GetPDGSpin() const { return thePDGSpin; }
166  G4int GetPDGiSpin() const { return thePDGiSpin; }
167  G4int GetPDGiParity() const { return thePDGiParity; }
168  G4int GetPDGiConjugation() const { return thePDGiConjugation; }
169  G4double GetPDGIsospin() const { return thePDGIsospin; }
170  G4double GetPDGIsospin3() const { return thePDGIsospin3; }
171  G4int GetPDGiIsospin() const { return thePDGiIsospin; }
172  G4int GetPDGiIsospin3() const { return thePDGiIsospin3; }
173  G4int GetPDGiGParity() const { return thePDGiGParity; }
174 
175  G4double GetPDGMagneticMoment() const { return thePDGMagneticMoment; }
176  void SetPDGMagneticMoment(G4double mageticMoment);
177  G4double CalculateAnomaly() const;
178  // Gives the anomaly of magnetic moment for spin 1/2 particles
179 
180  const G4String& GetParticleType() const { return theParticleType; }
181  const G4String& GetParticleSubType() const { return theParticleSubType; }
182  G4int GetLeptonNumber() const { return theLeptonNumber; }
183  G4int GetBaryonNumber() const { return theBaryonNumber; }
184 
185  G4int GetPDGEncoding() const { return thePDGEncoding; }
186  G4int GetAntiPDGEncoding() const { return theAntiPDGEncoding; }
187  void SetAntiPDGEncoding(G4int aEncoding);
188 
189 
190  G4int GetQuarkContent(G4int flavor) const;
191  G4int GetAntiQuarkContent(G4int flavor) const;
192  // Returns the number of quark with flavor contained in this particle.
193  // The value of flavor is assigned as follows
194  // 1:d, 2:u, 3:s, 4:c, 5:b, 6:t
195 
196  G4bool IsShortLived() const { return fShortLivedFlag; }
197 
198  G4bool GetPDGStable() const { return thePDGStable; }
199  void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
200 
201  G4double GetPDGLifeTime() const { return thePDGLifeTime; }
202  void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime=aLifeTime; }
203 
204  G4DecayTable* GetDecayTable() const;
205  void SetDecayTable(G4DecayTable* aDecayTable);
206  // Set/Get Decay Table
207  // !! Decay Table can be modified !!
208 
210  void SetProcessManager(G4ProcessManager* aProcessManager);
211  // Set/Get Process Manager
212  // !! Process Manager can be modified !!
213 
215  // Get pointer to the particle table
216 
217  G4int GetAtomicNumber() const;
218  G4int GetAtomicMass() const;
219  // Get AtomicNumber and AtomicMass
220  // These properties are defined for nucleus
221 
222  void DumpTable() const;
223  // Prints information of data members.
224 
226  G4int GetVerboseLevel() const;
227  // controle flag for output message
228  // 0: Silent
229  // 1: Warning message
230  // 2: More
231 
232  void SetApplyCutsFlag(G4bool);
233  G4bool GetApplyCutsFlag() const;
234 
235  G4bool IsGeneralIon() const;
236  // true only if the particle is G4Ions
237  // (it means that theProcessManager is same as one for G4GenricIon)
238 
241 
242  public : // without description
243 
245  // Returns the process manager master pointer.
246  inline void SetMasterProcessManager(G4ProcessManager* aNewPM);
247  //Sets the shadow master pointer (not to be used by user)
248 
249  inline G4int GetInstanceID() const;
250  // Returns the instance ID.
251 
252  static const G4PDefManager& GetSubInstanceManager();
253  // Returns the private data instance manager.
254  private:
255  // --- Shadow of master pointers.
256 
257  G4ProcessManager *theProcessManagerShadow;
258  // Each worker thread can access this field from the master thread
259  // through this pointer.
260 
261  G4int g4particleDefinitionInstanceID;
262  // This field is used as instance ID.
263 
264  G4PART_DLL static G4PDefManager subInstanceManager;
265  // This field helps to use the class G4PDefManager introduced above.
266 
267  protected:
268 
270  // Calculates quark and anti-quark contents
271  // return value is PDG encoding for this particle.
272  // It means error if the return value is deffernt from
273  // this->thePDGEncoding.
274 
275  void SetParticleSubType(const G4String& subtype);
276 
277  void SetAtomicNumber(G4int );
278  void SetAtomicMass(G4int );
279 
280  // !!! can not use "copy constructor" nor "default constructor" !!!!
281  //
284 
285  private:
286 
287  // !!! Assignment operation is forbidden !!!
288  //
290 
291  protected:
292 
296  // the number of quark (minus Sign means anti-quark) contents
297  // The value of flavor is assigned as follows
298  // 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
299 
300  private:
301 
302  // --- Following values can not be changed
303  // --- i.e. No Setxxxx Methods for them
304 
305  G4String theParticleName;
306  // The name of the particle.
307  // Each object must have its specific name!!
308 
309  // --- Following member values must be defined with Units
310 
311  G4double thePDGMass;
312  // The mass of the particle, in units of equivalent energy.
313 
314  G4double thePDGWidth;
315  // The decay width of the particle, usually the width of a
316  // Breit-Wigner function, assuming that you are near the
317  // mass center anyway. (in units of equivalent energy)
318 
319  G4double thePDGCharge;
320  // The charge of the particle.(in units of Coulomb)
321 
322  // --- Following members are quantum number
323  // i.e. discrete numbers can be allowded
324  // So, you can defined only by using integer in constructor
325 
326  G4int thePDGiSpin;
327  // The total spin of the particle, also often denoted as
328  // capital J, in units of 1/2.
329  G4double thePDGSpin;
330  // The total spin of the particle, in units of 1.
331 
332  G4int thePDGiParity;
333  // The parity quantum number, in units of 1. If the parity
334  // is not defined for this particle, we will set this to 0.
335 
336  G4int thePDGiConjugation;
337  // This charge conjugation quantum number in units of 1.
338 
339  G4int thePDGiGParity;
340  // The value of the G-parity quantum number.
341 
342  G4int thePDGiIsospin;
343  G4int thePDGiIsospin3;
344  // The isospin and its 3rd-component in units of 1/2.
345  G4double thePDGIsospin;
346  G4double thePDGIsospin3;
347  // The isospin quantum number in units of 1.
348 
349  G4double thePDGMagneticMoment;
350  // The magnetic moment.
351 
352  G4int theLeptonNumber;
353  // The lepton quantum number.
354 
355  G4int theBaryonNumber;
356  // The baryon quantum number.
357 
358  G4String theParticleType;
359  // More general textual type description of the particle.
360 
361  G4String theParticleSubType;
362  // Textual type description of the particle
363  // eg. pion, lamda etc.
364 
365  G4int thePDGEncoding;
366  // The Particle Data Group integer identifier of this particle
367 
368  G4int theAntiPDGEncoding;
369  // The Particle Data Group integer identifier of the anti-particle
370 
371  // --- Following members can be changed after construction
372 
373  G4bool fShortLivedFlag;
374  // Particles which have true value of this flag
375  // will not be tracked by TrackingManager
376 
377  G4bool thePDGStable;
378  // Is an indicator that this particle is stable. It must
379  // not decay. If the user tries to assign a kind of decay
380  // object to it, it will refuse to take it.
381 
382  G4double thePDGLifeTime;
383  // Is related to the decay width of the particle. The mean
384  // life time is given in seconds.
385 
386  G4DecayTable *theDecayTable;
387  // Points DecayTable
388 
389  private:
390 
391  G4ParticleTable* theParticleTable;
392 
393  G4int theAtomicNumber;
394  G4int theAtomicMass;
395 
396  G4int verboseLevel;
397  G4bool fApplyCutsFlag;
398 
399  protected:
401 
402  public:
403  void SetParticleDefinitionID(G4int id=-1);
405 };
406 
407 #include "G4ParticleDefinition.icc"
408 
409 #endif
G4int GetParticleDefinitionID() const
void SetDecayTable(G4DecayTable *aDecayTable)
void SetAtomicNumber(G4int)
void SetPDGStable(const G4bool aFlag)
void SetParticleDefinitionID(G4int id=-1)
void SetProcessManager(G4ProcessManager *aProcessManager)
G4double GetPDGIsospin3() const
void SetAntiPDGEncoding(G4int aEncoding)
G4double GetPDGIsospin() const
G4int operator!=(const G4ParticleDefinition &right) const
G4int GetVerboseLevel() const
G4PDefSplitter< G4PDefData > G4PDefManager
G4ProcessManager * theProcessManager
void SetPDGLifeTime(G4double aLifeTime)
G4int GetAntiQuarkContent(G4int flavor) const
#define width
const G4String & GetParticleSubType() const
static const G4PDefManager & GetSubInstanceManager()
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
G4int GetInstanceID() const
const G4String & GetParticleName() const
G4int GetAtomicNumber() const
G4bool IsGeneralIon() const
G4int GetAntiPDGEncoding() const
G4ParticleTable * GetParticleTable() const
G4DecayTable * GetDecayTable() const
G4double GetPDGWidth() const
G4ProcessManager * GetMasterProcessManager() const
G4double CalculateAnomaly() const
bool G4bool
Definition: G4Types.hh:79
G4int GetQuarkContent(G4int flavor) const
const G4String & GetParticleType() const
void SetVerboseLevel(G4int value)
G4int GetAtomicMass() const
G4int operator==(const G4ParticleDefinition &right) const
G4int GetPDGiConjugation() const
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
jump r
Definition: plot.C:36
G4PDefManager G4ParticleDefinitionSubInstanceManager
G4double GetPDGMass() const
G4int theQuarkContent[NumberOfQuarkFlavor]
void SetParticleSubType(const G4String &subtype)
G4double GetPDGSpin() const
const XML_Char int const XML_Char * value
Definition: expat.h:331
G4double GetPDGLifeTime() const
G4bool GetApplyCutsFlag() const
#define G4PART_DLL
Definition: pwdefs.hh:48
G4double GetPDGMagneticMoment() const
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
G4ParticlePropertyTable & operator=(const G4ParticlePropertyTable &right)
void SetMasterProcessManager(G4ProcessManager *aNewPM)
void SetAtomicMass(G4int)
void SetPDGMagneticMoment(G4double mageticMoment)