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