Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4StatMFMicroManager.cc,v 1.6 2008/07/25 11:20:47 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-02 $ 27 // 29 // 28 // Hadronic Process: Nuclear De-excitations 30 // Hadronic Process: Nuclear De-excitations 29 // by V. Lara 31 // by V. Lara 30 32 >> 33 31 #include "G4StatMFMicroManager.hh" 34 #include "G4StatMFMicroManager.hh" 32 #include "G4HadronicException.hh" 35 #include "G4HadronicException.hh" 33 36 >> 37 34 // Copy constructor 38 // Copy constructor 35 G4StatMFMicroManager::G4StatMFMicroManager(con 39 G4StatMFMicroManager::G4StatMFMicroManager(const G4StatMFMicroManager & ) 36 { 40 { 37 throw G4HadronicException(__FILE__, __LINE << 41 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroManager::copy_constructor meant to not be accessable"); 38 } 42 } 39 43 40 // Operators 44 // Operators 41 45 42 G4StatMFMicroManager & G4StatMFMicroManager:: 46 G4StatMFMicroManager & G4StatMFMicroManager:: 43 operator=(const G4StatMFMicroManager & ) 47 operator=(const G4StatMFMicroManager & ) 44 { 48 { 45 throw G4HadronicException(__FILE__, __LINE << 49 throw G4HadronicException(__FILE__, __LINE__, "G4StatMFMicroManager::operator= meant to not be accessable"); 46 return *this; 50 return *this; 47 } 51 } 48 52 49 53 50 G4bool G4StatMFMicroManager::operator==(const 54 G4bool G4StatMFMicroManager::operator==(const G4StatMFMicroManager & ) const 51 { 55 { 52 return false; 56 return false; 53 } 57 } 54 58 55 59 56 G4bool G4StatMFMicroManager::operator!=(const 60 G4bool G4StatMFMicroManager::operator!=(const G4StatMFMicroManager & ) const 57 { 61 { 58 return true; 62 return true; 59 } 63 } 60 64 >> 65 >> 66 61 // constructor 67 // constructor 62 G4StatMFMicroManager::G4StatMFMicroManager(con << 68 G4StatMFMicroManager::G4StatMFMicroManager(const G4Fragment & theFragment, const G4int multiplicity, 63 G4int multiplicity, << 69 const G4double FreeIntE, const G4double SCompNuc) : 64 G4double FreeIntE, G4double SComp << 70 _Normalization(0.0) 65 _Normalization(0.0) << 66 { 71 { 67 // Perform class initialization << 72 // Perform class initialization 68 Initialize(theFragment,multiplicity,FreeIntE << 73 Initialize(theFragment,multiplicity,FreeIntE,SCompNuc); 69 } 74 } 70 75 >> 76 71 // destructor 77 // destructor 72 G4StatMFMicroManager::~G4StatMFMicroManager() 78 G4StatMFMicroManager::~G4StatMFMicroManager() 73 { 79 { 74 if (!_Partition.empty()) 80 if (!_Partition.empty()) 75 { 81 { 76 std::for_each(_Partition.begin(),_Partit 82 std::for_each(_Partition.begin(),_Partition.end(), 77 DeleteFragment()); 83 DeleteFragment()); 78 } 84 } 79 } 85 } 80 86 81 void G4StatMFMicroManager::Initialize(const G4 << 87 82 G4double FreeIntE, G4double SCom << 88 >> 89 // Initialization method >> 90 >> 91 void G4StatMFMicroManager::Initialize(const G4Fragment & theFragment, const G4int m, >> 92 const G4double FreeIntE, const G4double SCompNuc) 83 { 93 { 84 G4int i; << 94 G4int i; 85 95 86 G4double U = theFragment.GetExcitationEnergy << 96 G4double U = theFragment.GetExcitationEnergy(); 87 97 88 G4int A = theFragment.GetA_asInt(); << 98 G4double A = theFragment.GetA(); 89 G4int Z = theFragment.GetZ_asInt(); << 99 G4double Z = theFragment.GetZ(); 90 100 91 // Statistical weights << 101 // Statistical weights 92 _WW = 0.0; << 102 _WW = 0.0; 93 103 94 // Mean breakup multiplicity << 104 // Mean breakup multiplicity 95 _MeanMultiplicity = 0.0; << 105 _MeanMultiplicity = 0.0; 96 106 97 // Mean channel temperature << 107 // Mean channel temperature 98 _MeanTemperature = 0.0; << 108 _MeanTemperature = 0.0; 99 109 100 // Mean channel entropy << 110 // Mean channel entropy 101 _MeanEntropy = 0.0; << 111 _MeanEntropy = 0.0; 102 112 103 // Keep fragment atomic numbers << 113 // Keep fragment atomic numbers 104 // G4int * FragmentAtomicNumbers = new G4in << 114 // G4int * FragmentAtomicNumbers = new G4int(static_cast<G4int>(A+0.5)); 105 // G4int * FragmentAtomicNumbers = new G4in << 115 // G4int * FragmentAtomicNumbers = new G4int(m); 106 G4int FragmentAtomicNumbers[4]; << 116 G4int FragmentAtomicNumbers[4]; 107 117 108 // We distribute A nucleons between m fragme << 118 // We distribute A nucleons between m fragments mantaining the order 109 // FragmentAtomicNumbers[m-1]>FragmentAtomic << 119 // FragmentAtomicNumbers[m-1]>FragmentAtomicNumbers[m-2]>...>FragmentAtomicNumbers[0] 110 // Our initial distribution is << 120 // Our initial distribution is 111 // FragmentAtomicNumbers[m-1]=A, FragmentAto << 121 // FragmentAtomicNumbers[m-1]=A, FragmentAtomicNumbers[m-2]=0, ..., FragmentAtomicNumbers[0]=0 112 FragmentAtomicNumbers[im-1] = A; << 122 FragmentAtomicNumbers[m-1] = static_cast<G4int>(A); 113 for (i = 0; i < (im - 1); i++) FragmentAtom << 123 for (i = 0; i < (m - 1); i++) FragmentAtomicNumbers[i] = 0; 114 << 124 115 // We try to distribute A nucleons in partit << 125 // We try to distribute A nucleons in partitions of m fragments 116 // MakePartition return true if it is possib << 126 // MakePartition return true if it is possible 117 // and false if it is not << 127 // and false if it is not 118 << 128 while (MakePartition(m,FragmentAtomicNumbers)) { 119 // Loop checking, 05-Aug-2015, Vladimir Ivan << 129 // Allowed partitions are stored and its probability calculated 120 while (MakePartition(im,FragmentAtomicNumber << 121 // Allowed partitions are stored and its p << 122 130 123 G4StatMFMicroPartition * aPartition = new << 131 G4StatMFMicroPartition * aPartition = new G4StatMFMicroPartition(static_cast<G4int>(A), 124 G4double PartitionProbability = 0.0; << 132 static_cast<G4int>(Z)); >> 133 G4double PartitionProbability = 0.0; 125 134 126 for (i = im-1; i >= 0; i--) aPartition->Se << 135 for (i = m-1; i >= 0; i--) aPartition->SetPartitionFragment(FragmentAtomicNumbers[i]); 127 PartitionProbability = aPartition->CalcPar << 136 PartitionProbability = aPartition->CalcPartitionProbability(U,FreeIntE,SCompNuc); 128 _Partition.push_back(aPartition); << 137 _Partition.push_back(aPartition); 129 138 130 _WW += PartitionProbability; << 139 _WW += PartitionProbability; 131 _MeanMultiplicity += im*PartitionProbabili << 140 _MeanMultiplicity += m*PartitionProbability; 132 _MeanTemperature += aPartition->GetTempera << 141 _MeanTemperature += aPartition->GetTemperature() * PartitionProbability; 133 if (PartitionProbability > 0.0) << 142 if (PartitionProbability > 0.0) 134 _MeanEntropy += PartitionProbability * a << 143 _MeanEntropy += PartitionProbability * aPartition->GetEntropy(); 135 } << 144 136 } << 145 } 137 << 146 138 G4bool G4StatMFMicroManager::MakePartition(G4i << 147 139 // Distributes A nucleons between k fragments << 148 // garbage collection 140 // mantaining the order ANumbers[k-1] > ANumbe << 149 // delete [] FragmentAtomicNumbers; 141 // If it is possible returns true. In other ca << 150 142 { << 151 } 143 G4int l = 1; << 152 144 // Loop checking, 05-Aug-2015, Vladimir Ivan << 153 145 while (l < k) { << 154 G4bool G4StatMFMicroManager::MakePartition(const G4int k, G4int * ANumbers) 146 G4int tmp = ANumbers[l-1] + ANumbers[k-1]; << 155 // Distributes A nucleons between k fragments 147 ANumbers[l-1] += 1; << 156 // mantaining the order ANumbers[k-1] > ANumbers[k-2] > ... > ANumbers[0] 148 ANumbers[k-1] -= 1; << 157 // If it is possible returns true. In other case returns false 149 if (ANumbers[l-1] > ANumbers[l] || ANumber << 158 { 150 ANumbers[l-1] = 1; << 159 G4int l = 1; 151 ANumbers[k-1] = tmp - 1; << 160 while (l < k) { 152 l++; << 161 G4int tmp = ANumbers[l-1] + ANumbers[k-1]; 153 } else return true; << 162 ANumbers[l-1] += 1; 154 } << 163 ANumbers[k-1] -= 1; 155 return false; << 164 if (ANumbers[l-1] > ANumbers[l] || ANumbers[k-2] > ANumbers[k-1]) { 156 } << 165 ANumbers[l-1] = 1; 157 << 166 ANumbers[k-1] = tmp - 1; 158 void G4StatMFMicroManager::Normalize(G4double << 167 l++; 159 { << 168 } else return true; 160 _Normalization = Norm; << 169 } 161 _WW /= Norm; << 170 return false; 162 _MeanMultiplicity /= Norm; << 171 } 163 _MeanTemperature /= Norm; << 172 164 _MeanEntropy /= Norm; << 173 165 << 174 166 return; << 175 void G4StatMFMicroManager::Normalize(const G4double Norm) >> 176 { >> 177 _Normalization = Norm; >> 178 _WW /= Norm; >> 179 _MeanMultiplicity /= Norm; >> 180 _MeanTemperature /= Norm; >> 181 _MeanEntropy /= Norm; >> 182 >> 183 return; 167 } 184 } 168 185 169 G4StatMFChannel* << 186 G4StatMFChannel * G4StatMFMicroManager::ChooseChannel(const G4double A0, const G4double Z0, 170 G4StatMFMicroManager::ChooseChannel(G4int A0, << 187 const G4double MeanT) 171 { 188 { 172 G4double RandNumber = _Normalization * _WW * << 189 G4double RandNumber = _Normalization * _WW * G4UniformRand(); 173 G4double AccumWeight = 0.0; << 190 G4double AccumWeight = 0.0; 174 191 175 for (std::vector<G4StatMFMicroPartition*>::i << 192 for (std::vector<G4StatMFMicroPartition*>::iterator i = _Partition.begin(); 176 i != _Partition.end(); ++i) << 193 i != _Partition.end(); ++i) 177 { 194 { 178 AccumWeight += (*i)->GetProbability(); 195 AccumWeight += (*i)->GetProbability(); 179 if (RandNumber < AccumWeight) 196 if (RandNumber < AccumWeight) 180 return (*i)->ChooseZ(A0,Z0,MeanT); << 197 return (*i)->ChooseZ(A0,Z0,MeanT); 181 } 198 } 182 199 183 throw G4HadronicException(__FILE__, __LINE__ << 200 throw G4HadronicException(__FILE__, __LINE__, 184 "G4StatMFMicroCanonical::ChooseChann << 201 "G4StatMFMicroCanonical::ChooseChannel: Couldn't find a channel."); 185 return 0; << 202 return 0; 186 } 203 } 187 204