Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:56:28

0001 // @(#)root/hist:$Id$
0002 // Author: Marian Ivanov, 2005
0003 
0004 /*************************************************************************
0005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006 * All rights reserved.                                                  *
0007 *                                                                       *
0008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010 *************************************************************************/
0011 // ---------------------------------- TFormulaPrimitive.h
0012 
0013 #ifndef ROOT_v5_TFormulaPrimitive
0014 #define ROOT_v5_TFormulaPrimitive
0015 
0016 
0017 
0018 //////////////////////////////////////////////////////////////////////////
0019 //                                                                      //
0020 // TFormulaPrimitive                                                    //
0021 //                                                                      //
0022 // The formula primitive base class                                     //
0023 //                                                                      //
0024 //////////////////////////////////////////////////////////////////////////
0025 
0026 #include "TNamed.h"
0027 #include "TBits.h"
0028 
0029 class TObjArray;
0030 
0031 namespace ROOT {
0032 
0033    namespace v5 {
0034 
0035 class TFormula;
0036 
0037 class TFormulaPrimitive : public TNamed
0038 {
0039    friend class ROOT::v5::TFormula;
0040 public:
0041    typedef Double_t (*GenFuncG)(const Double_t*,const Double_t*);
0042    typedef Double_t (*GenFunc0)();
0043    typedef Double_t (*GenFunc10)(Double_t);
0044    typedef Double_t (*GenFunc110)(Double_t,Double_t);
0045    typedef Double_t (*GenFunc1110)(Double_t,Double_t, Double_t);
0046    typedef Double_t (TObject::*TFuncG)(const Double_t*,const Double_t*) const;
0047    typedef Double_t (TObject::*TFunc0)() const;
0048    typedef Double_t (TObject::*TFunc10)(Double_t) const;
0049    typedef Double_t (TObject::*TFunc110)(Double_t,Double_t) const;
0050    typedef Double_t (TObject::*TFunc1110)(Double_t,Double_t,Double_t) const;
0051 protected:
0052    static TObjArray * fgListOfFunction;                   //!list of global primitive formulas
0053    static Int_t       BuildBasicFormulas();               //build list of basic formulas
0054    union {
0055       GenFuncG    fFuncG;                                 //!pointer to the TFormula generic function
0056       GenFunc0    fFunc0;                                 //!pointer to the function
0057       GenFunc10   fFunc10;                                //!pointer to the function
0058       GenFunc110  fFunc110;                               //!pointer to the function
0059       GenFunc1110 fFunc1110;                              //!pointer to the function
0060       TFuncG      fTFuncG;                                //!pointer to the TFormula generic function
0061       TFunc0      fTFunc0;                                //! pointer to member function
0062       TFunc10     fTFunc10;                               //! pointer to member function
0063       TFunc110    fTFunc110;                              //! pointer to member function
0064       TFunc1110   fTFunc1110;                             //! pointer to member function
0065    };
0066    Int_t      fType;                                      //type of the function
0067    Int_t      fNArguments;                                //number of arguments
0068    Int_t      fNParameters;                               //number of parameters
0069    Bool_t     fIsStatic;                                  // indication if the function is static
0070 private:
0071    TFormulaPrimitive(const TFormulaPrimitive&) = delete;
0072    TFormulaPrimitive& operator=(const TFormulaPrimitive&) = delete;
0073 public:
0074    TFormulaPrimitive();
0075    TFormulaPrimitive(const char *name,const char *formula, GenFunc0 fpointer);
0076    TFormulaPrimitive(const char *name,const char *formula, GenFunc10 fpointer);
0077    TFormulaPrimitive(const char *name,const char *formula, GenFunc110 fpointer);
0078    TFormulaPrimitive(const char *name,const char *formula, GenFunc1110 fpointer);
0079    TFormulaPrimitive(const char *name,const char *formula, GenFuncG fpointer,Int_t npar);
0080    TFormulaPrimitive(const char *name,const char *formula, TFunc0 fpointer);
0081    TFormulaPrimitive(const char *name,const char *formula, TFunc10 fpointer);
0082    TFormulaPrimitive(const char *name,const char *formula, TFunc110 fpointer);
0083    TFormulaPrimitive(const char *name,const char *formula, TFunc1110 fpointer);
0084    TFormulaPrimitive(const char *name,const char *formula, TFuncG fpointer);
0085    static Int_t AddFormula(TFormulaPrimitive * formula);
0086    static TFormulaPrimitive* FindFormula(const char* name);
0087    static TFormulaPrimitive* FindFormula(const char* name, const char *args);
0088    static TFormulaPrimitive* FindFormula(const char* name, UInt_t nargs);
0089    Double_t Eval(Double_t* x);                   //eval primitive function
0090    Double_t Eval(TObject *o,  Double_t *x);      //eval member function
0091    Double_t Eval(Double_t *x, Double_t *param);  //eval primitive parametric function
0092 
0093    ClassDefOverride(ROOT::v5::TFormulaPrimitive,0)  //The primitive formula
0094 };
0095 
0096    } // end namespace v5
0097 
0098 } // end namespace ROOT
0099 
0100 
0101 #endif