class fullRunningMean: public runningMean

This is the full running mean class.

Inheritance:


Public Methods

[more]virtual double getMean(const int ich) const
the getMean(i) funtion returns the current mean value of channel i
[more]virtual int Reset()
Reset will reset th whole class
[more]virtual int Add(const int iarr[])
Add will add a new list of readings.


Inherited from runningMean:


Documentation

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):

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

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

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;
}

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

pm->getmean(i);

ovirtual double getMean(const int ich) const
the getMean(i) funtion returns the current mean value of channel i

ovirtual int Reset()
Reset will reset th whole class

ovirtual int Add(const int iarr[])
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).


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.