BOSS 8.0.0
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 ()
StatusCode initialize ()
StatusCode finalize ()
bool putEvent (WriteRawEvent *re)

Detailed Description

Definition at line 10 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 : base_class( name, svcloc ), m_fw( 0 ) {
21
22 declareProperty( "OutputFile", m_outputFile = "offline.raw" );
23
24 m_buffer = new uint32_t[64 * 1024]; // 256k bytes
25}

Referenced by RawDataOutputSvc().

◆ ~RawDataOutputSvc()

RawDataOutputSvc::~RawDataOutputSvc ( )

Definition at line 28 of file RawDataOutputSvc.cxx.

28 {
29 MsgStream log( msgSvc(), name() );
30 log << MSG::DEBUG << "RawDataOutputSvc Destructor called " << endmsg;
31
32 delete[] m_buffer;
33}
IMessageSvc * msgSvc()

Member Function Documentation

◆ finalize()

StatusCode RawDataOutputSvc::finalize ( )

Definition at line 35 of file RawDataOutputSvc.cxx.

35 {
36 // clean up
37 if ( m_fw )
38 {
39 delete m_fw;
40 m_fw = nullptr;
41 }
42
43 return StatusCode::SUCCESS;
44}

◆ initialize()

StatusCode RawDataOutputSvc::initialize ( )

Definition at line 47 of file RawDataOutputSvc.cxx.

47 {
48
49 auto sc = Service::initialize();
50 if ( sc.isFailure() )
51 {
52 error() << "Failed to initialize Service" << endmsg;
53 return sc;
54 }
55 // Open the first output file for writing.
56 m_fw = new RawFileWriter( m_outputFile );
57
58 debug() << "Opened output File " << m_outputFile << endmsg;
59
60 return StatusCode::SUCCESS;
61}

◆ putEvent()

bool RawDataOutputSvc::putEvent ( WriteRawEvent * re)

Definition at line 64 of file RawDataOutputSvc.cxx.

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

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