ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4InuclElementaryParticle.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4InuclElementaryParticle.hh
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 // 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
28 // 20100409 M. Kelsey -- Drop unused string argument from ctors.
29 // 20100429 M. Kelsey -- Change "photon()" to "isPhoton()", use enum names
30 // 20100914 M. Kelsey -- Move printout to .cc file
31 // 20100915 M. Kelsey -- Add hyperon() identification function, ctor for
32 // G4DynamicParticle
33 // 20110117 M. Kelsey -- Add antinucleon() and antibaryon() flag
34 // 20110127 M. Kelsey -- Drop generation.
35 // 20110214 M. Kelsey -- Replace integer "model" with enum
36 // 20110321 M. Kelsey -- Fix getStrangeness() to return int
37 // 20110721 M. Kelsey -- Add constructors to take G4ParticleDefinition as
38 // input instead of type code, to allow pass-through of unusable
39 // particles during rescattering. Modify ctors to pass model to
40 // base ctor.
41 // 20110801 M. Kelsey -- Add fill() functions to replicate ctors, allowing
42 // reuse of objects as buffers; c.f. G4InuclNuclei.
43 // 20110922 M. Kelsey -- Add stream argument to printParticle() => print()
44 // 20120608 M. Kelsey -- Fix variable-name "shadowing" compiler warnings.
45 // 20130702 M. Kelsey -- Use static type classifiers in G4InuclParticleNames
46 // 20140310 M. Kelsey -- Fix constness in G4PD* passing
47 
48 #ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
49 #define G4INUCL_ELEMENTARY_PARTICLE_HH
50 
51 #include "G4InuclParticle.hh"
52 #include "G4InuclParticleNames.hh"
53 #include "globals.hh"
54 
56 
57 
59 public:
61  : G4InuclParticle() {}
62 
65 
68  : G4InuclParticle(dynPart, model) {}
69 
72  : G4InuclParticle(makeDefinition(ityp), mom, model) {}
73 
76  : G4InuclParticle(makeDefinition(ityp), ekin, model) {}
77 
78  // WARNING: This may create a particle without a valid type code!
80  const G4ParticleDefinition* pd,
82  : G4InuclParticle(pd, mom, model) {}
83 
84  // Copy and assignment constructors for use with std::vector<>
86  : G4InuclParticle(right) {}
87 
89 
90  // Overwrite data structure (avoids creating/copying temporaries)
91  void fill(G4int ityp, Model model=DefaultModel) { fill(0., ityp, model); }
92 
93  void fill(const G4LorentzVector& mom, G4int ityp, Model model=DefaultModel);
94 
95  void fill(G4double ekin, G4int ityp, Model model=DefaultModel);
96 
97  // WARNING: This may create a particle without a valid type code!
98  void fill(const G4LorentzVector& mom, const G4ParticleDefinition* pd,
100 
101  // Assignment and accessor functions
102  void setType(G4int ityp);
103  G4int type() const { return type(getDefinition()); }
104 
105  static G4int type(const G4ParticleDefinition* pd);
106 
107  // Ensure that type code refers to a known particle
108  inline static G4bool valid(G4int ityp) { return ityp!=0; }
109  G4bool valid() const { return valid(type()); }
110 
118 
119  G4int baryon() const { // Can use as a bool (!=0 ==> true)
120  return getDefinition()->GetBaryonNumber();
121  }
122 
123  G4bool antibaryon() const { return baryon() < 0; }
124 
125  G4bool hyperon() const { return (baryon() && getStrangeness()); }
126 
129  }
130 
131  G4int getStrangeness() const { return getStrangeness(type()); }
132 
133  virtual void print(std::ostream& os) const;
134 
135  static G4int getStrangeness(G4int type);
137 
138 protected:
139  // Convert internal type code to standard GEANT4 pointer
140  static const G4ParticleDefinition* makeDefinition(G4int ityp);
141 };
142 
143 #endif // G4INUCL_ELEMENTARY_PARTICLE_HH