BCVariableSet< T > Class Template Reference

Wrapper to allow access by name into list of BCVariable. More...

#include <BCVariableSet.h>

Public Member Functions

virtual bool Add (const T &var)
 Add a variable if no variable of same name exists yet. More...
 
virtual bool Add (const std::string &name, double min, double max, const std::string &latexname="", const std::string &unitstring="")
 Add a variable. More...
 
virtual T & At (unsigned index)
 Safe access, but slightly less efficient access to parameter. More...
 
virtual const T & At (unsigned index) const
 Safe access, but slightly less efficient access to parameter. More...
 
virtual T & Back ()
 Access to last pushed variable. More...
 
virtual const T & Back () const
 Access to last pushed variable. More...
 
 BCVariableSet ()
 Constructor.
 
virtual bool Empty () const
 Whether container is empty.
 
virtual void FillH1 (bool flag)
 Set fill-histograms flag for all 1D histograms for all parameters. More...
 
virtual void FillH2 (bool flag)
 Set fill-histograms flag for all 2D histograms for all parameters. More...
 
virtual void FillHistograms (bool flag)
 Set fill-histograms flag for 1D and 2D histograms for all parameters. More...
 
virtual void FillHistograms (bool flag_1d, bool flag_2d)
 Set fill-histograms flag for 1D and 2D histograms for all parameters. More...
 
virtual T & Get (const std::string &name)
 Safe access, but slightly less efficient access to parameter. More...
 
virtual const T & Get (const std::string &name) const
 Safe access, but slightly less efficient access to parameter. More...
 
virtual std::vector< double > GetRangeCenters () const
 
virtual std::vector< double > GetUniformRandomValues (TRandom *const R) const
 Get vector of uniformly distributed random values. More...
 
virtual unsigned Index (const std::string &name) const
 Find index of parameter identified by name; return Size() if name not found. More...
 
virtual bool IsWithinLimits (const std::vector< double > &x) const
 
virtual unsigned MaxNameLength () const
 
virtual T & operator[] (unsigned index)
 Raw and fast access. More...
 
virtual const T & operator[] (unsigned index) const
 Raw and fast access. More...
 
virtual std::vector< double > PositionInRange (const std::vector< double > &x) const
 return positions in ranges of given values from 0 (at lower limit) to 1 (at upper limit) for each variable in the set. More...
 
virtual void PrintSummary () const
 Print summary of variable set to logs. More...
 
virtual void SetNBins (unsigned nbins)
 Set number of bins for all parameters. More...
 
virtual void SetPrecision (unsigned n)
 Set precision for output of all parameters. More...
 
virtual unsigned Size () const
 Number of variables contained.
 
virtual void ValueFromPositionInRange (std::vector< double > &p) const
 Translate from unit interval to values in variable ranges. More...
 
virtual double Volume () const
 

Protected Attributes

unsigned fMaxNameLength
 Maximum length (in characters) of variable names. More...
 
std::vector< T > fVars
 Vector of BCVariables that forms the set. More...
 

Detailed Description

template<class T>
class BCVariableSet< T >

Wrapper to allow access by name into list of BCVariable.

Author
Frederik Beaujean
Daniel Greenwald
Note
Variables are owned by and will be deleted by BCVariableSet.

Definition at line 35 of file BCVariableSet.h.

Member Function Documentation

template<class T>
virtual bool BCVariableSet< T >::Add ( const T &  var)
inlinevirtual

Add a variable if no variable of same name exists yet.

Parameters
varVariable
Returns
Success of action.

Definition at line 56 of file BCVariableSet.h.

template<class T>
virtual bool BCVariableSet< T >::Add ( const std::string &  name,
double  min,
double  max,
const std::string &  latexname = "",
const std::string &  unitstring = "" 
)
inlinevirtual

Add a variable.

Parameters
nameName of variable
minminimum value of the variable
maxmaximum value of the variable
latexnameOptional latexname used for plotting
unitstringUnit string to be printed for variable
Returns
Success of action.

Definition at line 83 of file BCVariableSet.h.

template<class T>
virtual T& BCVariableSet< T >::At ( unsigned  index)
inlinevirtual

Safe access, but slightly less efficient access to parameter.

Parameters
indexIndex gets checked.
Returns
The pointer at index position or NULL if invalid index.

Definition at line 120 of file BCVariableSet.h.

template<class T>
virtual const T& BCVariableSet< T >::At ( unsigned  index) const
inlinevirtual

Safe access, but slightly less efficient access to parameter.

Parameters
indexIndex gets checked.
Returns
The pointer at index position or NULL if invalid index.

Definition at line 127 of file BCVariableSet.h.

template<class T>
virtual T& BCVariableSet< T >::Back ( )
inlinevirtual

Access to last pushed variable.

Definition at line 146 of file BCVariableSet.h.

template<class T>
virtual const T& BCVariableSet< T >::Back ( ) const
inlinevirtual

Access to last pushed variable.

Definition at line 151 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::FillH1 ( bool  flag)
inlinevirtual

Set fill-histograms flag for all 1D histograms for all parameters.

Parameters
flagFilling flag.

Definition at line 210 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::FillH2 ( bool  flag)
inlinevirtual

Set fill-histograms flag for all 2D histograms for all parameters.

Parameters
flagFilling flag.

Definition at line 219 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::FillHistograms ( bool  flag)
inlinevirtual

Set fill-histograms flag for 1D and 2D histograms for all parameters.

Parameters
flagFilling flag for both 1D and 2D histograms.

Definition at line 197 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::FillHistograms ( bool  flag_1d,
bool  flag_2d 
)
inlinevirtual

Set fill-histograms flag for 1D and 2D histograms for all parameters.

Parameters
flag_1dFilling flag for 1D histograms.
flag_2dFilling flag for 2D histograms.

Definition at line 204 of file BCVariableSet.h.

template<class T>
virtual T& BCVariableSet< T >::Get ( const std::string &  name)
inlinevirtual

Safe access, but slightly less efficient access to parameter.

Parameters
nameLook up name in list
Returns
The pointer at index position or NULL if invalid index.

Definition at line 134 of file BCVariableSet.h.

template<class T>
virtual const T& BCVariableSet< T >::Get ( const std::string &  name) const
inlinevirtual

Safe access, but slightly less efficient access to parameter.

Parameters
nameLook up name in list
Returns
The pointer at index position or NULL if invalid index.

Definition at line 141 of file BCVariableSet.h.

template<class T>
virtual std::vector<double> BCVariableSet< T >::GetRangeCenters ( ) const
inlinevirtual
Returns
vector of range centers.

Reimplemented in BCParameterSet.

Definition at line 281 of file BCVariableSet.h.

template<class T>
virtual std::vector<double> BCVariableSet< T >::GetUniformRandomValues ( TRandom *const  R) const
inlinevirtual

Get vector of uniformly distributed random values.

Parameters
RRandom number generator to use.
Returns
vector of random values uniformly distributed in variable ranges.

Reimplemented in BCParameterSet.

Definition at line 293 of file BCVariableSet.h.

template<class T>
virtual unsigned BCVariableSet< T >::Index ( const std::string &  name) const
inlinevirtual

Find index of parameter identified by name; return Size() if name not found.

Definition at line 157 of file BCVariableSet.h.

template<class T>
virtual bool BCVariableSet< T >::IsWithinLimits ( const std::vector< double > &  x) const
inlinevirtual
Returns
Whether values are within limits of variables.

Reimplemented in BCParameterSet.

Definition at line 244 of file BCVariableSet.h.

template<class T>
virtual unsigned BCVariableSet< T >::MaxNameLength ( ) const
inlinevirtual
Returns
Length of longest parameter name.

Definition at line 227 of file BCVariableSet.h.

template<class T>
virtual T& BCVariableSet< T >::operator[] ( unsigned  index)
inlinevirtual

Raw and fast access.

Parameters
indexIndex
Returns
Variable

Definition at line 106 of file BCVariableSet.h.

template<class T>
virtual const T& BCVariableSet< T >::operator[] ( unsigned  index) const
inlinevirtual

Raw and fast access.

Parameters
indexIndex
Returns
Variable

Definition at line 113 of file BCVariableSet.h.

template<class T>
virtual std::vector<double> BCVariableSet< T >::PositionInRange ( const std::vector< double > &  x) const
inlinevirtual

return positions in ranges of given values from 0 (at lower limit) to 1 (at upper limit) for each variable in the set.

Parameters
xvector of values to report positions of.
Returns
vector of positions of values in ranges.

Definition at line 260 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::PrintSummary ( ) const
inlinevirtual

Print summary of variable set to logs.

Definition at line 303 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::SetNBins ( unsigned  nbins)
inlinevirtual

Set number of bins for all parameters.

Parameters
nbinsNumber of bins.

Definition at line 179 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::SetPrecision ( unsigned  n)
inlinevirtual

Set precision for output of all parameters.

Parameters
nNumber of significant digits for printing.

Definition at line 188 of file BCVariableSet.h.

template<class T>
virtual void BCVariableSet< T >::ValueFromPositionInRange ( std::vector< double > &  p) const
inlinevirtual

Translate from unit interval to values in variable ranges.

Parameters
pvector of positions in the unit interval (0 = lower limit, 1 = upper limit).

Reimplemented in BCParameterSet.

Definition at line 271 of file BCVariableSet.h.

template<class T>
virtual double BCVariableSet< T >::Volume ( ) const
inlinevirtual
Returns
Volume of set.

Reimplemented in BCParameterSet.

Definition at line 232 of file BCVariableSet.h.

Member Data Documentation

template<class T>
unsigned BCVariableSet< T >::fMaxNameLength
protected

Maximum length (in characters) of variable names.

Definition at line 318 of file BCVariableSet.h.

template<class T>
std::vector<T> BCVariableSet< T >::fVars
protected

Vector of BCVariables that forms the set.

BCVariables are not owned by set, and are not deleted upon deletion of set.

Definition at line 314 of file BCVariableSet.h.


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