HepMC3 event record library
examples
ConvertExample
include
WriterDOT.h
Go to the documentation of this file.
1
#ifndef HEPMC3_WRITERDOT_H
2
#define HEPMC3_WRITERDOT_H
3
///
4
/// @file WriterDOT.h
5
/// @brief Definition of class \b WriterDOT
6
///
7
/// @class HepMC3::WriterDOT
8
/// @brief GenEvent I/O output to dot files that should be processed by graphviz or other software
9
///
10
/// @ingroup Examples
11
///
12
#include <string>
13
#include <fstream>
14
#include "
HepMC3/Writer.h
"
15
#include "
HepMC3/GenEvent.h
"
16
#include "
HepMC3/GenParticle.h
"
17
#include "
HepMC3/GenVertex.h
"
18
#include "
HepMC3/Data/GenEventData.h
"
19
namespace
HepMC3
20
{
21
class
WriterDOT
:
public
Writer
22
{
23
public
:
24
/// @brief Constructor
25
/// @warning If file already exists, it will be cleared before writing
26
WriterDOT
(
const
std::string &filename,std::shared_ptr<GenRunInfo> run = std::shared_ptr<GenRunInfo>());
27
/// @brief Constructor from ostream
28
WriterDOT
(std::ostream& stream,std::shared_ptr<GenRunInfo> run =std:: shared_ptr<GenRunInfo>());
29
/// @brief Write event to file
30
///
31
/// @param[in] evt Event to be serialized
32
void
write_event
(
const
GenEvent
&evt);
33
/// @brief Return status of the stream
34
bool
failed
() {
35
return
(
bool
)
m_file
.rdstate();
36
}
37
/// @brief Close file stream
38
void
close
();
39
/// @brief Close file stream
40
void
set_style
(
const
int
& istyle) {
41
m_style
=istyle;
42
};
43
44
private
:
45
void
allocate_buffer
();
//!< allocates buffer for output
46
void
flush
();
//!< flushes output buffer
47
void
forced_flush
();
//!< flushes output buffer
48
std::ofstream
m_file
;
//!< Output file
49
std::ostream*
m_stream
;
//!< Output stream
50
int
m_style
;
//!< style of dot file
51
char
*
m_buffer
;
//!< Stream buffer
52
char
*
m_cursor
;
//!< Cursor inside stream buffer
53
unsigned
long
m_buffer_size
;
//!< Buffer size
54
};
55
}
56
#endif
GenEventData.h
Definition of struct GenEventData.
GenEvent.h
Definition of class GenEvent.
GenParticle.h
Definition of class GenParticle.
GenVertex.h
Definition of class GenVertex.
Writer.h
Definition of interface Writer.
HepMC3::GenEvent
Stores event-related information.
Definition:
GenEvent.h:41
HepMC3::WriterDOT
GenEvent I/O output to dot files that should be processed by graphviz or other software.
Definition:
WriterDOT.h:22
HepMC3::WriterDOT::allocate_buffer
void allocate_buffer()
allocates buffer for output
Definition:
WriterDOT.cc:100
HepMC3::WriterDOT::m_cursor
char * m_cursor
Cursor inside stream buffer.
Definition:
WriterDOT.h:52
HepMC3::WriterDOT::set_style
void set_style(const int &istyle)
Close file stream.
Definition:
WriterDOT.h:40
HepMC3::WriterDOT::m_buffer
char * m_buffer
Stream buffer.
Definition:
WriterDOT.h:51
HepMC3::WriterDOT::close
void close()
Close file stream.
Definition:
WriterDOT.cc:26
HepMC3::WriterDOT::m_file
std::ofstream m_file
Output file.
Definition:
WriterDOT.h:48
HepMC3::WriterDOT::failed
bool failed()
Return status of the stream.
Definition:
WriterDOT.h:34
HepMC3::WriterDOT::m_buffer_size
unsigned long m_buffer_size
Buffer size.
Definition:
WriterDOT.h:53
HepMC3::WriterDOT::write_event
void write_event(const GenEvent &evt)
Write event to file.
Definition:
WriterDOT.cc:46
HepMC3::WriterDOT::flush
void flush()
flushes output buffer
Definition:
WriterDOT.cc:118
HepMC3::WriterDOT::forced_flush
void forced_flush()
flushes output buffer
Definition:
WriterDOT.cc:127
HepMC3::WriterDOT::m_stream
std::ostream * m_stream
Output stream.
Definition:
WriterDOT.h:49
HepMC3::WriterDOT::m_style
int m_style
style of dot file
Definition:
WriterDOT.h:50
HepMC3::Writer
Base class for all I/O writers.
Definition:
Writer.h:25
HepMC3
HepMC3 main namespace.
Definition:
AnalysisExample.h:19
Generated on Wed Jan 18 2023 00:00:00 for HepMC3 event record library by
1.9.6