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

Public Member Functions | |
| BeamMonSwicPedsDbuModule () | |
| ~BeamMonSwicPedsDbuModule () | |
| JobCResult | Ana (const MomNavigator *mom) |
| void | BeginFile () |
| void | EndFile () |
| void | EndJob () |
Private Member Functions | |
| void | Dump () |
Private Attributes | |
| BDPipeline | fPipe |
| BDSwicPeds * | fPedsProc |
| int | fCount |
This module should typically be run to *only* fill the pedestal tables and not in conjunction with the filling of any other beam monitoring tables or analysis. This is because just about anything that needs SWIC scanner devices needs correct pedestals (and channel masks, but that is a different story).
Created on: Wed Apr 13 18:19:14 2005
Definition at line 40 of file BeamMonSwicPedsDbuModule.h.
|
|
Definition at line 34 of file BeamMonSwicPedsDbuModule.cxx. References fPedsProc, fPipe, and BDPipeline::GetProcessPipeline(). 00035 : fPipe() 00036 , fPedsProc(new BDSwicPeds) 00037 , fCount(0) 00038 { 00039 fPipe.GetProcessPipeline().push_back(fPedsProc); 00040 }
|
|
|
Definition at line 42 of file BeamMonSwicPedsDbuModule.cxx. 00043 {
00044 }
|
|
|
Implement this for read only access to the MomNavigator Reimplemented from JobCModule. Definition at line 46 of file BeamMonSwicPedsDbuModule.cxx. References fPipe, BDUniquify::GetUniqueBlocks(), MSG, BDPipeline::SetSpill(), and RawBeamMonBlock::TclkTriggerEvent(). 00047 {
00048 static BDUniquify uniqifier;
00049 vector<BDUniquify::BlockPair> blocks = uniqifier.GetUniqueBlocks(*mom);
00050
00051 size_t nblocks = blocks.size();
00052
00053 if (nblocks == 0) {
00054 MSG("BD",Msg::kWarning)
00055 << "No good beam monitoring data in MOM\n";
00056 return JobCResult::kFailed;
00057 }
00058
00059 const int trigger_event = 0xa9; // FIXME: needs to be a configurable param.
00060 for (size_t iblock=0; iblock<nblocks; ++iblock) {
00061 const RawBeamMonHeaderBlock& rbmhb = *blocks[iblock].first;
00062 const RawBeamMonBlock& rbmb = *blocks[iblock].second;
00063
00064 if (rbmb.TclkTriggerEvent() != trigger_event) {
00065 MSG("BD",Msg::kWarning)
00066 << "Wrong trigger event: " << rbmb.TclkTriggerEvent()
00067 << " != " << trigger_event << endl;
00068 continue;
00069 }
00070
00071
00072 fPipe.SetSpill(rbmhb,rbmb);
00073 }
00074
00075 return JobCResult::kAOK;
00076 }
|
|
|
Implement for notification of begin of file. See GetCurrentFile(). Reimplemented from JobCModule. Definition at line 77 of file BeamMonSwicPedsDbuModule.cxx. References JobCModule::GetCurrentFile(), and MSG. 00078 {
00079 MSG("BD",Msg::kDebug) << "BeginFile: " << this->GetCurrentFile() << endl;
00080 }
|
|
|
Definition at line 94 of file BeamMonSwicPedsDbuModule.cxx. References BDSwicPeds::Clear(), DbiWriter< T >::Close(), done(), fPedsProc, BDSwicPeds::GetAllChannels(), UtilRunningAverageVector::GetPopulationSize(), BDSwicPeds::GetStart(), BDSwicPeds::GetStop(), MSG, UtilRunningAverageVector::PopulationMean(), and UtilRunningAverageVector::PopulationSigma(). Referenced by EndFile(). 00095 {
00096 VldTimeStamp vts_start = fPedsProc->GetStart();
00097 VldTimeStamp vts_stop = fPedsProc->GetStop();
00098
00099 if (vts_stop < vts_start) {
00100 MSG("BD",Msg::kWarning)
00101 << "No Peds for any devices in this database dump\n";
00102 return;
00103 }
00104
00105 const BDSwicPeds::SwicMap& chmap = fPedsProc->GetAllChannels();
00106 BDSwicPeds::SwicMap::const_iterator it, done = chmap.end();
00107
00108 // Do an initial run through to see if there is at least one
00109 // pedestal set ready. This is done to avoid creating VLD entries
00110 // with no associated main table rows.
00111 bool got_one = false;
00112 for (it=chmap.begin(); it != done; ++it) {
00113 assert(it->second);
00114 if (it->second->GetPopulationSize() > 0) {
00115 got_one = true;
00116 break;
00117 }
00118 }
00119 if (!got_one) {
00120 MSG("BD",Msg::kWarning) << "Aborting DB dump, no data\n";
00121 return;
00122 }
00123
00124 VldRange range(Detector::kNear|Detector::kFar,SimFlag::kData,
00125 vts_start,vts_stop,"Beam");
00126
00127 VldTimeStamp now;
00128 DbiWriter<BeamMonSwicPeds> writer(range,-1,0,now);
00129
00130
00131 for (it=chmap.begin(); it != done; ++it) {
00132 const UtilRunningAverageVector& urav = *(it->second);
00133
00134 int nsamples = urav.GetPopulationSize();
00135 if (!nsamples) continue;
00136
00137 BeamMonSwicPeds ped(it->first.c_str());
00138 ped.SetNsamples(nsamples);
00139
00140 vector<double> means = urav.PopulationMean();
00141
00142 if (means.size() != 96) {
00143 MSG("BD",Msg::kFatal)
00144 << nsamples << " samples but size (" << means.size()
00145 << ") doesn't match for " << it->first << endl;
00146 abort();
00147 }
00148
00149 double tot = 0;
00150 for (int ind=0; ind<96; ++ind) tot += means[ind];
00151
00152 ped.SetChannelMeans(means);
00153 ped.SetChannelSigmas(urav.PopulationSigma());
00154
00155 writer << ped;
00156 MSG("BD",Msg::kDebug)
00157 << it->first << ", " << nsamples << " samples, tot peds = " << tot << endl;
00158 if (tot == 0.0) {
00159 MSG("BD",Msg::kWarning)
00160 << it->first << ", " << nsamples << " samples, tot peds = " << tot << endl;
00161 }
00162
00163 }
00164
00165 writer.Close();
00166 fPedsProc->Clear();
00167 }
|
|
|
Implement for notification of end of file. See GetLastFile(). Reimplemented from JobCModule. Definition at line 83 of file BeamMonSwicPedsDbuModule.cxx.
|
|
|
Implement for notification of end of job Reimplemented from JobCModule. Definition at line 89 of file BeamMonSwicPedsDbuModule.cxx. References MSG. 00090 {
00091 MSG("BD",Msg::kDebug) << "EOJ\n";
00092 }
|
|
|
Definition at line 61 of file BeamMonSwicPedsDbuModule.h. |
|
|
Definition at line 59 of file BeamMonSwicPedsDbuModule.h. Referenced by BeamMonSwicPedsDbuModule(), and Dump(). |
|
|
Definition at line 56 of file BeamMonSwicPedsDbuModule.h. Referenced by Ana(), and BeamMonSwicPedsDbuModule(). |
1.3.9.1