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