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

In This Package:

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
DaqRootWriter Class Reference

#include <DaqRootWriter.h>

Inheritance diagram for DaqRootWriter:
Inheritance graph
[legend]
Collaboration diagram for DaqRootWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DaqRootWriter (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~DaqRootWriter ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode execute ()
DayaBay::ReadoutHeaderGetCurrentHeaderObject () const
virtual StatusCode sysInitialize ()
virtual StatusCode sysExecute ()
virtual StatusCode preExecute ()
virtual StatusCode postExecute ()
virtual StatusCode sysFinalize ()
IDataProviderSvc * arcSvc () const
void putTES (DataObject *obj, std::string location) const
TYPE * getTES (std::string location) const
TYPE * getAES (std::string location, int index) const
std::vector< DataObject * > getAEScollection (std::string location) const
int getExecNum ()
std::string Location () const

Protected Member Functions

virtual DybDaq::DaqToOStreamcreateDaqToOStream (const DybDaq::FileTraits &traits)
 Creates the DaqToOStream into which the DAQ bytes wiull be written.
virtual StatusCode writeData (const DayaBay::DaqCrate *daqCrate)
 Writes the data block.
virtual void wroteFileHead ()
 Called when the file header records have all been written.
virtual void wroteData ()
 Called when a file data record has all been written.
virtual void wroteFileFoot ()
 Called when the file footer records have all been written.
virtual StatusCode writeFileHead (const DayaBay::DaqCrate *daqCrate)
virtual StatusCode writeFileFoot ()
DayaBay::ReadoutHeaderMakeHeaderObject ()
void InitializeHeader (DayaBay::HeaderObject *header)
TYPE * MakeHeader ()
TYPE * MakeHeader (std::vector< const DayaBay::IHeader * > &inputHeaders)
TYPE * MakeHeader (const DayaBay::IHeader *referenceHeader)
void AppendInputHeader (const DayaBay::HeaderObject *header) const

Protected Attributes

DayaBay::HeaderObjectm_headerObject
bool m_pullMode
std::string m_location

Private Member Functions

DayaBay::DaqBlockcreateDaqBlock ()
 Creates a new DaqBlock from the current stream and reset that stream.
StatusCode writeDaqBlock (DayaBay::DaqBlock *daqBlock, unsigned int deltaEvents)
 Writes supplied DaqBlock to ROOT file.

Private Attributes

std::string m_daqBlockLocation
 Location in file where DAQ block will be saved.
DybDaq::DaqToStrStreamm_strStream
 The current DaqToStrStream into which data is being written.
IDybStorageSvcm_storageSvc
 The Storage service used to write the DaqBlocks.

Detailed Description

Definition at line 28 of file DaqRootWriter.h.


Constructor & Destructor Documentation

DaqRootWriter::DaqRootWriter ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 31 of file DaqRootWriter.cc.

                                               :
    DaqFormatWriter(name,
                    svc),
    m_storageSvc(0) {
    declareProperty("DaqBlockLocation",
                    m_daqBlockLocation=DayaBay::DaqBlockHeaderLocation::Default,
                    "Location in file where DAQ block will be saved.");
}
DaqRootWriter::~DaqRootWriter ( ) [virtual]

Definition at line 41 of file DaqRootWriter.cc.

                              {
}

Member Function Documentation

StatusCode DaqRootWriter::initialize ( ) [virtual]

Reimplemented from DybDaq::DaqFormatWriter.

Definition at line 44 of file DaqRootWriter.cc.

{
    StatusCode sc = DaqFormatWriter::initialize();
    if(sc.isFailure()) {
        return sc;
    }

    // Initialize the necessary services
    sc = service("DybStorageSvc",
                 m_storageSvc,
                 true);
    if(sc.isFailure()) {
        m_storageSvc = 0;
        warning() << "No Storage Service was found, so this module will be disabled" << endreq;
    }
    return StatusCode::SUCCESS;
}
StatusCode DaqRootWriter::finalize ( ) [virtual]

Reimplemented from DybDaq::DaqFormatWriter.

Definition at line 62 of file DaqRootWriter.cc.

{
    if(0 != m_storageSvc) {
        m_storageSvc->release();
    }
    return DaqFormatWriter::finalize();
}
DaqToOStream * DaqRootWriter::createDaqToOStream ( const DybDaq::FileTraits traits) [protected, virtual]

Creates the DaqToOStream into which the DAQ bytes wiull be written.

Implements DybDaq::DaqFormatWriter.

Definition at line 70 of file DaqRootWriter.cc.

                                                                        {
    m_strStream = new DaqToStrStream(traits);
    return  m_strStream;
}
StatusCode DaqRootWriter::writeData ( const DayaBay::DaqCrate daqCrate) [protected, virtual]

Writes the data block.

Reimplemented from DybDaq::DaqFormatWriter.

Definition at line 75 of file DaqRootWriter.cc.

                                                            {
  if (0 == m_strStream) {
      return StatusCode::FAILURE;
    }
    const EventReadout& eventReadout = daqCrate->eventReadout();
    m_strStream->eventSaved(eventReadout.bufferSize());
    return StatusCode::SUCCESS;
}
void DaqRootWriter::wroteFileHead ( ) [protected, virtual]

Called when the file header records have all been written.

Implements DybDaq::DaqFormatWriter.

Definition at line 84 of file DaqRootWriter.cc.

void DaqRootWriter::wroteData ( ) [protected, virtual]

Called when a file data record has all been written.

Implements DybDaq::DaqFormatWriter.

Definition at line 89 of file DaqRootWriter.cc.

                              {
  // Never called
}
void DaqRootWriter::wroteFileFoot ( ) [protected, virtual]

Called when the file footer records have all been written.

Implements DybDaq::DaqFormatWriter.

Definition at line 93 of file DaqRootWriter.cc.

DaqBlock * DaqRootWriter::createDaqBlock ( ) [private]

Creates a new DaqBlock from the current stream and reset that stream.

Definition at line 98 of file DaqRootWriter.cc.

                                        {
    string content = m_strStream->str();
    m_strStream->splitStream();
    unsigned int length = content.length();
    DaqBlock::RawData* rawData = new DaqBlock::RawData(length / ByteBuffer::BYTES_IN_INT);
    std::memcpy(&((*rawData)[0]),
                content.data(),
                length);
    DaqBlock* result = new DaqBlock();
    result->setBytes(rawData);
    return result;
}
StatusCode DaqRootWriter::writeDaqBlock ( DayaBay::DaqBlock daqBlock,
unsigned int  deltaEvents 
) [private]

Writes supplied DaqBlock to ROOT file.

Definition at line 111 of file DaqRootWriter.cc.

                                                                  {
    if (0 == m_storageSvc) {
        return StatusCode::SUCCESS;;
    }

    DaqBlockHeader* daqHeader = new DaqBlockHeader();
    daqHeader->setDeltaEvents(deltaEvents);
    daqHeader->setDaqBlock(daqBlock);

    DataSvcHelpers::RegistryEntry regEntry = DataSvcHelpers::RegistryEntry(m_daqBlockLocation);
    regEntry.setObject(daqHeader);
    debug() << "Storing DAQ Block" << endreq;
    StatusCode sc = m_storageSvc->store(daqHeader,
                                        m_daqBlockLocation);
    if(sc.isFailure()){
        error() << "Failed to store Run Header to output file" << endreq;
        return sc;
    }
    debug() << "Stored DAQ Block" << endreq;

    return StatusCode::SUCCESS;
}

Member Data Documentation

std::string DaqRootWriter::m_daqBlockLocation [private]

Location in file where DAQ block will be saved.

Definition at line 83 of file DaqRootWriter.h.

The current DaqToStrStream into which data is being written.

Definition at line 88 of file DaqRootWriter.h.

The Storage service used to write the DaqBlocks.

Definition at line 93 of file DaqRootWriter.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:57 for DybIO by doxygen 1.7.4