PrintStat Class Reference

#include <PrintStat.h>

Inheritance diagram for PrintStat:
JobCModule

List of all members.

Public Member Functions

 PrintStat ()
 ~PrintStat ()
void BeginJob ()
const RegistryDefaultConfig () const
void Config (const Registry &r)
JobCResult Ana (const MomNavigator *mom)
void EndJob ()

Private Attributes

Int_t fActOutLine
Int_t fOutputRate
Int_t fMaxOutLine

Detailed Description

Definition at line 15 of file PrintStat.h.


Constructor & Destructor Documentation

PrintStat::PrintStat (  ) 

Definition at line 26 of file PrintStat.cxx.

References Msg::kDebug, and MSG.

00026                      :
00027   fActOutLine(-1)      // event counter
00028 {
00029 //======================================================================
00030 // Set the initial state of your module. The code above initializes the
00031 // variables listed to the values in parentheses. 
00032 //======================================================================
00033 
00034   MSG("Stat",Msg::kDebug) << "Constructing PrintStat.\n";
00035 
00036 }

PrintStat::~PrintStat (  ) 

Definition at line 41 of file PrintStat.cxx.

References Msg::kDebug, and MSG.

00042 {
00043 //======================================================================
00044 // This is my destructor, which currently does nothing.
00045 //======================================================================
00046 
00047   MSG("Stat",Msg::kDebug) << "Destructing PrintStat.\n";
00048 
00049 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 109 of file PrintStat.cxx.

References bfld::AsString(), VldTimeStamp::AsString(), fActOutLine, fMaxOutLine, fOutputRate, MomNavigator::FragmentIter(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), VldContext::GetSimFlag(), RawDaqSnarlHeader::GetSnarl(), VldContext::GetTimeStamp(), RecMinosHdr::GetVldContext(), Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Msg::kVerbose, and MSG.

00110 {
00111 //======================================================================
00112 // Given the object to which the data is attached perform some
00113 // analysis of the data
00114 //======================================================================
00115 
00116   MSG("Stat", Msg::kDebug) << "Starting PrintStat::Ana.\n";
00117 
00118   // Accumulate statistics
00119 
00120   fActOutLine++;
00121   if (fActOutLine%fOutputRate!=0)           return JobCResult::kPassed;
00122   if (fActOutLine/fOutputRate>fMaxOutLine)  return JobCResult::kPassed;
00123 
00124   // find some pointers
00125 
00126   TObject* tobj;
00127   TIter    fragiter = mom->FragmentIter();
00128 
00129   RawRecord*                 rr   = 0;
00130   const RawDaqSnarlHeader*   rdsh = 0;
00131 
00132   // loop over all fragments of mom and get pointers
00133 
00134   while( ( tobj = fragiter.Next() ) ) { 
00135     if( ( rr = dynamic_cast<RawRecord*>(tobj) ) ) {
00136 
00137       MSG("Stat", Msg::kDebug) << "Found Next RawRecord. rr= "
00138                                  << rr << endl;
00139 
00140       if ( !rdsh )  rdsh  = dynamic_cast<const RawDaqSnarlHeader*>
00141                       (rr->GetRawHeader());
00142     } else {
00143       MSG("Stat", Msg::kVerbose) << "Not a RawRecord.\n";
00144 
00145     }  // if rawrec
00146   } // while
00147 
00148 
00149   if ( rdsh ) {
00150 
00151     Int_t        Run   = rdsh->GetRun();
00152     Int_t        Snarl = rdsh->GetSnarl();
00153     VldContext   vldc  = rdsh->GetVldContext();
00154     VldTimeStamp vldts = vldc.GetTimeStamp();
00155 
00156     MSG("Stat",Msg::kInfo) << "===>> " 
00157                            << SimFlag::AsString(vldc.GetSimFlag())
00158                            << " Snarl(" << setw(5) << fActOutLine << "):"
00159                            << " -- run = "    << setw(6) << Run
00160                            << " -- snarl = "  << setw(6) << Snarl
00161                            << " -- time = "   << vldts.AsString("c")
00162                            << " <<===" << endl;
00163   } else {
00164 
00165     MSG("Stat",Msg::kDebug) << "No RawDaqSnarlHeader.";
00166 
00167   }
00168   
00169   return JobCResult::kPassed;
00170 
00171 }

void PrintStat::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 53 of file PrintStat.cxx.

References Msg::kDebug, and MSG.

00054 {
00055 //======================================================================
00056 // This is my destructor, which currently does nothing.
00057 //======================================================================
00058 
00059   MSG("Stat",Msg::kDebug) << "PrintStat::BeginJob starts here.\n";
00060 
00061 }

void PrintStat::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 90 of file PrintStat.cxx.

References fMaxOutLine, fOutputRate, and Registry::Get().

00091 {
00092 //======================================================================
00093 // Configure the module given the registry r
00094 // Do all configuration here.
00095 // Beware: this methode may be called several times!
00096 //======================================================================
00097 
00098   int    tmpi;
00099 
00100   if (r.Get("OutputRate", tmpi)) { fOutputRate  = tmpi; }
00101   if (fOutputRate<1) fOutputRate = 1;
00102 
00103   if (r.Get("MaxOutLine", tmpi)) { fMaxOutLine  = tmpi; }
00104 
00105 }

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

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

00066 {
00067 //======================================================================
00068 // Create a registry which holds the default configuration and return it
00069 //======================================================================
00070   static Registry r;
00071 
00072   MSG("Stat",Msg::kDebug) << "PrintStat::DefaultConfig starts here.\n";
00073 
00074   // Set name of config
00075   std::string name = this->GetName();
00076   name += ".config.default";
00077   r.SetName(name.c_str());
00078 
00079   // Set values of config
00080   r.UnLockValues();
00081   r.Set("OutputRate",  10);
00082   r.Set("MaxOutLine", 100000);
00083   r.LockValues();
00084 
00085   return r;
00086 }

void PrintStat::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 175 of file PrintStat.cxx.

References fActOutLine, Msg::kInfo, and MSG.

00176 {
00177 //======================================================================
00178 // At the end of the job print some stuff out and save the histogram
00179 // to a file
00180 //======================================================================
00181 
00182   MSG("Stat",Msg::kInfo) << "PrintStat: Total Events processed = " 
00183                          << fActOutLine << "\n";
00184 
00185 }


Member Data Documentation

Int_t PrintStat::fActOutLine [private]

Definition at line 30 of file PrintStat.h.

Referenced by Ana(), and EndJob().

Int_t PrintStat::fMaxOutLine [private]

Definition at line 32 of file PrintStat.h.

Referenced by Ana(), and Config().

Int_t PrintStat::fOutputRate [private]

Definition at line 31 of file PrintStat.h.

Referenced by Ana(), and Config().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1