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.

113  {
114  floatCols_.push_back(FloatColumn(name, doc, value));
115  }

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

◆ 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.

118  {
120  }

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

◆ 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.

123  {
124  intCols_.push_back(IntColumn(name, doc, value));
125  }

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

◆ 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.

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

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

◆ 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.

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

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

◆ 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.

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

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

◆ floatCols()

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

Definition at line 105 of file MergeableCounterTable.h.

105 { return floatCols_; }

References floatCols_.

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

◆ floatWithNormCols()

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

◆ intCols()

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

Definition at line 109 of file MergeableCounterTable.h.

109 { return intCols_; }

References intCols_.

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

◆ mergeProduct()

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

Definition at line 145 of file MergeableCounterTable.h.

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  }

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

◆ swap()

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

Definition at line 161 of file MergeableCounterTable.h.

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  }

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

◆ 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.

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  }

Referenced by mergeProduct().

◆ vfloatCols()

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

Definition at line 106 of file MergeableCounterTable.h.

106 { return vfloatCols_; }

References vfloatCols_.

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

◆ vfloatWithNormCols()

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

◆ vintCols()

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

Definition at line 110 of file MergeableCounterTable.h.

110 { return vintCols_; }

References vintCols_.

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

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

nanoaod::MergeableCounterTable::intCols_
std::vector< IntColumn > intCols_
Definition: MergeableCounterTable.h:175
DDAxes::y
nanoaod::MergeableCounterTable::floatCols_
std::vector< FloatColumn > floatCols_
Definition: MergeableCounterTable.h:171
common_cff.doc
doc
Definition: common_cff.py:54
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDAxes::x
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
trackingPlots.other
other
Definition: trackingPlots.py:1465
nanoaod::MergeableCounterTable::tryMerge
bool tryMerge(std::vector< T > &one, const std::vector< T > &two)
Definition: MergeableCounterTable.h:179
nanoaod::MergeableCounterTable::floatWithNormCols_
std::vector< FloatWithNormColumn > floatWithNormCols_
Definition: MergeableCounterTable.h:173
value
Definition: value.py:1
nanoaod::MergeableCounterTable::vintCols_
std::vector< VIntColumn > vintCols_
Definition: MergeableCounterTable.h:176
nanoaod::MergeableCounterTable::FloatColumn
SingleColumn< float_accumulator > FloatColumn
Definition: MergeableCounterTable.h:35
nanoaod::MergeableCounterTable::IntColumn
SingleColumn< int_accumulator > IntColumn
Definition: MergeableCounterTable.h:36
nanoaod::MergeableCounterTable::FloatWithNormColumn
SingleWithNormColumn< float_accumulator > FloatWithNormColumn
Definition: MergeableCounterTable.h:53
T
long double T
Definition: Basic3DVectorLD.h:48
nanoaod::MergeableCounterTable::VIntColumn
VectorColumn< int_accumulator > VIntColumn
Definition: MergeableCounterTable.h:78
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
nanoaod::MergeableCounterTable::vfloatWithNormCols_
std::vector< VFloatWithNormColumn > vfloatWithNormCols_
Definition: MergeableCounterTable.h:174
nanoaod::MergeableCounterTable::VFloatWithNormColumn
VectorWithNormColumn< float_accumulator > VFloatWithNormColumn
Definition: MergeableCounterTable.h:103
nanoaod::MergeableCounterTable::vfloatCols_
std::vector< VFloatColumn > vfloatCols_
Definition: MergeableCounterTable.h:172
nanoaod::MergeableCounterTable::VFloatColumn
VectorColumn< float_accumulator > VFloatColumn
Definition: MergeableCounterTable.h:77