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, const BinningPointByMap &) const
 
virtual bool isInPayload (PerformanceResult::ResultType, const BinningPointByMap &) const
 
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
 
 PerformancePayloadFromTFormula (const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, PhysicsTFormulaPayload &in)
 
 PerformancePayloadFromTFormula ()
 
void printFormula (PerformanceResult::ResultType res) const
 
virtual ~PerformancePayloadFromTFormula ()
 
- Public Member Functions inherited from PerformancePayload
 PerformancePayload ()
 
virtual ~PerformancePayload ()
 

Static Public Attributes

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

Protected Member Functions

void check () const
 
bool isOk (const 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 ( const std::vector< PerformanceResult::ResultType > &  r,
const 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 58 of file PerformancePayloadFromTFormula.cc.

References i, and lumiQTWidget::t.

58  {
59  if (pl.formulas().size() == compiledFormulas_.size()) return;
60  //
61  // otherwise, compile!
62  //
63  for (unsigned int i=0; i< pl.formulas().size(); ++i){
64  TFormula* t = new TFormula("rr",(pl.formulas()[i]).c_str()); //FIXME: "rr" should be unique!
65  t->Compile();
66  compiledFormulas_.push_back(t);
67  }
68 }
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,
const BinningPointByMap _p 
) const
virtual

Implements PerformancePayload.

Definition at line 8 of file PerformancePayloadFromTFormula.cc.

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

Implements PerformancePayload.

Definition at line 48 of file PerformancePayloadFromTFormula.cc.

References CastorDataFrameFilter_impl::check(), and InvalidPos.

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

Definition at line 34 of file PerformancePayloadFromTFormula.cc.

References BinningPointByMap::isKeyAvailable(), AlCaHLTBitMon_ParallelJobs::p, lumiQTWidget::t, findQualityFiles::v, and BinningPointByMap::value().

34  {
35  BinningPointByMap p = _p;
36  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
37 
38  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
39  if (! p.isKeyAvailable(*it)) return false;
40  float v = p.value(*it);
41  int pos = limitPos(*it);
42  std::pair<float, float> limits = (pl.limits())[pos];
43  if (v<limits.first || v>limits.second) return false;
44  }
45  return true;
46 }
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
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 70 of file PerformancePayloadFromTFormula.cc.

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

Referenced by operator<<().

70  {
71  check();
72  //
73  // which formula to use?
74  //
76  cout << "Warning: result not available!" << endl;
77  }
78 
79  // nice, what to do here???
80  TFormula * formula = compiledFormulas_[resultPos(res)];
81  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
82  // prepare the vector to pass, order counts!!!
83  //
84  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
85 
86  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
87  int pos = limitPos(*it);
88  std::pair<float, float> limits = (pl.limits())[pos];
89  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
90  }
91 
92 }
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().

const 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().