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