Geant4-11
G4NumIntTwoBodyAngDst.hh
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: Dennis Wright (SLAC)
27// Date: 28 January 2013
28//
29// Description: Templated base class for numerically integrated two-body
30// final state angular distributions in Bertini-style cascade
31//
32// 20130219 M. Kelsey: Rewrite with C-arrays, using template args for
33// dimensions (c.f. G4CascadeSampler)
34// 20130620 Address Coverity #51342; initialize angDist[] buffer in ctor
35
36#ifndef G4NumIntTwoBodyAngDst_h
37#define G4NumIntTwoBodyAngDst_h 1
38
39#include "G4VTwoBodyAngDst.hh"
40#include <algorithm>
41
42template <G4int NKEBINS, G4int NANGLES>
44public:
45 enum { nDists=NKEBINS, nAngles=NANGLES }; // For use in function arguments
46
48 const G4double (&kebins)[nDists],
49 const G4double (&angles)[nAngles],
50 const G4double (&dists)[nDists][nAngles],
51 const G4double highKEscale, G4int verbose = 0)
52 : G4VTwoBodyAngDst(name, verbose), tcoeff(highKEscale),
53 labKE(kebins), cosBins(angles), angDists(dists) {
54 std::fill(angDist, angDist+nDists, 0.); // Initialize working buffer
55 }
56
58
59 virtual G4double GetCosTheta(const G4double& ekin, const G4double& pcm) const;
60
61protected:
62 G4double tcoeff; // Fall-off of exponential for high energy ang. dist.
63
64 // Kinetic energies at which angular distributions are taken
66
67 // Bins of the angular distributions in cos(theta)
69
70 // table of numerical normalized indefinite integrals of
71 // angular distributions vs. KE and angle
73
74 // Compute interpolated angular distribution between energy bins
75 void Interpolate(const G4double& ekin) const;
76 mutable G4double angDist[nAngles]; // Reusable buffer
77};
78
79// Implementations must be included for templated classes
81
82#endif /* G4NumIntTwoBodyAngDst_h */
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
void Interpolate(const G4double &ekin) const
G4NumIntTwoBodyAngDst(const G4String &name, const G4double(&kebins)[nDists], const G4double(&angles)[nAngles], const G4double(&dists)[nDists][nAngles], const G4double highKEscale, G4int verbose=0)
const G4double(& cosBins)[nAngles]
virtual G4double GetCosTheta(const G4double &ekin, const G4double &pcm) const
const G4double(& labKE)[nDists]
const G4double(& angDists)[nDists][nAngles]
const char * name(G4int ptype)