Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:17:14

0001 //
0002 // APFEL++ 2017
0003 //
0004 // Author: Valerio Bertone: valerio.bertone@cern.ch
0005 //
0006 
0007 #pragma once
0008 
0009 #include "apfel/set.h"
0010 #include "apfel/operator.h"
0011 
0012 namespace apfel
0013 {
0014   /**
0015    * @brief The Observable class encapsulates sets of operators and
0016    * sets of T-type objects for an easy computation of observables
0017    * deriving from the convolution of the two. This class can contain
0018    * an arbitrary number of such pairs that are separatately
0019    * convoluted and joint when the obeservable is computed by means of
0020    * the "Evaluate" function.
0021    */
0022   template<class T = Distribution>
0023   class Observable
0024   {
0025   public:
0026     /**
0027      * @brief This structure contains a pair of sets of coefficient
0028      * functions and of objects.
0029      */
0030     struct ConvolutionPair
0031     {
0032       ConvolutionPair(std::function<Set<Operator>(double const&)> const& C, std::function<Set<T>(double const&)> const& O): CoefficientFunctions(C), Objects(O) {}
0033       std::function<Set<Operator>(double const&)> CoefficientFunctions;
0034       std::function<Set<T>(double const&)>        Objects;
0035     };
0036 
0037     /**
0038      * @brief The Observable empty constructor.
0039      */
0040     Observable();
0041 
0042     /**
0043      * @brief The Observable constructor.
0044      * @param ConvPair: a vector of ConvolutionPair structures containing pairs of Set<Operator>-valued and Set<T>-valued functions
0045      */
0046     Observable(std::vector<ConvolutionPair> ConvPair);
0047 
0048     /**
0049      * @brief The Observable constructor.
0050      * @param CoefficientFunctions: a Set<Operator>-valued function returning the operators
0051      * @param Objects: a Set<T>-valued function returning the relevant object
0052      */
0053     Observable(std::function<Set<Operator>(double const&)> const& CoefficientFunctions,
0054                std::function<Set<T>(double const&)>        const& Objects);
0055 
0056     /**
0057      * @brief Function to add a convolution pair
0058      * @param CoefficientFunctions: a Set<Operator>-valued function returning the operators
0059      * @param Objects: a Set<T>-valued function returning the relevant object
0060      */
0061     void AddConvolutionPair(std::function<Set<Operator>(double const&)> const& CoefficientFunctions,
0062                             std::function<Set<T>(double const&)>        const& Objects);
0063 
0064     /**
0065      * @name Functions that evaluate the the observable at the scale
0066      * Q.
0067      */
0068     ///@{
0069     /**
0070      * @brief This function returns the observable as a distribution.
0071      * @param Q: the scale where the observable has to be evaluated
0072      * @return the observable in Q as a distribution
0073      */
0074     T Evaluate(double const& Q) const;
0075 
0076     /**
0077      * @brief This function returns the observable in Q interpolated in x.
0078      * @param x: the value to be interpolate on the x-space grid
0079      * @param Q: the scale where the observable has to be evaluated
0080      * @return the observable in Q interpolated in x
0081      */
0082     double Evaluate(double const& x, double const& Q) const;
0083     ///@}
0084 
0085     /**
0086      * @brief Set the set of ditributions keeping the same set of
0087      * coefficient functions.
0088      * @param Objects: the new set of objects
0089      * @param ip: index of the convolution-pair vector (default: 0)
0090      */
0091     void SetObjects(std::function<Set<T>(double const&)> const& Objects, int const& ip = 0);
0092 
0093     /**
0094      * @brief Get the set of coefficient functions.
0095      * @param ip: index of the convolution-pair vector (default: 0)
0096      * @return the set of coefficient functions.
0097      */
0098     std::function<Set<Operator>(double const&)> GetCoefficientFunctions(int const& ip = 0) const;
0099 
0100   private:
0101     std::vector<ConvolutionPair> _ConvPair;
0102   };
0103 }