FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
frib::analysis::CTreeParameter Class Reference
Collaboration diagram for frib::analysis::CTreeParameter:
Collaboration graph
[legend]

Classes

struct  _SharedData
 

Public Types

typedef struct frib::analysis::CTreeParameter::_SharedData SharedData
 
typedef struct frib::analysis::CTreeParameter::_SharedDatapSharedData
 

Public Member Functions

 CTreeParameter ()
 
 CTreeParameter (std::string name)
 
 CTreeParameter (std::string name, std::string units)
 
 CTreeParameter (std::string name, double lowLimit, double highLimit, std::string units)
 
 CTreeParameter (std::string name, unsigned channels, double lowLimit, double highLimit, std::string units)
 
 CTreeParameter (std::string name, unsigned resolution)
 
 CTreeParameter (std::string name, unsigned resolution, double lowLimit, double widthOrHigh, std::string units, bool widthOrHighGiven)
 
 CTreeParameter (std::string name, const CTreeParameter &Template)
 
 CTreeParameter (const CTreeParameter &rhs)
 
 ~CTreeParameter ()
 
void Initialize (std::string name, unsigned resolution)
 
void Initialize (std::string name, unsigned resolution, double lowLimit, double highOrWidth, std::string units, bool highOrWidthGiven)
 
void Initialize (std::string name)
 
void Initialize (std::string name, std::string units)
 
void Initialize (std::string name, unsigned channels, double lowLimit, double highLimit, std::string units)
 
bool isBound () const
 
 operator double () const
 
CTreeParameteroperator= (double newValue)
 
CTreeParameteroperator= (const CTreeParameter &rhs)
 
CTreeParameteroperator+= (double rhs)
 
CTreeParameteroperator-= (double rhs)
 
CTreeParameteroperator*= (double rhs)
 
CTreeParameteroperator/= (double rhs)
 
double operator++ (int dummy)
 
CTreeParameteroperator++ ()
 
double operator-- (int dummy)
 
CTreeParameteroperator-- ()
 
std::string getName () const
 
unsigned getId () const
 
double getValue () const
 
void setValue (double newValue)
 
unsigned getBins () const
 
void setBins (unsigned channels)
 
double getStart () const
 
void setStart (double low)
 
double getStop () const
 
void setStop (double high)
 
double getInc () const
 
void setInc (double channelWidth)
 
std::string getUnit () const
 
void setUnit (std::string units)
 
bool isValid () const
 
void setInvalid ()
 
void Reset ()
 
void clear ()
 
bool hasChanged () const
 
void setChanged ()
 
void resetChanged ()
 
void Bind ()
 

Static Public Member Functions

static void nextEvent ()
 
static std::vector< std::pair< unsigned, double > > collectEvent ()
 
static void setDefaultLimits (double low, double high)
 
static void setDefaultBins (unsigned bins)
 
static void setDefaultUnits (const char *units)
 
static void BindParameters ()
 
static void setEvent (...)
 
static const std::vector< double > & getEvent ()
 
static const std::vector< unsigned > getScoreboard ()
 
static std::vector< std::pair< std::string, SharedData > > getDefinitions ()
 
static void ResetAll ()
 

Static Public Attributes

static SharedData m_defaultSpecification
 

Constructor & Destructor Documentation

◆ CTreeParameter() [1/9]

frib::analysis::CTreeParameter::CTreeParameter ( )

Constructors of instances of CTreeParameter: default constructor Well actually I'd prefer to phase this out, however legacy code that constructed and then initialized might use this:

  • The name is set empty.
  • the definition point is set null.

Someone better invoke initialize on this before doing anything meaningful or there could be hell to pay:

◆ CTreeParameter() [2/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name)

construct with only the name. Initialize with all the default definitions.

Parameters
name- name of the object.

◆ CTreeParameter() [3/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
std::string  units 
)

construct with the units overriding the defaults.

Parameters
name- tree parameter name.
units- units of measure.

◆ CTreeParameter() [4/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
double  lowLimit,
double  highLimit,
std::string  units 
)

construct withy low, high and units overriding the defaaults.

Parameters
name-name of the parameter
lowLimit- suggested low limit
highLimit- suggested high limit
units-units of measure.

◆ CTreeParameter() [5/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
unsigned  channels,
double  lowLimit,
double  highLimit,
std::string  units 
)

constructor fully specified:

Parameters
name- name of the parameter.
channels- suggested bins.
lowLimit,highLimit- suggested axis limits.
units- units of measure.

◆ CTreeParameter() [6/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
unsigned  resolution 
)

constructor for simple raw parameter.

Parameters
name- name of parameter.
resolution- bits of resolution e.g. 0-2^resolution with 2^resolution channels.

◆ CTreeParameter() [7/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
unsigned  resolution,
double  lowLimit,
double  widthOrHigh,
std::string  units,
bool  widthOrHighGiven 
)

This constructor is no longer supported because it's too wonky, and overdetermined to boot. convince me otherwise.

◆ CTreeParameter() [8/9]

frib::analysis::CTreeParameter::CTreeParameter ( std::string  name,
const CTreeParameter t 
)

Construct a tree parameter from an existing one (just a different name).

Parameters
name- name of the new tree parameter.
t- the existing tree parameter that will be duplicated into the new one.

◆ CTreeParameter() [9/9]

frib::analysis::CTreeParameter::CTreeParameter ( const CTreeParameter rhs)

Copy construction.

◆ ~CTreeParameter()

frib::analysis::CTreeParameter::~CTreeParameter ( )

Destructor is no-op now:

Member Function Documentation

◆ Bind()

void frib::analysis::CTreeParameter::Bind ( )

Bind Bind the parameter to a slot. If the parameter is already bound, this is a no-op. The metadata values will be those of the default.

◆ BindParameters()

void frib::analysis::CTreeParameter::BindParameters ( )
static

BindParameters Supplied only for compatiblity - parameters are bound as they are created because the old SpecTcl parameters that are not tree parameters don't exist in this incarnation of the world.

◆ collectEvent()

std::vector< std::pair< unsigned, double > > frib::analysis::CTreeParameter::collectEvent ( )
static

collectEvent Using the scoreboard and the event, return a vector of pairs that describe the event contents. The first element of each pair is the parameter number while the second element is the parameter value for all elements parameters that have been set this event.

Returns
std::vector<std::pair<unsigned, double> - see above.
Note
if, somehow the scoreboard has an invalid index, std::out_of_range is throw.

◆ getBins()

unsigned frib::analysis::CTreeParameter::getBins ( ) const

getBins

Returns
unsigned - number of bins suggested for this parameter.
Exceptions
std::logic_error- if we are not yet bound.

◆ getDefinitions()

std::vector< std::pair< std::string, CTreeParameter::SharedData > > frib::analysis::CTreeParameter::getDefinitions ( )
static

getDefinitions

Returns
std::vector<std::pair<std::string, SharedData> - the tree parameter definitions.
Note
- tree parameter vectors will appear as several entries in this vector.

◆ getEvent()

const std::vector< double > & frib::analysis::CTreeParameter::getEvent ( )
static

getEvent

Returns
const std::vector<double>& - reference to the event vector.

◆ getId()

unsigned frib::analysis::CTreeParameter::getId ( ) const

getId

  • Requires that the parameter is bound to a slot.
    Returns
    unsigned - parameter number binding
    Exceptions
    std::logic_errorif the parameter is not bound.

◆ getInc()

double frib::analysis::CTreeParameter::getInc ( ) const

getInc Get the width of a channel, in parameter value. This is just high - low / bins.

Returns
double - width of a channel
Exceptions
std::logic_error- if not bound yet.
Note
this can be negative if the axis is 'backwards' (high < low).

◆ getName()

std::string frib::analysis::CTreeParameter::getName ( ) const

getters/setters and testers. getName

Returns
std::string - the tree parameter name.

◆ getScoreboard()

const std::vector< unsigned > frib::analysis::CTreeParameter::getScoreboard ( )
static

getScoreboard

Returns
const std::vector<unsigned>& - referencde to the event scoreboard.

◆ getStart()

double frib::analysis::CTreeParameter::getStart ( ) const

getStart

Returns
double - the suggested low limit for histograms.
Exceptions
std::logic_errorif not bound.

◆ getStop()

double frib::analysis::CTreeParameter::getStop ( ) const

getStop

Returns
double - the suggested high axis value for this parameter.
Exceptions
std::Logic_error- if the parameter is not yet bound.

◆ getUnit()

std::string frib::analysis::CTreeParameter::getUnit ( ) const

getUnit

Returns
std::string - the units of measure of the parameter.
Exceptions
std::Logic_errorif the parameter has not yet been bound.

◆ getValue()

double frib::analysis::CTreeParameter::getValue ( ) const

getValue Return the current value of the parameter.

  • The parameter must be bound.
  • The parameter must have been assigned to for this event.
    Returns
    double - the parameter's value for this event.
    Exceptions
    std::logic_error- the parameter is not bound.
    std::range_error- the parameter has no value yet.

◆ hasChanged()

bool frib::analysis::CTreeParameter::hasChanged ( ) const

hasChanged Parameter metatdata has, associated with it, a flag that indicates if it any metadata has been modified in the course of running the program. This can be used, in large parameter spaces, to limit the set of parameter definitions that are output.

Returns
bool if the parameter's metadata has changed.
Exceptions
std::logic_error- if not bound.

◆ Initialize() [1/5]

void frib::analysis::CTreeParameter::Initialize ( std::string  name,
unsigned  resolution 
)

Initialize These overloads do the actual heavy lifting of creating a tree parameter Note that all of these funnel into the fully specified Initialize. Initialize

Parameters
name- name of the parameter.
resolution- the number of bits of resolution.

◆ Initialize() [2/5]

void frib::analysis::CTreeParameter::Initialize ( std::string  name,
unsigned  resolution,
double  lowLimit,
double  highOrWidth,
std::string  units,
bool  highOrWidthGiven 
)

Initialize This is no longer available - it's over determined and wonky to boot.

◆ Initialize() [3/5]

void frib::analysis::CTreeParameter::Initialize ( std::string  name)

Initialize With only the name and everything else default:

Parameters
name- the parameter name.

◆ Initialize() [4/5]

void frib::analysis::CTreeParameter::Initialize ( std::string  name,
std::string  units 
)

Initialize WIth just the name and units.

Parameters
name- name of the parameter.
units- units of measure

◆ Initialize() [5/5]

void frib::analysis::CTreeParameter::Initialize ( std::string  name,
unsigned  channels,
double  lowLimit,
double  highLimit,
std::string  units 
)

Initialize (full)

  • If there's already a shared data associated with this, overwrite it with the requested metadata.
  • If there's not a shared data associated with this, create it.
    Note
    If the tree parameter is bound and the name is different than its current binding it will be bound to a different parameter.
    Parameters
    name- name of the parameter.
    channes- suggested channels

◆ isBound()

bool frib::analysis::CTreeParameter::isBound ( ) const

isBound A parameter is bound if it has shared data:

Returns
bool - true if the parameter is bound.

◆ isValid()

bool frib::analysis::CTreeParameter::isValid ( ) const

isValid

Returns
bool - true if the parameter has been set
Exceptions
std::logic_errorif the parameter is not yet bound.

◆ nextEvent()

void frib::analysis::CTreeParameter::nextEvent ( )
static

Static Method implementations: nextEvent

  • Increments m_generation.
  • Clears m_scorecard This sufficient to set all tree parameters to invalid and to have an empty event for collectEvent().

◆ operator double()

frib::analysis::CTreeParameter::operator double ( ) const

Support for treating instances as doubles. Note all fetches are via getValue and sets via setValue so the validity handling is done in a single spot. operator double() Convert value to a double.

Returns
double.
Exceptions
std::Logic_errorif the value is invalid or not bound.

◆ operator*=()

CTreeParameter & frib::analysis::CTreeParameter::operator*= ( double  rhs)

operator *=

Parameters
rhsvalue ot multiply this by

◆ operator++()

CTreeParameter & frib::analysis::CTreeParameter::operator++ ( )

pre-increment

Returns
*this

◆ operator+=()

CTreeParameter & frib::analysis::CTreeParameter::operator+= ( double  rhs)

operator+= Add to from double

Parameters
rhs- double to add to this.

◆ operator--() [1/2]

double frib::analysis::CTreeParameter::operator-- ( int  dummy)

post decrement

Returns
double

◆ operator--() [2/2]

CTreeParameter & frib::analysis::CTreeParameter::operator-- ( )

pre-decrement

Returns
*this

◆ operator-=()

CTreeParameter & frib::analysis::CTreeParameter::operator-= ( double  rhs)

operator-= Subtract double from us.

Parameters
rhsvalue to subtract

◆ operator/=()

CTreeParameter & frib::analysis::CTreeParameter::operator/= ( double  rhs)

operator /=

Parameters
rhsvalue to divide us by

◆ operator=() [1/2]

CTreeParameter & frib::analysis::CTreeParameter::operator= ( double  newValue)

operator= - assign from double.

Parameters
newValue-the double to assign to this.
Returns
*this.

◆ operator=() [2/2]

CTreeParameter & frib::analysis::CTreeParameter::operator= ( const CTreeParameter rhs)

operator= assign from another tree parameter.

Parameters
rhs- tree parameter to get the data fromm.
Returns
*this.

◆ Reset()

void frib::analysis::CTreeParameter::Reset ( )

Reset, clear Synonyms for setInvalid:

◆ ResetAll()

void frib::analysis::CTreeParameter::ResetAll ( )
static

ResetAll Synonym for nextEvent

◆ resetChanged()

void frib::analysis::CTreeParameter::resetChanged ( )

resetChanged Clear the metadata changed flag.

◆ setBins()

void frib::analysis::CTreeParameter::setBins ( unsigned  channels)

setBins Set a new suggested bin count for the parameter. This also sets the changed flag.

Parameters
channels- new suggested binning.
Exceptions
std::logic_error- the parameter is not bound.
std::range_error- the new channel count is zero.

◆ setChanged()

void frib::analysis::CTreeParameter::setChanged ( )

setChanged Set the changed flag in the parameter.

◆ setDefaultBins()

void frib::analysis::CTreeParameter::setDefaultBins ( unsigned  bins)
static

setDefaultBins Set the number of bins that will be used for tree parameters that have not specified this.

Parameters
bins- number of bins.

◆ setDefaultLimits()

void frib::analysis::CTreeParameter::setDefaultLimits ( double  low,
double  high 
)
static

setDefaultLimits Set the default limits value that will be used for tree parameters that have not had those limits specified.

Parameters
low- Low limit.
high- high limit.

◆ setDefaultUnits()

void frib::analysis::CTreeParameter::setDefaultUnits ( const char *  units)
static

setDefaultUnits Set the units string that will be associated with tree parameters that have not specified this information.

Parameters
units-new default units.

◆ setEvent()

void frib::analysis::CTreeParameter::setEvent (   ...)
static

setEvent Supplied only for compatibility. This incarnation of tree paramter maintains a static vector that is the event.

◆ setInc()

void frib::analysis::CTreeParameter::setInc ( double  channelWidth)

setInc Set the channel width. This just means adjusting bins so that the high-low/bins = inc. If high -low == 0 we set 0 for bins.

Parameters
channelWidth- noew channel width.
Exceptions
std::logic_errorif the parameter is not bound.
Note
- the actual increment may only be an approximation since the bins are integer typed.

◆ setInvalid()

void frib::analysis::CTreeParameter::setInvalid ( )

setInvalid

  • If the parameter is not bound throw logic_error.,
  • If the parameter's generation is the same as current:

    Remove its index from the set of indices in the scoreboard.

Set the generation to one less than current.

◆ setStart()

void frib::analysis::CTreeParameter::setStart ( double  low)

setStart Set a new low value for the suggested histograms.

Parameters
low- new vlaue to use.
Exceptions
std::logic_error-if the parameter is not yet bound.

◆ setStop()

void frib::analysis::CTreeParameter::setStop ( double  high)

setStop

Parameters
high- new stop value.
Exceptions
std::logic_error-if the parameter is not yet bound.

◆ setUnit()

void frib::analysis::CTreeParameter::setUnit ( std::string  units)

setUnit Change the units of measure for the parameter.

Parameters
units- new units of measure. std::Logic_error - if not bound.

◆ setValue()

void frib::analysis::CTreeParameter::setValue ( double  newValue)

setValue Set the parameter to a new value and do the book-keeping needed to ensure that the world knows our value is valid.

Parameters
newValue- new value to assign to *this.
Exceptions
std::logic_errorif the tree parameter is not yet bound.

Member Data Documentation

◆ m_defaultSpecification

CTreeParameter::SharedData frib::analysis::CTreeParameter::m_defaultSpecification
static
Initial value:
= {
.s_low = 0,
.s_high = 100,
.s_chans = 100,
.s_units = "Chans"
}

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