CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PerformancePayloadFromTable.h
Go to the documentation of this file.
1 #ifndef PerformancePayloadFromTable_h
2 #define PerformancePayloadFromTable_h
3 
6 
7 #include <algorithm>
8 #include <string>
9 #include <vector>
10 
12 
14 // class PerformancePayloadFromTable : public PerformancePayload, public PhysicsPerformancePayload {
15  public:
16 
17  static const int InvalidPos;
18 
19  //PerformancePayloadFromTable(int stride_, std::string columns_,std::vector<float> table) : PerformancePayload(stride_, columns_, table) {}
20 
21  PerformancePayloadFromTable(const std::vector<PerformanceResult::ResultType>& r, const std::vector<BinningVariables::BinningVariablesType>& b , int stride_,const std::vector<float>& table) :
22  pl(stride_, table),
23  results_(r), binning_(b) {}
24 
27 
28  float getResult(PerformanceResult::ResultType,const BinningPointByMap&) const ; // gets from the full payload
29 
32  }
33 
35 
36 const PhysicsPerformancePayload & payLoad() const {return pl;}
37 
38  protected:
39 
40  virtual std::vector<BinningVariables::BinningVariablesType> myBinning() const {return binning_;}
41 
42  virtual int minPos(const BinningVariables::BinningVariablesType b) const {
43  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
44  p = find(binning_.begin(), binning_.end(), b);
46  return ((p-binning_.begin())*2);
47  }
48  virtual int maxPos(const BinningVariables::BinningVariablesType b) const {
49  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
50  p = find(binning_.begin(), binning_.end(), b);
52  return ((p-binning_.begin())*2+1);
53 
54  }
56  // result should be: # of binning variables *2 + position of result
57  std::vector<PerformanceResult::ResultType>::const_iterator p;
58  p = find (results_.begin(), results_.end(), r);
59  if ( p == results_.end()) return PerformancePayloadFromTable::InvalidPos;
60  return (binning_.size()*2+(p-results_.begin()));
61 
62  }
63 
65 
67 
68  std::vector<PerformanceResult::ResultType> results_;
69  std::vector<BinningVariables::BinningVariablesType> binning_;
70 
71 };
72 
73 #endif
74 
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const
virtual int maxPos(const BinningVariables::BinningVariablesType b) const
const PhysicsPerformancePayload & payLoad() const
virtual int resultPos(PerformanceResult::ResultType r) const
virtual int minPos(const BinningVariables::BinningVariablesType b) const
virtual bool isParametrizedInVariable(const BinningVariables::BinningVariablesType p) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< BinningVariables::BinningVariablesType > binning_
#define table(NAME)
Definition: DbCore.h:49
std::vector< PerformanceResult::ResultType > results_
double b
Definition: hdecay.h:120
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
PerformancePayloadFromTable(const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, int stride_, const std::vector< float > &table)
virtual bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const