Fork me on GitHub

Changeset d38348d in git for classes


Ignore:
Timestamp:
Jun 26, 2015, 11:46:42 AM (9 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
fe0273c
Parents:
1d9974e (diff), f53a4d2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge pull request #14 from delphes/master

synchronize mergeCMS with master

Location:
classes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesFormula.cc

    r1d9974e rd38348d  
    2323
    2424#include <stdexcept>
    25 #include <string>
    2625
    2726using namespace std;
     
    5150Int_t DelphesFormula::Compile(const char *expression)
    5251{
    53   string buffer;
     52  TString buffer;
    5453  const char *it;
    5554  for(it = expression; *it; ++it)
    5655  {
    5756    if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;
    58     buffer.push_back(*it);
     57    buffer.Append(*it);
    5958  }
    60   if(TFormula::Compile(buffer.c_str()) != 0)
     59  buffer.ReplaceAll("pt", "x");
     60  buffer.ReplaceAll("eta", "y");
     61  buffer.ReplaceAll("phi", "z");
     62  buffer.ReplaceAll("energy", "t");
     63  if(TFormula::Compile(buffer) != 0)
    6164  {
    6265    throw runtime_error("Invalid formula.");
     
    7477
    7578//------------------------------------------------------------------------------
    76 
    77 Int_t DelphesFormula::DefinedVariable(TString &chaine, Int_t &action)
    78 {
    79   action = kVariable;
    80   if(chaine == "pt")
    81   {
    82     if(fNdim < 1) fNdim = 1;
    83     return 0;
    84   }
    85   else if(chaine == "eta")
    86   {
    87     if(fNdim < 2) fNdim = 2;
    88     return 1;
    89   }
    90   else if(chaine == "phi")
    91   {
    92     if(fNdim < 3) fNdim = 3;
    93     return 2;
    94   }
    95   else if(chaine == "energy")
    96   {
    97     if(fNdim < 4) fNdim = 4;
    98     return 3;
    99   }
    100   return -1;
    101 }
    102 
    103 //------------------------------------------------------------------------------
  • classes/DelphesFormula.h

    r1d9974e rd38348d  
    3535
    3636  Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0, Double_t energy = 0);
    37 
    38   Int_t DefinedVariable(TString &variable, Int_t &action);
    3937};
    4038
  • classes/DelphesTF2.cc

    r1d9974e rd38348d  
    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
  • classes/DelphesTF2.h

    r1d9974e rd38348d  
    2121
    2222#include "TF2.h"
    23 #include "TFormula.h"
    24 
    25 #include <string>
    2623
    2724class DelphesTF2: public TF2
     
    3532  ~DelphesTF2();
    3633
    37   Int_t DefinedVariable(TString &variable, Int_t &action);
    38 
     34  Int_t Compile(const char *expression);
    3935};
    4036
    4137#endif /* DelphesTF2_h */
    42 
Note: See TracChangeset for help on using the changeset viewer.