Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:29:40

0001 // @(#)root/minuit2:$Id$
0002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005
0003 
0004 /**********************************************************************
0005  *                                                                    *
0006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
0007  *                                                                    *
0008  **********************************************************************/
0009 
0010 #ifndef ROOT_Minuit2_MnParabola
0011 #define ROOT_Minuit2_MnParabola
0012 
0013 #include <cmath>
0014 
0015 namespace ROOT {
0016 
0017 namespace Minuit2 {
0018 
0019 /**
0020 
0021 This class defines a parabola of the form a*x*x + b*x + c
0022 
0023 @author Fred James and Matthias Winkler; comments added by Andras Zsenei
0024 and Lorenzo Moneta
0025 
0026 @ingroup Minuit
0027 
0028  */
0029 
0030 class MnParabola {
0031 
0032 public:
0033    /// Constructor that initializes the parabola with its three parameters.
0034    ///
0035    /// @param a the coefficient of the quadratic term.
0036    /// @param b the coefficient of the linear term.
0037    /// @param c the constant.
0038    MnParabola(double a, double b, double c) : fA(a), fB(b), fC(c) {}
0039 
0040    /// Evaluates the parabola a the point x.
0041    double Y(double x) const { return (fA * x * x + fB * x + fC); }
0042 
0043    /// Calculate the x coordinate of the Minimum of the parabola.
0044    double Min() const { return -fB / (2. * fA); }
0045 
0046    /// Calculate the y coordinate of the Minimum of the parabola.
0047    double YMin() const { return (-fB * fB / (4. * fA) + fC); }
0048 
0049    /// Get the coefficient of the quadratic term.
0050    double A() const { return fA; }
0051 
0052    /// Get the coefficient of the linear term.
0053    double B() const { return fB; }
0054 
0055    /// Get the coefficient of the constant term.
0056    double C() const { return fC; }
0057 
0058 private:
0059    double fA;
0060    double fB;
0061    double fC;
0062 };
0063 
0064 } // namespace Minuit2
0065 
0066 } // namespace ROOT
0067 
0068 #endif // ROOT_Minuit2_MnParabola