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

Public Types | |
| typedef std::map< std::string, UtilRunningAverageVector * > | SwicMap |
Public Member Functions | |
| BDSwicPeds () | |
| BDSwicPeds (const SwicMap &map) | |
| ~BDSwicPeds () | |
| void | Clear () |
| Reset object to initial conditions, as if it was reconstructed. | |
| void | SetSpill (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb) |
| Call once per spill if filling from data files. | |
| const UtilRunningAverageVector * | GetChannels (const char *name) const |
| const SwicMap & | GetAllChannels () const |
| Access vector of Channels. | |
| SwicMap & | GetAllChannels () |
| VldTimeStamp | GetStart () |
| VldTimeStamp | GetStop () |
Static Public Member Functions | |
| bool | IsPedSpill (const RawBeamMonBlock &rbmb) |
Private Attributes | |
| SwicMap | fSwicMap |
| VldTimeStamp | fBeginTS |
| VldTimeStamp | fEndTS |
This class maintains one UtilRunningAverageVector object for each SWIC scanner worth of channels.
Created on: Fri Apr 15 10:00:54 2005
Definition at line 45 of file BDSwicPeds.h.
|
|
Definition at line 48 of file BDSwicPeds.h. Referenced by GetAllChannels(). |
|
|
Create default BDSwicPeds. This will use BDDevices::SwicDevices() to form a ChannelsList Definition at line 24 of file BDSwicPeds.cxx. References Clear(). 00025 {
00026 this->Clear();
00027 }
|
|
|
Create a BDSwicPeds with pre-existing swic map. The map will be shallow copied. This transfers ownership of the URAV's. Definition at line 29 of file BDSwicPeds.cxx. References Clear().
|
|
|
Definition at line 55 of file BDSwicPeds.cxx. References done(), and fSwicMap. 00056 {
00057 SwicMap::iterator it, done = fSwicMap.end();
00058 for (it=fSwicMap.begin(); it != done; ++it)
00059 delete it->second;
00060 fSwicMap.clear();
00061 }
|
|
|
Reset object to initial conditions, as if it was reconstructed.
Definition at line 35 of file BDSwicPeds.cxx. References done(), fBeginTS, fEndTS, fSwicMap, VldTimeStamp::GetBOT(), VldTimeStamp::GetEOT(), MSG, nswics, BDDevices::SwicDevices(), and swics. Referenced by BDSwicPeds(), and BeamMonSwicPedsDbuModule::Dump(). 00036 {
00037 fBeginTS = VldTimeStamp::GetEOT(); // yes, EOT.
00038 fEndTS = VldTimeStamp::GetBOT(); // yes, BOT
00039
00040 size_t nswics = fSwicMap.size();
00041 if (!nswics) {
00042 vector<string> swics = BDDevices::SwicDevices();
00043 for (size_t ind=0; ind<swics.size(); ++ind) {
00044 MSG("BD",Msg::kDebug)
00045 << "BDSwicPeds::Clear: adding " << swics[ind] << endl;
00046 fSwicMap[swics[ind]] = new UtilRunningAverageVector(96);
00047 }
00048 return;
00049 }
00050 SwicMap::iterator it, done = fSwicMap.end();
00051 for (it=fSwicMap.begin(); it != done; ++it)
00052 it->second->Clear();
00053 }
|
|
|
Definition at line 175 of file BDSwicPeds.cxx. References SwicMap. 00176 {
00177 return fSwicMap;
00178 }
|
|
|
Access vector of Channels.
Definition at line 171 of file BDSwicPeds.cxx. References SwicMap. Referenced by BeamMonSwicPedsDbuModule::Dump(). 00172 {
00173 return fSwicMap;
00174 }
|
|
|
Access the Channels object corresponding to the given name. Returns 0 if there is no such channel name. Definition at line 164 of file BDSwicPeds.cxx. References fSwicMap. 00165 {
00166 SwicMap::const_iterator it = fSwicMap.find(name);
00167 if (it == fSwicMap.end()) return 0;
00168 return it->second;
00169 }
|
|
|
Return the earliest spill seen or VldtimeStamp::GetEOT() if not yet seen any spill. Definition at line 80 of file BDSwicPeds.h. Referenced by BeamMonSwicPedsDbuModule::Dump(). 00080 { return fBeginTS; }
|
|
|
Return the latest spill seen or VldTimeStamp::GetBOT() if not yet seen any spill. Definition at line 83 of file BDSwicPeds.h. Referenced by BeamMonSwicPedsDbuModule::Dump(). 00083 { return fEndTS; }
|
|
|
Return true if this spill would be suitable for use as a pedestal. This is called internally by SetSpill Definition at line 74 of file BDSwicPeds.cxx. References BDDevices::BpmIntensities(), dae_jitter, dae_vme_padding, RawBeamData::GetMsecs(), RawBeamData::GetSeconds(), maximum_bpm_intensity, maximum_toroid_intensity, MSG, RawBeamSwicData::SetData(), BDDevices::SwicDevices(), swics, RawBeamMonBlock::TclkTriggerDelay(), toroids, total(), RawBeamSwicData::VmeNanoseconds(), and RawBeamSwicData::VmeSeconds(). Referenced by PedStudy::OneFile(), SetSpill(), and BMSpillFiller::Spill(). 00075 {
00076 // First find empty spills by requiring the toroids
00077 // to be existing and quiet
00078 const char* toroids[] = { "E:TR101D", "E:TOR101", "E:TRTGTD", "E:TORTGT", 0 };
00079 for (int ind=0; toroids[ind]; ++ind) {
00080 const RawBeamData *rbd = rbmb[toroids[ind]];
00081 if (!rbd) {
00082 MSG("BD",Msg::kDebug)
00083 << "SetSpill bailing because can't get toroid " << toroids[ind] << endl;
00084 return false;
00085 }
00086 double tot = total(*rbd);
00087 if (tot > maximum_toroid_intensity) {
00088 MSG("BD",Msg::kVerbose)
00089 << "SetSpill bailing because toroid " << toroids[ind]
00090 << " intensity too high: "
00091 << tot << " > " << maximum_toroid_intensity << endl;
00092 return false;
00093 }
00094 }
00095
00096 // It's been found that some spills will have protons even with
00097 // quiet toroids! So, require quiet BPMs as well.
00098 vector<string> bpm_intensity = BDDevices::BpmIntensities();
00099 for (size_t ind=0; ind<bpm_intensity.size(); ++ind) {
00100 const RawBeamData *rbd = rbmb[bpm_intensity[ind].c_str()];
00101 if (!rbd) continue; // Don't just bail in case a BPM is simply removed
00102 double tot = total(*rbd);
00103 if (tot > maximum_bpm_intensity) {
00104 MSG("BD",Msg::kDebug)
00105 << "SetSpill bailing because bpm " << bpm_intensity[ind]
00106 << " intensity too high: "
00107 << tot << " > " << maximum_bpm_intensity << endl;
00108 return false;
00109 }
00110 }
00111
00112 // Go through SWIC devices and check if the VME and DAE times are
00113 // compatible.
00114 vector<string> swics = BDDevices::SwicDevices();
00115 RawBeamSwicData swic;
00116 double delay = rbmb.TclkTriggerDelay()/1.0e3;
00117 for (size_t ind=0; ind<swics.size(); ++ind) {
00118 const RawBeamData *rbd = rbmb[swics[ind].c_str()];
00119 if (!rbd) continue;
00120 swic.SetData(*rbd);
00121 double delta = rbd->GetSeconds() - swic.VmeSeconds() - delay;
00122 delta += rbd->GetMsecs()/1.0e3 - swic.VmeNanoseconds()/1.0e9;
00123
00124 if (delta < -dae_vme_padding || delta > dae_jitter+dae_vme_padding ) {
00125 MSG("BD",Msg::kWarning)
00126 << "SetSpill bailing, SWIC " << swics[ind]
00127 << " DAE-delay-VME time delta bad: "
00128 << delta << endl;
00129 return false;
00130 }
00131
00132 }
00133
00134 return true;
00135 }
|
|
||||||||||||
|
Call once per spill if filling from data files.
Implements BDProcessor. Definition at line 138 of file BDSwicPeds.cxx. References done(), fBeginTS, fEndTS, fSwicMap, RawBeamMonHeaderBlock::GetTimeStamp(), IsPedSpill(), and RawBeamSwicData::UnscaledWireData(). 00140 {
00141 VldTimeStamp vts = rbmhb.GetTimeStamp();
00142 if (vts < fBeginTS) fBeginTS = vts;
00143 if (vts > fEndTS) fEndTS = vts;
00144
00145 if (!BDSwicPeds::IsPedSpill(rbmb)) return;
00146
00147 // If we get here we are reasonably sure there are no protons in
00148 // the pipe.
00149 SwicMap::iterator it, done = fSwicMap.end();
00150 for (it=fSwicMap.begin(); it != done; ++it) {
00151 const RawBeamData* rbd = rbmb[it->first];
00152 if (!rbd) continue;
00153
00154 RawBeamSwicData rbsd(*rbd);
00155 vector<int> idata;
00156 rbsd.UnscaledWireData(idata);
00157 vector<double> ddata;
00158 for (size_t ind=0; ind<idata.size(); ++ind)
00159 ddata.push_back((double)idata[ind]);
00160 it->second->Add(ddata);
00161 }
00162 }
|
|
|
Definition at line 87 of file BDSwicPeds.h. Referenced by Clear(), and SetSpill(). |
|
|
Definition at line 87 of file BDSwicPeds.h. Referenced by Clear(), and SetSpill(). |
|
|
Definition at line 86 of file BDSwicPeds.h. Referenced by Clear(), GetChannels(), SetSpill(), and ~BDSwicPeds(). |
1.3.9.1