Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:28

0001 // -*- C++ -*-
0002 //
0003 // GSLHelper.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef HERWIG_GSLHelper_H
0010 #define HERWIG_GSLHelper_H
0011 //
0012 // This is the declaration of the GSLHelper class.
0013 //
0014 
0015 namespace Herwig {
0016 
0017   using namespace ThePEG;
0018 
0019 /** \ingroup Utilities This class can be used to inherit data structures
0020  * from, which can then be used by the GSL algorithms that need a
0021  * pointer to a function and don't know about Units. This class defines
0022  * the necessary typedefs and forces you to define the "()" operator. In
0023  * addition it implements the vUnit and aUnit static methods which can
0024  * be overwritten if the corresponding base unit is too far from the
0025  * actual used unit. This removes the numerical problem that arises once
0026  * the base unit is several orders of magnitude away from the used unit.
0027  */
0028 
0029 
0030 template <typename V, typename T> 
0031 struct GSLHelper 
0032 {
0033     
0034 public:
0035 
0036   /**
0037    *  Constructor
0038    */
0039   GSLHelper() {}
0040 
0041   /**
0042    *  Destructor
0043    */
0044   virtual ~GSLHelper() {}
0045 
0046   /**
0047    * Typedef for Agrument type
0048    */
0049   typedef T ArgType;
0050 
0051   /**
0052    *  Typedef for Value type
0053    */
0054   typedef V ValType;
0055 
0056   /**
0057    * Value type
0058    */
0059   virtual V vUnit() const {return TypeTraits<V>::baseunit();}
0060 
0061   /**
0062    * Agrument type
0063    */
0064   virtual T aUnit() const {return TypeTraits<T>::baseunit();}
0065 
0066 private:
0067 
0068   /**
0069    * The assignment operator is private and must never be called.
0070    * In fact, it should not even be implemented.
0071    */
0072   GSLHelper & operator=(const GSLHelper &) = delete;
0073 
0074 };
0075 
0076 }
0077 
0078 namespace {
0079 
0080   template <class T> struct GSLparam {
0081 
0082     //The function to find root for
0083     const T & function;
0084     
0085   };
0086 
0087 }
0088 
0089 #endif /* HERWIG_GSLHelper_H */