Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PartonShower.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PartonShower.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 //PartonShower with graph from GTL
17 
18 #ifndef PARTONSHOWER_H
19 #define PARTONSHOWER_H
20 
21 #include "GTL/graph.h"
22 #include <GTL/edge_map.h>
23 #include <GTL/node_map.h>
24 #include "JetClass.h"
25 #include "JetScapeLogger.h"
26 
27 using std::shared_ptr;
28 
29 namespace Jetscape {
30 
31 // Think about best interface and what is truly needed, maybe even better
32 // if no graph at all write a converter function/class and split parton in base
33 // and after transformer class. TBD ...
34 class Vertex;
35 class Parton;
36 
37 class PartonShower : public graph {
38 
39 public:
40  PartonShower();
41  virtual ~PartonShower();
42 
43  node new_vertex(shared_ptr<Vertex> v);
45 
46  shared_ptr<Vertex> GetVertex(node n) { return vMap[n]; }
48 
50  shared_ptr<Vertex> GetVertexAt(int n);
51 
52  node GetNodeAt(int n);
53  edge GetEdgeAt(int n);
54 
55  int GetNumberOfParents(int n);
56  int GetNumberOfChilds(int n);
57 
58  vector<shared_ptr<Parton>> GetFinalPartons();
59  vector<fjcore::PseudoJet> GetFinalPartonsForFastJet();
60 
61  //unique_ptr<Parton> GetPartonAt(int i);
62  //unique_ptr<Vertex> GetVertexAt(int i);
63  //vector<unique_ptr<Parton>> GetPartons() {};
64 
65  int GetNumberOfPartons() const { return number_of_edges(); }
66  int GetNumberOfVertices() const { return number_of_nodes(); }
67 
68  void save_node_info_handler(ostream *o, node n) const;
69  void save_edge_info_handler(ostream *o, edge n) const;
70 
73  void pre_clear_handler();
74 
75  void PrintVertices() { PrintNodes(false); }
76  void PrintPartons() { PrintEdges(false); }
77  void PrintNodes(bool verbose = true);
78  void PrintEdges(bool verbose = true);
79 
80  void SaveAsGML(string fName) { save(fName.c_str()); }
81  void SaveAsGV(string fName);
82  void SaveAsGraphML(string fName);
83 
84 private:
87 
88  vector<shared_ptr<Parton>> pFinal;
89 
90  //Check map data format (pointer to edge/node !??)
91  //map<weak_ptr<Parton>, edge> pToEdgeMap;
92  //map<weak_ptr<Vertex>, node> vToNodeMap;
93 
94  //void CreateMaps();
95  //bool mapsFilled;
96 
97  //Check here memory issues to avoid cyclic references (use unique pointers instead for return functions!?
98  //In general rethink and clean up pointer types for efficiency and safety ...
99  //Only fill when needed via Getters ...
100  //Can also be done via lists, a bit slower (interface question ...)
101  //vector<weak_ptr<Parton>> pVec;
102  //vector<weak_ptr<Vertex>> vVec;
103 
104  //void FillVertexVec();
105  //void FillPartonVec();
106 };
107 
108 } // end namespace Jetscape
109 #endif