Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PreCompoundEmission.cc
Go to the documentation of this file.
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 // $Id: G4PreCompoundEmission.cc 100378 2016-10-19 15:03:27Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4PreCompoundEmission
34 //
35 // Author: V.Lara
36 //
37 // Modified:
38 // 15.01.2010 J.M.Quesada added protection against unphysical values of parameter an
39 // 19.01.2010 V.Ivanchenko simplified computation of parameter an, sample cosTheta
40 // instead of theta; protect all calls to sqrt
41 // 20.08.2010 V.Ivanchenko added G4Pow and G4PreCompoundParameters pointers
42 // use int Z and A and cleanup
43 //
44 
45 #include "G4PreCompoundEmission.hh"
46 #include "G4PhysicalConstants.hh"
47 #include "G4SystemOfUnits.hh"
48 #include "G4Pow.hh"
49 #include "G4Exp.hh"
50 #include "G4Log.hh"
51 #include "Randomize.hh"
53 #include "G4HETCEmissionFactory.hh"
54 #include "G4HadronicException.hh"
55 #include "G4NuclearLevelData.hh"
56 #include "G4DeexPrecoParameters.hh"
57 
59 {
60  theFragmentsFactory = new G4PreCompoundEmissionFactory();
61  theFragmentsVector =
62  new G4PreCompoundFragmentVector(theFragmentsFactory->GetFragmentVector());
63  g4calc = G4Pow::GetInstance();
64  G4DeexPrecoParameters* param =
66  fLevelDensity = param->GetLevelDensity();
67  fFermiEnergy = param->GetFermiEnergy();
68 }
69 
71 {
72  delete theFragmentsFactory;
73  delete theFragmentsVector;
74 }
75 
77 {
78  if (theFragmentsFactory) { delete theFragmentsFactory; }
79  theFragmentsFactory = new G4PreCompoundEmissionFactory();
80  if (theFragmentsVector) {
81  theFragmentsVector->SetVector(theFragmentsFactory->GetFragmentVector());
82  } else {
83  theFragmentsVector =
84  new G4PreCompoundFragmentVector(theFragmentsFactory->GetFragmentVector());
85  }
86 }
87 
89 {
90  if (theFragmentsFactory) delete theFragmentsFactory;
91  theFragmentsFactory = new G4HETCEmissionFactory();
92  if (theFragmentsVector) {
93  theFragmentsVector->SetVector(theFragmentsFactory->GetFragmentVector());
94  } else {
95  theFragmentsVector =
96  new G4PreCompoundFragmentVector(theFragmentsFactory->GetFragmentVector());
97  }
98 }
99 
102 {
103  // Choose a Fragment for emission
104  G4VPreCompoundFragment * thePreFragment =
105  theFragmentsVector->ChooseFragment();
106  if (thePreFragment == 0)
107  {
108  G4cout << "G4PreCompoundEmission::PerformEmission : "
109  << "I couldn't choose a fragment\n"
110  << "while trying to de-excite\n"
111  << aFragment << G4endl;
112  throw G4HadronicException(__FILE__, __LINE__, "");
113  }
114 
115  //G4cout << "Chosen fragment: " << G4endl;
116  //G4cout << *thePreFragment << G4endl;
117 
118  // Kinetic Energy of emitted fragment
119  G4double kinEnergy = thePreFragment->SampleKineticEnergy(aFragment);
120  // if(kinEnergy < MeV) {
121  // G4cout << "Chosen fragment: " << G4endl;
122  // G4cout << *thePreFragment << G4endl;
123  // G4cout << "Ekin= " << kinEnergy << G4endl;
124  // }
125  kinEnergy = std::max(kinEnergy, 0.0);
126 
127  // Calculate the fragment momentum (three vector)
128  AngularDistribution(thePreFragment,aFragment,kinEnergy);
129 
130  // Mass of emittef fragment
131  G4double EmittedMass = thePreFragment->GetNuclearMass();
132  // Now we can calculate the four momentum
133  // both options are valid and give the same result but 2nd one is faster
134  G4LorentzVector Emitted4Momentum(theFinalMomentum,EmittedMass + kinEnergy);
135 
136  // Perform Lorentz boost
137  G4LorentzVector Rest4Momentum = aFragment.GetMomentum();
138  Emitted4Momentum.boost(Rest4Momentum.boostVector());
139 
140  // Set emitted fragment momentum
141  thePreFragment->SetMomentum(Emitted4Momentum);
142 
143  // NOW THE RESIDUAL NUCLEUS
144  // ------------------------
145 
146  Rest4Momentum -= Emitted4Momentum;
147 
148  // Update nucleus parameters:
149  // --------------------------
150 
151  // Z and A
152  aFragment.SetZandA_asInt(thePreFragment->GetRestZ(),
153  thePreFragment->GetRestA());
154 
155  // Number of excitons
156  aFragment.SetNumberOfParticles(aFragment.GetNumberOfParticles()-
157  thePreFragment->GetA());
158  // Number of charges
159  aFragment.SetNumberOfCharged(aFragment.GetNumberOfCharged()-
160  thePreFragment->GetZ());
161 
162  // Update nucleus momentum
163  // A check on consistence of Z, A, and mass will be performed
164  aFragment.SetMomentum(Rest4Momentum);
165 
166  // Create a G4ReactionProduct
167  G4ReactionProduct * MyRP = thePreFragment->GetReactionProduct();
168 
169  // if(kinEnergy < MeV) {
170  // G4cout << "G4PreCompoundEmission::Fragment emitted" << G4endl;
171  // G4cout << *thePreFragment << G4endl;
172  // }
173  return MyRP;
174 }
175 
176 void G4PreCompoundEmission::AngularDistribution(
177  G4VPreCompoundFragment* thePreFragment,
178  const G4Fragment& aFragment,
179  G4double ekin)
180 {
181  G4int p = aFragment.GetNumberOfParticles();
182  G4int h = aFragment.GetNumberOfHoles();
183  G4double U = aFragment.GetExcitationEnergy();
184 
185  // Emission particle separation energy
186  G4double Bemission = thePreFragment->GetBindingEnergy();
187 
188  G4double gg = (6.0/pi2)*aFragment.GetA_asInt()*fLevelDensity;
189 
190  // Average exciton energy relative to bottom of nuclear well
191  G4double Eav = 2*p*(p+1)/((p+h)*gg);
192 
193  // Excitation energy relative to the Fermi Level
194  G4double Uf = std::max(U - (p - h)*fFermiEnergy , 0.0);
195  // G4double Uf = U - KineticEnergyOfEmittedFragment - Bemission;
196 
197  G4double w_num = rho(p+1, h, gg, Uf, fFermiEnergy);
198  G4double w_den = rho(p, h, gg, Uf, fFermiEnergy);
199  if (w_num > 0.0 && w_den > 0.0)
200  {
201  Eav *= (w_num/w_den);
202  Eav += - Uf/(p+h) + fFermiEnergy;
203  }
204  else
205  {
206  Eav = fFermiEnergy;
207  }
208 
209  // VI + JMQ 19/01/2010 update computation of the parameter an
210  //
211  G4double an = 0.0;
212  G4double Eeff = ekin + Bemission + fFermiEnergy;
213  if(ekin > DBL_MIN && Eeff > DBL_MIN) {
214 
215  G4double zeta = std::max(1.0,9.3/std::sqrt(ekin/MeV));
216 
217  // This should be the projectile energy. If I would know which is
218  // the projectile (proton, neutron) I could remove the binding energy.
219  // But, what happens if INC precedes precompound? This approximation
220  // seems to work well enough
221  G4double ProjEnergy = aFragment.GetExcitationEnergy();
222 
223  an = 3*std::sqrt((ProjEnergy+fFermiEnergy)*Eeff)/(zeta*Eav);
224 
225  G4int ne = aFragment.GetNumberOfExcitons() - 1;
226  if ( ne > 1 ) { an /= (G4double)ne; }
227 
228  // protection of exponent
229  if ( an > 10. ) { an = 10.; }
230  }
231 
232  // sample cosine of theta and not theta as in old versions
233  G4double random = G4UniformRand();
234  G4double cost;
235 
236  if(an < 0.1) { cost = 1. - 2*random; }
237  else {
238  G4double exp2an = G4Exp(-2*an);
239  cost = 1. + G4Log(1-random*(1-exp2an))/an;
240  if(cost > 1.) { cost = 1.; }
241  else if(cost < -1.) {cost = -1.; }
242  }
243 
245 
246  // Calculate the momentum magnitude of emitted fragment
247  G4double pmag =
248  std::sqrt(ekin*(ekin + 2.0*thePreFragment->GetNuclearMass()));
249 
250  G4double sint = std::sqrt((1.0-cost)*(1.0+cost));
251 
252  theFinalMomentum.set(pmag*std::cos(phi)*sint,pmag*std::sin(phi)*sint,
253  pmag*cost);
254 
255  // theta is the angle wrt the incident direction
256  G4ThreeVector theIncidentDirection = aFragment.GetMomentum().vect().unit();
257  theFinalMomentum.rotateUz(theIncidentDirection);
258 }
259 
260 G4double G4PreCompoundEmission::rho(G4int p, G4int h, G4double gg,
261  G4double E, G4double Ef) const
262 {
263  // 25.02.2010 V.Ivanchenko added more protections
264  G4double Aph = (p*p + h*h + p - 3.0*h)/(4.0*gg);
265  // G4double alpha = (p*p + h*h)/(2.0*gg);
266 
267  if ( E - Aph < 0.0) { return 0.0; }
268 
269  G4double logConst = (p+h)*G4Log(gg)
270  - g4calc->logfactorial(p+h-1) - g4calc->logfactorial(p)
271  - g4calc->logfactorial(h);
272 
273  // initialise values using j=0
274 
275  G4double t1=1;
276  G4double t2=1;
277  G4double logt3 = (p+h-1) * G4Log(E-Aph) + logConst;
278  const G4double logmax = 200.;
279  if(logt3 > logmax) { logt3 = logmax; }
280  G4double tot = G4Exp( logt3 );
281 
282  // and now sum rest of terms
283  // 25.02.2010 V.Ivanchenko change while to for loop and cleanup
284  G4double Eeff = E - Aph;
285  for(G4int j=1; j<=h; ++j)
286  {
287  Eeff -= Ef;
288  if(Eeff < 0.0) { break; }
289  t1 *= -1.;
290  t2 *= (G4double)(h+1-j)/(G4double)j;
291  logt3 = (p+h-1) * G4Log( Eeff) + logConst;
292  if(logt3 > logmax) { logt3 = logmax; }
293  tot += t1*t2*G4Exp(logt3);
294  }
295 
296  return tot;
297 }
void set(double x, double y, double z)
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
Hep3Vector boostVector() const
G4ReactionProduct * GetReactionProduct() const
std::vector< G4VPreCompoundFragment * > * GetFragmentVector()
const char * p
Definition: xmltok.h:285
G4int GetA() const
G4int GetNumberOfParticles() const
Definition: G4Fragment.hh:345
G4double GetLevelDensity() const
int G4int
Definition: G4Types.hh:78
G4double GetBindingEnergy() const
G4int GetNumberOfHoles() const
Definition: G4Fragment.hh:365
void SetMomentum(const G4LorentzVector &value)
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
G4int GetA_asInt() const
Definition: G4Fragment.hh:266
G4double GetFermiEnergy() const
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:307
HepLorentzVector & boost(double, double, double)
void SetMomentum(const G4LorentzVector &value)
Definition: G4Fragment.hh:312
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:38
G4DeexPrecoParameters * GetParameters()
G4int GetRestZ() const
void SetNumberOfParticles(G4int value)
Definition: G4Fragment.hh:384
G4double G4Log(G4double x)
Definition: G4Log.hh:230
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
G4VPreCompoundFragment * ChooseFragment()
G4double GetNuclearMass() const
G4ReactionProduct * PerformEmission(G4Fragment &aFragment)
G4int GetNumberOfExcitons() const
Definition: G4Fragment.hh:340
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double logfactorial(G4int Z) const
Definition: G4Pow.hh:269
Hep3Vector unit() const
tuple t1
Definition: plottest35.py:33
void SetZandA_asInt(G4int Znew, G4int Anew)
Definition: G4Fragment.hh:276
virtual G4double SampleKineticEnergy(const G4Fragment &aFragment)=0
#define DBL_MIN
Definition: templates.hh:75
G4int GetRestA() const
#define G4endl
Definition: G4ios.hh:61
G4int GetZ() const
static constexpr double MeV
Definition: G4SIunits.hh:214
void SetNumberOfCharged(G4int value)
Definition: G4Fragment.hh:389
double G4double
Definition: G4Types.hh:76
G4int GetNumberOfCharged() const
Definition: G4Fragment.hh:350
static G4NuclearLevelData * GetInstance()
static constexpr double twopi
Definition: SystemOfUnits.h:55
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:283
static constexpr double pi2
Definition: G4SIunits.hh:78