BeamMonDbuModule Class Reference
[BeamDataDbi]

A module for filling BeamMon DB tables. More...

#include <BeamMonDbuModule.h>

Inheritance diagram for BeamMonDbuModule:
JobCModule

List of all members.

Public Member Functions

 BeamMonDbuModule ()
 ~BeamMonDbuModule ()
JobCResult Ana (const MomNavigator *mom)
void BeginFile ()
void EndFile ()
void EndJob ()

Private Member Functions

void FillPipeline ()
void Reap ()
void Process (const RawBeamMonHeaderBlock &rbmhb, const RawBeamMonBlock &rbmb)

Private Attributes

BDPipeline fPipe
BMFileSummaryFillerfFileSummaryFiller
BMSpillFillerfSpillFiller
BDScalarfProtonIntensity [4]
BDEarliestfEarliest
BDHornCurrentfHornCurrent
BDTargetfTarget
BDHadMuMonfHadMu [4]

Detailed Description

A module for filling BeamMon DB tables.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.11
Date:
Date
2005/11/07 21:38:22

Contact: bv@bnl.gov

Created on: Wed Apr 13 18:16:24 2005

Id
BeamMonDbuModule.h,v 1.11 2005/11/07 21:38:22 bv Exp

Definition at line 42 of file BeamMonDbuModule.h.


Constructor & Destructor Documentation

BeamMonDbuModule::BeamMonDbuModule (  ) 

Definition at line 30 of file BeamMonDbuModule.cxx.

References FillPipeline().

00031     : JobCModule()
00032     , fPipe()
00033     , fFileSummaryFiller(0)
00034     , fSpillFiller(0)
00035 {
00036     this->FillPipeline();
00037 }

BeamMonDbuModule::~BeamMonDbuModule (  ) 

Definition at line 38 of file BeamMonDbuModule.cxx.

References Msg::kInfo, MSG, and Reap().

00039 {
00040     MSG("BD",Msg::kInfo) << " BeamMonDbuModule destructor\n";
00041     this->Reap();
00042 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 84 of file BeamMonDbuModule.cxx.

References BDUniquify::GetUniqueBlocks(), JobCResult::kAOK, JobCResult::kFailed, Msg::kWarning, MSG, and Process().

00085 {
00086     static BDUniquify uniqifier;
00087     vector<BDUniquify::BlockPair> blocks = uniqifier.GetUniqueBlocks(*mom);
00088 
00089     size_t nblocks = blocks.size();
00090 
00091     if (nblocks == 0) {
00092         MSG("BD",Msg::kWarning)
00093             << "No good beam monitoring data in MOM\n";
00094         return JobCResult::kFailed;
00095     }
00096 
00097     for (size_t iblock=0; iblock<nblocks; ++iblock) {
00098         const RawBeamMonHeaderBlock& rbmhb = *blocks[iblock].first;
00099         const RawBeamMonBlock& rbmb = *blocks[iblock].second;
00100 
00101         this->Process(rbmhb,rbmb);
00102     }
00103     return JobCResult::kAOK;
00104 
00105 }

void BeamMonDbuModule::BeginFile (  )  [virtual]

Implement for notification of begin of file. See GetCurrentFile().

Reimplemented from JobCModule.

Definition at line 142 of file BeamMonDbuModule.cxx.

References fFileSummaryFiller, JobCModule::GetCurrentFile(), Msg::kDebug, MSG, and BMFileSummaryFiller::NewFile().

00143 {
00144     const char* file = this->GetCurrentFile();
00145     MSG("BD",Msg::kDebug) << "BeginFile: " << file << endl;
00146     fFileSummaryFiller->NewFile(file);
00147 }

void BeamMonDbuModule::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 149 of file BeamMonDbuModule.cxx.

References BMFileSummaryFiller::Commit(), fFileSummaryFiller, Msg::kDebug, and MSG.

00150 {
00151     MSG("BD",Msg::kDebug) << "EndFile\n";
00152     fFileSummaryFiller->Commit();
00153 }

void BeamMonDbuModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 155 of file BeamMonDbuModule.cxx.

References Msg::kDebug, MSG, and Reap().

00156 {
00157     MSG("BD",Msg::kDebug) << "EndJob\n";
00158     this->Reap();
00159 }

void BeamMonDbuModule::FillPipeline (  )  [private]

Definition at line 60 of file BeamMonDbuModule.cxx.

References fEarliest, fFileSummaryFiller, fHadMu, fHornCurrent, fPipe, fProtonIntensity, fSpillFiller, fTarget, BDPipeline::GetProcessPipeline(), BDScalar::SetDevice(), and toroids.

Referenced by BeamMonDbuModule().

00061 {
00062     BDPipeline::ProcessPipeline& pipeline = fPipe.GetProcessPipeline();
00063 
00064     const char* toroids[] = { "E:TOR101", "E:TR101D", "E:TORTGT", "E:TRTGTD", 0 };
00065     for (int ind=0; toroids[ind]; ++ind) {
00066         fProtonIntensity[ind] = new BDScalar();
00067         fProtonIntensity[ind]->SetDevice(toroids[ind]);
00068         pipeline.push_back(fProtonIntensity[ind]);
00069     }
00070     pipeline.push_back(fEarliest = new BDEarliest);
00071     pipeline.push_back(fHornCurrent = new BDHornCurrent);
00072     pipeline.push_back(fTarget = new BDTarget);
00073 
00074     for (int ind=0; ind<4; ++ind) {
00075         fHadMu[ind] = new BDHadMuMon;
00076     }
00077 
00078     fFileSummaryFiller = new BMFileSummaryFiller(*fProtonIntensity[3]);
00079     fSpillFiller = new BMSpillFiller(*fEarliest,fProtonIntensity,
00080                                      *fHornCurrent,*fTarget,fHadMu);
00081 }

void BeamMonDbuModule::Process ( const RawBeamMonHeaderBlock rbmhb,
const RawBeamMonBlock rbmb 
) [private]

Definition at line 106 of file BeamMonDbuModule.cxx.

References fFileSummaryFiller, fHadMu, fPipe, fSpillFiller, JobCModule::Get(), RawBeamMonHeaderBlock::GetTimeStamp(), BDDevices::HadMuMonitors(), Msg::kDebug, Msg::kWarning, MSG, BDHadMuMon::SetData(), BDPipeline::SetSpill(), BMFileSummaryFiller::SetTclkTrigger(), BMSpillFiller::Spill(), RawBeamMonBlock::TclkTriggerDelay(), RawBeamMonBlock::TclkTriggerEvent(), and BMFileSummaryFiller::Timestamp().

Referenced by Ana().

00108 {
00109     vector<string> hadmu_name = BDDevices::HadMuMonitors();
00110     for (int ind=0; ind<4; ++ind) {
00111         const RawBeamData* d = rbmb[hadmu_name[ind].c_str()];
00112         if (!d) {
00113             MSG("BD",Msg::kDebug)
00114                 << "No device data for " << hadmu_name[ind] << ", skipping\n";
00115             continue;
00116         }
00117         fHadMu[ind]->SetData(*d);
00118     }
00119 
00120     BDSwicCalibrator::Get().Calibrate(rbmhb,rbmb);
00121 
00122     const int trigger_event = 0xa9; // FIXME: needs to be a configurable param.
00123     if (rbmb.TclkTriggerEvent() != trigger_event) {
00124         MSG("BD",Msg::kWarning)
00125             << "Wrong trigger event: " << rbmb.TclkTriggerEvent()
00126             << " != " << trigger_event << endl;
00127         return;
00128     }
00129 
00130     // Alert each table of new data
00131     fPipe.SetSpill(rbmhb,rbmb);
00132 
00133 
00134     fFileSummaryFiller->Timestamp(rbmhb.GetTimeStamp());
00135     fFileSummaryFiller->SetTclkTrigger(rbmb.TclkTriggerEvent(),
00136                                        rbmb.TclkTriggerDelay());
00137 
00138     fSpillFiller->Spill(rbmhb,rbmb);
00139 
00140 }

void BeamMonDbuModule::Reap (  )  [private]

Definition at line 44 of file BeamMonDbuModule.cxx.

References fFileSummaryFiller, fHadMu, and fSpillFiller.

Referenced by EndJob(), and ~BeamMonDbuModule().

00045 {
00046     if (fSpillFiller) 
00047         delete fSpillFiller; 
00048     fSpillFiller = 0;
00049 
00050     if (fFileSummaryFiller)
00051         delete fFileSummaryFiller; 
00052     fFileSummaryFiller = 0;
00053 
00054     for (int ind=0; ind<4; ++ind) {
00055         if (fHadMu[ind]) delete fHadMu[ind];
00056         fHadMu[ind] = 0;
00057     }
00058 }


Member Data Documentation

Definition at line 72 of file BeamMonDbuModule.h.

Referenced by FillPipeline().

Definition at line 67 of file BeamMonDbuModule.h.

Referenced by BeginFile(), EndFile(), FillPipeline(), Process(), and Reap().

Definition at line 77 of file BeamMonDbuModule.h.

Referenced by FillPipeline(), Process(), and Reap().

Definition at line 73 of file BeamMonDbuModule.h.

Referenced by FillPipeline().

Definition at line 64 of file BeamMonDbuModule.h.

Referenced by FillPipeline(), and Process().

Definition at line 71 of file BeamMonDbuModule.h.

Referenced by FillPipeline().

Definition at line 68 of file BeamMonDbuModule.h.

Referenced by FillPipeline(), Process(), and Reap().

Definition at line 74 of file BeamMonDbuModule.h.

Referenced by FillPipeline().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1