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