BCVariable Class Reference

A class representing a variable of a model. More...

#include <BCVariable.h>

Inheritance diagram for BCVariable:
[legend]

Public Member Functions

Constructors and destructors
 BCVariable ()
 The default constructor. More...
 
 BCVariable (const std::string &name, double lowerlimit, double upperlimit, const std::string &latexname="", const std::string &unitstring="")
 A constructor. More...
 
virtual ~BCVariable ()
 Destructor.
 
Member functions (get)
virtual const std::string & GetPrefix () const
 
virtual const std::string & GetName () const
 
virtual const std::string & GetSafeName () const
 
virtual const std::string & GetLatexName () const
 
virtual const std::string & GetUnitString () const
 
virtual std::string GetLatexNameWithUnits () const
 
virtual double GetLowerLimit () const
 
virtual double GetUpperLimit () const
 
virtual double GetRangeWidth () const
 Returns the range width of the variable values. More...
 
virtual double GetRangeCenter () const
 Returns center of variable range. More...
 
virtual unsigned GetPrecision () const
 
virtual bool FillH1 () const
 
virtual bool FillH2 () const
 
virtual unsigned GetNbins () const
 
Member functions (set)
virtual void SetName (const std::string &name)
 
virtual void SetLatexName (const std::string &latex_name)
 
virtual void SetUnitString (const std::string &unit_string)
 
virtual void SetLowerLimit (double limit)
 Set the lower limit of the variable values. More...
 
virtual void SetUpperLimit (double limit)
 Set the upper limit of the variable values. More...
 
virtual void SetLimits (double lowerlimit=0, double upperlimit=1)
 Set the limits of the variable values. More...
 
virtual void SetPrecision (unsigned precision)
 Set the precision of the output of variable. More...
 
virtual void FillHistograms (bool flag)
 Set the filling of 1D and 2D histograms. More...
 
virtual void FillHistograms (bool fill_1d, bool fill_2d)
 Set the filling of 1D and 2D histograms. More...
 
virtual void FillH1 (bool flag)
 Set the filling of 1D histogram. More...
 
virtual void FillH2 (bool flag)
 Set the filling of 2D histograms. More...
 
virtual void SetNbins (unsigned nbins)
 
Member functions (miscellaneous methods)
virtual bool IsNamed (const std::string &name) const
 Check if name is that of variable. More...
 
virtual bool IsSafeNamed (const std::string &safename) const
 Check if safe name is that of variable. More...
 
virtual double PositionInRange (double x) const
 return position in range of given value from 0 (at lower limit) to 1 (at upper limit) More...
 
virtual double ValueFromPositionInRange (double p) const
 Translate from unit interval to value in variable range. More...
 
virtual void CalculatePrecision (bool force=false)
 Calculate the necessary precision for outputting this parameter and replace current precision is smaller or if force is set true. More...
 
virtual bool IsAtLimit (double value) const
 
virtual bool IsWithinLimits (double value) const
 
virtual void PrintSummary () const
 Prints a variable summary on the screen. More...
 
virtual std::string OneLineSummary (bool print_prefix=true, int name_length=-1) const
 
virtual std::string H1Title () const
 
virtual std::string H2Title (const BCVariable &ordinate) const
 
virtual std::string H3Title (const BCVariable &ordinate_y, const BCVariable &ordinate_z) const
 
virtual TH1 * CreateH1 (const std::string &name) const
 Creates a 1D Histogram for this variable. More...
 
name The name of the histogram.

Creates a 3D Histogram for this variable as the abcissa and a second as the ordinate.

Note
The caller is responsible for deletion of the returned object.
Parameters
ordinate_yThe variable to be used for the y ordinate.
ordinate_zThe variable to be used for the z ordinate.
virtual TH2 * CreateH2 (const std::string &name, const BCVariable &ordinate) const
 
virtual TH3 * CreateH3 (const std::string &name, const BCVariable &ordinate_y, const BCVariable &ordinate_z) const
 
virtual double GetUniformRandomValue (TRandom *const R) const
 Get random value uniformly distributed in range. More...
 

Protected Attributes

bool fFillH1
 Flag to store MCMC samples in 1D histogram.
 
bool fFillH2
 Flag to store MCMC samples in 2D histograms.
 
std::string fLatexName
 The latex name of the variable.
 
double fLowerLimit
 The lower limit of the variable value.
 
std::string fName
 The name of the variable.
 
unsigned fNbins
 The number of equal-size bins used in histograms involving this variable.
 
unsigned fPrecision
 Necessary precision for output.
 
std::string fPrefix
 prefix for output
 
std::string fSafeName
 Safe name of the variable for use in ROOT object naming.
 
std::string fUnitString
 Unit string for variable.
 
double fUpperLimit
 The upper limit of the variable value.
 

Detailed Description

A class representing a variable of a model.

Author
Daniel Greenwald
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
08.2008

This class represents a variable of a model. It contains information about the name and the range of the variable.

Definition at line 35 of file BCVariable.h.

Constructor & Destructor Documentation

BCVariable::BCVariable ( )

The default constructor.

Definition at line 23 of file BCVariable.cxx.

BCVariable::BCVariable ( const std::string &  name,
double  lowerlimit,
double  upperlimit,
const std::string &  latexname = "",
const std::string &  unitstring = "" 
)

A constructor.

Parameters
nameThe name of the variable.
lowerlimitThe lower limit of the variable values.
upperlimitThe upper limit of the variable values.
latexnameThe latex name of the variable used in axis labeling.
unitstringUnit string to be printed for variable.

Definition at line 36 of file BCVariable.cxx.

Member Function Documentation

void BCVariable::CalculatePrecision ( bool  force = false)
virtual

Calculate the necessary precision for outputting this parameter and replace current precision is smaller or if force is set true.

Parameters
forcereplace current precision even if calculated precision is lower than current precision.

Definition at line 70 of file BCVariable.cxx.

TH1 * BCVariable::CreateH1 ( const std::string &  name) const
virtual

Creates a 1D Histogram for this variable.

Note
The caller is responsible for deletion of the returned object.
Parameters
nameName of the histogram.
Returns
pointer to histogram object.

Definition at line 132 of file BCVariable.cxx.

virtual bool BCVariable::FillH1 ( ) const
inlinevirtual
Returns
whether to fill 1D histogram.

Definition at line 124 of file BCVariable.h.

virtual void BCVariable::FillH1 ( bool  flag)
inlinevirtual

Set the filling of 1D histogram.

Definition at line 195 of file BCVariable.h.

virtual bool BCVariable::FillH2 ( ) const
inlinevirtual
Returns
whether to fill 2D histograms.

Definition at line 129 of file BCVariable.h.

virtual void BCVariable::FillH2 ( bool  flag)
inlinevirtual

Set the filling of 2D histograms.

Definition at line 200 of file BCVariable.h.

virtual void BCVariable::FillHistograms ( bool  flag)
inlinevirtual

Set the filling of 1D and 2D histograms.

Parameters
flagToggles filling of 1D and 2D histograms.

Definition at line 183 of file BCVariable.h.

virtual void BCVariable::FillHistograms ( bool  fill_1d,
bool  fill_2d 
)
inlinevirtual

Set the filling of 1D and 2D histograms.

Parameters
fill_1dToggles filling of 1D histogram.
fill_2dToggles filling of 2D histograms.

Definition at line 190 of file BCVariable.h.

virtual const std::string& BCVariable::GetLatexName ( ) const
inlinevirtual
Returns
latex name if set, else identical to GetName().

Definition at line 82 of file BCVariable.h.

virtual std::string BCVariable::GetLatexNameWithUnits ( ) const
inlinevirtual
Returns
latex name with unit string

Definition at line 92 of file BCVariable.h.

virtual double BCVariable::GetLowerLimit ( ) const
inlinevirtual
Returns
The lower limit of the variable values.

Definition at line 97 of file BCVariable.h.

virtual const std::string& BCVariable::GetName ( ) const
inlinevirtual
Returns
The name of the variable.

Definition at line 72 of file BCVariable.h.

virtual unsigned BCVariable::GetNbins ( ) const
inlinevirtual
Returns
Number of bins on axis in 1D and 2D histograms.

Definition at line 134 of file BCVariable.h.

virtual unsigned BCVariable::GetPrecision ( ) const
inlinevirtual
Returns
precision of output

Definition at line 119 of file BCVariable.h.

virtual const std::string& BCVariable::GetPrefix ( ) const
inlinevirtual
Returns
Prefix for name of type of variable ("Parameter", "Observable")

Definition at line 67 of file BCVariable.h.

virtual double BCVariable::GetRangeCenter ( ) const
inlinevirtual

Returns center of variable range.

Definition at line 114 of file BCVariable.h.

virtual double BCVariable::GetRangeWidth ( ) const
inlinevirtual

Returns the range width of the variable values.

It is always a positive value.

Returns
The range width of the variable values.

Definition at line 109 of file BCVariable.h.

virtual const std::string& BCVariable::GetSafeName ( ) const
inlinevirtual
Returns
Safe name of the variable.

Definition at line 77 of file BCVariable.h.

double BCVariable::GetUniformRandomValue ( TRandom *const  R) const
virtual

Get random value uniformly distributed in range.

Parameters
Rrandom number generator to use

Definition at line 159 of file BCVariable.cxx.

virtual const std::string& BCVariable::GetUnitString ( ) const
inlinevirtual
Returns
unit string

Definition at line 87 of file BCVariable.h.

virtual double BCVariable::GetUpperLimit ( ) const
inlinevirtual
Returns
The upper limit of the variable values.

Definition at line 102 of file BCVariable.h.

std::string BCVariable::H1Title ( ) const
virtual
Returns
title appropriate for TH1

Definition at line 109 of file BCVariable.cxx.

std::string BCVariable::H2Title ( const BCVariable ordinate) const
virtual
Returns
title appropriate for TH2
Parameters
ordinateThe variable to be used for the ordinate.

Definition at line 115 of file BCVariable.cxx.

std::string BCVariable::H3Title ( const BCVariable ordinate_y,
const BCVariable ordinate_z 
) const
virtual
Returns
title appropriate for TH3
Parameters
ordinate_yThe variable to be used for the y ordinate.
ordinate_zThe variable to be used for the z ordinate.

Definition at line 123 of file BCVariable.cxx.

bool BCVariable::IsAtLimit ( double  value) const
virtual
Returns
Whether value is at upper or lower limit.

Definition at line 78 of file BCVariable.cxx.

virtual bool BCVariable::IsNamed ( const std::string &  name) const
inlinevirtual

Check if name is that of variable.

Parameters
nameName to check against variable name.

Definition at line 214 of file BCVariable.h.

virtual bool BCVariable::IsSafeNamed ( const std::string &  safename) const
inlinevirtual

Check if safe name is that of variable.

Parameters
safenameSafe name to check against variable name.

Definition at line 220 of file BCVariable.h.

virtual bool BCVariable::IsWithinLimits ( double  value) const
inlinevirtual
Returns
Whether value is within limits.

Definition at line 250 of file BCVariable.h.

std::string BCVariable::OneLineSummary ( bool  print_prefix = true,
int  name_length = -1 
) const
virtual
Returns
A one line summary of the variable.
Parameters
print_prefixWhether to print prefix before variable name.
name_lengthNumber of characters to pad name to (if positive)

Reimplemented in BCParameter.

Definition at line 98 of file BCVariable.cxx.

virtual double BCVariable::PositionInRange ( double  x) const
inlinevirtual

return position in range of given value from 0 (at lower limit) to 1 (at upper limit)

Parameters
xValue to report position of.
Returns
Position of value in range.

Definition at line 228 of file BCVariable.h.

void BCVariable::PrintSummary ( ) const
virtual

Prints a variable summary on the screen.

Definition at line 89 of file BCVariable.cxx.

virtual void BCVariable::SetLatexName ( const std::string &  latex_name)
inlinevirtual
Parameters
latex_nameLatex-formatted name of Variable.

Definition at line 148 of file BCVariable.h.

void BCVariable::SetLimits ( double  lowerlimit = 0,
double  upperlimit = 1 
)
virtual

Set the limits of the variable values.

Parameters
lowerlimitThe lower limit of the variable values.
upperlimitThe upper limit of the variable values.

Reimplemented in BCParameter.

Definition at line 59 of file BCVariable.cxx.

virtual void BCVariable::SetLowerLimit ( double  limit)
inlinevirtual

Set the lower limit of the variable values.

Parameters
limitThe lower limit of the variable values.

Definition at line 159 of file BCVariable.h.

void BCVariable::SetName ( const std::string &  name)
virtual
Parameters
nameThe name of the variable.

Definition at line 52 of file BCVariable.cxx.

virtual void BCVariable::SetPrecision ( unsigned  precision)
inlinevirtual

Set the precision of the output of variable.

Parameters
precisionThe precision of the variable for output.

Definition at line 177 of file BCVariable.h.

virtual void BCVariable::SetUnitString ( const std::string &  unit_string)
inlinevirtual
Parameters
unit_stringString to printed to mark units of variable when needed.

Definition at line 153 of file BCVariable.h.

virtual void BCVariable::SetUpperLimit ( double  limit)
inlinevirtual

Set the upper limit of the variable values.

Parameters
limitThe upper limit of the variable values.

Definition at line 165 of file BCVariable.h.

virtual double BCVariable::ValueFromPositionInRange ( double  p) const
inlinevirtual

Translate from unit interval to value in variable range.

Parameters
pPosition in unit interval (0 = lower limit, 1 = upper limit).
Returns
Value of variable at position in range.

Definition at line 235 of file BCVariable.h.


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