CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PerformancePayloadFromBinnedTFormula.cc
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 using namespace std;
7 
8 
10  //
11  // chooses the correct rectangular region
12  //
13  if (! isInPayload(r,p)) return NULL;
14  unsigned int region;
15  bool ok = isOk(p,region);
16  if (ok == false) return NULL;
17 
18  return compiledFormulas_[region][resultPos(r)];
19 
20 }
21 
23  check();
24  //
25  // which formula to use?
26  //
27  if (! isInPayload(r,p)) return PerformancePayload::InvalidResult;
28 
29  // nice, what to do here???
30  // TFormula * formula = compiledFormulas_[resultPos(r)];
31  //
32 
33  TFormula * formula = getFormula(r,p);
34 
35  // prepare the vector to pass, order counts!!!
36  //
37  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
38 
39  // sorry, TFormulas just work up to dimension==4
40  Double_t values[4];
41  int i=0;
42  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
43  values[i] = p.value(*it);
44  }
45  //
46  // i need a non const version #$%^
47  return formula->EvalPar(values);
48 }
49 
51 
52  //
53  // change: look on whether a single rectangularr region matches
54  //
55  for (unsigned int ti=0; ti< pls.size(); ++ti){
56  bool result = true;
57  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
58  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
59  //
60  // now looking into a single payload
61  //
62  if (! p.isKeyAvailable(*it)) return false;
63  float v = p.value(*it);
64  int pos = limitPos(*it);
65  std::pair<float, float> limits = (pls[ti].limits())[pos];
66  if (v<limits.first || v>limits.second) result= false;
67  }
68  if (result == true) {
69  whichone = ti;
70  return true;
71  }
72  }
73  whichone = 9999;
74  return false;
75 }
76 
78  check();
79  // first, let's see if it is available at all
80  if (resultPos(res) == PerformancePayloadFromBinnedTFormula::InvalidPos) return false;
81  unsigned int whocares;
82  if ( ! isOk(point,whocares)) return false;
83  return true;
84 }
85 
86 
88  if (pls.size()== compiledFormulas_.size()) return;
89  //
90  // otherwise, compile!
91  //
92  compiledFormulas_.clear();
93  for (unsigned int t=0; t< pls.size(); ++t){
94  std::vector <TFormula *> temp;
95  for (unsigned int i=0; i< (pls[t].formulas()).size(); ++i){
97  TFormula* tt = new TFormula("rr",((tmp.formulas())[i]).c_str()); //FIXME: "rr" should be unique!
98  tt->Compile();
99  temp.push_back(tt);
100  }
101  compiledFormulas_.push_back(temp);
102  }
103 }
104 
105 
106 
107 
109  check();
110  //
111  // which formula to use?
112  //
113  if (resultPos(res) == PerformancePayloadFromBinnedTFormula::InvalidPos) {
114  cout << "Warning: result not available!" << endl;
115  }
116 
117  // nice, what to do here???
118  TFormula * formula = getFormula(res, point);
119  unsigned int whichone;
120  isOk(point,whichone);
121  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
122  // prepare the vector to pass, order counts!!!
123  //
124  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
125 
126  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
127  int pos = limitPos(*it);
128  std::pair<float, float> limits = (pls[whichone].limits())[pos];
129  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
130  }
131 
132 }
133 
int i
Definition: DBlmapReader.cc:9
float getResult(PerformanceResult::ResultType, BinningPointByMap) const
#define NULL
Definition: scimark2.h:8
bool isKeyAvailable(BinningVariables::BinningVariablesType)
static const float InvalidResult
void printFormula(PerformanceResult::ResultType res, BinningPointByMap) const
const std::vector< std::string > & formulas() const
TFormula * getFormula(PerformanceResult::ResultType, BinningPointByMap) const
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
float value(BinningVariables::BinningVariablesType)
tuple result
Definition: query.py:137
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:97
bool isOk(BinningPointByMap p, unsigned int &) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
virtual bool isInPayload(PerformanceResult::ResultType, BinningPointByMap) 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