Changeset 19256


Ignore:
Timestamp:
Oct 22, 2018, 6:49:04 PM (3 months ago)
Author:
tbretz
Message:
Compatibility with root 6 -- untested
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mdata/MDataPhrase.cc

    r9552 r19256  
    116116#include <TFormula.h>
    117117#if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00)
     118#if ROOT_VERSION_CODE < ROOT_VERSION(6,00,00)
    118119#include <TFormulaPrimitive.h>
     120#else
     121#include <v5/TFormulaPrimitive.h>
     122#endif
    119123#endif
    120124
     
    472476MDataPhrase::MDataPhrase(const char *rule, const char *name, const char *title) : fFormula(0)
    473477{
     478#if ROOT_VERSION_CODE < ROOT_VERSION(6,00,00)
     479#define TFP TFormulaPrimtive
     480#else
     481#define TFP ROOT::v5::TFormulaPrimitive
     482#endif
     483
    474484    // More in TFormulaPrimitive.cxx
    475485    // More in TFormulaMathInterface
    476     if (!TFormulaPrimitive::FindFormula("isnan"))
    477     {
    478         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("log2",   "log2",   (TFormulaPrimitive::GenFunc10)TMath::Log2));
    479         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("fabs",   "fabs",   (TFormulaPrimitive::GenFunc10)TMath::Abs));
    480         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("floor",  "floor",  (TFormulaPrimitive::GenFunc10)TMath::Floor));
    481         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("ceil",   "ceil",   (TFormulaPrimitive::GenFunc10)TMath::Ceil));
    482 
    483         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("nint",   "nint",   (TFormulaPrimitive::GenFunc10)MFastFun::Nint));
    484         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("round",  "round",  (TFormulaPrimitive::GenFunc10)MFastFun::Nint));
    485         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("sgn",    "sgn",    (TFormulaPrimitive::GenFunc10)MFastFun::Sign));
    486 
    487         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("isnan",  "isnan",  (TFormulaPrimitive::GenFunc10)MFastFun::IsNaN));
    488         TFormulaPrimitive::AddFormula(new TFormulaPrimitive("finite", "finite", (TFormulaPrimitive::GenFunc10)MFastFun::Finite));
     486    if (!TFP::FindFormula("isnan"))
     487    {
     488        TFP::AddFormula(new TFP("log2",   "log2",   (TFP::GenFunc10)TMath::Log2));
     489        TFP::AddFormula(new TFP("fabs",   "fabs",   (TFP::GenFunc10)TMath::Abs));
     490        TFP::AddFormula(new TFP("floor",  "floor",  (TFP::GenFunc10)TMath::Floor));
     491        TFP::AddFormula(new TFP("ceil",   "ceil",   (TFP::GenFunc10)TMath::Ceil));
     492
     493        TFP::AddFormula(new TFP("nint",   "nint",   (TFP::GenFunc10)MFastFun::Nint));
     494        TFP::AddFormula(new TFP("round",  "round",  (TFP::GenFunc10)MFastFun::Nint));
     495        TFP::AddFormula(new TFP("sgn",    "sgn",    (TFP::GenFunc10)MFastFun::Sign));
     496
     497        TFP::AddFormula(new TFP("isnan",  "isnan",  (TFP::GenFunc10)MFastFun::IsNaN));
     498        TFP::AddFormula(new TFP("finite", "finite", (TFP::GenFunc10)MFastFun::Finite));
    489499    }
    490500
Note: See TracChangeset for help on using the changeset viewer.