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 #include <boost/shared_ptr.hpp>
13 #include "TFormula.h"
14 
16 
18 // class PerformancePayloadFromBinnedTFormula : public PerformancePayload, public PhysicsPerformancePayload {
19  public:
20 
21  static const int InvalidPos;
22 
23  PerformancePayloadFromBinnedTFormula(const std::vector<PerformanceResult::ResultType>& r,
24  const std::vector<BinningVariables::BinningVariablesType>& b ,
25  const std::vector<PhysicsTFormulaPayload>& in) : pls(in), results_(r), variables_(b) {
26  initialize();
27  }
28 
29  void initialize() override;
30 
33  compiledFormulas_.clear();
34  }
35 
36  float getResult(PerformanceResult::ResultType,const BinningPointByMap&) const override ; // gets from the full payload
37 
40  }
41 
42  bool isInPayload(PerformanceResult::ResultType,const BinningPointByMap&) const override ;
43 
44  const std::vector<PhysicsTFormulaPayload> & formulaPayloads() const {return pls;}
45 
47 
48 
49  protected:
50 
51  virtual std::vector<BinningVariables::BinningVariablesType> myBinning() const {return variables_;}
52 
54  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
55  p = find(variables_.begin(), variables_.end(), b);
57  return ((p-variables_.begin()));
58 
59  }
60 
62  std::vector<PerformanceResult::ResultType>::const_iterator p;
63  p = find (results_.begin(), results_.end(), r);
65  return ((p-results_.begin()));
66  }
67 
68 
69  bool isOk(const BinningPointByMap& p, unsigned int & ) const;
70 
71  const boost::shared_ptr<TFormula>& getFormula(PerformanceResult::ResultType,const BinningPointByMap&) const;
72 
73  //
74  // now this is a vector, since we can have different rectangular regions in the same object
75  //
76  std::vector<PhysicsTFormulaPayload> pls;
77  //
78  // the variable mapping
79  //
80  std::vector<PerformanceResult::ResultType> results_;
81  std::vector<BinningVariables::BinningVariablesType> variables_;
82 
83  //
84  // the transient part; now a vector of vector; CHANGE CHECK!!!!!
85  //
86 
87  // the compiled functions
88  std::vector<std::vector<boost::shared_ptr<TFormula> > > compiledFormulas_ COND_TRANSIENT;;
89 
91 };
92 
93 #endif
94 
std::vector< std::vector< boost::shared_ptr< TFormula > > > compiledFormulas_
bool isOk(const BinningPointByMap &p, unsigned int &) const
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
const boost::shared_ptr< TFormula > & getFormula(PerformanceResult::ResultType, const BinningPointByMap &) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
virtual int resultPos(PerformanceResult::ResultType r) const
Definition: Electron.h:4
const std::vector< PhysicsTFormulaPayload > & formulaPayloads() const
virtual bool isParametrizedInVariable(const BinningVariables::BinningVariablesType p) const
std::vector< PerformanceResult::ResultType > results_
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
void printFormula(PerformanceResult::ResultType res, const BinningPointByMap &) const
std::vector< BinningVariables::BinningVariablesType > variables_
#define COND_TRANSIENT
Definition: Serializable.h:61
double b
Definition: hdecay.h:120
#define COND_SERIALIZABLE
Definition: Serializable.h:38
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
PerformancePayloadFromBinnedTFormula(const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, const std::vector< PhysicsTFormulaPayload > &in)
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override