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  SingleWithNormColumn
 
struct  VectorColumn
 
struct  VectorWithNormColumn
 

Public Types

typedef double float_accumulator
 
typedef SingleColumn< float_accumulatorFloatColumn
 
typedef SingleWithNormColumn< float_accumulatorFloatWithNormColumn
 
typedef long long int_accumulator
 
typedef SingleColumn< int_accumulatorIntColumn
 
typedef VectorColumn< float_accumulatorVFloatColumn
 
typedef VectorWithNormColumn< float_accumulatorVFloatWithNormColumn
 
typedef VectorColumn< int_accumulatorVIntColumn
 

Public Member Functions

template<typename F >
void addFloat (const std::string &name, const std::string &doc, F value)
 
template<typename F >
void addFloatWithNorm (const std::string &name, const std::string &doc, F value, double norm)
 
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 F >
void addVFloatWithNorm (const std::string &name, const std::string &doc, const std::vector< F > values, double norm)
 
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< FloatWithNormColumn > & floatWithNormCols () const
 
const std::vector< IntColumn > & intCols () const
 
 MergeableCounterTable ()
 
bool mergeProduct (const MergeableCounterTable &other)
 
void swap (MergeableCounterTable &iOther)
 
const std::vector< VFloatColumn > & vfloatCols () const
 
const std::vector< VFloatWithNormColumn > & vfloatWithNormCols () 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< FloatWithNormColumnfloatWithNormCols_
 
std::vector< IntColumnintCols_
 
std::vector< VFloatColumnvfloatCols_
 
std::vector< VFloatWithNormColumnvfloatWithNormCols_
 
std::vector< VIntColumnvintCols_
 

Detailed Description

Definition at line 11 of file MergeableCounterTable.h.

Member Typedef Documentation

◆ float_accumulator

Definition at line 15 of file MergeableCounterTable.h.

◆ FloatColumn

Definition at line 35 of file MergeableCounterTable.h.

◆ FloatWithNormColumn

Definition at line 53 of file MergeableCounterTable.h.

◆ int_accumulator

Definition at line 14 of file MergeableCounterTable.h.

◆ IntColumn

Definition at line 36 of file MergeableCounterTable.h.

◆ VFloatColumn

Definition at line 77 of file MergeableCounterTable.h.

◆ VFloatWithNormColumn

Definition at line 103 of file MergeableCounterTable.h.

◆ VIntColumn

Definition at line 78 of file MergeableCounterTable.h.

Constructor & Destructor Documentation

◆ MergeableCounterTable()

nanoaod::MergeableCounterTable::MergeableCounterTable ( )
inline

Definition at line 13 of file MergeableCounterTable.h.

13 {}

Member Function Documentation

◆ addFloat()

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

◆ addFloatWithNorm()

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

◆ addInt()

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

◆ addVFloat()

template<typename F >
void nanoaod::MergeableCounterTable::addVFloat ( const std::string &  name,
const std::string &  doc,
const std::vector< F values 
)
inline

◆ addVFloatWithNorm()

template<typename F >
void nanoaod::MergeableCounterTable::addVFloatWithNorm ( const std::string &  name,
const std::string &  doc,
const std::vector< F values,
double  norm 
)
inline

◆ addVInt()

template<typename I >
void nanoaod::MergeableCounterTable::addVInt ( const std::string &  name,
const std::string &  doc,
const std::vector< I >  values 
)
inline

◆ floatCols()

const std::vector<FloatColumn>& nanoaod::MergeableCounterTable::floatCols ( ) const
inline

◆ floatWithNormCols()

const std::vector<FloatWithNormColumn>& nanoaod::MergeableCounterTable::floatWithNormCols ( ) const
inline

◆ intCols()

const std::vector<IntColumn>& nanoaod::MergeableCounterTable::intCols ( ) const
inline

◆ mergeProduct()

bool nanoaod::MergeableCounterTable::mergeProduct ( const MergeableCounterTable other)
inline

Definition at line 145 of file MergeableCounterTable.h.

References floatCols_, floatWithNormCols_, intCols_, trackingPlots::other, tryMerge(), vfloatCols_, vfloatWithNormCols_, and vintCols_.

145  {
146  if (!tryMerge(intCols_, other.intCols_))
147  return false;
148  if (!tryMerge(vintCols_, other.vintCols_))
149  return false;
150  if (!tryMerge(floatCols_, other.floatCols_))
151  return false;
152  if (!tryMerge(vfloatCols_, other.vfloatCols_))
153  return false;
154  if (!tryMerge(floatWithNormCols_, other.floatWithNormCols_))
155  return false;
156  if (!tryMerge(vfloatWithNormCols_, other.vfloatWithNormCols_))
157  return false;
158  return true;
159  }
std::vector< VFloatWithNormColumn > vfloatWithNormCols_
std::vector< IntColumn > intCols_
bool tryMerge(std::vector< T > &one, const std::vector< T > &two)
std::vector< FloatWithNormColumn > floatWithNormCols_
std::vector< VIntColumn > vintCols_
std::vector< VFloatColumn > vfloatCols_
std::vector< FloatColumn > floatCols_

◆ swap()

void nanoaod::MergeableCounterTable::swap ( MergeableCounterTable iOther)
inline

Definition at line 161 of file MergeableCounterTable.h.

References floatCols_, floatWithNormCols_, intCols_, vfloatCols_, vfloatWithNormCols_, and vintCols_.

161  {
162  floatCols_.swap(iOther.floatCols_);
163  vfloatCols_.swap(iOther.vfloatCols_);
164  floatWithNormCols_.swap(iOther.floatWithNormCols_);
165  vfloatWithNormCols_.swap(iOther.vfloatWithNormCols_);
166  intCols_.swap(iOther.intCols_);
167  vintCols_.swap(iOther.vintCols_);
168  }
std::vector< VFloatWithNormColumn > vfloatWithNormCols_
std::vector< IntColumn > intCols_
std::vector< FloatWithNormColumn > floatWithNormCols_
std::vector< VIntColumn > vintCols_
std::vector< VFloatColumn > vfloatCols_
std::vector< FloatColumn > floatCols_

◆ tryMerge()

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

Definition at line 179 of file MergeableCounterTable.h.

References SiPixelPI::two, and x.

Referenced by mergeProduct().

179  {
180  for (auto y : two) {
181  auto x = std::find_if(one.begin(), one.end(), [&y](const T& x) { return x.name == y.name; });
182  if (x == one.end())
183  one.push_back(y);
184  else
185  (*x) += y;
186  }
187  return true;
188  }
float x
long double T

◆ vfloatCols()

const std::vector<VFloatColumn>& nanoaod::MergeableCounterTable::vfloatCols ( ) const
inline

◆ vfloatWithNormCols()

const std::vector<VFloatWithNormColumn>& nanoaod::MergeableCounterTable::vfloatWithNormCols ( ) const
inline

◆ vintCols()

const std::vector<VIntColumn>& nanoaod::MergeableCounterTable::vintCols ( ) const
inline

Member Data Documentation

◆ floatCols_

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

Definition at line 171 of file MergeableCounterTable.h.

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

◆ floatWithNormCols_

std::vector<FloatWithNormColumn> nanoaod::MergeableCounterTable::floatWithNormCols_
private

Definition at line 173 of file MergeableCounterTable.h.

Referenced by addFloatWithNorm(), floatWithNormCols(), mergeProduct(), and swap().

◆ intCols_

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

Definition at line 175 of file MergeableCounterTable.h.

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

◆ vfloatCols_

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

Definition at line 172 of file MergeableCounterTable.h.

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

◆ vfloatWithNormCols_

std::vector<VFloatWithNormColumn> nanoaod::MergeableCounterTable::vfloatWithNormCols_
private

Definition at line 174 of file MergeableCounterTable.h.

Referenced by addVFloatWithNorm(), mergeProduct(), swap(), and vfloatWithNormCols().

◆ vintCols_

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

Definition at line 176 of file MergeableCounterTable.h.

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