Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4Integrator
0027 //
0028 // Class description:
0029 //
0030 // Template class collecting integrator methods for generic funtions.
0031 
0032 // Author: V.Grichine, 04.09.1999 - First implementation based on
0033 //         G4SimpleIntegration class with H.P.Wellisch, G.Cosmo, and
0034 //         E.TCherniaev advises
0035 // --------------------------------------------------------------------
0036 #ifndef G4INTEGRATOR_HH
0037 #define G4INTEGRATOR_HH 1
0038 
0039 #include "G4Types.hh"
0040 #include <CLHEP/Units/PhysicalConstants.h>
0041 #include <cmath>
0042 
0043 template <class T, class F>
0044 class G4Integrator
0045 {
0046  public:
0047   G4Integrator() { ; }
0048   ~G4Integrator() { ; }
0049 
0050   G4double Simpson(T& typeT, F f, G4double a, G4double b, G4int n);
0051   G4double Simpson(T* ptrT, F f, G4double a, G4double b, G4int n);
0052   G4double Simpson(G4double (*f)(G4double), G4double a, G4double b, G4int n);
0053   // Simpson integration method
0054 
0055   G4double AdaptiveGauss(T& typeT, F f, G4double a, G4double b, G4double e);
0056   G4double AdaptiveGauss(T* ptrT, F f, G4double a, G4double b, G4double e);
0057   G4double AdaptiveGauss(G4double (*f)(G4double), G4double a, G4double b,
0058                          G4double e);
0059   // Adaptive Gauss method
0060 
0061   // Integration methods involving orthogohol polynomials
0062 
0063   G4double Legendre(T& typeT, F f, G4double a, G4double b, G4int n);
0064   G4double Legendre(T* ptrT, F f, G4double a, G4double b, G4int n);
0065   G4double Legendre(G4double (*f)(G4double), G4double a, G4double b, G4int n);
0066   //
0067   // Methods involving Legendre polynomials
0068 
0069   G4double Legendre10(T& typeT, F f, G4double a, G4double b);
0070   G4double Legendre10(T* ptrT, F f, G4double a, G4double b);
0071   G4double Legendre10(G4double (*f)(G4double), G4double a, G4double b);
0072   //
0073   // Legendre10 is very fast and accurate enough
0074 
0075   G4double Legendre96(T& typeT, F f, G4double a, G4double b);
0076   G4double Legendre96(T* ptrT, F f, G4double a, G4double b);
0077   G4double Legendre96(G4double (*f)(G4double), G4double a, G4double b);
0078   //
0079   // Legendre96 is very accurate and fast enough
0080 
0081   G4double Chebyshev(T& typeT, F f, G4double a, G4double b, G4int n);
0082   G4double Chebyshev(T* ptrT, F f, G4double a, G4double b, G4int n);
0083   G4double Chebyshev(G4double (*f)(G4double), G4double a, G4double b, G4int n);
0084   //
0085   // Methods involving Chebyshev  polynomials
0086 
0087   G4double Laguerre(T& typeT, F f, G4double alpha, G4int n);
0088   G4double Laguerre(T* ptrT, F f, G4double alpha, G4int n);
0089   G4double Laguerre(G4double (*f)(G4double), G4double alpha, G4int n);
0090   //
0091   // Method involving Laguerre polynomials
0092 
0093   G4double Hermite(T& typeT, F f, G4int n);
0094   G4double Hermite(T* ptrT, F f, G4int n);
0095   G4double Hermite(G4double (*f)(G4double), G4int n);
0096   //
0097   // Method involving Hermite polynomials
0098 
0099   G4double Jacobi(T& typeT, F f, G4double alpha, G4double beta, G4int n);
0100   G4double Jacobi(T* ptrT, F f, G4double alpha, G4double beta, G4int n);
0101   G4double Jacobi(G4double (*f)(G4double), G4double alpha, G4double beta,
0102                   G4int n);
0103   // Method involving Jacobi polynomials
0104 
0105  protected:
0106   // Auxiliary functions for adaptive Gauss method
0107 
0108   G4double Gauss(T& typeT, F f, G4double a, G4double b);
0109   G4double Gauss(T* ptrT, F f, G4double a, G4double b);
0110   G4double Gauss(G4double (*f)(G4double), G4double a, G4double b);
0111 
0112   void AdaptGauss(T& typeT, F f, G4double a, G4double b, G4double e,
0113                   G4double& sum, G4int& n);
0114   void AdaptGauss(T* typeT, F f, G4double a, G4double b, G4double e,
0115                   G4double& sum, G4int& n);
0116   void AdaptGauss(G4double (*f)(G4double), G4double a, G4double b, G4double e,
0117                   G4double& sum, G4int& n);
0118 
0119   G4double GammaLogarithm(G4double xx);
0120 };
0121 
0122 #include "G4Integrator.icc"
0123 
0124 #endif