PulserSummaryModule Class Reference

#include <PulserSummaryModule.h>

Inheritance diagram for PulserSummaryModule:

JobCModule List of all members.

Public Member Functions

 PulserSummaryModule ()
 ~PulserSummaryModule ()
JobCResult Reco (MomNavigator *mom)
void BeginRun ()
void EndRun ()

Private Member Functions

void FinishList (MomNavigator *mom, VldTimeStamp ts)

Private Attributes

PulserSummaryListfSummaryList
std::vector< LIfLiData
unsigned int fLiPtr
int fDeltaT
bool fFirst
int fLastSec

Classes

struct  LI

Detailed Description

Definition at line 43 of file PulserSummaryModule.h.


Constructor & Destructor Documentation

PulserSummaryModule::PulserSummaryModule (  ) 

Definition at line 75 of file PulserSummaryModule.cxx.

References Msg::kVerbose, and MSG.

00076 {
00077   MSG("Pulser",Msg::kVerbose) << "PulserSummaryModule ctor\n";
00078   fSummaryList=0;
00079   fFirst = true;
00080 }

PulserSummaryModule::~PulserSummaryModule (  ) 

Definition at line 82 of file PulserSummaryModule.cxx.

References Msg::kVerbose, and MSG.

00083 {
00084   MSG("Pulser",Msg::kVerbose) << "PulserSummaryModule dtor\n";
00085 }


Member Function Documentation

void PulserSummaryModule::BeginRun (  )  [virtual]

Implement for notification of begin of run (meaningful for Daq data only). See GetCurrentRun().

Reimplemented from JobCModule.

Definition at line 203 of file PulserSummaryModule.cxx.

References fSummaryList, Msg::kDebug, and MSG.

00204 {
00205   MSG("Pulser",Msg::kDebug) << "PulserSummaryModule::BeginRun()"<<endl;
00206   fSummaryList=0;
00207 }

void PulserSummaryModule::EndRun (  )  [virtual]

Implement for notification of end of run (meaningful for Daq data only). See GetLastRun().

Reimplemented from JobCModule.

Definition at line 209 of file PulserSummaryModule.cxx.

References PulserSummaryList::Finish(), fSummaryList, PulserSummaryList::GetExpectedPoints(), PulserSummaryList::GetNumPulses(), PulserSummaryList::GetTriggers(), Msg::kDebug, Msg::kInfo, and MSG.

00210 {
00211 //  // Drop part-completed point at end of run, as liMaster will repeat it.
00212 //  delete fSummaryList;
00213 //  fSummaryList = 0;
00214   if (!fSummaryList) return;
00215 
00216   fSummaryList->Finish();
00217 
00218   // Test to see if SummaryList is OK here - squeal if it isn't.
00219   
00220   float trigfrac; 
00221   
00222   if (fSummaryList->GetExpectedPoints()!=0) {
00223     // Do we have enough triggers?
00224     trigfrac = float(fSummaryList->GetTriggers())/float(fSummaryList->GetNumPulses());
00225   } else {
00226     delete fSummaryList;
00227     fSummaryList=0;
00228     return;
00229   }
00230   
00231   if (trigfrac < 0.95) {
00232     MSG("Pulser",Msg::kInfo)<<"Only saw "<<trigfrac<<" of expected "<<fSummaryList->GetNumPulses()<<" triggers. Dumping point.\n";
00233     delete fSummaryList;
00234     fSummaryList=0;
00235     return;
00236   }
00237   
00238   MSG("Pulser",Msg::kDebug) <<"PulserSummaryModule::EndRun(): trying to save the last point"<<endl;
00239   
00240   TFolder *lf = dynamic_cast<TFolder *>
00241     (gROOT->GetRootFolder()->FindObject("Loon"));
00242   if (lf==0) {
00243     lf = gROOT->GetRootFolder()->AddFolder("Loon", "Loon analysis");
00244     gROOT->GetListOfBrowsables()->Add(lf, "Loon");
00245   }
00246 
00247   TFolder *fTFolder = lf->AddFolder("Pulser","Pulser analysis");
00248   fTFolder->Add(fSummaryList);
00249   MSG("Pulser",Msg::kDebug) <<"PulserSummaryModule::EndRun(): last point added to a temporary folder: Pulser"<<endl;
00250 
00251 
00252 }

void PulserSummaryModule::FinishList ( MomNavigator mom,
VldTimeStamp  ts 
) [private]

Definition at line 157 of file PulserSummaryModule.cxx.

References MomNavigator::AdoptFragment(), PulserSummaryList::Finish(), fSummaryList, PulserSummaryList::GetExpectedPoints(), PulserSummaryList::GetHeight(), PulserSummaryList::GetLed(), PulserSummaryList::GetNumPulses(), PulserSummaryList::GetPointIndex(), PulserSummaryList::GetPulserBox(), PulserSummaryList::GetTriggers(), PulserSummaryList::GetWidth(), Msg::kDebug, Msg::kError, Msg::kInfo, Msg::kWarning, and MSG.

Referenced by Reco().

00158 {
00159   MSG("Pulser",Msg::kInfo) <<ts<<" Summary Complete! Box " << fSummaryList->GetPulserBox() << " Led "<< fSummaryList->GetLed()<<", point "<<fSummaryList->GetPointIndex()<<" of "<<fSummaryList->GetExpectedPoints()<<endl;
00160 
00161   // Check if there are triggers:
00162   if (fSummaryList->GetTriggers()==0)  {
00163     MSG("Pulser",Msg::kDebug)<<"Found summary with no triggers. Triggers, Pulses: "
00164                              <<fSummaryList->GetTriggers() << ", "
00165                              <<fSummaryList->GetNumPulses() << endl;
00166     MSG("Pulser",Msg::kDebug)<<"LED, PB, PH, PW: "
00167                              <<fSummaryList->GetLed() << ", "
00168                              <<fSummaryList->GetPulserBox() << ", "
00169                              <<fSummaryList->GetHeight() << ", "
00170                              <<fSummaryList->GetWidth() << endl;
00171 
00172     fSummaryList=0;
00173   }
00174 
00175   if (fSummaryList) {
00176     fSummaryList->Finish();
00177     
00178     // Test to see if SummaryList is OK here - squeal if it isn't.
00179     
00180     float trigfrac; 
00181     if (fSummaryList->GetExpectedPoints()!=0) {
00182       // Do we have enough triggers?
00183       trigfrac = float(fSummaryList->GetTriggers())/float(fSummaryList->GetNumPulses());
00184     } else {
00185       MSG("Pulser",Msg::kWarning)<<"Found empty summary. Triggers, ExpectedPoints, Pulses: "
00186                                  <<fSummaryList->GetTriggers() << ", "<< fSummaryList->GetExpectedPoints()<<", "
00187                                  <<fSummaryList->GetNumPulses() << endl;
00188       trigfrac = 99999.;
00189     }
00190     
00191     if (trigfrac < 0.95) {
00192       MSG("Pulser",Msg::kError)<<"Only saw "<<trigfrac<<" of expected "<<fSummaryList->GetNumPulses()<<" triggers. Dumping point.\n";
00193       delete fSummaryList;
00194       fSummaryList=0;
00195       return;
00196     }
00197   }
00198 
00199   mom->AdoptFragment(fSummaryList);
00200   fSummaryList=0;
00201 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 87 of file PulserSummaryModule.cxx.

References PulserSummaryList::Add(), FinishList(), fLastSec, MomNavigator::FragmentIter(), fSummaryList, RawLIAdcSummaryBlock::GetCalibPoint(), RawLIAdcSummaryBlock::GetCalibType(), PulserSummaryList::GetExpectedPoints(), PulserSummaryList::GetLed(), RawLIAdcSummaryBlock::GetLed(), PulserSummaryList::GetPointIndex(), PulserSummaryList::GetPulserBox(), RawLIAdcSummaryBlock::GetPulserBox(), DataUtil::GetVldContext(), JobCResult::kAOK, Msg::kDebug, Msg::kInfo, Msg::kVerbose, and MSG.

00088 {
00089   MSG("Pulser",Msg::kVerbose) << "PulserSummaryModule::Reco()\n";
00090   
00091   // Find RawRecord fragment in MOM.
00092   TIter iter = mom->FragmentIter();
00093   while (TObject *obj = iter.Next()) {
00094     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00095     if (rawrec) {
00096       MSG("Pulser",Msg::kVerbose) << "PSM::Reco() got vld: " <<(rawrec->GetRawHeader())->GetVldContext() <<endl;
00097       int sec = rawrec->GetHeader()->GetVldContext().GetTimeStamp().GetSec();
00098       // look for a RawLIAdcSummaryBlock in the RawRecord
00099       VldTimeStamp ts = rawrec->GetHeader()->GetVldContext().GetTimeStamp();
00100       const RawLIAdcSummaryBlock *rawsum = 
00101         dynamic_cast<const RawLIAdcSummaryBlock *>
00102         (rawrec->FindRawBlock("RawLIAdcSummaryBlock"));
00103 
00104       if (rawsum) {
00105         // Got a LI summary
00106         MSG("Pulser",Msg::kVerbose) << 
00107           "PSM::Reco() : Got a LI summary" << sec<<endl;
00108         fLastSec = sec;
00109 
00110 
00111         // Code to use liMaster.log obsolete so now deleted
00112 
00113         //OK - now rawsum definitely contains its header info.
00114         // if (this rawLI doesn't match fSUmmaryList, dispatch list
00115         // elsewhere - if time -fLastSec >5, dispatch...
00116         if (fSummaryList) {
00117           //      if (rawsum->GetLed()==fSummaryList->GetLed() && 
00118           //          rawsum->GetCalibPoint()==fSummaryList->GetPointIndex()) {
00119           // Match pulser box and whether it is a drift point or gain curve
00120           if (rawsum->GetLed()==fSummaryList->GetLed() && 
00121               rawsum->GetCalibPoint()==fSummaryList->GetPointIndex() &&
00122               rawsum->GetCalibType()==fSummaryList->GetExpectedPoints() &&
00123               rawsum->GetPulserBox()==fSummaryList->GetPulserBox()) {
00124             fSummaryList->Add(*rawsum);
00125             
00126             MSG("Pulser",Msg::kDebug) << 
00127               "PSM::Reco() : Existing Point. Pulser Box, Led" << rawsum->GetPulserBox() << ", " << rawsum->GetLed()<<endl;
00128 
00129           }
00130           else {
00131             // We're on a new point now!
00132             MSG("Pulser",Msg::kDebug)<<"New point at "<<sec<<endl;
00133             MSG("Pulser",Msg::kDebug) << 
00134               "PSM::Reco() : New Point. Pulser Box, Led" << rawsum->GetPulserBox() << ", " << rawsum->GetLed()<<endl;
00135             FinishList(mom,ts);
00136             fSummaryList = new PulserSummaryList(*rawsum);
00137           }
00138         } 
00139         else {
00140           fSummaryList = new PulserSummaryList(*rawsum);
00141         }
00142       }
00143       
00144       if (fSummaryList&&(sec-fLastSec>10)) {
00145          // 4 secs without an LI summary? Must be end of point...
00146          MSG("Pulser",Msg::kInfo)<<"Point timed out "<<sec<<endl;
00147          FinishList(mom,ts);
00148       }
00149       
00150       
00151     }
00152   }
00153   return JobCResult::kAOK;
00154 }


Member Data Documentation

int PulserSummaryModule::fDeltaT [private]

Definition at line 71 of file PulserSummaryModule.h.

bool PulserSummaryModule::fFirst [private]

Definition at line 72 of file PulserSummaryModule.h.

int PulserSummaryModule::fLastSec [private]

Definition at line 73 of file PulserSummaryModule.h.

Referenced by Reco().

std::vector<LI> PulserSummaryModule::fLiData [private]

Definition at line 69 of file PulserSummaryModule.h.

unsigned int PulserSummaryModule::fLiPtr [private]

Definition at line 70 of file PulserSummaryModule.h.

PulserSummaryList* PulserSummaryModule::fSummaryList [private]

Definition at line 55 of file PulserSummaryModule.h.

Referenced by BeginRun(), EndRun(), FinishList(), and Reco().


The documentation for this class was generated from the following files:
Generated on Thu Apr 10 23:03:32 2014 for loon by  doxygen 1.4.7