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
PerformancePayloadFromBinnedTFormula Class Reference

#include <PerformancePayloadFromBinnedTFormula.h>

Inheritance diagram for PerformancePayloadFromBinnedTFormula:
PerformancePayload

Public Member Functions

const std::vector
< PhysicsTFormulaPayload > & 
formulaPayloads () const
 
float getResult (PerformanceResult::ResultType, const BinningPointByMap &) const
 
virtual bool isInPayload (PerformanceResult::ResultType, const BinningPointByMap &) const
 
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
 
 PerformancePayloadFromBinnedTFormula (const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, const std::vector< PhysicsTFormulaPayload > &in)
 
 PerformancePayloadFromBinnedTFormula ()
 
void printFormula (PerformanceResult::ResultType res, const BinningPointByMap &) const
 
virtual ~PerformancePayloadFromBinnedTFormula ()
 
- 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
 
TFormula * getFormula (PerformanceResult::ResultType, const BinningPointByMap &) const
 
bool isOk (const BinningPointByMap &p, unsigned int &) 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< std::vector
< TFormula * > > 
compiledFormulas_
 
std::vector
< PhysicsTFormulaPayload
pls
 
std::vector
< PerformanceResult::ResultType
results_
 
std::vector
< BinningVariables::BinningVariablesType
variables_
 

Detailed Description

Definition at line 14 of file PerformancePayloadFromBinnedTFormula.h.

Constructor & Destructor Documentation

PerformancePayloadFromBinnedTFormula::PerformancePayloadFromBinnedTFormula ( const std::vector< PerformanceResult::ResultType > &  r,
const std::vector< BinningVariables::BinningVariablesType > &  b,
const std::vector< PhysicsTFormulaPayload > &  in 
)
inline

Definition at line 20 of file PerformancePayloadFromBinnedTFormula.h.

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

Definition at line 22 of file PerformancePayloadFromBinnedTFormula.h.

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

Definition at line 23 of file PerformancePayloadFromBinnedTFormula.h.

References compiledFormulas_.

23  {
24  compiledFormulas_.clear();
25  }
std::vector< std::vector< TFormula * > > compiledFormulas_

Member Function Documentation

void PerformancePayloadFromBinnedTFormula::check ( ) const
protected

Definition at line 89 of file PerformancePayloadFromBinnedTFormula.cc.

References PhysicsTFormulaPayload::formulas(), i, findQualityFiles::size, lumiQTWidget::t, groupFilesInBlocks::temp, tmp, and groupFilesInBlocks::tt.

89  {
90  if (pls.size()== compiledFormulas_.size()) return;
91  //
92  // otherwise, compile!
93  //
94  compiledFormulas_.clear();
95  for (unsigned int t=0; t< pls.size(); ++t){
96  std::vector <TFormula *> temp;
97  for (unsigned int i=0; i< (pls[t].formulas()).size(); ++i){
99  TFormula* tt = new TFormula("rr",((tmp.formulas())[i]).c_str()); //FIXME: "rr" should be unique!
100  tt->Compile();
101  temp.push_back(tt);
102  }
103  compiledFormulas_.push_back(temp);
104  }
105 }
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & formulas() const
std::vector< std::vector< TFormula * > > compiledFormulas_
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple size
Write out results.
const std::vector<PhysicsTFormulaPayload>& PerformancePayloadFromBinnedTFormula::formulaPayloads ( ) const
inline

Definition at line 35 of file PerformancePayloadFromBinnedTFormula.h.

References pls.

Referenced by PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob().

35 {return pls;}
TFormula * PerformancePayloadFromBinnedTFormula::getFormula ( PerformanceResult::ResultType  r,
const BinningPointByMap p 
) const
protected

Definition at line 9 of file PerformancePayloadFromBinnedTFormula.cc.

References NULL, and convertSQLiteXML::ok.

9  {
10  //
11  // chooses the correct rectangular region
12  //
13  if (! isInPayload(r,p)) return NULL;
14  unsigned int region;
15  bool ok = isOk(p,region);
16  if (ok == false) return NULL;
17 
18  return compiledFormulas_[region][resultPos(r)];
19 
20 }
bool isOk(const BinningPointByMap &p, unsigned int &) const
#define NULL
Definition: scimark2.h:8
virtual int resultPos(PerformanceResult::ResultType r) const
std::vector< std::vector< TFormula * > > compiledFormulas_
virtual bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const
float PerformancePayloadFromBinnedTFormula::getResult ( PerformanceResult::ResultType  r,
const BinningPointByMap _p 
) const
virtual

Implements PerformancePayload.

Definition at line 22 of file PerformancePayloadFromBinnedTFormula.cc.

References CastorDataFrameFilter_impl::check(), EcalElecEmulExample_cfg::formula, i, PerformancePayload::InvalidResult, AlCaHLTBitMon_ParallelJobs::p, lumiQTWidget::t, BinningPointByMap::value(), and makeHLTPrescaleTable::values.

22  {
23  check();
24  BinningPointByMap p = _p;
25  //
26  // which formula to use?
27  //
29 
30  // nice, what to do here???
31  // TFormula * formula = compiledFormulas_[resultPos(r)];
32  //
33 
34  TFormula * formula = getFormula(r,p);
35 
36  // prepare the vector to pass, order counts!!!
37  //
38  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
39 
40  // sorry, TFormulas just work up to dimension==4
41  Double_t values[4];
42  int i=0;
43  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it, ++i){
44  values[i] = p.value(*it);
45  }
46  //
47  // i need a non const version #$%^
48  return formula->EvalPar(values);
49 }
int i
Definition: DBlmapReader.cc:9
static const float InvalidResult
float value(BinningVariables::BinningVariablesType)
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
TFormula * getFormula(PerformanceResult::ResultType, const BinningPointByMap &) const
virtual bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const
bool PerformancePayloadFromBinnedTFormula::isInPayload ( PerformanceResult::ResultType  res,
const BinningPointByMap point 
) const
virtual

Implements PerformancePayload.

Definition at line 79 of file PerformancePayloadFromBinnedTFormula.cc.

References CastorDataFrameFilter_impl::check(), and InvalidPos.

79  {
80  check();
81  // first, let's see if it is available at all
83  unsigned int whocares;
84  if ( ! isOk(point,whocares)) return false;
85  return true;
86 }
bool isOk(const BinningPointByMap &p, unsigned int &) const
virtual int resultPos(PerformanceResult::ResultType r) const
bool PerformancePayloadFromBinnedTFormula::isOk ( const BinningPointByMap p,
unsigned int &  whichone 
) const
protected

Definition at line 51 of file PerformancePayloadFromBinnedTFormula.cc.

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

51  {
52 
53  BinningPointByMap p = _p;
54  //
55  // change: look on whether a single rectangularr region matches
56  //
57  for (unsigned int ti=0; ti< pls.size(); ++ti){
58  bool result = true;
59  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
60  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
61  //
62  // now looking into a single payload
63  //
64  if (! p.isKeyAvailable(*it)) return false;
65  float v = p.value(*it);
66  int pos = limitPos(*it);
67  std::pair<float, float> limits = (pls[ti].limits())[pos];
68  if (v<limits.first || v>limits.second) result= false;
69  }
70  if (result == true) {
71  whichone = ti;
72  return true;
73  }
74  }
75  whichone = 9999;
76  return false;
77 }
bool isKeyAvailable(BinningVariables::BinningVariablesType)
float value(BinningVariables::BinningVariablesType)
tuple result
Definition: query.py:137
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
virtual bool PerformancePayloadFromBinnedTFormula::isParametrizedInVariable ( const BinningVariables::BinningVariablesType  p) const
inlinevirtual
virtual int PerformancePayloadFromBinnedTFormula::limitPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 44 of file PerformancePayloadFromBinnedTFormula.h.

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

Referenced by 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  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< BinningVariables::BinningVariablesType > variables_
double b
Definition: hdecay.h:120
virtual std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromBinnedTFormula::myBinning ( ) const
inlineprotectedvirtual

Definition at line 42 of file PerformancePayloadFromBinnedTFormula.h.

References variables_.

42 {return variables_;}
std::vector< BinningVariables::BinningVariablesType > variables_
void PerformancePayloadFromBinnedTFormula::printFormula ( PerformanceResult::ResultType  res,
const BinningPointByMap point 
) const

Definition at line 110 of file PerformancePayloadFromBinnedTFormula.cc.

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

110  {
111  check();
112  //
113  // which formula to use?
114  //
116  cout << "Warning: result not available!" << endl;
117  }
118 
119  // nice, what to do here???
120  TFormula * formula = getFormula(res, point);
121  unsigned int whichone;
122  isOk(point,whichone);
123  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
124  // prepare the vector to pass, order counts!!!
125  //
126  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
127 
128  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
129  int pos = limitPos(*it);
130  std::pair<float, float> limits = (pls[whichone].limits())[pos];
131  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
132  }
133 
134 }
bool isOk(const BinningPointByMap &p, unsigned int &) const
virtual int resultPos(PerformanceResult::ResultType r) const
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
TFormula * getFormula(PerformanceResult::ResultType, const BinningPointByMap &) const
tuple cout
Definition: gather_cfg.py:121
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
virtual int PerformancePayloadFromBinnedTFormula::resultPos ( PerformanceResult::ResultType  r) const
inlineprotectedvirtual

Definition at line 52 of file PerformancePayloadFromBinnedTFormula.h.

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

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<std::vector<TFormula *> > PerformancePayloadFromBinnedTFormula::compiledFormulas_
mutableprotected
const int PerformancePayloadFromBinnedTFormula::InvalidPos =-1
static
std::vector<PhysicsTFormulaPayload> PerformancePayloadFromBinnedTFormula::pls
protected

Definition at line 68 of file PerformancePayloadFromBinnedTFormula.h.

Referenced by formulaPayloads().

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

Definition at line 72 of file PerformancePayloadFromBinnedTFormula.h.

Referenced by resultPos().

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

Definition at line 73 of file PerformancePayloadFromBinnedTFormula.h.

Referenced by limitPos(), and myBinning().