npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

#include <ArchivedNtuple.hh>

Inheritance diagram for npstat::ArchivedNtuple< T >:
npstat::AbsNtuple< T >

Public Types

typedef T value_type
 
- Public Types inherited from npstat::AbsNtuple< T >
typedef T value_type
 

Public Member Functions

 ArchivedNtuple (const std::vector< std::string > &columnNames, const char *title, gs::AbsArchive &archive, const char *name, const char *category, unsigned long rowsPerBuffer, bool writeColumnWise=false)
 
gs::AbsArchive & archive () const
 
const std::string & name () const
 
const std::string & category () const
 
unsigned long rowsPerBuffer () const
 
bool writesByColumn () const
 
bool isReadable () const
 
bool isWritable () const
 
unsigned long objectNumber () const
 
void fill (const T *values, unsigned long lenValues)
 
void fill (const T &v0)
 
void fill (const T &v0, const T &v1)
 
void fill (const T &v0, const T &v1, const T &v2)
 
void fill (const T &v0, const T &v1, const T &v2, const T &v3)
 
void fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4)
 
void fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5)
 
void fill (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6)
 
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)
 
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)
 
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)
 
unsigned long nRows () const
 
operator() (const unsigned long row, const unsigned long column) const
 
at (const unsigned long row, const unsigned long column) const
 
void rowContents (const unsigned long row, T *buffer, unsigned long lenBuffer) const
 
void columnContents (const Column &c, T *buffer, unsigned long lenBuffer) const
 
virtual void clear ()
 
virtual bool write ()
 
virtual gs::ClassId classId () const
 
- Public Member Functions inherited from npstat::AbsNtuple< T >
 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
 
unsigned long length () const
 
template<typename T2 >
void append (const AbsNtuple< T2 > &another)
 
element (unsigned long r, const Column &c) const
 
elementAt (unsigned long r, const Column &c) const
 
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
 
bool operator== (const AbsNtuple &r) const
 
bool operator!= (const AbsNtuple &r) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 

Protected Member Functions

virtual bool isEqual (const AbsNtuple< T > &r) const
 

Friends

class Private::NtupleHeaderRecord< MyNtuple >
 
class Private::NtupleBufferRecord< MyNtuple >
 
class Private::NtupleFooterRecord< MyNtuple >
 
class Private::NtupleBufferReference< MyNtuple >
 
class Private::NtupleColumnReference< MyNtuple >
 
class NtupleReference< MyNtuple >
 

Detailed Description

template<typename T>
class npstat::ArchivedNtuple< T >

Ntuple which does not have to fit in memory, all rows at the same time. It can grow very large – the size is limited only by the capacity of the underlying archive which usually means by the size of available disk space.

Constructor & Destructor Documentation

◆ ArchivedNtuple()

template<typename T >
npstat::ArchivedNtuple< T >::ArchivedNtuple ( const std::vector< std::string > &  columnNames,
const char *  title,
gs::AbsArchive &  archive,
const char *  name,
const char *  category,
unsigned long  rowsPerBuffer,
bool  writeColumnWise = false 
)

Constructor arguments are as follows:

columnNames – naturally, the names of the ntuple columns

title – some title for the ntuple (arbitrary string)

archive – Archive in which the ntuple data will be stored. This archive must exist while the ntuple is in use.

name – ntuple name label in the archive

category – ntuple category labels in the archive

rowsPerBuffer – Number of rows to keep in memory simultaneously. This number essentially defines how large are going to be the chunks of data which are written to the archive or read back every single time the underlying code talks to the archive. The optimal buffer size will depend on the data access pattern. For example, if rows will be accessed in random order, it makes little sense to have large buffers. On the other hand, a large buffer will minimize the number of times we have to go to the archive in case the rows are accessed sequentially.

writeColumnWise – If this argument is "true", the data in the buffers will be written column after column. This mode is useful (results in faster data access) in case the ntuple data will be used predominatly via the "columnContents" method.

Member Function Documentation

◆ archive()

template<typename T >
gs::AbsArchive& npstat::ArchivedNtuple< T >::archive ( ) const
inline

Basic inspector of ntuple properties

◆ at()

template<typename T >
T npstat::ArchivedNtuple< T >::at ( const unsigned long  row,
const unsigned long  column 
) const
inlinevirtual

Access individual elements with bounds checking

Implements npstat::AbsNtuple< T >.

◆ classId()

template<typename T >
virtual gs::ClassId npstat::ArchivedNtuple< T >::classId ( ) const
inlinevirtual

Prototype needed for I/O

Implements npstat::AbsNtuple< T >.

◆ clear()

template<typename T >
virtual void npstat::ArchivedNtuple< T >::clear ( )
inlinevirtual

Can't really clear the data, it is in the archive already. So this is just a NOOP.

Implements npstat::AbsNtuple< T >.

◆ columnContents()

template<typename T >
void npstat::ArchivedNtuple< T >::columnContents ( const Column c,
T *  buffer,
unsigned long  lenBuffer 
) const
virtual

Access one column at a time. The provided buffer should be sufficiently large to contain the complete column.

Implements npstat::AbsNtuple< T >.

◆ fill() [1/2]

template<typename T >
void npstat::ArchivedNtuple< T >::fill ( const T &  v0)
virtual

Convenience method which works if the number of arguments equals the number if colums (otherwise an exception will be thrown)

Implements npstat::AbsNtuple< T >.

◆ fill() [2/2]

template<typename T >
void npstat::ArchivedNtuple< T >::fill ( const T *  values,
unsigned long  lenValues 
)
virtual

Add data to the ntuple. Will throw std::runtime_error in case the underlying archive is not writable. lenValues must be divisible by the number of columns.

Implements npstat::AbsNtuple< T >.

◆ isEqual()

template<typename T >
virtual bool npstat::ArchivedNtuple< T >::isEqual ( const AbsNtuple< T > &  r) const
protectedvirtual

Comparison for equality to be overriden by the derived classes. Don't forget to call "isEqual" method of the base class.

Reimplemented from npstat::AbsNtuple< T >.

◆ nRows()

template<typename T >
unsigned long npstat::ArchivedNtuple< T >::nRows ( ) const
inlinevirtual

Number of rows. If the ntuple is always filled one row at a time, this is also the number of fills.

Implements npstat::AbsNtuple< T >.

◆ objectNumber()

template<typename T >
unsigned long npstat::ArchivedNtuple< T >::objectNumber ( ) const
inline

Each object of this type created in one particular program run will have its own unique number. This number in not persistent.

◆ operator()()

template<typename T >
T npstat::ArchivedNtuple< T >::operator() ( const unsigned long  row,
const unsigned long  column 
) const
inlinevirtual

Access individual elements without bounds checking

Implements npstat::AbsNtuple< T >.

◆ rowContents()

template<typename T >
void npstat::ArchivedNtuple< T >::rowContents ( const unsigned long  row,
T *  buffer,
unsigned long  lenBuffer 
) const
virtual

Access one row at a time. The provided buffer should be sufficiently large to contain the complete row.

Implements npstat::AbsNtuple< T >.

◆ write()

template<typename T >
virtual bool npstat::ArchivedNtuple< T >::write ( )
virtual

Method needed for "geners" I/O


The documentation for this class was generated from the following file: