CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes

PerformancePayloadFromTable Class Reference

#include <PerformancePayloadFromTable.h>

Inheritance diagram for PerformancePayloadFromTable:
PerformancePayload

List of all members.

Public Member Functions

float getResult (PerformanceResult::ResultType, BinningPointByMap) const
virtual bool isInPayload (PerformanceResult::ResultType, BinningPointByMap) const
virtual bool isParametrizedInVariable (const BinningVariables::BinningVariablesType p) const
const PhysicsPerformancePayloadpayLoad () const
 PerformancePayloadFromTable ()
 PerformancePayloadFromTable (std::vector< PerformanceResult::ResultType > r, std::vector< BinningVariables::BinningVariablesType > b, int stride_, std::vector< float > table)
virtual ~PerformancePayloadFromTable ()

Static Public Attributes

static int InvalidPos = -1

Protected Member Functions

bool matches (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 ( std::vector< PerformanceResult::ResultType r,
std::vector< BinningVariables::BinningVariablesType b,
int  stride_,
std::vector< float >  table 
) [inline]

Definition at line 21 of file PerformancePayloadFromTable.h.

                                                                                                                                                                  : 
      pl(stride_, table),
      results_(r), binning_(b) {}
PerformancePayloadFromTable::PerformancePayloadFromTable ( ) [inline]

Definition at line 25 of file PerformancePayloadFromTable.h.

{}
virtual PerformancePayloadFromTable::~PerformancePayloadFromTable ( ) [inline, virtual]

Definition at line 26 of file PerformancePayloadFromTable.h.

{}

Member Function Documentation

float PerformancePayloadFromTable::getResult ( PerformanceResult::ResultType  r,
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, pos, and resultPos().

                                                                                                     {

  if (! isInPayload(r,p)) return  PerformancePayload::InvalidResult;

  // loop on the table rows and search for a match
  for (int i=0; i< pl.nRows(); i++){
    PhysicsPerformancePayload::Row  row = pl.getRow(i);

    if (matches(p,row)){
      int pos = resultPos(r);
      return row[pos];
    }
  }
  return PerformancePayload::InvalidResult;
}
bool PerformancePayloadFromTable::isInPayload ( PerformanceResult::ResultType  res,
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, resultPos(), and matplotRender::t.

Referenced by getResult().

                                                                                                           {
  // first, let's see if it is available at all
  if (resultPos(res) == PerformancePayloadFromTable::InvalidPos) return false;
  // now look whther the binning point contains all the info
  std::vector<BinningVariables::BinningVariablesType> t = myBinning();
  for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
    if (! point.isKeyAvailable(*it) ) return false;
  }
  // then, look if there is a matching row
  for (int i=0; i< pl.nRows(); i++){
    PhysicsPerformancePayload::Row  row = pl.getRow(i);
    if (matches(point,row)){
      return true;
    }
  }
  return false;
}
virtual bool PerformancePayloadFromTable::isParametrizedInVariable ( const BinningVariables::BinningVariablesType  p) const [inline, virtual]

Definition at line 30 of file PerformancePayloadFromTable.h.

References InvalidPos, and minPos().

bool PerformancePayloadFromTable::matches ( BinningPointByMap  p,
PhysicsPerformancePayload::Row row 
) const [protected]

Definition at line 24 of file PerformancePayloadFromTable.cc.

References maxPos(), minPos(), myBinning(), matplotRender::t, v, and BinningPointByMap::value().

Referenced by getResult(), and isInPayload().

                                                                                                       {
  //
  // this is the smart function which does not take into account the fields not present 
  //

  // I can do it via a loop!
  
    std::vector<BinningVariables::BinningVariablesType> t = myBinning();


    for (std::vector<BinningVariables::BinningVariablesType>::const_iterator it = t.begin(); it != t.end();++it){
      //
      // first the binning point map must contain ALL the quantities here
      //
      //    if (! p.isKeyAvailable(*it) ) return false;
      float v = p.value(*it);
      if (!(v >= row[minPos(*it)] && v  < row[maxPos(*it)])) return false;
  }
  return true;
}
virtual int PerformancePayloadFromTable::maxPos ( const BinningVariables::BinningVariablesType  b) const [inline, protected, virtual]

Definition at line 48 of file PerformancePayloadFromTable.h.

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

Referenced by matches().

                                                                         {
    std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
    p = find(binning_.begin(), binning_.end(), b);
    if (p == binning_.end()) return PerformancePayloadFromTable::InvalidPos;
    return ((p-binning_.begin())*2+1);

  }    
virtual int PerformancePayloadFromTable::minPos ( const BinningVariables::BinningVariablesType  b) const [inline, protected, virtual]

Definition at line 42 of file PerformancePayloadFromTable.h.

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

Referenced by isParametrizedInVariable(), and matches().

                                                                         {
    std::vector<BinningVariables::BinningVariablesType>::const_iterator p;
    p = find(binning_.begin(), binning_.end(), b);
    if (p == binning_.end()) return PerformancePayloadFromTable::InvalidPos;
    return ((p-binning_.begin())*2);
  }
virtual std::vector<BinningVariables::BinningVariablesType> PerformancePayloadFromTable::myBinning ( ) const [inline, protected, virtual]

Definition at line 40 of file PerformancePayloadFromTable.h.

References binning_.

Referenced by isInPayload(), and matches().

{return binning_;}
const PhysicsPerformancePayload& PerformancePayloadFromTable::payLoad ( ) const [inline]

Definition at line 36 of file PerformancePayloadFromTable.h.

References pl.

{return pl;}
virtual int PerformancePayloadFromTable::resultPos ( PerformanceResult::ResultType  r) const [inline, protected, virtual]

Definition at line 55 of file PerformancePayloadFromTable.h.

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

Referenced by getResult(), and isInPayload().

                                                                {
      // result should be: # of binning variables *2 + position of result
      std::vector<PerformanceResult::ResultType>::const_iterator p;
      p = find (results_.begin(), results_.end(), r);
      if ( p == results_.end()) return PerformancePayloadFromTable::InvalidPos;
      return (binning_.size()*2+(p-results_.begin()));
      
  }

Member Data Documentation

Definition at line 69 of file PerformancePayloadFromTable.h.

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

Definition at line 66 of file PerformancePayloadFromTable.h.

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

Definition at line 68 of file PerformancePayloadFromTable.h.

Referenced by resultPos().