Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetScapeWriterStream.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetScapeWriterStream.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 writer ascii class
17 
18 #ifndef JETSCAPEWRITERSTREAM_H
19 #define JETSCAPEWRITERSTREAM_H
20 
21 #include <fstream>
22 #include <string>
23 
24 #ifdef USE_GZIP
25 #include "gzstream.h"
26 #endif
27 
28 #include "JetScapeWriter.h"
29 
30 using std::ofstream;
31 
32 namespace Jetscape {
33 
34 template <class T> class JetScapeWriterStream : public JetScapeWriter {
35 
36 public:
38  JetScapeWriterStream<T>(string m_file_name_out);
39  virtual ~JetScapeWriterStream<T>();
40 
41  void Init();
42  void Exec();
43 
44  bool GetStatus() { return output_file.good(); }
45  void Close() { output_file.close(); }
46 
47  void WriteInitFileXMLMain();
48  void WriteInitFileXMLUser();
49 
50  void Write(weak_ptr<PartonShower> ps);
51  void Write(weak_ptr<Parton> p);
52  void Write(weak_ptr<Vertex> v);
53  void Write(weak_ptr<Hadron> h);
54  void WriteHeaderToFile();
55 
56  void Write(string s) { output_file << s << endl; }
57  void WriteComment(string s) { output_file << "# " << s << endl; }
58  void WriteWhiteSpace(string s) { output_file << s << " "; }
59  void WriteEvent();
60 
61 protected:
63  //int m_precision; //!< Output precision
64 
65  // Allows the registration of the module so that it is available to be used by the Jetscape framework.
68 };
69 
71 #ifdef USE_GZIP
73 #endif
74 
75 } // end namespace Jetscape
76 
77 #endif // JETSCAPEWRITERSTREAM_H