Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4StatMFMacroCanonical.cc
이 파일의 문서화 페이지로 가기
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 // $Id: G4StatMFMacroCanonical.cc 100379 2016-10-19 15:05:35Z gcosmo $
28 //
29 // by V. Lara
30 // --------------------------------------------------------------------
31 //
32 // Modified:
33 // 25.07.08 I.Pshenichnov (in collaboration with Alexander Botvina and Igor
34 // Mishustin (FIAS, Frankfurt, INR, Moscow and Kurchatov Institute,
35 // Moscow, pshenich@fias.uni-frankfurt.de) fixed infinite loop for
36 // a fagment with Z=A; fixed memory leak
37 
39 #include "G4PhysicalConstants.hh"
40 #include "G4SystemOfUnits.hh"
41 #include "G4Pow.hh"
42 
43 // constructor
45 {
46 
47  // Get memory for clusters
48  _theClusters.push_back(new G4StatMFMacroNucleon); // Size 1
49  _theClusters.push_back(new G4StatMFMacroBiNucleon); // Size 2
50  _theClusters.push_back(new G4StatMFMacroTriNucleon); // Size 3
51  _theClusters.push_back(new G4StatMFMacroTetraNucleon); // Size 4
52  for (G4int i = 4; i < theFragment.GetA_asInt(); i++)
53  _theClusters.push_back(new G4StatMFMacroMultiNucleon(i+1)); // Size 5 ... A
54 
55  // Perform class initialization
56  Initialize(theFragment);
57 
58 }
59 
60 // destructor
62 {
63  // garbage collection
64  if (!_theClusters.empty())
65  {
66  std::for_each(_theClusters.begin(),_theClusters.end(),DeleteFragment());
67  }
68 }
69 
70 // Initialization method
72 {
73 
74  G4int A = theFragment.GetA_asInt();
75  G4int Z = theFragment.GetZ_asInt();
76  G4double x = 1.0 - 2.0*Z/G4double(A);
77  G4Pow* g4calc = G4Pow::GetInstance();
78 
79  // Free Internal energy at T = 0
80  __FreeInternalE0 = A*( -G4StatMFParameters::GetE0() + // Volume term (for T = 0)
81  G4StatMFParameters::GetGamma0()*x*x) // Symmetry term
82  + G4StatMFParameters::GetBeta0()*g4calc->Z23(A) + // Surface term (for T = 0)
83  0.6*elm_coupling*Z*Z/(G4StatMFParameters::Getr0()* // Coulomb term
84  g4calc->Z13(A));
85 
86  CalculateTemperature(theFragment);
87  return;
88 }
89 
91 {
92  // Excitation Energy
93  G4double U = theFragment.GetExcitationEnergy();
94 
95  G4int A = theFragment.GetA_asInt();
96  G4int Z = theFragment.GetZ_asInt();
97 
98  // Fragment Multiplicity
99  G4double FragMult = std::max((1.0+(2.31/MeV)*(U/A - 3.5*MeV))*A/100.0, 2.0);
100 
101  // Parameter Kappa
102  G4Pow* g4calc = G4Pow::GetInstance();
103  _Kappa = (1.0+elm_coupling*(g4calc->A13(FragMult)-1)/
104  (G4StatMFParameters::Getr0()*g4calc->Z13(A)));
105  _Kappa = _Kappa*_Kappa*_Kappa - 1.0;
106 
107  G4StatMFMacroTemperature * theTemp = new
109 
110  __MeanTemperature = theTemp->CalcTemperature();
114  __MeanEntropy = theTemp->GetEntropy();
115 
116  delete theTemp;
117 
118  return;
119 }
120 
121 // --------------------------------------------------------------------------
122 
124 // Calculate total fragments multiplicity, fragment atomic numbers and charges
125 {
126  G4int A = theFragment.GetA_asInt();
127  G4int Z = theFragment.GetZ_asInt();
128 
129  std::vector<G4int> ANumbers(A);
130 
131  G4double Multiplicity = ChooseA(A,ANumbers);
132 
133  std::vector<G4int> FragmentsA;
134 
135  G4int i = 0;
136  for (i = 0; i < A; i++)
137  {
138  for (G4int j = 0; j < ANumbers[i]; j++) FragmentsA.push_back(i+1);
139  }
140 
141  // Sort fragments in decreasing order
142  G4int im = 0;
143  for (G4int j = 0; j < Multiplicity; j++)
144  {
145  G4int FragmentsAMax = 0;
146  im = j;
147  for (i = j; i < Multiplicity; i++)
148  {
149  if (FragmentsA[i] <= FragmentsAMax) { continue; }
150  else
151  {
152  im = i;
153  FragmentsAMax = FragmentsA[im];
154  }
155  }
156  if (im != j)
157  {
158  FragmentsA[im] = FragmentsA[j];
159  FragmentsA[j] = FragmentsAMax;
160  }
161  }
162  return ChooseZ(Z,FragmentsA);
163 }
164 
165 G4double G4StatMFMacroCanonical::ChooseA(G4int A, std::vector<G4int> & ANumbers)
166  // Determines fragments multiplicities and compute total fragment multiplicity
167 {
168  G4double multiplicity = 0.0;
169  G4int i;
170 
171  std::vector<G4double> AcumMultiplicity;
172  AcumMultiplicity.reserve(A);
173 
174  AcumMultiplicity.push_back((*(_theClusters.begin()))->GetMeanMultiplicity());
175  for (std::vector<G4VStatMFMacroCluster*>::iterator it = _theClusters.begin()+1;
176  it != _theClusters.end(); ++it)
177  {
178  AcumMultiplicity.push_back((*it)->GetMeanMultiplicity()+AcumMultiplicity.back());
179  }
180 
181  G4int CheckA;
182  do {
183  CheckA = -1;
184  G4int SumA = 0;
185  G4int ThisOne = 0;
186  multiplicity = 0.0;
187  for (i = 0; i < A; i++) ANumbers[i] = 0;
188  do {
190  for (i = 0; i < A; i++) {
191  if (RandNumber < AcumMultiplicity[i]) {
192  ThisOne = i;
193  break;
194  }
195  }
196  multiplicity++;
197  ANumbers[ThisOne] = ANumbers[ThisOne]+1;
198  SumA += ThisOne+1;
199  CheckA = A - SumA;
200 
201  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
202  } while (CheckA > 0);
203 
204  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
205  } while (CheckA < 0 || std::abs(__MeanMultiplicity - multiplicity) > std::sqrt(__MeanMultiplicity) + 0.5);
206 
207  return multiplicity;
208 }
209 
211  std::vector<G4int> & FragmentsA)
212  //
213 {
214  G4Pow* g4calc = G4Pow::GetInstance();
215  std::vector<G4int> FragmentsZ;
216 
217  G4int DeltaZ = 0;
219  G4int multiplicity = FragmentsA.size();
220 
221  do {
222  FragmentsZ.clear();
223  G4int SumZ = 0;
224  for (G4int i = 0; i < multiplicity; i++)
225  {
226  G4int A = FragmentsA[i];
227  if (A <= 1)
228  {
229  G4double RandNumber = G4UniformRand();
230  if (RandNumber < (*_theClusters.begin())->GetZARatio())
231  {
232  FragmentsZ.push_back(1);
233  SumZ += FragmentsZ[i];
234  }
235  else FragmentsZ.push_back(0);
236  }
237  else
238  {
239  G4double RandZ;
241  + 2*CP*g4calc->Z23(FragmentsA[i]);
242  G4double ZMean;
243  if (FragmentsA[i] > 1 && FragmentsA[i] < 5) { ZMean = 0.5*FragmentsA[i]; }
244  else {
245  ZMean = FragmentsA[i]*(4.0*G4StatMFParameters::GetGamma0()
246  + _ChemPotentialNu)/CC;
247  }
248  G4double ZDispersion = std::sqrt(FragmentsA[i]*__MeanTemperature/CC);
249  G4int z;
250  do
251  {
252  RandZ = G4RandGauss::shoot(ZMean,ZDispersion);
253  z = G4lrint(RandZ+0.5);
254  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
255  } while (z < 0 || z > A);
256  FragmentsZ.push_back(z);
257  SumZ += z;
258  }
259  }
260  DeltaZ = Z - SumZ;
261  // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
262  } while (std::abs(DeltaZ) > 1);
263 
264  // DeltaZ can be 0, 1 or -1
265  G4int idx = 0;
266  if (DeltaZ < 0.0)
267  {
268  while (FragmentsZ[idx] < 1) { ++idx; }
269  }
270  FragmentsZ[idx] += DeltaZ;
271 
272  G4StatMFChannel * theChannel = new G4StatMFChannel;
273  for (G4int i = multiplicity-1; i >= 0; i--)
274  {
275  theChannel->CreateFragment(FragmentsA[i],FragmentsZ[i]);
276  }
277 
278  return theChannel;
279 }
Float_t x
Definition: compare.C:6
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double Z13(G4int Z) const
Definition: G4Pow.hh:132
G4double A13(G4double A) const
Definition: G4Pow.cc:138
static constexpr double MeV
Definition: G4SIunits.hh:214
G4double GetEntropy(void) const
Double_t z
G4int GetA_asInt() const
Definition: G4Fragment.hh:259
static G4double GetE0()
static G4double GetCoulomb()
std::vector< G4VStatMFMacroCluster * > _theClusters
G4double GetMeanMultiplicity(void) const
G4double GetChemicalPotentialNu(void) const
static G4double Getr0()
Float_t Z
void CreateFragment(G4int A, G4int Z)
double G4double
Definition: G4Types.hh:76
static G4Pow * GetInstance()
Definition: G4Pow.cc:57
static constexpr double elm_coupling
#define G4UniformRand()
Definition: Randomize.hh:53
void Initialize(const G4Fragment &theFragment)
double A(double temperature)
G4int GetZ_asInt() const
Definition: G4Fragment.hh:264
ThreeVector shoot(const G4int Ap, const G4int Af)
G4StatMFChannel * ChooseZ(G4int &Z, std::vector< G4int > &FragmentsA)
void CalculateTemperature(const G4Fragment &theFragment)
G4double ChooseA(G4int A, std::vector< G4int > &ANumbers)
int G4lrint(double ad)
Definition: templates.hh:151
int G4int
Definition: G4Types.hh:78
Definition: G4Pow.hh:56
G4double GetChemicalPotentialMu(void) const
static G4double GetBeta0()
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:276
G4double Z23(G4int Z) const
Definition: G4Pow.hh:137
static G4double GetGamma0()
G4StatMFChannel * ChooseAandZ(const G4Fragment &theFragment)