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

Public Types | |
| enum | MonitorType { kUnknown = 0, kProfile, kHadron, kMuon, kWire } |
| General type of monitor, see GetMonitorType(). More... | |
Public Member Functions | |
| BDSwicDevice () | |
| Default constructor. | |
| BDSwicDevice (const RawBeamData &swic_data) | |
| Construct a BDSwicDevice with an initial RawBeamData object. | |
| virtual | ~BDSwicDevice () |
| virtual void | SetData (const RawBeamData &swic_data) |
| Set the RawBeamData from a swic scanner device. | |
| bool | SetPeds (const std::vector< double > &peds) |
| Set the per channel pedestals to use. | |
| virtual bool | SetMask (const std::vector< double > &mask) |
| Mask off any bad channels. | |
| bool | SetNoise (const std::vector< double > &noise) |
| Set the per channel noise to use. | |
| void | SetScale (double scale) |
| Set an overall scale. | |
| void | SetMvPerADC (double mvperadc) |
| Set millivolt per ADC count correction. | |
| void | SetGainCorrection (double gain) |
| Set multiplicative gain correction. | |
| void | SetCapacitance (double cap) |
| Set capacitance of integrating capacitor for GetCharge(). | |
| virtual double | GetVoltage (int index) const |
| Get a channel's voltage with all corrections applied. | |
| double | GetCharge (int index) const |
| Get a channel's corrected charge in Munits (not pC!). | |
| double | GetTotalVoltage () |
| Get the total voltage. | |
| double | GetTotalCharge () |
| Get the total charge. | |
| MonitorType | GetMonitorType () |
| double | GetNoise (int index) const |
| Get the channel noise. | |
Private Member Functions | |
| void | UpdateType () |
Private Attributes | |
| std::vector< double > | fPeds |
| std::vector< double > | fMask |
| std::vector< double > | fNoise |
| double | fMvPerADC |
| double | fScale |
| double | fGain |
| double | fCap |
| std::vector< int > | fData |
| MonitorType | fType |
This class is a RawBeamSwicData object which applies pedestals, channel masks, and anything else needed to make the per-channel data more regular. It provides the base class for more specific devices such as BDHadMuMon and BDProfMon.
Created on: Fri Apr 15 11:52:50 2005
Definition at line 41 of file BDSwicDevice.h.
|
|
General type of monitor, see GetMonitorType().
Definition at line 46 of file BDSwicDevice.h. Referenced by GetMonitorType().
|
|
|
Default constructor. Constructed this way, this object will not be valid until SetData() is called. Definition at line 14 of file BDSwicDevice.cxx. 00015 : RawBeamSwicData() 00016 , fPeds(96,0) 00017 , fMask(96,1) 00018 , fNoise(96,0.1) 00019 , fMvPerADC(-0.30518) 00020 , fScale(1.0) 00021 , fGain(1.0) 00022 , fCap(0) 00023 , fType(kUnknown) 00024 00025 { 00026 }
|
|
|
Construct a BDSwicDevice with an initial RawBeamData object. The RawBeamData object should be from SWIC scanner data. Definition at line 28 of file BDSwicDevice.cxx. References BDSwicCalibrator::AddDevice(), fData, BDSwicCalibrator::Get(), RawBeamSwicData::UnscaledWireData(), and UpdateType(). 00029 : RawBeamSwicData(swic_data) 00030 , fPeds(96,0) 00031 , fMask(96,1) 00032 , fNoise(96,0.1) 00033 , fMvPerADC(-0.30518) 00034 , fScale(1.0) 00035 , fGain(1.0) 00036 , fCap(0) 00037 , fType(kUnknown) 00038 { 00039 this->RawBeamSwicData::UnscaledWireData(fData); 00040 this->UpdateType(); 00041 BDSwicCalibrator::Get().AddDevice(*this); 00042 }
|
|
|
Definition at line 44 of file BDSwicDevice.cxx. References BDSwicCalibrator::Get(), and BDSwicCalibrator::RemoveDevice(). 00045 {
00046 BDSwicCalibrator::Get().RemoveDevice(*this);
00047 }
|
|
|
Get a channel's corrected charge in Munits (not pC!).
Definition at line 155 of file BDSwicDevice.cxx. References GetVoltage(). Referenced by dump_hadmus(), and BDHadMuMon::GetStats(). 00156 {
00157 return this->GetVoltage(index)*fCap;
00158 }
|
|
|
Get general type of monitor as an enum. Definition at line 173 of file BDSwicDevice.h. References MonitorType. Referenced by BDSwicCalibrator::CalibrateOne(). 00173 { return fType; }
|
|
|
Get the channel noise. Units are in mV. This just returns the noise on a given channel. Noise is defined as the RMS of the pedestal distribution. Definition at line 136 of file BDSwicDevice.cxx. References fData, fMvPerADC, fNoise, fScale, and MSG. Referenced by BDProfMon::GetGaussFit(). 00137 {
00138 if (!fData.size() || index < 0 || index >= 96) {
00139 MSG("BDU",Msg::kWarning)
00140 << "BDSwicDevice::GetNoise given bad index: " << index << endl;
00141 return 0;
00142 }
00143 return fScale*fMvPerADC*fNoise[index]*Munits::millivolt;
00144 }
|
|
|
Get the total charge. Units are in Munits (not pC!). This just returns the sum of the above over all unmasked channels. Definition at line 159 of file BDSwicDevice.cxx. References fCap, GetTotalVoltage(), and MSG. Referenced by dump_hadmus(). 00160 {
00161 if (fCap == 0.0) {
00162 MSG("BDU",Msg::kWarning)
00163 << "BDSwicDevice::GetTotalCharge called but capacitance is zero\n";
00164 return 0;
00165 }
00166 return this->GetTotalVoltage() * fCap;
00167 }
|
|
|
Get the total voltage. Units are in Munits. This just returns the sum of the above over all unmasked channels. Definition at line 146 of file BDSwicDevice.cxx. References fData, fMask, fMvPerADC, fPeds, and fScale. Referenced by HadMuMonModule::Fill(), and GetTotalCharge(). 00147 {
00148 if (!fData.size()) return 0.0;
00149 double ret=0;
00150 for (int ind=0; ind<96; ++ind)
00151 ret += (fData[ind] - fPeds[ind])*fMask[ind];
00152 ret *= fScale*fMvPerADC*Munits::millivolt;
00153 return ret;
00154 }
|
|
|
Get a channel's voltage with all corrections applied. Units are in Munits (not mV!) and indexing is SWIC level indexing with "index" ranging from 0-95, inclusive. A zero is returned if a bad index is passed. Definition at line 125 of file BDSwicDevice.cxx. References fData, fMask, fMvPerADC, fPeds, fScale, and MSG. Referenced by HadMuMonModule::Fill(), GetCharge(), BDProfMon::GetGaussFit(), and BDProfMon::GetStats(). 00126 {
00127 if (!fData.size() || index < 0 || index >= 96) {
00128 MSG("BDU",Msg::kWarning)
00129 << "BDSwicDevice::GetVoltage given bad index: " << index << endl;
00130 return 0;
00131 }
00132 return fScale*fMvPerADC*(fData[index] - fPeds[index])*fMask[index]*Munits::millivolt;
00133 }
|
|
|
Set capacitance of integrating capacitor for GetCharge(). If this goes unset all charge returned will be zero. units are Munits Definition at line 119 of file BDSwicDevice.cxx. References fCap. Referenced by BDSwicCalibrator::CalibrateOne(). 00120 {
00121 fCap = cap;
00122 }
|
|
|
Set the RawBeamData from a swic scanner device. If subclasses override this, they should still pass the data to the parent class. Reimplemented from RawBeamSwicData. Reimplemented in BDHadMuMon, and BDProfMon. Definition at line 48 of file BDSwicDevice.cxx. References BDSwicCalibrator::AddDevice(), fData, BDSwicCalibrator::Get(), RawBeamData::GetName(), RawBeamSwicData::IsValid(), MSG, RawBeamSwicData::SetData(), RawBeamSwicData::UnscaledWireData(), and UpdateType(). Referenced by BDProfMon::SetData(), and BDHadMuMon::SetData(). 00049 {
00050 this->RawBeamSwicData::SetData(swic_data);
00051
00052 if (!this->IsValid())
00053 MSG("BDU",Msg::kInfo) << swic_data.GetName() << " given invalid data\n";
00054
00055
00056 fData.clear();
00057 this->RawBeamSwicData::UnscaledWireData(fData);
00058
00059 this->UpdateType();
00060 BDSwicCalibrator::Get().AddDevice(*this);
00061 }
|
|
|
Set multiplicative gain correction.
Definition at line 115 of file BDSwicDevice.cxx. References fGain. Referenced by BDSwicCalibrator::CalibrateOne(). 00116 {
00117 fGain = gain;
00118 }
|
|
|
Mask off any bad channels.
Sub classes can override this in order to zero out channels that are always missing but the mask should still be passed to the base class for storage and use. The subclass should only zero a channel and not otherwise modify since the mask can hold per-channel scaling information. Reimplemented in BDProfMon. Definition at line 92 of file BDSwicDevice.cxx. References fMask. Referenced by BDSwicCalibrator::CalibrateOne(), and BDProfMon::SetMask(). 00093 {
00094 if (mask.size() != 96) return false;
00095 fMask = mask;
00096 return true;
00097 }
|
|
|
Set millivolt per ADC count correction. This allows a linear correction to convert from raw ADC counts to millivolts. Default is -0.30518 mV/ADC. Definition at line 111 of file BDSwicDevice.cxx. References fMvPerADC. 00112 {
00113 fMvPerADC = mvperadc;
00114 }
|
|
|
Set the per channel noise to use.
Definition at line 99 of file BDSwicDevice.cxx. References fNoise. Referenced by BDSwicCalibrator::CalibrateOne(). 00100 {
00101 if (noise.size() != 96) return false;
00102 fNoise = noise;
00103 return true;
00104 }
|
|
|
Set the per channel pedestals to use.
Definition at line 86 of file BDSwicDevice.cxx. References fPeds. Referenced by BDSwicCalibrator::CalibrateOne(). 00087 {
00088 if (peds.size() != 96) return false;
00089 fPeds = peds;
00090 return true;
00091 }
|
|
|
Set an overall scale. This allows an overall scale to be set by the user which will be multiplied to the pedestal subtracted data. It can be useful if one wants to normalize the data to proton intensity as measured by, say, a toroid. Default is 1.0. It is external (in addition) to any calibrations. Definition at line 107 of file BDSwicDevice.cxx. References fScale. 00108 {
00109 fScale = scale;
00110 }
|
|
|
Definition at line 62 of file BDSwicDevice.cxx. References fType, RawBeamSwicData::GetData(), RawBeamData::GetName(), RawBeamSwicData::IsValid(), and MSG. Referenced by BDSwicDevice(), and SetData(). 00063 {
00064 if (!this->IsValid()) {
00065 MSG("BDU",Msg::kWarning)
00066 << "BDSwicDevice: Attempt to update with invalid data\n";
00067 fType = kUnknown;
00068 return;
00069 }
00070 string name = this->GetData().GetName();
00071 if (name == "E:HADMDS") {
00072 fType = kHadron;
00073 return;
00074 }
00075 if (name == "E:MMA1DS" || name == "E:MMA2DS" || name == "E:MMA3DS") {
00076 fType = kMuon;
00077 return;
00078 }
00079 if (name == "E:M117DS") {
00080 fType = kWire;
00081 return;
00082 }
00083 fType = kProfile; // should do explicit check. meh.
00084 }
|
|
|
Definition at line 186 of file BDSwicDevice.h. Referenced by GetTotalCharge(), and SetCapacitance(). |
|
|
Reimplemented from RawBeamSwicData. Definition at line 187 of file BDSwicDevice.h. Referenced by BDSwicDevice(), GetNoise(), GetTotalVoltage(), GetVoltage(), and SetData(). |
|
|
Definition at line 186 of file BDSwicDevice.h. Referenced by SetGainCorrection(). |
|
|
Definition at line 185 of file BDSwicDevice.h. Referenced by GetTotalVoltage(), GetVoltage(), and SetMask(). |
|
|
Definition at line 186 of file BDSwicDevice.h. Referenced by GetNoise(), GetTotalVoltage(), GetVoltage(), and SetMvPerADC(). |
|
|
Definition at line 185 of file BDSwicDevice.h. Referenced by GetNoise(), and SetNoise(). |
|
|
Definition at line 185 of file BDSwicDevice.h. Referenced by GetTotalVoltage(), GetVoltage(), and SetPeds(). |
|
|
Definition at line 186 of file BDSwicDevice.h. Referenced by GetNoise(), GetTotalVoltage(), GetVoltage(), and SetScale(). |
|
|
Definition at line 189 of file BDSwicDevice.h. Referenced by UpdateType(). |
1.3.9.1