#include <RootNTuple.h>
Inheritance diagram for RootNTuple:
Definition at line 37 of file RootNTuple.h.
Public Types | |
typedef void(Observer::*) | Action (const Observable *) |
The member function of the Observer that is called. | |
typedef std::list< Observer * > | ObserverList_t |
The type of STL container to maintain list of Observer objects. | |
Public Member Functions | |
virtual int | addColumn (const std::string &label, const std::vector< double > &data, const std::vector< intptr_t > &shape) |
Adds column vector. | |
int | addColumn (const std::string &label, const std::vector< double > &column) |
Adds a column to the end of the RootNTuple. | |
void | addObserver (Observer *) |
Adds an Observer to the Observer list. | |
virtual void | addRow (const std::vector< double > &row) |
Adds a row to the data source. | |
virtual void | append (const DataSource *source) |
Appends the contents of the DataSource source. | |
virtual void | clear () |
Removes all the cached data vectors, does not change the contained ROOT file. | |
unsigned int | columns () const |
Returns the number of columns or data arrays available from this DataSource. | |
std::string | createBinding (const std::string &name, const std::vector< int > &indices) const |
Creates complete binding string from the array variable name and indexes. | |
virtual double * | doubleArrayAt (unsigned int row, unsigned int column) const |
Returns pointer to a double array type in given row. | |
virtual bool | empty () const |
Returns true , if RootNTuple is empty, i.e. | |
virtual void | eraseRow (unsigned int index) |
Erase a row from the data source. | |
void | expandIfNeeded (const std::vector< std::string > &labels) const |
Expand the labels if needed. | |
virtual bool | fillRange (unsigned int column, Range &) const |
Fills the Range object from data indexed by column. | |
virtual void | fillShape (std::vector< int > &v, const std::string &label) const |
Fills the vector with the shape of a column. | |
virtual void | fillShape (std::vector< int > &v, unsigned int column) const |
Fills the vector with the shape of a column. | |
virtual float * | floatArrayAt (unsigned int row, unsigned int column) const |
Returns pointer to a float array type in given row. | |
virtual const std::vector< double > & | getColumn (unsigned int index) const |
Returns the data in the column with index column. | |
virtual const std::vector< double > & | getColumn (const std::string &name, const std::vector< int > &indices) const |
Returns the column with label name. | |
virtual const std::vector< double > & | getColumn (const std::string &name) const |
Returns the data in the column with label name. | |
const std::vector< std::string > & | getDuplicatedLabels () const |
Returns the column labels that were duplicated, or an empty vector. | |
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 data source. | |
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 i) const |
Returns a const reference to slice along the axis known as a row. | |
const std::vector< unsigned int > & | getShape () const |
Returns the shape of the data elements. | |
hippodraw::RootData::Type | getType (unsigned int column) const |
Returns the type of data in column. | |
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 int * | intArrayAt (unsigned int row, unsigned int column) const |
Returns pointer to a int array type in given row. | |
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. | |
virtual bool | isUseable (const std::string &label) const |
Returns true if the column is usable in the context of a DataSource. | |
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 observers. | |
virtual double | operator[] (std::vector< unsigned int > &indices) const |
Raises an assertion, as a RootNTuple does not really have shape. | |
void | removeObserver (Observer *) |
Removes an Observer from the Observer list. | |
virtual void | replaceColumn (const std::string &label, const std::vector< double > &data, const std::vector< intptr_t > &shape) |
Replaces or adds column vector. | |
virtual void | replaceColumn (const std::string &label, const std::vector< double > &array) |
Replaces data in column label with contents of array. | |
void | replaceColumn (unsigned int index, const std::vector< double > &data) |
Replaces the data in column index. | |
virtual void | reserve (unsigned int) |
Does nothing as the contained ROOT file controls the size. | |
RootNTuple (TTree *tree) | |
A constructor taking TTree from ROOT file as argument. | |
virtual unsigned int | rows () const |
Returns the size of first dimension, i.e. | |
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 data source. | |
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. | |
virtual void | setTitle (const std::string &title) |
Sets the title of the data source to title. | |
void | smartExpandRootNTuple (const std::string &column) const |
Suppose we encounter a RootNTuple which has multi-dimensional data sitting in the rows of the concerned column. | |
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 data source. | |
virtual unsigned int * | uintArrayAt (unsigned int row, unsigned int column) const |
Returns pointer to a unsigned int array type in given row and column. | |
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 double | valueAtNoCache (unsigned int row, unsigned int column) const |
Returns the value in the table in position given by the row and column indexes without storing it into cache. | |
virtual | ~RootNTuple () |
The destructor. | |
Protected Member Functions | |
virtual void | addLabel (const std::string &label) |
Adds a new label for a column. | |
virtual void | checkWidth (const DataSource *source) |
Checks the number of columns. | |
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. | |
RootNTuple (const RootNTuple &) | |
The copy constructor. | |
RootNTuple () | |
The default constructor. | |
Protected Attributes | |
std::vector< double > | m_array |
A temporary array that can be returned by const reference. | |
std::vector< std::string > | m_dups |
A list of labels that duplicated others in a DataSource file. | |
std::vector< unsigned int > | m_shape |
The shape of the data. | |
Private Types | |
typedef std::vector< RootBranch * > | BranchList_t |
The type of container holding pointers to the ROOT branches. | |
typedef std::vector< std::vector< double > * > | CacheList_t |
The type of container holding pointers to the cached data vectors. | |
Private Member Functions | |
int | addColumn (const std::string &label, RootBranch *) |
Adds a column to the end of the RootNTuple. | |
void | expandIfNeeded (const std::string &label) const |
void | fillDataCache (unsigned int column) |
Fills the data cache for column column. | |
TBranch * | getTBranch (const std::string &column) |
Get the TBranch associated with this column. | |
void | initBranches () |
Initializes the columns of the NTuple. | |
bool | rotateWheels (std::vector< int > &wheels, const std::vector< int > &sz, unsigned int d) |
A hack to generate labels. | |
Private Attributes | |
unsigned int | m_cur_entry |
Index into the current position in the branches. | |
BranchList_t | m_data |
The RootBranch objects that contains the data. | |
CacheList_t | m_data_cache |
A cache of data already read. | |
std::vector< bool > | m_multiDimensional |
Answers if rows of column are composed of the multidimensional data. | |
TTree * | m_tree |
The ROOT TTree object which is the source of the data. |
typedef void( Observer::*) Action(const Observable *) [inherited] |
typedef std::vector< RootBranch * > BranchList_t [private] |
The type of container holding pointers to the ROOT branches.
Definition at line 44 of file RootNTuple.h.
typedef std::vector< std::vector < double > * > CacheList_t [private] |
The type of container holding pointers to the cached data vectors.
Definition at line 52 of file RootNTuple.h.
typedef std::list< Observer * > ObserverList_t [inherited] |
The type of STL container to maintain list of Observer objects.
Definition at line 45 of file Observable.h.
RootNTuple | ( | ) | [protected] |
The default constructor.
Definition at line 56 of file RootNTuple.cxx.
RootNTuple | ( | const RootNTuple & | ) | [protected] |
The copy constructor.
RootNTuple | ( | TTree * | tree | ) |
A constructor taking TTree from ROOT file as argument.
Definition at line 47 of file RootNTuple.cxx.
References RootNTuple::initBranches().
~RootNTuple | ( | ) | [virtual] |
The destructor.
Definition at line 63 of file RootNTuple.cxx.
References RootNTuple::m_data, RootNTuple::m_data_cache, Observable::notifyObservers(), and Observer::willDelete().
int addColumn | ( | const std::string & | label, | |
const std::vector< double > & | data, | |||
const std::vector< intptr_t > & | shape | |||
) | [virtual, inherited] |
Adds column vector.
Adds a new column with label and returns its index. The number of rows, as defined by first element of the shape, must be the same as existing columns, if any. Not all derived classes support the notion of shape, therefore as convenience to developers, the implementation in this base class throws a std::runtime_error object.
Reimplemented in FitsNTuple.
Definition at line 400 of file DataSource.cxx.
int addColumn | ( | const std::string & | label, | |
const std::vector< double > & | column | |||
) | [virtual] |
Adds a column to the end of the RootNTuple.
If the size of the input array is the same as the size of the existing columns adds input array to then end of the RootNTuple . Gives the column the label label. Returns the index of the newly created column. If the size of the input array differs from the size of existing columns or if the label already exists, then throws a DataSourceException object.
Reimplemented from DataSource.
Reimplemented in QtRootNTuple.
Definition at line 348 of file RootNTuple.cxx.
References DataSource::addLabel(), DataSource::indexOf(), RootNTuple::m_data, RootNTuple::m_data_cache, RootNTuple::m_multiDimensional, and RootNTuple::rows().
int addColumn | ( | const std::string & | label, | |
RootBranch * | ||||
) | [private] |
Adds a column to the end of the RootNTuple.
If the size of the input array is the same as the size of the existing columns adds input array to then end of the RootNTuple . Gives the column the label label. Returns the index of the newly created column. If the size of the input array differs from the size of existing columns or if the label already exists, then throws a std::runtime_error object.
Definition at line 327 of file RootNTuple.cxx.
References DataSource::addLabel(), DataSource::indexOf(), RootNTuple::m_data, and RootNTuple::m_data_cache.
Referenced by QtRootNTuple::addColumn(), RootNTuple::initBranches(), and RootNTuple::smartExpandRootNTuple().
void addLabel | ( | const std::string & | label | ) | [protected, virtual, inherited] |
Adds a new label for a column.
Definition at line 154 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by RootNTuple::addColumn(), NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), and FitsNTuple::addColumn().
void addObserver | ( | Observer * | ) | [inherited] |
Adds an Observer to the Observer list.
Definition at line 52 of file Observable.cxx.
References Observable::m_list.
Referenced by XyPlotter::addDataRep(), FunctionRep::FunctionRep(), BinningProjector::normalizeTo(), DataRepController::setAxisBindings(), DisplayController::setNTuple(), CutPlotter::setNTuple(), and TextPlotter::setParentDataRep().
void addRow | ( | const std::vector< double > & | row | ) | [virtual, inherited] |
Adds a row to the data source.
Since most derived classes are not capable of adding a row, the implementation of this member functions throws std::runtime_error.
Reimplemented in CircularBuffer, NTuple, RTuple, and PyNTuple.
Definition at line 548 of file DataSource.cxx.
Referenced by DataSource::append().
void append | ( | const DataSource * | source | ) | [virtual, inherited] |
Appends the contents of the DataSource source.
Appends the contents of the DataSource source to end by adding rows.
Reimplemented in NTuple, and PyNTuple.
Definition at line 580 of file DataSource.cxx.
References DataSource::addRow(), DataSource::checkWidth(), DataSource::getRow(), DataSource::rows(), and num_util::size().
Referenced by NTuple::append().
void checkWidth | ( | const DataSource * | source | ) | [protected, virtual, inherited] |
Checks the number of columns.
Check that the number of columns of source is the same as the receiving object. Throws a std::runtime_error if they are different, otherwise does nothing.
Definition at line 565 of file DataSource.cxx.
References DataSource::columns(), and hippodraw::String::convert().
Referenced by NTuple::append(), and DataSource::append().
void clear | ( | ) | [virtual] |
Removes all the cached data vectors, does not change the contained ROOT file.
Implements DataSource.
Definition at line 266 of file RootNTuple.cxx.
References RootNTuple::m_data_cache.
unsigned int columns | ( | ) | const [inline, inherited] |
Returns the number of columns or data arrays available from this DataSource.
Reimplemented in QtRootNTuple.
Definition at line 458 of file DataSource.h.
References DataSource::m_labels.
Referenced by PyDataSource::addColumn(), ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), MeshProjector::changedNTuple(), MapMatrixProjector::changedNTuple(), Map3Projector::changedNTuple(), Map2Projector::changedNTuple(), Map1Projector::changedNTuple(), EqualEntriesHist1DProjector::changedNTuple(), DyHist2DProjector::changedNTuple(), DyHist1DProjector::changedNTuple(), DataSource::checkWidth(), QtRootNTuple::columns(), PyDataSource::columns(), NTupleSorter::columns(), NTuple::copy(), CreateNTuple::createButtonClicked(), NTupleXML::createChildren(), NTupleProjector::createEmptyNTuple(), NTupleProjector::dataRange(), NTupleProjector::dataRangeWithError(), hippodraw::Python::export_CircularBuffer(), hippodraw::Python::export_DataSource(), DataSource::fillRange(), NTuple::getColumn(), NumArrayTuple::getNumArray(), NTupleProjector::getPos(), NTupleProjector::getPosWithError(), NTuple::getRow(), DataSource::indexOfMaxElement(), DataSource::indexOfMinElement(), DataSource::isValidColumn(), RTuple::operator[](), RootNTuple::replaceColumn(), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), FitsNTuple::replaceColumn(), NTuple::setLabels(), DataSource::sum(), and DataSource::throwIfInvalidRowSize().
void copyPrivate | ( | const DataSource & | other | ) | [protected, virtual, inherited] |
Copies the contents of the other DataSource.
For use by derived classes only.
Definition at line 114 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 RTuple::copy(), and NTuple::copy().
std::string createBinding | ( | const std::string & | name, | |
const std::vector< int > & | indices | |||
) | const |
Creates complete binding string from the array variable name and indexes.
Reimplemented in QtRootNTuple.
Definition at line 621 of file RootNTuple.cxx.
References hippodraw::String::convert(), and num_util::size().
Referenced by QtRootNTuple::createBinding(), and RootNTuple::getColumn().
double * doubleArrayAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns pointer to a double array type in given row.
Reimplemented from DataSource.
Definition at line 229 of file RootNTuple.cxx.
References num_util::data(), and RootNTuple::m_data.
Referenced by QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
bool empty | ( | ) | const [virtual] |
Returns true
, if RootNTuple is empty, i.e.
has no data.
Implements DataSource.
Definition at line 185 of file RootNTuple.cxx.
References RootNTuple::rows().
void eraseRow | ( | unsigned int | index | ) | [virtual, inherited] |
Erase a row from the data source.
The implementation throws std::runtime_error.
Reimplemented in NTuple.
Definition at line 556 of file DataSource.cxx.
void expandIfNeeded | ( | const std::string & | label | ) | const [private] |
Definition at line 558 of file RootNTuple.cxx.
References RootNTuple::isMultiDimensional(), and RootNTuple::smartExpandRootNTuple().
void expandIfNeeded | ( | const std::vector< std::string > & | labels | ) | const [virtual] |
Expand the labels if needed.
For each label in labels, expand the variable name if it is an array.
const
function as the state of the data doesn't change. Reimplemented from DataSource.
Reimplemented in QtRootNTuple.
Definition at line 573 of file RootNTuple.cxx.
References num_util::size().
Referenced by QtRootNTuple::expandIfNeeded(), and RootNTuple::getColumn().
void fillDataCache | ( | unsigned int | column | ) | [private] |
Fills the data cache for column column.
Definition at line 171 of file RootNTuple.cxx.
References num_util::data(), RootNTuple::m_data, RootNTuple::m_data_cache, RootNTuple::operator[](), RootNTuple::rows(), num_util::size(), and RootNTuple::valueAt().
Referenced by RootNTuple::getColumn(), and RootNTuple::valueAt().
bool fillRange | ( | unsigned int | column, | |
Range & | ||||
) | const [virtual, inherited] |
Fills the Range object from data indexed by column.
Returns true
if all the data in the column was valid, otherwise returns false
. Invalid data is +/- HUGE_VAL or NAN. Invalid data is not used in setting the range.
Reimplemented in NTuple, and FitsNTuple.
Definition at line 415 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), Range::setRange(), num_util::size(), and DataSource::valueAt().
void fillShape | ( | std::vector< int > & | v, | |
const std::string & | label | |||
) | const [virtual, inherited] |
Fills the vector with the shape of a column.
Returns via the vector v, the shape of the data at column column. Most derived classes will only support a vector in a column. Thus as convenience to implementers of derived classes the implementation of this base class returns a shape of size 1 containing the number of rows.
Definition at line 328 of file DataSource.cxx.
References DataSource::fillShape(), and DataSource::indexOf().
void fillShape | ( | std::vector< int > & | v, | |
unsigned int | column | |||
) | const [virtual] |
Fills the vector with the shape of a column.
Returns via the vector v, the shape of the contained TBranch at the column column. If the TBranch contains an array of n dimensions, the size of shape vector will be n+1 since the first index is always the number of rows.
Reimplemented from DataSource.
Definition at line 445 of file RootNTuple.cxx.
References RootNTuple::getShape(), RootNTuple::m_data, num_util::rank(), RootNTuple::rows(), and num_util::size().
Referenced by QtRootNTuple::getColumnAsArray(), QtRootNTuple::getColumnShape(), and QtRootNTuple::valueAt().
float * floatArrayAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns pointer to a float array type in given row.
Definition at line 238 of file RootNTuple.cxx.
References num_util::data(), and RootNTuple::m_data.
Referenced by QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
const vector< double > & getColumn | ( | unsigned int | column | ) | const [virtual] |
Returns the data in the column with index column.
Reimplemented from DataSource.
Reimplemented in QtRootNTuple.
Definition at line 607 of file RootNTuple.cxx.
References RootNTuple::fillDataCache(), DataSource::isValidColumn(), and RootNTuple::m_data_cache.
const vector< double > & getColumn | ( | const std::string & | name, | |
const std::vector< int > & | indices | |||
) | const [virtual] |
Returns the column with label name.
The column should be one that has an array on the TBranch. The vector indexes is used as the indexes into the array.
Reimplemented in QtRootNTuple.
Definition at line 597 of file RootNTuple.cxx.
References RootNTuple::createBinding(), and RootNTuple::getColumn().
const vector< double > & getColumn | ( | const std::string & | name | ) | const [virtual] |
Returns the data in the column with label name.
Reimplemented from DataSource.
Reimplemented in QtRootNTuple.
Definition at line 585 of file RootNTuple.cxx.
References RootNTuple::expandIfNeeded(), DataSource::indexOf(), and DataSource::throwIfInvalidLabel().
Referenced by RootNTuple::getColumn(), and QtRootNTuple::getColumn().
const vector< string > & getDuplicatedLabels | ( | ) | const [inherited] |
Returns the column labels that were duplicated, or an empty vector.
Definition at line 534 of file DataSource.cxx.
References DataSource::m_dups.
const string & getLabelAt | ( | unsigned int | index | ) | const [virtual, inherited] |
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 179 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(), MeshProjector::getZLabel(), MapMatrixProjector::getZLabel(), and Map3Projector::getZLabel().
const vector< string > & getLabels | ( | ) | const [virtual, inherited] |
Returns the list of available labels.
Reimplemented in QtRootNTuple.
Definition at line 172 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by Inspector::availPlotTypesActivated(), NTupleProjector::createEmptyNTuple(), hippodraw::Python::export_DataSource(), DisplayController::getDataSourceLabels(), QtRootNTuple::getLabels(), PyDataSource::getLabels(), RootNTuple::getRow(), PyDataSource::replaceColumn(), RootNTuple::smartExpandRootNTuple(), Inspector::updateCutVarGroupBox(), and NTupleController::writeNTupleToFile().
const string & getName | ( | ) | const [inherited] |
Returns the name of the data source.
Definition at line 136 of file DataSource.cxx.
References DataSource::m_ds_name.
Referenced by HiNTupleXML::createElement(), NTupleProjector::getNTupleName(), DataSourceController::registerNTuple(), and NTupleXML::setAttributes().
const Observable::ObserverList_t & getObservers | ( | ) | const [inherited] |
Returns the list of observers.
Definition at line 60 of file Observable.cxx.
References Observable::m_list.
unsigned int getRank | ( | ) | const [inherited] |
Returns the rank of the data source.
Returns the number of axes of the data source, i.e the rank.
Definition at line 343 of file DataSource.cxx.
References DataSource::m_shape.
Referenced by RTuple::operator[](), NTuple::operator[](), and RootNTuple::smartExpandRootNTuple().
const vector< double > & getRow | ( | unsigned int | i | ) | const [virtual] |
Returns a const reference to slice along the axis known as a row.
Implements DataSource.
Reimplemented in QtRootNTuple.
Definition at line 297 of file RootNTuple.cxx.
References DataSource::getLabels(), RootNTuple::isUseable(), DataSource::m_array, RootNTuple::m_data, num_util::size(), RootNTuple::smartExpandRootNTuple(), and RootNTuple::valueAt().
Referenced by QtRootNTuple::getRow().
const vector< unsigned int > & getShape | ( | ) | const [virtual] |
Returns the shape of the data elements.
Reimplemented from DataSource.
Definition at line 415 of file RootNTuple.cxx.
References DataSource::m_shape.
Referenced by RootNTuple::fillShape(), and RootNTuple::smartExpandRootNTuple().
TBranch * getTBranch | ( | const std::string & | column | ) | [private] |
Get the TBranch associated with this column.
Definition at line 481 of file RootNTuple.cxx.
References DataSource::indexOf(), and RootNTuple::m_data.
Referenced by RootNTuple::smartExpandRootNTuple().
RootData::Type getType | ( | unsigned int | column | ) | const |
Returns the type of data in column.
Definition at line 220 of file RootNTuple.cxx.
References num_util::data(), and RootNTuple::m_data.
Referenced by QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
int indexOf | ( | const std::string & | label | ) | const [virtual, inherited] |
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 193 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by RootNTuple::addColumn(), NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), NTupleController::createNTuple(), DataSource::fillShape(), RootNTuple::getColumn(), NTuple::getColumn(), DataSource::getColumn(), QtRootNTuple::getColumnAsArray(), QtRootNTuple::getColumnShape(), NumArrayTuple::getNumArray(), RootNTuple::getTBranch(), NTupleProjector::indexOf(), RootNTuple::initBranches(), FitsNTuple::initColumns(), RootNTuple::isMultiDimensional(), RootNTuple::isUseable(), NumArrayTuple::replaceColumn(), ListTuple::replaceColumn(), FitsNTuple::replaceColumn(), DataSource::replaceColumn(), NTupleProjector::setAxisBinding(), RootNTuple::setReleventIndex(), RootNTuple::smartExpandRootNTuple(), and QtRootNTuple::valueAt().
unsigned int indexOfMaxElement | ( | unsigned int | index | ) | const [virtual, inherited] |
Returns row index of the maximum element in a column for the given column.
Reimplemented in NTuple.
Definition at line 476 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
unsigned int indexOfMinElement | ( | unsigned int | index | ) | const [virtual, inherited] |
Returns row index of the minimum element in a column for the given column.
Reimplemented in NTuple.
Definition at line 497 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
void initBranches | ( | ) | [private] |
Initializes the columns of the NTuple.
Definition at line 86 of file RootNTuple.cxx.
References RootNTuple::addColumn(), DataSource::indexOf(), RootNTuple::isMultiDimensional(), RootNTuple::m_data, DataSource::m_dups, RootNTuple::m_multiDimensional, and RootNTuple::m_tree.
Referenced by RootNTuple::RootNTuple().
int * intArrayAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns pointer to a int array type in given row.
Definition at line 247 of file RootNTuple.cxx.
References num_util::data(), and RootNTuple::m_data.
Referenced by QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
bool isMultiDimensional | ( | const std::string & | column | ) | const [virtual] |
Answers if rows of column are composed of the multidimensional data.
Reimplemented from DataSource.
Reimplemented in QtRootNTuple.
Definition at line 423 of file RootNTuple.cxx.
References DataSource::indexOf(), and RootNTuple::m_multiDimensional.
Referenced by RootNTuple::expandIfNeeded(), RootNTuple::initBranches(), QtRootNTuple::isMultiDimensional(), RootNTuple::setReleventIndex(), and RootNTuple::smartExpandRootNTuple().
bool isNull | ( | ) | const [inherited] |
Returns true
if the receiving objects is a null object.
Definition at line 125 of file DataSource.cxx.
References DataSource::m_is_null.
Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DataSource::getLabelAt(), NTupleProjector::NTupleProjector(), NTupleProjector::setNTuple(), and NTupleProjector::~NTupleProjector().
bool isUseable | ( | const std::string & | label | ) | const [virtual] |
Returns true
if the column is usable in the context of a DataSource.
A column may not be usable if it contains a multidimensional array that varies in size from row to row.
Reimplemented from DataSource.
Definition at line 432 of file RootNTuple.cxx.
References DataSource::indexOf(), and RootNTuple::m_data.
Referenced by RootNTuple::getRow().
bool isValidColumn | ( | unsigned int | index | ) | const [protected, inherited] |
Returns true
if index is valid, otherwise throws a DataSourceException.
Definition at line 212 of file DataSource.cxx.
References DataSource::columns(), hippodraw::String::convert(), and num_util::size().
Referenced by RootNTuple::getColumn(), NTuple::getColumn(), FitsNTuple::getColumn(), and DataSource::getColumn().
bool isValidLabel | ( | const std::string & | label | ) | const [inherited] |
Returns true
if label is a valid label for a column in the DataSource.
The search is case sensitive. If the label is not found, returns false
.
Definition at line 257 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by FitsNTuple::checkLabel(), and DataSource::throwIfInvalidLabel().
void notifyObservers | ( | Action | action | ) | const [protected, inherited] |
An internal method to iterate over all observers and to send the message action.
Definition at line 72 of file Observable.cxx.
References Observable::m_list.
void notifyObservers | ( | ) | const [virtual] |
Notifies observers.
Reimplemented from Observable.
Definition at line 156 of file RootNTuple.cxx.
References Observable::notifyObservers().
Referenced by RootNTuple::replaceColumn().
double operator[] | ( | std::vector< unsigned int > & | indices | ) | const [virtual] |
Raises an assertion, as a RootNTuple does not really have shape.
Implements DataSource.
Definition at line 285 of file RootNTuple.cxx.
Referenced by RootNTuple::fillDataCache().
void removeObserver | ( | Observer * | ) | [inherited] |
Removes an Observer from the Observer list.
Definition at line 66 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().
void replaceColumn | ( | const std::string & | label, | |
const std::vector< double > & | data, | |||
const std::vector< intptr_t > & | shape | |||
) | [virtual, inherited] |
Replaces or adds column vector.
If column label exists, replaces that column with data, otherwise adds a new column with label. In both cases, the number of rows, as defined by first element of the shape, must be the same as existing columns, if any. Not all derived classes support the notion of shape, therefore as convenience to developers, the implementation in this base class throws a std::runtime_error object.
Reimplemented in FitsNTuple.
Definition at line 378 of file DataSource.cxx.
void replaceColumn | ( | const std::string & | label, | |
const std::vector< double > & | array | |||
) | [virtual, inherited] |
Replaces data in column label with contents of array.
If column label label exists, replace it contents with array, otherwise throw std::runtime_error.
Reimplemented in PyNTuple.
Definition at line 360 of file DataSource.cxx.
References DataSource::indexOf().
Referenced by hippodraw::Python::export_DataSource(), hippodraw::Python::export_FitsNTuple(), PyNTuple::replaceColumn(), and PyDataSource::saveColumnFromNumArray().
void replaceColumn | ( | unsigned int | index, | |
const std::vector< double > & | data | |||
) | [virtual] |
Replaces the data in column index.
If index is in a valid range and if the size of data is the same as existing columns, then replaces the specified column with a copy of data in data. If index is not a valid range or the sizes differ, then throws a DataSourceException. In neither case is the ROOT file modified.
Reimplemented from DataSource.
Definition at line 381 of file RootNTuple.cxx.
References DataSource::columns(), RootNTuple::m_data_cache, RootNTuple::notifyObservers(), RootNTuple::rows(), and num_util::size().
Referenced by hippodraw::Python::export_RootNTuple().
void reserve | ( | unsigned | int | ) | [virtual] |
Does nothing as the contained ROOT file controls the size.
Implements DataSource.
Definition at line 278 of file RootNTuple.cxx.
bool rotateWheels | ( | std::vector< int > & | wheels, | |
const std::vector< int > & | sz, | |||
unsigned int | d | |||
) | [private] |
A hack to generate labels.
Definition at line 120 of file RootNTuple.cxx.
Referenced by RootNTuple::smartExpandRootNTuple().
unsigned int rows | ( | ) | const [virtual] |
Returns the size of first dimension, i.e.
the number of rows.
Implements DataSource.
Reimplemented in QtRootNTuple.
Definition at line 163 of file RootNTuple.cxx.
References RootNTuple::m_tree.
Referenced by RootNTuple::addColumn(), RootNTuple::empty(), RootNTuple::fillDataCache(), RootNTuple::fillShape(), RootNTuple::replaceColumn(), and QtRootNTuple::rows().
bool setLabelAt | ( | const std::string & | s, | |
unsigned int | index | |||
) | [virtual, inherited] |
Changes the label of a data column to s.
s | the new label. | |
index | the column number starting at zero. |
Definition at line 161 of file DataSource.cxx.
References DataSource::m_labels, and Observable::notifyObservers().
void setLabels | ( | const std::vector< std::string > & | v | ) | [virtual, inherited] |
Assigns the label to each column from the vector of strings @ v.
Reimplemented in NTuple.
Definition at line 297 of file DataSource.cxx.
References DataSource::m_labels, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NumArrayTuple(), RTuple::RTuple(), and NTuple::setLabels().
void setName | ( | const std::string & | name | ) | [inherited] |
Sets the name of the data source.
Definition at line 130 of file DataSource.cxx.
References DataSource::m_ds_name, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_DataSource(), PyDataSource::registerNTuple(), DataSourceController::registerNTuple(), and PyDataSource::setName().
bool setReleventIndex | ( | const std::string & | column, | |
const std::vector< unsigned int > & | index | |||
) | [virtual] |
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 this relevant entry.
Reimplemented from DataSource.
Definition at line 463 of file RootNTuple.cxx.
References DataSource::indexOf(), RootNTuple::isMultiDimensional(), and RootNTuple::m_data.
Referenced by RootNTuple::smartExpandRootNTuple().
void setShape | ( | std::vector< unsigned int > & | shape | ) | [virtual] |
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 RootNTuple is not equal to the product of the shape, then an assertion is raised.
Reimplemented from DataSource.
Definition at line 407 of file RootNTuple.cxx.
References DataSource::m_shape.
void setTitle | ( | const std::string & | title | ) | [virtual, inherited] |
Sets the title of the data source to title.
Reimplemented in PyNTuple.
Definition at line 146 of file DataSource.cxx.
References DataSource::m_title, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_DataSource(), NTupleController::readAsciiNTuple(), PyNTuple::setTitle(), and PyDataSource::setTitle().
void smartExpandRootNTuple | ( | const std::string & | column | ) | const |
Suppose we encounter a RootNTuple which has multi-dimensional data sitting in the rows of the concerned column.
We expand this new NTuple to have additional columns with labels of form array[i][j][k] provided it has not been done before.
Definition at line 494 of file RootNTuple.cxx.
References RootNTuple::addColumn(), DataSource::getLabels(), DataSource::getRank(), RootNTuple::getShape(), RootNTuple::getTBranch(), DataSource::indexOf(), RootNTuple::isMultiDimensional(), RootNTuple::m_data, RootNTuple::m_multiDimensional, RootNTuple::rotateWheels(), and RootNTuple::setReleventIndex().
Referenced by RootNTuple::expandIfNeeded(), and RootNTuple::getRow().
double sum | ( | unsigned int | column | ) | const [virtual, inherited] |
Returns the sum of all the elements in the sequence of column column.
Reimplemented in NTuple.
Definition at line 518 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
void throwIfInvalidLabel | ( | const std::string & | label | ) | const [virtual, inherited] |
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 268 of file DataSource.cxx.
References DataSource::isValidLabel().
Referenced by RootNTuple::getColumn(), NTuple::getColumn(), QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
void throwIfInvalidRowSize | ( | const std::vector< double > & | row | ) | [inherited] |
Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing.
Definition at line 281 of file DataSource.cxx.
References DataSource::columns(), hippodraw::String::convert(), and num_util::size().
Referenced by RTuple::addRow(), NTuple::addRow(), and NTuple::replaceRow().
const string & title | ( | ) | const [inherited] |
Returns a const reference to the title of the data source.
Definition at line 141 of file DataSource.cxx.
References DataSource::m_title.
Referenced by hippodraw::Python::export_DataSource(), DataSource::getLabelAt(), PyDataSource::getTitle(), NTupleProjector::getTitle(), and NTupleController::writeNTupleToFile().
unsigned int * uintArrayAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns pointer to a unsigned int array type in given row and column.
Definition at line 256 of file RootNTuple.cxx.
References num_util::data(), and RootNTuple::m_data.
Referenced by QtRootNTuple::getColumnAsArray().
double valueAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns the value in the table in position given by the row and column indexes.
Implements DataSource.
Definition at line 192 of file RootNTuple.cxx.
References RootNTuple::fillDataCache(), and RootNTuple::m_data_cache.
Referenced by RootNTuple::fillDataCache(), RootNTuple::getRow(), and RootNTuple::valueAtNoCache().
double valueAtNoCache | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns the value in the table in position given by the row and column indexes without storing it into cache.
Reimplemented from DataSource.
Definition at line 205 of file RootNTuple.cxx.
References num_util::data(), RootNTuple::m_data, and RootNTuple::valueAt().
std::vector< double > m_array [mutable, protected, inherited] |
A temporary array that can be returned by const reference.
Definition at line 88 of file DataSource.h.
Referenced by DataSource::getColumn(), RootNTuple::getRow(), and FitsNTuple::getRow().
unsigned int m_cur_entry [mutable, private] |
BranchList_t m_data [private] |
The RootBranch objects that contains the data.
Definition at line 48 of file RootNTuple.h.
Referenced by RootNTuple::addColumn(), RootNTuple::doubleArrayAt(), RootNTuple::fillDataCache(), RootNTuple::fillShape(), RootNTuple::floatArrayAt(), RootNTuple::getRow(), RootNTuple::getTBranch(), RootNTuple::getType(), RootNTuple::initBranches(), RootNTuple::intArrayAt(), RootNTuple::isUseable(), RootNTuple::setReleventIndex(), RootNTuple::smartExpandRootNTuple(), RootNTuple::uintArrayAt(), RootNTuple::valueAtNoCache(), and RootNTuple::~RootNTuple().
CacheList_t m_data_cache [private] |
A cache of data already read.
Definition at line 55 of file RootNTuple.h.
Referenced by RootNTuple::addColumn(), RootNTuple::clear(), RootNTuple::fillDataCache(), RootNTuple::getColumn(), RootNTuple::replaceColumn(), RootNTuple::valueAt(), and RootNTuple::~RootNTuple().
std::vector< std::string > m_dups [protected, inherited] |
A list of labels that duplicated others in a DataSource file.
Definition at line 100 of file DataSource.h.
Referenced by DataSource::getDuplicatedLabels(), RootNTuple::initBranches(), and FitsNTuple::initColumns().
std::vector< bool > m_multiDimensional [private] |
Answers if rows of column are composed of the multidimensional data.
Definition at line 60 of file RootNTuple.h.
Referenced by RootNTuple::addColumn(), RootNTuple::initBranches(), RootNTuple::isMultiDimensional(), and RootNTuple::smartExpandRootNTuple().
std::vector< unsigned int > m_shape [protected, inherited] |
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 96 of file DataSource.h.
Referenced by DataSource::copyPrivate(), DataSource::getRank(), RootNTuple::getShape(), NumArrayTuple::getShape(), ListTuple::getShape(), FitsNTuple::getShape(), DataSource::getShape(), RTuple::operator[](), NTuple::operator[](), RootNTuple::setShape(), NumArrayTuple::setShape(), ListTuple::setShape(), FitsNTuple::setShape(), and DataSource::setShape().
The ROOT TTree object which is the source of the data.
Definition at line 64 of file RootNTuple.h.
Referenced by RootNTuple::initBranches(), and RootNTuple::rows().