JobCDemoModuleA Class Reference

#include <JobCDemoModuleA.h>

Inheritance diagram for JobCDemoModuleA:
JobCModule

List of all members.

Public Member Functions

 JobCDemoModuleA ()
 ~JobCDemoModuleA ()
void BeginJob ()
void EndJob ()
void BeginFile ()
void EndFile ()
void BeginRun ()
void EndRun ()
JobCResult Get (MomNavigator *mom)
JobCResult Ana (const MomNavigator *mom)
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void HandleCommand (JobCommand *command)
void Help ()

Private Attributes

int fNget
int fNana
int fNreco

Detailed Description

Definition at line 20 of file JobCDemoModuleA.h.


Constructor & Destructor Documentation

JobCDemoModuleA::JobCDemoModuleA (  ) 

Definition at line 28 of file JobCDemoModuleA.cxx.

References Msg::kDebug, and MSG.

00028                                  : fNget(0),fNana(0),fNreco(0)
00029 {
00030   MSG("JobC", Msg::kDebug) << "** DemoModuleA::Constructor\n";
00031 }

JobCDemoModuleA::~JobCDemoModuleA (  ) 

Definition at line 35 of file JobCDemoModuleA.cxx.

References Msg::kDebug, and MSG.

00036 {
00037   MSG("JobC", Msg::kDebug) << "** DemoModuleA::Destructor\n";
00038 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 148 of file JobCDemoModuleA.cxx.

References fNana, JobCResult::kAOK, Msg::kInfo, and MSG.

00149 {
00150   ++fNana;
00151   
00152   MSG("JobC", Msg::kInfo)
00153     << "** DemoModuleA(" << this << ")::Ana (" << mom << ")" 
00154     << " Ana=" << fNana << "\n";
00155   
00156   return JobCResult::kAOK;
00157 }

void JobCDemoModuleA::BeginFile (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 93 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00094 {
00095   MSG("JobC", Msg::kInfo) << "** DemoModuleA::BeginFile()\n";
00096 }

void JobCDemoModuleA::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 79 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00080 {
00081   MSG("JobC", Msg::kInfo) << "** DemoModuleA::BeginJob()\n";
00082 }

void JobCDemoModuleA::BeginRun (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 107 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00108 {
00109   MSG("JobC", Msg::kInfo) << "** DemoModuleA::BeginRun()\n";
00110 }

void JobCDemoModuleA::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 59 of file JobCDemoModuleA.cxx.

References Registry::GetCharString(), Registry::GetDouble(), Registry::GetInt(), Registry::KeyExists(), Msg::kInfo, Munits::m, and MSGSTREAM.

00060 {
00061 //======================================================================
00062 // Dummy config method.
00063 //======================================================================
00064   MsgStream& m = MSGSTREAM("JobC",Msg::kInfo);
00065   m << "DemoA::Config()\n";
00066   if (r.KeyExists("Sweet")) { 
00067     m << " New value of Sweet = " << r.GetInt("Sweet") << "\n";
00068   }
00069   if (r.KeyExists("Pi")) {
00070     m << " New value of Pi = " << r.GetDouble("Pi") << "\n";
00071   }
00072   if (r.KeyExists("OutFile")) {
00073     m << " New value of OutFile = " << r.GetCharString("OutFile") << "\n";
00074   }
00075 }

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

References Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00043 {
00044 //======================================================================
00045 // Setup the default configuration for the module
00046 //======================================================================
00047   static Registry r;
00048   r.UnLockValues();
00049   r.SetName("DemoA.config");
00050   r.Set("Sweet",  16);  
00051   r.Set("Pi",     3.14);
00052   r.Set("OutFile","output.root");
00053   r.LockValues();
00054   return r;
00055 }

void JobCDemoModuleA::EndFile (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 100 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00101 {
00102   MSG("JobC", Msg::kInfo) << "** DemoModuleA::EndFile()\n";
00103 }

void JobCDemoModuleA::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 86 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00087 {
00088   MSG("JobC", Msg::kInfo) << "** DemoModuleA::EndJob()\n";
00089 }

void JobCDemoModuleA::EndRun (  )  [virtual]

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

Reimplemented from JobCModule.

Definition at line 114 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00115 {
00116   MSG("JobC", Msg::kInfo) << "** DemoModuleA::EndRun()\n";
00117 }

JobCResult JobCDemoModuleA::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 121 of file JobCDemoModuleA.cxx.

References fNget, Msg::kInfo, MSG, JobCResult::SetBeginFile(), JobCResult::SetBeginRun(), JobCResult::SetEndFile(), JobCResult::SetEndOfInputStream(), and JobCResult::SetEndRun().

00122 {
00123   ++fNget;
00124   MSG("JobC", Msg::kInfo) << 
00125     "** DemoModuleA::Get (" << mom << ") nGet=" << fNget << "\n";
00126   
00127   // Practice sending some typical results
00128   JobCResult r;
00129   // Begin/End File
00130   if (fNget%5 == 1) {
00131     r.SetBeginFile();
00132     if (fNget>1) r.SetEndFile();
00133   }
00134   // Begin/End Run
00135   if (fNget%10 == 1) {
00136     r.SetBeginRun();
00137     if (fNget>1) r.SetEndRun();
00138   }
00139   // End of input stream
00140   if (fNget > 30) {
00141     r.SetEndOfInputStream();
00142   }
00143   return r;
00144 }

void JobCDemoModuleA::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 173 of file JobCDemoModuleA.cxx.

References JobCommand::HaveCmd(), JobCommand::HaveOpt(), Msg::kInfo, Munits::m, MSGSTREAM, JobCommand::PopCmd(), and JobCommand::PopOpt().

00174 {
00175   MsgStream& m = MSGSTREAM("JobC", Msg::kInfo);
00176 
00177   bool ifirst = true;
00178   m << "** DemoModuleA::HandleCommand: ";
00179   while (c->HaveCmd()) {
00180     if (!ifirst) m << "/";
00181     m << c->PopCmd();
00182     ifirst = false;
00183   }
00184   m << " opt={";
00185   ifirst = true;
00186   while (c->HaveOpt()) {
00187     if (!ifirst) m << ",";
00188     m << c->PopOpt();
00189     ifirst = false;
00190   }
00191   m << "}\n";
00192 }

void JobCDemoModuleA::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 196 of file JobCDemoModuleA.cxx.

References Msg::kInfo, and MSG.

00197 {
00198   MSG("JobC", Msg::kInfo) << "** DemoModuleA::Help()\n";
00199 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 161 of file JobCDemoModuleA.cxx.

References fNreco, JobCResult::kFailed, Msg::kInfo, JobCResult::kPassed, and MSG.

00162 {
00163   ++fNreco;
00164   MSG("JobC", Msg::kInfo) << 
00165     "** DemoModuleA(" << this << ")::Reco(" << mom << ") nReco=" << 
00166     fNreco << "\n";
00167   if (fNreco%2 == 0) return JobCResult::kPassed;
00168   return JobCResult::kFailed;
00169 }


Member Data Documentation

int JobCDemoModuleA::fNana [private]

Definition at line 46 of file JobCDemoModuleA.h.

Referenced by Ana().

int JobCDemoModuleA::fNget [private]

Definition at line 45 of file JobCDemoModuleA.h.

Referenced by Get().

int JobCDemoModuleA::fNreco [private]

Definition at line 47 of file JobCDemoModuleA.h.

Referenced by Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1