CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
PerformancePayloadFromTFormula Class Reference

#include <PerformancePayloadFromTFormula.h>

Inheritance diagram for PerformancePayloadFromTFormula:
PerformancePayload

Public Member Functions

const PhysicsTFormulaPayloadformulaPayload () const
 
float getResult (PerformanceResult::ResultType, BinningPointByMap) const
 
virtual bool isInPayload (PerformanceResult::ResultType, BinningPointByMap) const
 
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
 
 PerformancePayloadFromTFormula (std::vector< PerformanceResult::ResultType > r, std::vector< BinningVariables::BinningVariablesType > b, PhysicsTFormulaPayload &in)
 
 PerformancePayloadFromTFormula ()
 
virtual ~PerformancePayloadFromTFormula ()
 
- Public Member Functions inherited from PerformancePayload
 PerformancePayload ()
 

Static Public Attributes

static int InvalidPos =-1
 
- Static Public Attributes inherited from PerformancePayload
static const float InvalidResult = -100.
 

Protected Member Functions

void check () const
 
bool isOk (BinningPointByMap p) const
 
virtual int limitPos (const BinningVariables::BinningVariablesType b) const
 
virtual std::vector
< BinningVariables::BinningVariablesType
myBinning () const
 
virtual int resultPos (PerformanceResult::ResultType r) const
 

Protected Attributes

std::vector< TFormula * > compiledFormulas_
 
PhysicsTFormulaPayload pl
 
std::vector
< PerformanceResult::ResultType
results_
 
std::vector
< BinningVariables::BinningVariablesType
variables_
 

Detailed Description

Definition at line 14 of file PerformancePayloadFromTFormula.h.

Constructor & Destructor Documentation

PerformancePayloadFromTFormula::PerformancePayloadFromTFormula ( std::vector< PerformanceResult::ResultType r,
std::vector< BinningVariables::BinningVariablesType b,
PhysicsTFormulaPayload in 
)
inline

Definition at line 20 of file PerformancePayloadFromTFormula.h.

20 : pl(in), results_(r), variables_(b) {}
std::vector< BinningVariables::BinningVariablesType > variables_
double b
Definition: hdecay.h:120
std::vector< PerformanceResult::ResultType > results_
PerformancePayloadFromTFormula::PerformancePayloadFromTFormula ( )
inline

Definition at line 22 of file PerformancePayloadFromTFormula.h.

22 {}
virtual PerformancePayloadFromTFormula::~PerformancePayloadFromTFormula ( )
inlinevirtual

Definition at line 23 of file PerformancePayloadFromTFormula.h.

References compiledFormulas_, and i.

23  {
24  for (unsigned int i=0; i< compiledFormulas_.size(); ++i){
25  delete compiledFormulas_[i];
26  }
27  compiledFormulas_.clear();
28  }
int i
Definition: DBlmapReader.cc:9

Member Function Documentation

void PerformancePayloadFromTFormula::check ( ) const
protected

Definition at line 56 of file PerformancePayloadFromTFormula.cc.

References compiledFormulas_, PhysicsTFormulaPayload::formulas(), i, pl, and matplotRender::t.

Referenced by getResult(), and isInPayload().

56  {
57  if (pl.formulas().size() == compiledFormulas_.size()) return;
58  //
59  // otherwise, compile!
60  //
61  for (unsigned int i=0; i< pl.formulas().size(); ++i){
62  TFormula* t = new TFormula("rr",(pl.formulas()[i]).c_str());
63  t->Compile();
64  compiledFormulas_.push_back(t);
65  }
66 }
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & formulas() const
const PhysicsTFormulaPayload& PerformancePayloadFromTFormula::formulaPayload ( ) const
inline

Definition at line 38 of file PerformancePayloadFromTFormula.h.

References pl.

38 {return pl;}
float PerformancePayloadFromTFormula::getResult ( PerformanceResult::ResultType  r,
BinningPointByMap  p 
) const
virtual

Implements PerformancePayload.

Definition at line 8 of file PerformancePayloadFromTFormula.cc.

References check(), compiledFormulas_, EcalElecEmulExample_cfg::formula, i, PerformancePayload::InvalidResult, isInPayload(), myBinning(), resultPos(), matplotRender::t, BinningPointByMap::value(), and makeHLTPrescaleTable::values.

8  {
9  check();
10  //
11  // which formula to use?
12  //
14 
15  // nice, what to do here???
16  TFormula * formula = compiledFormulas_[resultPos(r)];
17  //
18  // prepare the vector to pass, order counts!!!
19  //
20  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
21 
22  // sorry, TFormulas just work up to dimension==4
23  Double_t values[4];
24  int i=0;
25  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
26  values[i] = p.value(*it);
27  }
28  //
29  // i need a non const version #$%^
30  return formula->EvalPar(values);
31 }
int i
Definition: DBlmapReader.cc:9
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
static const float InvalidResult
float value(BinningVariables::BinningVariablesType)
virtual bool isInPayload(PerformanceResult::ResultType, BinningPointByMap) const
virtual int resultPos(PerformanceResult::ResultType r) const
bool PerformancePayloadFromTFormula::isInPayload ( PerformanceResult::ResultType  res,
BinningPointByMap  point 
) const
virtual

Implements PerformancePayload.

Definition at line 47 of file PerformancePayloadFromTFormula.cc.

References check(), InvalidPos, isOk(), and resultPos().

Referenced by getResult().

47  {
48  check();
49  // first, let's see if it is available at all
50  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
51  if ( ! isOk(point)) return false;
52  return true;
53 }
bool isOk(BinningPointByMap p) const
virtual int resultPos(PerformanceResult::ResultType r) const
bool PerformancePayloadFromTFormula::isOk ( BinningPointByMap  p) const
protected

Definition at line 33 of file PerformancePayloadFromTFormula.cc.

References BinningPointByMap::isKeyAvailable(), limitPos(), PhysicsTFormulaPayload::limits(), myBinning(), pl, pos, matplotRender::t, v, and BinningPointByMap::value().

Referenced by isInPayload().

33  {
34 
35  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
36 
37  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
38  if (! p.isKeyAvailable(*it)) return false;
39  float v = p.value(*it);
40  int pos = limitPos(*it);
41  std::pair<float, float> limits = (pl.limits())[pos];
42  if (v<limits.first || v>limits.second) return false;
43  }
44  return true;
45 }
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
bool isKeyAvailable(BinningVariables::BinningVariablesType)
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
float value(BinningVariables::BinningVariablesType)
const std::vector< std::pair< float, float > > & limits() const
mathSSE::Vec4< T > v
virtual bool PerformancePayloadFromTFormula::isParametrizedInVariable ( const BinningVariables::BinningVariablesType  p) const
inlinevirtual

Definition at line 32 of file PerformancePayloadFromTFormula.h.

References InvalidPos, and limitPos().

32  {
34  }
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
virtual int PerformancePayloadFromTFormula::limitPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 44 of file PerformancePayloadFromTFormula.h.

References b, spr::find(), InvalidPos, L1TEmulatorMonitor_cff::p, and variables_.

Referenced by isOk(), and isParametrizedInVariable().

44  {
45  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
46  p = find(variables_.begin(), variables_.end(), b);
48  return ((p-variables_.begin()));
49 
50  }
std::vector< BinningVariables::BinningVariablesType > variables_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
double b
Definition: hdecay.h:120
virtual std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTFormula::myBinning ( ) const
inlineprotectedvirtual

Definition at line 42 of file PerformancePayloadFromTFormula.h.

References variables_.

Referenced by getResult(), and isOk().

42 {return variables_;}
std::vector< BinningVariables::BinningVariablesType > variables_
virtual int PerformancePayloadFromTFormula::resultPos ( PerformanceResult::ResultType  r) const
inlineprotectedvirtual

Definition at line 52 of file PerformancePayloadFromTFormula.h.

References spr::find(), InvalidPos, L1TEmulatorMonitor_cff::p, csvReporter::r, and results_.

Referenced by getResult(), and isInPayload().

52  {
53  std::vector<PerformanceResult::ResultType>::const_iterator p;
54  p = find (results_.begin(), results_.end(), r);
56  return ((p-results_.begin()));
57  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< PerformanceResult::ResultType > results_

Member Data Documentation

std::vector<TFormula *> PerformancePayloadFromTFormula::compiledFormulas_
mutableprotected
int PerformancePayloadFromTFormula::InvalidPos =-1
static
PhysicsTFormulaPayload PerformancePayloadFromTFormula::pl
protected

Definition at line 64 of file PerformancePayloadFromTFormula.h.

Referenced by check(), formulaPayload(), and isOk().

std::vector<PerformanceResult::ResultType> PerformancePayloadFromTFormula::results_
protected

Definition at line 68 of file PerformancePayloadFromTFormula.h.

Referenced by resultPos().

std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTFormula::variables_
protected

Definition at line 69 of file PerformancePayloadFromTFormula.h.

Referenced by limitPos(), and myBinning().