CMS 3D CMS Logo

PerformancePayloadFromTable.h
Go to the documentation of this file.
1 #ifndef PerformancePayloadFromTable_h
2 #define PerformancePayloadFromTable_h
3 
5 
8 
9 #include <algorithm>
10 #include <string>
11 #include <vector>
12 
14 
16  // class PerformancePayloadFromTable : public PerformancePayload, public PhysicsPerformancePayload {
17 public:
18  static const int InvalidPos;
19 
20  //PerformancePayloadFromTable(int stride_, std::string columns_,std::vector<float> table) : PerformancePayload(stride_, columns_, table) {}
21 
22  PerformancePayloadFromTable(const std::vector<PerformanceResult::ResultType>& r,
23  const std::vector<BinningVariables::BinningVariablesType>& b,
24  int stride_,
25  const std::vector<float>& table)
26  : pl(stride_, table), results_(r), binning_(b) {}
27 
30 
32  const BinningPointByMap&) const override; // gets from the full payload
33 
36  }
37 
38  bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap&) const override;
39 
40  const PhysicsPerformancePayload& payLoad() const { return pl; }
41 
42 protected:
43  virtual std::vector<BinningVariables::BinningVariablesType> myBinning() const { return binning_; }
44 
45  virtual int minPos(const BinningVariables::BinningVariablesType b) const {
46  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
47  p = find(binning_.begin(), binning_.end(), b);
48  if (p == binning_.end())
50  return ((p - binning_.begin()) * 2);
51  }
52  virtual int maxPos(const BinningVariables::BinningVariablesType b) const {
53  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
54  p = find(binning_.begin(), binning_.end(), b);
55  if (p == binning_.end())
57  return ((p - binning_.begin()) * 2 + 1);
58  }
60  // result should be: # of binning variables *2 + position of result
61  std::vector<PerformanceResult::ResultType>::const_iterator p;
62  p = find(results_.begin(), results_.end(), r);
63  if (p == results_.end())
65  return (binning_.size() * 2 + (p - results_.begin()));
66  }
67 
69 
71 
72  std::vector<PerformanceResult::ResultType> results_;
73  std::vector<BinningVariables::BinningVariablesType> binning_;
74 
76 };
77 
78 #endif
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
virtual bool isParametrizedInVariable(const BinningVariables::BinningVariablesType p) const
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int minPos(const BinningVariables::BinningVariablesType b) const
virtual int maxPos(const BinningVariables::BinningVariablesType b) const
std::vector< BinningVariables::BinningVariablesType > binning_
virtual int resultPos(PerformanceResult::ResultType r) const
std::vector< PerformanceResult::ResultType > results_
double b
Definition: hdecay.h:118
const PhysicsPerformancePayload & payLoad() const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
PerformancePayloadFromTable(const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, int stride_, const std::vector< float > &table)