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