Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:19:20

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 //PartonShower with graph from GTL
0017 
0018 #ifndef PARTONSHOWER_H
0019 #define PARTONSHOWER_H
0020 
0021 #include "GTL/graph.h"
0022 #include <GTL/edge_map.h>
0023 #include <GTL/node_map.h>
0024 #include "JetClass.h"
0025 #include "JetScapeLogger.h"
0026 
0027 using std::shared_ptr;
0028 
0029 namespace Jetscape {
0030 
0031 // Think about best interface and what is truly needed, maybe even better
0032 // if no graph at all write a converter function/class and split parton in base
0033 // and after transformer class. TBD ...
0034 class Vertex;
0035 class Parton;
0036 
0037 class PartonShower : public graph {
0038 
0039 public:
0040   PartonShower();
0041   virtual ~PartonShower();
0042 
0043   node new_vertex(shared_ptr<Vertex> v);
0044   int new_parton(node s, node t, shared_ptr<Parton> p);
0045 
0046   shared_ptr<Vertex> GetVertex(node n) { return vMap[n]; }
0047   shared_ptr<Parton> GetParton(edge e) { return pMap[e]; }
0048 
0049   shared_ptr<Parton> GetPartonAt(int n);
0050   shared_ptr<Vertex> GetVertexAt(int n);
0051 
0052   node GetNodeAt(int n);
0053   edge GetEdgeAt(int n);
0054 
0055   int GetNumberOfParents(int n);
0056   int GetNumberOfChilds(int n);
0057 
0058   vector<shared_ptr<Parton>> GetFinalPartons();
0059   vector<fjcore::PseudoJet> GetFinalPartonsForFastJet();
0060 
0061   //unique_ptr<Parton> GetPartonAt(int i);
0062   //unique_ptr<Vertex> GetVertexAt(int i);
0063   //vector<unique_ptr<Parton>> GetPartons() {};
0064 
0065   int GetNumberOfPartons() const { return number_of_edges(); }
0066   int GetNumberOfVertices() const { return number_of_nodes(); }
0067 
0068   void save_node_info_handler(ostream *o, node n) const;
0069   void save_edge_info_handler(ostream *o, edge n) const;
0070 
0071   void load_edge_info_handler(edge e, GML_pair *read);
0072   void load_node_info_handler(node n, GML_pair *read);
0073   void pre_clear_handler();
0074 
0075   void PrintVertices() { PrintNodes(false); }
0076   void PrintPartons() { PrintEdges(false); }
0077   void PrintNodes(bool verbose = true);
0078   void PrintEdges(bool verbose = true);
0079 
0080   void SaveAsGML(string fName) { save(fName.c_str()); }
0081   void SaveAsGV(string fName);
0082   void SaveAsGraphML(string fName);
0083 
0084 private:
0085   node_map<shared_ptr<Vertex>> vMap;
0086   edge_map<shared_ptr<Parton>> pMap;
0087 
0088   vector<shared_ptr<Parton>> pFinal;
0089 
0090   //Check map data format (pointer to edge/node !??)
0091   //map<weak_ptr<Parton>, edge> pToEdgeMap;
0092   //map<weak_ptr<Vertex>, node> vToNodeMap;
0093 
0094   //void CreateMaps();
0095   //bool mapsFilled;
0096 
0097   //Check here memory issues to avoid cyclic references (use unique pointers instead for return functions!?
0098   //In general rethink and clean up pointer types for efficiency and safety ...
0099   //Only fill when needed via Getters ...
0100   //Can also be done via lists, a bit slower (interface question ...)
0101   //vector<weak_ptr<Parton>> pVec;
0102   //vector<weak_ptr<Vertex>> vVec;
0103 
0104   //void FillVertexVec();
0105   //void FillPartonVec();
0106 };
0107 
0108 } // end namespace Jetscape
0109 #endif