TTTT Analysis  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
fv::DerivedValue< T > Class Template Referenceabstract

A generic, derived, value. More...

#include <value.hpp>

Inheritance diagram for fv::DerivedValue< T >:
Inheritance graph
[legend]
Collaboration diagram for fv::DerivedValue< T >:
Collaboration graph
[legend]

Public Member Functions

 DerivedValue (const std::string &name, const std::string &alias="")
 
T & get_value ()
 Calculate, if necessary, and return the value held by this object.
 
- Public Member Functions inherited from fv::Value< T >
 Value (const std::string &name, const std::string &alias="")
 
- Public Member Functions inherited from fv::GenValue
 GenValue (const std::string &name, const std::string &alias)
 
const std::string & get_name ()
 

Protected Member Functions

virtual void update_value ()=0
 Updates the internal value. More...
 

Protected Attributes

value
 
bool value_valid
 

Private Member Functions

void _reset ()
 Mark the internal value as invalid. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from fv::GenValue
static void reset ()
 
static GenValueget_value (const std::string &name)
 
static void alias (const std::string &name, GenValue *value)
 
static GenValuealias (const std::string &name)
 
static std::string summary ()
 
- Static Protected Attributes inherited from fv::GenValue
static std::map< const std::string, GenValue * > values
 A static mapping containing all created Value objects. More...
 
static std::map< const std::string, GenValue * > aliases
 Composite value names are typically nested. More...
 

Detailed Description

template<typename T>
class fv::DerivedValue< T >

A generic, derived, value.

A DerivedValue is generally defined as some function of other Value objects. For example, a Pair is a function of two other Value objects that makes a pair of them. Note that these other Value objects are free to be either ObservedValues or other DerivedValues.

It is desireable from a performance standpoint that each DerivedValue be calculated no more than once per observation. Therefore, when a get_value is called on a DerivedValue, it first checks whether the value that it holds is valid, meaning it has already been calculated for this observation. If so, it simply returns the value. If not, the update_value function is called to calculate the value. and then the newly calculated value is marked as valid and returned.

Member Function Documentation

§ _reset()

template<typename T>
void fv::DerivedValue< T >::_reset ( )
inlineprivatevirtual

Mark the internal value as invalid.

This is needed for DerivedValue to force a recalculation of the internal value when a new observation is loaded into memory. It is called automatically for all GenValue objects when reset is called.

Implements fv::GenValue.

§ update_value()

template<typename T>
virtual void fv::DerivedValue< T >::update_value ( )
protectedpure virtual

Updates the internal value.

This function should be overridden by any child class to do the actual work of updating value based on whatever rules the class chooses. Normally, this consists of geting the values from some associated Value objects, doing some calculation on them, and storing the result in value.

Implemented in fv::ConstantValue< T >, fv::PointerValue< T >, fv::BoundValue< T >, fv::ReduceIndex< T >, fv::Reduce< T >, fv::Count< T >, fv::ZipMapFour< R, T >, fv::Pair< T1, T2 >, fv::WrapperVector< T >, fv::Filter, fv::root::LorentzVectorEnergy, fv::root::LorentzVector, and fv::root::MassFilter.


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