- Timestamp:
- Jun 26, 2015, 11:46:42 AM (9 years ago)
- 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. - Location:
- classes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
classes/DelphesFormula.cc
r1d9974e rd38348d 23 23 24 24 #include <stdexcept> 25 #include <string>26 25 27 26 using namespace std; … … 51 50 Int_t DelphesFormula::Compile(const char *expression) 52 51 { 53 string buffer;52 TString buffer; 54 53 const char *it; 55 54 for(it = expression; *it; ++it) 56 55 { 57 56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 58 buffer. push_back(*it);57 buffer.Append(*it); 59 58 } 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) 61 64 { 62 65 throw runtime_error("Invalid formula."); … … 74 77 75 78 //------------------------------------------------------------------------------ 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 35 35 36 36 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);39 37 }; 40 38 -
classes/DelphesTF2.cc
r1d9974e rd38348d 18 18 19 19 #include "classes/DelphesTF2.h" 20 21 #include "RVersion.h" 20 22 #include "TString.h" 23 21 24 #include <stdexcept> 22 #include <string>23 25 24 26 using namespace std; … … 34 36 35 37 DelphesTF2::DelphesTF2(const char *name, const char *expression) : 36 TF2(name, expression)38 TF2(name, expression) 37 39 { 38 40 } … … 46 48 //------------------------------------------------------------------------------ 47 49 48 Int_t DelphesTF2:: DefinedVariable(TString &chaine, Int_t &action)50 Int_t DelphesTF2::Compile(const char *expression) 49 51 { 50 action = kVariable; 51 if(chaine == "z") 52 TString buffer; 53 const char *it; 54 for(it = expression; *it; ++it) 52 55 { 53 if( fNdim < 1) fNdim = 1;54 return 0;56 if(*it == ' ' || *it == '\t' || *it == '\r' || *it == '\n' || *it == '\\' ) continue; 57 buffer.Append(*it); 55 58 } 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 57 66 { 58 if(fNdim < 2) fNdim = 2; 59 return 1; 67 throw runtime_error("Invalid formula."); 60 68 } 61 return -1;69 return 0; 62 70 } 63 71 -
classes/DelphesTF2.h
r1d9974e rd38348d 21 21 22 22 #include "TF2.h" 23 #include "TFormula.h"24 25 #include <string>26 23 27 24 class DelphesTF2: public TF2 … … 35 32 ~DelphesTF2(); 36 33 37 Int_t DefinedVariable(TString &variable, Int_t &action); 38 34 Int_t Compile(const char *expression); 39 35 }; 40 36 41 37 #endif /* DelphesTF2_h */ 42
Note:
See TracChangeset
for help on using the changeset viewer.