Geant4  10.01.p02
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 79342 2014-02-24 11:42:42Z 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>
58 #include <CLHEP/Units/PhysicalConstants.h>
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; }
171  G4int GetPDGiIsospin() const { return thePDGiIsospin; }
173  G4int GetPDGiGParity() const { return thePDGiGParity; }
174 
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; }
184 
185  G4int GetPDGEncoding() const { return thePDGEncoding; }
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;
199  void SetPDGStable(const G4bool aFlag) { thePDGStable=aFlag; }
200 
201  G4double GetPDGLifeTime() const;
202  void SetPDGLifeTime(G4double aLifeTime) { thePDGLifeTime=aLifeTime; }
203 
204  G4double GetIonLifeTime() const;
205  // Get life time of a generic ion through G4NuclideTable.
206 
207  G4DecayTable* GetDecayTable() const;
208  void SetDecayTable(G4DecayTable* aDecayTable);
209  // Set/Get Decay Table
210  // !! Decay Table can be modified !!
211 
213  void SetProcessManager(G4ProcessManager* aProcessManager);
214  // Set/Get Process Manager
215  // !! Process Manager can be modified !!
216 
218  // Get pointer to the particle table
219 
220  G4int GetAtomicNumber() const;
221  G4int GetAtomicMass() const;
222  // Get AtomicNumber and AtomicMass
223  // These properties are defined for nucleus
224 
225  void DumpTable() const;
226  // Prints information of data members.
227 
228  void SetVerboseLevel(G4int value);
229  G4int GetVerboseLevel() const;
230  // controle flag for output message
231  // 0: Silent
232  // 1: Warning message
233  // 2: More
234 
235  void SetApplyCutsFlag(G4bool);
236  G4bool GetApplyCutsFlag() const;
237 
238  G4bool IsGeneralIon() const;
239  // true only if the particle is G4Ions
240  // (it means that theProcessManager is same as one for G4GenricIon)
241 
244 
245  public : // without description
246 
248  // Returns the process manager master pointer.
249  inline void SetMasterProcessManager(G4ProcessManager* aNewPM);
250  //Sets the shadow master pointer (not to be used by user)
251 
252  inline G4int GetInstanceID() const;
253  // Returns the instance ID.
254 
255  static const G4PDefManager& GetSubInstanceManager();
256  // Returns the private data instance manager.
257  private:
258  // --- Shadow of master pointers.
259 
261  // Each worker thread can access this field from the master thread
262  // through this pointer.
263 
265  // This field is used as instance ID.
266 
268  // This field helps to use the class G4PDefManager introduced above.
269 
270  protected:
271 
273  // Calculates quark and anti-quark contents
274  // return value is PDG encoding for this particle.
275  // It means error if the return value is deffernt from
276  // this->thePDGEncoding.
277 
278  void SetParticleSubType(const G4String& subtype);
279 
280  void SetAtomicNumber(G4int );
281  void SetAtomicMass(G4int );
282 
283  // !!! can not use "copy constructor" nor "default constructor" !!!!
284  //
287 
288  private:
289 
290  // !!! Assignment operation is forbidden !!!
291  //
293 
294  protected:
295 
299  // the number of quark (minus Sign means anti-quark) contents
300  // The value of flavor is assigned as follows
301  // 0:d, 1:u, 2:s, 3:c, 4:b, 5:t
302 
303  private:
304 
305  // --- Following values can not be changed
306  // --- i.e. No Setxxxx Methods for them
307 
309  // The name of the particle.
310  // Each object must have its specific name!!
311 
312  // --- Following member values must be defined with Units
313 
315  // The mass of the particle, in units of equivalent energy.
316 
318  // The decay width of the particle, usually the width of a
319  // Breit-Wigner function, assuming that you are near the
320  // mass center anyway. (in units of equivalent energy)
321 
323  // The charge of the particle.(in units of Coulomb)
324 
325  // --- Following members are quantum number
326  // i.e. discrete numbers can be allowded
327  // So, you can defined only by using integer in constructor
328 
330  // The total spin of the particle, also often denoted as
331  // capital J, in units of 1/2.
333  // The total spin of the particle, in units of 1.
334 
336  // The parity quantum number, in units of 1. If the parity
337  // is not defined for this particle, we will set this to 0.
338 
340  // This charge conjugation quantum number in units of 1.
341 
343  // The value of the G-parity quantum number.
344 
347  // The isospin and its 3rd-component in units of 1/2.
350  // The isospin quantum number in units of 1.
351 
353  // The magnetic moment.
354 
356  // The lepton quantum number.
357 
359  // The baryon quantum number.
360 
362  // More general textual type description of the particle.
363 
365  // Textual type description of the particle
366  // eg. pion, lamda etc.
367 
369  // The Particle Data Group integer identifier of this particle
370 
372  // The Particle Data Group integer identifier of the anti-particle
373 
374  // --- Following members can be changed after construction
375 
377  // Particles which have true value of this flag
378  // will not be tracked by TrackingManager
379 
381  // Is an indicator that this particle is stable. It must
382  // not decay. If the user tries to assign a kind of decay
383  // object to it, it will refuse to take it.
384 
386  // Is related to the decay width of the particle. The mean
387  // life time is given in seconds.
388 
390  // Points DecayTable
391 
392  private:
393 
395 
398 
401 
402  protected:
404 
405  public:
406  void SetParticleDefinitionID(G4int id=-1);
408 };
409 
410 #include "G4ParticleDefinition.icc"
411 
412 #endif
G4int GetParticleDefinitionID() const
void SetDecayTable(G4DecayTable *aDecayTable)
G4ParticleTable * theParticleTable
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
G4bool GetPDGStable() const
G4ProcessManager * theProcessManager
void SetPDGLifeTime(G4double aLifeTime)
G4int GetAntiQuarkContent(G4int flavor) const
static G4PART_DLL G4PDefManager subInstanceManager
#define width
G4ProcessManager * theProcessManagerShadow
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
G4double GetIonLifeTime() 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)
#define encoding
Definition: xmlparse.cc:588
G4int GetAtomicMass() const
G4int operator==(const G4ParticleDefinition &right) const
G4int GetPDGiConjugation() const
G4int theAntiQuarkContent[NumberOfQuarkFlavor]
G4PDefManager G4ParticleDefinitionSubInstanceManager
G4double GetPDGMass() const
G4int theQuarkContent[NumberOfQuarkFlavor]
void SetParticleSubType(const G4String &subtype)
G4double GetPDGSpin() const
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
void SetMasterProcessManager(G4ProcessManager *aNewPM)
void SetAtomicMass(G4int)
void SetPDGMagneticMoment(G4double mageticMoment)
const G4ParticleDefinition & operator=(const G4ParticleDefinition &r)