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 | Private Member Functions | Friends
PerformancePayloadFromTFormula Class Reference

#include <PerformancePayloadFromTFormula.h>

Inheritance diagram for PerformancePayloadFromTFormula:
PerformancePayload

Public Member Functions

const PhysicsTFormulaPayloadformulaPayload () const
 
float getResult (PerformanceResult::ResultType, const BinningPointByMap &) const
 
void initialize ()
 
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 ()
 
 PerformancePayloadFromTFormula (const PerformancePayloadFromTFormula &b)
 
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

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< boost::shared_ptr
< TFormula > > 
compiledFormulas_
 
PhysicsTFormulaPayload pl
 
std::vector
< PerformanceResult::ResultType
results_
 
std::vector
< BinningVariables::BinningVariablesType
variables_
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 17 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 23 of file PerformancePayloadFromTFormula.h.

References initialize().

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

Definition at line 29 of file PerformancePayloadFromTFormula.h.

29 {}
PerformancePayloadFromTFormula::PerformancePayloadFromTFormula ( const PerformancePayloadFromTFormula b)
inline

Definition at line 33 of file PerformancePayloadFromTFormula.h.

33  :
34  pl(b.pl),
35  results_(b.results_),
std::vector< boost::shared_ptr< TFormula > > compiledFormulas_
std::vector< BinningVariables::BinningVariablesType > variables_
std::vector< PerformanceResult::ResultType > results_
virtual PerformancePayloadFromTFormula::~PerformancePayloadFromTFormula ( )
inlinevirtual

Definition at line 39 of file PerformancePayloadFromTFormula.h.

References compiledFormulas_.

39  {
40  compiledFormulas_.clear();
41  }
std::vector< boost::shared_ptr< TFormula > > compiledFormulas_

Member Function Documentation

const PhysicsTFormulaPayload& PerformancePayloadFromTFormula::formulaPayload ( ) const
inline

Definition at line 53 of file PerformancePayloadFromTFormula.h.

References pl.

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

Implements PerformancePayload.

Definition at line 26 of file PerformancePayloadFromTFormula.cc.

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

26  {
27  BinningPointByMap p = _p;
28  //
29  // which formula to use?
30  //
32 
33  // nice, what to do here???
34  const boost::shared_ptr<TFormula>& formula = compiledFormulas_[resultPos(r)];
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  // Note, in current implementation of TFormula EvalPar should be
49  // thread safe as it does nothing more than call a function
50  // through a function pointer which is stateless. In spite of the
51  // fact that it is not const.
52  return formula->EvalPar(values);
53 }
int i
Definition: DBlmapReader.cc:9
std::vector< boost::shared_ptr< TFormula > > compiledFormulas_
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
void PerformancePayloadFromTFormula::initialize ( )
virtual

Reimplemented from PerformancePayload.

Definition at line 13 of file PerformancePayloadFromTFormula.cc.

References EcalElecEmulTccOnlyExample_cfg::formula, relval_steps::gen(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and createPayload::uuid.

Referenced by PerformancePayloadFromTFormula().

13  {
14  boost::uuids::random_generator gen;
15 
16  for( std::vector<std::string>::const_iterator formula = pl.formulas().begin(); formula != pl.formulas().end(); ++formula ) {
17  boost::uuids::uuid uniqueFormulaId = gen();
18  const auto formulaUniqueName = boost::lexical_cast<std::string>(uniqueFormulaId);
19  boost::shared_ptr<TFormula> temp(new TFormula(formulaUniqueName.c_str(),formula->c_str()));
20  temp->Compile();
21  compiledFormulas_.push_back(temp);
22  }
23 }
std::vector< boost::shared_ptr< TFormula > > compiledFormulas_
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
const std::vector< std::string > & formulas() const
bool PerformancePayloadFromTFormula::isInPayload ( PerformanceResult::ResultType  res,
const BinningPointByMap point 
) const
virtual

Implements PerformancePayload.

Definition at line 69 of file PerformancePayloadFromTFormula.cc.

References InvalidPos.

69  {
70  // first, let's see if it is available at all
71  if (resultPos(res) == PerformancePayloadFromTFormula::InvalidPos) return false;
72 
73  if ( ! isOk(point)) return false;
74  return true;
75 }
bool isOk(const BinningPointByMap &p) const
virtual int resultPos(PerformanceResult::ResultType r) const
bool PerformancePayloadFromTFormula::isOk ( const BinningPointByMap p) const
protected

Definition at line 55 of file PerformancePayloadFromTFormula.cc.

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

55  {
56  BinningPointByMap p = _p;
57  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
58 
59  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
60  if (! p.isKeyAvailable(*it)) return false;
61  float v = p.value(*it);
62  int pos = limitPos(*it);
63  std::pair<float, float> limits = (pl.limits())[pos];
64  if (v<limits.first || v>limits.second) return false;
65  }
66  return true;
67 }
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 47 of file PerformancePayloadFromTFormula.h.

References InvalidPos, and limitPos().

47  {
49  }
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
virtual int PerformancePayloadFromTFormula::limitPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 62 of file PerformancePayloadFromTFormula.h.

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

Referenced by isParametrizedInVariable().

62  {
63  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
64  p = find(variables_.begin(), variables_.end(), b);
66  return ((p-variables_.begin()));
67 
68  }
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 60 of file PerformancePayloadFromTFormula.h.

References variables_.

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

Definition at line 77 of file PerformancePayloadFromTFormula.cc.

References gather_cfg::cout, EcalElecEmulTccOnlyExample_cfg::formula, InvalidPos, and lumiQTWidget::t.

77  {
78  //
79  // which formula to use?
80  //
82  cout << "Warning: result not available!" << endl;
83  return;
84  }
85 
86  // nice, what to do here???
87  const boost::shared_ptr<TFormula>& formula =
89  cout << "-- Formula: " << formula->GetExpFormula("p") << endl;
90  // prepare the vector to pass, order counts!!!
91  //
92  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
93 
94  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
95  int pos = limitPos(*it);
96  std::pair<float, float> limits = (pl.limits())[pos];
97  cout << " Variable: " << *it << " with limits: " << "from: " << limits.first << " to: " << limits.second << endl;
98  }
99 
100 }
std::vector< boost::shared_ptr< TFormula > > compiledFormulas_
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int limitPos(const BinningVariables::BinningVariablesType b) const
tuple cout
Definition: gather_cfg.py:145
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 70 of file PerformancePayloadFromTFormula.h.

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

70  {
71  std::vector<PerformanceResult::ResultType>::const_iterator p;
72  p = find (results_.begin(), results_.end(), r);
74  return ((p-results_.begin()));
75  }
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_
template<class Archive >
void PerformancePayloadFromTFormula::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 91 of file PerformancePayloadFromTFormula.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 91 of file PerformancePayloadFromTFormula.h.

Member Data Documentation

std::vector< boost::shared_ptr<TFormula> > PerformancePayloadFromTFormula::compiledFormulas_
protected

Definition at line 89 of file PerformancePayloadFromTFormula.h.

Referenced by ~PerformancePayloadFromTFormula().

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

Definition at line 80 of file PerformancePayloadFromTFormula.h.

Referenced by formulaPayload().

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

Definition at line 84 of file PerformancePayloadFromTFormula.h.

Referenced by resultPos().

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

Definition at line 85 of file PerformancePayloadFromTFormula.h.

Referenced by limitPos(), and myBinning().