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

#include <PerformancePayloadFromTable.h>

Inheritance diagram for PerformancePayloadFromTable:
PerformancePayload

Public Member Functions

float getResult (PerformanceResult::ResultType, const BinningPointByMap &) const
 
virtual bool isInPayload (PerformanceResult::ResultType, const BinningPointByMap &) const
 
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 ()
 
virtual ~PerformancePayloadFromTable ()
 
- 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 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_
 

Detailed Description

Definition at line 13 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 21 of file PerformancePayloadFromTable.h.

21  :
22  pl(stride_, table),
23  results_(r), binning_(b) {}
std::vector< BinningVariables::BinningVariablesType > binning_
#define table(NAME)
Definition: DbCore.h:49
std::vector< PerformanceResult::ResultType > results_
double b
Definition: hdecay.h:120
PerformancePayloadFromTable::PerformancePayloadFromTable ( )
inline

Definition at line 25 of file PerformancePayloadFromTable.h.

25 {}
virtual PerformancePayloadFromTable::~PerformancePayloadFromTable ( )
inlinevirtual

Definition at line 26 of file PerformancePayloadFromTable.h.

26 {}

Member Function Documentation

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

Implements PerformancePayload.

Definition at line 8 of file PerformancePayloadFromTable.cc.

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

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 }
int i
Definition: DBlmapReader.cc:9
virtual int resultPos(PerformanceResult::ResultType r) const
static const float InvalidResult
virtual bool isInPayload(PerformanceResult::ResultType, const BinningPointByMap &) const
bool matches(const BinningPointByMap &, PhysicsPerformancePayload::Row &) const
bool PerformancePayloadFromTable::isInPayload ( PerformanceResult::ResultType  res,
const BinningPointByMap _point 
) const
virtual

Implements PerformancePayload.

Definition at line 45 of file PerformancePayloadFromTable.cc.

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

Referenced by getResult().

45  {
46  BinningPointByMap point = _point;
47  // first, let's see if it is available at all
48  if (resultPos(res) == PerformancePayloadFromTable::InvalidPos) return false;
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 }
int i
Definition: DBlmapReader.cc:9
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 30 of file PerformancePayloadFromTable.h.

References InvalidPos, and minPos().

30  {
32  }
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, lumiQTWidget::t, findQualityFiles::v, and BinningPointByMap::value().

Referenced by getResult(), and isInPayload().

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

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

Referenced by matches().

48  {
49  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
50  p = find(binning_.begin(), binning_.end(), b);
52  return ((p-binning_.begin())*2+1);
53 
54  }
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 > binning_
double b
Definition: hdecay.h:120
virtual int PerformancePayloadFromTable::minPos ( const BinningVariables::BinningVariablesType  b) const
inlineprotectedvirtual

Definition at line 42 of file PerformancePayloadFromTable.h.

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

Referenced by isParametrizedInVariable(), and matches().

42  {
43  std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
44  p = find(binning_.begin(), binning_.end(), b);
46  return ((p-binning_.begin())*2);
47  }
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 > binning_
double b
Definition: hdecay.h:120
virtual std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTable::myBinning ( ) const
inlineprotectedvirtual

Definition at line 40 of file PerformancePayloadFromTable.h.

References binning_.

Referenced by isInPayload(), and matches().

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

Definition at line 36 of file PerformancePayloadFromTable.h.

References pl.

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

Definition at line 55 of file PerformancePayloadFromTable.h.

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

Referenced by getResult(), and isInPayload().

55  {
56  // result should be: # of binning variables *2 + position of result
57  std::vector<PerformanceResult::ResultType>::const_iterator p;
58  p = find (results_.begin(), results_.end(), r);
59  if ( p == results_.end()) return PerformancePayloadFromTable::InvalidPos;
60  return (binning_.size()*2+(p-results_.begin()));
61 
62  }
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 > binning_
std::vector< PerformanceResult::ResultType > results_

Member Data Documentation

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

Definition at line 69 of file PerformancePayloadFromTable.h.

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

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

Definition at line 66 of file PerformancePayloadFromTable.h.

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

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

Definition at line 68 of file PerformancePayloadFromTable.h.

Referenced by resultPos().