Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4InuclParamMomDst.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// Author: Michael Kelsey (SLAC)
27// Date: 7 March 2013
28//
29// Description: intermediate base class for INUCL parametrizations of
30// final-state momentum distributions in Bertini-style cascade
31//
32// 20130308 M. Kelsey -- Move PQ,PR calculation to G4InuclSpecialFunctions.
33// 20130924 M. Kelsey -- Replace std::pow with G4Pow::powN() for CPU speed
34
35#include "G4InuclParamMomDst.hh"
38#include "G4Pow.hh"
39#include "Randomize.hh"
40
41using namespace G4InuclSpecialFunctions;
42using namespace G4InuclParticleNames;
43
44
45// Use coefficients in power expansion of random fraction
46
49 if (verboseLevel>3) {
50 G4cout << theName << "::GetMomentum: ptype " << ptype << " ekin " << ekin
51 << G4endl;
52 }
53
54 G4int JK = (ptype==pro || ptype==neu) ? 0 : 1; // nucleon vs. other
55
56 if (verboseLevel > 3) G4cout << " JK " << JK << G4endl;
57
58 G4Pow* theG4Pow = G4Pow::GetInstance(); // For convenience
59
60 G4double Spow = randomInuclPowers(ekin, coeffPR[JK]);
61
62 G4double C=0., PS=0.;
63 for(G4int im = 0; im < 3; im++) {
64 C = coeffPS[JK][im];
65 PS += C * theG4Pow->powN(ekin, im);
66
67 if (verboseLevel >3) {
68 G4cout << " im " << im << " : coeffPS[JK][im] " << C
69 << " ekin^im " << theG4Pow->powN(ekin, im) << G4endl;
70 }
71 }
72
73 G4double PRA = PS * Spow;
74
75 if (verboseLevel > 3)
76 G4cout << " PS " << PS << " Spow = sqrt(S)*(PR+(1-PQ)*S^4) " << Spow
77 << " PRA = PS*Spow " << PRA << G4endl;
78
79 return std::fabs(PRA);
80}
double C(double temp)
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4double(& coeffPS)[2][3]
const G4double(& coeffPR)[2][4][4]
virtual G4double GetMomentum(G4int ptype, const G4double &ekin) const
Definition: G4Pow.hh:49
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double powN(G4double x, G4int n) const
Definition: G4Pow.cc:166
G4double randomInuclPowers(G4double ekin, const G4double(&coeff)[4][4])