// @(#)root/hist:$Id$
// Author: Marian Ivanov, 2005

/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
* All rights reserved.                                                  *
*                                                                       *
* For the licensing terms see $ROOTSYS/LICENSE.                         *
* For the list of contributors see $ROOTSYS/README/CREDITS.             *
*************************************************************************/

#include <math.h>

#include "TFormulaPrimitive.h"
#include "TMath.h"
#include "TVirtualMutex.h"
#ifdef WIN32
#pragma optimize("",off)
#endif

static TVirtualMutex* gTFormulaPrimativeListMutex = 0;

void TMath_GenerInterface();

ClassImp(TFormulaPrimitive)

//______________________________________________________________________________
// The Formula Primitive class
//
//    Helper class for TFormula to speed up TFormula evaluation
//    TFormula can use all functions registered in the list of TFormulaPrimitives
//    User can add new function to the list of primitives
//    if FormulaPrimitive with given name is already defined new primitive is ignored
//    Example:
//      TFormulaPrimitive::AddFormula(new TFormulaPrimitive("Pow2","Pow2",TFastFun::Pow2));
//      TF1 f1("f1","Pow2(x)");
//
//
//
//    TFormulaPrimitive is used to get direct acces to the function pointers
//    GenFunc     -  pointers  to the static function
//    TFunc       -  pointers  to the data member functions
//
//    The following sufixes are currently used, to describe function arguments:
//    ------------------------------------------------------------------------
//    G     - generic layout - pointer to double (arguments), pointer to double (parameters)
//    10    - double
//    110   - double, double
//    1110  - double, double, double


//______________________________________________________________________________
// TFormula primitive
//
TObjArray * TFormulaPrimitive::fgListOfFunction = 0;
#ifdef R__COMPLETE_MEM_TERMINATION
namespace {
   class TFormulaPrimitiveCleanup {
      TObjArray **fListOfFunctions;
   public:
      TFormulaPrimitiveCleanup(TObjArray **functions) : fListOfFunctions(functions) {}
      ~TFormulaPrimitiveCleanup() {
         delete *fListOfFunctions;
      }
   };

}
#endif

//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive() : TNamed(),
                                         fFuncG(0),
                                         fType(0),fNArguments(0),fNParameters(0),fIsStatic(kTRUE)
{
   // Default constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     GenFunc0 fpointer) : TNamed(name,formula),
                                                          fFunc0(fpointer),
                                                          fType(0),fNArguments(0),fNParameters(0),fIsStatic(kTRUE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     GenFunc10 fpointer) : TNamed(name,formula),
                                                           fFunc10(fpointer),
                                                           fType(10),fNArguments(1),fNParameters(0),fIsStatic(kTRUE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     GenFunc110 fpointer) : TNamed(name,formula),
                                                            fFunc110(fpointer),
                                                            fType(110),fNArguments(2),fNParameters(0),fIsStatic(kTRUE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     GenFunc1110 fpointer) : TNamed(name,formula),
                                                             fFunc1110(fpointer),
                                                             fType(1110),fNArguments(3),fNParameters(0),fIsStatic(kTRUE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     GenFuncG fpointer,Int_t npar) : TNamed(name,formula),
                                                                     fFuncG(fpointer),
                                                                     fType(-1),fNArguments(2),fNParameters(npar),fIsStatic(kTRUE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     TFuncG fpointer) : TNamed(name,formula),
                                                        fTFuncG(fpointer),
                                                        fType(0),fNArguments(0),fNParameters(0),fIsStatic(kFALSE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     TFunc0 fpointer) : TNamed(name,formula),
                                                        fTFunc0(fpointer),
                                                        fType(0),fNArguments(0),fNParameters(0),fIsStatic(kFALSE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     TFunc10 fpointer) : TNamed(name,formula),
                                                         fTFunc10(fpointer),
                                                         fType(-10),fNArguments(1),fNParameters(0),fIsStatic(kFALSE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     TFunc110 fpointer) : TNamed(name,formula),
                                                          fTFunc110(fpointer),
                                                          fType(-110),fNArguments(2),fNParameters(0),fIsStatic(kFALSE)
{
   // Constructor.

}


//______________________________________________________________________________
TFormulaPrimitive::TFormulaPrimitive(const char *name,const char *formula,
                                     TFunc1110 fpointer) :TNamed(name,formula),
                                                          fTFunc1110(fpointer),
                                                          fType(-1110),fNArguments(3),fNParameters(0),fIsStatic(kFALSE)
{
   // Constructor.

}


//______________________________________________________________________________
Int_t TFormulaPrimitive::AddFormula(TFormulaPrimitive * formula)
{
   // Add formula to the list of primitive formulas.
   // If primitive formula already defined do nothing.
   R__LOCKGUARD2(gTFormulaPrimativeListMutex);
   if (fgListOfFunction == 0) BuildBasicFormulas();
   if (FindFormula(formula->GetName(),formula->fNArguments)){
      delete formula;
      return 0;
   }
   fgListOfFunction->AddLast(formula);
   return 1;
}


//______________________________________________________________________________
Double_t TFormulaPrimitive::Eval(Double_t* x)
{
   // Eval primitive function at point x.

   if (fIsStatic == kFALSE) return 0;

   if (fType==0) return  fFunc0();
   if (fType==10) {
      return fFunc10(x[0]);
   }
   if (fType==110) {
      return fFunc110(x[0],x[1]);
   }
   if (fType==1110) {
      return fFunc1110(x[0],x[1],x[2]);
   }
   return 0;
}


//______________________________________________________________________________
Double_t  TFormulaPrimitive::Eval(TObject *o, Double_t *x)
{
   // Eval member function of object o at point x.

   if (fIsStatic == kTRUE) return 0;
   if (fType== 0)    return (*o.*fTFunc0)();
   if (fType==-10)   return (*o.*fTFunc10)(*x);
   if (fType==-110)  return (*o.*fTFunc110)(x[0],x[1]);
   if (fType==-1110) return (*o.*fTFunc1110)(x[0],x[1],x[2]);
   return 0;
}


//______________________________________________________________________________
Double_t TFormulaPrimitive::Eval(Double_t *x, Double_t *param)
{
   // Eval primitive parametric function.

   return fFuncG(x,param);
}


#define RTFastFun__POLY(var)                                          \
{                                                                     \
   Double_t res= param[var-1]+param[var]*x[0];                        \
   for (Int_t j=var-1 ;j>0;j--) res      = param[j-1]+x[0]*res;       \
   return res;                                                        \
}

namespace TFastFun {
   //
   // Namespace with basic primitive functions registered by TFormulaPrimitive
   // all function registered by TFormulaPrimitive can be used in TFormula
   //
   Double_t Pow2(Double_t x){return x*x;}
   Double_t Pow3(Double_t x){return x*x*x;}
   Double_t Pow4(Double_t x){return x*x*x*x;}
   Double_t Pow5(Double_t x){return x*x*x*x*x;}
   inline   Double_t FPoln(Double_t *x, Double_t *param, Int_t npar);
   Double_t FPol0(Double_t * /*x*/, Double_t *param){ return param[0];}
   Double_t FPol1(Double_t *x, Double_t *param){ return param[0]+param[1]*x[0];}
   Double_t FPol2(Double_t *x, Double_t *param){ return param[0]+x[0]*(param[1]+param[2]*x[0]);}
   Double_t FPol3(Double_t *x, Double_t *param){ return param[0]+x[0]*(param[1]+x[0]*(param[2]+param[3]*x[0]));}
   Double_t FPol4(Double_t *x, Double_t *param){ RTFastFun__POLY(4)}
   Double_t FPol5(Double_t *x, Double_t *param){ RTFastFun__POLY(5)}
   Double_t FPol6(Double_t *x, Double_t *param){ RTFastFun__POLY(6)}
   Double_t FPol7(Double_t *x, Double_t *param){ RTFastFun__POLY(7)}
   Double_t FPol8(Double_t *x, Double_t *param){ RTFastFun__POLY(8)}
   Double_t FPol9(Double_t *x, Double_t *param){ RTFastFun__POLY(9)}
   Double_t FPol10(Double_t *x, Double_t *param){ RTFastFun__POLY(10)}
   //
   //
   Double_t PlusXY(Double_t x,Double_t y){return x+y;}
   Double_t MinusXY(Double_t x,Double_t y){return x-y;}
   Double_t MultXY(Double_t x,Double_t y){return x*y;}
   Double_t DivXY(Double_t x, Double_t y){return TMath::Abs(y)>0 ? x/y:0;}
   Double_t XpYpZ(Double_t x, Double_t y, Double_t z){ return x+y+z;}
   Double_t XxYxZ(Double_t x, Double_t y, Double_t z){ return x*y*z;}
   Double_t XxYpZ(Double_t x, Double_t y, Double_t z){ return x*(y+z);}
   Double_t XpYxZ(Double_t x, Double_t y, Double_t z){ return x+(y*z);}
   Double_t Gaus(Double_t x, Double_t mean, Double_t sigma);
   Double_t Gausn(Double_t x, Double_t mean, Double_t sigma);
   Double_t Landau(Double_t x, Double_t mean, Double_t sigma){return TMath::Landau(x,mean,sigma,kFALSE);}
   Double_t Landaun(Double_t x, Double_t mean, Double_t sigma){return TMath::Landau(x,mean,sigma,kTRUE);}
   Double_t Sqrt(Double_t x) {return x>0?sqrt(x):0;}
   //
   Double_t Sign(Double_t x){return (x<0)? -1:1;}
   Double_t Nint(Double_t x){return TMath::Nint(x);}
   Double_t Abs(Double_t x){return TMath::Abs(x);}
   //logical
   Double_t XandY(Double_t x, Double_t y){ return (x*y>0.1);}
   Double_t XorY(Double_t x, Double_t y) { return (x+y>0.1);}
   Double_t XgY(Double_t x, Double_t y) {return (x>y);}
   Double_t XgeY(Double_t x, Double_t y) {return (x>=y);}
   Double_t XlY(Double_t x, Double_t y) {return (x<y);}
   Double_t XleY(Double_t x, Double_t y) {return (x<=y);}
   Double_t XeY(Double_t x,Double_t y) {return (x==y);}
   Double_t XneY(Double_t x,Double_t y) {return (x!=y);}
   Double_t XNot(Double_t x){ return (x<0.1);}
};


//______________________________________________________________________________
TFormulaPrimitive* TFormulaPrimitive::FindFormula(const char* name)
{
   // Find the formula in the list of formulas.
   R__LOCKGUARD2(gTFormulaPrimativeListMutex);
   if (!fgListOfFunction) {
      BuildBasicFormulas();
   }
   Int_t nobjects = fgListOfFunction->GetEntries();
   for (Int_t i = 0; i < nobjects; ++i) {
      TFormulaPrimitive *formula = (TFormulaPrimitive*)fgListOfFunction->At(i);
      if (formula && 0==strcmp(name, formula->GetName())) return formula;
   }
   return 0;
}


//______________________________________________________________________________
TFormulaPrimitive* TFormulaPrimitive::FindFormula(const char* name, UInt_t nargs)
{
   // Find the formula in the list of formulas.

   R__LOCKGUARD2(gTFormulaPrimativeListMutex);
   if (!fgListOfFunction) {
      BuildBasicFormulas();
   }
   Int_t nobjects = fgListOfFunction->GetEntries();
   for (Int_t i = 0; i < nobjects; ++i) {
      TFormulaPrimitive *prim = (TFormulaPrimitive*)fgListOfFunction->At(i);
      if (prim) {
         bool match = ( ((UInt_t)prim->fNArguments) == nargs );
         if (match && 0==strcmp(name, prim->GetName())) return prim;
      }
   }
   return 0;
}


//______________________________________________________________________________
TFormulaPrimitive* TFormulaPrimitive::FindFormula(const char* name, const char *args)
{
   // Find the formula in the list of formulas.

   // let's count the argument(s)
   if (args) {
      Int_t nargs = 0;
      if (args[0]!=')') {
         nargs = 1;
         int nest = 0;
         for(UInt_t c = 0; c < strlen(args); ++c ) {
            switch (args[c]) {
               case '(': ++nest; break;
               case ')': --nest; break;
               case '<': ++nest; break;
               case '>': --nest; break;
               case ',': nargs += (nest==0); break;
            }
         }
      }
      return FindFormula(name,nargs);
   } else {
      return FindFormula(name);
   }
   return 0;
}


//______________________________________________________________________________
Double_t TFastFun::FPoln(Double_t *x, Double_t *param, Int_t npar)
{
   // FPoln.

   Double_t res = 0; Double_t temp=1;
   for (Int_t j=npar ;j>=0;j--) {
      res  += temp*param[j];
      temp *= *x;
   }
   return res;
}


//______________________________________________________________________________
Double_t TFastFun::Gaus(Double_t x, Double_t mean, Double_t sigma)
{
   // Gauss.

   if (sigma == 0) return 1.e30;
   Double_t arg = (x-mean)/sigma;
   return TMath::Exp(-0.5*arg*arg);
}


//______________________________________________________________________________
Double_t TFastFun::Gausn(Double_t x, Double_t mean, Double_t sigma)
{
   // Normalize gauss.

   if (sigma == 0)  return 0;
   Double_t arg = (x-mean)/sigma;
   return TMath::Exp(-0.5*arg*arg)/(2.50662827463100024*sigma);  //sqrt(2*Pi)=2.50662827463100024
}


//______________________________________________________________________________
Int_t TFormulaPrimitive::BuildBasicFormulas()
{
   // Built-in functions.
   R__LOCKGUARD2(gTFormulaPrimativeListMutex);
   if (fgListOfFunction==0) {
      fgListOfFunction = new TObjArray(1000);
      fgListOfFunction->SetOwner(kTRUE);
   }
#ifdef R__COMPLETE_MEM_TERMINATION
   static TFormulaPrimitiveCleanup gCleanup(&fgListOfFunction);
#endif

   //
   // logical
   //
   AddFormula(new TFormulaPrimitive("XandY","XandY",TFastFun::XandY));
   AddFormula(new TFormulaPrimitive("XorY","XorY",TFastFun::XorY));
   AddFormula(new TFormulaPrimitive("XNot","XNot",TFastFun::XNot));
   AddFormula(new TFormulaPrimitive("XlY","XlY",TFastFun::XlY));
   AddFormula(new TFormulaPrimitive("XleY","XleY",TFastFun::XleY));
   AddFormula(new TFormulaPrimitive("XgY","XgY",TFastFun::XgY));
   AddFormula(new TFormulaPrimitive("XgeY","XgeY",TFastFun::XgeY));
   AddFormula(new TFormulaPrimitive("XeY","XeY",TFastFun::XeY));
   AddFormula(new TFormulaPrimitive("XneY","XneY",TFastFun::XneY));
   // addition  + multiplication
   AddFormula(new TFormulaPrimitive("PlusXY","PlusXY",TFastFun::PlusXY));
   AddFormula(new TFormulaPrimitive("MinusXY","MinusXY",TFastFun::MinusXY));
   AddFormula(new TFormulaPrimitive("MultXY","MultXY",TFastFun::MultXY));
   AddFormula(new TFormulaPrimitive("DivXY","DivXY",TFastFun::DivXY));
   AddFormula(new TFormulaPrimitive("XpYpZ","XpYpZ",TFastFun::XpYpZ));
   AddFormula(new TFormulaPrimitive("XxYxZ","XxYxZ",TFastFun::XxYxZ));
   AddFormula(new TFormulaPrimitive("XxYpZ","XxYpZ",TFastFun::XxYpZ));
   AddFormula(new TFormulaPrimitive("XpYxZ","XpYxZ",TFastFun::XpYxZ));
   //
   //
   AddFormula(new TFormulaPrimitive("Gaus","Gaus",TFastFun::Gaus));
   AddFormula(new TFormulaPrimitive("Gausn","Gausn",TFastFun::Gausn));
   AddFormula(new TFormulaPrimitive("Landau","Landau",TFastFun::Landau));
   AddFormula(new TFormulaPrimitive("Landaun","Landaun",TFastFun::Landaun));
   //
   //
   // polynoms
   //
   //
   AddFormula(new TFormulaPrimitive("Pol0","Pol0",(GenFuncG)TFastFun::FPol0,1));
   AddFormula(new TFormulaPrimitive("Pol1","Pol1",(GenFuncG)TFastFun::FPol1,2));
   AddFormula(new TFormulaPrimitive("Pol2","Pol2",(GenFuncG)TFastFun::FPol2,3));
   AddFormula(new TFormulaPrimitive("Pol3","Pol3",(GenFuncG)TFastFun::FPol3,4));
   AddFormula(new TFormulaPrimitive("Pol4","Pol4",(GenFuncG)TFastFun::FPol4,5));
   AddFormula(new TFormulaPrimitive("Pol5","Pol5",(GenFuncG)TFastFun::FPol5,6));
   AddFormula(new TFormulaPrimitive("Pol6","Pol6",(GenFuncG)TFastFun::FPol6,7));
   AddFormula(new TFormulaPrimitive("Pol7","Pol7",(GenFuncG)TFastFun::FPol7,8));
   AddFormula(new TFormulaPrimitive("Pol8","Pol8",(GenFuncG)TFastFun::FPol8,9));
   AddFormula(new TFormulaPrimitive("Pol9","Pol9",(GenFuncG)TFastFun::FPol9,10));
   AddFormula(new TFormulaPrimitive("Pol10","Pol10",(GenFuncG)TFastFun::FPol10,11));
   //
   // pows
   AddFormula(new TFormulaPrimitive("Pow2","Pow2",TFastFun::Pow2));
   AddFormula(new TFormulaPrimitive("Pow3","Pow3",TFastFun::Pow3));
   AddFormula(new TFormulaPrimitive("Pow4","Pow4",TFastFun::Pow4));
   AddFormula(new TFormulaPrimitive("Pow5","Pow5",TFastFun::Pow5));
   //
   //
   AddFormula(new TFormulaPrimitive("TMath::Cos","TMath::Cos",cos));              // 10
   AddFormula(new TFormulaPrimitive("cos","cos",cos));                            // 10
   AddFormula(new TFormulaPrimitive("TMath::Sin","TMath::Sin",sin));              // 11
   AddFormula(new TFormulaPrimitive("sin","sin",sin));                            // 11
   AddFormula(new TFormulaPrimitive("TMath::Tan","TMath::Tan",tan));              // 12
   AddFormula(new TFormulaPrimitive("tan","tan",tan));                            // 12
   AddFormula(new TFormulaPrimitive("TMath::ACos","TMath::ACos",acos));           // 13
   AddFormula(new TFormulaPrimitive("acos","acos",acos));                         // 13
   AddFormula(new TFormulaPrimitive("TMath::ASin","TMath::ASin",asin));           // 14
   AddFormula(new TFormulaPrimitive("asin","asin",asin));                         // 14
   AddFormula(new TFormulaPrimitive("TMath::ATan","TMath::ATan",atan));           // 15
   AddFormula(new TFormulaPrimitive("atan","atan",atan));                         // 15
   AddFormula(new TFormulaPrimitive("TMath::ATan2","TMath::ATan2",atan2));        // 16
   AddFormula(new TFormulaPrimitive("atan2","atan2",atan2));                      // 16
   //   kpow      = 20, ksq = 21, ksqrt     = 22,
   AddFormula(new TFormulaPrimitive("pow","pow",TMath::Power));                 //20
   AddFormula(new TFormulaPrimitive("sq","sq",TFastFun::Pow2));                 //21
   AddFormula(new TFormulaPrimitive("sqrt","sqrt",TFastFun::Sqrt));             //22
   // kmin      = 24, kmax = 25,
   AddFormula(new TFormulaPrimitive("min","min",(GenFunc110)TMath::Min));       //24
   AddFormula(new TFormulaPrimitive("max","max",(GenFunc110)TMath::Max));       //25
   // klog      = 30, kexp = 31, klog10 = 32,
   AddFormula(new TFormulaPrimitive("log","log",TMath::Log));                           //30
   AddFormula(new TFormulaPrimitive("exp","exp",TMath::Exp));                           //31
   AddFormula(new TFormulaPrimitive("log10","log10",TMath::Log10));                     //32
   //
   //    cosh        70                  acosh        73
   //    sinh        71                  asinh        74
   //    tanh        72                  atanh        75
   //
   AddFormula(new TFormulaPrimitive("TMath::CosH","TMath::Cosh",cosh));                     // 70
   AddFormula(new TFormulaPrimitive("cosh","cosh",cosh));                                   // 70
   AddFormula(new TFormulaPrimitive("TMath::SinH","TMath::SinH",sinh));                     // 71
   AddFormula(new TFormulaPrimitive("sinh","sinh",sinh));                                   // 71
   AddFormula(new TFormulaPrimitive("TMath::TanH","TMath::Tanh",tanh));                     // 72
   AddFormula(new TFormulaPrimitive("tanh","tanh",tanh));                                   // 72
   AddFormula(new TFormulaPrimitive("TMath::ACosH","TMath::ACosh",TMath::ACosH));           // 73
   AddFormula(new TFormulaPrimitive("acosh","acosH",TMath::ACosH));                         // 73
   AddFormula(new TFormulaPrimitive("TMath::ASinH","TMath::ASinh",TMath::ASinH));           // 74
   AddFormula(new TFormulaPrimitive("acosh","acosH",TMath::ASinH));                         // 74
   AddFormula(new TFormulaPrimitive("TMath::ATanH","TMath::ATanh",TMath::ATanH));           // 75
   AddFormula(new TFormulaPrimitive("atanh","atanh",TMath::ATanH));                         // 75
   //
   AddFormula(new TFormulaPrimitive("TMath::Abs","TMath::Abs",TMath::Abs));
   AddFormula(new TFormulaPrimitive("TMath::BreitWigner","TMath::BreitWigner",TMath::BreitWigner));

   //Disable direct access to TMath::Landau for now because of the default parameter.
   //AddFormula(new TFormulaPrimitive("TMath::Landau","TMath::Landau",(TFormulaPrimitive::GenFunc1110)TMath::Landau));

   TMath_GenerInterface();
   return 1;
}
 TFormulaPrimitive.cxx:1
 TFormulaPrimitive.cxx:2
 TFormulaPrimitive.cxx:3
 TFormulaPrimitive.cxx:4
 TFormulaPrimitive.cxx:5
 TFormulaPrimitive.cxx:6
 TFormulaPrimitive.cxx:7
 TFormulaPrimitive.cxx:8
 TFormulaPrimitive.cxx:9
 TFormulaPrimitive.cxx:10
 TFormulaPrimitive.cxx:11
 TFormulaPrimitive.cxx:12
 TFormulaPrimitive.cxx:13
 TFormulaPrimitive.cxx:14
 TFormulaPrimitive.cxx:15
 TFormulaPrimitive.cxx:16
 TFormulaPrimitive.cxx:17
 TFormulaPrimitive.cxx:18
 TFormulaPrimitive.cxx:19
 TFormulaPrimitive.cxx:20
 TFormulaPrimitive.cxx:21
 TFormulaPrimitive.cxx:22
 TFormulaPrimitive.cxx:23
 TFormulaPrimitive.cxx:24
 TFormulaPrimitive.cxx:25
 TFormulaPrimitive.cxx:26
 TFormulaPrimitive.cxx:27
 TFormulaPrimitive.cxx:28
 TFormulaPrimitive.cxx:29
 TFormulaPrimitive.cxx:30
 TFormulaPrimitive.cxx:31
 TFormulaPrimitive.cxx:32
 TFormulaPrimitive.cxx:33
 TFormulaPrimitive.cxx:34
 TFormulaPrimitive.cxx:35
 TFormulaPrimitive.cxx:36
 TFormulaPrimitive.cxx:37
 TFormulaPrimitive.cxx:38
 TFormulaPrimitive.cxx:39
 TFormulaPrimitive.cxx:40
 TFormulaPrimitive.cxx:41
 TFormulaPrimitive.cxx:42
 TFormulaPrimitive.cxx:43
 TFormulaPrimitive.cxx:44
 TFormulaPrimitive.cxx:45
 TFormulaPrimitive.cxx:46
 TFormulaPrimitive.cxx:47
 TFormulaPrimitive.cxx:48
 TFormulaPrimitive.cxx:49
 TFormulaPrimitive.cxx:50
 TFormulaPrimitive.cxx:51
 TFormulaPrimitive.cxx:52
 TFormulaPrimitive.cxx:53
 TFormulaPrimitive.cxx:54
 TFormulaPrimitive.cxx:55
 TFormulaPrimitive.cxx:56
 TFormulaPrimitive.cxx:57
 TFormulaPrimitive.cxx:58
 TFormulaPrimitive.cxx:59
 TFormulaPrimitive.cxx:60
 TFormulaPrimitive.cxx:61
 TFormulaPrimitive.cxx:62
 TFormulaPrimitive.cxx:63
 TFormulaPrimitive.cxx:64
 TFormulaPrimitive.cxx:65
 TFormulaPrimitive.cxx:66
 TFormulaPrimitive.cxx:67
 TFormulaPrimitive.cxx:68
 TFormulaPrimitive.cxx:69
 TFormulaPrimitive.cxx:70
 TFormulaPrimitive.cxx:71
 TFormulaPrimitive.cxx:72
 TFormulaPrimitive.cxx:73
 TFormulaPrimitive.cxx:74
 TFormulaPrimitive.cxx:75
 TFormulaPrimitive.cxx:76
 TFormulaPrimitive.cxx:77
 TFormulaPrimitive.cxx:78
 TFormulaPrimitive.cxx:79
 TFormulaPrimitive.cxx:80
 TFormulaPrimitive.cxx:81
 TFormulaPrimitive.cxx:82
 TFormulaPrimitive.cxx:83
 TFormulaPrimitive.cxx:84
 TFormulaPrimitive.cxx:85
 TFormulaPrimitive.cxx:86
 TFormulaPrimitive.cxx:87
 TFormulaPrimitive.cxx:88
 TFormulaPrimitive.cxx:89
 TFormulaPrimitive.cxx:90
 TFormulaPrimitive.cxx:91
 TFormulaPrimitive.cxx:92
 TFormulaPrimitive.cxx:93
 TFormulaPrimitive.cxx:94
 TFormulaPrimitive.cxx:95
 TFormulaPrimitive.cxx:96
 TFormulaPrimitive.cxx:97
 TFormulaPrimitive.cxx:98
 TFormulaPrimitive.cxx:99
 TFormulaPrimitive.cxx:100
 TFormulaPrimitive.cxx:101
 TFormulaPrimitive.cxx:102
 TFormulaPrimitive.cxx:103
 TFormulaPrimitive.cxx:104
 TFormulaPrimitive.cxx:105
 TFormulaPrimitive.cxx:106
 TFormulaPrimitive.cxx:107
 TFormulaPrimitive.cxx:108
 TFormulaPrimitive.cxx:109
 TFormulaPrimitive.cxx:110
 TFormulaPrimitive.cxx:111
 TFormulaPrimitive.cxx:112
 TFormulaPrimitive.cxx:113
 TFormulaPrimitive.cxx:114
 TFormulaPrimitive.cxx:115
 TFormulaPrimitive.cxx:116
 TFormulaPrimitive.cxx:117
 TFormulaPrimitive.cxx:118
 TFormulaPrimitive.cxx:119
 TFormulaPrimitive.cxx:120
 TFormulaPrimitive.cxx:121
 TFormulaPrimitive.cxx:122
 TFormulaPrimitive.cxx:123
 TFormulaPrimitive.cxx:124
 TFormulaPrimitive.cxx:125
 TFormulaPrimitive.cxx:126
 TFormulaPrimitive.cxx:127
 TFormulaPrimitive.cxx:128
 TFormulaPrimitive.cxx:129
 TFormulaPrimitive.cxx:130
 TFormulaPrimitive.cxx:131
 TFormulaPrimitive.cxx:132
 TFormulaPrimitive.cxx:133
 TFormulaPrimitive.cxx:134
 TFormulaPrimitive.cxx:135
 TFormulaPrimitive.cxx:136
 TFormulaPrimitive.cxx:137
 TFormulaPrimitive.cxx:138
 TFormulaPrimitive.cxx:139
 TFormulaPrimitive.cxx:140
 TFormulaPrimitive.cxx:141
 TFormulaPrimitive.cxx:142
 TFormulaPrimitive.cxx:143
 TFormulaPrimitive.cxx:144
 TFormulaPrimitive.cxx:145
 TFormulaPrimitive.cxx:146
 TFormulaPrimitive.cxx:147
 TFormulaPrimitive.cxx:148
 TFormulaPrimitive.cxx:149
 TFormulaPrimitive.cxx:150
 TFormulaPrimitive.cxx:151
 TFormulaPrimitive.cxx:152
 TFormulaPrimitive.cxx:153
 TFormulaPrimitive.cxx:154
 TFormulaPrimitive.cxx:155
 TFormulaPrimitive.cxx:156
 TFormulaPrimitive.cxx:157
 TFormulaPrimitive.cxx:158
 TFormulaPrimitive.cxx:159
 TFormulaPrimitive.cxx:160
 TFormulaPrimitive.cxx:161
 TFormulaPrimitive.cxx:162
 TFormulaPrimitive.cxx:163
 TFormulaPrimitive.cxx:164
 TFormulaPrimitive.cxx:165
 TFormulaPrimitive.cxx:166
 TFormulaPrimitive.cxx:167
 TFormulaPrimitive.cxx:168
 TFormulaPrimitive.cxx:169
 TFormulaPrimitive.cxx:170
 TFormulaPrimitive.cxx:171
 TFormulaPrimitive.cxx:172
 TFormulaPrimitive.cxx:173
 TFormulaPrimitive.cxx:174
 TFormulaPrimitive.cxx:175
 TFormulaPrimitive.cxx:176
 TFormulaPrimitive.cxx:177
 TFormulaPrimitive.cxx:178
 TFormulaPrimitive.cxx:179
 TFormulaPrimitive.cxx:180
 TFormulaPrimitive.cxx:181
 TFormulaPrimitive.cxx:182
 TFormulaPrimitive.cxx:183
 TFormulaPrimitive.cxx:184
 TFormulaPrimitive.cxx:185
 TFormulaPrimitive.cxx:186
 TFormulaPrimitive.cxx:187
 TFormulaPrimitive.cxx:188
 TFormulaPrimitive.cxx:189
 TFormulaPrimitive.cxx:190
 TFormulaPrimitive.cxx:191
 TFormulaPrimitive.cxx:192
 TFormulaPrimitive.cxx:193
 TFormulaPrimitive.cxx:194
 TFormulaPrimitive.cxx:195
 TFormulaPrimitive.cxx:196
 TFormulaPrimitive.cxx:197
 TFormulaPrimitive.cxx:198
 TFormulaPrimitive.cxx:199
 TFormulaPrimitive.cxx:200
 TFormulaPrimitive.cxx:201
 TFormulaPrimitive.cxx:202
 TFormulaPrimitive.cxx:203
 TFormulaPrimitive.cxx:204
 TFormulaPrimitive.cxx:205
 TFormulaPrimitive.cxx:206
 TFormulaPrimitive.cxx:207
 TFormulaPrimitive.cxx:208
 TFormulaPrimitive.cxx:209
 TFormulaPrimitive.cxx:210
 TFormulaPrimitive.cxx:211
 TFormulaPrimitive.cxx:212
 TFormulaPrimitive.cxx:213
 TFormulaPrimitive.cxx:214
 TFormulaPrimitive.cxx:215
 TFormulaPrimitive.cxx:216
 TFormulaPrimitive.cxx:217
 TFormulaPrimitive.cxx:218
 TFormulaPrimitive.cxx:219
 TFormulaPrimitive.cxx:220
 TFormulaPrimitive.cxx:221
 TFormulaPrimitive.cxx:222
 TFormulaPrimitive.cxx:223
 TFormulaPrimitive.cxx:224
 TFormulaPrimitive.cxx:225
 TFormulaPrimitive.cxx:226
 TFormulaPrimitive.cxx:227
 TFormulaPrimitive.cxx:228
 TFormulaPrimitive.cxx:229
 TFormulaPrimitive.cxx:230
 TFormulaPrimitive.cxx:231
 TFormulaPrimitive.cxx:232
 TFormulaPrimitive.cxx:233
 TFormulaPrimitive.cxx:234
 TFormulaPrimitive.cxx:235
 TFormulaPrimitive.cxx:236
 TFormulaPrimitive.cxx:237
 TFormulaPrimitive.cxx:238
 TFormulaPrimitive.cxx:239
 TFormulaPrimitive.cxx:240
 TFormulaPrimitive.cxx:241
 TFormulaPrimitive.cxx:242
 TFormulaPrimitive.cxx:243
 TFormulaPrimitive.cxx:244
 TFormulaPrimitive.cxx:245
 TFormulaPrimitive.cxx:246
 TFormulaPrimitive.cxx:247
 TFormulaPrimitive.cxx:248
 TFormulaPrimitive.cxx:249
 TFormulaPrimitive.cxx:250
 TFormulaPrimitive.cxx:251
 TFormulaPrimitive.cxx:252
 TFormulaPrimitive.cxx:253
 TFormulaPrimitive.cxx:254
 TFormulaPrimitive.cxx:255
 TFormulaPrimitive.cxx:256
 TFormulaPrimitive.cxx:257
 TFormulaPrimitive.cxx:258
 TFormulaPrimitive.cxx:259
 TFormulaPrimitive.cxx:260
 TFormulaPrimitive.cxx:261
 TFormulaPrimitive.cxx:262
 TFormulaPrimitive.cxx:263
 TFormulaPrimitive.cxx:264
 TFormulaPrimitive.cxx:265
 TFormulaPrimitive.cxx:266
 TFormulaPrimitive.cxx:267
 TFormulaPrimitive.cxx:268
 TFormulaPrimitive.cxx:269
 TFormulaPrimitive.cxx:270
 TFormulaPrimitive.cxx:271
 TFormulaPrimitive.cxx:272
 TFormulaPrimitive.cxx:273
 TFormulaPrimitive.cxx:274
 TFormulaPrimitive.cxx:275
 TFormulaPrimitive.cxx:276
 TFormulaPrimitive.cxx:277
 TFormulaPrimitive.cxx:278
 TFormulaPrimitive.cxx:279
 TFormulaPrimitive.cxx:280
 TFormulaPrimitive.cxx:281
 TFormulaPrimitive.cxx:282
 TFormulaPrimitive.cxx:283
 TFormulaPrimitive.cxx:284
 TFormulaPrimitive.cxx:285
 TFormulaPrimitive.cxx:286
 TFormulaPrimitive.cxx:287
 TFormulaPrimitive.cxx:288
 TFormulaPrimitive.cxx:289
 TFormulaPrimitive.cxx:290
 TFormulaPrimitive.cxx:291
 TFormulaPrimitive.cxx:292
 TFormulaPrimitive.cxx:293
 TFormulaPrimitive.cxx:294
 TFormulaPrimitive.cxx:295
 TFormulaPrimitive.cxx:296
 TFormulaPrimitive.cxx:297
 TFormulaPrimitive.cxx:298
 TFormulaPrimitive.cxx:299
 TFormulaPrimitive.cxx:300
 TFormulaPrimitive.cxx:301
 TFormulaPrimitive.cxx:302
 TFormulaPrimitive.cxx:303
 TFormulaPrimitive.cxx:304
 TFormulaPrimitive.cxx:305
 TFormulaPrimitive.cxx:306
 TFormulaPrimitive.cxx:307
 TFormulaPrimitive.cxx:308
 TFormulaPrimitive.cxx:309
 TFormulaPrimitive.cxx:310
 TFormulaPrimitive.cxx:311
 TFormulaPrimitive.cxx:312
 TFormulaPrimitive.cxx:313
 TFormulaPrimitive.cxx:314
 TFormulaPrimitive.cxx:315
 TFormulaPrimitive.cxx:316
 TFormulaPrimitive.cxx:317
 TFormulaPrimitive.cxx:318
 TFormulaPrimitive.cxx:319
 TFormulaPrimitive.cxx:320
 TFormulaPrimitive.cxx:321
 TFormulaPrimitive.cxx:322
 TFormulaPrimitive.cxx:323
 TFormulaPrimitive.cxx:324
 TFormulaPrimitive.cxx:325
 TFormulaPrimitive.cxx:326
 TFormulaPrimitive.cxx:327
 TFormulaPrimitive.cxx:328
 TFormulaPrimitive.cxx:329
 TFormulaPrimitive.cxx:330
 TFormulaPrimitive.cxx:331
 TFormulaPrimitive.cxx:332
 TFormulaPrimitive.cxx:333
 TFormulaPrimitive.cxx:334
 TFormulaPrimitive.cxx:335
 TFormulaPrimitive.cxx:336
 TFormulaPrimitive.cxx:337
 TFormulaPrimitive.cxx:338
 TFormulaPrimitive.cxx:339
 TFormulaPrimitive.cxx:340
 TFormulaPrimitive.cxx:341
 TFormulaPrimitive.cxx:342
 TFormulaPrimitive.cxx:343
 TFormulaPrimitive.cxx:344
 TFormulaPrimitive.cxx:345
 TFormulaPrimitive.cxx:346
 TFormulaPrimitive.cxx:347
 TFormulaPrimitive.cxx:348
 TFormulaPrimitive.cxx:349
 TFormulaPrimitive.cxx:350
 TFormulaPrimitive.cxx:351
 TFormulaPrimitive.cxx:352
 TFormulaPrimitive.cxx:353
 TFormulaPrimitive.cxx:354
 TFormulaPrimitive.cxx:355
 TFormulaPrimitive.cxx:356
 TFormulaPrimitive.cxx:357
 TFormulaPrimitive.cxx:358
 TFormulaPrimitive.cxx:359
 TFormulaPrimitive.cxx:360
 TFormulaPrimitive.cxx:361
 TFormulaPrimitive.cxx:362
 TFormulaPrimitive.cxx:363
 TFormulaPrimitive.cxx:364
 TFormulaPrimitive.cxx:365
 TFormulaPrimitive.cxx:366
 TFormulaPrimitive.cxx:367
 TFormulaPrimitive.cxx:368
 TFormulaPrimitive.cxx:369
 TFormulaPrimitive.cxx:370
 TFormulaPrimitive.cxx:371
 TFormulaPrimitive.cxx:372
 TFormulaPrimitive.cxx:373
 TFormulaPrimitive.cxx:374
 TFormulaPrimitive.cxx:375
 TFormulaPrimitive.cxx:376
 TFormulaPrimitive.cxx:377
 TFormulaPrimitive.cxx:378
 TFormulaPrimitive.cxx:379
 TFormulaPrimitive.cxx:380
 TFormulaPrimitive.cxx:381
 TFormulaPrimitive.cxx:382
 TFormulaPrimitive.cxx:383
 TFormulaPrimitive.cxx:384
 TFormulaPrimitive.cxx:385
 TFormulaPrimitive.cxx:386
 TFormulaPrimitive.cxx:387
 TFormulaPrimitive.cxx:388
 TFormulaPrimitive.cxx:389
 TFormulaPrimitive.cxx:390
 TFormulaPrimitive.cxx:391
 TFormulaPrimitive.cxx:392
 TFormulaPrimitive.cxx:393
 TFormulaPrimitive.cxx:394
 TFormulaPrimitive.cxx:395
 TFormulaPrimitive.cxx:396
 TFormulaPrimitive.cxx:397
 TFormulaPrimitive.cxx:398
 TFormulaPrimitive.cxx:399
 TFormulaPrimitive.cxx:400
 TFormulaPrimitive.cxx:401
 TFormulaPrimitive.cxx:402
 TFormulaPrimitive.cxx:403
 TFormulaPrimitive.cxx:404
 TFormulaPrimitive.cxx:405
 TFormulaPrimitive.cxx:406
 TFormulaPrimitive.cxx:407
 TFormulaPrimitive.cxx:408
 TFormulaPrimitive.cxx:409
 TFormulaPrimitive.cxx:410
 TFormulaPrimitive.cxx:411
 TFormulaPrimitive.cxx:412
 TFormulaPrimitive.cxx:413
 TFormulaPrimitive.cxx:414
 TFormulaPrimitive.cxx:415
 TFormulaPrimitive.cxx:416
 TFormulaPrimitive.cxx:417
 TFormulaPrimitive.cxx:418
 TFormulaPrimitive.cxx:419
 TFormulaPrimitive.cxx:420
 TFormulaPrimitive.cxx:421
 TFormulaPrimitive.cxx:422
 TFormulaPrimitive.cxx:423
 TFormulaPrimitive.cxx:424
 TFormulaPrimitive.cxx:425
 TFormulaPrimitive.cxx:426
 TFormulaPrimitive.cxx:427
 TFormulaPrimitive.cxx:428
 TFormulaPrimitive.cxx:429
 TFormulaPrimitive.cxx:430
 TFormulaPrimitive.cxx:431
 TFormulaPrimitive.cxx:432
 TFormulaPrimitive.cxx:433
 TFormulaPrimitive.cxx:434
 TFormulaPrimitive.cxx:435
 TFormulaPrimitive.cxx:436
 TFormulaPrimitive.cxx:437
 TFormulaPrimitive.cxx:438
 TFormulaPrimitive.cxx:439
 TFormulaPrimitive.cxx:440
 TFormulaPrimitive.cxx:441
 TFormulaPrimitive.cxx:442
 TFormulaPrimitive.cxx:443
 TFormulaPrimitive.cxx:444
 TFormulaPrimitive.cxx:445
 TFormulaPrimitive.cxx:446
 TFormulaPrimitive.cxx:447
 TFormulaPrimitive.cxx:448
 TFormulaPrimitive.cxx:449
 TFormulaPrimitive.cxx:450
 TFormulaPrimitive.cxx:451
 TFormulaPrimitive.cxx:452
 TFormulaPrimitive.cxx:453
 TFormulaPrimitive.cxx:454
 TFormulaPrimitive.cxx:455
 TFormulaPrimitive.cxx:456
 TFormulaPrimitive.cxx:457
 TFormulaPrimitive.cxx:458
 TFormulaPrimitive.cxx:459
 TFormulaPrimitive.cxx:460
 TFormulaPrimitive.cxx:461
 TFormulaPrimitive.cxx:462
 TFormulaPrimitive.cxx:463
 TFormulaPrimitive.cxx:464
 TFormulaPrimitive.cxx:465
 TFormulaPrimitive.cxx:466
 TFormulaPrimitive.cxx:467
 TFormulaPrimitive.cxx:468
 TFormulaPrimitive.cxx:469
 TFormulaPrimitive.cxx:470
 TFormulaPrimitive.cxx:471
 TFormulaPrimitive.cxx:472
 TFormulaPrimitive.cxx:473
 TFormulaPrimitive.cxx:474
 TFormulaPrimitive.cxx:475
 TFormulaPrimitive.cxx:476
 TFormulaPrimitive.cxx:477
 TFormulaPrimitive.cxx:478
 TFormulaPrimitive.cxx:479
 TFormulaPrimitive.cxx:480
 TFormulaPrimitive.cxx:481
 TFormulaPrimitive.cxx:482
 TFormulaPrimitive.cxx:483
 TFormulaPrimitive.cxx:484
 TFormulaPrimitive.cxx:485
 TFormulaPrimitive.cxx:486
 TFormulaPrimitive.cxx:487
 TFormulaPrimitive.cxx:488
 TFormulaPrimitive.cxx:489
 TFormulaPrimitive.cxx:490
 TFormulaPrimitive.cxx:491
 TFormulaPrimitive.cxx:492
 TFormulaPrimitive.cxx:493
 TFormulaPrimitive.cxx:494
 TFormulaPrimitive.cxx:495
 TFormulaPrimitive.cxx:496
 TFormulaPrimitive.cxx:497
 TFormulaPrimitive.cxx:498
 TFormulaPrimitive.cxx:499
 TFormulaPrimitive.cxx:500
 TFormulaPrimitive.cxx:501
 TFormulaPrimitive.cxx:502
 TFormulaPrimitive.cxx:503
 TFormulaPrimitive.cxx:504
 TFormulaPrimitive.cxx:505
 TFormulaPrimitive.cxx:506
 TFormulaPrimitive.cxx:507
 TFormulaPrimitive.cxx:508
 TFormulaPrimitive.cxx:509
 TFormulaPrimitive.cxx:510
 TFormulaPrimitive.cxx:511
 TFormulaPrimitive.cxx:512
 TFormulaPrimitive.cxx:513
 TFormulaPrimitive.cxx:514
 TFormulaPrimitive.cxx:515
 TFormulaPrimitive.cxx:516
 TFormulaPrimitive.cxx:517
 TFormulaPrimitive.cxx:518
 TFormulaPrimitive.cxx:519
 TFormulaPrimitive.cxx:520
 TFormulaPrimitive.cxx:521
 TFormulaPrimitive.cxx:522
 TFormulaPrimitive.cxx:523
 TFormulaPrimitive.cxx:524
 TFormulaPrimitive.cxx:525
 TFormulaPrimitive.cxx:526
 TFormulaPrimitive.cxx:527
 TFormulaPrimitive.cxx:528