CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
PerformancePayloadFromTable Class Reference

#include <PerformancePayloadFromTable.h>

Inheritance diagram for PerformancePayloadFromTable:
PerformancePayload

Public Member Functions

float getResult (PerformanceResult::ResultType, const BinningPointByMap &) const override
 
bool isInPayload (PerformanceResult::ResultType, const BinningPointByMap &) const override
 
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
 
const PhysicsPerformancePayloadpayLoad () const
 
 PerformancePayloadFromTable (const std::vector< PerformanceResult::ResultType > &r, const std::vector< BinningVariables::BinningVariablesType > &b, int stride_, const std::vector< float > &table)
 
 PerformancePayloadFromTable ()
 
 ~PerformancePayloadFromTable () override
 
- Public Member Functions inherited from PerformancePayload
virtual void initialize ()
 
 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 matches (const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
 
virtual int maxPos (const BinningVariables::BinningVariablesType b) const
 
virtual int minPos (const BinningVariables::BinningVariablesType b) const
 
virtual std::vector
< BinningVariables::BinningVariablesType
myBinning () const
 
virtual int resultPos (PerformanceResult::ResultType r) const
 

Protected Attributes

std::vector
< BinningVariables::BinningVariablesType
binning_
 
PhysicsPerformancePayload pl
 
std::vector
< PerformanceResult::ResultType
results_
 

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 15 of file PerformancePayloadFromTable.h.

Constructor & Destructor Documentation

PerformancePayloadFromTable::PerformancePayloadFromTable ( const std::vector< PerformanceResult::ResultType > &  r,
const std::vector< BinningVariables::BinningVariablesType > &  b,
int  stride_,
const std::vector< float > &  table 
)
inline

Definition at line 22 of file PerformancePayloadFromTable.h.

26  : pl(stride_, table), results_(r), binning_(b) {}
std::vector< BinningVariables::BinningVariablesType > binning_
std::vector< PerformanceResult::ResultType > results_
double b
Definition: hdecay.h:118
PerformancePayloadFromTable::PerformancePayloadFromTable ( )
inline

Definition at line 28 of file PerformancePayloadFromTable.h.

28 {}
PerformancePayloadFromTable::~PerformancePayloadFromTable ( )
inlineoverride

Definition at line 29 of file PerformancePayloadFromTable.h.

29 {}

Member Function Documentation

float PerformancePayloadFromTable::getResult ( PerformanceResult::ResultType  r,
const BinningPointByMap p 
) const
overridevirtual

Implements PerformancePayload.

Definition at line 7 of file PerformancePayloadFromTable.cc.

References PhysicsPerformancePayload::getRow(), mps_fire::i, PerformancePayload::InvalidResult, isInPayload(), matches(), PhysicsPerformancePayload::nRows(), pl, and resultPos().

7  {
8  if (!isInPayload(r, p))
10 
11  // loop on the table rows and search for a match
12  for (int i = 0; i < pl.nRows(); i++) {
14 
15  if (matches(p, row)) {
16  int pos = resultPos(r);
17  return row[pos];
18  }
19  }
21 }
bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const override
virtual int resultPos(PerformanceResult::ResultType r) const
static const float InvalidResult
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
bool PerformancePayloadFromTable::isInPayload ( PerformanceResult::ResultType  res,
const BinningPointByMap _point 
) const
overridevirtual

Implements PerformancePayload.

Definition at line 44 of file PerformancePayloadFromTable.cc.

References PhysicsPerformancePayload::getRow(), mps_fire::i, InvalidPos, BinningPointByMap::isKeyAvailable(), matches(), myBinning(), PhysicsPerformancePayload::nRows(), pl, point, resultPos(), and submitPVValidationJobs::t.

Referenced by getResult().

45  {
46  BinningPointByMap point = _point;
47  // first, let's see if it is available at all
49  return false;
50  // now look whther the binning point contains all the info
51  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
52  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
53  if (!point.isKeyAvailable(*it))
54  return false;
55  }
56  // then, look if there is a matching row
57  for (int i = 0; i < pl.nRows(); i++) {
59  if (matches(point, row)) {
60  return true;
61  }
62  }
63  return false;
64 }
virtual int resultPos(PerformanceResult::ResultType r) const
bool isKeyAvailable(BinningVariables::BinningVariablesType)
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
virtual bool PerformancePayloadFromTable::isParametrizedInVariable ( const BinningVariables::BinningVariablesType  p) const
inlinevirtual

Definition at line 34 of file PerformancePayloadFromTable.h.

References InvalidPos, and minPos().

34  {
36  }
virtual int minPos(const BinningVariables::BinningVariablesType b) const
bool PerformancePayloadFromTable::matches ( const BinningPointByMap _p,
PhysicsPerformancePayload::Row row 
) const
protected

Definition at line 23 of file PerformancePayloadFromTable.cc.

References maxPos(), minPos(), myBinning(), AlCaHLTBitMon_ParallelJobs::p, submitPVValidationJobs::t, findQualityFiles::v, and BinningPointByMap::value().

Referenced by getResult(), and isInPayload().

23  {
24  //
25  // this is the smart function which does not take into account the fields not present
26  //
27 
28  // I can do it via a loop!
29  BinningPointByMap p = _p;
30  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
31 
32  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end(); ++it) {
33  //
34  // first the binning point map must contain ALL the quantities here
35  //
36  // if (! p.isKeyAvailable(*it) ) return false;
37  float v = p.value(*it);
38  if (!(v >= row[minPos(*it)] && v < row[maxPos(*it)]))
39  return false;
40  }
41  return true;
42 }
virtual int maxPos(const BinningVariables::BinningVariablesType b) const
virtual int minPos(const BinningVariables::BinningVariablesType b) const
float value(BinningVariables::BinningVariablesType)
virtual std::vector< BinningVariables::BinningVariablesType > myBinning() const
virtual int PerformancePayloadFromTable::maxPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 52 of file PerformancePayloadFromTable.h.

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

Referenced by matches().

52  {
53  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
54  p = find(binning_.begin(), binning_.end(), b);
55  if (p == binning_.end())
57  return ((p - binning_.begin()) * 2 + 1);
58  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< BinningVariables::BinningVariablesType > binning_
double b
Definition: hdecay.h:118
virtual int PerformancePayloadFromTable::minPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 45 of file PerformancePayloadFromTable.h.

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

Referenced by isParametrizedInVariable(), and matches().

45  {
46  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
47  p = find(binning_.begin(), binning_.end(), b);
48  if (p == binning_.end())
50  return ((p - binning_.begin()) * 2);
51  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< BinningVariables::BinningVariablesType > binning_
double b
Definition: hdecay.h:118
virtual std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTable::myBinning ( ) const
inlineprotectedvirtual

Definition at line 43 of file PerformancePayloadFromTable.h.

References binning_.

Referenced by isInPayload(), and matches().

43 { return binning_; }
std::vector< BinningVariables::BinningVariablesType > binning_
const PhysicsPerformancePayload& PerformancePayloadFromTable::payLoad ( ) const
inline

Definition at line 40 of file PerformancePayloadFromTable.h.

References pl.

40 { return pl; }
virtual int PerformancePayloadFromTable::resultPos ( PerformanceResult::ResultType  r) const
inlineprotectedvirtual

Definition at line 59 of file PerformancePayloadFromTable.h.

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

Referenced by getResult(), and isInPayload().

59  {
60  // result should be: # of binning variables *2 + position of result
61  std::vector<PerformanceResult::ResultType>::const_iterator p;
62  p = find(results_.begin(), results_.end(), r);
63  if (p == results_.end())
65  return (binning_.size() * 2 + (p - results_.begin()));
66  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< BinningVariables::BinningVariablesType > binning_
std::vector< PerformanceResult::ResultType > results_
template<class Archive >
void PerformancePayloadFromTable::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 75 of file PerformancePayloadFromTable.h.

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

Definition at line 75 of file PerformancePayloadFromTable.h.

Member Data Documentation

std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTable::binning_
protected

Definition at line 73 of file PerformancePayloadFromTable.h.

Referenced by maxPos(), minPos(), myBinning(), and resultPos().

const int PerformancePayloadFromTable::InvalidPos = -1
static
PhysicsPerformancePayload PerformancePayloadFromTable::pl
protected

Definition at line 70 of file PerformancePayloadFromTable.h.

Referenced by getResult(), isInPayload(), and payLoad().

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

Definition at line 72 of file PerformancePayloadFromTable.h.

Referenced by resultPos().