thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
LWH::DataPointSet Class Reference

An DataPointSet represents a binned histogram axis. More...

#include <DataPointSet.h>

Inheritance diagram for LWH::DataPointSet:

Public Member Functions

 DataPointSet (int D)
 Standard constructor takes the dimension, D, of the data points as argument.
 
virtual ~DataPointSet ()
 Destructor.
 
IAnnotation & annotation ()
 Not implemented in LWH.
 
const IAnnotation & annotation () const
 Not implemented in LWH.
 
std::string title () const
 Get the data set's title.
 
std::string name () const
 Get the data set's title.
 
bool setTitle (const std::string &title)
 Set the data set's title.
 
int dimension () const
 Get the dimension of the IDataPoints that can be stored in the set.
 
void clear ()
 Remove all the IDataPoints in the set.
 
int size () const
 Get the current size of the IDataPointSet, i.e.
 
IDataPoint * point (int index)
 Get the IDataPoint at a give index in the set.
 
bool setCoordinate (int coord, const std::vector< double > &val, const std::vector< double > &err)
 Set the values and errors of a given coordinate all at once.
 
bool setCoordinate (int coord, const std::vector< double > &val, const std::vector< double > &errp, const std::vector< double > &errm)
 Set the values and errors of a given coordinate all at once.
 
const IDataPoint * point (int index) const
 Return the data point at the given index.
 
IDataPoint * addPoint ()
 Add a new empty IDataPoint at the end of the set.
 
bool addPoint (const IDataPoint &point)
 Add a copy of an IDataPoint at the end of the set.
 
bool removePoint (int index)
 Remove the IDataPoint at a given index.
 
double lowerExtent (int coord) const
 Get the lower value for a give axis.
 
double upperExtent (int coord) const
 Get the upper value for a give axis.
 
bool scale (double scale)
 Scales the values and the errors of all the measurements of each point by a given factor.
 
bool scaleValues (double scale)
 Scales the values of all the measurements of each point by a given factor.
 
bool scaleErrors (double scale)
 Scales the errors of all the measurements of each point by a given factor.
 
void * cast (const std::string &) const
 Not implemented in LWH.
 
bool writeXML (std::ostream &os, std::string path, std::string name)
 Write out the data set in the AIDA xml format.
 
bool writeFLAT (std::ostream &os, std::string path, std::string name)
 Write out the data set in a flat text file suitable for eg.
 
- Public Member Functions inherited from LWH::ManagedObject
virtual ~ManagedObject ()
 Destructor.
 
virtual bool writeXML (std::ostream &os, std::string path, std::string name)=0
 Write out the object to the given stream in XML format.
 
virtual bool writeFLAT (std::ostream &os, std::string path, std::string name)=0
 Write out the object to the given stream in simple table format.
 

Private Attributes

std::string theTitle
 The title.
 
std::vector< DataPointdset
 The included data points.
 
unsigned int dim
 The dimension of the points in this set.
 

Detailed Description

An DataPointSet represents a binned histogram axis.

A 1D Histogram would have one DataPointSet representing the X axis, while a 2D Histogram would have two axes representing the X and Y DataPointSet.

Definition at line 33 of file DataPointSet.h.

Constructor & Destructor Documentation

◆ DataPointSet()

LWH::DataPointSet::DataPointSet ( int  D)
inline

Standard constructor takes the dimension, D, of the data points as argument.

Definition at line 41 of file DataPointSet.h.

◆ ~DataPointSet()

virtual LWH::DataPointSet::~DataPointSet ( )
inlinevirtual

Destructor.

Definition at line 46 of file DataPointSet.h.

Member Function Documentation

◆ addPoint() [1/2]

IDataPoint * LWH::DataPointSet::addPoint ( )
inline

Add a new empty IDataPoint at the end of the set.

Returns
The newly added point.

Definition at line 185 of file DataPointSet.h.

References dimension(), and dset.

◆ addPoint() [2/2]

bool LWH::DataPointSet::addPoint ( const IDataPoint &  point)
inline

Add a copy of an IDataPoint at the end of the set.

Parameters
pointThe IDataPoint to be added.
Returns
false If the point has the wrong dimension or if the point cannot be added.

Definition at line 196 of file DataPointSet.h.

References dimension(), dset, and point().

◆ annotation() [1/2]

IAnnotation & LWH::DataPointSet::annotation ( )
inline

Not implemented in LWH.

will throw an exception.

Definition at line 51 of file DataPointSet.h.

◆ annotation() [2/2]

const IAnnotation & LWH::DataPointSet::annotation ( ) const
inline

Not implemented in LWH.

will throw an exception.

Definition at line 58 of file DataPointSet.h.

◆ cast()

void * LWH::DataPointSet::cast ( const std::string &  ) const
inline

Not implemented in LWH.

Returns
null pointer always.

Definition at line 299 of file DataPointSet.h.

◆ clear()

void LWH::DataPointSet::clear ( )
inline

Remove all the IDataPoints in the set.

After this the IDataPointSet is as just created.

Definition at line 101 of file DataPointSet.h.

References dset.

◆ dimension()

int LWH::DataPointSet::dimension ( ) const
inline

Get the dimension of the IDataPoints that can be stored in the set.

Returns
The dimension of the IDataPoints storable in the set.

Definition at line 93 of file DataPointSet.h.

References dim.

Referenced by addPoint(), lowerExtent(), scale(), scaleErrors(), scaleValues(), setCoordinate(), upperExtent(), writeFLAT(), and writeXML().

◆ lowerExtent()

double LWH::DataPointSet::lowerExtent ( int  coord) const
inline

Get the lower value for a give axis.

Parameters
coordThe coordinate of the axis.
Returns
The lower edge of the corresponding axis. If coord < 0 or coord >= dimension(), or if the set is empty NaN is returned.

Definition at line 220 of file DataPointSet.h.

References dimension(), and dset.

◆ name()

std::string LWH::DataPointSet::name ( ) const
inline

Get the data set's title.

Returns
The data set's title.

Definition at line 74 of file DataPointSet.h.

References theTitle.

Referenced by writeFLAT(), and writeXML().

◆ point() [1/2]

IDataPoint * LWH::DataPointSet::point ( int  index)
inline

Get the IDataPoint at a give index in the set.

Parameters
indexThe IDataPoint index.
Returns
The corresponding IDataPoint.

Definition at line 119 of file DataPointSet.h.

References dset.

Referenced by addPoint(), writeFLAT(), and writeXML().

◆ point() [2/2]

const IDataPoint * LWH::DataPointSet::point ( int  index) const
inline

Return the data point at the given index.

Returns
0 if index is out of range.

Definition at line 176 of file DataPointSet.h.

References dset.

◆ removePoint()

bool LWH::DataPointSet::removePoint ( int  index)
inline

Remove the IDataPoint at a given index.

Parameters
indexThe index of the IDataPoint to be removed.
Returns
false If the index is < 0 or >= size().

Definition at line 207 of file DataPointSet.h.

References dset.

◆ scale()

bool LWH::DataPointSet::scale ( double  scale)
inline

Scales the values and the errors of all the measurements of each point by a given factor.

Parameters
scaleThe scale factor.
Returns
false If an illegal scaleFactor is provided.

Definition at line 253 of file DataPointSet.h.

References dimension(), dset, and scale().

Referenced by scale(), scaleErrors(), and scaleValues().

◆ scaleErrors()

bool LWH::DataPointSet::scaleErrors ( double  scale)
inline

Scales the errors of all the measurements of each point by a given factor.

Parameters
scaleThe scale factor.
Returns
false If an illegal scaleFactor is provided.

Definition at line 285 of file DataPointSet.h.

References dimension(), dset, and scale().

◆ scaleValues()

bool LWH::DataPointSet::scaleValues ( double  scale)
inline

Scales the values of all the measurements of each point by a given factor.

Parameters
scaleThe scale factor.
Returns
false If an illegal scaleFactor is provided.

Definition at line 270 of file DataPointSet.h.

References dimension(), dset, and scale().

◆ setCoordinate() [1/2]

bool LWH::DataPointSet::setCoordinate ( int  coord,
const std::vector< double > &  val,
const std::vector< double > &  err 
)
inline

Set the values and errors of a given coordinate all at once.

If this method is called on an empty IDataPointSet, a number of points equal to the size of the arrays provided is created; if the IDataPointSet is not empty the dimension of the array must match with the size of the IDataPointSet.

Parameters
coordThe coordinate's index
valThe array of the values for the given coordinate
errThe array with the symmetric errors.
Returns
false if an illegal coordinate is provided or if there is a mismatch between the size of the array and the size of the IDataPointSet.

Definition at line 136 of file DataPointSet.h.

References setCoordinate().

Referenced by setCoordinate().

◆ setCoordinate() [2/2]

bool LWH::DataPointSet::setCoordinate ( int  coord,
const std::vector< double > &  val,
const std::vector< double > &  errp,
const std::vector< double > &  errm 
)
inline

Set the values and errors of a given coordinate all at once.

If this method is called on an empty IDataPointSet, a number of points equal to the size of the arrays provided is created; if the IDataPointSet is not empty the dimension of the array must match with the size of the IDataPointSet.

Parameters
coordThe coordinate's index
valThe array of the values for the given coordinate
errpThe array with the plus errors.
errmThe array with the minus errors.
Returns
false if an illegal coordinate is provided or if there is a mismatch between the size of the array and the size of the IDataPointSet.

Definition at line 157 of file DataPointSet.h.

References dimension(), and dset.

◆ setTitle()

bool LWH::DataPointSet::setTitle ( const std::string &  title)
inline

Set the data set's title.

Parameters
titleThe title.
Returns
false If title cannot be changed.

Definition at line 83 of file DataPointSet.h.

References theTitle, and title().

Referenced by LWH::DataPointSetFactory::create().

◆ size()

int LWH::DataPointSet::size ( ) const
inline

Get the current size of the IDataPointSet, i.e.

the number of IDataPoints contained in the set.

Returns
The size of the IDataPointSet.

Definition at line 110 of file DataPointSet.h.

References dset.

Referenced by writeFLAT(), and writeXML().

◆ title()

std::string LWH::DataPointSet::title ( ) const
inline

Get the data set's title.

Returns
The data set's title.

Definition at line 66 of file DataPointSet.h.

References theTitle.

Referenced by setTitle(), writeFLAT(), and writeXML().

◆ upperExtent()

double LWH::DataPointSet::upperExtent ( int  coord) const
inline

Get the upper value for a give axis.

Parameters
coordThe coordinate of the axis.
Returns
The upper edge of the corresponding axis. If coord < 0 or coord >= dimension(), or if the set is empty NaN is returned.

Definition at line 237 of file DataPointSet.h.

References dimension(), and dset.

◆ writeFLAT()

bool LWH::DataPointSet::writeFLAT ( std::ostream &  os,
std::string  path,
std::string  name 
)
inlinevirtual

Write out the data set in a flat text file suitable for eg.

gnuplot to read. The coloums are layed out as 'x1 x2 ... xn dx1+ dx2+ ... dxn+ dx1- dx2- ... dxn-'.

Implements LWH::ManagedObject.

Definition at line 334 of file DataPointSet.h.

References dimension(), name(), point(), size(), and title().

◆ writeXML()

bool LWH::DataPointSet::writeXML ( std::ostream &  os,
std::string  path,
std::string  name 
)
inlinevirtual

Write out the data set in the AIDA xml format.

Implements LWH::ManagedObject.

Definition at line 306 of file DataPointSet.h.

References dimension(), name(), point(), size(), and title().

Member Data Documentation

◆ dim

unsigned int LWH::DataPointSet::dim
private

The dimension of the points in this set.

Definition at line 363 of file DataPointSet.h.

Referenced by dimension().

◆ dset

std::vector<DataPoint> LWH::DataPointSet::dset
private

The included data points.

Definition at line 358 of file DataPointSet.h.

Referenced by addPoint(), clear(), lowerExtent(), point(), removePoint(), scale(), scaleErrors(), scaleValues(), setCoordinate(), size(), and upperExtent().

◆ theTitle

std::string LWH::DataPointSet::theTitle
private

The title.

Definition at line 353 of file DataPointSet.h.

Referenced by name(), setTitle(), and title().


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