Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QtRootNTuple Class Reference

#include <QtRootNTuple.h>

Inheritance diagram for QtRootNTuple:

Inheritance graph
[legend]
Collaboration diagram for QtRootNTuple:

Collaboration graph
[legend]
List of all members.

Detailed Description

A wrapper for RootNTuple, so that when RootNTuple is used in Qt based application, the application object can be locked and unlocked before calling any ROOT functions.

ROOT is not thread safe, so this is necessary to avoid the application thread and Python thread from clashing.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 40 of file QtRootNTuple.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

int addColumn (const std::string &, const std::vector< double > &)
 Adds a column to the object.
void addObserver (hippodraw::Observer *)
 Adds an Observer to the Observer list.
virtual void addRow (const std::vector< double > &row)
 Raises an assertion, as the contained ROOT file should not be changed.
virtual void addRow (const std::vector< double > &row)
 Raises an assertion, as the contained ROOT file should not be changed.
virtual void clear ()
 Removes all the cached data vectors, does not change the contained ROOT file.
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.
unsigned int columns ()
 Returns the number of columns.
virtual void copy (const DataSource &)
 Raises assertion as contained ROOT NTuple should not be copied.
virtual void copy (const DataSource &)
 Raises assertion as contained ROOT NTuple should not be copied.
std::string createBinding (const std::string &name, const std::vector< int > &indices) const
 Creates complete binding string from the array variable name and indexes.
double * doubleArrayAt (unsigned int row, unsigned int column) const
 Returns pointer to a double array type in given row.
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 bool empty () const
 Returns true, if RootNTuple is empty, i.e.
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.
float * floatArrayAt (unsigned int row, unsigned int column) const
 Returns pointer to a float array type in given row.
float * floatArrayAt (unsigned int row, unsigned int column) const
 Returns pointer to a float array type in given row.
const std::vector< double > & getColumn (unsigned int index) const
 Returns copy of TBranch data by index.
const std::vector< double > & getColumn (const std::string &name, const std::vector< int > &indexes) const
 Returns copy of TBranch data by name and indexes.
const std::vector< double > & getColumn (const std::string &name) const
 Returns copy of TBranch data by name.
const std::vector< int > & getColumnShape (unsigned int column) const
 Returns the shape of multidimensional array.
const std::vector< int > & getColumnShape (unsigned int column) const
 Returns the shape of multidimensional array.
virtual const std::stringgetLabelAt (unsigned int index) const
 Returns the label for the column at index index.
const std::vector< std::string > & getLabels () const
 Returns the labels of the column, i.e.
const std::stringgetName () const
 Returns the name of the ntuple.
const ObserverList_tgetObservers () const
 Returns the list of observers.
unsigned int getRank () const
 Returns the rank of the data source.
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 i) const
 Returns a const reference to slice along the axis known as a row.
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.
const std::vector< unsigned
int > & 
getShape () const
 Returns the shape of the data elements.
TBranchgetTBranch (const std::string &column)
 Get the TBranch associated with this column.
TBranchgetTBranch (const std::string &column)
 Get the TBranch associated with this column.
hippodraw::RootData::Type getType (unsigned int column) const
 Returns the type of data in column.
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.
int * intArrayAt (unsigned int row, unsigned int column) const
 Returns pointer to a int array type in given row.
int * intArrayAt (unsigned int row, unsigned int column) const
 Returns pointer to a int array type in given row.
bool isMultiDimensional (const std::string &column) const
 Returns true if the column named column, is an array, rather then simple type.
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 observers.
virtual void notifyObservers () const
 Notifies observers.
virtual double operator[] (std::vector< unsigned int > &indices) const
 Raises an assertion, as a ROOT NTuple does not really have shape.
virtual double operator[] (std::vector< unsigned int > &indices) const
 Raises an assertion, as a ROOT NTuple does not really have shape.
 QtRootNTuple (TTree *tree)
 The public constructor requiring a TTree from a ROOT file.
void removeObserver (hippodraw::Observer *)
 Removes an Observer from the Observer list.
void replaceColumn (const std::string &label, const std::vector< double > &data)
 Replaces the data in column labeled label.
void replaceColumn (unsigned int index, const std::vector< double > &data)
 Replaces the data in column index.
void replaceColumn (const std::string &label, const std::vector< double > &data)
 Replaces the data in column labeled label.
void replaceColumn (unsigned int index, const std::vector< double > &data)
 Replaces the data in column index.
virtual void reserve (unsigned int count)=0
 For each column, reserves enough space for the NTuple to grow to count rows.
virtual void reserve (unsigned int)
 Does nothing as the contained ROOT file controls the size.
virtual void reserve (unsigned int)
 Does nothing as the contained ROOT file controls the size.
const std::vector< int > & rowDataDimSize (const std::string &column) const
 Size of the multidimensional matrix in various dimensions.
const std::vector< int > & rowDataDimSize (const std::string &column)
 Size of the multidimensional matrix in various dimensions.
virtual unsigned int rows () const
 Returns the size of the slice for the next to last dimension.
unsigned int rows ()
 Returns the number of rows.
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 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 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.
void smartExpandRootNTuple (const std::string &column) const
 Suppose we encounter a RootTuple which has multi-dimensional data sitting in the rows of the concerned column.
void smartExpandRootNTuple (const std::string &column) const
 Suppose we encounter a RootTuple 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::stringtitle () 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.
boost::python::numeric::array valueAt (unsigned int row, const std::string &variable)
 Returns a numarray for variable in row of NTuple.

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

 QtRootNTuple ()
 The default constructor.


Member Typedef Documentation

typedef void( hippodraw::Observer::* Observable::Action)(const Observable *) [inherited]
 

The member function of the Observer that is called.

Definition at line 83 of file Observable.h.

typedef std::list< hippodraw::Observer * > Observable::ObserverList_t [inherited]
 

The type of STL container to maintain list of Observer objects.

Definition at line 46 of file Observable.h.


Constructor & Destructor Documentation

QtRootNTuple::QtRootNTuple  )  [private]
 

The default constructor.

Note:
The default constructor is private because the implement currently requires opening a ROOT file.

Definition at line 46 of file QtRootNTuple.cxx.

QtRootNTuple::QtRootNTuple TTree tree  ) 
 

The public constructor requiring a TTree from a ROOT file.

Definition at line 40 of file QtRootNTuple.cxx.


Member Function Documentation

int QtRootNTuple::addColumn const std::string ,
const std::vector< double > & 
 

Adds a column to the object.

The column is treated like the other columns and the original ROOT file is not modified.

Reimplemented from RootNTuple.

Definition at line 131 of file QtRootNTuple.cxx.

References RootNTuple::addColumn().

Referenced by hippodraw::Python::export_RootNTuple().

void DataSource::addLabel const std::string label  )  [protected, virtual, inherited]
 

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

void Observable::addObserver hippodraw::Observer  )  [inherited]
 

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

virtual void RootNTuple::addRow const std::vector< double > &  row  )  [virtual, inherited]
 

Raises an assertion, as the contained ROOT file should not be changed.

Implements DataSource.

void RootNTuple::addRow const std::vector< double > &  row  )  [virtual, inherited]
 

Raises an assertion, as the contained ROOT file should not be changed.

Implements DataSource.

Definition at line 243 of file LdfNTuple.cxx.

virtual void RootNTuple::clear  )  [virtual, inherited]
 

Removes all the cached data vectors, does not change the contained ROOT file.

Implements DataSource.

void RootNTuple::clear  )  [virtual, inherited]
 

Removes all the cached data vectors, does not change the contained ROOT file.

Implements DataSource.

Definition at line 223 of file LdfNTuple.cxx.

References RootNTuple::m_data_cache.

unsigned int DataSource::columns  )  const [inline, inherited]
 

Returns the number of columns or data arrays available from this DataSource.

Note:
This function was selected to be in line sine it contributes heavily in time for addRow member function.

Definition at line 332 of file DataSource.h.

References DataSource::m_labels.

Referenced by PyDataSource::addColumn(), ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), MapMatrixProjector::changedNTuple(), Map3Projector::changedNTuple(), Map2Projector::changedNTuple(), Map1Projector::changedNTuple(), DyHist2DProjector::changedNTuple(), DyHist1DProjector::changedNTuple(), columns(), PyDataSource::columns(), NTupleSorter::columns(), NTuple::copy(), NTupleXML::createChildren(), NTupleProjector::dataRange(), NTupleProjector::dataRangeWithError(), hippodraw::Python::export_CircularBuffer(), hippodraw::Python::export_DataSource(), DataSource::fillRange(), NTuple::getColumn(), NTupleProjector::getNTupleAfterCuts(), NumArrayTuple::getNumArray(), NTupleProjector::getPos(), NTupleProjector::getPosWithError(), NTuple::getRow(), DataSource::indexOfMaxElement(), DataSource::indexOfMinElement(), DataSource::isValidColumn(), RTuple::operator[](), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), RootNTuple::replaceColumn(), FitsNTuple::replaceColumn(), NTuple::setLabels(), DataSource::sum(), and DataSource::throwIfInvalidRowSize().

unsigned int QtRootNTuple::columns  ) 
 

Returns the number of columns.

Definition at line 64 of file QtRootNTuple.cxx.

References DataSource::columns().

Referenced by hippodraw::Python::export_RootNTuple().

virtual void RootNTuple::copy const DataSource  )  [virtual, inherited]
 

Raises assertion as contained ROOT NTuple should not be copied.

void RootNTuple::copy const DataSource  )  [virtual, inherited]
 

Raises assertion as contained ROOT NTuple should not be copied.

Definition at line 68 of file LdfNTuple.cxx.

void DataSource::copyPrivate const DataSource other  )  [protected, virtual, inherited]
 

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 RTuple::copy(), and NTuple::copy().

std::string QtRootNTuple::createBinding const std::string name,
const std::vector< int > &  indices
const
 

Creates complete binding string from the array variable name and indexes.

Reimplemented from RootNTuple.

Definition at line 185 of file QtRootNTuple.cxx.

References RootNTuple::createBinding().

Referenced by QtDisplay::QtDisplay().

double* RootNTuple::doubleArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a double array type in given row.

double * RootNTuple::doubleArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a double array type in given row.

Definition at line 195 of file LdfNTuple.cxx.

References num_util::data(), and RootNTuple::m_data.

Referenced by valueAt().

virtual bool RootNTuple::empty  )  const [virtual, inherited]
 

Returns true, if RootNTuple is empty, i.e.

has no data.

Implements DataSource.

bool RootNTuple::empty  )  const [virtual, inherited]
 

Returns true, if RootNTuple is empty, i.e.

has no data.

Implements DataSource.

Definition at line 164 of file LdfNTuple.cxx.

References RootNTuple::rows().

void QtRootNTuple::expandIfNeeded const std::vector< std::string > &  labels  )  const
 

Expand the labels if needed.

For each label in labels, expand the variable name if it is an array.

Note:
Although the object changes its labels, it is still logically a const function as the state of the data doesn't change.

Reimplemented from RootNTuple.

Definition at line 178 of file QtRootNTuple.cxx.

References RootNTuple::expandIfNeeded().

Referenced by QtDisplay::QtDisplay().

bool DataSource::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 323 of file DataSource.cxx.

References DataSource::columns(), std::max(), std::min(), DataSource::rows(), Range::setRange(), num_util::size(), and DataSource::valueAt().

float* RootNTuple::floatArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a float array type in given row.

float * RootNTuple::floatArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a float array type in given row.

Definition at line 204 of file LdfNTuple.cxx.

References num_util::data(), and RootNTuple::m_data.

Referenced by valueAt().

const vector< double > & QtRootNTuple::getColumn unsigned int  index  )  const [virtual]
 

Returns copy of TBranch data by index.

Reimplemented from RootNTuple.

Definition at line 112 of file QtRootNTuple.cxx.

References RootNTuple::getColumn().

const vector< double > & QtRootNTuple::getColumn const std::string name,
const std::vector< int > &  indexes
const [virtual]
 

Returns copy of TBranch data by name and indexes.

Reimplemented from RootNTuple.

Definition at line 91 of file QtRootNTuple.cxx.

References RootNTuple::getColumn().

const vector< double > & QtRootNTuple::getColumn const std::string name  )  const [virtual]
 

Returns copy of TBranch data by name.

Reimplemented from RootNTuple.

Definition at line 72 of file QtRootNTuple.cxx.

References RootNTuple::getColumn().

Referenced by hippodraw::Python::export_RootNTuple().

const std::vector< int >& RootNTuple::getColumnShape unsigned int  column  )  const [inherited]
 

Returns the shape of multidimensional array.

const vector< int > & RootNTuple::getColumnShape unsigned int  column  )  const [inherited]
 

Returns the shape of multidimensional array.

Definition at line 413 of file LdfNTuple.cxx.

References RootNTuple::m_data, and RootNTuple::rowDataDimSize().

Referenced by RootNTuple::rowDataDimSize(), and valueAt().

const string & DataSource::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 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().

const std::vector< std::string > & QtRootNTuple::getLabels  )  const [virtual]
 

Returns the labels of the column, i.e.

the TBranch names.

Reimplemented from DataSource.

Definition at line 139 of file QtRootNTuple.cxx.

References DataSource::getLabels().

Referenced by hippodraw::Python::export_RootNTuple().

const string & DataSource::getName  )  const [inherited]
 

Returns the name of the ntuple.

See also:
m_ds_name.

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

const Observable::ObserverList_t & Observable::getObservers  )  const [inherited]
 

Returns the list of observers.

Definition at line 57 of file Observable.cxx.

References Observable::m_list.

unsigned int RootNTuple::getRank  )  const [inherited]
 

Returns the rank of the data source.

Returns the number of axes of the data source, i.e the rank.

Reimplemented from DataSource.

unsigned int RootNTuple::getRank  )  const [inherited]
 

Returns the rank of the data source.

Returns the number of axes of the data source, i.e the rank.

Reimplemented from DataSource.

Definition at line 383 of file LdfNTuple.cxx.

References DataSource::m_shape.

virtual const std::vector< double >& DataSource::getRow unsigned  int  )  const [pure virtual, inherited]
 

Returns a const reference to slice along the axis known as a row.

Referenced by RTuple::copy(), NTuple::copy(), and NTupleController::writeNTupleToFile().

virtual const std::vector< double >& RootNTuple::getRow unsigned int  i  )  const [virtual, inherited]
 

Returns a const reference to slice along the axis known as a row.

const vector< double > & RootNTuple::getRow unsigned int  row  )  const [virtual, inherited]
 

Returns a const reference to slice along the axis known as a row.

Todo:
Could bypass calling valueAt if performance is shown to be an issue.

Definition at line 261 of file LdfNTuple.cxx.

References DataSource::m_array, RootNTuple::m_data, num_util::size(), and RootNTuple::valueAt().

const std::vector< unsigned int >& RootNTuple::getShape  )  const [inherited]
 

Returns the shape of the data elements.

Reimplemented from DataSource.

const vector< unsigned int > & RootNTuple::getShape  )  const [inherited]
 

Returns the shape of the data elements.

Reimplemented from DataSource.

Definition at line 376 of file LdfNTuple.cxx.

References DataSource::m_shape.

TBranch* RootNTuple::getTBranch const std::string column  )  [inherited]
 

Get the TBranch associated with this column.

TBranch * RootNTuple::getTBranch const std::string column  )  [inherited]
 

Get the TBranch associated with this column.

Definition at line 440 of file LdfNTuple.cxx.

References DataSource::indexOf(), and RootNTuple::m_data.

Referenced by RootNTuple::smartExpandRootNTuple().

hippodraw::RootData::Type RootNTuple::getType unsigned int  column  )  const [inherited]
 

Returns the type of data in column.

RootData::Type RootNTuple::getType unsigned int  column  )  const [inherited]
 

Returns the type of data in column.

Definition at line 186 of file LdfNTuple.cxx.

References num_util::data(), and RootNTuple::m_data.

Referenced by valueAt().

int DataSource::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 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 valueAt().

unsigned int DataSource::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 377 of file DataSource.cxx.

References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().

unsigned int DataSource::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 398 of file DataSource.cxx.

References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().

int* RootNTuple::intArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a int array type in given row.

int * RootNTuple::intArrayAt unsigned int  row,
unsigned int  column
const [inherited]
 

Returns pointer to a int array type in given row.

Definition at line 213 of file LdfNTuple.cxx.

References num_util::data(), and RootNTuple::m_data.

Referenced by valueAt().

bool QtRootNTuple::isMultiDimensional const std::string column  )  const [virtual]
 

Returns true if the column named column, is an array, rather then simple type.

Reimplemented from RootNTuple.

Definition at line 147 of file QtRootNTuple.cxx.

References RootNTuple::isMultiDimensional().

Referenced by hippodraw::Python::export_RootNTuple().

bool DataSource::isNull  )  const [inherited]
 

Returns true if the receiving objects is a null object.

See also:
DataSource( bool ).

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

bool DataSource::isValidColumn unsigned int  index  )  const [protected, inherited]
 

Returns true if index is valid, otherwise throws a DataSourceException.

Definition at line 208 of file DataSource.cxx.

References DataSource::columns(), and num_util::size().

Referenced by NTuple::getColumn(), and DataSource::getColumn().

bool DataSource::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 250 of file DataSource.cxx.

References std::find(), and DataSource::m_labels.

Referenced by DataSource::throwIfInvalidLabel().

void Observable::notifyObservers Action  action  )  const [protected, inherited]
 

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

virtual void RootNTuple::notifyObservers  )  const [virtual, inherited]
 

Notifies observers.

Todo:
remove this method when Observable is exposed to Python.

Reimplemented from Observable.

void RootNTuple::notifyObservers  )  const [virtual, inherited]
 

Notifies observers.

Todo:
remove this method when Observable is exposed to Python.

Reimplemented from Observable.

Definition at line 135 of file LdfNTuple.cxx.

References Observable::notifyObservers().

Referenced by RootNTuple::replaceColumn().

virtual double RootNTuple::operator[] std::vector< unsigned int > &  indices  )  const [virtual, inherited]
 

Raises an assertion, as a ROOT NTuple does not really have shape.

Implements DataSource.

double RootNTuple::operator[] std::vector< unsigned int > &  indices  )  const [virtual, inherited]
 

Raises an assertion, as a ROOT NTuple does not really have shape.

Implements DataSource.

Definition at line 250 of file LdfNTuple.cxx.

Referenced by RootNTuple::fillDataCache().

void Observable::removeObserver hippodraw::Observer  )  [inherited]
 

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

void RootNTuple::replaceColumn const std::string label,
const std::vector< double > &  data
[inherited]
 

Replaces the data in column labeled label.

If the label is valid 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 the label is not valid or the sizes differ, then throws a DataSourceException. In neither case is the ROOT file modified.

void RootNTuple::replaceColumn unsigned int  index,
const std::vector< double > &  data
[inherited]
 

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.

void RootNTuple::replaceColumn const std::string label,
const std::vector< double > &  data
[inherited]
 

Replaces the data in column labeled label.

If the label is valid 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 the label is not valid or the sizes differ, then throws a DataSourceException. In neither case is the ROOT file modified.

Definition at line 353 of file LdfNTuple.cxx.

References DataSource::indexOf(), and RootNTuple::replaceColumn().

void RootNTuple::replaceColumn unsigned int  index,
const std::vector< double > &  data
[inherited]
 

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.

Definition at line 327 of file LdfNTuple.cxx.

References DataSource::columns(), std::copy(), RootNTuple::m_data_cache, RootNTuple::notifyObservers(), RootNTuple::rows(), and num_util::size().

Referenced by hippodraw::Python::export_RootNTuple(), and RootNTuple::replaceColumn().

virtual void DataSource::reserve unsigned int  count  )  [pure virtual, inherited]
 

For each column, reserves enough space for the NTuple to grow to count rows.

Implemented in CircularBuffer, NTuple, RTuple, FitsNTuple, NumArrayTuple, and ListTuple.

virtual void RootNTuple::reserve unsigned  int  )  [virtual, inherited]
 

Does nothing as the contained ROOT file controls the size.

void RootNTuple::reserve unsigned  int  )  [virtual, inherited]
 

Does nothing as the contained ROOT file controls the size.

Definition at line 236 of file LdfNTuple.cxx.

const vector< int > & RootNTuple::rowDataDimSize const std::string column  )  const [inherited]
 

Size of the multidimensional matrix in various dimensions.

Returns the shape of multidimensional array.

Note:
Chose int to be compatible with num_util.

Definition at line 400 of file LdfNTuple.cxx.

References RootNTuple::getColumnShape(), and DataSource::indexOf().

Referenced by RootNTuple::getColumnShape(), rowDataDimSize(), and RootNTuple::smartExpandRootNTuple().

const std::vector< int > & QtRootNTuple::rowDataDimSize const std::string column  ) 
 

Size of the multidimensional matrix in various dimensions.

Returns the shape of multidimensional array.

Note:
Chose int to be compatible with num_util.

Definition at line 163 of file QtRootNTuple.cxx.

References RootNTuple::rowDataDimSize().

Referenced by hippodraw::Python::export_RootNTuple().

unsigned int RootNTuple::rows  )  const [virtual, inherited]
 

Returns the size of the slice for the next to last dimension.

Implements DataSource.

Definition at line 142 of file LdfNTuple.cxx.

References RootNTuple::m_tree.

Referenced by RootNTuple::addColumn(), RootNTuple::empty(), RootNTuple::fillDataCache(), RootNTuple::replaceColumn(), and rows().

unsigned int QtRootNTuple::rows  ) 
 

Returns the number of rows.

Definition at line 53 of file QtRootNTuple.cxx.

References RootNTuple::rows().

Referenced by hippodraw::Python::export_RootNTuple().

bool DataSource::setLabelAt const std::string s,
unsigned int  index
[virtual, inherited]
 

Changes the label of a data column to s.

Parameters:
s the new label.
index the column number starting at zero.
Returns:
true if index is less than the width of the ntuple; otherwise, it does nothing and returns false.

Definition at line 157 of file DataSource.cxx.

References DataSource::m_labels, and Observable::notifyObservers().

void DataSource::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 289 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 DataSource::setName const std::string name  )  [inherited]
 

Sets the name of the ntuple.

See also:
m_ds_name.

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

virtual bool RootNTuple::setReleventIndex const std::string column,
const std::vector< unsigned int > &  index
[virtual, inherited]
 

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.

bool RootNTuple::setReleventIndex const std::string column,
const std::vector< unsigned int > &  index
[virtual, inherited]
 

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 422 of file LdfNTuple.cxx.

References DataSource::indexOf(), RootNTuple::isMultiDimensional(), and RootNTuple::m_data.

Referenced by RootNTuple::smartExpandRootNTuple().

virtual void RootNTuple::setShape std::vector< unsigned int > &  shape  )  [virtual, inherited]
 

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.

void RootNTuple::setShape std::vector< unsigned int > &  shape  )  [virtual, inherited]
 

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 363 of file LdfNTuple.cxx.

References DataSource::m_shape, and num_util::size().

void DataSource::setTitle const std::string title  )  [inherited]
 

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

void RootNTuple::smartExpandRootNTuple const std::string column  )  const [inherited]
 

Suppose we encounter a RootTuple 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.

void RootNTuple::smartExpandRootNTuple const std::string column  )  const [inherited]
 

Suppose we encounter a RootTuple 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 451 of file LdfNTuple.cxx.

References RootNTuple::addColumn(), DataSource::getLabels(), RootNTuple::getTBranch(), DataSource::indexOf(), RootNTuple::isMultiDimensional(), RootNTuple::m_data, RootNTuple::m_multiDimensional, RootNTuple::rotateWheels(), RootNTuple::rowDataDimSize(), and RootNTuple::setReleventIndex().

Referenced by RootNTuple::expandIfNeeded().

double DataSource::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 419 of file DataSource.cxx.

References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().

void DataSource::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 264 of file DataSource.cxx.

References DataSource::isValidLabel().

Referenced by NTuple::getColumn(), RootNTuple::getColumn(), and valueAt().

void DataSource::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 277 of file DataSource.cxx.

References DataSource::columns(), and num_util::size().

Referenced by RTuple::addRow(), NTuple::addRow(), and NTuple::replaceRow().

const string & DataSource::title  )  const [inherited]
 

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

double RootNTuple::valueAt unsigned int  row,
unsigned int  column
const [virtual, inherited]
 

Returns the value in the table in position given by the row and column indexes.

Implements DataSource.

Definition at line 171 of file LdfNTuple.cxx.

References RootNTuple::fillDataCache(), and RootNTuple::m_data_cache.

Referenced by RootNTuple::fillDataCache(), and RootNTuple::getRow().

numeric::array QtRootNTuple::valueAt unsigned int  row,
const std::string variable
 

Returns a numarray for variable in row of NTuple.

Definition at line 199 of file QtRootNTuple.cxx.

References hippodraw::RootData::Double, RootNTuple::doubleArrayAt(), hippodraw::RootData::Float, RootNTuple::floatArrayAt(), RootNTuple::getColumnShape(), RootNTuple::getType(), DataSource::indexOf(), hippodraw::RootData::Int, RootNTuple::intArrayAt(), num_util::makeNum(), num_util::shape(), DataSource::throwIfInvalidLabel(), and num_util::type().

Referenced by hippodraw::Python::export_RootNTuple().


Member Data Documentation

std::vector< double > DataSource::m_array [mutable, protected, inherited]
 

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

std::vector< unsigned int > DataSource::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 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(), RTuple::operator[](), NTuple::operator[](), NumArrayTuple::setShape(), ListTuple::setShape(), RootNTuple::setShape(), FitsNTuple::setShape(), and DataSource::setShape().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3