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  for( std::vector<std::string>::const_iterator formula = pl.formulas().begin(); formula != pl.formulas().end(); ++formula ) {
10  //FIXME: "rr" should be unique!
11  boost::shared_ptr<TFormula> temp(new TFormula("rr",formula->c_str()));
12  temp->Compile();
13  compiledFormulas_.push_back(temp);
14  }
15 }
16 
17 
19  BinningPointByMap p = _p;
20  //
21  // which formula to use?
22  //
23  if (! isInPayload(r,p)) return PerformancePayload::InvalidResult;
24 
25  // nice, what to do here???
26  const boost::shared_ptr<TFormula>& formula = compiledFormulas_[resultPos(r)];
27  //
28  // prepare the vector to pass, order counts!!!
29  //
30  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
31 
32  // sorry, TFormulas just work up to dimension==4
33  Double_t values[4];
34  int i=0;
35  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
36  values[i] = p.value(*it);
37  }
38  //
39  // i need a non const version #$%^
40  // Note, in current implementation of TFormula EvalPar should be
41  // thread safe as it does nothing more than call a function
42  // through a function pointer which is stateless. In spite of the
43  // fact that it is not const.
44  return formula->EvalPar(values);
45 }
46 
48  BinningPointByMap p = _p;
49  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
50 
51  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
52  if (! p.isKeyAvailable(*it)) return false;
53  float v = p.value(*it);
54  int pos = limitPos(*it);
55  std::pair<float, float> limits = (pl.limits())[pos];
56  if (v<limits.first || v>limits.second) return false;
57  }
58  return true;
59 }
60 
62  // first, let's see if it is available at all
63  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
64 
65  if ( ! isOk(point)) return false;
66  return true;
67 }
68 
70  //
71  // which formula to use?
72  //
73  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) {
74  cout << "Warning: result not available!" << endl;
75  return;
76  }
77 
78  // nice, what to do here???
79  const boost::shared_ptr<TFormula>& formula =
80  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
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