Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4InuclElementaryParticle.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 // $Id: G4InuclElementaryParticle.hh 72074 2013-07-06 06:28:53Z mkelsey $
27 //
28 // 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
29 // 20100409 M. Kelsey -- Drop unused string argument from ctors.
30 // 20100429 M. Kelsey -- Change "photon()" to "isPhoton()", use enum names
31 // 20100914 M. Kelsey -- Move printout to .cc file
32 // 20100915 M. Kelsey -- Add hyperon() identification function, ctor for
33 // G4DynamicParticle
34 // 20110117 M. Kelsey -- Add antinucleon() and antibaryon() flag
35 // 20110127 M. Kelsey -- Drop generation.
36 // 20110214 M. Kelsey -- Replace integer "model" with enum
37 // 20110321 M. Kelsey -- Fix getStrangeness() to return int
38 // 20110721 M. Kelsey -- Add constructors to take G4ParticleDefinition as
39 // input instead of type code, to allow pass-through of unusable
40 // particles during rescattering. Modify ctors to pass model to
41 // base ctor.
42 // 20110801 M. Kelsey -- Add fill() functions to replicate ctors, allowing
43 // reuse of objects as buffers; c.f. G4InuclNuclei.
44 // 20110922 M. Kelsey -- Add stream argument to printParticle() => print()
45 // 20120608 M. Kelsey -- Fix variable-name "shadowing" compiler warnings.
46 // 20130702 M. Kelsey -- Use static type classifiers in G4InuclParticleNames
47 // 20140310 M. Kelsey -- Fix constness in G4PD* passing
48 
49 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
50 #define G4INUCL_ELEMENTARY_PARTICLE_HH
51 
52 #include "G4InuclParticle.hh"
53 #include "G4InuclParticleNames.hh"
54 #include "globals.hh"
55 
57 
58 
60 public:
62  : G4InuclParticle() {}
63 
66 
69  : G4InuclParticle(dynPart, model) {}
70 
73  : G4InuclParticle(makeDefinition(ityp), mom, model) {}
74 
77  : G4InuclParticle(makeDefinition(ityp), ekin, model) {}
78 
79  // WARNING: This may create a particle without a valid type code!
81  const G4ParticleDefinition* pd,
83  : G4InuclParticle(pd, mom, model) {}
84 
85  // Copy and assignment constructors for use with std::vector<>
87  : G4InuclParticle(right) {}
88 
90 
91  // Overwrite data structure (avoids creating/copying temporaries)
92  void fill(G4int ityp, Model model=DefaultModel) { fill(0., ityp, model); }
93 
94  void fill(const G4LorentzVector& mom, G4int ityp, Model model=DefaultModel);
95 
96  void fill(G4double ekin, G4int ityp, Model model=DefaultModel);
97 
98  // WARNING: This may create a particle without a valid type code!
99  void fill(const G4LorentzVector& mom, const G4ParticleDefinition* pd,
101 
102  // Assignment and accessor functions
103  void setType(G4int ityp);
104  G4int type() const { return type(getDefinition()); }
105 
106  static G4int type(const G4ParticleDefinition* pd);
107 
108  // Ensure that type code refers to a known particle
109  inline static G4bool valid(G4int ityp) { return ityp!=0; }
110  G4bool valid() const { return valid(type()); }
111 
119 
120  G4int baryon() const { // Can use as a bool (!=0 ==> true)
121  return getDefinition()->GetBaryonNumber();
122  }
123 
124  G4bool antibaryon() const { return baryon() < 0; }
125 
126  G4bool hyperon() const { return (baryon() && getStrangeness()); }
127 
130  }
131 
132  G4int getStrangeness() const { return getStrangeness(type()); }
133 
134  virtual void print(std::ostream& os) const;
135 
136  static G4int getStrangeness(G4int type);
138 
139 protected:
140  // Convert internal type code to standard GEANT4 pointer
141  static const G4ParticleDefinition* makeDefinition(G4int ityp);
142 };
143 
144 #endif // G4INUCL_ELEMENTARY_PARTICLE_HH
G4InuclElementaryParticle(G4int ityp, Model model=DefaultModel)
G4bool isElectron(G4int ityp)
G4bool pion(G4int ityp)
static const G4ParticleDefinition * makeDefinition(G4int ityp)
const G4ParticleDefinition * getDefinition() const
G4bool isNeutrino(G4int ityp)
G4InuclElementaryParticle(const G4LorentzVector &mom, const G4ParticleDefinition *pd, Model model=DefaultModel)
static G4double getParticleMass(G4int type)
G4bool antinucleon(G4int ityp)
int G4int
Definition: G4Types.hh:78
static G4bool valid(G4int ityp)
G4InuclElementaryParticle(const G4LorentzVector &mom, G4int ityp, Model model=DefaultModel)
G4InuclElementaryParticle & operator=(const G4InuclElementaryParticle &right)
G4InuclElementaryParticle(const G4InuclElementaryParticle &right)
G4InuclElementaryParticle(G4double ekin, G4int ityp, Model model=DefaultModel)
G4bool nucleon(G4int ityp)
G4bool isMuon(G4int ityp)
G4bool isPhoton(G4int ityp)
bool G4bool
Definition: G4Types.hh:79
void fill(G4int ityp, Model model=DefaultModel)
G4bool quasi_deutron(G4int ityp)
double G4double
Definition: G4Types.hh:76
const XML_Char XML_Content * model
Definition: expat.h:151
virtual void print(std::ostream &os) const
G4InuclElementaryParticle(const G4DynamicParticle &dynPart, Model model=DefaultModel)