ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4InuclParticle.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4InuclParticle.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 // 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
28 // 20100409 M. Kelsey -- Drop unused string argument from ctors.
29 // 20100519 M. Kelsey -- Add public access to G4DynamicParticle content
30 // 20100715 M. Kelsey -- Add setKineticEnergy() function
31 // 20100915 M. Kelsey -- Add constructor to copy G4DynamicParticle input
32 // 20110214 M. Kelsey -- Replace integer "model" with enum
33 // 20110225 M. Kelsey -- Add equality operator (NOT sorting!)
34 // 20110721 M. Kelsey -- Add model ID as optional ctor argument (so subclasses
35 // don't have to call SetModel()).
36 // 20110917 M. Kelsey -- Add coalesence to model ID list
37 // 20110919 M. Kelsey -- Move setDefinition code to .cc to allow null argument
38 // 20110922 M. Kelsey -- Add stream argument to printParticle() => print(),
39 // add operator<<().
40 // 20140310 M. Kelsey -- Fix constness in G4PD* passing
41 
42 #ifndef G4INUCL_PARTICLE_HH
43 #define G4INUCL_PARTICLE_HH
44 
45 #include <iosfwd>
47 
48 #include "globals.hh"
49 #include "G4LorentzVector.hh"
50 #include "G4DynamicParticle.hh"
51 
53 public:
54  // used to indicate model that created instance of G4InuclParticle
55  // 0 default
56  // 1 bullet
57  // 2 target
58  // 3 G4ElementaryParticleCollider
59  // 4 G4IntraNucleiCascader
60  // 5 G4NonEquilibriumEvaporator
61  // 6 G4EquilibriumEvaporator
62  // 7 G4Fissioner
63  // 8 G4BigBanger
64  // 9 G4PreCompound
65  // 10 G4CascadeCoalescence
69 
70 public:
72 
74  : pDP(dynPart), modelId(model) {}
75 
77  : modelId(model) { pDP.Set4Momentum(mom*CLHEP::GeV/CLHEP::MeV); } // Bertini to G4 units
78 
79  virtual ~G4InuclParticle() {}
80 
81  // Copy and assignment constructors for use with std::vector<>
83  : pDP(right.pDP), modelId(right.modelId) {}
84 
86 
87  // Equality (comparison) operator -- NOT SORTING
89  return ( (&right == this) || (pDP == right.pDP) ); // Ignore model code
90  }
91 
93  return !operator==(right);
94  }
95 
96  // This is no longer required, as setMomentum() handles mass adjustment
97  void setEnergy() { ; }
98 
99  // These are call-throughs to G4DynamicParticle
100  void setMomentum(const G4LorentzVector& mom);
101 
103 
105 
106  G4double getMass() const {
107  return pDP.GetMass()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
108  }
109 
110  G4double getCharge() const {
111  return pDP.GetCharge();
112  }
113 
115  return pDP.GetKineticEnergy()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
116  }
117 
118  G4double getEnergy() const {
119  return pDP.GetTotalEnergy()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
120  }
121 
123  return pDP.GetTotalMomentum()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
124  }
125 
127  return pDP.Get4Momentum()*CLHEP::MeV/CLHEP::GeV; // From G4 to Bertini units
128  }
129 
130  virtual void print(std::ostream& os) const;
131 
133  return pDP.GetDefinition();
134  }
135 
137  return pDP;
138  }
139 
140 public:
142  Model getModel() const { return modelId; }
143 
144 protected:
145  // Special constructors for subclasses to set particle type correctly
148  : modelId(model) { setDefinition(pd); }
149 
150  // FIXME: Bertini code doesn't pass valid 4-vectors, so force mass value
151  // from supplied PartDefn, with required unit conversions
154 
155  // NOTE: Momentum forced along Z direction
158  : pDP(pd,G4ThreeVector(0.,0.,1.),ekin*CLHEP::GeV/CLHEP::MeV), modelId(model) {}
159 
160  void setDefinition(const G4ParticleDefinition* pd);
161 
162 private:
163  G4DynamicParticle pDP; // Carries all the kinematics and info
165 };
166 
167 // Proper stream output (just calls print())
168 
169 std::ostream& operator<<(std::ostream& os, const G4InuclParticle& part);
170 
171 #endif // G4INUCL_PARTICLE_HH