Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
JetScapeWriterAsciiGZ.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file JetScapeWriterAsciiGZ.cc
1
// -----------------------------------------
2
// JetScape (modular/task) based framework
3
// Intial Design: Joern Putschke (2017)
4
// (Wayne State University)
5
// -----------------------------------------
6
// License and Doxygen-like Documentation to be added ...
7
8
// jetscape writer ascii + gzip class implementation
9
10
#include "
JetScapeWriterAsciiGZ.h
"
11
#include "
JetScapeLogger.h
"
12
#include "
JetScapeXML.h
"
13
14
namespace
Jetscape {
15
16
JetScapeWriterAsciiGZ::JetScapeWriterAsciiGZ
(
string
m_file_name_out)
17
{
18
SetOutputFileName
(m_file_name_out);
19
}
20
21
JetScapeWriterAsciiGZ::~JetScapeWriterAsciiGZ
()
22
{
23
if
(
GetActive
())
24
Close
();
25
}
26
27
void
JetScapeWriterAsciiGZ::WriteHeaderToFile
()
28
{
29
INFO
<<
"Run JetScapeWriterAsciiGZ: Write header of event # "
<<
GetCurrentEvent
()<<
" ..."
;
30
Write
(
to_string
(
GetCurrentEvent
()) +
" Event"
);
31
32
std::ostringstream oss;
33
oss.str(
""
); oss <<
GetId
() <<
"sigmaGen "
<<
GetHeader
().
GetSigmaGen
();
34
WriteComment
( oss.str() );
35
oss.str(
""
); oss <<
GetId
() <<
"sigmaErr "
<<
GetHeader
().
GetSigmaErr
();
36
WriteComment
( oss.str() );
37
oss.str(
""
); oss <<
GetId
() <<
"weight "
<<
GetHeader
().
GetEventWeight
();
38
WriteComment
( oss.str() );
39
}
40
41
void
JetScapeWriterAsciiGZ::WriteEvent
()
42
{
43
// INFO<<"Run JetScapeWriterAsciiGZ: Write event # "<<GetCurrentEvent()<<" ...";
44
// do nothing, the modules handle this
45
}
46
47
void
JetScapeWriterAsciiGZ::Write
(weak_ptr<Parton>
p
)
48
{
49
auto
pp = p.lock();
50
if
( pp ) {
51
output_file
<< *pp << endl;
52
}
53
}
54
55
void
JetScapeWriterAsciiGZ::Write
(weak_ptr<Vertex>
v
)
56
{
57
auto
vv = v.lock();
58
if
( vv ){
59
output_file
<< *vv << endl;
60
}
61
}
62
63
void
JetScapeWriterAsciiGZ::Write
(weak_ptr<PartonShower>
ps
){
64
auto
pShower = ps.lock();
65
if
( !pShower)
return
;
66
67
WriteComment
(
"Parton Shower in JetScape format to be used later by GTL graph:"
);
68
69
// write vertices
70
PartonShower::node_iterator
nIt,nEnd;
71
72
for
(nIt = pShower->nodes_begin(), nEnd = pShower->nodes_end(); nIt != nEnd; ++nIt){
73
WriteWhiteSpace
(
"["
+
to_string
(nIt->id())+
"] V"
);
74
Write
(pShower->GetVertex(*nIt));
75
}
76
77
PartonShower::edge_iterator
eIt,eEnd;
78
for
(eIt = pShower->edges_begin(), eEnd = pShower->edges_end(); eIt != eEnd; ++eIt) {
79
WriteWhiteSpace
(
"["
+
to_string
(eIt->source().id())+
"]=>["
+
to_string
(eIt->target().id())+
"] P"
);
80
Write
(pShower->GetParton(*eIt));
81
}
82
83
}
84
85
86
void
JetScapeWriterAsciiGZ::Write
(weak_ptr<Hadron>
h
)
87
{
88
auto
hh = h.lock();
89
if
( hh ){
90
output_file
<< *hh << endl;
91
}
92
}
93
94
void
JetScapeWriterAsciiGZ::Init
()
95
{
96
if
(
GetActive
())
97
{
98
INFO
<<
"JetScape (gzip) Writer initialized with output file = "
<<
GetOutputFileName
();
99
output_file
.
open
(
GetOutputFileName
().c_str());
100
}
101
}
102
103
void
JetScapeWriterAsciiGZ::Exec
()
104
{
105
// if (GetActive())
106
// WriteEvent();
107
}
108
109
}
// end namespace Jetscape
JETSCAPE
blob
main
jail
JetScapeWriterAsciiGZ.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:24
using
1.8.2 with
sPHENIX GitHub integration