11 evaluator_.setSystemOfUnits(1.
e+3, 1./1.60217733
e-25, 1.
e+9, 1./1.60217733
e-10,
29 std::vector<std::string>::iterator it(vars.begin()), ed(vars.end());
31 for (; it != ed; ++it) {
48 prepare(ns,name,exprValue,newVar,newVal);
50 <<
" in: " << ns <<
" " << name <<
" " << exprValue
51 <<
" pr: " << newVar <<
" " << newVal);
53 evaluator_.setVariable(newVar.c_str(), newVal.c_str());
55 case HepTool::Evaluator::WARNING_EXISTING_VARIABLE:
59 case HepTool::Evaluator::WARNING_EXISTING_FUNCTION:
60 case HepTool::Evaluator::WARNING_BLANK_STRING:
65 std::cout <<
"set-var: ns=" << ns <<
" nm=" << name <<
" val=" << exprValue << std::endl;
67 throwex(ns,name,exprValue,
"can't set parameter !");
75 case HepTool::Evaluator::WARNING_EXISTING_VARIABLE:
79 case HepTool::Evaluator::WARNING_EXISTING_FUNCTION:
80 case HepTool::Evaluator::WARNING_BLANK_STRING:
85 std::cout <<
"set-varname=" << n <<
" val=" << v << std::endl;
87 throwex(
"",n,v,
"can't set parameter !");
100 prepare(ns,pseudo,expr, pseudo,prepared);
104 std::cout <<
"expr: " << prepared << std::endl;
119 std::cout <<
"expr: " << expression << std::endl;
135 prepare(ns,name,
"0", newVar,newVal);
136 return evaluator_.findVariable(newVar.c_str());
162 nameResult = ns + sep +
name;
173 bool insideBracket =
false;
174 bool nsFound =
false;
176 std::vector<int> hasNs(1);
180 switch(exprValue[idx])
183 if (nsFound || insideBracket)
186 "found a ':' outside '[..]' , or too many '[' !",idx);
194 throwex(ns,name,exprValue,
"too many ']' !",idx);
208 if ( (!insideBracket) || nsFound )
211 "found a ':' outside '[..]' , or multiple ':' inside '[..]'",idx);
222 if ( insideBracket || nsFound ) {
224 "'[..]' not closed , or ':' outside of '[..]'",idx);
234 switch(exprValue[idx])
238 if ( !hasNs[varCount] )
240 valResult = valResult + ns +
sep;
246 valResult = valResult +
sep;
249 valResult = valResult + exprValue[
idx];
bool isDefined(const std::string &ns, const std::string &name)
std::vector< std::string > variables_
pair< int, edm::FunctionWithDict > OK
std::vector< std::string > values_
HepTool::Evaluator evaluator_
#define DCOUT_V(M_v_Y, M_v_S)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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)
double eval(const std::string &ns, const std::string &expr)
void prepare(const std::string &ns, const std::string &name, const std::string &exprValue, std::string &nameResult, std::string &valResult) const
void dd_exchange_value(std::vector< std::string > &vars, std::vector< std::string > &vals, const std::string &var, const std::string &val)