CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
nanoaod::MergeableCounterTable Class Reference

#include <MergeableCounterTable.h>

Classes

struct  SingleColumn
 
struct  VectorColumn
 

Public Types

typedef double float_accumulator
 
typedef SingleColumn< float_accumulatorFloatColumn
 
typedef long long int_accumulator
 
typedef SingleColumn< int_accumulatorIntColumn
 
typedef VectorColumn< float_accumulatorVFloatColumn
 
typedef VectorColumn< int_accumulatorVIntColumn
 

Public Member Functions

template<typename F >
void addFloat (const std::string &name, const std::string &doc, F value)
 
template<typename I >
void addInt (const std::string &name, const std::string &doc, I value)
 
template<typename F >
void addVFloat (const std::string &name, const std::string &doc, const std::vector< F > values)
 
template<typename I >
void addVInt (const std::string &name, const std::string &doc, const std::vector< I > values)
 
const std::vector< FloatColumn > & floatCols () const
 
const std::vector< IntColumn > & intCols () const
 
 MergeableCounterTable ()
 
bool mergeProduct (const MergeableCounterTable &other)
 
const std::vector< VFloatColumn > & vfloatCols () const
 
const std::vector< VIntColumn > & vintCols () const
 

Private Member Functions

template<typename T >
bool tryMerge (std::vector< T > &one, const std::vector< T > &two)
 

Private Attributes

std::vector< FloatColumnfloatCols_
 
std::vector< IntColumnintCols_
 
std::vector< VFloatColumnvfloatCols_
 
std::vector< VIntColumnvintCols_
 

Detailed Description

Definition at line 10 of file MergeableCounterTable.h.

Member Typedef Documentation

Definition at line 14 of file MergeableCounterTable.h.

Definition at line 33 of file MergeableCounterTable.h.

Definition at line 13 of file MergeableCounterTable.h.

Definition at line 34 of file MergeableCounterTable.h.

Definition at line 57 of file MergeableCounterTable.h.

Definition at line 58 of file MergeableCounterTable.h.

Constructor & Destructor Documentation

nanoaod::MergeableCounterTable::MergeableCounterTable ( )
inline

Definition at line 12 of file MergeableCounterTable.h.

12 {}

Member Function Documentation

template<typename F >
void nanoaod::MergeableCounterTable::addFloat ( const std::string &  name,
const std::string &  doc,
F  value 
)
inline

Definition at line 66 of file MergeableCounterTable.h.

References floatCols_.

66 { floatCols_.push_back(FloatColumn(name, doc, value)); }
SingleColumn< float_accumulator > FloatColumn
Definition: value.py:1
std::vector< FloatColumn > floatCols_
template<typename I >
void nanoaod::MergeableCounterTable::addInt ( const std::string &  name,
const std::string &  doc,
value 
)
inline

Definition at line 69 of file MergeableCounterTable.h.

References intCols_.

69 { intCols_.push_back(IntColumn(name, doc, value)); }
std::vector< IntColumn > intCols_
Definition: value.py:1
SingleColumn< int_accumulator > IntColumn
template<typename F >
void nanoaod::MergeableCounterTable::addVFloat ( const std::string &  name,
const std::string &  doc,
const std::vector< F values 
)
inline

Definition at line 72 of file MergeableCounterTable.h.

References popcon2dropbox::copy(), and vfloatCols_.

72  {
73  vfloatCols_.push_back(VFloatColumn(name, doc, values.size()));
74  std::copy(values.begin(), values.end(), vfloatCols_.back().values.begin());
75  }
def copy(args, dbName)
std::vector< VFloatColumn > vfloatCols_
VectorColumn< float_accumulator > VFloatColumn
template<typename I >
void nanoaod::MergeableCounterTable::addVInt ( const std::string &  name,
const std::string &  doc,
const std::vector< I >  values 
)
inline

Definition at line 78 of file MergeableCounterTable.h.

References popcon2dropbox::copy(), and vintCols_.

78  {
79  vintCols_.push_back(VIntColumn(name, doc, values.size()));
80  std::copy(values.begin(), values.end(), vintCols_.back().values.begin());
81  }
def copy(args, dbName)
std::vector< VIntColumn > vintCols_
VectorColumn< int_accumulator > VIntColumn
const std::vector<FloatColumn>& nanoaod::MergeableCounterTable::floatCols ( ) const
inline
const std::vector<IntColumn>& nanoaod::MergeableCounterTable::intCols ( ) const
inline
bool nanoaod::MergeableCounterTable::mergeProduct ( const MergeableCounterTable other)
inline

Definition at line 84 of file MergeableCounterTable.h.

References floatCols_, intCols_, tryMerge(), vfloatCols_, and vintCols_.

84  {
85  if (!tryMerge(intCols_, other.intCols_)) return false;
86  if (!tryMerge(vintCols_, other.vintCols_)) return false;
87  if (!tryMerge(floatCols_, other.floatCols_)) return false;
88  if (!tryMerge(vfloatCols_, other.vfloatCols_)) return false;
89  return true;
90  }
std::vector< IntColumn > intCols_
bool tryMerge(std::vector< T > &one, const std::vector< T > &two)
std::vector< VIntColumn > vintCols_
std::vector< VFloatColumn > vfloatCols_
std::vector< FloatColumn > floatCols_
template<typename T >
bool nanoaod::MergeableCounterTable::tryMerge ( std::vector< T > &  one,
const std::vector< T > &  two 
)
inlineprivate

Definition at line 99 of file MergeableCounterTable.h.

References nanoaod::MergeableCounterTable::SingleColumn< T >::compatible(), mps_fire::i, and gen::n.

Referenced by mergeProduct().

99  {
100  if (one.size() != two.size()) return false;
101  for (unsigned int i = 0, n = one.size(); i < n; ++i) {
102  if (!one[i].compatible(two[i])) return false;
103  one[i] += two[i];
104  }
105  return true;
106  }
const std::vector<VFloatColumn>& nanoaod::MergeableCounterTable::vfloatCols ( ) const
inline
const std::vector<VIntColumn>& nanoaod::MergeableCounterTable::vintCols ( ) const
inline

Member Data Documentation

std::vector<FloatColumn> nanoaod::MergeableCounterTable::floatCols_
private

Definition at line 93 of file MergeableCounterTable.h.

Referenced by addFloat(), floatCols(), and mergeProduct().

std::vector<IntColumn> nanoaod::MergeableCounterTable::intCols_
private

Definition at line 95 of file MergeableCounterTable.h.

Referenced by addInt(), intCols(), and mergeProduct().

std::vector<VFloatColumn> nanoaod::MergeableCounterTable::vfloatCols_
private

Definition at line 94 of file MergeableCounterTable.h.

Referenced by addVFloat(), mergeProduct(), and vfloatCols().

std::vector<VIntColumn> nanoaod::MergeableCounterTable::vintCols_
private

Definition at line 96 of file MergeableCounterTable.h.

Referenced by addVInt(), mergeProduct(), and vintCols().