Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetScapeReader.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetScapeReader.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 #ifndef JETSCAPEREADER_H
17 #define JETSCAPEREADER_H
18 
19 #include "GTL/graph.h"
20 #include <GTL/edge_map.h>
21 #include <GTL/node_map.h>
22 #include "JetClass.h"
23 #include "JetScapeParticles.h"
24 #include "JetScapeLogger.h"
25 #include "StringTokenizer.h"
26 #include "PartonShower.h"
27 #include <fstream>
28 #ifdef USE_GZIP
29 #include "gzstream.h"
30 #endif
31 
32 using std::ostream;
33 using std::istream;
34 using std::ofstream;
35 using std::ifstream;
36 
37 namespace Jetscape {
38 
39 template <class T> class JetScapeReader {
40 
41 public:
43  JetScapeReader(string m_file_name_in) {
44  file_name_in = m_file_name_in;
45  Init();
46  }
47  virtual ~JetScapeReader();
48 
49  void Close() { inFile.close(); }
50  void Clear();
51 
52  void Next();
53  bool Finished() { return inFile.eof(); }
54 
55  int GetCurrentEvent() { return currentEvent - 1; }
56  int GetCurrentNumberOfPartonShowers() { return pShowers.size(); }
57 
58  //shared_ptr<PartonShower> GetPartonShower() {return pShower;}
59  vector<shared_ptr<PartonShower>> GetPartonShowers() { return pShowers; }
60 
61  vector<shared_ptr<Hadron>> GetHadrons() { return hadrons; }
62  vector<fjcore::PseudoJet> GetHadronsForFastJet();
63  double GetSigmaGen() const { return sigmaGen; }
64  double GetSigmaErr() const { return sigmaErr; }
65  double GetEventWeight() const { return eventWeight; }
66  double GetEventPlaneAngle() const { return EventPlaneAngle; }
67 
68 private:
70 
71  void Init();
72  void AddNode(string s);
73  void AddEdge(string s);
74  //void MakeGraph();
75  void AddHadron(string s);
76  string file_name_in;
78 
81 
82  shared_ptr<PartonShower> pShower;
83  vector<shared_ptr<PartonShower>> pShowers;
84 
85  vector<node> nodeVec;
86  vector<edge> edgeVec;
87  vector<shared_ptr<Hadron>> hadrons;
88  double sigmaGen;
89  double sigmaErr;
90  double eventWeight;
92 };
93 
95 #ifdef USE_GZIP
96 typedef JetScapeReader<igzstream> JetScapeReaderAsciiGZ;
97 #endif
98 
99 } // end namespace Jetscape
100 
101 // ---------------------
102 
103 #endif
104 
105 // ---------------------