CMS 3D CMS Logo

PerformancePayloadFromTFormula.cc
Go to the documentation of this file.
4 
6 
7 #include <iostream>
8 using namespace std;
9 
11  for (std::vector<std::string>::const_iterator formula = pl.formulas().begin(); formula != pl.formulas().end();
12  ++formula) {
13  const auto formulaUniqueName = edm::createGlobalIdentifier();
14  //be sure not to add TFormula to ROOT's global list
15  auto temp = std::make_shared<TFormula>(formulaUniqueName.c_str(), formula->c_str(), false);
16  temp->Compile();
17  compiledFormulas_.emplace_back(std::move(temp));
18  }
19 }
20 
22  BinningPointByMap p = _p;
23  //
24  // which formula to use?
25  //
26  if (!isInPayload(r, p)) {
27  edm::LogError("PerformancePayloadFromTFormula")
28  << "Missing formula in conditions. Maybe code/conditions are inconsistent" << std::endl;
29  assert(false);
30  }
31 
32  const TFormula* formula = compiledFormulas_[resultPos(r)].get();
33  //
34  // prepare the vector to pass, order counts!!!
35  //
36  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
37 
38  // sorry, TFormulas just work up to dimension==4
39  Double_t values[4];
40  int i = 0;
41  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it, ++i) {
42  values[i] = p.value(*it);
43  }
44  //
45  return formula->EvalPar(values);
46 }
47 
49  BinningPointByMap p = _p;
50  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
51 
52  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
53  if (!p.isKeyAvailable(*it))
54  return false;
55  float v = p.value(*it);
56  int pos = limitPos(*it);
57  std::pair<float, float> limits = (pl.limits())[pos];
58  if (v < limits.first || v > limits.second)
59  return false;
60  }
61  return true;
62 }
63 
65  const BinningPointByMap& point) const {
66  // first, let's see if it is available at all
68  return false;
69 
70  if (!isOk(point))
71  return false;
72  return true;
73 }
74 
76  //
77  // which formula to use?
78  //
80  cout << "Warning: result not available!" << endl;
81  return;
82  }
83 
84  const TFormula* formula = compiledFormulas_[resultPos(res)].get();
85  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
86  // prepare the vector to pass, order counts!!!
87  //
88  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
89 
90  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
91  int pos = limitPos(*it);
92  std::pair<float, float> limits = (pl.limits())[pos];
93  cout << " Variable: " << *it << " with limits: "
94  << "from: " << limits.first << " to: " << limits.second << endl;
95  }
96 }
97 
PerformancePayloadFromTFormula
Definition: PerformancePayloadFromTFormula.h:17
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
pfMETCorrectionType0_cfi.formula
formula
Definition: pfMETCorrectionType0_cfi.py:46
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
PerformancePayloadFromTFormula::initialize
void initialize() override
Definition: PerformancePayloadFromTFormula.cc:10
typelookup.h
cms::cuda::assert
assert(be >=bs)
findQualityFiles.v
v
Definition: findQualityFiles.py:179
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
PerformancePayloadFromTFormula::isInPayload
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
Definition: PerformancePayloadFromTFormula.cc:64
OrderedSet.t
t
Definition: OrderedSet.py:90
PerformanceResult::ResultType
ResultType
Definition: PerformanceResult.h:8
edm::LogError
Definition: MessageLogger.h:183
PerformancePayloadFromTFormula::getResult
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
Definition: PerformancePayloadFromTFormula.cc:21
PerformancePayloadFromTFormula::printFormula
void printFormula(PerformanceResult::ResultType res) const
Definition: PerformancePayloadFromTFormula.cc:75
GlobalIdentifier.h
res
Definition: Electron.h:6
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
BinningPointByMap
Definition: BinningPointByMap.h:8
PerformancePayloadFromTFormula.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PerformancePayloadFromTFormula::isOk
bool isOk(const BinningPointByMap &p) const
Definition: PerformancePayloadFromTFormula.cc:48
point
*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
PerformancePayloadFromTFormula::InvalidPos
static const int InvalidPos
Definition: PerformancePayloadFromTFormula.h:20
edm::createGlobalIdentifier
std::string createGlobalIdentifier()
Definition: GlobalIdentifier.cc:5