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 ()
 
void printFormula (PerformanceResult::ResultType res) const
 
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 57 of file PerformancePayloadFromTFormula.cc.

References i, and lumiQTWidget::t.

57  {
58  if (pl.formulas().size() == compiledFormulas_.size()) return;
59  //
60  // otherwise, compile!
61  //
62  for (unsigned int i=0; i< pl.formulas().size(); ++i){
63  TFormula* t = new TFormula("rr",(pl.formulas()[i]).c_str()); //FIXME: "rr" should be unique!
64  t->Compile();
65  compiledFormulas_.push_back(t);
66  }
67 }
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 CastorDataFrameFilter_impl::check(), EcalElecEmulExample_cfg::formula, i, PerformancePayload::InvalidResult, lumiQTWidget::t, BinningPointByMap::value(), and makeHLTPrescaleTable::values.

Referenced by PFEnergyCalibration::aBarrel(), PFEnergyCalibration::aEndcap(), PFEnergyCalibration::aEtaBarrel(), PFEnergyCalibration::aEtaEndcap(), PFEnergyCalibration::bBarrel(), PFEnergyCalibration::bEndcap(), PFEnergyCalibration::bEtaBarrel(), PFEnergyCalibration::bEtaEndcap(), PFEnergyCalibration::cBarrel(), and PFEnergyCalibration::cEndcap().

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 CastorDataFrameFilter_impl::check(), and InvalidPos.

47  {
48  check();
49  // first, let's see if it is available at all
50  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
51 
52  if ( ! isOk(point)) return false;
53  return true;
54 }
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(), pos, lumiQTWidget::t, v, and BinningPointByMap::value().

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 47 of file PerformancePayloadFromTFormula.h.

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

Referenced by isParametrizedInVariable().

47  {
48  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
49  p = find(variables_.begin(), variables_.end(), b);
51  return ((p-variables_.begin()));
52 
53  }
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 45 of file PerformancePayloadFromTFormula.h.

References variables_.

45 {return variables_;}
std::vector< BinningVariables::BinningVariablesType > variables_
void PerformancePayloadFromTFormula::printFormula ( PerformanceResult::ResultType  res) const

Definition at line 69 of file PerformancePayloadFromTFormula.cc.

References CastorDataFrameFilter_impl::check(), gather_cfg::cout, EcalElecEmulExample_cfg::formula, InvalidPos, pos, and lumiQTWidget::t.

Referenced by operator<<().

69  {
70  check();
71  //
72  // which formula to use?
73  //
75  cout << "Warning: result not available!" << endl;
76  }
77 
78  // nice, what to do here???
79  TFormula * formula = compiledFormulas_[resultPos(res)];
80  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
81  // prepare the vector to pass, order counts!!!
82  //
83  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
84 
85  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
86  int pos = limitPos(*it);
87  std::pair<float, float> limits = (pl.limits())[pos];
88  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
89  }
90 
91 }
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
tuple cout
Definition: gather_cfg.py:121
const std::vector< std::pair< float, float > > & limits() const
virtual int resultPos(PerformanceResult::ResultType r) const
virtual int PerformancePayloadFromTFormula::resultPos ( PerformanceResult::ResultType  r) const
inlineprotectedvirtual

Definition at line 55 of file PerformancePayloadFromTFormula.h.

References spr::find(), InvalidPos, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, and results_.

55  {
56  std::vector<PerformanceResult::ResultType>::const_iterator p;
57  p = find (results_.begin(), results_.end(), r);
59  return ((p-results_.begin()));
60  }
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

Definition at line 76 of file PerformancePayloadFromTFormula.h.

Referenced by ~PerformancePayloadFromTFormula().

int PerformancePayloadFromTFormula::InvalidPos =-1
static
PhysicsTFormulaPayload PerformancePayloadFromTFormula::pl
protected

Definition at line 67 of file PerformancePayloadFromTFormula.h.

Referenced by formulaPayload().

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

Definition at line 71 of file PerformancePayloadFromTFormula.h.

Referenced by resultPos().

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

Definition at line 72 of file PerformancePayloadFromTFormula.h.

Referenced by limitPos(), and myBinning().