Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:00

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // 20100506  M. Kelsey -- Move functionality of G4CascadeChannel here,
0028 //      use as base class to G4CascadeFunctions<T>.
0029 // 20100512  M. Kelsey -- Make this templated on energy and multiplicity
0030 //      binning, as base to new sampler.
0031 // 20100803  M. Kelsey -- Add print function for debugging.
0032 // 20110923  M. Kelsey -- Add optional ostream& argument to print()
0033 
0034 #ifndef G4_CASCADE_SAMPLER_HH
0035 #define G4_CASCADE_SAMPLER_HH
0036 
0037 #include "globals.hh"
0038 #include "G4CascadeInterpolator.hh"
0039 #include <iosfwd>
0040 #include <vector>
0041 
0042 template <G4int NBINS, G4int NMULT>
0043 class G4CascadeSampler {
0044 public:
0045   enum { energyBins=NBINS, multBins=NMULT };    // For use in function arguments
0046 
0047   G4CascadeSampler(const G4double (&ebins)[energyBins]) 
0048     : interpolator(ebins), energyScale(ebins) {}
0049 
0050   virtual ~G4CascadeSampler() {}
0051 
0052   virtual G4double 
0053   findCrossSection(G4double ke, const G4double (&xsec)[energyBins]) const;
0054 
0055   virtual G4int 
0056   findMultiplicity(G4double ke, const G4double xmult[][energyBins]) const;
0057 
0058   virtual G4int 
0059   findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
0060               const G4double xsec[][energyBins]) const;
0061 
0062   virtual void print(std::ostream& os) const;
0063 
0064 private:
0065   // Optional start/stop arguments default to inclusive arrays
0066   void fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
0067                G4int startBin=0, G4int stopBin=multBins) const;
0068 
0069   G4int sampleFlat() const;
0070 
0071   G4CascadeInterpolator<NBINS> interpolator;
0072   mutable std::vector<G4double> sigmaBuf;
0073   const G4double (&energyScale)[energyBins];
0074 };
0075 
0076 #include "G4CascadeSampler.icc"
0077 
0078 #endif  /* G4_CASCADE_SAMPLER_HH */