Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:35

0001 // -*- C++ -*-
0002 // $Id: LegendreFit.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
0003 //---------------------LegendreFit------------------------------------------//
0004 //                                                                          //
0005 // Class LegendreFit.  This is a fitting function consisting of a super     //
0006 // position of N legendre polynomials.  Cascading fractions and phases are  //
0007 // the input parameters. Function is normalized to one (on [-1,1])          //
0008 //                                                                          //
0009 //--------------------------------------------------------------------------//
0010 #ifndef LegendreFit_h
0011 #define LegendreFit_h 1
0012 #include "CLHEP/GenericFunctions/AbsFunction.hh"
0013 #include "CLHEP/GenericFunctions/Parameter.hh"
0014 #include "CLHEP/GenericFunctions/LegendreCoefficientSet.hh"
0015 #include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh"
0016 namespace Genfun {
0017 
0018   /**
0019    * @author
0020    * @ingroup genfun
0021    */
0022   class LegendreFit : public AbsFunction  {
0023 
0024     FUNCTION_OBJECT_DEF(LegendreFit)
0025 
0026       public:
0027 
0028     // Constructor
0029     LegendreFit(unsigned int N);
0030 
0031     // Copy constructor
0032     LegendreFit(const LegendreFit &right);
0033   
0034     // Destructor
0035     virtual ~LegendreFit();
0036   
0037     // Retreive function value
0038     virtual double operator ()(double argument) const override;
0039     virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
0040   
0041     unsigned int order() const;
0042 
0043     Parameter *getFraction(unsigned int i);
0044     const Parameter *getFraction(unsigned int i) const;
0045 
0046     Parameter *getPhase(unsigned int i);
0047     const Parameter *getPhase(unsigned int i) const;
0048 
0049     // Gets the coefficients the coefficients of the function which is
0050     // Squared to obtain a probability distribution (amplitude)
0051     const LegendreCoefficientSet & coefficientsA() const;
0052 
0053     // Gets the coefficients the coefficients of the function which is
0054     // Squared to obtain a probability distribution: 
0055     const LegendreCoefficientSet & coefficientsASq() const;
0056 
0057     // Recompute coefficients from the parameters:
0058     void recomputeCoefficients() const;
0059 
0060 
0061   private:
0062 
0063     // It is illegal to assign an adjustable constant
0064     const LegendreFit & operator=(const LegendreFit &right);
0065 
0066     // 
0067     const unsigned   int                      N;
0068     std::vector <Genfun::Parameter *>         fraction;
0069     std::vector <Genfun::Parameter *>         phase;
0070     mutable LegendreCoefficientSet            coefA;
0071     mutable LegendreCoefficientSet            coefASq;
0072     mutable ClebschGordanCoefficientSet       ClebschGordan;
0073 
0074   };
0075 } // namespace Genfun
0076 #include "CLHEP/GenericFunctions/LegendreFit.icc"
0077 #endif