#include <BDScalar.h>
Inheritance diagram for BDScalar:

Public Member Functions | |
| BDScalar (float max_dev=5.0, int nspills=10, const char *device_name=0) | |
| ~BDScalar () | |
| void | SetDevice (const char *device_name) |
| void | SetSpill (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb) |
| Set the current spill blocks. | |
| bool | BeamChanged () |
| void | SetSpillQueueSize (int nspills) |
| void | SetAllowedSpillDeviation (float sigmas) |
| double | GetValue () const |
| Return the last scalar added. | |
Protected Member Functions | |
| virtual double | GetScalar (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb) |
Private Attributes | |
| UtilRunningAverage | fPastSpills |
| float | fMaxDev |
| bool | fBeamChanged |
| const char * | fDeviceName |
This maintains a running average of the scalar value. It can be used in two ways:
1) Simply give the constructor a device name and it will use that devices data for the scalar value
2) Subclass and override GetScalar() to handle unpacking/caculating more complex values.
Created on: Fri Apr 15 09:59:46 2005
Definition at line 37 of file BDScalar.h.
|
||||||||||||||||
|
Construct a BDScalar.
Definition at line 8 of file BDScalar.cxx. References SetSpillQueueSize(). 00009 : fMaxDev(max_dev), fDeviceName(device_name) 00010 { 00011 this->SetSpillQueueSize(nspills); 00012 }
|
|
|
Definition at line 13 of file BDScalar.cxx. 00014 {
00015 }
|
|
|
Return true if the latest spill is a "significant change" from previous as determined by the maximum deviation allowed. Definition at line 34 of file BDScalar.cxx. 00035 {
00036 return fBeamChanged;
00037 }
|
|
||||||||||||
|
Reimplemented in BDHornCurrent. Definition at line 55 of file BDScalar.cxx. References fDeviceName, RawBeamData::GetData(), RawBeamData::GetDataLength(), and MSG. Referenced by SetSpill(). 00057 {
00058 if (!fDeviceName) return 0.0;
00059
00060 const RawBeamData* dev = rbmb[fDeviceName];
00061 double value = 0;
00062 if (!dev) {
00063 MSG("BD",Msg::kWarning)
00064 << "No "<<fDeviceName<<" in the data\n";
00065 }
00066 else if (! dev->GetDataLength()) {
00067 MSG("BD",Msg::kWarning)
00068 << fDeviceName<<" exists but w/out data\n";
00069 }
00070 else value = dev->GetData()[0];
00071
00072 return value;
00073 }
|
|
|
Return the last scalar added.
Definition at line 50 of file BDScalar.cxx. References fPastSpills, and UtilRunningAverage::LastSample(). Referenced by NtpBDFullModule::FillToroids(), BMSpillFiller::Spill(), and BMFileSummaryFiller::Timestamp(). 00051 {
00052 return fPastSpills.LastSample();
00053 }
|
|
|
Set the number of standard deviations a toroid measurement is allowed to deviate from the average before it is considered a significant deviation. Deviation is not checked until the configured number of spills have been collected. Definition at line 45 of file BDScalar.cxx. References fMaxDev. 00046 {
00047 fMaxDev = max_dev;
00048 }
|
|
|
Set device name. If GetScalar() hasn't been overridden, this device name will be used to pull out data to be used as the watched scalar. Definition at line 17 of file BDScalar.cxx. References fDeviceName. Referenced by BeamMonDbuModule::FillPipeline(). 00018 {
00019 fDeviceName = device_name;
00020 }
|
|
||||||||||||
|
Set the current spill blocks.
Implements BDProcessor. Definition at line 22 of file BDScalar.cxx. References UtilRunningAverage::Add(), fBeamChanged, fPastSpills, GetScalar(), and UtilRunningAverage::SampleDeviation(). Referenced by NtpBDFullModule::FillToroids(). 00024 {
00025 double value = this->GetScalar(rbmhb,rbmb);
00026 fBeamChanged = false;
00027 if (fPastSpills.SampleDeviation(value) > fMaxDev)
00028 fBeamChanged = true;
00029
00030 fPastSpills.Add(value);
00031
00032 }
|
|
|
Set the number of spills overwhich to maintain the running average Definition at line 40 of file BDScalar.cxx. References fPastSpills, and UtilRunningAverage::SetSampleSize(). Referenced by BDScalar(). 00041 {
00042 fPastSpills.SetSampleSize(nspills);
00043 }
|
|
|
Definition at line 95 of file BDScalar.h. Referenced by SetSpill(). |
|
|
Definition at line 96 of file BDScalar.h. Referenced by GetScalar(), and SetDevice(). |
|
|
Definition at line 94 of file BDScalar.h. Referenced by SetAllowedSpillDeviation(). |
|
|
Definition at line 93 of file BDScalar.h. Referenced by GetValue(), SetSpill(), and SetSpillQueueSize(). |
1.3.9.1