#include <RTuple.h>
Inheritance diagram for RTuple:
Definition at line 28 of file RTuple.h.
Public Types | |
typedef void(hippodraw::Observer::* | Action )(const Observable *) |
The member function of the Observer that is called. | |
typedef std::list< hippodraw::Observer * > | ObserverList_t |
The type of STL container to maintain list of Observer objects. | |
Public Member Functions | |
void | addObserver (hippodraw::Observer *) |
Adds an Observer to the Observer list. | |
virtual void | addRow (const std::vector< double > &v) |
Adds a row to the end of the ntuple. | |
virtual void | clear () |
Clears the RTuple. | |
unsigned int | columns () const |
Returns the number of columns or data arrays available from this DataSource. | |
virtual void | copy (const DataSource &other) |
virtual bool | empty () const |
Returns true , if RTuple is empty, i.e. | |
virtual bool | fillRange (unsigned int column, Range &) const |
Fills the Range object from data indexed by column. | |
virtual const std::vector< double > & | getColumn (unsigned int column) const |
Returns the data in the column with index column. | |
virtual const std::vector< double > & | getColumn (const std::string &name) const |
Returns the data in the column with label name. | |
virtual const std::string & | getLabelAt (unsigned int index) const |
Returns the label for the column at index index. | |
virtual const std::vector< std::string > & | getLabels () const |
Returns the list of available labels. | |
const std::string & | getName () const |
Returns the name of the ntuple. | |
const ObserverList_t & | getObservers () const |
Returns the list of observers. | |
unsigned int | getRank () const |
Returns the rank of the data source. | |
virtual const std::vector< double > & | getRow (unsigned int) const =0 |
Returns a const reference to slice along the axis known as a row. | |
virtual const std::vector< double > & | getRow (unsigned int index) const |
Returns a vector of data elements in one row. | |
const std::vector< unsigned int > & | getShape () const |
Returns the shape of the data elements. | |
virtual int | indexOf (const std::string &label) const |
Returns the index of the column whose label is label. | |
virtual unsigned int | indexOfMaxElement (unsigned int index) const |
Returns row index of the maximum element in a column for the given column. | |
virtual unsigned int | indexOfMinElement (unsigned int index) const |
Returns row index of the minimum element in a column for the given column. | |
virtual bool | isMultiDimensional (const std::string &column) const |
Answers if rows of column are composed of the multidimensional data. | |
bool | isNull () const |
Returns true if the receiving objects is a null object. | |
bool | isValidLabel (const std::string &label) const |
Returns true if label is a valid label for a column in the DataSource. | |
virtual void | notifyObservers () const |
Notifies Observer objects of a change. | |
virtual double | operator[] (std::vector< unsigned int > &indices) const |
void | removeObserver (hippodraw::Observer *) |
Removes an Observer from the Observer list. | |
virtual void | reserve (unsigned int count) |
For each column, reserves enough space for the NTuple to grow to count rows. | |
virtual unsigned int | rows () const |
Returns the number of rows. | |
RTuple (unsigned int n) | |
A constructor that creates an ntuple with n columns. | |
RTuple (const std::vector< std::string > &labels) | |
Constructor taking a vector of column labels as argument. | |
virtual bool | setLabelAt (const std::string &s, unsigned int index) |
Changes the label of a data column to s. | |
virtual void | setLabels (const std::vector< std::string > &v) |
Assigns the label to each column from the vector of strings @ v. | |
void | setName (const std::string &name) |
Sets the name of the ntuple. | |
virtual bool | setReleventIndex (const std::string &column, const std::vector< unsigned int > &index) |
In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data. | |
virtual void | setShape (std::vector< unsigned int > &shape) |
Sets the shape of the data elements. | |
void | setTitle (const std::string &title) |
Sets the title of the ntuple to title. | |
virtual double | sum (unsigned int column) const |
Returns the sum of all the elements in the sequence of column column. | |
virtual void | throwIfInvalidLabel (const std::string &label) const |
Throws a DataSourceException object if label is not a valid label for this DataSource. | |
void | throwIfInvalidRowSize (const std::vector< double > &row) |
Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing. | |
const std::string & | title () const |
Returns a const reference to the title of the ntuple. | |
virtual double | valueAt (unsigned int row, unsigned int column) const |
Returns the value in the table in position given by the row and column indexes. | |
virtual | ~RTuple () |
The destructor. | |
Protected Member Functions | |
virtual void | addLabel (const std::string &label) |
Adds a new label for a column. | |
virtual void | copyPrivate (const DataSource &other) |
Copies the contents of the other DataSource. | |
bool | isValidColumn (unsigned int index) const |
Returns true if index is valid, otherwise throws a DataSourceException. | |
void | notifyObservers (Action action) const |
An internal method to iterate over all observers and to send the message action. | |
Protected Attributes | |
std::vector< double > | m_array |
A temporary array that can be returned by const reference. | |
std::vector< unsigned int > | m_shape |
The shape of the data. | |
Private Member Functions | |
RTuple (const RTuple &nt) | |
The copy constructor creates an ntuple that is a copy of an existing one. | |
Private Attributes | |
std::vector< std::vector< double > * > | m_data |
The data rows of the ntuple table. |
|
The member function of the Observer that is called.
Definition at line 83 of file Observable.h. |
|
The type of STL container to maintain list of Observer objects.
Definition at line 46 of file Observable.h. |
|
The copy constructor creates an ntuple that is a copy of an existing one.
Definition at line 51 of file RTuple.cxx. |
|
Constructor taking a vector of column labels as argument.
Definition at line 41 of file RTuple.cxx. References m_data, and num_util::size(). |
|
A constructor that creates an ntuple with n columns. Creates an RTuple with n columns. The objects will be empty, i.e. 0 rows. Definition at line 57 of file RTuple.cxx. References DataSource::setLabels(). |
|
The destructor.
Definition at line 68 of file RTuple.cxx. References m_data, Observable::notifyObservers(), and hippodraw::Observer::willDelete(). |
|
Adds a new label for a column.
Definition at line 150 of file DataSource.cxx. References DataSource::m_labels. Referenced by NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), RootNTuple::addColumn(), and FitsNTuple::addColumn(). |
|
Adds an Observer to the Observer list.
Definition at line 49 of file Observable.cxx. References Observable::m_list. Referenced by CutPlotter::addCutTarget(), XyPlotter::addDataRep(), FunctionRep::FunctionRep(), BinningProjector::normalizeTo(), DataRepController::setAxisBindings(), DisplayController::setNTuple(), CutPlotter::setNTuple(), and TextPlotter::setParentDataRep(). |
|
Adds a row to the end of the ntuple. If the size of the input vector is the same as the width of the ntuple, adds the row to the end of the ntuple. It also notifies its Observer objects and returns true. Otherwise, throws a DataSourceException object. Implements DataSource. Definition at line 129 of file RTuple.cxx. References m_data, Observable::notifyObservers(), and DataSource::throwIfInvalidRowSize(). |
|
Clears the RTuple. Clears all the data elements of the RTuple. Does not change the other attributes or capacity. Implements DataSource. Definition at line 103 of file RTuple.cxx. References m_data. Referenced by copy(). |
|
|
Definition at line 79 of file RTuple.cxx. References clear(), DataSource::copyPrivate(), DataSource::getRow(), m_data, DataSource::rows(), and num_util::size(). |
|
Copies the contents of the other DataSource. For use by derived classes only. Definition at line 110 of file DataSource.cxx. References DataSource::m_ds_name, DataSource::m_is_null, DataSource::m_labels, DataSource::m_shape, and DataSource::m_title. Referenced by copy(), and NTuple::copy(). |
|
Returns has no rows. Implements DataSource. Definition at line 115 of file RTuple.cxx. References m_data. |
|
Fills the Range object from data indexed by column.
Returns Reimplemented in NTuple, and FitsNTuple. Definition at line 323 of file DataSource.cxx. References DataSource::columns(), std::max(), std::min(), DataSource::rows(), Range::setRange(), num_util::size(), and DataSource::valueAt(). |
|
Returns the data in the column with index column.
Reimplemented in NTuple, RootNTuple, QtRootNTuple, and RootNTuple. Definition at line 221 of file DataSource.cxx. References DataSource::isValidColumn(), DataSource::m_array, DataSource::rows(), num_util::size(), and DataSource::valueAt(). |
|
Returns the data in the column with label name.
Reimplemented in NTuple, RootNTuple, QtRootNTuple, and RootNTuple. Definition at line 236 of file DataSource.cxx. References DataSource::indexOf(). Referenced by PyDataSource::columnAsNumArray(), NTupleXML::createChildren2D(), hippodraw::Python::export_DataSource(), and PyDataSource::getColumn(). |
|
Returns the label for the column at index index. Returns the label for the column at index index, or throws a DataSourceException if index is out of range. Definition at line 175 of file DataSource.cxx. References DataSource::isNull(), DataSource::m_labels, and DataSource::title(). Referenced by NTupleXML::createChildren2D(), hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NTuple(), hippodraw::Python::export_NumArrayTuple(), NTupleProjector::getAxisBindings(), NTupleProjector::getXLabel(), NTupleProjector::getYLabel(), Map1Projector::getYLabel(), Profile2DProjector::getZLabel(), MapMatrixProjector::getZLabel(), and Map3Projector::getZLabel(). |
|
Returns the list of available labels.
Reimplemented in QtRootNTuple. Definition at line 168 of file DataSource.cxx. References DataSource::m_labels. Referenced by Inspector::availPlotTypesActivated(), hippodraw::Python::export_DataSource(), DisplayController::getDataSourceLabels(), QtRootNTuple::getLabels(), PyDataSource::getLabels(), NTupleProjector::getNTupleAfterCuts(), PyDataSource::replaceColumn(), RootNTuple::smartExpandRootNTuple(), Inspector::updateCutVarGroupBox(), and NTupleController::writeNTupleToFile(). |
|
Returns the name of the ntuple.
Definition at line 132 of file DataSource.cxx. References DataSource::m_ds_name. Referenced by HiNTupleXML::createElement(), NTupleProjector::getNTupleName(), DataSourceController::registerNTuple(), NTupleController::saveNTuples(), and NTupleXML::setAttributes(). |
|
Returns the list of observers.
Definition at line 57 of file Observable.cxx. References Observable::m_list. |
|
Returns the rank of the data source. Returns the number of axes of the data source, i.e the rank. Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple. Definition at line 316 of file DataSource.cxx. References DataSource::m_shape. Referenced by operator[](), and NTuple::operator[](). |
|
Returns a const reference to slice along the axis known as a row.
Referenced by copy(), NTuple::copy(), and NTupleController::writeNTupleToFile(). |
|
Returns a vector of data elements in one row. Returns a vector with data elements copied from the RTuple row indexed by index. If index is out of range, throws a DataSourceException object. Definition at line 139 of file RTuple.cxx. References m_data. |
|
Returns the shape of the data elements.
Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple. Definition at line 310 of file DataSource.cxx. References DataSource::m_shape. |
|
Returns the index of the column whose label is label. Returns the index of the data column whose label is label, or -1 if label does not exist. Definition at line 189 of file DataSource.cxx. References std::find(), and DataSource::m_labels. Referenced by NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), RootNTuple::addColumn(), FitsNTuple::addColumn(), NTuple::getColumn(), RootNTuple::getColumn(), DataSource::getColumn(), NumArrayTuple::getNumArray(), RootNTuple::getTBranch(), NTupleProjector::indexOf(), RootNTuple::isMultiDimensional(), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), RootNTuple::replaceColumn(), FitsNTuple::replaceColumn(), RootNTuple::rowDataDimSize(), NTupleProjector::setAxisBinding(), RootNTuple::setReleventIndex(), RootNTuple::smartExpandRootNTuple(), and QtRootNTuple::valueAt(). |
|
Returns row index of the maximum element in a column for the given column.
Reimplemented in NTuple. Definition at line 377 of file DataSource.cxx. References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt(). |
|
Returns row index of the minimum element in a column for the given column.
Reimplemented in NTuple. Definition at line 398 of file DataSource.cxx. References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt(). |
|
Answers if rows of column are composed of the multidimensional data.
Reimplemented in RootNTuple, QtRootNTuple, and RootNTuple. Definition at line 359 of file DataSource.cxx. |
|
Returns
Definition at line 121 of file DataSource.cxx. References DataSource::m_is_null. Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DataSource::getLabelAt(), NTupleProjector::NTupleProjector(), NTupleProjector::setNTuple(), and NTupleProjector::~NTupleProjector(). |
|
Returns
Definition at line 208 of file DataSource.cxx. References DataSource::columns(), and num_util::size(). Referenced by NTuple::getColumn(), and DataSource::getColumn(). |
|
Returns
The search is case sensitive. If the label is not found, returns Definition at line 250 of file DataSource.cxx. References std::find(), and DataSource::m_labels. Referenced by DataSource::throwIfInvalidLabel(). |
|
An internal method to iterate over all observers and to send the message action.
Definition at line 69 of file Observable.cxx. References std::bind2nd(), std::for_each(), Observable::m_list, and std::mem_fun(). |
|
|
Implements DataSource. Definition at line 151 of file RTuple.cxx. References DataSource::columns(), DataSource::getRank(), m_data, DataSource::m_shape, num_util::rank(), and num_util::size(). |
|
Removes an Observer from the Observer list.
Definition at line 63 of file Observable.cxx. References Observable::m_list. Referenced by BinningProjector::normalizeTo(), CutPlotter::removeFromTarget(), DisplayController::removeTextObservers(), NTupleProjector::setNTuple(), FunctionRep::willDelete(), FunctionRep::~FunctionRep(), and NTupleProjector::~NTupleProjector(). |
|
For each column, reserves enough space for the NTuple to grow to count rows.
Implements DataSource. Definition at line 198 of file RTuple.cxx. References m_data. |
|
Returns the number of rows.
Implements DataSource. Definition at line 122 of file RTuple.cxx. References m_data. |
|
Changes the label of a data column to s.
Definition at line 157 of file DataSource.cxx. References DataSource::m_labels, and Observable::notifyObservers(). |
|
Assigns the label to each column from the vector of strings @ v.
Reimplemented in NTuple. Definition at line 289 of file DataSource.cxx. References DataSource::m_labels, and Observable::notifyObservers(). Referenced by hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NumArrayTuple(), RTuple(), and NTuple::setLabels(). |
|
Sets the name of the ntuple.
Definition at line 126 of file DataSource.cxx. References DataSource::m_ds_name, and Observable::notifyObservers(). Referenced by NTupleController::createNTuple(), hippodraw::Python::export_DataSource(), PyDataSource::registerNTuple(), DataSourceController::registerNTuple(), and PyDataSource::setName(). |
|
In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data. So here we set index of this relevant entry. Reimplemented in RootNTuple, and RootNTuple. Definition at line 366 of file DataSource.cxx. |
|
Sets the shape of the data elements. Sets the shape data elements from the vector shape. The rank is given by the size of the vector. A rank of 2 correspond to table. If the total number of elements in the DataSource is not equal to the product of the shape, then an assertion is raised. Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple. Definition at line 298 of file DataSource.cxx. References DataSource::m_shape, and num_util::size(). |
|
Sets the title of the ntuple to title.
Definition at line 142 of file DataSource.cxx. References DataSource::m_title, and Observable::notifyObservers(). Referenced by hippodraw::Python::export_DataSource(), NTupleController::readAsciiNTuple(), and PyDataSource::setTitle(). |
|
Returns the sum of all the elements in the sequence of column column.
Reimplemented in NTuple. Definition at line 419 of file DataSource.cxx. References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt(). |
|
Throws a DataSourceException object if label is not a valid label for this DataSource. The exception object contains a message that the label is invalid. Derived classes may over-ride this method with more information on why the label is invalid. Definition at line 264 of file DataSource.cxx. References DataSource::isValidLabel(). Referenced by NTuple::getColumn(), RootNTuple::getColumn(), and QtRootNTuple::valueAt(). |
|
Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing.
Definition at line 277 of file DataSource.cxx. References DataSource::columns(), and num_util::size(). Referenced by addRow(), NTuple::addRow(), and NTuple::replaceRow(). |
|
Returns a const reference to the title of the ntuple.
Definition at line 137 of file DataSource.cxx. References DataSource::m_title. Referenced by hippodraw::Python::export_DataSource(), DataSource::getLabelAt(), PyDataSource::getTitle(), NTupleProjector::getTitle(), and NTupleController::writeNTupleToFile(). |
|
Returns the value in the table in position given by the row and column indexes.
Implements DataSource. Definition at line 191 of file RTuple.cxx. References m_data. |
|
A temporary array that can be returned by const reference.
Definition at line 81 of file DataSource.h. Referenced by DataSource::getColumn(), RootNTuple::getRow(), and FitsNTuple::getRow(). |
|
The data rows of the ntuple table. Note that the pointer to the rowss is used so that when rows are added, the row data doesn't need to be relocated. Definition at line 37 of file RTuple.h. Referenced by addRow(), clear(), copy(), empty(), getRow(), operator[](), reserve(), rows(), RTuple(), valueAt(), and ~RTuple(). |
|
The shape of the data. The elements the DataSource can have an arbitrary number of dimensions, called rank. An ordinary table has rank of 2 and the shape is number of columns and number of rows. That is m_shape[0] is number of columns and m_share[1] is number of rows. Definition at line 89 of file DataSource.h. Referenced by DataSource::copyPrivate(), NumArrayTuple::getRank(), ListTuple::getRank(), RootNTuple::getRank(), FitsNTuple::getRank(), DataSource::getRank(), NumArrayTuple::getShape(), ListTuple::getShape(), RootNTuple::getShape(), FitsNTuple::getShape(), DataSource::getShape(), operator[](), NTuple::operator[](), NumArrayTuple::setShape(), ListTuple::setShape(), RootNTuple::setShape(), FitsNTuple::setShape(), and DataSource::setShape(). |