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  BinningPointByMap p = _p;
11  //
12  // which formula to use?
13  //
14  if (! isInPayload(r,p)) return PerformancePayload::InvalidResult;
15 
16  // nice, what to do here???
17  TFormula * formula = compiledFormulas_[resultPos(r)];
18  //
19  // prepare the vector to pass, order counts!!!
20  //
21  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
22 
23  // sorry, TFormulas just work up to dimension==4
24  Double_t values[4];
25  int i=0;
26  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
27  values[i] = p.value(*it);
28  }
29  //
30  // i need a non const version #$%^
31  return formula->EvalPar(values);
32 }
33 
35  BinningPointByMap p = _p;
36  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
37 
38  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
39  if (! p.isKeyAvailable(*it)) return false;
40  float v = p.value(*it);
41  int pos = limitPos(*it);
42  std::pair<float, float> limits = (pl.limits())[pos];
43  if (v<limits.first || v>limits.second) return false;
44  }
45  return true;
46 }
47 
49  check();
50  // first, let's see if it is available at all
51  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
52 
53  if ( ! isOk(point)) return false;
54  return true;
55 }
56 
57 
59  if (pl.formulas().size() == compiledFormulas_.size()) return;
60  //
61  // otherwise, compile!
62  //
63  for (unsigned int i=0; i< pl.formulas().size(); ++i){
64  TFormula* t = new TFormula("rr",(pl.formulas()[i]).c_str()); //FIXME: "rr" should be unique!
65  t->Compile();
66  compiledFormulas_.push_back(t);
67  }
68 }
69 
71  check();
72  //
73  // which formula to use?
74  //
75  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) {
76  cout << "Warning: result not available!" << endl;
77  }
78 
79  // nice, what to do here???
80  TFormula * formula = compiledFormulas_[resultPos(res)];
81  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
82  // prepare the vector to pass, order counts!!!
83  //
84  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
85 
86  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
87  int pos = limitPos(*it);
88  std::pair<float, float> limits = (pl.limits())[pos];
89  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
90  }
91 
92 }
93 
int i
Definition: DBlmapReader.cc:9
bool isKeyAvailable(BinningVariables::BinningVariablesType)
static const float InvalidResult
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
virtual bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const
float value(BinningVariables::BinningVariablesType)
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:96
bool isOk(const BinningPointByMap &p) 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