source: trunk/source/processes/hadronic/models/de_excitation/multifragmentation/src/G4StatMFMicroManager.cc@ 1199

Last change on this file since 1199 was 1196, checked in by garnier, 16 years ago

update CVS release candidate geant4.9.3.01

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