Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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// $Id$
28//
29// Hadronic Process: Nuclear De-excitations
30// by V. Lara
31
32
35
36
37// Copy constructor
39{
40 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroManager::copy_constructor meant to not be accessable");
41}
42
43// Operators
44
45G4StatMFMicroManager & G4StatMFMicroManager::
46operator=(const G4StatMFMicroManager & )
47{
48 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroManager::operator= meant to not be accessable");
49 return *this;
50}
51
52
54{
55 return false;
56}
57
58
60{
61 return true;
62}
63
64
65
66// constructor
67G4StatMFMicroManager::G4StatMFMicroManager(const G4Fragment & theFragment, const G4int multiplicity,
68 const G4double FreeIntE, const G4double SCompNuc) :
69 _Normalization(0.0)
70{
71 // Perform class initialization
72 Initialize(theFragment,multiplicity,FreeIntE,SCompNuc);
73}
74
75
76// destructor
78{
79 if (!_Partition.empty())
80 {
81 std::for_each(_Partition.begin(),_Partition.end(),
82 DeleteFragment());
83 }
84}
85
86
87
88// Initialization method
89
90void G4StatMFMicroManager::Initialize(const G4Fragment & theFragment, const G4int im,
91 const G4double FreeIntE, const G4double SCompNuc)
92{
93 G4int i;
94
95 G4double U = theFragment.GetExcitationEnergy();
96
97 G4double A = theFragment.GetA();
98 G4double Z = theFragment.GetZ();
99
100 // Statistical weights
101 _WW = 0.0;
102
103 // Mean breakup multiplicity
104 _MeanMultiplicity = 0.0;
105
106 // Mean channel temperature
107 _MeanTemperature = 0.0;
108
109 // Mean channel entropy
110 _MeanEntropy = 0.0;
111
112 // Keep fragment atomic numbers
113// G4int * FragmentAtomicNumbers = new G4int(static_cast<G4int>(A+0.5));
114// G4int * FragmentAtomicNumbers = new G4int(m);
115 G4int FragmentAtomicNumbers[4];
116
117 // We distribute A nucleons between m fragments mantaining the order
118 // FragmentAtomicNumbers[m-1]>FragmentAtomicNumbers[m-2]>...>FragmentAtomicNumbers[0]
119 // Our initial distribution is
120 // FragmentAtomicNumbers[m-1]=A, FragmentAtomicNumbers[m-2]=0, ..., FragmentAtomicNumbers[0]=0
121 FragmentAtomicNumbers[im-1] = static_cast<G4int>(A);
122 for (i = 0; i < (im - 1); i++) FragmentAtomicNumbers[i] = 0;
123
124 // We try to distribute A nucleons in partitions of m fragments
125 // MakePartition return true if it is possible
126 // and false if it is not
127 while (MakePartition(im,FragmentAtomicNumbers)) {
128 // Allowed partitions are stored and its probability calculated
129
130 G4StatMFMicroPartition * aPartition = new G4StatMFMicroPartition(static_cast<G4int>(A),
131 static_cast<G4int>(Z));
132 G4double PartitionProbability = 0.0;
133
134 for (i = im-1; i >= 0; i--) aPartition->SetPartitionFragment(FragmentAtomicNumbers[i]);
135 PartitionProbability = aPartition->CalcPartitionProbability(U,FreeIntE,SCompNuc);
136 _Partition.push_back(aPartition);
137
138 _WW += PartitionProbability;
139 _MeanMultiplicity += im*PartitionProbability;
140 _MeanTemperature += aPartition->GetTemperature() * PartitionProbability;
141 if (PartitionProbability > 0.0)
142 _MeanEntropy += PartitionProbability * aPartition->GetEntropy();
143
144 }
145
146
147 // garbage collection
148// delete [] FragmentAtomicNumbers;
149
150}
151
152
153G4bool G4StatMFMicroManager::MakePartition(const G4int k, G4int * ANumbers)
154 // Distributes A nucleons between k fragments
155 // mantaining the order ANumbers[k-1] > ANumbers[k-2] > ... > ANumbers[0]
156 // If it is possible returns true. In other case returns false
157{
158 G4int l = 1;
159 while (l < k) {
160 G4int tmp = ANumbers[l-1] + ANumbers[k-1];
161 ANumbers[l-1] += 1;
162 ANumbers[k-1] -= 1;
163 if (ANumbers[l-1] > ANumbers[l] || ANumbers[k-2] > ANumbers[k-1]) {
164 ANumbers[l-1] = 1;
165 ANumbers[k-1] = tmp - 1;
166 l++;
167 } else return true;
168 }
169 return false;
170}
171
172
173
175{
176 _Normalization = Norm;
177 _WW /= Norm;
178 _MeanMultiplicity /= Norm;
179 _MeanTemperature /= Norm;
180 _MeanEntropy /= Norm;
181
182 return;
183}
184
186 const G4double MeanT)
187{
188 G4double RandNumber = _Normalization * _WW * G4UniformRand();
189 G4double AccumWeight = 0.0;
190
191 for (std::vector<G4StatMFMicroPartition*>::iterator i = _Partition.begin();
192 i != _Partition.end(); ++i)
193 {
194 AccumWeight += (*i)->GetProbability();
195 if (RandNumber < AccumWeight)
196 return (*i)->ChooseZ(A0,Z0,MeanT);
197 }
198
199 throw G4HadronicException(__FILE__, __LINE__,
200 "G4StatMFMicroCanonical::ChooseChannel: Couldn't find a channel.");
201 return 0;
202}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4UniformRand()
Definition: Randomize.hh:53
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:235
G4double GetZ() const
Definition: G4Fragment.hh:278
G4double GetA() const
Definition: G4Fragment.hh:283
void Normalize(const G4double Norm)
G4bool operator!=(const G4StatMFMicroManager &right) const
G4StatMFChannel * ChooseChannel(const G4double A0, const G4double Z0, const G4double MeanT)
G4bool operator==(const G4StatMFMicroManager &right) const
G4StatMFMicroManager(const G4Fragment &theFragment, const G4int multiplicity, const G4double FreeIntE, const G4double SCompNuc)
void SetPartitionFragment(const G4int anA)
G4double CalcPartitionProbability(const G4double U, const G4double FreeInternalE0, const G4double SCompound)