Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InitialState.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InitialState.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 INITIALSTATE_H
17 #define INITIALSTATE_H
18 
19 #include <tuple>
20 #include <memory>
21 #include "JetScapeModuleBase.h"
22 #include "JetClass.h"
23 
24 namespace Jetscape {
29 public:
32  InitialState() { SetId("InitialState"); }
33 
36  ~InitialState();
37 
41  virtual void Init();
42 
46  virtual void Exec();
47 
50  virtual void Clear();
51 
55  virtual void Write(weak_ptr<JetScapeWriter> w);
56 
60  virtual void CollectHeader(weak_ptr<JetScapeWriter> w);
61 
65  virtual double GetNpart() { return -1; };
66 
70  virtual double GetNcoll() { return -1; };
71 
75  virtual double GetTotalEntropy() { return -1; };
76 
77  // one can set range by hand if not read from xml file
83  inline void SetRanges(double xmax, double ymax, double zmax) {
84  grid_max_x_ = xmax;
85  grid_max_y_ = ymax;
86  grid_max_z_ = zmax;
87  }
88 
89  // one can set grid steps by hand if not read from xml file
95  inline void SetSteps(double dx, double dy, double dz) {
96  grid_step_x_ = dx;
97  grid_step_y_ = dy;
98  grid_step_z_ = dz;
99  }
100 
104  inline std::vector<double> GetEntropyDensityDistribution() {
106  };
107 
113  inline std::vector<double> GetNumOfBinaryCollisions() {
115  };
116 
118  int GetEventId() const { return (event_id_); }
119 
121  void SetEventId(int event_id_in) { event_id_ = event_id_in; }
122 
127  std::tuple<double, double, double> CoordFromIdx(int idx);
128  virtual void SampleABinaryCollisionPoint(double &x, double &y);
129 
132  inline double GetXMax() { return grid_max_x_; }
135  inline double GetXStep() { return grid_step_x_; }
138  inline double GetYMax() { return grid_max_y_; }
141  inline double GetYStep() { return grid_step_y_; }
144  inline double GetZMax() { return grid_max_z_; }
147  inline double GetZStep() { return grid_step_z_; }
148 
149  // get number of grids along x, follow trento convention
152  inline int GetXSize() {
153  return int(std::ceil(2 * grid_max_x_ / grid_step_x_));
154  }
155 
156  // get number of grids along y
159  inline int GetYSize() {
160  return int(std::ceil(2 * grid_max_y_ / grid_step_y_));
161  }
162 
163  // get number of grids along z
166  inline int GetZSize() {
167  int nz = 1;
168  if (grid_step_z_ != 0) {
169  nz = int(std::ceil(2 * grid_max_z_ / grid_step_z_));
170  // for 2d case, user may set grid_max_z_ = 0,
171  if (nz == 0)
172  nz = 1;
173  }
174  return nz;
175  }
176 
177 protected:
178  // initial state entropy density distribution for the given grids
179  // stored order: for z { for y {for x } }
183  std::vector<double> entropy_density_distribution_;
184 
185  // one can sample jet production position from Ta * Tb
186  // where Ta * Tb is the distribution of num_of_binary_collisions
187  // stored order: for z { for y {for x } }
191  std::vector<double> num_of_binary_collisions_;
192  // the above should be private. Only Adding getters for now to not break other people's code
193 
197  //inline std::vector<double> GetEntropyDensityDistribution() {return entropy_density_distribution_;};
198 
199  // one can sample jet production position from Ta * Tb
200  // where Ta * Tb is the distribution of num_of_binary_collisions
204  //inline std::vector<double> GetNumOfBinaryCollisions() {return num_of_binary_collisions_;};
205 
206  // compute 3d coordinates (x, y, z) given the 1D index in vector
210  //std::tuple<double, double, double> CoordFromIdx(int idx);
211 
213  //int GetEventId() const {return(event_id_);}
214  //void SetEventId(int event_id_in) {event_id_ = event_id_in;}
215 
216  // default assumption: x range = [-grid_max_x_, grid_max_x_]
217  // default assumption: y range = [-grid_max_y_, grid_max_y_]
218  // default assumption: z range = [-grid_max_z_, grid_max_z_]
219  double grid_max_x_;
220  double grid_max_y_;
221  double grid_max_z_; // z can represent spatial rapidity
222 
223  // one problem: different hydro codes require different dx_i / dtau
224  // matches between (dx_i/dtau, hydro_code) should be checked
225  double grid_step_x_;
226  double grid_step_y_;
227  double grid_step_z_;
228 };
229 
230 } // end namespace Jetscape
231 
232 #endif