Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fullRunningMean Class Reference

#include <OnlMon/blob/main/onlmonutils/fullRunningMean.h>

+ Inheritance diagram for fullRunningMean:
+ Collaboration diagram for fullRunningMean:

Public Member Functions

 fullRunningMean (const int, const int)
 
 ~fullRunningMean () override
 
 fullRunningMean (const fullRunningMean &)=delete
 
fullRunningMeanoperator= (const fullRunningMean &)=delete
 
double getMean (const int) const override
 the getMean(i) funtion returns the current mean value of channel i
 
int Reset () override
 Reset will reset th whole class.
 
int Add (const int[]) override
 
int Add (const float[]) override
 
int Add (const double[]) override
 
- Public Member Functions inherited from runningMean
 runningMean ()
 
virtual ~runningMean ()
 
virtual double getReference (const int) const
 
virtual int getNumberofChannels () const
 
int setRefArray (const double[])
 
int setRefChannel (const int, const double)
 
int setAsReference ()
 
double getPercentDeviation (const int) const
 

Protected Member Functions

int addChannel (const int, const double)
 

Protected Attributes

int depth
 
int current_depth
 
double ** array
 
- Protected Attributes inherited from runningMean
int NumberofChannels = 0
 
doublerefArray
 

Detailed Description

This is the full running mean class.

It will calculate the "real" (mathematically correct) running mean value of a certain depth d, which comes at a price. For many online monitoring applicatiomns, you will be better off with the "pseudoRunningMean" class, which is a good approximation of the true running mean value. This class is provided to allow you to check that your pseudo running mean is a good enough approximation of the true value. Also, if the series of input values has large variations, the pseudo running mean will be off by a few percent.

Since you will need to store the d most recent entries to the running mean this can lead to excessive amount of memory allocated.

This class is mean to monitor lots of values (such as all channels of a given detector) simultaneously; In the constructor you specify the "width" (how many channels) and the depth of the running mean.

Since both this fullRunningMean and pseudoRunningMean inherit from the abstract runningMean class, you can change your choice by just instantiating a different object, as in the following example (the calculate_running_mean function will accept either class)

{verbatim} runningMean *pm = new fullRunningMean(144,50); {verbatim}

and the pass your "laser" events and the pm object on to a routine that add the values:

{verbatim} int calculate_running_mean ( Event * evt, runningMean * rm) { int array[144]; Packet *p = evt->getPacket(8002); if (p) { yes, we got the packet, and we ask it now to get channel 57 for us p->fillIntArray(array, 144, &nw); rm->Add(array); delete p; return 0; } return 1; } {verbatim}

Then, outside of your routine, you could ask the pm object for the running mean value of channel i with

{verbatim} pm->getmean(i); {verbatim}

Definition at line 67 of file fullRunningMean.h.

View newest version in sPHENIX GitHub at line 67 of file fullRunningMean.h

Constructor & Destructor Documentation

fullRunningMean::fullRunningMean ( const int  n,
const int  d 
)

Definition at line 3 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 3 of file fullRunningMean.cc

References array, current_depth, depth, i, j, n, and runningMean::NumberofChannels.

fullRunningMean::~fullRunningMean ( )
override

Definition at line 17 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 17 of file fullRunningMean.cc

References array, i, and runningMean::NumberofChannels.

fullRunningMean::fullRunningMean ( const fullRunningMean )
explicitdelete

Member Function Documentation

int fullRunningMean::Add ( const int  iarr[])
overridevirtual

Add will add a new list of readings. It is your responsibility to provide an approriate array of readings. (Typically you can get the array of int's from the Packet object's fillIntArray function).

Implements runningMean.

Definition at line 27 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 27 of file fullRunningMean.cc

References addChannel(), current_depth, depth, i, and runningMean::NumberofChannels.

+ Here is the call graph for this function:

int fullRunningMean::Add ( const float  farr[])
overridevirtual

Implements runningMean.

Definition at line 36 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 36 of file fullRunningMean.cc

References addChannel(), current_depth, depth, i, and runningMean::NumberofChannels.

+ Here is the call graph for this function:

int fullRunningMean::Add ( const double  darr[])
overridevirtual

Implements runningMean.

Definition at line 45 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 45 of file fullRunningMean.cc

References addChannel(), current_depth, depth, i, and runningMean::NumberofChannels.

+ Here is the call graph for this function:

int fullRunningMean::addChannel ( const int  channel,
const double  k 
)
protected

Definition at line 77 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 77 of file fullRunningMean.cc

References array, channel(), current_depth, depth, j, and k.

Referenced by Add().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double fullRunningMean::getMean ( const int  ich) const
overridevirtual

the getMean(i) funtion returns the current mean value of channel i

Implements runningMean.

Definition at line 65 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 65 of file fullRunningMean.cc

References array, current_depth, double(), j, and ambiguity_solver_full_chain::x.

+ Here is the call graph for this function:

fullRunningMean& fullRunningMean::operator= ( const fullRunningMean )
delete
int fullRunningMean::Reset ( )
overridevirtual

Reset will reset th whole class.

Implements runningMean.

Definition at line 55 of file fullRunningMean.cc.

View newest version in sPHENIX GitHub at line 55 of file fullRunningMean.cc

References array, depth, i, j, and runningMean::NumberofChannels.

Member Data Documentation

double** fullRunningMean::array
protected

Definition at line 96 of file fullRunningMean.h.

View newest version in sPHENIX GitHub at line 96 of file fullRunningMean.h

Referenced by addChannel(), fullRunningMean(), getMean(), Reset(), and ~fullRunningMean().

int fullRunningMean::current_depth
protected

Definition at line 95 of file fullRunningMean.h.

View newest version in sPHENIX GitHub at line 95 of file fullRunningMean.h

Referenced by Add(), addChannel(), fullRunningMean(), and getMean().

int fullRunningMean::depth
protected

Definition at line 94 of file fullRunningMean.h.

View newest version in sPHENIX GitHub at line 94 of file fullRunningMean.h

Referenced by Add(), addChannel(), fullRunningMean(), and Reset().


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