BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataOutputSvc Class Reference

#include <RawDataOutputSvc.h>

+ Inheritance diagram for RawDataOutputSvc:

Public Member Functions

 RawDataOutputSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~RawDataOutputSvc (void)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual bool putEvent (WriteRawEvent *re)
 
- Public Member Functions inherited from IRawDataOutputSvc
 IRawDataOutputSvc (const std::string &name, ISvcLocator *svcloc)
 
virtual ~IRawDataOutputSvc (void)
 

Detailed Description

Definition at line 12 of file RawDataOutputSvc.h.

Constructor & Destructor Documentation

◆ RawDataOutputSvc()

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

Definition at line 19 of file RawDataOutputSvc.cxx.

20 : IRawDataOutputSvc(name,svcloc),
21 m_fw(0)
22{
23 PropertyMgr m_propMgr;
24 m_propMgr.declareProperty("OutputFile", m_outputFile = "offline.raw");
25
26 IJobOptionsSvc* jobSvc;
27 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
28 jobSvc->setMyProperties(name, &m_propMgr);
29
30 m_buffer = new uint32_t[64*1024]; // 256k bytes
31}
IRawDataOutputSvc(const std::string &name, ISvcLocator *svcloc)

◆ ~RawDataOutputSvc()

RawDataOutputSvc::~RawDataOutputSvc ( void )

Definition at line 34 of file RawDataOutputSvc.cxx.

35{
36 MsgStream log(messageService(), name() );
37 log << MSG::DEBUG << "RawDataOutputSvc Destructor called " << endreq;
38
39 delete [] m_buffer;
40}

Member Function Documentation

◆ finalize()

StatusCode RawDataOutputSvc::finalize ( )
virtual

Definition at line 43 of file RawDataOutputSvc.cxx.

44{
45 // clean up
46 if ( m_fw ) {
47 delete m_fw;
48 m_fw = 0;
49 }
50
51 return StatusCode::SUCCESS;
52}

◆ initialize()

StatusCode RawDataOutputSvc::initialize ( )
virtual

Reimplemented from IRawDataOutputSvc.

Definition at line 55 of file RawDataOutputSvc.cxx.

56{
57 MsgStream log(messageService(), name() );
58
59 // Open the first output file for writing.
60 m_fw = new RawFileWriter(m_outputFile);
61
62 log << MSG::DEBUG << "Opened output File " << m_outputFile << endreq;
63
64 return StatusCode::SUCCESS;
65}

◆ putEvent()

bool RawDataOutputSvc::putEvent ( WriteRawEvent * re)
virtual

Implements IRawDataOutputSvc.

Definition at line 68 of file RawDataOutputSvc.cxx.

69{
70 MsgStream log(messageService(), name() );
71
72 //uint32_t evt_size_w = re->size_word();
73
74 const eformat::write::node_t* top = re->bind();
75 if (eformat::write::copy(*top, m_buffer, 64*1024) == 0) {
76 log << MSG::ERROR << "failed to copy Event to the buffer !" << endreq;
77 return false;
78 }
79
80 try {
81 RawEvent evt(m_buffer);
82 evt.check_tree();
83 }
84 catch (std::exception& ex) {
85 std::cerr << "Uncaught std exception: " << ex.what() << std::endl;
86 std::exit(1);
87 }
88 catch (...) {
89 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
90 std::exit(1);
91 }
92
93 m_fw->writeEvent(m_buffer);
94
95 return true;
96}
int writeEvent(const uint32_t *pevt)
const eformat::write::node_t * bind(void)
uint32_t copy(const node_t &list, uint32_t *dest, size_t max)
Definition node.cxx:64

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