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

Public Member Functions | |
| BDEarliest () | |
| void | SetSpill (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb) |
| Set the current spill blocks. | |
| void | SetAllowedVmeDeviation (float before=-0.1 *Munits::second, float after=+0.4 *Munits::second) |
| void | GetTimestamps (double &dae, double &vme) |
| void | GetLastTimestamps (double &dae, double &vme) |
Static Public Member Functions | |
| static void | CalculateEarliest (const RawBeamMonBlock &rbmb, double &dae, double &vme, float before=-0.1 *Munits::second, float after=+0.4 *Munits::second) |
Private Attributes | |
| double | fDae |
| double | fVme |
| double | fLastDae |
| double | fLastVme |
| float | fBefore |
| float | fAfter |
This is done by:
1) Find the earliest SWIC VME time that is w/in the set deviation of the DAE time less the ACNET readout delay (encoded in the data).
2) If no such VME time can be found, use the earliest SWIC DAE time.
3) If there are no SWICS use earliest torroid
4) If there are no torroids in the spill use the earliest DAE time from a BPM.
5) If no BPMs, use zero. You wouldn't want this spill anyways.
Created on: Fri Apr 15 09:56:12 2005
Definition at line 43 of file BDEarliest.h.
| BDEarliest::BDEarliest | ( | ) |
Definition at line 18 of file BDEarliest.cxx.
References SetAllowedVmeDeviation().
00019 : fDae(0), fVme(0), fLastDae(0), fLastVme(0), fBefore(0), fAfter(0) 00020 { 00021 this->SetAllowedVmeDeviation(); 00022 }
| void BDEarliest::CalculateEarliest | ( | const RawBeamMonBlock & | rbmb, | |
| double & | dae, | |||
| double & | vme, | |||
| float | before = -0.1 *Munits::second, |
|||
| float | after = +0.4 *Munits::second | |||
| ) | [static] |
Definition at line 37 of file BDEarliest.cxx.
References BDDevices::BpmPositions(), find_earliest(), Form(), Msg::kDebug, Msg::kVerbose, MSG, RawBeamSwicData::SetData(), BDDevices::SwicDevices(), RawBeamMonBlock::TclkTriggerDelay(), BDDevices::Toroids(), RawBeamSwicData::VmeNanoseconds(), and RawBeamSwicData::VmeSeconds().
Referenced by get_timestamp(), and SetSpill().
00040 { 00041 00042 double earliest_vme=-1, earliest_dae=-1; 00043 00044 RawBeamSwicData swic; 00045 00046 vector<string> swic_names = BDDevices::SwicDevices(); 00047 00048 const float delay = rbmb.TclkTriggerDelay()/1000.0; 00049 MSG("BD",Msg::kVerbose) 00050 << "TCLK trigger delay is " << delay << endl; 00051 00052 00053 for (size_t ind=0; ind<swic_names.size(); ++ind) { 00054 const RawBeamData* rbd = rbmb[swic_names[ind]]; 00055 if (!rbd) continue; 00056 00057 double dae = rbd->GetSeconds() + rbd->GetMsecs()/1.0e3 - delay; 00058 00059 if (earliest_dae < 0 || dae < earliest_dae) 00060 earliest_dae = dae; 00061 00062 if (!swic.SetData(*rbd)) continue; // skip bogus data 00063 00064 double vme = swic.VmeSeconds() + swic.VmeNanoseconds()/1.0e9; 00065 00066 if (vme < 1.0) continue; // skip bogus timestamps 00067 00068 double diff = dae-vme; 00069 00070 if (diff < before || diff > after) { 00071 MSG("BD",Msg::kDebug) 00072 << swic_names[ind] << " has too large dae-vme=" << diff << endl; 00073 continue; // skip bogus timestamps 00074 } 00075 00076 // Get here, then vme timestamp is non-bogus 00077 00078 if (earliest_vme < 0 || vme < earliest_vme) earliest_vme = vme; 00079 } 00080 00081 if (earliest_vme < 0) earliest_vme = 0.0; 00082 if (earliest_dae < 0) { 00083 double tmp = find_earliest(rbmb,BDDevices::Toroids()); 00084 if (tmp>1 && tmp<earliest_dae) earliest_dae = tmp; 00085 } 00086 if (earliest_dae < 0) { 00087 double tmp = find_earliest(rbmb,BDDevices::BpmPositions()); 00088 if (tmp>1 && tmp<earliest_dae) earliest_dae = tmp; 00089 } 00090 if (earliest_dae < 0) 00091 earliest_dae = 0; 00092 00093 dae_out = earliest_dae; 00094 vme_out = earliest_vme; 00095 00096 MSG("BD",Msg::kVerbose) 00097 << Form("dae = %16.3f, vme = %16.3f, diff = %.3f", 00098 earliest_dae, earliest_vme, earliest_dae - earliest_vme) 00099 << endl; 00100 }
| void BDEarliest::GetLastTimestamps | ( | double & | dae, | |
| double & | vme | |||
| ) | [inline] |
Definition at line 61 of file BDEarliest.h.
References fLastDae, and fLastVme.
Referenced by BDataQualityModule::FillFile().
| void BDEarliest::GetTimestamps | ( | double & | dae, | |
| double & | vme | |||
| ) | [inline] |
Get the timestamps. Note, that dae is corrected to have the ACNET readout delay removed
Definition at line 59 of file BDEarliest.h.
Referenced by dump(), fill_bdtest(), BDataQualityModule::FillFile(), BDUniquify::GetUniqueBlocks(), and BMSpillFiller::Spill().
| void BDEarliest::SetAllowedVmeDeviation | ( | float | before = -0.1*Munits::second, |
|
| float | after = +0.4*Munits::second | |||
| ) | [inline] |
Set the amount that the VME time is allowed to deviate from the DAE time after readout delay is removed. The readout delay is taken from the value in the RawBeamMonBlock.
Definition at line 53 of file BDEarliest.h.
References fAfter, and fBefore.
Referenced by BDEarliest().
| void BDEarliest::SetSpill | ( | const RawBeamMonHeaderBlock & | rbmhb, | |
| const RawBeamMonBlock & | rbmb | |||
| ) | [virtual] |
Set the current spill blocks.
Implements BDProcessor.
Definition at line 102 of file BDEarliest.cxx.
References CalculateEarliest(), fAfter, fBefore, fDae, fLastDae, fLastVme, and fVme.
Referenced by dump(), fill_bdtest(), BDataQualityModule::FillFile(), and BDUniquify::GetUniqueBlocks().
00104 { 00105 fLastDae = fDae; 00106 fLastVme = fVme; 00107 00108 fDae = fVme = 0.0; 00109 00110 BDEarliest::CalculateEarliest(rbmb,fDae,fVme,fBefore,fAfter); 00111 }
float BDEarliest::fAfter [private] |
float BDEarliest::fBefore [private] |
double BDEarliest::fDae [private] |
double BDEarliest::fLastDae [private] |
double BDEarliest::fLastVme [private] |
double BDEarliest::fVme [private] |
1.4.7