![]() |
|
|||
File indexing completed on 2025-08-03 08:19:55
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 INITIALSTATE_H 0017 #define INITIALSTATE_H 0018 0019 #include <tuple> 0020 #include <memory> 0021 #include "JetScapeModuleBase.h" 0022 #include "JetClass.h" 0023 0024 namespace Jetscape { 0025 /** @class 0026 Interface for Initial State Physics. 0027 */ 0028 class InitialState : public JetScapeModuleBase { 0029 public: 0030 /** Default constructor to create a Initial State Physics task. Sets the task ID as "InitialState". 0031 */ 0032 InitialState() { SetId("InitialState"); } 0033 0034 /** Destructor for the Initial State Physics task. 0035 */ 0036 ~InitialState(); 0037 0038 /** Reads the input parameters from the XML file under the tag <IS>. Calls InitTask(); This explicit call of InitTask() can be used for actual initialization of modules such as @a Trento if attached as a @a polymorphic class. It also initializes the tasks within the current module. 0039 @sa Read about @a polymorphism in C++. 0040 */ 0041 virtual void Init(); 0042 0043 /** Default Exec() function. It can be overridden by other tasks. 0044 After this is run, GetNumBinaryCollisions and GetEntropyDensityDistribution should return sensible values. 0045 */ 0046 virtual void Exec(); 0047 0048 /** Default Clear() function. It can be overridden by other tasks. 0049 */ 0050 virtual void Clear(); 0051 0052 /** Default Write() function. It can be overridden by other tasks. 0053 @param w A pointer to the JetScapeWriter class. 0054 */ 0055 virtual void Write(weak_ptr<JetScapeWriter> w); 0056 0057 /** Collect header information for writer modules 0058 @param w is a pointer of type JetScapeWrite class. 0059 */ 0060 virtual void CollectHeader(weak_ptr<JetScapeWriter> w); 0061 0062 /** Generated number of collision participants. 0063 To be overwritten by implementations that have such information. 0064 */ 0065 virtual double GetNpart() { return -1; }; 0066 0067 /** Generated number of binary collisions. 0068 To be overwritten by implementations that have such information. 0069 */ 0070 virtual double GetNcoll() { return -1; }; 0071 0072 /** Generated total entropy 0073 To be overwritten by implementations that have such information. 0074 */ 0075 virtual double GetTotalEntropy() { return -1; }; 0076 0077 // one can set range by hand if not read from xml file 0078 /** Sets the range of the coordinates (xmax, ymax, zmax). 0079 @param xmax Maximum value of the coordinate x in the nuclear density profile. 0080 @param ymax Maximum value of the coordinate y in the nuclear density profile. 0081 @param zmax Maxium value of the spatial rapidity ( if (tau,x,y,eta) system), or maximum value of the coordinate z (if in (t,x,y,z) system) in the nuclear density profile. 0082 */ 0083 inline void SetRanges(double xmax, double ymax, double zmax) { 0084 grid_max_x_ = xmax; 0085 grid_max_y_ = ymax; 0086 grid_max_z_ = zmax; 0087 } 0088 0089 // one can set grid steps by hand if not read from xml file 0090 /** It sets the step-size (dx, dy, dz). 0091 @param dx Step-size for x. 0092 @param dy Step-size for y. 0093 @param dz Step-size for z or eta. 0094 */ 0095 inline void SetSteps(double dx, double dy, double dz) { 0096 grid_step_x_ = dx; 0097 grid_step_y_ = dy; 0098 grid_step_z_ = dz; 0099 } 0100 0101 /** @return The initial state entropy density distribution. 0102 @sa Function CoordFromIdx(int idx) for mapping of the index of the vector entropy_density_distribution_ to the fluid cell at location (x, y, z or eta). 0103 */ 0104 inline std::vector<double> GetEntropyDensityDistribution() { 0105 return entropy_density_distribution_; 0106 }; 0107 0108 /** one can sample jet production position from Ta * Tb 0109 where Ta * Tb is the distribution of num_of_binary_collisions 0110 @return The un-normalized probability density of binary collisions. 0111 @sa Function CoordFromIdx(int idx) for mapping of the index of the vector num_of_binary_collisions_ to the fluid cell at location (x, y, z or eta). 0112 */ 0113 inline std::vector<double> GetNumOfBinaryCollisions() { 0114 return num_of_binary_collisions_; 0115 }; 0116 0117 //! @return the event id 0118 int GetEventId() const { return (event_id_); } 0119 0120 //! set the event id 0121 void SetEventId(int event_id_in) { event_id_ = event_id_in; } 0122 0123 /** compute 3d coordinates (x, y, z) given the 1D index in vector 0124 @return Grid point (x,y,z or eta). 0125 @param idx is an integer which maps to an unique unit cell in the coordinate space (x,y,z or eta). 0126 */ 0127 std::tuple<double, double, double> CoordFromIdx(int idx); 0128 virtual void SampleABinaryCollisionPoint(double &x, double &y); 0129 0130 /** @return The maximum value of coordinate "x" in the nuclear profile of a nucleus. 0131 */ 0132 inline double GetXMax() { return grid_max_x_; } 0133 /** @return The step-size "dx" used to discretize the nuclear profile of a nucleus in x-direction. 0134 */ 0135 inline double GetXStep() { return grid_step_x_; } 0136 /** @return The maximum value of coordinate "y" in the nuclear profile of a nucleus. 0137 */ 0138 inline double GetYMax() { return grid_max_y_; } 0139 /** @return The step-size "dy" used to discretize the nuclear profile of a nucleus in y-direction. 0140 */ 0141 inline double GetYStep() { return grid_step_y_; } 0142 /** @return The maximum value of coordinate "z or eta" in the nuclear profile of a nucleus. 0143 */ 0144 inline double GetZMax() { return grid_max_z_; } 0145 /** @return The step-size "dz" used to discretize the nuclear profile of a nucleus in z or eta direction. 0146 */ 0147 inline double GetZStep() { return grid_step_z_; } 0148 0149 // get number of grids along x, follow trento convention 0150 /** @return The number of grid points in x-direction in the nuclear profile of a nucleus. 0151 */ 0152 inline int GetXSize() { 0153 return int(std::ceil(2 * grid_max_x_ / grid_step_x_)); 0154 } 0155 0156 // get number of grids along y 0157 /** @return The number of grid points in y-direction in the nuclear profile of a nucleus. 0158 */ 0159 inline int GetYSize() { 0160 return int(std::ceil(2 * grid_max_y_ / grid_step_y_)); 0161 } 0162 0163 // get number of grids along z 0164 /** @return The number of grid points in z or eta direction in the nuclear profile of a nucleus. 0165 */ 0166 inline int GetZSize() { 0167 int nz = 1; 0168 if (grid_step_z_ != 0) { 0169 nz = int(std::ceil(2 * grid_max_z_ / grid_step_z_)); 0170 // for 2d case, user may set grid_max_z_ = 0, 0171 if (nz == 0) 0172 nz = 1; 0173 } 0174 return nz; 0175 } 0176 0177 protected: 0178 // initial state entropy density distribution for the given grids 0179 // stored order: for z { for y {for x } } 0180 /** It stores the initial state entropy density distribution. The index of the vector is associated to a cell with coordinate (x, y, z or eta). 0181 @sa Function CoordFromIdx(int idx) for the mapping. 0182 */ 0183 std::vector<double> entropy_density_distribution_; 0184 0185 // one can sample jet production position from Ta * Tb 0186 // where Ta * Tb is the distribution of num_of_binary_collisions 0187 // stored order: for z { for y {for x } } 0188 /** It represents the un-normalized probability density of binary collisions. The index of the vector is associated to a cell with coordinate (x, y, z or eta). 0189 @sa Function CoordFromIdx(int idx) for the mapping. 0190 */ 0191 std::vector<double> num_of_binary_collisions_; 0192 // the above should be private. Only Adding getters for now to not break other people's code 0193 0194 /** @return The initial state entropy density distribution. 0195 @sa Function CoordFromIdx(int idx) for mapping of the index of the vector entropy_density_distribution_ to the fluid cell at location (x, y, z or eta). 0196 */ 0197 //inline std::vector<double> GetEntropyDensityDistribution() {return entropy_density_distribution_;}; 0198 0199 // one can sample jet production position from Ta * Tb 0200 // where Ta * Tb is the distribution of num_of_binary_collisions 0201 /** @return The un-normalized probability density of binary collisions. 0202 @sa Function CoordFromIdx(int idx) for mapping of the index of the vector num_of_binary_collisions_ to the fluid cell at location (x, y, z or eta). 0203 */ 0204 //inline std::vector<double> GetNumOfBinaryCollisions() {return num_of_binary_collisions_;}; 0205 0206 // compute 3d coordinates (x, y, z) given the 1D index in vector 0207 /** @return Grid point (x,y,z or eta). 0208 @param idx is an integer which maps to an unique unit cell in the coordinate space (x,y,z or eta). 0209 */ 0210 //std::tuple<double, double, double> CoordFromIdx(int idx); 0211 0212 int event_id_; 0213 //int GetEventId() const {return(event_id_);} 0214 //void SetEventId(int event_id_in) {event_id_ = event_id_in;} 0215 0216 // default assumption: x range = [-grid_max_x_, grid_max_x_] 0217 // default assumption: y range = [-grid_max_y_, grid_max_y_] 0218 // default assumption: z range = [-grid_max_z_, grid_max_z_] 0219 double grid_max_x_; 0220 double grid_max_y_; 0221 double grid_max_z_; // z can represent spatial rapidity 0222 0223 // one problem: different hydro codes require different dx_i / dtau 0224 // matches between (dx_i/dtau, hydro_code) should be checked 0225 double grid_step_x_; 0226 double grid_step_y_; 0227 double grid_step_z_; 0228 }; 0229 0230 } // end namespace Jetscape 0231 0232 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |