Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/de_excitation/ablation/src/G4WilsonAblationModel.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/de_excitation/ablation/src/G4WilsonAblationModel.cc (Version 11.3.0) and /processes/hadronic/models/de_excitation/ablation/src/G4WilsonAblationModel.cc (Version 7.1)


  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 // *                                               18 // *                                                                  *
 21 // * Parts of this code which have been  devel     19 // * Parts of this code which have been  developed by QinetiQ Ltd     *
 22 // * under contract to the European Space Agen <<  20 // * under contract to the European Space Agency (ESA) are the        *
 23 // * intellectual property of ESA. Rights to u     21 // * intellectual property of ESA. Rights to use, copy, modify and    *
 24 // * redistribute this software for general pu     22 // * redistribute this software for general public use are granted    *
 25 // * in compliance with any licensing, distrib     23 // * in compliance with any licensing, distribution and development   *
 26 // * policy adopted by the Geant4 Collaboratio     24 // * policy adopted by the Geant4 Collaboration. This code has been   *
 27 // * written by QinetiQ Ltd for the European S     25 // * written by QinetiQ Ltd for the European Space Agency, under ESA  *
 28 // * contract 17191/03/NL/LvH (Aurora Programm <<  26 // * contract 17191/03/NL/LvH (Aurora Programme).           *
 29 // *                                               27 // *                                                                  *
 30 // * By using,  copying,  modifying or  distri <<  28 // * By copying,  distributing  or modifying the Program (or any work *
 31 // * any work based  on the software)  you  ag <<  29 // * based  on  the Program)  you indicate  your  acceptance of  this *
 32 // * use  in  resulting  scientific  publicati <<  30 // * statement, and all its terms.                                    *
 33 // * acceptance of all terms of the Geant4 Sof << 
 34 // *******************************************     31 // ********************************************************************
 35 //                                                 32 //
 36 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     33 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 37 //                                                 34 //
 38 // MODULE:              G4WilsonAblationModel.     35 // MODULE:              G4WilsonAblationModel.cc
 39 //                                                 36 //
 40 // Version:   1.0                              <<  37 // Version:   B.1
 41 // Date:    08/12/2009                         <<  38 // Date:    15/04/04
 42 // Author:    P R Truscott                         39 // Author:    P R Truscott
 43 // Organisation:  QinetiQ Ltd, UK                  40 // Organisation:  QinetiQ Ltd, UK
 44 // Customer:    ESA/ESTEC, NOORDWIJK               41 // Customer:    ESA/ESTEC, NOORDWIJK
 45 // Contract:    17191/03/NL/LvH                    42 // Contract:    17191/03/NL/LvH
 46 //                                                 43 //
 47 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     44 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 48 //                                                 45 //
 49 // CHANGE HISTORY                                  46 // CHANGE HISTORY
 50 // --------------                                  47 // --------------
 51 //                                                 48 //
 52 // 6 October 2003, P R Truscott, QinetiQ Ltd,      49 // 6 October 2003, P R Truscott, QinetiQ Ltd, UK
 53 // Created.                                        50 // Created.
 54 //                                                 51 //
 55 // 15 March 2004, P R Truscott, QinetiQ Ltd, U     52 // 15 March 2004, P R Truscott, QinetiQ Ltd, UK
 56 // Beta release                                    53 // Beta release
 57 //                                                 54 //
 58 // 08 December 2009, P R Truscott, QinetiQ Ltd << 
 59 // Ver 1.0                                     << 
 60 // Updated as a result of changes in the G4Eva << 
 61 // affect mostly SelectSecondariesByEvaporatio << 
 62 // associated with the evaporation model which << 
 63 //    OPTxs to select the inverse cross-sectio << 
 64 //    OPTxs = 0      => Dostrovski's parameter << 
 65 //    OPTxs = 1 or 2 => Chatterjee's paramater << 
 66 //    OPTxs = 3 or 4 => Kalbach's parameteriza << 
 67 //    useSICB        => use superimposed Coulo << 
 68 //                      sections               << 
 69 // Other problem found with G4Fragment definit << 
 70 // **G4ParticleDefinition**.  This does not al << 
 71 // fragment for some reason.  Now the fragment << 
 72 //    G4Fragment *fragment = new G4Fragment(A, << 
 73 // to avoid this quirk.  Bug found in SelectSe << 
 74 // equated to evapType[i] whereas previously i << 
 75 //                                             << 
 76 // 06 August 2015, A. Ribon, CERN              << 
 77 // Migrated std::exp and std::pow to the faste << 
 78 //                                             << 
 79 // 09 June 2017, C. Mancini Terracciano, INFN  << 
 80 // Fixed bug on the initialization of Photon E << 
 81 //                                             << 
 82 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     55 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 83 //////////////////////////////////////////////     56 ////////////////////////////////////////////////////////////////////////////////
 84 //                                                 57 //
 85 #include <iomanip>                             << 
 86 #include <numeric>                             << 
 87                                                << 
 88 #include "G4WilsonAblationModel.hh"                58 #include "G4WilsonAblationModel.hh"
 89 #include "G4PhysicalConstants.hh"              << 
 90 #include "G4SystemOfUnits.hh"                  << 
 91 #include "Randomize.hh"                            59 #include "Randomize.hh"
 92 #include "G4ParticleTable.hh"                      60 #include "G4ParticleTable.hh"
 93 #include "G4IonTable.hh"                           61 #include "G4IonTable.hh"
 94 #include "G4Alpha.hh"                              62 #include "G4Alpha.hh"
 95 #include "G4He3.hh"                                63 #include "G4He3.hh"
 96 #include "G4Triton.hh"                             64 #include "G4Triton.hh"
 97 #include "G4Deuteron.hh"                           65 #include "G4Deuteron.hh"
 98 #include "G4Proton.hh"                             66 #include "G4Proton.hh"
 99 #include "G4Neutron.hh"                            67 #include "G4Neutron.hh"
100 #include "G4AlphaEvaporationChannel.hh"            68 #include "G4AlphaEvaporationChannel.hh"
101 #include "G4He3EvaporationChannel.hh"              69 #include "G4He3EvaporationChannel.hh"
102 #include "G4TritonEvaporationChannel.hh"           70 #include "G4TritonEvaporationChannel.hh"
103 #include "G4DeuteronEvaporationChannel.hh"         71 #include "G4DeuteronEvaporationChannel.hh"
104 #include "G4ProtonEvaporationChannel.hh"           72 #include "G4ProtonEvaporationChannel.hh"
105 #include "G4NeutronEvaporationChannel.hh"          73 #include "G4NeutronEvaporationChannel.hh"
106 #include "G4PhotonEvaporation.hh"              << 
107 #include "G4LorentzVector.hh"                      74 #include "G4LorentzVector.hh"
108 #include "G4VEvaporationChannel.hh"                75 #include "G4VEvaporationChannel.hh"
109                                                    76 
110 #include "G4Exp.hh"                            <<  77 #include <iomanip>
111 #include "G4Pow.hh"                            <<  78 #include <numeric>
112                                                << 
113 #include "G4PhysicsModelCatalog.hh"            << 
114                                                << 
115 //////////////////////////////////////////////     79 ////////////////////////////////////////////////////////////////////////////////
116 //                                                 80 //
117 G4WilsonAblationModel::G4WilsonAblationModel()     81 G4WilsonAblationModel::G4WilsonAblationModel()
118 {                                                  82 {
119 //                                                 83 //
120 //                                                 84 //
121 // Send message to stdout to advise that the G     85 // Send message to stdout to advise that the G4Abrasion model is being used.
122 //                                                 86 //
123   PrintWelcomeMessage();                           87   PrintWelcomeMessage();
124 //                                                 88 //
125 //                                                 89 //
126 // Set the default verbose level to 0 - no out     90 // Set the default verbose level to 0 - no output.
127 //                                                 91 //
128   verboseLevel = 0;                                92   verboseLevel = 0;  
129 //                                                 93 //
130 //                                                 94 //
131 // Set the binding energy per nucleon .... did     95 // Set the binding energy per nucleon .... did I mention that this is a crude
132 // model for nuclear de-excitation?                96 // model for nuclear de-excitation?
133 //                                                 97 //
134   B = 10.0 * MeV;                                  98   B = 10.0 * MeV;
135 //                                                 99 //
136 //                                                100 //
137 // It is possuble to switch off secondary part    101 // It is possuble to switch off secondary particle production (other than the
138 // final nuclear fragment).  The default is on    102 // final nuclear fragment).  The default is on.
139 //                                                103 //
140   produceSecondaries = true;                      104   produceSecondaries = true;
141 //                                                105 //
142 //                                                106 //
143 // Now we need to define the decay modes.  We'    107 // Now we need to define the decay modes.  We're using the G4Evaporation model
144 // to help determine the kinematics of the dec    108 // to help determine the kinematics of the decay.
145 //                                                109 //
146   nFragTypes  = 6;                                110   nFragTypes  = 6;
147   fragType[0] = G4Alpha::Alpha();                 111   fragType[0] = G4Alpha::Alpha();
148   fragType[1] = G4He3::He3();                     112   fragType[1] = G4He3::He3();
149   fragType[2] = G4Triton::Triton();               113   fragType[2] = G4Triton::Triton();
150   fragType[3] = G4Deuteron::Deuteron();           114   fragType[3] = G4Deuteron::Deuteron();
151   fragType[4] = G4Proton::Proton();               115   fragType[4] = G4Proton::Proton();
152   fragType[5] = G4Neutron::Neutron();             116   fragType[5] = G4Neutron::Neutron();
153   for(G4int i=0; i<200; ++i) { fSig[i] = 0.0;  << 
154 //                                                117 //
155 //                                                118 //
156 // Set verboseLevel default to no output.         119 // Set verboseLevel default to no output.
157 //                                                120 //
158   verboseLevel = 0;                               121   verboseLevel = 0;
159   theChannelFactory = new G4EvaporationFactory << 
160   theChannels = theChannelFactory->GetChannel( << 
161 //                                             << 
162 //                                             << 
163 // Set defaults for evaporation classes.  Thes << 
164 // "set" methods.                              << 
165 //                                             << 
166   OPTxs   = 3;                                 << 
167   useSICB = false;                             << 
168   fragmentVector = 0;                          << 
169                                                << 
170   secID = G4PhysicsModelCatalog::GetModelID("m << 
171 }                                                 122 }
172 //////////////////////////////////////////////    123 ////////////////////////////////////////////////////////////////////////////////
173 //                                                124 //
174 G4WilsonAblationModel::~G4WilsonAblationModel(    125 G4WilsonAblationModel::~G4WilsonAblationModel()
175 {}                                             << 126 {;}
176                                                << 
177 //////////////////////////////////////////////    127 ////////////////////////////////////////////////////////////////////////////////
178 //                                                128 //
179 G4FragmentVector *G4WilsonAblationModel::Break    129 G4FragmentVector *G4WilsonAblationModel::BreakItUp
180   (const G4Fragment &theNucleus)                  130   (const G4Fragment &theNucleus)
181 {                                                 131 {
182 //                                                132 //
183 //                                                133 //
184 // Initilise the pointer to the G4FragmentVect    134 // Initilise the pointer to the G4FragmentVector used to return the information
185 // about the breakup.                             135 // about the breakup.
186 //                                                136 //
187   fragmentVector = new G4FragmentVector;          137   fragmentVector = new G4FragmentVector;
188   fragmentVector->clear();                        138   fragmentVector->clear();
189 //                                                139 //
190 //                                                140 //
191 // Get the A, Z and excitation of the nucleus.    141 // Get the A, Z and excitation of the nucleus.
192 //                                                142 //
193   G4int A     = theNucleus.GetA_asInt();       << 143   G4int A     = (G4int) theNucleus.GetA();
194   G4int Z     = theNucleus.GetZ_asInt();       << 144   G4int Z     = (G4int) theNucleus.GetZ();
195   G4double ex = theNucleus.GetExcitationEnergy    145   G4double ex = theNucleus.GetExcitationEnergy();
196   if (verboseLevel >= 2)                          146   if (verboseLevel >= 2)
197   {                                               147   {
198     G4cout <<"oooooooooooooooooooooooooooooooo    148     G4cout <<"oooooooooooooooooooooooooooooooooooooooo"
199            <<"oooooooooooooooooooooooooooooooo    149            <<"oooooooooooooooooooooooooooooooooooooooo"
200            <<G4endl;                              150            <<G4endl;
201     G4cout.precision(6);                          151     G4cout.precision(6);
202     G4cout <<"IN G4WilsonAblationModel" <<G4en    152     G4cout <<"IN G4WilsonAblationModel" <<G4endl;
203     G4cout <<"Initial prefragment A=" <<A         153     G4cout <<"Initial prefragment A=" <<A
204            <<", Z=" <<Z                           154            <<", Z=" <<Z
205            <<", excitation energy = " <<ex/MeV    155            <<", excitation energy = " <<ex/MeV <<" MeV"
206            <<G4endl;                              156            <<G4endl; 
207   }                                               157   }
208 //                                                158 //
209 //                                                159 //
210 // Check that there is a nucleus to speak of.     160 // Check that there is a nucleus to speak of.  It's possible there isn't one
211 // or its just a proton or neutron.  In either    161 // or its just a proton or neutron.  In either case, the excitation energy
212 // (from the Lorentz vector) is not used.         162 // (from the Lorentz vector) is not used.
213 //                                                163 //
214   if (A == 0)                                     164   if (A == 0)
215   {                                               165   {
216     if (verboseLevel >= 2)                        166     if (verboseLevel >= 2)
217     {                                             167     {
218       G4cout <<"No nucleus to decay" <<G4endl;    168       G4cout <<"No nucleus to decay" <<G4endl;
219       G4cout <<"oooooooooooooooooooooooooooooo    169       G4cout <<"oooooooooooooooooooooooooooooooooooooooo"
220              <<"oooooooooooooooooooooooooooooo    170              <<"oooooooooooooooooooooooooooooooooooooooo"
221              <<G4endl;                            171              <<G4endl;
222     }                                             172     }
223     return fragmentVector;                        173     return fragmentVector;
224   }                                               174   }
225   else if (A == 1)                                175   else if (A == 1)
226   {                                               176   {
227     G4LorentzVector lorentzVector = theNucleus    177     G4LorentzVector lorentzVector = theNucleus.GetMomentum();
228     lorentzVector.setE(lorentzVector.e()-ex+10    178     lorentzVector.setE(lorentzVector.e()-ex+10.0*eV);
229     if (Z == 0)                                   179     if (Z == 0)
230     {                                             180     {
231       G4Fragment *fragment = new G4Fragment(lo    181       G4Fragment *fragment = new G4Fragment(lorentzVector,G4Neutron::Neutron());
232       if (fragment != nullptr) { fragment->Set << 
233       fragmentVector->push_back(fragment);        182       fragmentVector->push_back(fragment);
234     }                                             183     }
235     else                                          184     else
236     {                                             185     {
237       G4Fragment *fragment = new G4Fragment(lo    186       G4Fragment *fragment = new G4Fragment(lorentzVector,G4Proton::Proton());
238       if (fragment != nullptr) { fragment->Set << 
239       fragmentVector->push_back(fragment);        187       fragmentVector->push_back(fragment);
240     }                                             188     }
241     if (verboseLevel >= 2)                        189     if (verboseLevel >= 2)
242     {                                             190     {
243       G4cout <<"Final fragment is in fact only    191       G4cout <<"Final fragment is in fact only a nucleon) :" <<G4endl;
244       G4cout <<(*fragmentVector)[0] <<G4endl;     192       G4cout <<(*fragmentVector)[0] <<G4endl;
245       G4cout <<"oooooooooooooooooooooooooooooo    193       G4cout <<"oooooooooooooooooooooooooooooooooooooooo"
246              <<"oooooooooooooooooooooooooooooo    194              <<"oooooooooooooooooooooooooooooooooooooooo"
247              <<G4endl;                            195              <<G4endl;
248     }                                             196     }
249     return fragmentVector;                        197     return fragmentVector;
250   }                                               198   }
251 //                                                199 //
252 //                                                200 //
253 // Then the number of nucleons ablated (either    201 // Then the number of nucleons ablated (either as nucleons or light nuclear
254 // fragments) is based on a simple argument fo    202 // fragments) is based on a simple argument for the binding energy per nucleon.
255 //                                                203 //
256   G4int DAabl = (G4int) (ex / B);                 204   G4int DAabl = (G4int) (ex / B);
257   if (DAabl > A) DAabl = A;                       205   if (DAabl > A) DAabl = A;
258 // The following lines are no longer accurate  << 206   if (verboseLevel >= 2)
259 //  if (verboseLevel >= 2)                     << 207     G4cout <<"Number of nucleons ejected = " <<DAabl <<G4endl;
260 //    G4cout <<"Number of nucleons ejected = " << 
261                                                   208 
262 //                                                209 //
263 //                                                210 //
264 // Determine the nuclear fragment from the abl    211 // Determine the nuclear fragment from the ablation process by sampling the
265 // Rudstam equation.                              212 // Rudstam equation.
266 //                                                213 //
267   G4int AF = A - DAabl;                           214   G4int AF = A - DAabl;
268   G4int ZF = 0;                                   215   G4int ZF = 0;
269                                                << 
270   if (AF > 0)                                     216   if (AF > 0)
271   {                                               217   {
272     G4Pow* g4calc = G4Pow::GetInstance();      << 218     G4double AFd = static_cast<G4double>(AF);
273     G4double AFd = (G4double) AF;              << 219     G4double R = 11.8 / std::pow(AFd, 0.45);
274     G4double R = 11.8 / g4calc->powZ(AF, 0.45) << 220     G4int minZ = Z - DAabl;
275     G4int minZ = std::max(1, Z - DAabl);       << 221     if (minZ <= 0) minZ = 1;
276 //                                                222 //
277 //                                                223 //
278 // Here we define an integral probability dist    224 // Here we define an integral probability distribution based on the Rudstam
279 // equation assuming a constant AF.               225 // equation assuming a constant AF.
280 //                                                226 //    
281     G4int zmax = std::min(199, Z);             << 227     G4double sig[100];
282     G4double sum = 0.0;                           228     G4double sum = 0.0;
283     for (ZF=minZ; ZF<=zmax; ++ZF)              << 229     for (G4int ii=minZ; ii<= Z; ii++)
284     {                                             230     {
285       sum += G4Exp(-R*g4calc->powA(std::abs(ZF << 231       sum   += std::exp(-R*std::pow(std::abs(ii - 0.486*AFd + 3.8E-04*AFd*AFd),1.5));
286       fSig[ZF] = sum;                          << 232       sig[ii] = sum;
287     }                                             233     }
288 //                                                234 //
289 //                                                235 //
290 // Now sample that distribution to determine a    236 // Now sample that distribution to determine a value for ZF.
291 //                                                237 //
292     sum *= G4UniformRand();                    << 238     G4double xi  = G4UniformRand();
293     for (ZF=minZ; ZF<=zmax; ++ZF) {            << 239     G4int iz     = minZ;
294       if(sum <= fSig[ZF]) { break; }           << 240     G4bool found = false;
295     }                                          << 241     while (iz <= Z && !found)
                                                   >> 242     {
                                                   >> 243       found = (xi <= sig[iz]/sum);
                                                   >> 244       if (!found) iz++;
                                                   >> 245     }
                                                   >> 246     if (iz > Z)
                                                   >> 247       ZF = Z;
                                                   >> 248     else
                                                   >> 249       ZF = iz;
296   }                                               250   }
297   G4int DZabl = Z - ZF;                           251   G4int DZabl = Z - ZF;
                                                   >> 252   if (verboseLevel >= 2)
                                                   >> 253     G4cout <<"Final fragment      A=" <<AF
                                                   >> 254            <<", Z=" <<ZF
                                                   >> 255            <<G4endl;
298 //                                                256 //
299 //                                                257 //
300 // Now determine the nucleons or nuclei which     258 // Now determine the nucleons or nuclei which have bee ablated.  The preference
301 // is for the production of alphas, then other    259 // is for the production of alphas, then other nuclei in order of decreasing
302 // binding energy. The energies assigned to th    260 // binding energy. The energies assigned to the products of the decay are
303 // provisional for the moment (the 10eV is jus    261 // provisional for the moment (the 10eV is just to avoid errors with negative
304 // excitation energies due to rounding).          262 // excitation energies due to rounding).
305 //                                                263 //
306   G4double totalEpost = 0.0;                      264   G4double totalEpost = 0.0;
307   evapType.clear();                               265   evapType.clear();
308   for (G4int ift=0; ift<nFragTypes; ift++)        266   for (G4int ift=0; ift<nFragTypes; ift++)
309   {                                               267   {
310     G4ParticleDefinition *type = fragType[ift]    268     G4ParticleDefinition *type = fragType[ift];
311     G4double n  = std::floor((G4double) DAabl     269     G4double n  = std::floor((G4double) DAabl / type->GetBaryonNumber() + 1.0E-10);
312     G4double n1 = 1.0E+10;                        270     G4double n1 = 1.0E+10;
313     if (fragType[ift]->GetPDGCharge() > 0.0)      271     if (fragType[ift]->GetPDGCharge() > 0.0)
314       n1 = std::floor((G4double) DZabl / type-    272       n1 = std::floor((G4double) DZabl / type->GetPDGCharge() + 1.0E-10);
315     if (n > n1) n = n1;                           273     if (n > n1) n = n1;
316     if (n > 0.0)                                  274     if (n > 0.0)
317     {                                             275     {
318       G4double mass = type->GetPDGMass();         276       G4double mass = type->GetPDGMass();
319       for (G4int j=0; j<(G4int) n; j++)           277       for (G4int j=0; j<(G4int) n; j++)
320       {                                           278       {
321         totalEpost += mass;                       279         totalEpost += mass;
322         evapType.push_back(type);                 280         evapType.push_back(type);
323       }                                           281       }
324       DAabl -= (G4int) (n * type->GetBaryonNum    282       DAabl -= (G4int) (n * type->GetBaryonNumber() + 1.0E-10);
325       DZabl -= (G4int) (n * type->GetPDGCharge    283       DZabl -= (G4int) (n * type->GetPDGCharge() + 1.0E-10);
                                                   >> 284       if (verboseLevel >= 2)
                                                   >> 285         G4cout <<"Particle type: " <<std::setw(10) <<type->GetParticleName()
                                                   >> 286                <<", number of particles emitted = " <<n
                                                   >> 287                <<G4endl;
326     }                                             288     }
327   }                                               289   }
328 //                                                290 //
329 //                                                291 //
330 // Determine the properties of the final nucle << 292 // Determine the properties of the final nuclear fragment.
331 // the final fragment is predicted to have a n << 
332 // really it's the particle last in the vector << 
333 // final fragment.  Therefore delete this from << 
334 // case.                                       << 
335 //                                                293 //
336   G4double massFinalFrag = 0.0;                   294   G4double massFinalFrag = 0.0;
337   if (AF > 0)                                  << 295   if (AF > 0.0)
338     massFinalFrag = G4ParticleTable::GetPartic    296     massFinalFrag = G4ParticleTable::GetParticleTable()->GetIonTable()->
339       GetIonMass(ZF,AF);                          297       GetIonMass(ZF,AF);
340   else                                         << 
341   {                                            << 
342     G4ParticleDefinition *type = evapType[evap << 
343     AF                         = type->GetBary << 
344     ZF                         = (G4int) (type << 
345     evapType.erase(evapType.end()-1);          << 
346   }                                            << 
347   totalEpost   += massFinalFrag;                  298   totalEpost   += massFinalFrag;
348 //                                                299 //
349 //                                                300 //
350 // Provide verbose output on the nuclear fragm << 
351 //                                             << 
352   if (verboseLevel >= 2)                       << 
353   {                                            << 
354     G4cout <<"Final fragment      A=" <<AF     << 
355            <<", Z=" <<ZF                       << 
356            <<G4endl;                           << 
357     for (G4int ift=0; ift<nFragTypes; ift++)   << 
358     {                                          << 
359       G4ParticleDefinition *type = fragType[if << 
360       G4long n = std::count(evapType.cbegin(), << 
361       if (n > 0)                               << 
362         G4cout <<"Particle type: " <<std::setw << 
363                <<", number of particles emitte << 
364     }                                          << 
365   }                                            << 
366 //                                             << 
367 // Add the total energy from the fragment.  No    301 // Add the total energy from the fragment.  Note that the fragment is assumed
368 // to be de-excited and does not undergo photo    302 // to be de-excited and does not undergo photo-evaporation .... I did mention
369 // this is a bit of a crude model?                303 // this is a bit of a crude model?
370 //                                                304 //
371   G4double massPreFrag      = theNucleus.GetGr    305   G4double massPreFrag      = theNucleus.GetGroundStateMass();
372   G4double totalEpre        = massPreFrag + ex    306   G4double totalEpre        = massPreFrag + ex;
373   G4double excess           = totalEpre - tota    307   G4double excess           = totalEpre - totalEpost;
374 //  G4Fragment *resultNucleus(theNucleus);        308 //  G4Fragment *resultNucleus(theNucleus);
375   G4Fragment *resultNucleus = new G4Fragment(A    309   G4Fragment *resultNucleus = new G4Fragment(A, Z, theNucleus.GetMomentum());
376   G4ThreeVector boost(0.0,0.0,0.0);               310   G4ThreeVector boost(0.0,0.0,0.0);
377   std::size_t nEvap = 0;                       << 311   G4int nEvap = 0;
378   if (produceSecondaries && evapType.size()>0)    312   if (produceSecondaries && evapType.size()>0)
379   {                                               313   {
380     if (excess > 0.0)                             314     if (excess > 0.0)
381     {                                             315     {
382       SelectSecondariesByEvaporation (resultNu    316       SelectSecondariesByEvaporation (resultNucleus);
383       nEvap = fragmentVector->size();             317       nEvap = fragmentVector->size();
384       boost = resultNucleus->GetMomentum().fin    318       boost = resultNucleus->GetMomentum().findBoostToCM();
385       if (evapType.size() > 0)                    319       if (evapType.size() > 0)
386         SelectSecondariesByDefault (boost);       320         SelectSecondariesByDefault (boost);
387     }                                             321     }
388     else                                          322     else
389       SelectSecondariesByDefault(G4ThreeVector    323       SelectSecondariesByDefault(G4ThreeVector(0.0,0.0,0.0));
390   }                                               324   }
391                                                << 
392   if (AF > 0)                                     325   if (AF > 0)
393   {                                               326   {
394     G4double mass = G4ParticleTable::GetPartic    327     G4double mass = G4ParticleTable::GetParticleTable()->GetIonTable()->
395       GetIonMass(ZF,AF);                          328       GetIonMass(ZF,AF);
396     G4double e    = mass + 10.0*eV;               329     G4double e    = mass + 10.0*eV;
397     G4double p    = std::sqrt(e*e-mass*mass);     330     G4double p    = std::sqrt(e*e-mass*mass);
398     G4ThreeVector direction(0.0,0.0,1.0);         331     G4ThreeVector direction(0.0,0.0,1.0);
399     G4LorentzVector lorentzVector = G4LorentzV    332     G4LorentzVector lorentzVector = G4LorentzVector(direction*p, e);
400     lorentzVector.boost(-boost);                  333     lorentzVector.boost(-boost);
401     G4Fragment* frag = new G4Fragment(AF, ZF,  << 334     *resultNucleus = G4Fragment(AF, ZF, lorentzVector);
402     if (frag != nullptr) { frag->SetCreatorMod << 335     fragmentVector->push_back(resultNucleus);
403     fragmentVector->push_back(frag);           << 
404   }                                               336   }
405   delete resultNucleus;                        << 
406 //                                                337 //
407 //                                                338 //
408 // Provide verbose output on the ablation prod    339 // Provide verbose output on the ablation products if requested.
409 //                                                340 //
410   if (verboseLevel >= 2)                          341   if (verboseLevel >= 2)
411   {                                               342   {
412     if (nEvap > 0)                                343     if (nEvap > 0)
413     {                                             344     {
414       G4cout <<"----------------------" <<G4en    345       G4cout <<"----------------------" <<G4endl;
415       G4cout <<"Evaporated particles :" <<G4en    346       G4cout <<"Evaporated particles :" <<G4endl;
416       G4cout <<"----------------------" <<G4en    347       G4cout <<"----------------------" <<G4endl;
417     }                                             348     }
418     std::size_t ie = 0;                        << 349     G4int ie = 0;
419     for (auto iter = fragmentVector->cbegin(); << 350     G4FragmentVector::iterator iter;
420               iter != fragmentVector->cend();  << 351     for (iter = fragmentVector->begin(); iter != fragmentVector->end(); ++iter)
421     {                                             352     {
422       if (ie == nEvap)                            353       if (ie == nEvap)
423       {                                           354       {
424 //        G4cout <<*iter  <<G4endl;            << 355         G4cout <<*iter  <<G4endl;
425         G4cout <<"----------------------------    356         G4cout <<"---------------------------------" <<G4endl;
426         G4cout <<"Particles from default emiss    357         G4cout <<"Particles from default emission :" <<G4endl;
427         G4cout <<"----------------------------    358         G4cout <<"---------------------------------" <<G4endl;
428       }                                           359       }
429       G4cout <<*iter <<G4endl;                    360       G4cout <<*iter <<G4endl;
430     }                                             361     }
431     G4cout <<"oooooooooooooooooooooooooooooooo    362     G4cout <<"oooooooooooooooooooooooooooooooooooooooo"
432            <<"oooooooooooooooooooooooooooooooo    363            <<"oooooooooooooooooooooooooooooooooooooooo"
433            <<G4endl;                              364            <<G4endl;
434   }                                               365   }
435                                                   366 
436   return fragmentVector;                          367   return fragmentVector;    
437 }                                                 368 }
438 //////////////////////////////////////////////    369 ////////////////////////////////////////////////////////////////////////////////
439 //                                                370 //
440 void G4WilsonAblationModel::SelectSecondariesB    371 void G4WilsonAblationModel::SelectSecondariesByEvaporation
441   (G4Fragment *intermediateNucleus)               372   (G4Fragment *intermediateNucleus)
442 {                                                 373 {
443   G4Fragment theResidualNucleus = *intermediat << 
444   G4bool evaporate = true;                        374   G4bool evaporate = true;
445   // Loop checking, 05-Aug-2015, Vladimir Ivan << 
446   while (evaporate && evapType.size() != 0)       375   while (evaporate && evapType.size() != 0)
447   {                                               376   {
448 //                                                377 //
449 //                                                378 //
450 // Here's the cheaky bit.  We're hijacking the    379 // Here's the cheaky bit.  We're hijacking the G4Evaporation model, in order to
451 // more accurately sample to kinematics, but t    380 // more accurately sample to kinematics, but the species of the nuclear
452 // fragments will be the ones of our choosing     381 // fragments will be the ones of our choosing as above.
453 //                                                382 //
454     std::vector <G4VEvaporationChannel*>  theC << 383     std::vector <G4VEvaporationChannel*>  theChannels;
455     theChannels1.clear();                      << 384     theChannels.clear();
456     std::vector <G4VEvaporationChannel*>::iter << 
457     VectorOfFragmentTypes::iterator iter;         385     VectorOfFragmentTypes::iterator iter;
458     std::vector <VectorOfFragmentTypes::iterat    386     std::vector <VectorOfFragmentTypes::iterator> iters;
459     iters.clear();                                387     iters.clear();
460     iter = std::find(evapType.begin(), evapTyp    388     iter = std::find(evapType.begin(), evapType.end(), G4Alpha::Alpha());
461     if (iter != evapType.end())                   389     if (iter != evapType.end())
462     {                                             390     {
463       theChannels1.push_back(new G4AlphaEvapor << 391       theChannels.push_back(new G4AlphaEvaporationChannel);
464       i = theChannels1.end() - 1;              << 
465       (*i)->SetOPTxs(OPTxs);                   << 
466       (*i)->UseSICB(useSICB);                  << 
467 //      (*i)->Initialize(theResidualNucleus);  << 
468       iters.push_back(iter);                      392       iters.push_back(iter);
469     }                                             393     }
470     iter = std::find(evapType.begin(), evapTyp    394     iter = std::find(evapType.begin(), evapType.end(), G4He3::He3());
471     if (iter != evapType.end())                   395     if (iter != evapType.end())
472     {                                             396     {
473       theChannels1.push_back(new G4He3Evaporat << 397       theChannels.push_back(new G4He3EvaporationChannel);
474       i = theChannels1.end() - 1;              << 
475       (*i)->SetOPTxs(OPTxs);                   << 
476       (*i)->UseSICB(useSICB);                  << 
477 //      (*i)->Initialize(theResidualNucleus);  << 
478       iters.push_back(iter);                      398       iters.push_back(iter);
479     }                                             399     }
480     iter = std::find(evapType.begin(), evapTyp    400     iter = std::find(evapType.begin(), evapType.end(), G4Triton::Triton());
481     if (iter != evapType.end())                   401     if (iter != evapType.end())
482     {                                             402     {
483       theChannels1.push_back(new G4TritonEvapo << 403       theChannels.push_back(new G4TritonEvaporationChannel);
484       i = theChannels1.end() - 1;              << 
485       (*i)->SetOPTxs(OPTxs);                   << 
486       (*i)->UseSICB(useSICB);                  << 
487 //      (*i)->Initialize(theResidualNucleus);  << 
488       iters.push_back(iter);                      404       iters.push_back(iter);
489     }                                             405     }
490     iter = std::find(evapType.begin(), evapTyp    406     iter = std::find(evapType.begin(), evapType.end(), G4Deuteron::Deuteron());
491     if (iter != evapType.end())                   407     if (iter != evapType.end())
492     {                                             408     {
493       theChannels1.push_back(new G4DeuteronEva << 409       theChannels.push_back(new G4DeuteronEvaporationChannel);
494       i = theChannels1.end() - 1;              << 
495       (*i)->SetOPTxs(OPTxs);                   << 
496       (*i)->UseSICB(useSICB);                  << 
497 //      (*i)->Initialize(theResidualNucleus);  << 
498       iters.push_back(iter);                      410       iters.push_back(iter);
499     }                                             411     }
500     iter = std::find(evapType.begin(), evapTyp    412     iter = std::find(evapType.begin(), evapType.end(), G4Proton::Proton());
501     if (iter != evapType.end())                   413     if (iter != evapType.end())
502     {                                             414     {
503       theChannels1.push_back(new G4ProtonEvapo << 415       theChannels.push_back(new G4ProtonEvaporationChannel);
504       i = theChannels1.end() - 1;              << 
505       (*i)->SetOPTxs(OPTxs);                   << 
506       (*i)->UseSICB(useSICB);                  << 
507 //      (*i)->Initialize(theResidualNucleus);  << 
508       iters.push_back(iter);                      416       iters.push_back(iter);
509     }                                             417     }
510     iter = std::find(evapType.begin(), evapTyp    418     iter = std::find(evapType.begin(), evapType.end(), G4Neutron::Neutron());
511     if (iter != evapType.end())                   419     if (iter != evapType.end())
512     {                                             420     {
513       theChannels1.push_back(new G4NeutronEvap << 421       theChannels.push_back(new G4NeutronEvaporationChannel);
514       i = theChannels1.end() - 1;              << 
515       (*i)->SetOPTxs(OPTxs);                   << 
516       (*i)->UseSICB(useSICB);                  << 
517 //      (*i)->Initialize(theResidualNucleus);  << 
518       iters.push_back(iter);                      422       iters.push_back(iter);
519     }                                             423     }
520     std::size_t nChannels = theChannels1.size( << 424     G4int nChannels = theChannels.size();
521                                                   425 
522     G4double totalProb = 0.0;                  << 426     std::vector<G4VEvaporationChannel*>::iterator iterEv;
523     G4int ich = 0;                             << 427     for (iterEv=theChannels.begin(); iterEv!=theChannels.end(); iterEv++)
524     G4double probEvapType[6] = {0.0};          << 428       (*iterEv)->Initialize(*intermediateNucleus);
525     for (auto iterEv=theChannels1.cbegin();    << 429     G4double totalProb = std::accumulate(theChannels.begin(),
526               iterEv!=theChannels1.cend(); ++i << 430       theChannels.end(), 0.0, SumProbabilities());
527       totalProb += (*iterEv)->GetEmissionProba << 431     if (totalProb > 0.0)
528       probEvapType[ich] = totalProb;           << 432     {
529       ++ich;                                   << 
530     }                                          << 
531     if (totalProb > 0.0) {                     << 
532 //                                                433 //
533 //                                                434 //
534 // The emission probability for at least one o    435 // The emission probability for at least one of the evaporation channels is
535 // positive, therefore work out which one shou    436 // positive, therefore work out which one should be selected and decay
536 // the nucleus.                                   437 // the nucleus.
537 //                                                438 //
538       G4double xi = totalProb*G4UniformRand(); << 439       G4double totalProb1      = 0.0;
539       std::size_t ii = 0;                      << 440       G4double probEvapType[6] = {0.0};
540       for (ii=0; ii<nChannels; ++ii)           << 441       for (G4int ich=0; ich<nChannels; ich++)
541       {                                           442       {
542         if (xi < probEvapType[ii]) { break; }  << 443         totalProb1      += theChannels[ich]->GetEmissionProbability();
543       }                                        << 444         probEvapType[ich]  = totalProb1 / totalProb;
544       if (ii >= nChannels) { ii = nChannels -  << 
545       G4FragmentVector *evaporationResult = th << 
546         BreakUpFragment(intermediateNucleus);  << 
547       if ((*evaporationResult)[0] != nullptr)  << 
548       {                                        << 
549         (*evaporationResult)[0]->SetCreatorMod << 
550       }                                           445       }
                                                   >> 446       G4double xi = G4UniformRand();
                                                   >> 447       G4int i     = 0;
                                                   >> 448       for (i=0; i<nChannels; i++)
                                                   >> 449         if (xi < probEvapType[i]) break;
                                                   >> 450       if (i > nChannels) i = nChannels - 1;
                                                   >> 451       G4FragmentVector *evaporationResult = theChannels[i]->
                                                   >> 452         BreakUp(*intermediateNucleus);
551       fragmentVector->push_back((*evaporationR    453       fragmentVector->push_back((*evaporationResult)[0]);
552       intermediateNucleus = (*evaporationResul << 454       *intermediateNucleus = *(*evaporationResult)[1];
                                                   >> 455       delete evaporationResult->back();
553       delete evaporationResult;                   456       delete evaporationResult;
                                                   >> 457       evapType.erase(iters[i]);
554     }                                             458     }
555     else                                          459     else
556     {                                             460     {
557 //                                                461 //
558 //                                                462 //
559 // Probability for further evaporation is nil     463 // Probability for further evaporation is nil so have to escape from this
560 // routine and set the energies of the seconda    464 // routine and set the energies of the secondaries to 10eV.
561 //                                                465 //
562       evaporate = false;                          466       evaporate = false;
563     }                                             467     }
564   }                                               468   }
565                                                   469   
566   return;                                         470   return;
567 }                                                 471 }
568 //////////////////////////////////////////////    472 ////////////////////////////////////////////////////////////////////////////////
569 //                                                473 //
570 void G4WilsonAblationModel::SelectSecondariesB    474 void G4WilsonAblationModel::SelectSecondariesByDefault (G4ThreeVector boost)
571 {                                                 475 {
572   for (std::size_t i=0; i<evapType.size(); ++i << 476   for (unsigned i=0; i<evapType.size(); i++)
573   {                                               477   {
574     G4ParticleDefinition *type = evapType[i];  << 478     G4ParticleDefinition *type = fragType[i];
575     G4double mass              = type->GetPDGM    479     G4double mass              = type->GetPDGMass();
576     G4double e                 = mass + 10.0*e    480     G4double e                 = mass + 10.0*eV;
577     G4double p                 = std::sqrt(e*e    481     G4double p                 = std::sqrt(e*e-mass*mass);
578     G4double costheta          = 2.0*G4Uniform    482     G4double costheta          = 2.0*G4UniformRand() - 1.0;
579     G4double sintheta          = std::sqrt((1.    483     G4double sintheta          = std::sqrt((1.0 - costheta)*(1.0 + costheta));
580     G4double phi               = twopi * G4Uni    484     G4double phi               = twopi * G4UniformRand() * rad;
581     G4ThreeVector direction(sintheta*std::cos(    485     G4ThreeVector direction(sintheta*std::cos(phi),sintheta*std::sin(phi),costheta);
582     G4LorentzVector lorentzVector = G4LorentzV    486     G4LorentzVector lorentzVector = G4LorentzVector(direction*p, e);
583     lorentzVector.boost(-boost);                  487     lorentzVector.boost(-boost);
584 // Possibility that the following line is not  << 
585 // from particle definition.  Force values.  P << 
586 //    G4Fragment *fragment          =          << 
587 //      new G4Fragment(lorentzVector, type);   << 
588     G4int A = type->GetBaryonNumber();         << 
589     G4int Z = (G4int) (type->GetPDGCharge() +  << 
590     G4Fragment *fragment          =               488     G4Fragment *fragment          = 
591       new G4Fragment(A, Z, lorentzVector);     << 489       new G4Fragment(lorentzVector, type);
592     if (fragment != nullptr) { fragment->SetCr << 
593     fragmentVector->push_back(fragment);          490     fragmentVector->push_back(fragment);
594   }                                               491   }
595 }                                                 492 }
596 //////////////////////////////////////////////    493 ////////////////////////////////////////////////////////////////////////////////
597 //                                                494 //
598 void G4WilsonAblationModel::PrintWelcomeMessag    495 void G4WilsonAblationModel::PrintWelcomeMessage ()
599 {                                                 496 {
600   G4cout <<G4endl;                                497   G4cout <<G4endl;
601   G4cout <<" *********************************    498   G4cout <<" *****************************************************************"
602          <<G4endl;                                499          <<G4endl;
603   G4cout <<" Nuclear ablation model for nuclea    500   G4cout <<" Nuclear ablation model for nuclear-nuclear interactions activated"
604          <<G4endl;                                501          <<G4endl;
605   G4cout <<" (Written by QinetiQ Ltd for the E    502   G4cout <<" (Written by QinetiQ Ltd for the European Space Agency)"
606          <<G4endl;                             << 
607   G4cout <<" !!! WARNING: This model is not we << 
608          <<G4endl;                                503          <<G4endl;
609   G4cout <<" *********************************    504   G4cout <<" *****************************************************************"
610          <<G4endl;                                505          <<G4endl;
611   G4cout << G4endl;                               506   G4cout << G4endl;
612                                                   507 
613   return;                                         508   return;
614 }                                                 509 }
615 //////////////////////////////////////////////    510 ////////////////////////////////////////////////////////////////////////////////
616 //                                                511 //
617                                                   512