Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:08

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2018
0003  *
0004  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
0005  * 
0006  * For the list of contributors see AUTHORS.
0007  *
0008  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
0009  *
0010  * or via email to bugs.jetscape@gmail.com
0011  *
0012  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
0013  * See COPYING for details.
0014  ******************************************************************************/
0015 
0016 #ifndef JETSCAPEREADER_H
0017 #define JETSCAPEREADER_H
0018 
0019 #include "GTL/graph.h"
0020 #include <GTL/edge_map.h>
0021 #include <GTL/node_map.h>
0022 #include "JetClass.h"
0023 #include "JetScapeParticles.h"
0024 #include "JetScapeLogger.h"
0025 #include "StringTokenizer.h"
0026 #include "PartonShower.h"
0027 #include <fstream>
0028 #ifdef USE_GZIP
0029 #include "gzstream.h"
0030 #endif
0031 
0032 using std::ostream;
0033 using std::istream;
0034 using std::ofstream;
0035 using std::ifstream;
0036 
0037 namespace Jetscape {
0038 
0039 template <class T> class JetScapeReader {
0040 
0041 public:
0042   JetScapeReader();
0043   JetScapeReader(string m_file_name_in) {
0044     file_name_in = m_file_name_in;
0045     Init();
0046   }
0047   virtual ~JetScapeReader();
0048 
0049   void Close() { inFile.close(); }
0050   void Clear();
0051 
0052   void Next();
0053   bool Finished() { return inFile.eof(); }
0054 
0055   int GetCurrentEvent() { return currentEvent - 1; }
0056   int GetCurrentNumberOfPartonShowers() { return pShowers.size(); }
0057 
0058   //shared_ptr<PartonShower> GetPartonShower() {return pShower;}
0059   vector<shared_ptr<PartonShower>> GetPartonShowers() { return pShowers; }
0060 
0061   vector<shared_ptr<Hadron>> GetHadrons() { return hadrons; }
0062   vector<fjcore::PseudoJet> GetHadronsForFastJet();
0063   double GetSigmaGen() const { return sigmaGen; }
0064   double GetSigmaErr() const { return sigmaErr; }
0065   double GetEventWeight() const { return eventWeight; }
0066   double GetEventPlaneAngle() const { return EventPlaneAngle; }
0067 
0068 private:
0069   StringTokenizer strT;
0070 
0071   void Init();
0072   void AddNode(string s);
0073   void AddEdge(string s);
0074   //void MakeGraph();
0075   void AddHadron(string s);
0076   string file_name_in;
0077   T inFile;
0078 
0079   int currentEvent;
0080   int currentShower;
0081 
0082   shared_ptr<PartonShower> pShower;
0083   vector<shared_ptr<PartonShower>> pShowers;
0084 
0085   vector<node> nodeVec;
0086   vector<edge> edgeVec;
0087   vector<shared_ptr<Hadron>> hadrons;
0088   double sigmaGen;
0089   double sigmaErr;
0090   double eventWeight;
0091   double EventPlaneAngle;
0092 };
0093 
0094 typedef JetScapeReader<ifstream> JetScapeReaderAscii;
0095 #ifdef USE_GZIP
0096 typedef JetScapeReader<igzstream> JetScapeReaderAsciiGZ;
0097 #endif
0098 
0099 } // end namespace Jetscape
0100 
0101 // ---------------------
0102 
0103 #endif
0104 
0105 // ---------------------