/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
DybDaq::DaqEventConverter Class Reference

#include <DaqEventConverter.h>

List of all members.

Classes

class  Address
 Implementation of IOpaqueAddress interface for this class. More...

Public Member Functions

 DaqEventConverter (unsigned char storageType, const CLID &clid, ISvcLocator *svc)
 Creates an instance of this class.
 DaqEventConverter (ISvcLocator *svc)
 Creates an instance of this class.
 ~DaqEventConverter ()
 Destroys the instance of this class.
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&pObject)
 Create DataObject based on the supplied IOpaqueAddress.
virtual long repSvcType () const
 Bookkeepting method used by ConverterSvc class.

Static Public Member Functions

static const long storageType ()
 Required by converter factory.
static const CLID & classID ()
 Required by converter factory.

Private Member Functions

 DaqEventConverter ()
 Suppress default.
 DaqEventConverter (const DaqEventConverter &rhs)
 Suppress default.
DaqEventConverteroperator= (const DaqEventConverter &rhs)
 Suppress default.
DayaBay::ReadoutHeadercreateReadoutHeader (const DybDaq::EventReadout &event)
 Creates a new ReadoutHeader from the supplied context.
template<class CrateType >
DayaBay::ReadoutHeadernewReadoutHeader (const DybDaq::EventReadout &event)
 Helper to reduce cut-and-paste code.

Private Attributes

int m_execNumber
 Maintain an execution cycle count.

Detailed Description

Definition at line 26 of file DaqEventConverter.h.


Constructor & Destructor Documentation

DaqEventConverter::DaqEventConverter ( unsigned char  storageType,
const CLID &  clid,
ISvcLocator *  svc 
)

Creates an instance of this class.

Definition at line 66 of file DaqEventConverter.cc.

                                                       :
    Converter(storageType,
              clid,
              svc),
    m_execNumber(0)
{
}
DaqEventConverter::DaqEventConverter ( ISvcLocator *  svc)

Creates an instance of this class.

Definition at line 76 of file DaqEventConverter.cc.

                                                     :
    Converter(storageType(),
              classID(),
              svc),
    m_execNumber(0)
{
}
DaqEventConverter::~DaqEventConverter ( )

Destroys the instance of this class.

Definition at line 84 of file DaqEventConverter.cc.

                                      {
}
DybDaq::DaqEventConverter::DaqEventConverter ( ) [private]

Suppress default.

DybDaq::DaqEventConverter::DaqEventConverter ( const DaqEventConverter rhs) [private]

Suppress default.


Member Function Documentation

const long DaqEventConverter::storageType ( ) [static]

Required by converter factory.

Definition at line 87 of file DaqEventConverter.cc.

const CLID & DaqEventConverter::classID ( ) [static]

Required by converter factory.

Definition at line 91 of file DaqEventConverter.cc.

                                       {
    return DayaBay::CLID_ReadoutHeader;
}
StatusCode DaqEventConverter::createObj ( IOpaqueAddress *  addr,
DataObject *&  pObject 
) [virtual]

Create DataObject based on the supplied IOpaqueAddress.

Definition at line 95 of file DaqEventConverter.cc.

                                                              {
    Address* address = dynamic_cast<Address*>(addr);
    if (0 == address) {
        return StatusCode::FAILURE;
    }
    const EventReadout* eventReadout = address->context().event();
    if (0 == eventReadout) {
        return StatusCode::FAILURE;
    }
    pObject = createReadoutHeader(*eventReadout);
    if (0 == pObject) {
        return StatusCode::FAILURE;
    }
    return StatusCode::SUCCESS;
    
}
long DaqEventConverter::repSvcType ( ) const [virtual]

Bookkeepting method used by ConverterSvc class.

Definition at line 153 of file DaqEventConverter.cc.

                                         {
    return i_repSvcType();
}
DaqEventConverter& DybDaq::DaqEventConverter::operator= ( const DaqEventConverter rhs) [private]

Suppress default.

ReadoutHeader * DaqEventConverter::createReadoutHeader ( const DybDaq::EventReadout event) [private]

Creates a new ReadoutHeader from the supplied context.

Definition at line 113 of file DaqEventConverter.cc.

                                                                               {

    const EventHeader& header = event.header();
    const EventTraits& traits = header.eventTraits();
    const unsigned int kFeeModuleType = traits.moduleType(EventTraits::kFeeModule);
    const unsigned int kRpcRtmModuleType = traits.moduleType(EventTraits::kRpcRtmModule);

    const EventReadout::RomFragmentPtrList& fragments = event.romFragments();
    EventReadout::RomFragmentPtrList::const_iterator fragment = fragments.begin();
    const unsigned int* crateType = 0;
    while(0 == crateType && fragment != fragments.end()) {
        unsigned int type = (*fragment)->header().moduleType();
        if (kFeeModuleType == type ) {
            crateType = &kFeeModuleType;
        }
        else if ( kRpcRtmModuleType == type || kRpcRtmModuleType == type ) {
           crateType = &kRpcRtmModuleType;
        }
        ++fragment;
    }
    if (0 == crateType) {
        return 0;
    }

    ++m_execNumber;

    if ((*crateType) == kFeeModuleType) {
        return newReadoutHeader<DaqPmtCrate>(event);
    }

    if ((*crateType) == kRpcRtmModuleType) {
        return newReadoutHeader<DaqRpcCrate>(event);
    }

    MsgStream log(msgSvc(),
                  "DaqEventConverter");
    log << MSG::ERROR << "Could not determine crate type so, cannot make readout." << endreq;
    return 0;
}
template<class CrateType >
DayaBay::ReadoutHeader* DybDaq::DaqEventConverter::newReadoutHeader ( const DybDaq::EventReadout event) [inline, private]

Helper to reduce cut-and-paste code.

Definition at line 111 of file DaqEventConverter.h.

                                                                                {
            const CrateType* crate = new CrateType(&event);
            const DayaBay::Detector& detector = crate->detector();
            const TimeStamp& triggerTime = crate->triggerTime();
            Context context(detector.site(),
                            SimFlag::kData,
                            triggerTime,
                            detector.detectorId());
            DayaBay::ReadoutHeader* result = new DayaBay::ReadoutHeader();
            result->setContext(context);
            result->setEarliest(triggerTime);
            result->setLatest(triggerTime);
            result->setExecNumber(m_execNumber);
            result->setDaqCrate(const_cast<CrateType*>(crate));
            return result;
        }

Member Data Documentation

Maintain an execution cycle count.

Definition at line 131 of file DaqEventConverter.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:15:32 for DaqFormatModules by doxygen 1.7.4