CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PerformancePayloadFromTFormula.cc
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 using namespace std;
7 
9  check();
10  //
11  // which formula to use?
12  //
13  if (! isInPayload(r,p)) return PerformancePayload::InvalidResult;
14 
15  // nice, what to do here???
16  TFormula * formula = compiledFormulas_[resultPos(r)];
17  //
18  // prepare the vector to pass, order counts!!!
19  //
20  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
21 
22  // sorry, TFormulas just work up to dimension==4
23  Double_t values[4];
24  int i=0;
25  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
26  values[i] = p.value(*it);
27  }
28  //
29  // i need a non const version #$%^
30  return formula->EvalPar(values);
31 }
32 
34 
35  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
36 
37  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
38  if (! p.isKeyAvailable(*it)) return false;
39  float v = p.value(*it);
40  int pos = limitPos(*it);
41  std::pair<float, float> limits = (pl.limits())[pos];
42  if (v<limits.first || v>limits.second) return false;
43  }
44  return true;
45 }
46 
48  check();
49  // first, let's see if it is available at all
50  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
51 
52  if ( ! isOk(point)) return false;
53  return true;
54 }
55 
56 
58  if (pl.formulas().size() == compiledFormulas_.size()) return;
59  //
60  // otherwise, compile!
61  //
62  for (unsigned int i=0; i< pl.formulas().size(); ++i){
63  TFormula* t = new TFormula("rr",(pl.formulas()[i]).c_str()); //FIXME: "rr" should be unique!
64  t->Compile();
65  compiledFormulas_.push_back(t);
66  }
67 }
68 
70  check();
71  //
72  // which formula to use?
73  //
74  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) {
75  cout << "Warning: result not available!" << endl;
76  }
77 
78  // nice, what to do here???
79  TFormula * formula = compiledFormulas_[resultPos(res)];
80  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
81  // prepare the vector to pass, order counts!!!
82  //
83  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
84 
85  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
86  int pos = limitPos(*it);
87  std::pair<float, float> limits = (pl.limits())[pos];
88  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
89  }
90 
91 }
92 
bool isOk(BinningPointByMap p) const
float getResult(PerformanceResult::ResultType, BinningPointByMap) const
int i
Definition: DBlmapReader.cc:9
bool isKeyAvailable(BinningVariables::BinningVariablesType)
static const float InvalidResult
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
float value(BinningVariables::BinningVariablesType)
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:97
virtual bool isInPayload(PerformanceResult::ResultType, BinningPointByMap) const
tuple cout
Definition: gather_cfg.py:121
void printFormula(PerformanceResult::ResultType res) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5