DemoRecordModule Class Reference

#include <DemoRecordModule.h>

Inheritance diagram for DemoRecordModule:
JobCModule

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 16 of file DemoRecordModule.h.


Constructor & Destructor Documentation

DemoRecordModule::DemoRecordModule (  ) 

Definition at line 180 of file DemoRecordModule.cxx.

References Msg::kVerbose, and MSG.

00180                                    { 
00181   //
00182   //  Purpose:  Default constructor.
00183   //
00184   //  Arguments: none.
00185   //
00186   //  Return:    n/a.
00187   //
00188   //  Contact:   S. Kasahara
00189   // 
00190   //  Notes: none.
00191   // 
00192 
00193   MSG("DemoRecord", Msg::kVerbose) << "DemoRecordModule::Constructor" << endl;
00194 
00195 }

DemoRecordModule::~DemoRecordModule (  ) 

Definition at line 197 of file DemoRecordModule.cxx.

References Msg::kVerbose, and MSG.

00197                                     {
00198   //
00199   //  Purpose:  Destructor.  
00200   //
00201   //  Contact:   S. Kasahara
00202   // 
00203 
00204   MSG("DemoRecord", Msg::kVerbose) << "DemoRecordModule::Destructor" << endl;
00205 
00206 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 38 of file DemoRecordModule.cxx.

References Msg::kInfo, JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, MSG, JobCResult::SetFailed(), and JobCResult::SetWarning().

00038                                                         {
00039 
00040   JobCResult result(JobCResult::kPassed);  
00041   MSG("DemoRecord",Msg::kVerbose) << "DemoRecordModule::Ana" << endl;
00042 
00043   // Check that mom exists.
00044   assert(mom);
00045 
00046   // Retrieve record
00047   RecDataRecord<RecPhysicsHeader> *record 
00048   = dynamic_cast<RecDataRecord<RecPhysicsHeader>*>
00049     (mom->GetFragment("RecDataRecord<RecPhysicsHeader>"));
00050   if ( !record ) {
00051     MSG("DemoRecord",Msg::kWarning) << "No RecDataRecord in Mom " <<endl;
00052     result.SetWarning().SetFailed();
00053     return result;
00054   }
00055   MSG("DemoRecord",Msg::kInfo) 
00056     << "DemoRecordModule::Ana retrieved selected record:\n" << *record << endl;
00057   return result;
00058   
00059 }

void DemoRecordModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 123 of file DemoRecordModule.cxx.

References Msg::kVerbose, and MSG.

00123                                 {
00124   //
00125   //  Purpose:  Configure module at beginning of job.
00126   //
00127   //  Arguments: none.
00128   //  
00129   //  Return: none.
00130   //
00131   //  Contact:   S. Kasahara
00132   // 
00133 
00134   MSG("DemoRecord", Msg::kVerbose) << "DemoRecordModule::BeginJob" << endl;
00135 
00136   // Configure module
00137  
00138 }

void DemoRecordModule::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 140 of file DemoRecordModule.cxx.

References Msg::kDebug, and MSG.

00140                                                {
00141   //
00142   //  Purpose:  Configure the module based on the contents of the registry.
00143   //
00144   //  Arguments: none.
00145   //  
00146   //  Return: none.
00147   //
00148   //  Contact:   S. Kasahara
00149   // 
00150 
00151   MSG("DemoRecord",Msg::kDebug) << "Config DemoRecordModule with r=" << r << endl;
00152 
00153 }

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

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

00155                                                       {
00156   //
00157   //  Purpose:  Load default values into configuration registry.
00158   //
00159   //  Arguments: none.
00160   //  
00161   //  Return: registry of default configuration values.
00162   //
00163   //  Contact:   S. Kasahara
00164   // 
00165 
00166   static Registry r;
00167   r.SetName("DemoRecord.config");
00168 
00169   r.UnLockValues();
00170 
00171   MSG("DemoRecord",Msg::kDebug) << "Loading default config.\n" << endl;
00172 
00173   // r.Set("variable","argument");
00174 
00175   r.LockValues();
00176   return r;
00177 
00178 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 61 of file DemoRecordModule.cxx.

References MomNavigator::AdoptFragment(), RawDaqSnarlHeader::GetErrorCode(), MomNavigator::GetFragment(), RawDaqSnarlHeader::GetRemoteSpillType(), RawDaqHeader::GetRun(), RawDaqHeader::GetRunType(), RawDaqSnarlHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RawDaqHeader::GetTimeFrameNum(), RawDaqSnarlHeader::GetTrigSrc(), RecMinosHdr::GetVldContext(), Msg::kInfo, JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, MSG, JobCResult::SetFailed(), and JobCResult::SetWarning().

00061                                                    {
00062   //
00063   //  Purpose:  Create record.
00064   //
00065   //  Arguments: none.
00066   //  
00067   //  Return: none.
00068   //
00069   //  Contact:   S. Kasahara
00070   // 
00071 
00072 
00073   JobCResult result(JobCResult::kPassed);  
00074   MSG("DemoRecord",Msg::kVerbose) << "DemoRecordModule::Reco" << endl;
00075 
00076   // Check that mom exists.
00077   assert(mom);
00078 
00079   // Create a RecDataRecord<RecPhysicsHeader> from a RawRecord (DaqSnarl) 
00080   // Should iterate, but this is just a demo
00081   RawRecord *rawRec = dynamic_cast<RawRecord*>(mom->GetFragment("RawRecord"));
00082   if ( !rawRec ) {
00083     MSG("RawRecord",Msg::kWarning) << "No RawRecord in Mom " <<endl;
00084     result.SetWarning().SetFailed();
00085     return result;
00086   }
00087 
00088   const RawDaqSnarlHeader* rawHdr = dynamic_cast<const RawDaqSnarlHeader*>
00089                               (rawRec -> GetHeader());
00090   RecPhysicsHeader* newHdr = new RecPhysicsHeader(rawHdr->GetVldContext(),
00091         rawHdr->GetRun(),rawHdr->GetSubRun(),rawHdr->GetRunType(),
00092         rawHdr->GetErrorCode(),rawHdr->GetSnarl(),rawHdr->GetTrigSrc(),
00093         rawHdr->GetTimeFrameNum(),rawHdr->GetRemoteSpillType());
00094 
00095   // Create new record
00096   RecDataRecord<RecPhysicsHeader>* newRec 
00097     = new RecDataRecord<RecPhysicsHeader>(*newHdr);
00098 
00099   // Objects pushed in snarl have periodicity of 3 snarls:
00100   // 0) No components
00101   // 1) An object TNamed w/objectname MyObject1
00102   // 2) Two objects i)TNamed w/objectname MyObject1
00103   //               ii)TNamed w/objectname MyObject2
00104   // This is to be able to test the HasComponent feature
00105   if ( rawHdr->GetSnarl() % 3 == 1 || rawHdr->GetSnarl() % 3 == 2 ) {
00106     TNamed* named = new TNamed("MyObject1","");
00107     newRec->AdoptComponent(named); 
00108   }  
00109   if ( rawHdr->GetSnarl() % 3 == 2 ) {
00110     TNamed* named = new TNamed("MyObject2","");
00111     newRec->AdoptComponent(named);
00112   }
00113  
00114   // And pass it to Mom, mom now has memory management responsibility
00115   MSG("DemoRecord",Msg::kInfo) 
00116     << "DemoRecordModule::Reco created record:\n" << *newRec << endl;
00117   mom->AdoptFragment(newRec);
00118 
00119   return result;
00120 
00121 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1