Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4StatMF.cc
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// Multi-fragmentation
27// by V. Lara
28//
29
30#include "G4StatMF.hh"
32#include "G4SystemOfUnits.hh"
33#include "G4Pow.hh"
35#include "Randomize.hh"
36#include "G4RandomDirection.hh"
37
39{
40 theMicrocanonicalEnsemble = new G4StatMFMicroCanonical();
41 theMacrocanonicalEnsemble = new G4StatMFMacroCanonical();
42 //fSecID = G4PhysicsModelCatalog::GetModelID("model_G4StatMF");
43}
44
46{
47 delete theMicrocanonicalEnsemble;
48 delete theMacrocanonicalEnsemble;
49}
50
52{
53 // Maximun average multiplicity: M_0 = 2.6 for A ~ 200
54 // and M_0 = 3.3 for A <= 110
55 G4int A = theFragment.GetA_asInt();
57
58 // Microcanonical ensemble - direct simulation
59 theMicrocanonicalEnsemble->Initialise(theFragment);
60
61 const G4int iLimit = 20;
62 G4double Temperature = 0.0;
63
64 G4StatMFChannel* theChannel = nullptr;
65
66 for (G4int i=0; i<iLimit; ++i) {
67 for (G4int j=0; j<iLimit; ++j) {
68
69 G4double theMeanMult = theMicrocanonicalEnsemble->GetMeanMultiplicity();
70 if (theMeanMult <= MaxAverageMultiplicity) {
71 //G4cout << "MICROCANONICAL Nmean=" << theMeanMult
72 // << " i=" << i << " j=" << j << G4endl;
73 // Choose fragments atomic numbers and charges from direct simulation
74 theChannel = theMicrocanonicalEnsemble->ChooseAandZ(theFragment);
75 fEnsemble = theMicrocanonicalEnsemble;
76 } else {
77 //-----------------------------------------------------
78 // Non direct simulation part (Macrocanonical Ensemble)
79 //-----------------------------------------------------
80 // Macrocanonical ensemble initialization
81 theMacrocanonicalEnsemble->Initialise(theFragment);
82 fEnsemble = theMacrocanonicalEnsemble;
83 //G4cout << "MACROCANONICAL Nmean=" << theMeanMult
84 // << " i=" << i << " j=" << j << G4endl;
85 // Select calculated fragment total multiplicity,
86 // fragment atomic numbers and fragment charges.
87 theChannel = theMacrocanonicalEnsemble->ChooseAandZ(theFragment);
88 }
89
90 if (theChannel->CheckFragments()) { break; }
91 delete theChannel;
92 theChannel = nullptr;
93 }
94
95 if (nullptr == theChannel || theChannel->GetMultiplicity() <= 1) {
96 delete theChannel;
97 theChannel = nullptr;
98 break;
99 }
100
101 // G4cout << " multiplicity=" << theChannel->GetMultiplicity() << G4endl;
102 //--------------------------------------
103 // Second part of simulation procedure.
104 //--------------------------------------
105
106 // Find temperature of breaking channel.
107 Temperature = fEnsemble->GetMeanTemperature(); // Initial guess for Temperature
108
109 if (FindTemperatureOfBreakingChannel(theFragment, theChannel, Temperature)) {
110 break;
111 }
112
113 // Do not forget to delete this unusable channel, for which we failed to find the temperature,
114 // otherwise for very proton-reach nuclei it would lead to memory leak due to large
115 // number of iterations. N.B. "theChannel" is created in G4StatMFMacroCanonical::ChooseZ()
116
117 // G4cout << " Iteration # " << Iterations << " Mean Temperature = " << Temperature << G4endl;
118 delete theChannel;
119 theChannel = nullptr;
120 }
121
122 // primary
123 G4FragmentVector* theResult = nullptr;
124
125 // no multi-fragmentation
126 if (nullptr == theChannel || theChannel->GetMultiplicity() <= 1) {
127 theResult = new G4FragmentVector();
128 theResult->push_back(new G4Fragment(theFragment));
129 delete theChannel;
130 return theResult;
131 }
132
133 G4int Z = theFragment.GetZ_asInt();
134 G4double m0 = theFragment.GetGroundStateMass() + theFragment.GetExcitationEnergy();
135 auto bs = theFragment.GetMomentum().boostVector();
136
137 G4double etot = 0.0;
138 G4double ekin = 0.0;
139 for (G4int i=0; i<iLimit; ++i) {
140 theResult = theChannel->GetFragments(A, Z, Temperature);
141 if (nullptr == theResult) { continue; }
142 etot = 0.0;
143 ekin = 0.0;
144 for (auto const & ptr : *theResult) {
145 G4double e = ptr->GetMomentum().e();
146 G4double m1 = ptr->GetGroundStateMass() + ptr->GetExcitationEnergy();
147 etot += e;
148 ekin += std::max(e - m1, 0.0);
149 }
150 // correction possible
151 if (etot - m0 + ekin > 0.0 && ekin > 0.0) { break; }
152
153 // new attemt required
154 for (auto const & ptr : *theResult) {
155 delete ptr;
156 }
157 delete theResult;
158 theResult = nullptr;
159 }
160 delete theChannel;
161
162 // no multi-fragmentation
163 if (nullptr == theResult || ekin <= 0.0) {
164 theResult = new G4FragmentVector();
165 theResult->push_back(new G4Fragment(theFragment));
166 return theResult;
167 }
168
169 G4double x = 1.0 + (etot - m0)/ekin;
170 G4LorentzVector lv1;
171
172 // scale and boost
173 for (auto const & ptr : *theResult) {
174 G4double m1 = ptr->GetGroundStateMass() + ptr->GetExcitationEnergy();
175 G4double ek = std::max((ptr->GetMomentum().e() - m1)*x, 0.0);
176 auto mom = ptr->GetMomentum().vect().unit();
177 mom *= std::sqrt(ek * (ek + 2.0*m1));
178 lv1.set(mom.x(), mom.y(), mom.z(), ek + m1);
179 lv1.boost(bs);
180 ptr->SetMomentum(lv1);
181 }
182 return theResult;
183}
184
185G4bool G4StatMF::FindTemperatureOfBreakingChannel(const G4Fragment & theFragment,
186 const G4StatMFChannel * aChannel,
187 G4double & Temperature)
188 // This finds temperature of breaking channel.
189{
190 G4int A = theFragment.GetA_asInt();
191 G4int Z = theFragment.GetZ_asInt();
192 G4double U = theFragment.GetExcitationEnergy();
193
194 G4double T = std::max(Temperature, 0.0012*CLHEP::MeV);
195 G4double Ta = T;
196 G4double TotalEnergy = CalcEnergy(A,Z,aChannel,T);
197
198 G4double Da = (U - TotalEnergy)/U;
199 G4double Db = 0.0;
200
201 // bracketing the solution
202 if (Da == 0.0) {
203 Temperature = T;
204 return true;
205 } else if (Da < 0.0) {
206 do {
207 T *= 0.5;
208 if (T < 0.001*MeV) return false;
209
210 TotalEnergy = CalcEnergy(A,Z,aChannel,T);
211
212 Db = (U - TotalEnergy)/U;
213 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
214 } while (Db < 0.0);
215
216 } else {
217 do {
218 T *= 1.5;
219
220 TotalEnergy = CalcEnergy(A,Z,aChannel,T);
221
222 Db = (U - TotalEnergy)/U;
223 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
224 } while (Db > 0.0);
225 }
226
227 G4double eps = 1.0e-14 * std::abs(T-Ta);
228 //G4double eps = 1.0e-3 ;
229
230 // Start the bisection method
231 for (G4int j = 0; j < 1000; j++) {
232 G4double Tc = (Ta+T)*0.5;
233 if (std::abs(Ta-Tc) <= eps) {
234 Temperature = Tc;
235 return true;
236 }
237
238 T = Tc;
239 TotalEnergy = CalcEnergy(A,Z,aChannel,T);
240 G4double Dc = (U - TotalEnergy)/U;
241
242 if (Dc == 0.0) {
243 Temperature = Tc;
244 return true;
245 }
246 if (Da*Dc < 0.0) {
247 T = Tc;
248 Db = Dc;
249 } else {
250 Ta = Tc;
251 Da = Dc;
252 }
253 }
254
255 Temperature = (Ta+T)*0.5;
256 return false;
257}
258
259G4double G4StatMF::CalcEnergy(G4int A, G4int Z, const G4StatMFChannel* aChannel,
260 G4double T)
261{
263 G4double ChannelEnergy = aChannel->GetFragmentsEnergy(T);
264 return -MassExcess0 + G4StatMFParameters::GetCoulomb() + ChannelEnergy;
265}
std::vector< G4Fragment * > G4FragmentVector
Definition G4Fragment.hh:65
CLHEP::HepLorentzVector G4LorentzVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
Hep3Vector boostVector() const
HepLorentzVector & boost(double, double, double)
void set(double x, double y, double z, double t)
G4double GetGroundStateMass() const
G4double GetExcitationEnergy() const
const G4LorentzVector & GetMomentum() const
G4int GetZ_asInt() const
G4int GetA_asInt() const
static G4double GetMassExcess(const G4int A, const G4int Z)
G4bool CheckFragments(void)
G4double GetFragmentsEnergy(G4double T) const
size_t GetMultiplicity(void)
G4FragmentVector * GetFragments(G4int anA, G4int anZ, G4double T)
static G4double GetMaxAverageMultiplicity(G4int A)
static G4double GetCoulomb()
G4FragmentVector * BreakItUp(const G4Fragment &theNucleus) override
Definition G4StatMF.cc:51
~G4StatMF() override
Definition G4StatMF.cc:45