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

Public Member Functions | |
| PulserTimingMaker () | |
| ~PulserTimingMaker () | |
| JobCResult | Ana (const MomNavigator *mom) |
| const Registry & | DefaultConfig () const |
| void | Config (const Registry &r) |
Private Member Functions | |
| void | FinishPoint () |
Private Attributes | |
| int | fWriteDatabase |
| int | fWriteTextfile |
| double | fSummaryTimeout |
| PulserTimingPoint * | fCurrentPoint |
|
|
Definition at line 26 of file PulserTimingMaker.cxx. References PulserTimingPoint::AsString(), fCurrentPoint, and MSG. 00027 {
00028 fCurrentPoint = 0;
00029 TFile savefile("PulserTimingPoint.open.root","READ");
00030 if(!(savefile.IsZombie())) {
00031 fCurrentPoint = dynamic_cast<PulserTimingPoint*> (savefile.Get("PulserTimingPoint"));
00032 if(fCurrentPoint) MSG("PulserTiming",Msg::kInfo) << "Loaded saved point: " << fCurrentPoint->AsString() << endl;
00033 }
00034
00035 if(fCurrentPoint==0)
00036 MSG("PulserTiming",Msg::kInfo) << "Failed to load saved point" << endl;
00037 }
|
|
|
Definition at line 41 of file PulserTimingMaker.cxx. 00042 {
00043 //FinishPoint();
00044 }
|
|
|
Find and sum up any LI timing summaries in the data stream. Dumps them when complete. Reimplemented from JobCModule. Definition at line 48 of file PulserTimingMaker.cxx. References PulserTimingPoint::AddSummaryBlock(), VldContext::AsString(), PulserTimingPoint::AsString(), fCurrentPoint, FinishPoint(), MomNavigator::FragmentIter(), fSummaryTimeout, RawRecord::GetRawBlockIter(), RawRecord::GetRawHeader(), VldContext::GetTimeStamp(), MSG, PulserTimingPoint::PointIsFinished(), and PulserTimingPoint::PointTimedOut(). 00049 {
00055
00056 // Find the RawRecord, if any.
00057
00058 //DataUtil::dump_mom(mom,std::cout);
00059
00060 JobCResult result = JobCResult::kFailed;
00061
00062 Bool_t anyData = false;
00063 VldContext now;
00064
00065 TObject* tobj;
00066 const RawRecord* rawrec = 0;
00067 // Find the raw record. Assumes only 1.
00068 TIter fragiter = mom->FragmentIter();
00069 while( ( tobj = fragiter.Next() ) ) {
00070 rawrec = dynamic_cast<const RawRecord*>(tobj);
00071 if(rawrec) {
00072
00073 anyData = true;
00074 now = (rawrec->GetRawHeader())->GetVldContext();
00075
00076 // Ask the RawRecord for an iterator over its RawDatBlocks
00077 TIter itr = rawrec->GetRawBlockIter();
00078 RawDataBlock* rawBlk;
00079 while ( ( rawBlk = dynamic_cast<RawDataBlock*>(itr.Next()) ) ) {
00080
00081 // Find the timing summary block, if any.
00082 const RawLITimingSummaryBlock *sumblock =
00083 dynamic_cast<const RawLITimingSummaryBlock *>(rawBlk);
00084
00085 if(sumblock) {
00086
00087 result = JobCResult::kPassed;
00088
00089 // Ok, we have a summary block.
00090 // Do we already have a point running?
00091
00092 if(fCurrentPoint) {
00093 // See if the new block fits in with the current one.
00094 if(fCurrentPoint->AddSummaryBlock(sumblock)) {
00095 // All is well. We added it sucessfully.
00096 MSG("PulserTiming",Msg::kInfo) << "Summary block added successfully to "
00097 << fCurrentPoint->AsString() << endl;
00098 } else {
00099 // The old point must be done. Finish it off.
00100 FinishPoint();
00101 // And start a new one.
00102 fCurrentPoint = new PulserTimingPoint(sumblock);
00103 MSG("PulserTiming",Msg::kInfo) << "Started new point: "
00104 << fCurrentPoint->AsString() << endl;
00105 }
00106 } else {
00107 // Don't have a point going yet; add it.
00108 fCurrentPoint = new PulserTimingPoint(sumblock);
00109 MSG("PulserTiming",Msg::kInfo) << "Started new point: "
00110 << fCurrentPoint->AsString() << endl;
00111 }
00112
00113 } // if(sumblock)
00114
00115 }
00116 }
00117 }
00118
00119 if(anyData) { // There was at least a VldTimeStamp on this Mom.
00120
00121 if(fCurrentPoint) {
00122 if(fCurrentPoint->PointTimedOut(now.GetTimeStamp(),fSummaryTimeout)) {
00123 MSG("PulserTiming",Msg::kInfo) << "Point timed out. " << now.AsString() << " " << fSummaryTimeout << endl;
00124 FinishPoint();
00125 } else if( fCurrentPoint->PointIsFinished() ) {
00126 MSG("PulserTiming",Msg::kInfo) << "Point finished. ";
00127 FinishPoint();
00128 }
00129 }
00130
00131 // Save progress.
00132 if(fCurrentPoint) {
00133 TFile savefile("PulserTimingPoint.open.root","RECREATE");
00134 fCurrentPoint->Write("PulserTimingPoint",TObject::kOverwrite);
00135 savefile.Close();
00136 }
00137
00138 }
00139 return result; // kNoDecision, kFailed, etc.
00140 }
|
|
|
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 189 of file PulserTimingMaker.cxx. References fSummaryTimeout, fWriteDatabase, fWriteTextfile, and Registry::Get(). 00190 {
00191 //======================================================================
00192 // Configure the module given the Registry r
00193 //======================================================================
00194 int tmpi;
00195 double tmpd;
00196
00197 if (r.Get("writeDatabase",tmpi)) { fWriteDatabase = tmpi; }
00198 if (r.Get("writeTextfile",tmpi)) { fWriteTextfile = tmpi; }
00199 if (r.Get("summaryTimeout",tmpd)) { fSummaryTimeout = tmpd; }
00200 }
|
|
|
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 165 of file PulserTimingMaker.cxx. References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues(). 00166 {
00167 //======================================================================
00168 // Supply the default configuration for the module
00169 //======================================================================
00170 static Registry r; // Default configuration for module
00171
00172 // Set name of config
00173 std::string name = this->GetName();
00174 name += ".config.default";
00175 r.SetName(name.c_str());
00176
00177 // Set values in configuration
00178 r.UnLockValues();
00179 r.Set("writeDatabase", 1);
00180 r.Set("writeTextfile", 0);
00181 r.Set("summaryTimeout", 600.0);
00182 r.LockValues();
00183
00184 return r;
00185 }
|
|
|
Definition at line 144 of file PulserTimingMaker.cxx. References fCurrentPoint, MSG, PulserTimingPoint::PointIsGood(), PulserTimingPoint::WriteToDatabase(), and PulserTimingPoint::WriteToTextfile(). Referenced by Ana(). 00145 {
00146 if(fCurrentPoint) {
00147 MSG("PulserTiming",Msg::kInfo) << "Current timing point finishing." << endl;
00148 if(fCurrentPoint->PointIsGood())
00149 if(fWriteDatabase) {
00150 MSG("PulserTiming",Msg::kInfo) << "Writing point to DB..." << endl;
00151 fCurrentPoint->WriteToDatabase();
00152 }
00153 if(fWriteTextfile) {
00154 MSG("PulserTiming",Msg::kInfo) << "Writing point to text file..." << endl;
00155 fCurrentPoint->WriteToTextfile("endrun");
00156 }
00157
00158 delete fCurrentPoint;
00159 fCurrentPoint = 0;
00160 }
00161 }
|
|
|
Definition at line 34 of file PulserTimingMaker.h. Referenced by Ana(), FinishPoint(), and PulserTimingMaker(). |
|
|
Definition at line 32 of file PulserTimingMaker.h. |
|
|
Definition at line 30 of file PulserTimingMaker.h. Referenced by Config(). |
|
|
Definition at line 31 of file PulserTimingMaker.h. Referenced by Config(). |
1.3.9.1