CFEL - ASG Software Suite
2.5.0
CASS
|
result averaging. More...
#include <operations.h>
Public Member Functions | |
pp61 (const name_t &name) | |
constructor More... | |
virtual void | process (const CASSEvent &, result_t &) |
process event More... | |
virtual void | loadSettings (size_t) |
load the settings More... | |
Public Member Functions inherited from cass::AccumulatingProcessor | |
AccumulatingProcessor (const name_t &name) | |
constructor More... | |
virtual | ~AccumulatingProcessor () |
virtual destructor More... | |
virtual void | processEvent (const CASSEvent &evt) |
process the event More... | |
virtual const result_t & | result (const CASSEvent::id_t) |
retrieve a result. More... | |
virtual void | releaseEvent (const CASSEvent &) |
overwrite default behaviour to do nothing More... | |
virtual void | createHistList (result_t::shared_pointer result) |
create the list of results More... | |
Public Member Functions inherited from cass::Processor | |
Processor (const name_t &name) | |
constructor More... | |
virtual | ~Processor () |
virtual destructor More... | |
result_t::shared_pointer | resultCopy (const uint64_t eventid) |
retrieve histogram for id More... | |
virtual void | load () |
load the general settings More... | |
virtual void | aboutToQuit () |
function that will be called when the processor is about to be deleted More... | |
const names_t & | dependencies () |
Define all processors keys a processor depends on. More... | |
void | clearDependencies () |
clear the dependenies More... | |
void | clearHistograms () |
clear the histograms More... | |
virtual void | processCommand (std::string command) |
process command in pp More... | |
const name_t | name () const |
retrieve the name of this processor More... | |
bool | hide () const |
retrieve the hide flag of this processor More... | |
const std::string & | comment () const |
retrieve the comment of this processor More... | |
Protected Member Functions | |
result_t::value_t | average (result_t::value_t val, result_t::value_t aveOld, result_t::value_t scale) |
function for normal averaging. More... | |
result_t::value_t | squareAverage (result_t::value_t val, result_t::value_t aveOld, result_t::value_t scale) |
function that will calculate the square average More... | |
result_t::value_t | cumulativeScale () |
retrieve the cumulative scale for the current datum More... | |
result_t::value_t | movingScale () |
retrieve the moving average scale after the initialization of the "first" point More... | |
result_t::value_t | movingInitializationScale () |
retrieve the moving average scale during the initialization More... | |
Protected Member Functions inherited from cass::Processor | |
virtual void | createHistList (result_t::shared_pointer result) |
create result list. More... | |
void | setupGeneral () |
general setup of the processor More... | |
bool | setupCondition (bool defaultConditionType=true) |
setup the condition. More... | |
shared_pointer | setupDependency (const std::string &depVarName, const name_t &name="") |
setup the dependecy. More... | |
Protected Attributes | |
result_t::value_t | _alpha |
alpha for the running average More... | |
std::tr1::function< result_t::value_t(result_t::value_t, result_t::value_t, result_t::value_t)> | _func |
function that will do the averagin More... | |
std::tr1::function< result_t::value_t()> | _scale |
function that will return the scale that should be used for the average More... | |
shared_pointer | _pHist |
processor containing result to average More... | |
Protected Attributes inherited from cass::AccumulatingProcessor | |
result_t::shared_pointer | _result |
the result that accumulates the events More... | |
size_t | _nbrEventsAccumulated |
the number of events the processor has accumulated More... | |
Protected Attributes inherited from cass::Processor | |
const name_t | _name |
the processors name More... | |
bool | _hide |
flag to tell whether this pp should be hidden in the dropdown list More... | |
std::string | _comment |
optional comment that one can add to a processor. More... | |
CachedList | _resultList |
the list of results More... | |
names_t | _dependencies |
the list of dependencies More... | |
shared_pointer | _condition |
pointer to the processor that will contain the condition More... | |
Additional Inherited Members | |
Public Types inherited from cass::Processor | |
typedef std::tr1::shared_ptr< Processor > | shared_pointer |
a shared pointer of this More... | |
typedef std::string | name_t |
define the name type More... | |
typedef std::list< name_t > | names_t |
define the list of names More... | |
typedef CachedList::item_type | result_t |
define the results More... | |
typedef CachedList::item_sp | resultsp_t |
define the shared pointer to the result More... | |
result averaging.
Running or cummulative average of a result. Could also be a squared average.
Processor/%name%/{AveragingType}
The type of averaging that should be performed. Default is "Normal"
Processor/%name%/{NbrOfAverages}
how many images should be averaged. When value is 0 its a cummulative average. Default is 1.
Processor/%name%/{InputName}
processor name containing the result that we average.
Definition at line 1096 of file operations.h.
pp61::pp61 | ( | const name_t & | name | ) |
|
protected |
function for normal averaging.
this operator is capable of performing a cumulative moving average and a Exponential moving average.
the operator calculates the average using the function where when is equal to N it is a cumulative moving average, otherwise it will be a exponential moving average.
val | the current value to be added to the average |
aveOld | the old average |
scale | the scale with which the new value will be weighted |
Definition at line 1536 of file operations.cpp.
Referenced by loadSettings().
|
inlineprotected |
retrieve the cumulative scale for the current datum
Definition at line 1145 of file operations.h.
References cass::AccumulatingProcessor::_nbrEventsAccumulated.
Referenced by loadSettings(), and movingInitializationScale().
|
virtual |
load the settings
: In case we're running a moving average (_alpha is non-zero), we need to initialize the the first value of the moving average. Here we initialize it with the mean of the first datapoints, meaning we'll check if the _alpha calculated for the cumulative averaging is still larger than the _alpha for the moving averge. If its smaller than the _alpha of the cumulative average it means that the current datum will not have as much weight. Therefore from this point onward, we should use the _alpha of the moving averge to start "forgetting" older values by putting comparatively more weight on the newer datums.
: initialize the result to be zero, otherwise the cumulatinve averaging won't produce correct results
Reimplemented from cass::Processor.
Definition at line 1483 of file operations.cpp.
References _alpha, cass::Processor::_condition, _func, _pHist, cass::AccumulatingProcessor::_result, _scale, cass::Log::add(), average(), QSettings::beginGroup(), cass::AccumulatingProcessor::createHistList(), cumulativeScale(), QString::fromStdString(), cass::Log::INFO, movingInitializationScale(), cass::Processor::name(), cass::Processor::setupCondition(), cass::Processor::setupDependency(), cass::Processor::setupGeneral(), squareAverage(), cass::toString(), and QSettings::value().
Referenced by pp61().
|
protected |
retrieve the moving average scale during the initialization
when the first value of the moving avererage has been initialized (see comment above), we can then procede by using the moving average's _alpha
Definition at line 1550 of file operations.cpp.
References _alpha, _scale, cumulativeScale(), and movingScale().
Referenced by loadSettings().
|
inlineprotected |
retrieve the moving average scale after the initialization of the "first" point
Definition at line 1153 of file operations.h.
References _alpha.
Referenced by movingInitializationScale().
process event
: the nbr of accumulated events needs to be increased BEFORE calculating the scale because the cumulative scale expect the scale to be
Reimplemented from cass::Processor.
Definition at line 1564 of file operations.cpp.
References _func, cass::AccumulatingProcessor::_nbrEventsAccumulated, _pHist, _scale, cass::Result< T >::begin(), cass::Result< T >::datasize(), cass::CASSEvent::id(), and cass::Result< T >::lock.
|
protected |
function that will calculate the square average
the operator calculates the square average using the function where when is equal to N it is a cumulative moving average.
val | the current value to be added to the average |
aveOld | the old average |
scale | the scale with which the new value will be weighted |
Definition at line 1543 of file operations.cpp.
Referenced by loadSettings().
|
protected |
alpha for the running average
Definition at line 1160 of file operations.h.
Referenced by loadSettings(), movingInitializationScale(), and movingScale().
|
protected |
function that will do the averagin
Definition at line 1163 of file operations.h.
Referenced by loadSettings(), and process().
|
protected |
processor containing result to average
Definition at line 1169 of file operations.h.
Referenced by loadSettings(), and process().
|
protected |
function that will return the scale that should be used for the average
Definition at line 1166 of file operations.h.
Referenced by loadSettings(), movingInitializationScale(), and process().