NtpStModule Class Reference

#include <NtpStModule.h>

Inheritance diagram for NtpStModule:
JobCModule

List of all members.

Public Member Functions

 NtpStModule ()
 ~NtpStModule ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
virtual JobCResult Get (MomNavigator *mom)

Private Attributes

std::string fRecordName
std::string fRecordTitle
std::string fCandRecordName

Detailed Description

Definition at line 17 of file NtpStModule.h.


Constructor & Destructor Documentation

NtpStModule::NtpStModule (  )  [inline]

Definition at line 20 of file NtpStModule.h.

00020 : fRecordName(""),fRecordTitle(""),fCandRecordName("") {}

NtpStModule::~NtpStModule (  )  [inline]

Definition at line 21 of file NtpStModule.h.

00021 {}


Member Function Documentation

void NtpStModule::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 71 of file NtpStModule.cxx.

References fCandRecordName, fRecordName, fRecordTitle, Registry::Get(), Msg::kDebug, and MSG.

00071                                           {
00072   //
00073   // Purpose: Configure the module given a registry.
00074   //
00075   // Arguments: Registry to use to configure the module.
00076   //
00077   // Return: none.
00078   //
00079 
00080   MSG("NtpSt",Msg::kDebug) << "NtpStModule::Config" << endl;
00081   
00082   //Int_t tmpi;
00083   //Double_t tmpd;
00084   const Char_t* tmps;
00085   if ( r.Get("RecordName", tmps) )  fRecordName = tmps;
00086   if ( r.Get("RecordTitle", tmps) ) fRecordTitle = tmps;
00087   if ( r.Get("CandRecordName",tmps) ) fCandRecordName = tmps;
00088 
00089 }

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

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

00042                                                  {
00043   //
00044   // Purpose: Method to return default configuration.
00045   // 
00046   // Arguments: none.
00047   //
00048   // Return: Registry containing default configuration
00049   //
00050 
00051   MSG("NtpSt",Msg::kDebug) << "NtpStModule::DefaultConfig" << endl;
00052 
00053   static Registry r; 
00054   std::string name = this->JobCModule::GetName();
00055   name += ".config.default";
00056   r.SetName(name.c_str());
00057 
00058   r.UnLockValues();
00059   // insert configuration default definitions here
00060   r.Set("RecordName","Primary");
00061   r.Set("RecordTitle","Created by NtpStModule");
00062   r.Set("CandRecordName","PrimaryCandidateRecord");
00063   
00064   r.LockValues();
00065 
00066   return r;
00067 }

JobCResult NtpStModule::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 93 of file NtpStModule.cxx.

References fCandRecordName, fRecordName, fRecordTitle, DataUtil::GetCandHeader(), RawDaqSnarlHeader::GetErrorCode(), RecDataHeader::GetErrorCode(), CandHeader::GetEvent(), MomNavigator::GetFragment(), RecRecordImp< T >::GetJobHistory(), RecMinos::GetJobHistory(), DataUtil::GetRawHeader(), RawDaqSnarlHeader::GetRemoteSpillType(), RecPhysicsHeader::GetRemoteSpillType(), CandHeader::GetRun(), RawDaqHeader::GetRun(), RecDataHeader::GetRun(), RecDataHeader::GetRunType(), RawDaqHeader::GetRunType(), SimSnarlRecord::GetSimSnarlHeader(), RawDaqSnarlHeader::GetSnarl(), CandHeader::GetSnarl(), RecPhysicsHeader::GetSnarl(), RecDataHeader::GetSubRun(), RawDaqHeader::GetSubRun(), RecPhysicsHeader::GetTimeFrame(), RawDaqHeader::GetTimeFrameNum(), RecPhysicsHeader::GetTrigSrc(), RawDaqSnarlHeader::GetTrigSrc(), RecHeader::GetVldContext(), RecMinosHdr::GetVldContext(), Msg::kDebug, RecJobHistory::kNtpSt, JobCResult::kPassed, Msg::kWarning, MSG, JobCResult::SetFailed(), and JobCResult::SetWarning().

00093                                              {
00094   //
00095   //  Purpose:  Create standard ntuple record.
00096   //
00097   //  Arguments: mom.
00098   //  
00099   //  Return: status.
00100   // 
00101 
00102   JobCResult result(JobCResult::kPassed);  
00103   MSG("NtpSt",Msg::kDebug) << "NtpStModule::Get" << endl;
00104 
00105   // Check that mom exists.
00106   assert(mom);
00107 
00108   const CandRecord* cndrec = dynamic_cast<const CandRecord*>
00109           (mom->GetFragment("CandRecord",fCandRecordName.c_str()));
00110   const SimSnarlRecord* simrec = dynamic_cast<const SimSnarlRecord*>
00111           (mom->GetFragment("SimSnarlRecord"));
00112   if (!cndrec && !simrec ) {
00113     MSG("NtpSt",Msg::kWarning) 
00114     << "No PrimaryCandidateRecord or SimSnarlRecord in Mom" << endl;
00115     result.SetWarning().SetFailed();
00116     return result;
00117   }
00118 
00119   NtpStRecord* ntprec = 0;
00120   if ( !cndrec ) {
00121     // Use SimSnarlRecord header
00122     const SimSnarlHeader* simhdr = simrec->GetSimSnarlHeader();
00123 
00124     RecCandHeader ntphdr(simhdr->GetVldContext(),simhdr->GetRun(),
00125          simhdr->GetSubRun(),simhdr->GetRunType(),simhdr->GetErrorCode(),
00126          simhdr->GetSnarl(),simhdr->GetTrigSrc(),simhdr->GetTimeFrame(),
00127          simhdr->GetRemoteSpillType(),-1);
00128     ntprec = new NtpStRecord(ntphdr);
00129     ntprec -> SetName(fRecordName.c_str());
00130     ntprec -> SetTitle(fRecordTitle.c_str());
00131 
00132     RecJobHistory& jobhist
00133       = const_cast<RecJobHistory&>(ntprec->GetJobHistory());
00134     jobhist.Append(simrec->GetJobHistory());
00135     jobhist.CreateJobRecord(RecJobHistory::kNtpSt);
00136 
00137     mom -> AdoptFragment(ntprec); // pass record to mom to own
00138     return result; // a triggerless event
00139   }
00140   
00141 
00142   // Extract header from CandRecord and use this to create RecCandHeader
00143   // and NtpStRecord.
00144   const CandHeader* cndhdr = cndrec -> GetCandHeader();
00145   const RawRecord* rawrec = 
00146    dynamic_cast<const RawRecord*>(mom->GetFragment("RawRecord","","DaqSnarl"));
00147   if (!rawrec) {
00148     MSG("NtpSt",Msg::kWarning) << "No DaqSnarl RawRecord in Mom"
00149        <<"\nShield data will not be filled and header will be incomplete." 
00150        << endl;
00151     result.SetWarning();
00152   }
00153   if (rawrec) {  
00154     const RawDaqSnarlHeader* rawhdr = dynamic_cast<const RawDaqSnarlHeader*>
00155                                       (rawrec -> GetRawHeader());
00156     RecCandHeader ntphdr(rawhdr->GetVldContext(),rawhdr->GetRun(),
00157          rawhdr->GetSubRun(),rawhdr->GetRunType(),rawhdr->GetErrorCode(),
00158          rawhdr->GetSnarl(),rawhdr->GetTrigSrc(),rawhdr->GetTimeFrameNum(),
00159          rawhdr->GetRemoteSpillType(),cndhdr->GetEvent());
00160     ntprec = new NtpStRecord(ntphdr);
00161   }
00162   else {
00163     // This dependency is terrible, but is because CandRecord never made
00164     // the transition to new base class and CandHeader is incomplete
00165     RecCandHeader ntphdr(cndhdr->GetVldContext(),cndhdr->GetRun(),
00166            -1,-1,0,cndhdr->GetSnarl(),0,-1,-1,cndhdr->GetEvent());
00167     ntprec = new NtpStRecord(ntphdr);
00168   }
00169   
00170   ntprec -> SetName(fRecordName.c_str());
00171   ntprec -> SetTitle(fRecordTitle.c_str());
00172 
00173   RecJobHistory& jobhist
00174       = const_cast<RecJobHistory&>(ntprec->GetJobHistory());
00175   if ( simrec ) jobhist.Append(simrec->GetJobHistory());
00176   jobhist.Append(cndrec->GetJobHistory());
00177   jobhist.CreateJobRecord(RecJobHistory::kNtpSt);
00178 
00179   mom -> AdoptFragment(ntprec);  // pass record to mom to own
00180 
00181   return result;
00182 
00183 }


Member Data Documentation

std::string NtpStModule::fCandRecordName [private]

Definition at line 32 of file NtpStModule.h.

Referenced by Config(), and Get().

std::string NtpStModule::fRecordName [private]

Definition at line 30 of file NtpStModule.h.

Referenced by Config(), and Get().

std::string NtpStModule::fRecordTitle [private]

Definition at line 31 of file NtpStModule.h.

Referenced by Config(), and Get().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1