|
#include <AbsNtuple.hh>
|
| AbsNtuple (const std::vector< std::string > &columnNames, const char *ntTitle) |
|
const std::string & | title () const |
|
virtual void | setTitle (const char *newtitle) |
|
unsigned long | nColumns () const |
|
const std::string & | columnName (const unsigned long i) const |
|
const std::vector< std::string > & | columnNames () const |
|
virtual bool | setColumnName (unsigned long i, const char *newname) |
|
unsigned long | columnNumber (const char *columnName) const |
|
unsigned long | validColumn (const char *columnName) const |
|
virtual unsigned long | nRows () const =0 |
|
unsigned long | length () const |
|
virtual void | fill (const T *values, unsigned long lenValues)=0 |
|
virtual void | fill (const T &v0)=0 |
|
virtual void | fill (const T &v0, const T &v1)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7, const T &v8)=0 |
|
virtual void | fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7, const T &v8, const T &v9)=0 |
|
template<typename T2 > |
void | append (const AbsNtuple< T2 > &another) |
|
virtual T | operator() (unsigned long r, unsigned long c) const =0 |
|
virtual T | at (unsigned long r, unsigned long c) const =0 |
|
T | element (unsigned long r, const Column &c) const |
|
T | elementAt (unsigned long r, const Column &c) const |
|
virtual void | rowContents (unsigned long row, T *buf, unsigned long lenBuf) const =0 |
|
virtual void | columnContents (const Column &c, T *buf, unsigned long lenBuf) const =0 |
|
virtual void | clear ()=0 |
|
row_iterator | row_begin (unsigned long rowNumber) const |
|
row_iterator | row_end () const |
|
column_iterator | column_begin (const Column &column) const |
|
column_iterator | column_end () const |
|
template<class Accumulator > |
void | cycleOverRows (Accumulator &acc) const |
|
template<class Filter , class Accumulator > |
unsigned long | conditionalCycleOverRows (const Filter &f, Accumulator &acc) const |
|
template<class Filter > |
unsigned long | conditionalRowCount (const Filter &f) const |
|
template<class Accumulator , class WeightCalc > |
void | weightedCycleOverRows (Accumulator &acc, const WeightCalc &wcalc, bool skipZeroWeights=false) const |
|
template<class Filter , class Accumulator , class WeightCalc > |
double | weightedConditionalCycleOverRows (const Filter &f, Accumulator &acc, const WeightCalc &wcalc, bool skipZeroWeights=false) const |
|
template<class Filter , class WeightCalc > |
double | weightedConditionalRowCount (const Filter &f, const WeightCalc &wcalc) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4, const Column &c5) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4, const Column &c5, const Column &c6) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4, const Column &c5, const Column &c6, const Column &c7) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4, const Column &c5, const Column &c6, const Column &c7, const Column &c8) const |
|
std::vector< unsigned long > | columnIndices (const Column &c0, const Column &c1, const Column &c2, const Column &c3, const Column &c4, const Column &c5, const Column &c6, const Column &c7, const Column &c8, const Column &c9) const |
|
std::vector< unsigned long > | columnIndices (const std::vector< std::string > &colNames) const |
|
virtual gs::ClassId | classId () const =0 |
|
bool | operator== (const AbsNtuple &r) const |
|
bool | operator!= (const AbsNtuple &r) const |
|
template<typename T>
class npstat::AbsNtuple< T >
Interface class for ntuples. Here, ntuples are homogeneous 2-d tables in which the number of columns is fixed while the number of rows can grow dynamically.
◆ AbsNtuple()
The constructor arguments are a vector of column names and an ntuple title c-string (which can be NULL)
◆ append()
template<typename T >
template<typename T2 >
Append contents of another ntuple. That ntuple must have the same number of columns. The copy constructor must exist which builds elements of this ntuple from the elements of another ntuple.
◆ at()
◆ classId()
◆ clear()
◆ columnIndices() [1/2]
Convenience method which returns a collection of column indices using a set of inhomogeneous column descriptions as an argument. Exception will be thrown if the column does not exist.
◆ columnIndices() [2/2]
template<typename T >
std::vector<unsigned long> npstat::AbsNtuple< T >::columnIndices |
( |
const std::vector< std::string > & |
colNames | ) |
const |
Convenience method which returns a collection of column indices using a vector of column names as an argument.
◆ columnName()
Retrieve the name for the given column
◆ columnNames()
Retrieve all column names
◆ columnNumber()
This method returns nColumns() in case the given column name is not valid
◆ conditionalCycleOverRows()
template<typename T >
template<class Filter , class Accumulator >
unsigned long npstat::AbsNtuple< T >::conditionalCycleOverRows |
( |
const Filter & |
f, |
|
|
Accumulator & |
acc |
|
) |
| const |
Same as cycleOverRows, but the accumulator will be called only if the filter returns "true". The filter must be a functor which implements
bool operator()(unsigned long rowNumber, const T* rowContents, unsigned long nColumns) const
The function returns the number of rows passing the filter.
◆ conditionalRowCount()
template<typename T >
template<class Filter >
Cycle over rows counting how many rows pass the filter
◆ cycleOverRows()
template<typename T >
template<class Accumulator >
Function for cycling over all rows. The accumulator class must implement the following function:
void accumulate(T* rowContents, unsigned long nColumns)
◆ element()
Access with flexible column argument. The "Column" class has converting constructors from unsigned long, const char*, and std::string&. All these can now be used as the second argument. Note that this type of access will be slower than access by simple indices, so don't use this method in tight loops.
◆ elementAt()
Similar method with bounds checking
◆ fill() [1/2]
◆ fill() [2/2]
template<typename T >
virtual void npstat::AbsNtuple< T >::fill |
( |
const T * |
values, |
|
|
unsigned long |
lenValues |
|
) |
| |
|
pure virtual |
◆ isEqual()
◆ length()
Retrieve the total number of ntuple elements
◆ nColumns()
Retrieve the number of columns
◆ nRows()
◆ operator!=()
Logical negation of operator==
◆ operator()()
template<typename T >
virtual T npstat::AbsNtuple< T >::operator() |
( |
unsigned long |
r, |
|
|
unsigned long |
c |
|
) |
| const |
|
pure virtual |
Access individual elements (no bounds checking). Note that access is by value, so it involves a fair amount of copying. The other alternative, return by reference, could lead to subtle bugs with references invalidated by fill operations and buffer swapping.
Implemented in npstat::ArchivedNtuple< T >, and npstat::InMemoryNtuple< T >.
◆ operator==()
Comparison for equality. Do not override in derived classes (override "isEqual" method instead)
◆ row_begin()
Methods which return begin/end positions for the row/column iterators
◆ rowContents()
template<typename T >
virtual void npstat::AbsNtuple< T >::rowContents |
( |
unsigned long |
row, |
|
|
T * |
buf, |
|
|
unsigned long |
lenBuf |
|
) |
| const |
|
pure virtual |
◆ setColumnName()
template<typename T >
virtual bool npstat::AbsNtuple< T >::setColumnName |
( |
unsigned long |
i, |
|
|
const char * |
newname |
|
) |
| |
|
virtual |
The code will refuse to set the column name (and false will be returned in this case) if the provided name duplicates an existing column name. False will also be returned if the column index is out of range. Derived classes can also refuse to change the column name if their implementation relies in some way on the permanence of these names.
◆ setTitle()
◆ title()
Retrieve the ntuple title
◆ validColumn()
This method works just like columnNumber but generates a dynamic fault in case the given column name is invalid
◆ weightedConditionalCycleOverRows()
template<typename T >
template<class Filter , class Accumulator , class WeightCalc >
double npstat::AbsNtuple< T >::weightedConditionalCycleOverRows |
( |
const Filter & |
f, |
|
|
Accumulator & |
acc, |
|
|
const WeightCalc & |
wcalc, |
|
|
bool |
skipZeroWeights = false |
|
) |
| const |
This method returns the sum of weights for rows that pass the filter and call the accumulator as appropriate
◆ weightedConditionalRowCount()
template<typename T >
template<class Filter , class WeightCalc >
double npstat::AbsNtuple< T >::weightedConditionalRowCount |
( |
const Filter & |
f, |
|
|
const WeightCalc & |
wcalc |
|
) |
| const |
This method just returns the sum of weights for rows that pass the filter
◆ weightedCycleOverRows()
template<typename T >
template<class Accumulator , class WeightCalc >
void npstat::AbsNtuple< T >::weightedCycleOverRows |
( |
Accumulator & |
acc, |
|
|
const WeightCalc & |
wcalc, |
|
|
bool |
skipZeroWeights = false |
|
) |
| const |
Another row cycling function which employs a functor that calculates a weight. The weight functor must implement
double operator()(unsigned long rowNumber, const T* rowContents, unsigned long nCols) const
The returned weights must be non-negative. The accumulator must implement
void accumulate(T* rowContents, unsigned long nColumns, double w)
The option "skipZeroWeights" allows the user not to call the accumulator if the calculated weight is 0.
The documentation for this class was generated from the following file:
|