CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClhepEvaluator.h
Go to the documentation of this file.
1 #ifndef ClhepEvaluator_h
2 #define ClhepEvaluator_h
3 
4 
5 #include <vector>
6 #include <string>
8 #include "CLHEP/Evaluator/Evaluator.h"
9 
10 
12 {
13 public:
15 
17 
18  void set(const std::string & ns, const std::string & name, const std::string & exprValue);
19 
20  double eval(const std::string & ns, const std::string & expr);
21 
22  bool isDefined(const std::string & ns, //< current namespace
23  const std::string & name //< name of the variable inside current namespace
24  );
25 
27  const std::vector<std::string> & variables() const { return variables_;}
28  const std::vector<std::string> & values() const { return values_;}
29 
31 
32  double eval(const char * expression);
33 
35  void set(const std::string & name, const std::string & value);
36 
37  void clear();
38 
39 private:
40  void prepare(const std::string & ns, // input
41  const std::string & name, // input
42  const std::string & exprValue, // input
43  std::string & nameResult, // output
44  std::string & valResult) const; // output
45 
46  void throwex(const std::string & ns,
47  const std::string & name,
48  const std::string & expr,
49  const std::string & reason,
50  int idx=0) const;
51 
52  void checkname(const std::string & name) const;
53 
54  HepTool::Evaluator evaluator_;
55  std::vector<std::string> variables_;
56  std::vector<std::string> values_;
57 };
58 
59 #endif
bool isDefined(const std::string &ns, const std::string &name)
check whether a variable is already defined or not
std::vector< std::string > variables_
std::vector< std::string > values_
string reason
Definition: Association.py:177
Interface of an Expression Evaluator.
const std::vector< std::string > & variables() const
access to the clhep-implementation of the dictionary variables
HepTool::Evaluator evaluator_
const std::vector< std::string > & values() const
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void clear()
access to the dictionary (namespace,name)-&gt;value
void checkname(const std::string &name) const
void throwex(const std::string &ns, const std::string &name, const std::string &expr, const std::string &reason, int idx=0) const
void set(const std::string &ns, const std::string &name, const std::string &exprValue)
put a new variable named &#39;namespace:name&#39; into the dictionary of the evaluator
double eval(const std::string &ns, const std::string &expr)
evaluate an expression expr inside the local namespace
void prepare(const std::string &ns, const std::string &name, const std::string &exprValue, std::string &nameResult, std::string &valResult) const