CMS 3D CMS Logo

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::BinningVariablesTypemyBinning () const
 
virtual int resultPos (PerformanceResult::ResultType r) const
 

Protected Attributes

std::vector< BinningVariables::BinningVariablesTypebinning_
 
PhysicsPerformancePayload pl
 
std::vector< PerformanceResult::ResultTyperesults_
 

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

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

Definition at line 27 of file PerformancePayloadFromTable.h.

27 {}
PerformancePayloadFromTable::~PerformancePayloadFromTable ( )
inlineoverride

Definition at line 28 of file PerformancePayloadFromTable.h.

References getResult().

28 {}

Member Function Documentation

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

Implements PerformancePayload.

Definition at line 8 of file PerformancePayloadFromTable.cc.

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

Referenced by ~PerformancePayloadFromTable().

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

Implements PerformancePayload.

Definition at line 45 of file PerformancePayloadFromTable.cc.

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

Referenced by getResult(), and isParametrizedInVariable().

45  {
46  BinningPointByMap point = _point;
47  // first, let's see if it is available at all
49  // now look whther the binning point contains all the info
50  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
51  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
52  if (! point.isKeyAvailable(*it) ) return false;
53  }
54  // then, look if there is a matching row
55  for (int i=0; i< pl.nRows(); i++){
57  if (matches(point,row)){
58  return true;
59  }
60  }
61  return false;
62 }
virtual int resultPos(PerformanceResult::ResultType r) const
bool isKeyAvailable(BinningVariables::BinningVariablesType)
Definition: Electron.h:6
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 32 of file PerformancePayloadFromTable.h.

References InvalidPos, isInPayload(), and minPos().

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

Definition at line 24 of file PerformancePayloadFromTable.cc.

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

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

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

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

Referenced by matches().

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

Definition at line 44 of file PerformancePayloadFromTable.h.

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

Referenced by isParametrizedInVariable(), and matches().

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

Definition at line 42 of file PerformancePayloadFromTable.h.

References binning_.

Referenced by isInPayload(), and matches().

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

Definition at line 38 of file PerformancePayloadFromTable.h.

References pl.

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

Definition at line 57 of file PerformancePayloadFromTable.h.

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

Referenced by getResult(), and isInPayload().

57  {
58  // result should be: # of binning variables *2 + position of result
59  std::vector<PerformanceResult::ResultType>::const_iterator p;
60  p = find (results_.begin(), results_.end(), r);
61  if ( p == results_.end()) return PerformancePayloadFromTable::InvalidPos;
62  return (binning_.size()*2+(p-results_.begin()));
63 
64  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
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 74 of file PerformancePayloadFromTable.h.

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

Definition at line 74 of file PerformancePayloadFromTable.h.

Member Data Documentation

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

Definition at line 71 of file PerformancePayloadFromTable.h.

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

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

Definition at line 68 of file PerformancePayloadFromTable.h.

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

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

Definition at line 70 of file PerformancePayloadFromTable.h.

Referenced by resultPos().