CMS 3D CMS Logo

PerformancePayloadFromBinnedTFormula.h
Go to the documentation of this file.
1 #ifndef PerformancePayloadFromBinnedTFormula_h
2 #define PerformancePayloadFromBinnedTFormula_h
3 
5 
8 
9 #include <algorithm>
10 #include <string>
11 #include <vector>
12 
13 #include "TFormula.h"
14 
16 
18  // class PerformancePayloadFromBinnedTFormula : public PerformancePayload, public PhysicsPerformancePayload {
19 public:
20  static const int InvalidPos;
21 
22  PerformancePayloadFromBinnedTFormula(const std::vector<PerformanceResult::ResultType>& r,
23  const std::vector<BinningVariables::BinningVariablesType>& b,
24  const std::vector<PhysicsTFormulaPayload>& in)
25  : pls(in), results_(r), variables_(b) {
26  initialize();
27  }
28 
29  void initialize() override;
30 
33 
35  const BinningPointByMap&) const override; // gets from the full payload
36 
39  }
40 
41  bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap&) const override;
42 
43  const std::vector<PhysicsTFormulaPayload>& formulaPayloads() const { return pls; }
44 
46 
47 protected:
48  virtual std::vector<BinningVariables::BinningVariablesType> myBinning() const { return variables_; }
49 
51  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
52  p = find(variables_.begin(), variables_.end(), b);
53  if (p == variables_.end())
55  return ((p - variables_.begin()));
56  }
57 
59  std::vector<PerformanceResult::ResultType>::const_iterator p;
60  p = find(results_.begin(), results_.end(), r);
61  if (p == results_.end())
63  return ((p - results_.begin()));
64  }
65 
66  bool isOk(const BinningPointByMap& p, unsigned int&) const;
67 
68  const std::shared_ptr<TFormula>& getFormula(PerformanceResult::ResultType, const BinningPointByMap&) const;
69 
70  //
71  // now this is a vector, since we can have different rectangular regions in the same object
72  //
73  std::vector<PhysicsTFormulaPayload> pls;
74  //
75  // the variable mapping
76  //
77  std::vector<PerformanceResult::ResultType> results_;
78  std::vector<BinningVariables::BinningVariablesType> variables_;
79 
80  //
81  // the transient part; now a vector of vector; CHANGE CHECK!!!!!
82  //
83 
84  // the compiled functions
85  std::vector<std::vector<std::shared_ptr<TFormula> > > compiledFormulas_ COND_TRANSIENT;
86  ;
87 
89 };
90 
91 #endif
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
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:19
Definition: Electron.h:6
const std::vector< PhysicsTFormulaPayload > & formulaPayloads() const
std::vector< PerformanceResult::ResultType > results_
const std::shared_ptr< TFormula > & getFormula(PerformanceResult::ResultType, const BinningPointByMap &) const
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
std::vector< BinningVariables::BinningVariablesType > variables_
#define COND_TRANSIENT
Definition: Serializable.h:63
double b
Definition: hdecay.h:120
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
#define COND_SERIALIZABLE
Definition: Serializable.h:39
virtual int resultPos(PerformanceResult::ResultType r) const
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
std::vector< std::vector< std::shared_ptr< TFormula > > > compiledFormulas_
bool isOk(const BinningPointByMap &p, unsigned int &) const
void printFormula(PerformanceResult::ResultType res, const BinningPointByMap &) const
PerformancePayloadFromBinnedTFormula(const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, const std::vector< PhysicsTFormulaPayload > &in)