CMS 3D CMS Logo

PerformancePayloadFromTFormula.h
Go to the documentation of this file.
1 #ifndef PerformancePayloadFromTFormula_h
2 #define PerformancePayloadFromTFormula_h
3 
5 
8 
9 #include <algorithm>
10 #include <string>
11 #include <vector>
12 #include <memory>
13 #include <iostream>
14 #include "TFormula.h"
16 
18 // class PerformancePayloadFromTFormula : public PerformancePayload, public PhysicsPerformancePayload {
19  public:
20 
21  static const int InvalidPos;
22 
23  PerformancePayloadFromTFormula(const std::vector<PerformanceResult::ResultType>& r,
24  const std::vector<BinningVariables::BinningVariablesType>& b ,
26  initialize();
27  }
28 
30 
31  void initialize() override;
32 
34  pl(b.pl),
35  results_(b.results_),
38 
40  compiledFormulas_.clear();
41  }
42 
43 
44 
45  float getResult(PerformanceResult::ResultType,const BinningPointByMap&) const override ; // gets from the full payload
46 
49  }
50 
51  bool isInPayload(PerformanceResult::ResultType,const BinningPointByMap&) const override ;
52 
53  const PhysicsTFormulaPayload & formulaPayload() const {return pl;}
54 
56 
57 
58  protected:
59 
60  virtual std::vector<BinningVariables::BinningVariablesType> myBinning() const {return variables_;}
61 
63  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
64  p = find(variables_.begin(), variables_.end(), b);
66  return ((p-variables_.begin()));
67 
68  }
69 
71  std::vector<PerformanceResult::ResultType>::const_iterator p;
72  p = find (results_.begin(), results_.end(), r);
74  return ((p-results_.begin()));
75  }
76 
77 
78  bool isOk(const BinningPointByMap& p) const;
79 
81  //
82  // the variable mapping
83  //
84  std::vector<PerformanceResult::ResultType> results_;
85  std::vector<BinningVariables::BinningVariablesType> variables_;
86  //
87  // the transient part
88  //
89  std::vector< std::shared_ptr<const TFormula> > compiledFormulas_ COND_TRANSIENT;
90 
92 };
93 
94 #endif
std::vector< std::shared_ptr< const TFormula > > compiledFormulas_
float getResult(PerformanceResult::ResultType, const BinningPointByMap &) const override
PerformancePayloadFromTFormula(const PerformancePayloadFromTFormula &b)
std::vector< BinningVariables::BinningVariablesType > variables_
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Definition: Electron.h:6
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
virtual bool isParametrizedInVariable(const BinningVariables::BinningVariablesType p) const
#define COND_TRANSIENT
Definition: Serializable.h:61
double b
Definition: hdecay.h:120
bool isOk(const BinningPointByMap &p) const
#define COND_SERIALIZABLE
Definition: Serializable.h:38
const PhysicsTFormulaPayload & formulaPayload() const
PerformancePayloadFromTFormula(const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, PhysicsTFormulaPayload &in)
void printFormula(PerformanceResult::ResultType res) const
std::vector< PerformanceResult::ResultType > results_
virtual int resultPos(PerformanceResult::ResultType r) const