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