27 std::vector<std::string> functionPatterns;
31 const std::vector<std::string>& patterns() {
32 if (functionPatterns.empty()) {
33 const std::string array[6] = {
"E",
"P",
"theta",
"phi",
"pT",
"pZ"};
34 functionPatterns.assign(array, array + 6);
36 return functionPatterns;
42 const std::string tformulaVariables[4] = {
"x",
"y",
"z",
"t"};
45 std::map<std::string, Smear::KinType> kinTypes;
48 const std::map<std::string, Smear::KinType>& kinTypeTable() {
49 if (kinTypes.empty()) {
50 kinTypes.insert(std::make_pair(
"E",
Smear::kE));
51 kinTypes.insert(std::make_pair(
"P",
Smear::kP));
53 kinTypes.insert(std::make_pair(
"phi",
Smear::kPhi));
54 kinTypes.insert(std::make_pair(
"pT",
Smear::kPt));
55 kinTypes.insert(std::make_pair(
"pZ",
Smear::kPz));
82 std::string f =
Parse(formula);
88 std::cerr <<
"FormulaString::Eval() got " << args.size() <<
89 " arguments, expected " <<
mVariables.size() << std::endl;
93 std::vector<double> a(args);
95 return mFormula->Eval(a.at(0), a.at(1), a.at(2), a.at(3));
111 std::map<int, string>
args;
112 typedef vector<string>::const_iterator StrIter;
113 for (StrIter i = patterns().begin(); i != patterns().end(); ++i) {
115 if (position != string::npos) {
116 args.insert(std::make_pair(position, *i));
123 std::list<string> substitutions(tformulaVariables,
124 tformulaVariables + 4);
126 for (std::map<int, string>::const_iterator i = args.begin();
127 i != args.end(); ++i) {
128 s.ReplaceAll(i->second, substitutions.front());
129 substitutions.pop_front();
132 return string(s.Data());
149 if (kinTypeTable().find(name) != kinTypeTable().end()) {
150 type = kinTypes[
name];
157 std::map<std::string, KinType>::const_iterator i;
158 for (i = kinTypeTable().begin(); i != kinTypeTable().end(); ++i) {
159 if (i->second == type) {