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
JetScapeWriterFinalStateStream.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file JetScapeWriterFinalStateStream.h
1
/*******************************************************************************
2
* Copyright (c) The JETSCAPE Collaboration, 2018
3
*
4
* Modular, task-based framework for simulating all aspects of heavy-ion collisions
5
*
6
* For the list of contributors see AUTHORS.
7
*
8
* Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9
*
10
* or via email to bugs.jetscape@gmail.com
11
*
12
* Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13
* See COPYING for details.
14
******************************************************************************/
15
16
// Jetscape final state {hadrons,kartons} writer ascii class
17
// Based on JetScapeWriterStream.
18
// author: Raymond Ehlers <raymond.ehlers@cern.ch>, ORNL
19
20
#ifndef JETSCAPEWRITERSTREAM_H
21
#define JETSCAPEWRITERSTREAM_H
22
23
#include <fstream>
24
#include <string>
25
26
#ifdef USE_GZIP
27
#include "
gzstream.h
"
28
#endif
29
30
#include "
JetScapeWriter.h
"
31
32
using
std::ofstream;
33
34
namespace
Jetscape {
35
36
template
<
class
T>
37
class
JetScapeWriterFinalStateStream
:
public
JetScapeWriter
{
38
39
public
:
40
JetScapeWriterFinalStateStream<T>
(){};
41
JetScapeWriterFinalStateStream<T>
(
string
m_file_name_out);
42
virtual
~
JetScapeWriterFinalStateStream<T>
();
43
44
void
Init
();
45
void
Exec
();
46
47
virtual
std::string
GetName
() {
throw
std::runtime_error(
"Don't use the base class"
); }
48
bool
GetStatus
() {
return
output_file
.good(); }
49
// Close is utilized to add the xsec and error.
50
void
Close
();
51
52
void
Write
(weak_ptr<PartonShower>
ps
);
53
void
Write
(weak_ptr<Hadron>
h
);
54
// We aren't interested in the individual partons or vertices, so skip them.
55
56
void
WriteHeaderToFile
() { };
57
void
WriteEvent
();
58
59
void
Write
(
string
s
) {
output_file
<< s << endl; }
60
// Intentionally make these no-ops since we want to fully control our output from this
61
// class. Tasks will often directly call these functions, so we need to prevent them from doing so.
62
void
WriteComment
(
string
s
) { }
63
void
WriteWhiteSpace
(
string
s
) { }
64
65
protected
:
66
T
output_file
;
67
std::vector<std::shared_ptr<JetScapeParticleBase>>
particles
;
68
};
69
70
template
<
class
T>
71
class
JetScapeWriterFinalStatePartonsStream
:
public
JetScapeWriterFinalStateStream
<T> {
72
std::string
GetName
() {
return
"partons"
; }
73
// Don't collect the hadrons by making it a no-op
74
void
Write
(weak_ptr<Hadron>
h
) { }
75
protected
:
76
// Allows the registration of the module so that it is available to be used by the Jetscape framework.
77
static
RegisterJetScapeModule<JetScapeWriterFinalStatePartonsStream<ofstream>
>
regParton
;
78
static
RegisterJetScapeModule<JetScapeWriterFinalStatePartonsStream<ogzstream>
>
regPartonGZ
;
79
};
80
81
template
<
class
T>
82
class
JetScapeWriterFinalStateHadronsStream
:
public
JetScapeWriterFinalStateStream
<T> {
83
std::string
GetName
() {
return
"hadrons"
; }
84
// Don't collect the hadrons by making it a no-op
85
void
Write
(weak_ptr<PartonShower>
ps
) { }
86
protected
:
87
// Allows the registration of the module so that it is available to be used by the Jetscape framework.
88
static
RegisterJetScapeModule<JetScapeWriterFinalStateHadronsStream<ofstream>
>
regHadron
;
89
static
RegisterJetScapeModule<JetScapeWriterFinalStateHadronsStream<ogzstream>
>
regHadronGZ
;
90
};
91
92
typedef
JetScapeWriterFinalStatePartonsStream<ofstream>
JetScapeWriterFinalStatePartonsAscii
;
93
typedef
JetScapeWriterFinalStateHadronsStream<ofstream>
JetScapeWriterFinalStateHadronsAscii
;
94
#ifdef USE_GZIP
95
typedef
JetScapeWriterFinalStatePartonsStream<ogzstream>
JetScapeWriterFinalStatePartonsAsciiGZ;
96
typedef
JetScapeWriterFinalStateHadronsStream<ogzstream>
JetScapeWriterFinalStateHadronsAsciiGZ;
97
#endif
98
99
}
// end namespace Jetscape
100
101
#endif // JETSCAPEWRITERSTREAM_H
JETSCAPE
blob
main
src
framework
JetScapeWriterFinalStateStream.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:24
using
1.8.2 with
sPHENIX GitHub integration