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

In This Package:

Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
DybDaq::EventReadout Class Reference

#include <EventReadout.h>

Inheritance diagram for DybDaq::EventReadout:
Inheritance graph
[legend]
Collaboration diagram for DybDaq::EventReadout:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< const
RomFragment * > 
RomFragmentPtrList
typedef std::pair< const char
*, unsigned int > 
OutputBuffer
typedef std::vector< OutputBufferOutputBufferList
typedef std::vector
< ByteInspector * > 
Bytes
typedef std::vector
< BitsInspector * > 
Bits

Public Member Functions

 EventReadout (const EventReadout &rhs)
 Create an instance of this class.
 EventReadout (const unsigned int site, const unsigned int detector, const unsigned int run, const unsigned int event, const unsigned int dataType, const bool rawCblt, const bool triggerMismatch, const bool invalidData, const bool rpcSortDisabled, const bool dataSortTimeout, const EventTraits &traits)
 Create an instance of this class.
 EventReadout (const unsigned int site, const unsigned int detector, const unsigned int run, const unsigned int event, const unsigned int dataType, const bool rawCblt, const bool triggerMismatch, const bool invalidData, const bool rpcSortDisabled, const bool dataSortTimeout, const CbltTraits &cbltTraits, const EventTraits &traits)
 Create an instance of this class.
 EventReadout (const ByteBuffer &byteBuffer)
 Create an instance of this class.
virtual ~EventReadout ()
 Destroy this instance of the class.
virtual const DaqTraitsdaqTraits () const
 Returns the DaqTraits instance used to parse this object's buffer.
const EventHeaderheader () const
 Returns the EventHeader for this event.
const RomFragmentPtrListromFragments () const
 Returns the list of RomFragments in this event.
bool containsPmtFragments () const
 Returns true if this event contains ROM fragments from LTB, FEE or FADC.
bool containsRpcFragments () const
 Returns true if this event contains ROM fragments from RTM or FEC.
virtual unsigned int bufferSize () const
 Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
void addReadout (const FadcReadout *readout, const unsigned int slot)
void addReadout (const FeeReadout *readout, const unsigned int slot)
void addReadout (const LtbReadout *readout, const unsigned int slot)
void addReadout (const FecReadout *readout, const unsigned int slot)
void addReadout (const RtmReadout *readout, const unsigned int slot)
virtual unsigned int gather (OutputBufferList &outputBuffers) const
virtual unsigned int inspect (DaqBuffer::Bytes &inspectors) const
bool hasDaqTraits () const

Static Public Attributes

static const unsigned int kBytesInInt
static const unsigned int kUndefinedFormatComponent

Protected Member Functions

virtual unsigned int gatherComponents (OutputBufferList &outputBuffers) const
 Gathers the DAQ formatted bytes for this object's components.
virtual unsigned int inspectComponents (DaqBuffer::Bytes &inspectors) const
 Inspects the DAQ formatted bytes for this object's components.
virtual void expanded (const unsigned int size)
 Tells this object that its contents has expanded by the specified number of bytes.
unsigned int begin () const
unsigned int containerSize () const
bool setExpandable (DaqExpandable &expandable)
void notifyExpandable (const unsigned int size)
bool expandedByRomData (const RomData *romData)
const char * buffer () const
char * buffer ()
bool hasByteBuffer () const
const ByteBufferbyteBuffer () const
unsigned int fillInspectors (DaqBuffer::Bytes &inspectors, unsigned int component, unsigned int cursor) const
virtual bool readBool (const unsigned int field) const
virtual int readInt (const unsigned int field) const
virtual unsigned char readUnsignedChar (const unsigned int field) const
virtual unsigned int readUnsignedInt (const unsigned int field) const
virtual void writeField (const bool value, const unsigned int field)
virtual void writeField (const int value, const unsigned int field)
virtual void writeField (const unsigned int value, const unsigned int field)
virtual unsigned int formatComponent () const

Private Member Functions

 EventReadout ()
 Create an instance of this class.
EventReadoutoperator= (const EventReadout &rhs)
 Suppress default.
void addReadout (const RomData *readout, const unsigned int slot, const unsigned int moduleType)
const RomFragmentadd (const RomFragment *fragment)
 Adds the supplied RomFragment to this object,.

Private Attributes

EventHeaderm_header
 The EventHeader for this object.
std::vector< const RomFragment * > * m_fragments
 The list of RomFragments in this object.
const CbltTraitsm_cbltTraits
 The CbltTraits, if any, to use when wrapping rom data.

Detailed Description

Definition at line 32 of file EventReadout.h.


Member Typedef Documentation

Definition at line 36 of file EventReadout.h.


Constructor & Destructor Documentation

EventReadout::EventReadout ( const EventReadout rhs)

Create an instance of this class.

Definition at line 41 of file EventReadout.cc.

                                                     :
DaqContainer(readout),
m_header(0),
m_fragments(0),
m_cbltTraits((CbltTraits*)0) {
    // Currently assumes a ByteBuffer based EventReadout is being copied.
}
EventReadout::EventReadout ( const unsigned int  site,
const unsigned int  detector,
const unsigned int  run,
const unsigned int  event,
const unsigned int  dataType,
const bool  rawCblt,
const bool  triggerMismatch,
const bool  invalidData,
const bool  rpcSortDisabled,
const bool  dataSortTimeout,
const EventTraits traits 
)

Create an instance of this class.

Definition at line 49 of file EventReadout.cc.

                                                      :
DaqContainer(),
m_header(new EventHeader(site,
                         detector,
                         run,
                         event,
                         dataType,
                         false,
                         rawCblt,
                         triggerMismatch,
                         invalidData,
                         rpcSortDisabled,
                         dataSortTimeout,
                         traits)),
m_fragments(0),
m_cbltTraits((CbltTraits*)0) {
}
EventReadout::EventReadout ( const unsigned int  site,
const unsigned int  detector,
const unsigned int  run,
const unsigned int  event,
const unsigned int  dataType,
const bool  rawCblt,
const bool  triggerMismatch,
const bool  invalidData,
const bool  rpcSortDisabled,
const bool  dataSortTimeout,
const CbltTraits cbltTraits,
const EventTraits traits 
)

Create an instance of this class.

Definition at line 77 of file EventReadout.cc.

                                                      :
DaqContainer(),
m_header(new EventHeader(site,
                         detector,
                         run,
                         event,
                         dataType,
                         true,
                         rawCblt,
                         triggerMismatch,
                         invalidData,
                         rpcSortDisabled,
                         dataSortTimeout,
                         traits)),
m_fragments(0),
m_cbltTraits(&cbltTraits) {
}
EventReadout::EventReadout ( const ByteBuffer byteBuffer)

Create an instance of this class.

Definition at line 106 of file EventReadout.cc.

                                                       :
DaqContainer(byteBuffer,
             0),
m_header(0),
m_fragments(0),
m_cbltTraits((CbltTraits*)0) {
    byteBuffer.position(byteBuffer.position() + (header().totalSize() * kBytesInInt));
}
EventReadout::~EventReadout ( ) [virtual]

Destroy this instance of the class.

Definition at line 115 of file EventReadout.cc.

                            {
    if (0 != m_fragments) {
        RomFragmentPtrList::iterator fragment;
        for (fragment = m_fragments->begin();
             fragment != m_fragments->end();
             ++fragment) {
            delete const_cast<RomFragment*>(*fragment);
        }
        delete m_fragments;
    }
    if (0 != m_header) {
        delete m_header;
    }
}
DybDaq::EventReadout::EventReadout ( ) [private]

Create an instance of this class.


Member Function Documentation

const DaqTraits & EventReadout::daqTraits ( ) const [virtual]

Returns the DaqTraits instance used to parse this object's buffer.

Reimplemented from DybDaq::DaqContainer.

Definition at line 130 of file EventReadout.cc.

                                               {
    return header().eventTraits();
}
const EventHeader & EventReadout::header ( ) const

Returns the EventHeader for this event.

Definition at line 134 of file EventReadout.cc.

                                              {
    if (0 == m_header && hasByteBuffer()) {
        const ByteBuffer& buffer = byteBuffer();
        
        const unsigned int originalPosition = buffer.position();
        buffer.position(begin());
        m_header = new EventHeader(buffer);
        buffer.position(originalPosition);
    }
    return *m_header;
}
const EventReadout::RomFragmentPtrList & EventReadout::romFragments ( ) const

Returns the list of RomFragments in this event.

Definition at line 146 of file EventReadout.cc.

                                                                       {
    if (0 == m_fragments) {
        m_fragments = new RomFragmentPtrList();
        if (hasByteBuffer()) {
            const ByteBuffer& buffer = byteBuffer();
            
            const unsigned int originalPosition = buffer.position();
            buffer.position(begin() + (header().headerSize() * kBytesInInt));
            const EventTraits& traits = header().eventTraits();
            const bool cbltWrapping = header().cbltWrapping();
            const unsigned int finished = begin() + (bufferSize() * kBytesInInt);
            while (buffer.position() != finished) {
                const RomFragment* romFragment = new RomFragment(buffer,
                                                                 traits,
                                                                 cbltWrapping);
                m_fragments->push_back(romFragment);
            }
            buffer.position(originalPosition);
        }
    }
        return *m_fragments;
}
bool EventReadout::containsPmtFragments ( ) const

Returns true if this event contains ROM fragments from LTB, FEE or FADC.

Definition at line 169 of file EventReadout.cc.

                                              {
    const EventTraits& traits = header().eventTraits();
    const unsigned int kLtbModuleType = traits.moduleType(EventTraits::kLtbModule);
    const unsigned int kFeeModuleType = traits.moduleType(EventTraits::kFeeModule);
    const unsigned int kFadcModuleType = traits.moduleType(EventTraits::kFadcModule);
    const RomFragmentPtrList& fragments = romFragments();
    for (RomFragmentPtrList::const_iterator fragment = fragments.begin();
         fragment != fragments.end();
         ++fragment) {
        unsigned int romType = (*fragment)->header().moduleType();
        if (kLtbModuleType == romType || kFeeModuleType == romType || kFadcModuleType == romType) {
            return true;
        }
    }
    return false;
}
bool EventReadout::containsRpcFragments ( ) const

Returns true if this event contains ROM fragments from RTM or FEC.

Definition at line 186 of file EventReadout.cc.

                                              {
    const EventTraits& traits = header().eventTraits();
    const unsigned int kRpcRomModuleType = traits.moduleType(EventTraits::kRpcRomModule);
    const unsigned int kRpcRtmModuleType = traits.moduleType(EventTraits::kRpcRtmModule);
    const RomFragmentPtrList& fragments = romFragments();
    for (RomFragmentPtrList::const_iterator fragment = fragments.begin();
         fragment != fragments.end();
         ++fragment) {
        unsigned int romType = (*fragment)->header().moduleType();
        if (kRpcRomModuleType == romType || kRpcRtmModuleType == romType) {
            return true;
        }
    }
    return false;
}
unsigned int EventReadout::bufferSize ( ) const [virtual]

Returns the size, in 4-bytes, of this ojbect's contents in the buffer.

Implements DybDaq::DaqContainer.

Definition at line 202 of file EventReadout.cc.

                                            {
    return header().totalSize();
}
void EventReadout::addReadout ( const FadcReadout readout,
const unsigned int  slot 
)

Definition at line 236 of file EventReadout.cc.

                                                       {
    addReadout(readout,
               slot,
               header().eventTraits().moduleType(EventTraits::kFadcModule));
}
void EventReadout::addReadout ( const FeeReadout readout,
const unsigned int  slot 
)

Definition at line 243 of file EventReadout.cc.

                                                       {
    addReadout(readout,
               slot,
               header().eventTraits().moduleType(EventTraits::kFeeModule));
}
void EventReadout::addReadout ( const LtbReadout readout,
const unsigned int  slot 
)

Definition at line 250 of file EventReadout.cc.

                                                       {
    
    addReadout(readout,
               slot,
               header().eventTraits().moduleType(EventTraits::kLtbModule));
}
void EventReadout::addReadout ( const FecReadout readout,
const unsigned int  slot 
)

Definition at line 258 of file EventReadout.cc.

                                                       {
    
    addReadout(readout,
               slot,
               header().eventTraits().moduleType(EventTraits::kRpcRomModule));
}
void EventReadout::addReadout ( const RtmReadout readout,
const unsigned int  slot 
)

Definition at line 266 of file EventReadout.cc.

                                                       {
    
    addReadout(readout,
               slot,
               header().eventTraits().moduleType(EventTraits::kRpcRtmModule));
}
unsigned int EventReadout::gatherComponents ( OutputBufferList outputBuffers) const [protected, virtual]

Gathers the DAQ formatted bytes for this object's components.

Implements DybDaq::DaqContainer.

Definition at line 206 of file EventReadout.cc.

                                                                                 {
    unsigned int result = header().gather(outputBuffers);
    const RomFragmentPtrList& fragments = romFragments();
    RomFragmentPtrList::const_iterator fragment;
    for (fragment = fragments.begin();
         fragment != fragments.end();
         ++fragment) {
        result += (*fragment)->gather(outputBuffers);
    }
    return result;
}
unsigned int EventReadout::inspectComponents ( DaqBuffer::Bytes inspectors) const [protected, virtual]

Inspects the DAQ formatted bytes for this object's components.

Implements DybDaq::DaqContainer.

Definition at line 218 of file EventReadout.cc.

                                                                             {
    unsigned int result = header().inspect(inspectors);
    const RomFragmentPtrList& fragments = romFragments();
    RomFragmentPtrList::const_iterator fragment;
    for (fragment = fragments.begin();
         fragment != fragments.end();
         ++fragment) {
        result += (*fragment)->inspect(inspectors);
    }
    return result;
}
void EventReadout::expanded ( const unsigned int  size) [protected, virtual]

Tells this object that its contents has expanded by the specified number of bytes.

Implements DybDaq::DaqContainer.

Definition at line 230 of file EventReadout.cc.

                                                   {
    // If this is non-const, then header must already exist.
    m_header->setTotalSize(m_header->totalSize() + size);
    notifyExpandable(size);
}
EventReadout& DybDaq::EventReadout::operator= ( const EventReadout rhs) [private]

Suppress default.

void EventReadout::addReadout ( const RomData readout,
const unsigned int  slot,
const unsigned int  moduleType 
) [private]

Definition at line 274 of file EventReadout.cc.

                                                             {
    RomFragment* result;
    if (header().cbltWrapping()) {
        CbltReadout* cbltReadout = new CbltReadout(slot,
                                                   moduleType,
                                                   readout,
                                                   *m_cbltTraits);
        result = new RomFragment(header().site(),
                                 header().detector(),
                                 moduleType,
                                 slot,
                                 cbltReadout,
                                 header().eventTraits(),
                                 true,
                                 *this);
    } else {
        result = new RomFragment(header().site(),
                                 header().detector(),
                                 moduleType,
                                 slot,
                                 readout,
                                 header().eventTraits(),
                                 false,
                                 *this);
    }
    add(result);
}
const RomFragment & EventReadout::add ( const RomFragment fragment) [private]

Adds the supplied RomFragment to this object,.

Definition at line 304 of file EventReadout.cc.

                                                                {
    if (0 == m_fragments) {
        m_fragments = new RomFragmentPtrList();
    }
    m_fragments->push_back(fragment);
    expanded(fragment->bufferSize());
    return *fragment;
}

Member Data Documentation

The EventHeader for this object.

Definition at line 171 of file EventReadout.h.

std::vector<const RomFragment*>* DybDaq::EventReadout::m_fragments [mutable, private]

The list of RomFragments in this object.

Definition at line 176 of file EventReadout.h.

The CbltTraits, if any, to use when wrapping rom data.

Definition at line 181 of file EventReadout.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 09:53:16 for EventReadoutFormat by doxygen 1.7.4