Changeset 1351 in svn
- Timestamp:
- Jan 20, 2014, 12:19:36 PM (11 years ago)
- Location:
- trunk/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/classes/DelphesTF2.cc
r1343 r1351 27 27 28 28 //------------------------------------------------------------------------------ 29 /*30 Int_t DelphesTF2::Compile(const char *expression)31 {32 string buffer;33 const char *it;34 for(it = expression; *it; ++it)35 {36 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue;37 buffer.push_back(*it);38 }39 40 TFormula f("",buffer.c_str());41 if(f.Compile() != 0)42 {43 throw runtime_error("Invalid formula.");44 }45 return 0;46 }47 48 //------------------------------------------------------------------------------49 50 Double_t DelphesTF2::Eval(Double_t z, Double_t t)51 {52 Double_t x[2] = {z , t};53 return EvalPar(x);54 }55 56 //------------------------------------------------------------------------------57 58 void DelphesTF2::ReplaceAll(std::string& subject, const std::string& search, const std::string& replace)59 {60 size_t pos = 0;61 while ((pos = subject.find(search, pos)) != std::string::npos)62 {63 subject.replace(pos, search.length(), replace);64 pos += replace.length();65 }66 }67 68 69 //------------------------------------------------------------------------------70 71 string DelphesTF2::ChangeVariables(const char *expression)72 {73 DelphesTF2::Compile(expression);74 75 string str = string(expression);76 ReplaceAll(str,"z","x");77 ReplaceAll(str,"t","y");78 79 return str;80 }81 82 */83 //------------------------------------------------------------------------------84 29 85 30 Int_t DelphesTF2::DefinedVariable(TString &chaine, Int_t &action) -
trunk/classes/DelphesTF2.h
r1343 r1351 17 17 ~DelphesTF2(); 18 18 19 // Int_t Compile(const char *expression);20 21 // Double_t Eval(Double_t z, Double_t t);22 23 // std::string ChangeVariables(const char *expression);24 25 // void ReplaceAll(std::string& str, const std::string& from, const std::string& to);26 27 19 Int_t DefinedVariable(TString &variable, Int_t &action); 28 20
Note:
See TracChangeset
for help on using the changeset viewer.