NtpBDLiteModule Class Reference

#include <NtpBDLiteModule.h>

Inheritance diagram for NtpBDLiteModule:
JobCModule

List of all members.

Public Member Functions

 NtpBDLiteModule ()
 ~NtpBDLiteModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Reco (MomNavigator *mom)
NtpBDLiteRecordFillNtpBDLite (const VldContext &vldc)

Private Attributes

std::string fInputRecordsFilter

Detailed Description

Definition at line 14 of file NtpBDLiteModule.h.


Constructor & Destructor Documentation

NtpBDLiteModule::NtpBDLiteModule (  ) 

Definition at line 32 of file NtpBDLiteModule.cxx.

00033     :fInputRecordsFilter("!ConfigRecord")
00034 {}

NtpBDLiteModule::~NtpBDLiteModule (  ) 

Definition at line 38 of file NtpBDLiteModule.cxx.

00039 {}


Member Function Documentation

void NtpBDLiteModule::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 62 of file NtpBDLiteModule.cxx.

References fInputRecordsFilter, Registry::Get(), Msg::kDebug, and MSG.

00063 {
00064     MSG("NtpBDLite",Msg::kDebug) << "NtpBDLiteModule::Config" << endl;
00065 
00066     const char* tmps;
00067     if ( r.Get("InputRecordsFilter",tmps) ) fInputRecordsFilter = tmps;   
00068 }

const Registry & NtpBDLiteModule::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 43 of file NtpBDLiteModule.cxx.

References JobCModule::GetName(), Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00044 {
00045     MSG("NtpBDLite",Msg::kDebug) <<
00046         "NtpBDLiteModule::DefaultConfig" << endl;
00047 
00048     static Registry r;
00049     std::string name = this->JobCModule::GetName();
00050     name += ".config.default";
00051     r.SetName(name.c_str());
00052 
00053     r.UnLockValues();
00054     r.Set("InputRecordsFilter","!ConfigRecord");
00055     r.LockValues();
00056 
00057     return r;
00058 }

NtpBDLiteRecord * NtpBDLiteModule::FillNtpBDLite ( const VldContext vldc  ) 

Definition at line 123 of file NtpBDLiteModule.cxx.

References NtpBDLiteRecord::bpmint, NtpBDLiteRecord::bposx, NtpBDLiteRecord::bposy, NtpBDLiteRecord::bwidx, NtpBDLiteRecord::bwidy, NtpBDLiteRecord::dt_nearest, BeamMonSpill::fBpmInt, BeamMonSpill::fHadInt, BeamMonSpill::fHornCur, BeamMonSpill::fMuInt1, BeamMonSpill::fMuInt2, BeamMonSpill::fMuInt3, BeamMonSpill::fProfWidX, BeamMonSpill::fProfWidY, BeamMonSpill::fTargBpmX, BeamMonSpill::fTargBpmY, BeamMonSpill::fTor101, BeamMonSpill::fTortgt, BeamMonSpill::fTr101d, BeamMonSpill::fTrtgtd, JobCModule::Get(), VldTimeStamp::GetNanoSec(), VldTimeStamp::GetSec(), VldTimeStamp::GetSeconds(), BeamMonSpill::GetStatusInt(), SpillTimeFinder::GetTimeOfNearestSpill(), VldContext::GetTimeStamp(), SpillTimeFinder::GetTimeToNearestSpill(), NtpBDLiteRecord::hadint, NtpBDLiteRecord::horncur, SpillTimeFinder::Instance(), Msg::kDebug, MSG, NtpBDLiteRecord::muint1, NtpBDLiteRecord::muint2, NtpBDLiteRecord::muint3, NtpBDLiteRecord::nearest_nsec, NtpBDLiteRecord::nearest_sec, BeamDataLiteHeader::SetEarliestTimeStamp(), BeamDataLiteHeader::SetFoundBD(), BeamDataLiteHeader::SetStatus(), BeamDataLiteHeader::SetTimeDiffStreamSpill(), BeamMonSpill::SpillTime(), NtpBDLiteRecord::tor101, NtpBDLiteRecord::tortgt, NtpBDLiteRecord::tr101d, and NtpBDLiteRecord::trtgtd.

Referenced by Reco().

00124 {
00125 
00126     MSG("NtpBDLite",Msg::kDebug)<< "vldc = "  << vldc <<endl;
00127     BeamDataLiteHeader bdh(vldc);
00128 
00129     const BeamMonSpill* spill = BDSpillAccessor::Get().LoadSpill(vldc.GetTimeStamp());
00130     //BDSpillAccessor B;
00131     //const BeamMonSpill* spill = B.LoadSpill(vldc.GetTimeStamp());
00132     if (!spill){ 
00133         MSG("NtpBDLite",Msg::kDebug)<< "No spill found!" <<endl;
00134         NtpBDLiteRecord* ntpbdr = new NtpBDLiteRecord(bdh);
00135         return ntpbdr;
00136     }
00137     
00138     // fill members of the BeamDataLiteHeader
00139     
00140     VldTimeStamp spill_time = spill->SpillTime();
00141     bdh.SetEarliestTimeStamp(spill_time);
00142     VldTimeStamp vldd = spill_time-vldc.GetTimeStamp();
00143     bdh.SetTimeDiffStreamSpill(vldd.GetSeconds()); 
00144     bdh.SetFoundBD(1);
00145     bdh.SetStatus(spill->GetStatusInt());
00146     
00147     NtpBDLiteRecord* ntpbdr = new NtpBDLiteRecord(bdh);
00148     MSG("NtpBDLite",Msg::kDebug)<< spill->fTor101  <<endl;
00149     ntpbdr->tor101 = spill->fTor101;           
00150     ntpbdr->tr101d = spill->fTr101d;           
00151     ntpbdr->tortgt = spill->fTortgt;           
00152     ntpbdr->trtgtd = spill->fTrtgtd;
00153     ntpbdr->horncur = spill->fHornCur;     
00154     for (Int_t i=0;i<6;++i){
00155         ntpbdr->bposx[i]=spill->fTargBpmX[i];
00156         ntpbdr->bposy[i]=spill->fTargBpmY[i];
00157         ntpbdr->bpmint[i]=spill->fBpmInt[i];
00158     }
00159     ntpbdr->bwidx = spill->fProfWidX;  
00160     ntpbdr->bwidy = spill->fProfWidY;  
00161     ntpbdr->hadint = spill->fHadInt; 
00162     ntpbdr->muint1 = spill->fMuInt1;  
00163     ntpbdr->muint2 = spill->fMuInt2;  
00164     ntpbdr->muint3 = spill->fMuInt3;  
00165 
00166     SpillTimeFinder &stf = SpillTimeFinder::Instance();
00167     ntpbdr->dt_nearest = stf.GetTimeToNearestSpill(vldc);
00168     VldTimeStamp tons = stf.GetTimeOfNearestSpill(vldc);
00169     ntpbdr->nearest_sec = tons.GetSec();
00170     ntpbdr->nearest_nsec = tons.GetNanoSec();
00171 
00172     return ntpbdr;
00173 }

JobCResult NtpBDLiteModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 72 of file NtpBDLiteModule.cxx.

References MomNavigator::AdoptFragment(), FillNtpBDLite(), fInputRecordsFilter, MomNavigator::GetFragment(), RecMinos::GetHeader(), VldContext::GetTimeStamp(), GetVldContext(), RecMinosHdr::GetVldContext(), Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, Msg::kWarning, MAXMSG, and MSG.

00073 {
00074     MSG("NtpBDLite",Msg::kDebug)<<"In NtpBDLite::Reco"<<endl;
00075     
00076     // try to get the vld context from somewhere
00077 
00078     VldContext vldc;
00079     
00080     RawRecord* daqsnarl =
00081       dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord",0,"DaqSnarl"));
00082     if ( daqsnarl ) {
00083       // prefer a DaqSnarl record if one is available
00084       vldc = daqsnarl->GetHeader()->GetVldContext();
00085     } else {
00086       // no DaqSnarl
00087       if (fInputRecordsFilter.empty()) {
00088         MAXMSG("NtpBDLite",Msg::kWarning,5)
00089           << "No input record name set. Might pick up wrong VldContext." 
00090           << endl;
00091       }
00092     
00093       MSG("NtpBDLite",Msg::kDebug) << "Record filter = " 
00094                                    << fInputRecordsFilter << endl;
00095 
00096       vector<VldContext> vldcv = 
00097         DataUtil::GetVldContext(mom,fInputRecordsFilter.c_str());
00098       if ( vldcv.empty() ){
00099         MSG("NtpBDLite",Msg::kDebug)
00100           << "In NtpBDLite::Reco: "
00101           << "Nothing interesting found in mom." <<  endl;
00102         return JobCResult::kFailed;
00103       }
00104 
00105       vldc = vldcv[0];
00106       // Look for earliest time in the streams
00107       for (UInt_t i=1; i<vldcv.size(); ++i) {
00108         if (vldcv[i].GetTimeStamp()<vldc.GetTimeStamp()) vldc = vldcv[i] ;
00109       }
00110     }
00111 
00112     NtpBDLiteRecord* ntpbdr = FillNtpBDLite(vldc);
00113 
00114     //give the ntpbdr object to mom, she'll write it to the file
00115     mom->AdoptFragment(ntpbdr);
00116         
00117     return JobCResult::kPassed;
00118 
00119 }


Member Data Documentation

std::string NtpBDLiteModule::fInputRecordsFilter [private]

Definition at line 31 of file NtpBDLiteModule.h.

Referenced by Config(), and Reco().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1