CMS 3D CMS Logo

PerformancePayloadFromTable.cc
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 
8  if (!isInPayload(r, p))
10 
11  // loop on the table rows and search for a match
12  for (int i = 0; i < pl.nRows(); i++) {
14 
15  if (matches(p, row)) {
16  int pos = resultPos(r);
17  return row[pos];
18  }
19  }
21 }
22 
24  //
25  // this is the smart function which does not take into account the fields not present
26  //
27 
28  // I can do it via a loop!
29  BinningPointByMap p = _p;
30  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
31 
32  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
33  //
34  // first the binning point map must contain ALL the quantities here
35  //
36  // if (! p.isKeyAvailable(*it) ) return false;
37  float v = p.value(*it);
38  if (!(v >= row[minPos(*it)] && v < row[maxPos(*it)]))
39  return false;
40  }
41  return true;
42 }
43 
45  const BinningPointByMap& _point) const {
46  BinningPointByMap point = _point;
47  // first, let's see if it is available at all
49  return false;
50  // now look whther the binning point contains all the info
51  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
52  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
53  if (!point.isKeyAvailable(*it))
54  return false;
55  }
56  // then, look if there is a matching row
57  for (int i = 0; i < pl.nRows(); i++) {
59  if (matches(point, row)) {
60  return true;
61  }
62  }
63  return false;
64 }
65 
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
static const float InvalidResult
Definition: Electron.h:6
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int minPos(const BinningVariables::BinningVariablesType b) const
virtual int maxPos(const BinningVariables::BinningVariablesType b) const
virtual int resultPos(PerformanceResult::ResultType r) const
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
*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