DemoNtupleModule Class Reference

#include <DemoNtupleModule.h>

Inheritance diagram for DemoNtupleModule:
JobCModule

List of all members.

Public Member Functions

 DemoNtupleModule ()
 ~DemoNtupleModule ()
JobCResult Reco (MomNavigator *mom)

Detailed Description

Definition at line 16 of file DemoNtupleModule.h.


Constructor & Destructor Documentation

DemoNtupleModule::DemoNtupleModule (  )  [inline]

Definition at line 19 of file DemoNtupleModule.h.

00019 {}

DemoNtupleModule::~DemoNtupleModule (  )  [inline]

Definition at line 20 of file DemoNtupleModule.h.

00020 {}


Member Function Documentation

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 38 of file DemoNtupleModule.cxx.

References DataUtil::GetRawHeader(), RawDaqSnarlHeader::GetSnarl(), RecMinosHdr::GetVldContext(), JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, MSG, JobCResult::SetFailed(), and JobCResult::SetWarning().

00038                                                    {
00039   //
00040   //  Purpose:  Create ntuple record.
00041   //
00042   //  Arguments: none.
00043   //  
00044   //  Return: none.
00045   //
00046   //  Contact:   S. Kasahara
00047   // 
00048 
00049 
00050   JobCResult result(JobCResult::kPassed);  
00051   MSG("DemoNtuple",Msg::kVerbose) << "DemoNtupleModule::Reco" << endl;
00052 
00053   // Check that mom exists.
00054   assert(mom);
00055 
00056   // Create a DemoNtupleRecord from a RawRecord (DaqSnarl) 
00057   // Should iterate over rawrecords in mom, but this is just a demo
00058   RawRecord *rawRec = dynamic_cast<RawRecord*>(mom->GetFragment("RawRecord"));
00059   if ( !rawRec ) {
00060     MSG("RawRecord",Msg::kWarning) << "No RawRecord in Mom " <<endl;
00061     result.SetWarning().SetFailed();
00062     return result;
00063   }
00064 
00065   const RawDaqSnarlHeader* oldHdr = dynamic_cast<const RawDaqSnarlHeader*>
00066                                          (rawRec -> GetRawHeader());
00067   // Use validity context to create header for ntuple record
00068   RecHeader newHdr(oldHdr->GetVldContext());
00069 
00070   // Create new record
00071   DemoNtupleRecord* ntp = new DemoNtupleRecord(newHdr);
00072   ntp -> SetMyData(oldHdr->GetSnarl());
00073 
00074   // For each new vertex, a TVector3 object is created and added to
00075   // the TClonesArray.
00076   int nvectors = 0;
00077   for ( int i = 0; i < 2; i++ ) {
00078     // This uses "new with placement" to reuse previously allocated memory
00079     if ( oldHdr->GetSnarl()%2 == 0 ) {
00080       // just for fun, every other entry has different values
00081       new((ntp->GetVectors())[nvectors++]) TVector3(1,2,3);
00082     }
00083     else {
00084       new((ntp->GetVectors())[nvectors++]) TVector3(4,5,6);
00085     }
00086   }
00087 
00088   mom -> AdoptFragment(ntp);
00089 
00090   return result;
00091 
00092 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1