BDSpliceModule Class Reference
[BeamDataUtil]

Pass records based on RawBeamMonBlock times. More...

#include <BDSpliceModule.h>

Inheritance diagram for BDSpliceModule:
JobCModule

List of all members.

Public Member Functions

 BDSpliceModule ()
virtual ~BDSpliceModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Ana (const MomNavigator *mom)

Private Attributes

VldTimeStamp fBegin
VldTimeStamp fEnd

Detailed Description

Pass records based on RawBeamMonBlock times.

This simply fails all records outside of a configured time range. It has these configuration parameters:

BeginTime: unix epoc seconds of begin of accepted time range (def: 0) EndTime: unix epoc seconds of end of accepted time range (def: -1)

For human readable setting do something like:

VldTimeStamp begin(2005,1,1, 12,30,0);

and use begin.GetSec().

Remeber, times are all in UTC.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.1
Date:
Date
2005/08/05 14:42:08

Contact: bv@bnl.gov

Created on: Wed Aug 3 10:02:00 2005

Id
BDSpliceModule.h,v 1.1 2005/08/05 14:42:08 bv Exp

Definition at line 42 of file BDSpliceModule.h.


Constructor & Destructor Documentation

BDSpliceModule::BDSpliceModule (  ) 

Definition at line 11 of file BDSpliceModule.cxx.

00012     : fBegin(VldTimeStamp::GetBOT())
00013       , fEnd(VldTimeStamp::GetEOT())
00014 {
00015 }

BDSpliceModule::~BDSpliceModule (  )  [virtual]

Definition at line 17 of file BDSpliceModule.cxx.

00018 {
00019 }


Member Function Documentation

JobCResult BDSpliceModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 41 of file BDSpliceModule.cxx.

References JobCResult::Failed(), fBegin, fEnd, RawBeamMonHeaderBlock::GetTimeStamp(), header, JobCResult::kFailed, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, MSG, and JobCResult::Passed().

00042 {
00043     static bool inrange = false;
00044 
00045     const RawBeamMonHeaderBlock* header =
00046         DataUtil::GetRawBlock<RawBeamMonHeaderBlock>(mom);
00047 
00048     if (!header) {
00049         MSG("BDSpliceModule",Msg::kWarning)
00050             << "No RawBeamMonHeaderBlock, failing record\n";
00051         return JobCResult::kFailed;
00052     }
00053 
00054     VldTimeStamp now = header->GetTimeStamp();
00055 
00056     JobCResult pf = JobCResult::kPassed;
00057 
00058     if (now < fBegin) pf = JobCResult::kFailed;
00059     if (now > fEnd)   pf = JobCResult::kFailed;
00060 
00061     if (inrange && pf.Failed()) {
00062         MSG("BDSpliceModule",Msg::kInfo)
00063             << "Leaving range at " << now << endl;
00064     }
00065     if (!inrange && pf.Passed()) {
00066         MSG("BDSpliceModule",Msg::kInfo)
00067             << "Entering range at " << now << endl;
00068     }
00069     if (pf.Passed()) inrange = true;
00070     else inrange = false;
00071 
00072     return pf;
00073 }

void BDSpliceModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 32 of file BDSpliceModule.cxx.

References fBegin, fEnd, Registry::Get(), and VldTimeStamp::GetSec().

00033 {
00034     int t;
00035     if (cfg.Get("BeginTime",t) && t != fBegin.GetSec())
00036         fBegin = VldTimeStamp(t);
00037     if (cfg.Get("EndTime",t) && t != fEnd.GetSec())
00038         fEnd = VldTimeStamp(t);
00039 }

const Registry & BDSpliceModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 22 of file BDSpliceModule.cxx.

References Form(), JobCModule::GetName(), Registry::Set(), and Registry::Size().

00023 {
00024     static Registry r;
00025     if (r.Size()) return r;
00026     r.Set("BeginTime",0);
00027     r.Set("EndTime",(int)((time_t)-1));
00028     r.SetName(Form("%s.config.default",this->JobCModule::GetName()));
00029     return r;
00030 }


Member Data Documentation

Definition at line 44 of file BDSpliceModule.h.

Referenced by Ana(), and Config().

Definition at line 44 of file BDSpliceModule.h.

Referenced by Ana(), and Config().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1