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