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 | // $Id: G4InuclNuclei.cc,v 1.22 2010/09/25 06:44:30 mkelsey Exp $ |
---|
26 | // Geant4 tag: $Name: hadr-casc-V09-03-85 $ |
---|
27 | // |
---|
28 | // 20100301 M. Kelsey -- Add function to create unphysical nuclei for use |
---|
29 | // as temporary final-state fragments. |
---|
30 | // 20100319 M. Kelsey -- Add information message to makeNuclearFragment(). |
---|
31 | // Use new GetBindingEnergy() function instead of bindingEnergy(). |
---|
32 | // 20100622 M. Kelsey -- Use local "bindingEnergy()" function to call through. |
---|
33 | // 20100627 M. Kelsey -- Test for non-physical fragments and abort job. |
---|
34 | // 20100630 M. Kelsey -- Use excitation energy in G4Ions |
---|
35 | // 20100714 M. Kelsey -- Use G4DynamicParticle::theDynamicalMass to deal with |
---|
36 | // excitation energy without instantianting "infinite" G4PartDefns. |
---|
37 | // 20100719 M. Kelsey -- Change excitation energy without altering momentum |
---|
38 | // 20100906 M. Kelsey -- Add fill() functions to rewrite contents |
---|
39 | // 20100910 M. Kelsey -- Add clearExitonConfiguration() to fill() functions |
---|
40 | // 20100914 M. Kelsey -- Make printout symmetric with G4InuclElemPart, |
---|
41 | // migrate to integer A and Z |
---|
42 | // 20100924 M. Kelsey -- Add constructor to copy G4Fragment input, and output |
---|
43 | // functions to create G4Fragment |
---|
44 | |
---|
45 | #include "G4InuclNuclei.hh" |
---|
46 | #include "G4Fragment.hh" |
---|
47 | #include "G4HadronicException.hh" |
---|
48 | #include "G4InuclSpecialFunctions.hh" |
---|
49 | #include "G4Ions.hh" |
---|
50 | #include "G4IonTable.hh" |
---|
51 | #include "G4NucleiProperties.hh" |
---|
52 | #include "G4ParticleDefinition.hh" |
---|
53 | #include "G4ParticleTable.hh" |
---|
54 | #include <assert.h> |
---|
55 | #include <sstream> |
---|
56 | #include <map> |
---|
57 | |
---|
58 | using namespace G4InuclSpecialFunctions; |
---|
59 | |
---|
60 | |
---|
61 | // Convert contents from (via constructor) and to G4Fragment |
---|
62 | |
---|
63 | G4InuclNuclei::G4InuclNuclei(const G4Fragment& aFragment, G4int model) |
---|
64 | : G4InuclParticle(makeDefinition(aFragment.GetA_asInt(), |
---|
65 | aFragment.GetZ_asInt()), |
---|
66 | aFragment.GetMomentum()/GeV) { // Bertini units |
---|
67 | setExitationEnergy(aFragment.GetExcitationEnergy()); |
---|
68 | setModel(model); |
---|
69 | |
---|
70 | // Exciton configuration must be set by hand |
---|
71 | theExitonConfiguration.protonQuasiParticles = aFragment.GetNumberOfCharged(); |
---|
72 | |
---|
73 | theExitonConfiguration.neutronQuasiParticles = |
---|
74 | aFragment.GetNumberOfCharged() - aFragment.GetNumberOfCharged(); |
---|
75 | |
---|
76 | // Split hole count evenly between protons and neutrons (arbitrary!) |
---|
77 | theExitonConfiguration.protonHoles = aFragment.GetNumberOfHoles()/2; |
---|
78 | |
---|
79 | theExitonConfiguration.neutronHoles = |
---|
80 | aFragment.GetNumberOfHoles() - theExitonConfiguration.protonHoles; |
---|
81 | } |
---|
82 | |
---|
83 | // FIXME: Should we have a local buffer and return by const-reference instead? |
---|
84 | G4Fragment G4InuclNuclei::makeG4Fragment() const { |
---|
85 | G4Fragment frag(getA(), getZ(), getMomentum()*GeV); // From Bertini units |
---|
86 | |
---|
87 | // Note: exciton configuration has to be set piece by piece |
---|
88 | frag.SetNumberOfHoles(theExitonConfiguration.protonHoles |
---|
89 | + theExitonConfiguration.neutronHoles); |
---|
90 | |
---|
91 | frag.SetNumberOfParticles(theExitonConfiguration.protonQuasiParticles |
---|
92 | + theExitonConfiguration.neutronQuasiParticles); |
---|
93 | |
---|
94 | frag.SetNumberOfCharged(theExitonConfiguration.protonQuasiParticles); |
---|
95 | |
---|
96 | return frag; |
---|
97 | } |
---|
98 | |
---|
99 | G4InuclNuclei::operator G4Fragment() const { |
---|
100 | return makeG4Fragment(); |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | // Overwrite data structure (avoids creating/copying temporaries) |
---|
105 | |
---|
106 | void G4InuclNuclei::fill(const G4LorentzVector& mom, G4int a, G4int z, |
---|
107 | G4double exc, G4int model) { |
---|
108 | setDefinition(makeDefinition(a,z)); |
---|
109 | setMomentum(mom); |
---|
110 | setExitationEnergy(exc); |
---|
111 | clearExitonConfiguration(); |
---|
112 | setModel(model); |
---|
113 | } |
---|
114 | |
---|
115 | void G4InuclNuclei::fill(G4double ekin, G4int a, G4int z, G4double exc, |
---|
116 | G4int model) { |
---|
117 | setDefinition(makeDefinition(a,z)); |
---|
118 | setKineticEnergy(ekin); |
---|
119 | setExitationEnergy(exc); |
---|
120 | clearExitonConfiguration(); |
---|
121 | setModel(model); |
---|
122 | } |
---|
123 | |
---|
124 | |
---|
125 | // Change excitation energy while keeping momentum vector constant |
---|
126 | |
---|
127 | void G4InuclNuclei::setExitationEnergy(G4double e) { |
---|
128 | G4double ekin = getKineticEnergy(); // Current kinetic energy |
---|
129 | |
---|
130 | G4double emass = getNucleiMass() + e*MeV/GeV; // From Bertini to G4 units |
---|
131 | |
---|
132 | // Directly compute new kinetic energy from old |
---|
133 | G4double ekin_new = std::sqrt(emass*emass + ekin*(2.*getMass()+ekin)) - emass; |
---|
134 | |
---|
135 | setMass(emass); // Momentum is computed from mass and Ekin |
---|
136 | setKineticEnergy(ekin_new); |
---|
137 | } |
---|
138 | |
---|
139 | |
---|
140 | // Convert nuclear configuration to standard GEANT4 pointer |
---|
141 | |
---|
142 | // WARNING: Opposite conventions! G4InuclNuclei uses (A,Z) everywhere, while |
---|
143 | // G4ParticleTable::GetIon() uses (Z,A)! |
---|
144 | |
---|
145 | G4ParticleDefinition* G4InuclNuclei::makeDefinition(G4int a, G4int z) { |
---|
146 | G4ParticleTable* pTable = G4ParticleTable::GetParticleTable(); |
---|
147 | G4ParticleDefinition *pd = pTable->GetIon(z, a, 0.); |
---|
148 | |
---|
149 | // SPECIAL CASE: Non-physical nuclear fragment, for final-state return |
---|
150 | if (!pd) pd = makeNuclearFragment(a,z); |
---|
151 | |
---|
152 | return pd; // This could return a null pointer if above fails |
---|
153 | } |
---|
154 | |
---|
155 | // Creates a non-standard excited nucleus |
---|
156 | |
---|
157 | // Creates a non-physical pseudo-nucleus, for return as final-state fragment |
---|
158 | // from G4IntraNuclearCascader |
---|
159 | |
---|
160 | G4ParticleDefinition* |
---|
161 | G4InuclNuclei::makeNuclearFragment(G4int a, G4int z) { |
---|
162 | if (a<=0 || z<0 || a<z) { |
---|
163 | G4cerr << " >>> G4InuclNuclei::makeNuclearFragment() called with" |
---|
164 | << " impossible arguments A=" << a << " Z=" << z << G4endl; |
---|
165 | throw G4HadronicException(__FILE__, __LINE__, |
---|
166 | "G4InuclNuclei impossible A/Z arguments"); |
---|
167 | } |
---|
168 | |
---|
169 | G4int code = G4IonTable::GetNucleusEncoding(z, a); |
---|
170 | |
---|
171 | // Use local lookup table (see G4IonTable.hh) to maintain singletons |
---|
172 | // NOTE: G4ParticleDefinitions don't need to be explicitly deleted |
---|
173 | // (see comments in G4IonTable.cc::~G4IonTable) |
---|
174 | |
---|
175 | // If correct nucleus already created return it |
---|
176 | static std::map<G4int, G4ParticleDefinition*> fragmentList; |
---|
177 | if (fragmentList.find(code) != fragmentList.end()) return fragmentList[code]; |
---|
178 | |
---|
179 | // Name string follows format in G4IonTable.cc::GetIonName(Z,A,E) |
---|
180 | std::stringstream zstr, astr; |
---|
181 | zstr << z; |
---|
182 | astr << a; |
---|
183 | |
---|
184 | G4String name = "Z" + zstr.str() + "A" + astr.str(); |
---|
185 | |
---|
186 | G4double mass = getNucleiMass(a,z) *GeV/MeV; // From Bertini to GEANT4 units |
---|
187 | |
---|
188 | // Arguments for constructor are as follows |
---|
189 | // name mass width charge |
---|
190 | // 2*spin parity C-conjugation |
---|
191 | // 2*Isospin 2*Isospin3 G-parity |
---|
192 | // type lepton number baryon number PDG encoding |
---|
193 | // stable lifetime decay table |
---|
194 | // shortlived subType anti_encoding Excitation-energy |
---|
195 | |
---|
196 | G4cout << " >>> G4InuclNuclei creating temporary fragment for evaporation " |
---|
197 | << "with non-standard PDGencoding." << G4endl; |
---|
198 | |
---|
199 | G4Ions* fragPD = new G4Ions(name, mass, 0., z*eplus, |
---|
200 | 0, +1, 0, |
---|
201 | 0, 0, 0, |
---|
202 | "nucleus", 0, a, code, |
---|
203 | true, 0., 0, |
---|
204 | true, "generic", 0, 0.); |
---|
205 | fragPD->SetAntiPDGEncoding(0); |
---|
206 | |
---|
207 | return (fragmentList[code] = fragPD); // Store in table for next lookup |
---|
208 | } |
---|
209 | |
---|
210 | G4double G4InuclNuclei::getNucleiMass(G4int a, G4int z, G4double exc) { |
---|
211 | // Simple minded mass calculation use constants in CLHEP (all in MeV) |
---|
212 | G4double mass = G4NucleiProperties::GetNuclearMass(a,z) + exc; |
---|
213 | |
---|
214 | return mass*MeV/GeV; // Convert from GEANT4 to Bertini units |
---|
215 | } |
---|
216 | |
---|
217 | // Assignment operator for use with std::sort() |
---|
218 | G4InuclNuclei& G4InuclNuclei::operator=(const G4InuclNuclei& right) { |
---|
219 | theExitonConfiguration = right.theExitonConfiguration; |
---|
220 | G4InuclParticle::operator=(right); |
---|
221 | return *this; |
---|
222 | } |
---|
223 | |
---|
224 | // Dump particle properties for diagnostics |
---|
225 | |
---|
226 | void G4InuclNuclei::printParticle() const { |
---|
227 | G4InuclParticle::printParticle(); |
---|
228 | G4cout << " Nucleus: " << getDefinition()->GetParticleName() |
---|
229 | << " A " << getA() << " Z " << getZ() << " mass " << getMass() |
---|
230 | << " Eex (MeV) " << getExitationEnergy() << G4endl; |
---|
231 | } |
---|