RawDataOutputSvc Class Reference

#include <RawDataOutputSvc.h>

Inheritance diagram for RawDataOutputSvc:

IRawDataOutputSvc List of all members.

Public Member Functions

 RawDataOutputSvc (const std::string &name, ISvcLocator *svcloc)
 ~RawDataOutputSvc (void)
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual bool putEvent (WriteRawEvent *re)

Private Attributes

uint32_t * m_buffer
RawFileWriterm_fw
std::string m_outputFile

Detailed Description

Definition at line 12 of file RawDataOutputSvc.h.


Constructor & Destructor Documentation

RawDataOutputSvc::RawDataOutputSvc ( const std::string name,
ISvcLocator *  svcloc 
)

Definition at line 18 of file RawDataOutputSvc.cxx.

References m_buffer, and m_outputFile.

00019    : IRawDataOutputSvc(name,svcloc),  
00020      m_fw(0)
00021 {
00022   PropertyMgr m_propMgr;
00023   m_propMgr.declareProperty("OutputFile", m_outputFile = "offline.raw");
00024 
00025   IJobOptionsSvc* jobSvc; 
00026   Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
00027   jobSvc->setMyProperties(name, &m_propMgr);
00028 
00029   m_buffer = new uint32_t[64*1024];  // 256k bytes
00030 }

RawDataOutputSvc::~RawDataOutputSvc ( void   ) 

Definition at line 33 of file RawDataOutputSvc.cxx.

References Bes_Common::DEBUG, and m_buffer.

00034 {
00035   MsgStream log(messageService(), name() );
00036   log << MSG::DEBUG << "RawDataOutputSvc Destructor called " << endreq;
00037 
00038   delete [] m_buffer;
00039 }


Member Function Documentation

StatusCode RawDataOutputSvc::finalize (  )  [virtual]

Definition at line 42 of file RawDataOutputSvc.cxx.

References m_fw.

00043 {
00044    // clean up
00045    if ( m_fw ) {
00046       delete m_fw;
00047       m_fw = 0;
00048    }
00049  
00050    return StatusCode::SUCCESS;
00051 }

StatusCode RawDataOutputSvc::initialize (  )  [virtual]

Reimplemented from IRawDataOutputSvc.

Definition at line 54 of file RawDataOutputSvc.cxx.

References Bes_Common::DEBUG, m_fw, and m_outputFile.

00055 {
00056    MsgStream log(messageService(), name() );
00057 
00058    // Open the first output file for writing.
00059    m_fw = new RawFileWriter(m_outputFile);
00060 
00061    log << MSG::DEBUG << "Opened output File " << m_outputFile << endreq;
00062   
00063    return StatusCode::SUCCESS;
00064 }

bool RawDataOutputSvc::putEvent ( WriteRawEvent re  )  [virtual]

Implements IRawDataOutputSvc.

Definition at line 67 of file RawDataOutputSvc.cxx.

References eformat::write::FullEventFragment::bind(), eformat::FullEventFragment< TPointer >::check_tree(), eformat::write::copy(), calibUtil::ERROR, m_buffer, m_fw, and RawFileWriter::writeEvent().

00068 {
00069   MsgStream log(messageService(), name() );
00070 
00071   //uint32_t evt_size_w = re->size_word();
00072 
00073   const eformat::write::node_t* top = re->bind();
00074   if (eformat::write::copy(*top, m_buffer, 64*1024) == 0) {
00075     log << MSG::ERROR << "failed to copy Event to the buffer !" << endreq;
00076     return false;
00077   }
00078 
00079   try {
00080     RawEvent evt(m_buffer);
00081     evt.check_tree();
00082   }
00083   catch (std::exception& ex) {
00084     std::cerr << "Uncaught std exception: " << ex.what() << std::endl;
00085     std::exit(1);
00086   }
00087   catch (...) {
00088     std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
00089     std::exit(1);
00090   }
00091 
00092   m_fw->writeEvent(m_buffer);
00093 
00094   return true; 
00095 }


Member Data Documentation

uint32_t* RawDataOutputSvc::m_buffer [private]

Definition at line 25 of file RawDataOutputSvc.h.

Referenced by putEvent(), RawDataOutputSvc(), and ~RawDataOutputSvc().

RawFileWriter* RawDataOutputSvc::m_fw [private]

Definition at line 26 of file RawDataOutputSvc.h.

Referenced by finalize(), initialize(), and putEvent().

std::string RawDataOutputSvc::m_outputFile [private]

Definition at line 27 of file RawDataOutputSvc.h.

Referenced by initialize(), and RawDataOutputSvc().


Generated on Tue Nov 29 23:20:46 2016 for BOSS_7.0.2 by  doxygen 1.4.7