Fork me on GitHub

Changeset f59e9c1 in git for classes/DelphesTF2.cc


Ignore:
Timestamp:
Jun 24, 2015, 5:44:37 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
c9803f7
Parents:
3cac201
Message:

adapt DelphesFormula and DelphesTF2 to ROOT 6.04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesTF2.cc

    r3cac201 rf59e9c1  
    1818
    1919#include "classes/DelphesTF2.h"
     20
     21#include "RVersion.h"
    2022#include "TString.h"
     23
    2124#include <stdexcept>
    22 #include <string>
    2325
    2426using namespace std;
     
    3436
    3537DelphesTF2::DelphesTF2(const char *name, const char *expression) :
    36   TF2(name,expression)
     38  TF2(name, expression)
    3739{
    3840}
     
    4648//------------------------------------------------------------------------------
    4749
    48 Int_t DelphesTF2::DefinedVariable(TString &chaine, Int_t &action)
     50Int_t DelphesTF2::Compile(const char *expression)
    4951{
    50   action = kVariable;
    51   if(chaine == "z")
     52  TString buffer;
     53  const char *it;
     54  for(it = expression; *it; ++it)
    5255  {
    53     if(fNdim < 1) fNdim = 1;
    54     return 0;
     56    if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
     57    buffer.Append(*it);
    5558  }
    56   else if(chaine == "t")
     59  buffer.ReplaceAll("z", "x");
     60  buffer.ReplaceAll("t", "y");
     61#if  ROOT_VERSION_CODE < ROOT_VERSION(6,04,00)
     62  if(TF2::Compile(buffer) != 0)
     63#else
     64  if(TF2::GetFormula()->Compile(buffer) != 0)
     65#endif
    5766  {
    58     if(fNdim < 2) fNdim = 2;
    59     return 1;
     67    throw runtime_error("Invalid formula.");
    6068  }
    61   return -1;
     69  return 0;
    6270}
    6371
Note: See TracChangeset for help on using the changeset viewer.