source: trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeSampler.hh @ 1340

Last change on this file since 1340 was 1340, checked in by garnier, 14 years ago

update ti head

File size: 3.2 KB
Line 
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: G4CascadeSampler.hh,v 1.4 2010/08/03 23:09:36 mkelsey Exp $
27// GEANT4 tag: $Name: hadr-casc-V09-03-85 $
28//
29// 20100506  M. Kelsey -- Move functionality of G4CascadeChannel here,
30//              use as base class to G4CascadeFunctions<T>.
31// 20100512  M. Kelsey -- Make this templated on energy and multiplicity
32//              binning, as base to new sampler.
33// 20100803  M. Kelsey -- Add print function for debugging.
34
35#ifndef G4_CASCADE_SAMPLER_HH
36#define G4_CASCADE_SAMPLER_HH
37
38#include <vector>
39#include "globals.hh"
40#include "G4CascadeInterpolator.hh"
41
42template <int NBINS, int NMULT>
43class G4CascadeSampler {
44public:
45  enum { energyBins=NBINS, multBins=NMULT };    // For use in function arguments
46
47  G4CascadeSampler(const G4double (&ebins)[energyBins]) 
48    : interpolator(ebins), energyScale(ebins) {}
49
50  virtual ~G4CascadeSampler() {}
51
52  virtual G4double
53  findCrossSection(double ke, const G4double (&xsec)[energyBins]) const;
54
55  virtual G4int
56  findMultiplicity(G4double ke, const G4double xmult[][energyBins]) const;
57
58  virtual G4int
59  findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
60                      const G4double xsec[][energyBins]) const;
61
62  virtual void print() const;
63
64private:
65  // Optional start/stop arguments default to inclusive arrays
66  void fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
67                       G4int startBin=0, G4int stopBin=multBins) const;
68
69  G4int sampleFlat() const;
70
71  G4CascadeInterpolator<NBINS> interpolator;
72  mutable std::vector<G4double> sigmaBuf;
73  const G4double (&energyScale)[energyBins];
74};
75
76#include "G4CascadeSampler.icc"
77
78#endif  /* G4_CASCADE_SAMPLER_HH */
Note: See TracBrowser for help on using the repository browser.