G4CascadeSampler.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // 20100506  M. Kelsey -- Move functionality of G4CascadeChannel here,
00029 //              use as base class to G4CascadeFunctions<T>.
00030 // 20100512  M. Kelsey -- Make this templated on energy and multiplicity
00031 //              binning, as base to new sampler.
00032 // 20100803  M. Kelsey -- Add print function for debugging.
00033 // 20110923  M. Kelsey -- Add optional ostream& argument to print()
00034 
00035 #ifndef G4_CASCADE_SAMPLER_HH
00036 #define G4_CASCADE_SAMPLER_HH
00037 
00038 #include "globals.hh"
00039 #include "G4CascadeInterpolator.hh"
00040 #include <iosfwd>
00041 #include <vector>
00042 
00043 template <int NBINS, int NMULT>
00044 class G4CascadeSampler {
00045 public:
00046   enum { energyBins=NBINS, multBins=NMULT };    // For use in function arguments
00047 
00048   G4CascadeSampler(const G4double (&ebins)[energyBins]) 
00049     : interpolator(ebins), energyScale(ebins) {}
00050 
00051   virtual ~G4CascadeSampler() {}
00052 
00053   virtual G4double 
00054   findCrossSection(double ke, const G4double (&xsec)[energyBins]) const;
00055 
00056   virtual G4int 
00057   findMultiplicity(G4double ke, const G4double xmult[][energyBins]) const;
00058 
00059   virtual G4int 
00060   findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
00061                       const G4double xsec[][energyBins]) const;
00062 
00063   virtual void print(std::ostream& os) const;
00064 
00065 private:
00066   // Optional start/stop arguments default to inclusive arrays
00067   void fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
00068                        G4int startBin=0, G4int stopBin=multBins) const;
00069 
00070   G4int sampleFlat() const;
00071 
00072   G4CascadeInterpolator<NBINS> interpolator;
00073   mutable std::vector<G4double> sigmaBuf;
00074   const G4double (&energyScale)[energyBins];
00075 };
00076 
00077 #include "G4CascadeSampler.icc"
00078 
00079 #endif  /* G4_CASCADE_SAMPLER_HH */

Generated on Mon May 27 17:47:50 2013 for Geant4 by  doxygen 1.4.7