[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[1196] | 27 | // $Id: G4Evaporation.cc,v 1.15 2009/09/16 15:32:25 vnivanch Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[819] | 29 | // |
---|
| 30 | // Hadronic Process: Nuclear De-excitations |
---|
| 31 | // by V. Lara (Oct 1998) |
---|
| 32 | // |
---|
| 33 | // Alex Howard - added protection for negative probabilities in the sum, 14/2/07 |
---|
| 34 | // |
---|
[962] | 35 | // Modif (03 September 2008) by J. M. Quesada for external choice of inverse |
---|
| 36 | // cross section option |
---|
| 37 | // JMQ (06 September 2008) Also external choices have been added for |
---|
| 38 | // superimposed Coulomb barrier (if useSICBis set true, by default is false) |
---|
[1196] | 39 | // |
---|
| 40 | // V.Ivanchenko added G4EvaporationDefaultGEMFactory option, 27/07/09 |
---|
[962] | 41 | |
---|
[819] | 42 | #include "G4Evaporation.hh" |
---|
| 43 | #include "G4EvaporationFactory.hh" |
---|
| 44 | #include "G4EvaporationGEMFactory.hh" |
---|
[1196] | 45 | #include "G4EvaporationDefaultGEMFactory.hh" |
---|
[819] | 46 | #include "G4HadronicException.hh" |
---|
| 47 | #include <numeric> |
---|
| 48 | |
---|
| 49 | G4Evaporation::G4Evaporation() |
---|
| 50 | { |
---|
| 51 | theChannelFactory = new G4EvaporationFactory(); |
---|
[1196] | 52 | //theChannelFactory = new G4EvaporationDefaultGEMFactory(); |
---|
[819] | 53 | theChannels = theChannelFactory->GetChannel(); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | G4Evaporation::~G4Evaporation() |
---|
| 57 | { |
---|
| 58 | if (theChannels != 0) theChannels = 0; |
---|
| 59 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | void G4Evaporation::SetDefaultChannel() |
---|
| 63 | { |
---|
| 64 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
| 65 | theChannelFactory = new G4EvaporationFactory(); |
---|
| 66 | theChannels = theChannelFactory->GetChannel(); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | void G4Evaporation::SetGEMChannel() |
---|
| 70 | { |
---|
| 71 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
| 72 | theChannelFactory = new G4EvaporationGEMFactory(); |
---|
| 73 | theChannels = theChannelFactory->GetChannel(); |
---|
| 74 | } |
---|
| 75 | |
---|
[1196] | 76 | void G4Evaporation::SetCombinedChannel() |
---|
| 77 | { |
---|
| 78 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
| 79 | theChannelFactory = new G4EvaporationDefaultGEMFactory(); |
---|
| 80 | theChannels = theChannelFactory->GetChannel(); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
[819] | 84 | G4FragmentVector * G4Evaporation::BreakItUp(const G4Fragment &theNucleus) |
---|
| 85 | { |
---|
| 86 | G4FragmentVector * theResult = new G4FragmentVector; |
---|
| 87 | |
---|
| 88 | // CHECK that Excitation Energy != 0 |
---|
| 89 | if (theNucleus.GetExcitationEnergy() <= 0.0) { |
---|
| 90 | theResult->push_back(new G4Fragment(theNucleus)); |
---|
| 91 | return theResult; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | // The residual nucleus (after evaporation of each fragment) |
---|
| 95 | G4Fragment theResidualNucleus = theNucleus; |
---|
| 96 | |
---|
| 97 | // Number of channels |
---|
| 98 | G4int TotNumberOfChannels = theChannels->size(); |
---|
| 99 | |
---|
| 100 | // Starts loop over evaporated particles |
---|
| 101 | for (;;) |
---|
[962] | 102 | |
---|
| 103 | { |
---|
[819] | 104 | // loop over evaporation channels |
---|
| 105 | std::vector<G4VEvaporationChannel*>::iterator i; |
---|
| 106 | for (i=theChannels->begin(); i != theChannels->end(); i++) |
---|
| 107 | { |
---|
[962] | 108 | // for inverse cross section choice |
---|
| 109 | (*i)->SetOPTxs(OPTxs); |
---|
| 110 | // for superimposed Coulomb Barrier for inverse cross sections |
---|
| 111 | (*i)->UseSICB(useSICB); |
---|
| 112 | |
---|
[819] | 113 | (*i)->Initialize(theResidualNucleus); |
---|
| 114 | } |
---|
| 115 | // Can't use this form beacuse Initialize is a non const member function |
---|
| 116 | // for_each(theChannels->begin(),theChannels->end(), |
---|
| 117 | // bind2nd(mem_fun(&G4VEvaporationChannel::Initialize),theResidualNucleus)); |
---|
| 118 | // Work out total decay probability by summing over channels |
---|
| 119 | G4double TotalProbability = std::accumulate(theChannels->begin(), |
---|
| 120 | theChannels->end(), |
---|
| 121 | 0.0,SumProbabilities()); |
---|
| 122 | |
---|
| 123 | if (TotalProbability <= 0.0) |
---|
| 124 | { |
---|
| 125 | // Will be no evaporation more |
---|
| 126 | // write information about residual nucleus |
---|
| 127 | theResult->push_back(new G4Fragment(theResidualNucleus)); |
---|
| 128 | break; |
---|
| 129 | } |
---|
| 130 | else |
---|
| 131 | { |
---|
| 132 | // Selection of evaporation channel, fission or gamma |
---|
| 133 | // G4double * EmissionProbChannel = new G4double(TotNumberOfChannels); |
---|
| 134 | std::vector<G4double> EmissionProbChannel; |
---|
| 135 | EmissionProbChannel.reserve(theChannels->size()); |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | // EmissionProbChannel[0] = theChannels->at(0)->GetEmissionProbability(); |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | G4double first = theChannels->front()->GetEmissionProbability(); |
---|
| 142 | |
---|
| 143 | EmissionProbChannel.push_back(first >0 ? first : 0); // index 0 |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | // EmissionProbChannel.push_back(theChannels->front()->GetEmissionProbability()); // index 0 |
---|
| 147 | |
---|
| 148 | for (i= (theChannels->begin()+1); i != theChannels->end(); i++) |
---|
| 149 | { |
---|
| 150 | // EmissionProbChannel[i] = EmissionProbChannel[i-1] + |
---|
| 151 | // theChannels->at(i)->GetEmissionProbability(); |
---|
| 152 | // EmissionProbChannel.push_back(EmissionProbChannel.back() + (*i)->GetEmissionProbability()); |
---|
| 153 | first = (*i)->GetEmissionProbability(); |
---|
| 154 | EmissionProbChannel.push_back(first> 0? EmissionProbChannel.back() + first : EmissionProbChannel.back()); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | G4double shoot = G4UniformRand() * TotalProbability; |
---|
| 158 | G4int j; |
---|
| 159 | for (j=0; j < TotNumberOfChannels; j++) |
---|
| 160 | { |
---|
| 161 | // if (shoot < EmissionProbChannel[i]) |
---|
| 162 | if (shoot < EmissionProbChannel[j]) |
---|
| 163 | break; |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | // delete [] EmissionProbChannel; |
---|
| 167 | EmissionProbChannel.clear(); |
---|
| 168 | |
---|
| 169 | if( j >= TotNumberOfChannels ) |
---|
| 170 | { |
---|
[962] | 171 | G4cerr << " Residual A: " << theResidualNucleus.GetA() << " Residual Z: " << theResidualNucleus.GetZ() << " Excitation Energy: " << theResidualNucleus.GetExcitationEnergy() << G4endl; |
---|
| 172 | G4cerr << " j has not chosen a channel, j = " << j << " TotNumberOfChannels " << TotNumberOfChannels << " Total Probability: " << TotalProbability << G4endl; |
---|
| 173 | for (j=0; j < TotNumberOfChannels; j++) |
---|
| 174 | { |
---|
| 175 | G4cerr << " j: " << j << " EmissionProbChannel: " << EmissionProbChannel[j] << " and shoot: " << shoot << " (<ProbChannel?) " << G4endl; |
---|
| 176 | } |
---|
[819] | 177 | throw G4HadronicException(__FILE__, __LINE__, "G4Evaporation::BreakItUp: Can't define emission probability of the channels!" ); |
---|
| 178 | } |
---|
| 179 | else |
---|
| 180 | { |
---|
| 181 | // Perform break-up |
---|
| 182 | G4FragmentVector * theEvaporationResult = (*theChannels)[j]->BreakUp(theResidualNucleus); |
---|
| 183 | |
---|
| 184 | #ifdef debug |
---|
| 185 | G4cout << "-----------------------------------------------------------\n"; |
---|
| 186 | G4cout << G4endl << " After the evaporation of a particle, testing conservation \n"; |
---|
| 187 | CheckConservation(theResidualNucleus,theEvaporationResult); |
---|
| 188 | G4cout << G4endl |
---|
| 189 | << "------------------------------------------------------------\n"; |
---|
| 190 | #endif |
---|
| 191 | |
---|
| 192 | // Check if chosen channel is fission (there are only two EXCITED fragments) |
---|
| 193 | // or the channel could not evaporate anything |
---|
| 194 | if ( theEvaporationResult->size() == 1 || |
---|
| 195 | ((*(theEvaporationResult->begin()))->GetExcitationEnergy() > 0.0 && |
---|
| 196 | (*(theEvaporationResult->end()-1))->GetExcitationEnergy() > 0.0) ) { |
---|
| 197 | // FISSION |
---|
| 198 | for (G4FragmentVector::iterator i = theEvaporationResult->begin(); |
---|
| 199 | i != theEvaporationResult->end(); ++i) |
---|
| 200 | { |
---|
| 201 | theResult->push_back(*(i)); |
---|
| 202 | } |
---|
| 203 | delete theEvaporationResult; |
---|
| 204 | break; |
---|
| 205 | } else { |
---|
| 206 | // EVAPORATION |
---|
| 207 | for (G4FragmentVector::iterator i = theEvaporationResult->begin(); |
---|
| 208 | i != theEvaporationResult->end()-1; ++i) |
---|
| 209 | { |
---|
| 210 | #ifdef PRECOMPOUND_TEST |
---|
| 211 | if ((*i)->GetA() == 0) (*i)->SetCreatorModel(G4String("G4PhotonEvaporation")); |
---|
| 212 | #endif |
---|
| 213 | theResult->push_back(*(i)); |
---|
| 214 | } |
---|
| 215 | theResidualNucleus = *(theEvaporationResult->back()); |
---|
| 216 | delete theEvaporationResult->back(); |
---|
| 217 | delete theEvaporationResult; |
---|
| 218 | #ifdef PRECOMPOUND_TEST |
---|
| 219 | theResidualNucleus.SetCreatorModel(G4String("ResidualNucleus")); |
---|
| 220 | #endif |
---|
[962] | 221 | |
---|
[819] | 222 | } |
---|
| 223 | } |
---|
| 224 | } |
---|
| 225 | } |
---|
| 226 | |
---|
| 227 | #ifdef debug |
---|
| 228 | G4cout << "======== Evaporation Conservation Test ===========\n" |
---|
| 229 | << "==================================================\n"; |
---|
| 230 | CheckConservation(theNucleus,theResult); |
---|
| 231 | G4cout << "==================================================\n"; |
---|
| 232 | #endif |
---|
| 233 | return theResult; |
---|
| 234 | } |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | #ifdef debug |
---|
| 239 | void G4Evaporation::CheckConservation(const G4Fragment & theInitialState, |
---|
| 240 | G4FragmentVector * Result) const |
---|
| 241 | { |
---|
| 242 | G4double ProductsEnergy =0; |
---|
| 243 | G4ThreeVector ProductsMomentum; |
---|
| 244 | G4int ProductsA = 0; |
---|
| 245 | G4int ProductsZ = 0; |
---|
| 246 | for (G4FragmentVector::iterator h = Result->begin(); h != Result->end(); h++) { |
---|
| 247 | G4LorentzVector tmp = (*h)->GetMomentum(); |
---|
| 248 | ProductsEnergy += tmp.e(); |
---|
| 249 | ProductsMomentum += tmp.vect(); |
---|
| 250 | ProductsA += static_cast<G4int>((*h)->GetA()); |
---|
| 251 | ProductsZ += static_cast<G4int>((*h)->GetZ()); |
---|
| 252 | } |
---|
| 253 | |
---|
| 254 | if (ProductsA != theInitialState.GetA()) { |
---|
| 255 | G4cout << "!!!!!!!!!! Baryonic Number Conservation Violation !!!!!!!!!!" << G4endl; |
---|
| 256 | G4cout << "G4Evaporation.cc: Barionic Number Conservation test for evaporation fragments" |
---|
| 257 | << G4endl; |
---|
| 258 | G4cout << "Initial A = " << theInitialState.GetA() |
---|
| 259 | << " Fragments A = " << ProductsA << " Diference --> " |
---|
| 260 | << theInitialState.GetA() - ProductsA << G4endl; |
---|
| 261 | } |
---|
| 262 | if (ProductsZ != theInitialState.GetZ()) { |
---|
| 263 | G4cout << "!!!!!!!!!! Charge Conservation Violation !!!!!!!!!!" << G4endl; |
---|
| 264 | G4cout << "G4Evaporation.cc: Charge Conservation test for evaporation fragments" |
---|
| 265 | << G4endl; |
---|
| 266 | G4cout << "Initial Z = " << theInitialState.GetZ() |
---|
| 267 | << " Fragments Z = " << ProductsZ << " Diference --> " |
---|
| 268 | << theInitialState.GetZ() - ProductsZ << G4endl; |
---|
| 269 | } |
---|
| 270 | if (std::abs(ProductsEnergy-theInitialState.GetMomentum().e()) > 1.0*keV) { |
---|
| 271 | G4cout << "!!!!!!!!!! Energy Conservation Violation !!!!!!!!!!" << G4endl; |
---|
| 272 | G4cout << "G4Evaporation.cc: Energy Conservation test for evaporation fragments" |
---|
| 273 | << G4endl; |
---|
| 274 | G4cout << "Initial E = " << theInitialState.GetMomentum().e()/MeV << " MeV" |
---|
| 275 | << " Fragments E = " << ProductsEnergy/MeV << " MeV Diference --> " |
---|
| 276 | << (theInitialState.GetMomentum().e() - ProductsEnergy)/MeV << " MeV" << G4endl; |
---|
| 277 | } |
---|
| 278 | if (std::abs(ProductsMomentum.x()-theInitialState.GetMomentum().x()) > 1.0*keV || |
---|
| 279 | std::abs(ProductsMomentum.y()-theInitialState.GetMomentum().y()) > 1.0*keV || |
---|
| 280 | std::abs(ProductsMomentum.z()-theInitialState.GetMomentum().z()) > 1.0*keV) { |
---|
| 281 | G4cout << "!!!!!!!!!! Momentum Conservation Violation !!!!!!!!!!" << G4endl; |
---|
| 282 | G4cout << "G4Evaporation.cc: Momentum Conservation test for evaporation fragments" |
---|
| 283 | << G4endl; |
---|
| 284 | G4cout << "Initial P = " << theInitialState.GetMomentum().vect() << " MeV" |
---|
| 285 | << " Fragments P = " << ProductsMomentum << " MeV Diference --> " |
---|
| 286 | << theInitialState.GetMomentum().vect() - ProductsMomentum << " MeV" << G4endl; |
---|
| 287 | } |
---|
| 288 | return; |
---|
| 289 | } |
---|
| 290 | #endif |
---|
| 291 | |
---|
| 292 | |
---|
| 293 | |
---|
| 294 | |
---|