Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4StatMFMicroManager.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//
27//
28// Hadronic Process: Nuclear De-excitations
29// by V. Lara
30
33
34// constructor
36 G4int multiplicity,
37 G4double FreeIntE, G4double SCompNuc) :
38 _Normalization(0.0)
39{
40 // Perform class initialization
41 Initialize(theFragment,multiplicity,FreeIntE,SCompNuc);
42}
43
44// destructor
46{
47 if (!_Partition.empty()) {
48 for (auto & p : _Partition) { delete p; }
49 }
50}
51
52void G4StatMFMicroManager::Initialize(const G4Fragment & theFragment, G4int im,
53 G4double FreeIntE, G4double SCompNuc)
54{
55 G4int i;
56
57 G4double U = theFragment.GetExcitationEnergy();
58
59 G4int A = theFragment.GetA_asInt();
60 G4int Z = theFragment.GetZ_asInt();
61
62 // Statistical weights
63 _WW = 0.0;
64
65 // Mean breakup multiplicity
66 _MeanMultiplicity = 0.0;
67
68 // Mean channel temperature
69 _MeanTemperature = 0.0;
70
71 // Mean channel entropy
72 _MeanEntropy = 0.0;
73
74 // Keep fragment atomic numbers
75 // G4int * FragmentAtomicNumbers = new G4int(static_cast<G4int>(A+0.5));
76 // G4int * FragmentAtomicNumbers = new G4int(m);
77 G4int FragmentAtomicNumbers[4];
78
79 // We distribute A nucleons between m fragments mantaining the order
80 // FragmentAtomicNumbers[m-1]>FragmentAtomicNumbers[m-2]>...>FragmentAtomicNumbers[0]
81 // Our initial distribution is
82 // FragmentAtomicNumbers[m-1]=A, FragmentAtomicNumbers[m-2]=0, ..., FragmentAtomicNumbers[0]=0
83 FragmentAtomicNumbers[im-1] = A;
84 for (i = 0; i < (im - 1); i++) FragmentAtomicNumbers[i] = 0;
85
86 // We try to distribute A nucleons in partitions of m fragments
87 // MakePartition return true if it is possible
88 // and false if it is not
89
90 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
91 while (MakePartition(im,FragmentAtomicNumbers)) {
92 // Allowed partitions are stored and its probability calculated
93
95 G4double PartitionProbability = 0.0;
96
97 for (i = im-1; i >= 0; i--) aPartition->SetPartitionFragment(FragmentAtomicNumbers[i]);
98 PartitionProbability = aPartition->CalcPartitionProbability(U,FreeIntE,SCompNuc);
99 _Partition.push_back(aPartition);
100
101 _WW += PartitionProbability;
102 _MeanMultiplicity += im*PartitionProbability;
103 _MeanTemperature += aPartition->GetTemperature() * PartitionProbability;
104 if (PartitionProbability > 0.0)
105 _MeanEntropy += PartitionProbability * aPartition->GetEntropy();
106 }
107}
108
109G4bool G4StatMFMicroManager::MakePartition(G4int k, G4int * ANumbers)
110// Distributes A nucleons between k fragments
111// mantaining the order ANumbers[k-1] > ANumbers[k-2] > ... > ANumbers[0]
112// If it is possible returns true. In other case returns false
113{
114 G4int l = 1;
115 // Loop checking, 05-Aug-2015, Vladimir Ivanchenko
116 while (l < k) {
117 G4int tmp = ANumbers[l-1] + ANumbers[k-1];
118 ANumbers[l-1] += 1;
119 ANumbers[k-1] -= 1;
120 if (ANumbers[l-1] > ANumbers[l] || ANumbers[k-2] > ANumbers[k-1]) {
121 ANumbers[l-1] = 1;
122 ANumbers[k-1] = tmp - 1;
123 l++;
124 } else return true;
125 }
126 return false;
127}
128
130{
131 _Normalization = Norm;
132 _WW /= Norm;
133 _MeanMultiplicity /= Norm;
134 _MeanTemperature /= Norm;
135 _MeanEntropy /= Norm;
136
137 return;
138}
139
142{
143 G4double RandNumber = _Normalization * _WW * G4UniformRand();
144 G4double AccumWeight = 0.0;
145
146 for (auto & p : _Partition) {
147 AccumWeight += p->GetProbability();
148 if (RandNumber <= AccumWeight)
149 return p->ChooseZ(A0,Z0,MeanT);
150 }
151
152 throw G4HadronicException(__FILE__, __LINE__,
153 "G4StatMFMicroManager::ChooseChannel: Couldn't find a channel.");
154 return nullptr;
155}
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
const G4double A[17]
#define G4UniformRand()
Definition Randomize.hh:52
G4double GetExcitationEnergy() const
G4int GetZ_asInt() const
G4int GetA_asInt() const
G4StatMFMicroManager(const G4Fragment &theFragment, G4int multiplicity, G4double FreeIntE, G4double SCompNuc)
void Normalize(G4double Norm)
G4StatMFChannel * ChooseChannel(G4int A0, G4int Z0, G4double MeanT)
G4double CalcPartitionProbability(G4double U, G4double FreeInternalE0, G4double SCompound)