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, BinningPointByMap) const
 
virtual bool isInPayload (PerformanceResult::ResultType, BinningPointByMap) const
 
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
 
 PerformancePayloadFromBinnedTFormula (std::vector< PerformanceResult::ResultType > r, std::vector< BinningVariables::BinningVariablesType > b, std::vector< PhysicsTFormulaPayload > in)
 
 PerformancePayloadFromBinnedTFormula ()
 
void printFormula (PerformanceResult::ResultType res, BinningPointByMap) const
 
virtual ~PerformancePayloadFromBinnedTFormula ()
 
- 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
 
TFormula * getFormula (PerformanceResult::ResultType, BinningPointByMap) const
 
bool isOk (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 ( std::vector< PerformanceResult::ResultType r,
std::vector< BinningVariables::BinningVariablesType b,
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 87 of file PerformancePayloadFromBinnedTFormula.cc.

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

87  {
88  if (pls.size()== compiledFormulas_.size()) return;
89  //
90  // otherwise, compile!
91  //
92  compiledFormulas_.clear();
93  for (unsigned int t=0; t< pls.size(); ++t){
94  std::vector <TFormula *> temp;
95  for (unsigned int i=0; i< (pls[t].formulas()).size(); ++i){
97  TFormula* tt = new TFormula("rr",((tmp.formulas())[i]).c_str()); //FIXME: "rr" should be unique!
98  tt->Compile();
99  temp.push_back(tt);
100  }
101  compiledFormulas_.push_back(temp);
102  }
103 }
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,
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 }
#define NULL
Definition: scimark2.h:8
virtual int resultPos(PerformanceResult::ResultType r) const
std::vector< std::vector< TFormula * > > compiledFormulas_
bool isOk(BinningPointByMap p, unsigned int &) const
virtual bool isInPayload(PerformanceResult::ResultType, BinningPointByMap) const
float PerformancePayloadFromBinnedTFormula::getResult ( PerformanceResult::ResultType  r,
BinningPointByMap  p 
) const
virtual

Implements PerformancePayload.

Definition at line 22 of file PerformancePayloadFromBinnedTFormula.cc.

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

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

Implements PerformancePayload.

Definition at line 77 of file PerformancePayloadFromBinnedTFormula.cc.

References CastorDataFrameFilter_impl::check(), and InvalidPos.

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

Definition at line 50 of file PerformancePayloadFromBinnedTFormula.cc.

References BinningPointByMap::isKeyAvailable(), pos, query::result, lumiQTWidget::t, v, and BinningPointByMap::value().

50  {
51 
52  //
53  // change: look on whether a single rectangularr region matches
54  //
55  for (unsigned int ti=0; ti< pls.size(); ++ti){
56  bool result = true;
57  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
58  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
59  //
60  // now looking into a single payload
61  //
62  if (! p.isKeyAvailable(*it)) return false;
63  float v = p.value(*it);
64  int pos = limitPos(*it);
65  std::pair<float, float> limits = (pls[ti].limits())[pos];
66  if (v<limits.first || v>limits.second) result= false;
67  }
68  if (result == true) {
69  whichone = ti;
70  return true;
71  }
72  }
73  whichone = 9999;
74  return false;
75 }
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
mathSSE::Vec4< T > v
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,
BinningPointByMap  point 
) const

Definition at line 108 of file PerformancePayloadFromBinnedTFormula.cc.

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

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