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

Definition at line 113 of file MergeableCounterTable.h.

References boostedTaus_cff::doc, floatCols_, and Skims_PA_cff::name.

113  {
114  floatCols_.push_back(FloatColumn(name, doc, value));
115  }
SingleColumn< float_accumulator > FloatColumn
Definition: value.py:1
std::vector< FloatColumn > floatCols_

◆ addFloatWithNorm()

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

Definition at line 118 of file MergeableCounterTable.h.

References boostedTaus_cff::doc, floatWithNormCols_, and Skims_PA_cff::name.

118  {
120  }
SingleWithNormColumn< float_accumulator > FloatWithNormColumn
std::vector< FloatWithNormColumn > floatWithNormCols_
Definition: value.py:1

◆ addInt()

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

Definition at line 123 of file MergeableCounterTable.h.

References boostedTaus_cff::doc, intCols_, and Skims_PA_cff::name.

123  {
124  intCols_.push_back(IntColumn(name, doc, value));
125  }
std::vector< IntColumn > intCols_
Definition: value.py:1
SingleColumn< int_accumulator > IntColumn

◆ addVFloat()

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

Definition at line 128 of file MergeableCounterTable.h.

References filterCSVwithJSON::copy, boostedTaus_cff::doc, Skims_PA_cff::name, contentValuesCheck::values, and vfloatCols_.

128  {
129  vfloatCols_.push_back(VFloatColumn(name, doc, values.size()));
130  std::copy(values.begin(), values.end(), vfloatCols_.back().values.begin());
131  }
std::vector< VFloatColumn > vfloatCols_
VectorColumn< float_accumulator > VFloatColumn

◆ addVFloatWithNorm()

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

Definition at line 134 of file MergeableCounterTable.h.

References filterCSVwithJSON::copy, boostedTaus_cff::doc, Skims_PA_cff::name, contentValuesCheck::values, and vfloatWithNormCols_.

134  {
135  vfloatWithNormCols_.push_back(VFloatWithNormColumn(name, doc, values.size(), norm));
136  std::copy(values.begin(), values.end(), vfloatWithNormCols_.back().values.begin());
137  }
std::vector< VFloatWithNormColumn > vfloatWithNormCols_
VectorWithNormColumn< float_accumulator > VFloatWithNormColumn

◆ addVInt()

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

Definition at line 140 of file MergeableCounterTable.h.

References filterCSVwithJSON::copy, boostedTaus_cff::doc, Skims_PA_cff::name, contentValuesCheck::values, and vintCols_.

140  {
141  vintCols_.push_back(VIntColumn(name, doc, values.size()));
142  std::copy(values.begin(), values.end(), vintCols_.back().values.begin());
143  }
std::vector< VIntColumn > vintCols_
VectorColumn< int_accumulator > VIntColumn

◆ floatCols()

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

Definition at line 105 of file MergeableCounterTable.h.

References floatCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

105 { return floatCols_; }
std::vector< FloatColumn > floatCols_

◆ floatWithNormCols()

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

Definition at line 107 of file MergeableCounterTable.h.

References floatWithNormCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

107 { return floatWithNormCols_; }
std::vector< FloatWithNormColumn > floatWithNormCols_

◆ intCols()

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

Definition at line 109 of file MergeableCounterTable.h.

References intCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

109 { return intCols_; }
std::vector< IntColumn > intCols_

◆ 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  }
long double T

◆ vfloatCols()

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

Definition at line 106 of file MergeableCounterTable.h.

References vfloatCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

106 { return vfloatCols_; }
std::vector< VFloatColumn > vfloatCols_

◆ vfloatWithNormCols()

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

Definition at line 108 of file MergeableCounterTable.h.

References vfloatWithNormCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

108 { return vfloatWithNormCols_; }
std::vector< VFloatWithNormColumn > vfloatWithNormCols_

◆ vintCols()

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

Definition at line 110 of file MergeableCounterTable.h.

References vintCols_.

Referenced by SummaryTableOutputBranches::fill(), and SummaryTableOutputBranches::updateBranches().

110 { return vintCols_; }
std::vector< VIntColumn > vintCols_

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().