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 | // |
---|
27 | // $Id: G4Evaporation.cc,v 1.12 2008/12/09 17:57:36 ahoward Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02 $ |
---|
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 | // |
---|
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) |
---|
39 | |
---|
40 | #include "G4Evaporation.hh" |
---|
41 | #include "G4EvaporationFactory.hh" |
---|
42 | #include "G4EvaporationGEMFactory.hh" |
---|
43 | #include "G4HadronicException.hh" |
---|
44 | #include <numeric> |
---|
45 | |
---|
46 | G4Evaporation::G4Evaporation() |
---|
47 | { |
---|
48 | theChannelFactory = new G4EvaporationFactory(); |
---|
49 | theChannels = theChannelFactory->GetChannel(); |
---|
50 | } |
---|
51 | |
---|
52 | G4Evaporation::G4Evaporation(const G4Evaporation &) : G4VEvaporation() |
---|
53 | { |
---|
54 | throw G4HadronicException(__FILE__, __LINE__, "G4Evaporation::copy_constructor meant to not be accessable."); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | G4Evaporation::~G4Evaporation() |
---|
59 | { |
---|
60 | if (theChannels != 0) theChannels = 0; |
---|
61 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
62 | } |
---|
63 | |
---|
64 | const G4Evaporation & G4Evaporation::operator=(const G4Evaporation &) |
---|
65 | { |
---|
66 | throw G4HadronicException(__FILE__, __LINE__, "G4Evaporation::operator= meant to not be accessable."); |
---|
67 | return *this; |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | G4bool G4Evaporation::operator==(const G4Evaporation &) const |
---|
72 | { |
---|
73 | return false; |
---|
74 | } |
---|
75 | |
---|
76 | G4bool G4Evaporation::operator!=(const G4Evaporation &) const |
---|
77 | { |
---|
78 | return true; |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | void G4Evaporation::SetDefaultChannel() |
---|
83 | { |
---|
84 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
85 | theChannelFactory = new G4EvaporationFactory(); |
---|
86 | theChannels = theChannelFactory->GetChannel(); |
---|
87 | } |
---|
88 | |
---|
89 | void G4Evaporation::SetGEMChannel() |
---|
90 | { |
---|
91 | if (theChannelFactory != 0) delete theChannelFactory; |
---|
92 | theChannelFactory = new G4EvaporationGEMFactory(); |
---|
93 | theChannels = theChannelFactory->GetChannel(); |
---|
94 | } |
---|
95 | |
---|
96 | G4FragmentVector * G4Evaporation::BreakItUp(const G4Fragment &theNucleus) |
---|
97 | { |
---|
98 | G4FragmentVector * theResult = new G4FragmentVector; |
---|
99 | |
---|
100 | // CHECK that Excitation Energy != 0 |
---|
101 | if (theNucleus.GetExcitationEnergy() <= 0.0) { |
---|
102 | theResult->push_back(new G4Fragment(theNucleus)); |
---|
103 | return theResult; |
---|
104 | } |
---|
105 | |
---|
106 | // The residual nucleus (after evaporation of each fragment) |
---|
107 | G4Fragment theResidualNucleus = theNucleus; |
---|
108 | |
---|
109 | // Number of channels |
---|
110 | G4int TotNumberOfChannels = theChannels->size(); |
---|
111 | |
---|
112 | // Starts loop over evaporated particles |
---|
113 | for (;;) |
---|
114 | |
---|
115 | { |
---|
116 | // loop over evaporation channels |
---|
117 | std::vector<G4VEvaporationChannel*>::iterator i; |
---|
118 | for (i=theChannels->begin(); i != theChannels->end(); i++) |
---|
119 | { |
---|
120 | // for inverse cross section choice |
---|
121 | (*i)->SetOPTxs(OPTxs); |
---|
122 | // for superimposed Coulomb Barrier for inverse cross sections |
---|
123 | (*i)->UseSICB(useSICB); |
---|
124 | |
---|
125 | (*i)->Initialize(theResidualNucleus); |
---|
126 | } |
---|
127 | // Can't use this form beacuse Initialize is a non const member function |
---|
128 | // for_each(theChannels->begin(),theChannels->end(), |
---|
129 | // bind2nd(mem_fun(&G4VEvaporationChannel::Initialize),theResidualNucleus)); |
---|
130 | // Work out total decay probability by summing over channels |
---|
131 | G4double TotalProbability = std::accumulate(theChannels->begin(), |
---|
132 | theChannels->end(), |
---|
133 | 0.0,SumProbabilities()); |
---|
134 | |
---|
135 | if (TotalProbability <= 0.0) |
---|
136 | { |
---|
137 | // Will be no evaporation more |
---|
138 | // write information about residual nucleus |
---|
139 | theResult->push_back(new G4Fragment(theResidualNucleus)); |
---|
140 | break; |
---|
141 | } |
---|
142 | else |
---|
143 | { |
---|
144 | // Selection of evaporation channel, fission or gamma |
---|
145 | // G4double * EmissionProbChannel = new G4double(TotNumberOfChannels); |
---|
146 | std::vector<G4double> EmissionProbChannel; |
---|
147 | EmissionProbChannel.reserve(theChannels->size()); |
---|
148 | |
---|
149 | |
---|
150 | // EmissionProbChannel[0] = theChannels->at(0)->GetEmissionProbability(); |
---|
151 | |
---|
152 | |
---|
153 | G4double first = theChannels->front()->GetEmissionProbability(); |
---|
154 | |
---|
155 | EmissionProbChannel.push_back(first >0 ? first : 0); // index 0 |
---|
156 | |
---|
157 | |
---|
158 | // EmissionProbChannel.push_back(theChannels->front()->GetEmissionProbability()); // index 0 |
---|
159 | |
---|
160 | for (i= (theChannels->begin()+1); i != theChannels->end(); i++) |
---|
161 | { |
---|
162 | // EmissionProbChannel[i] = EmissionProbChannel[i-1] + |
---|
163 | // theChannels->at(i)->GetEmissionProbability(); |
---|
164 | // EmissionProbChannel.push_back(EmissionProbChannel.back() + (*i)->GetEmissionProbability()); |
---|
165 | first = (*i)->GetEmissionProbability(); |
---|
166 | EmissionProbChannel.push_back(first> 0? EmissionProbChannel.back() + first : EmissionProbChannel.back()); |
---|
167 | } |
---|
168 | |
---|
169 | G4double shoot = G4UniformRand() * TotalProbability; |
---|
170 | G4int j; |
---|
171 | for (j=0; j < TotNumberOfChannels; j++) |
---|
172 | { |
---|
173 | // if (shoot < EmissionProbChannel[i]) |
---|
174 | if (shoot < EmissionProbChannel[j]) |
---|
175 | break; |
---|
176 | } |
---|
177 | |
---|
178 | // delete [] EmissionProbChannel; |
---|
179 | EmissionProbChannel.clear(); |
---|
180 | |
---|
181 | if( j >= TotNumberOfChannels ) |
---|
182 | { |
---|
183 | G4cerr << " Residual A: " << theResidualNucleus.GetA() << " Residual Z: " << theResidualNucleus.GetZ() << " Excitation Energy: " << theResidualNucleus.GetExcitationEnergy() << G4endl; |
---|
184 | G4cerr << " j has not chosen a channel, j = " << j << " TotNumberOfChannels " << TotNumberOfChannels << " Total Probability: " << TotalProbability << G4endl; |
---|
185 | for (j=0; j < TotNumberOfChannels; j++) |
---|
186 | { |
---|
187 | G4cerr << " j: " << j << " EmissionProbChannel: " << EmissionProbChannel[j] << " and shoot: " << shoot << " (<ProbChannel?) " << G4endl; |
---|
188 | } |
---|
189 | throw G4HadronicException(__FILE__, __LINE__, "G4Evaporation::BreakItUp: Can't define emission probability of the channels!" ); |
---|
190 | } |
---|
191 | else |
---|
192 | { |
---|
193 | // Perform break-up |
---|
194 | G4FragmentVector * theEvaporationResult = (*theChannels)[j]->BreakUp(theResidualNucleus); |
---|
195 | |
---|
196 | #ifdef debug |
---|
197 | G4cout << "-----------------------------------------------------------\n"; |
---|
198 | G4cout << G4endl << " After the evaporation of a particle, testing conservation \n"; |
---|
199 | CheckConservation(theResidualNucleus,theEvaporationResult); |
---|
200 | G4cout << G4endl |
---|
201 | << "------------------------------------------------------------\n"; |
---|
202 | #endif |
---|
203 | |
---|
204 | // Check if chosen channel is fission (there are only two EXCITED fragments) |
---|
205 | // or the channel could not evaporate anything |
---|
206 | if ( theEvaporationResult->size() == 1 || |
---|
207 | ((*(theEvaporationResult->begin()))->GetExcitationEnergy() > 0.0 && |
---|
208 | (*(theEvaporationResult->end()-1))->GetExcitationEnergy() > 0.0) ) { |
---|
209 | // FISSION |
---|
210 | for (G4FragmentVector::iterator i = theEvaporationResult->begin(); |
---|
211 | i != theEvaporationResult->end(); ++i) |
---|
212 | { |
---|
213 | theResult->push_back(*(i)); |
---|
214 | } |
---|
215 | delete theEvaporationResult; |
---|
216 | break; |
---|
217 | } else { |
---|
218 | // EVAPORATION |
---|
219 | for (G4FragmentVector::iterator i = theEvaporationResult->begin(); |
---|
220 | i != theEvaporationResult->end()-1; ++i) |
---|
221 | { |
---|
222 | #ifdef PRECOMPOUND_TEST |
---|
223 | if ((*i)->GetA() == 0) (*i)->SetCreatorModel(G4String("G4PhotonEvaporation")); |
---|
224 | #endif |
---|
225 | theResult->push_back(*(i)); |
---|
226 | } |
---|
227 | theResidualNucleus = *(theEvaporationResult->back()); |
---|
228 | delete theEvaporationResult->back(); |
---|
229 | delete theEvaporationResult; |
---|
230 | #ifdef PRECOMPOUND_TEST |
---|
231 | theResidualNucleus.SetCreatorModel(G4String("ResidualNucleus")); |
---|
232 | #endif |
---|
233 | |
---|
234 | } |
---|
235 | } |
---|
236 | } |
---|
237 | } |
---|
238 | |
---|
239 | #ifdef debug |
---|
240 | G4cout << "======== Evaporation Conservation Test ===========\n" |
---|
241 | << "==================================================\n"; |
---|
242 | CheckConservation(theNucleus,theResult); |
---|
243 | G4cout << "==================================================\n"; |
---|
244 | #endif |
---|
245 | return theResult; |
---|
246 | } |
---|
247 | |
---|
248 | |
---|
249 | |
---|
250 | #ifdef debug |
---|
251 | void G4Evaporation::CheckConservation(const G4Fragment & theInitialState, |
---|
252 | G4FragmentVector * Result) const |
---|
253 | { |
---|
254 | G4double ProductsEnergy =0; |
---|
255 | G4ThreeVector ProductsMomentum; |
---|
256 | G4int ProductsA = 0; |
---|
257 | G4int ProductsZ = 0; |
---|
258 | for (G4FragmentVector::iterator h = Result->begin(); h != Result->end(); h++) { |
---|
259 | G4LorentzVector tmp = (*h)->GetMomentum(); |
---|
260 | ProductsEnergy += tmp.e(); |
---|
261 | ProductsMomentum += tmp.vect(); |
---|
262 | ProductsA += static_cast<G4int>((*h)->GetA()); |
---|
263 | ProductsZ += static_cast<G4int>((*h)->GetZ()); |
---|
264 | } |
---|
265 | |
---|
266 | if (ProductsA != theInitialState.GetA()) { |
---|
267 | G4cout << "!!!!!!!!!! Baryonic Number Conservation Violation !!!!!!!!!!" << G4endl; |
---|
268 | G4cout << "G4Evaporation.cc: Barionic Number Conservation test for evaporation fragments" |
---|
269 | << G4endl; |
---|
270 | G4cout << "Initial A = " << theInitialState.GetA() |
---|
271 | << " Fragments A = " << ProductsA << " Diference --> " |
---|
272 | << theInitialState.GetA() - ProductsA << G4endl; |
---|
273 | } |
---|
274 | if (ProductsZ != theInitialState.GetZ()) { |
---|
275 | G4cout << "!!!!!!!!!! Charge Conservation Violation !!!!!!!!!!" << G4endl; |
---|
276 | G4cout << "G4Evaporation.cc: Charge Conservation test for evaporation fragments" |
---|
277 | << G4endl; |
---|
278 | G4cout << "Initial Z = " << theInitialState.GetZ() |
---|
279 | << " Fragments Z = " << ProductsZ << " Diference --> " |
---|
280 | << theInitialState.GetZ() - ProductsZ << G4endl; |
---|
281 | } |
---|
282 | if (std::abs(ProductsEnergy-theInitialState.GetMomentum().e()) > 1.0*keV) { |
---|
283 | G4cout << "!!!!!!!!!! Energy Conservation Violation !!!!!!!!!!" << G4endl; |
---|
284 | G4cout << "G4Evaporation.cc: Energy Conservation test for evaporation fragments" |
---|
285 | << G4endl; |
---|
286 | G4cout << "Initial E = " << theInitialState.GetMomentum().e()/MeV << " MeV" |
---|
287 | << " Fragments E = " << ProductsEnergy/MeV << " MeV Diference --> " |
---|
288 | << (theInitialState.GetMomentum().e() - ProductsEnergy)/MeV << " MeV" << G4endl; |
---|
289 | } |
---|
290 | if (std::abs(ProductsMomentum.x()-theInitialState.GetMomentum().x()) > 1.0*keV || |
---|
291 | std::abs(ProductsMomentum.y()-theInitialState.GetMomentum().y()) > 1.0*keV || |
---|
292 | std::abs(ProductsMomentum.z()-theInitialState.GetMomentum().z()) > 1.0*keV) { |
---|
293 | G4cout << "!!!!!!!!!! Momentum Conservation Violation !!!!!!!!!!" << G4endl; |
---|
294 | G4cout << "G4Evaporation.cc: Momentum Conservation test for evaporation fragments" |
---|
295 | << G4endl; |
---|
296 | G4cout << "Initial P = " << theInitialState.GetMomentum().vect() << " MeV" |
---|
297 | << " Fragments P = " << ProductsMomentum << " MeV Diference --> " |
---|
298 | << theInitialState.GetMomentum().vect() - ProductsMomentum << " MeV" << G4endl; |
---|
299 | } |
---|
300 | return; |
---|
301 | } |
---|
302 | #endif |
---|
303 | |
---|
304 | |
---|
305 | |
---|
306 | |
---|