Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ThermPtnSampler.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ThermPtnSampler.h
1 #ifndef THERMPTNSAMPLER_H
2 #define THERMPTNSAMPLER_H
3 
4 #include "JetScapeLogger.h"
5 #include <vector>
6 #include <random>
7 
8 
9 using namespace Jetscape;
10 
12 {
13  public:
14  //constructor - initializes variables and random number generator
15  ThermalPartonSampler(unsigned int ran_seed);
16 
17  //sampler - samples thermal partons (u,d,s) from brick or 2+1d / 3+1d hydro
18  void samplebrick();
19  void sample_2p1d(double eta_max);
20  void sample_3p1d(bool Cartesian_hydro=false);
21 
22  //to load a hypersurface
23  void set_hypersurface(std::vector<std::vector<double>> surf_in){surface = surf_in;}
24 
25  //setters for params
26  void brick_length_width(double len_bri, double wid_bri){L = 2.*len_bri + 4.; W = 2.*wid_bri + 4.; Time = len_bri;} // +4 gives 2fm additional brick in each direction
27  void brick_flow(double vx_in, double vy_in, double vz_in){Vx = vx_in; Vy = vy_in; Vz = vz_in;}
28  void brick_Tc(double brick_Tc){T = brick_Tc/GEVFM;}
29 
30  //getters for thermal partons
31  int nTot( ){return Plist.size();}
32  int th_Evnum(int i){return (int)Plist[i][0];}
33  int th_pid( int i){return (int)Plist[i][1];}
34  int th_orig( int i){return (int)Plist[i][2];}
35  int th_stat( int i){return (int)Plist[i][11];}
36  double th_px(int i){return Plist[i][3];}
37  double th_py(int i){return Plist[i][4];}
38  double th_pz(int i){return Plist[i][5];}
39  double th_e( int i){return Plist[i][6];}
40  double th_x( int i){return Plist[i][7];}
41  double th_y( int i){return Plist[i][8];}
42  double th_z( int i){return Plist[i][9];}
43  double th_t( int i){return Plist[i][10];}
44  int th_nL(){return num_ud;}
45  int th_nS(){return num_s;}
46 
47 
48  private:
49 
50  //thermal parton list
51  std::vector<std::vector<double>> Plist; // List of particles ( [0]->event number; [1]->particle ID; [2]->origin; [3-6]->Px,Py,Pz,E; [7-10]->x,y,z,t; [11]->Particle Status )
52  // Same format as in shower data, event number is always 1, origin is always 0, particle status is always 0 (indicates a thermal quark)
53 
54  // Functions
55  bool SplitSort (double goal, int floor, int ceiling, int quark);
56  void MCSampler(double Temp, int quark); //Samples momentum distribution, redefines NewP, NewX, NewY, NewZ variables - momentum in rest frame
57  double FermiPDF (double Pc, double Mc, double Tc, double muc); //Gives form of Fermi-Dirac distribution (no normalization factors!). Mu is currently given by 0 everywhere
58  void CDFGenerator(double Temp, double M, int quark); //generates cumulative distribution in thermal rest frame "quark" is 1 for light and 2 for strange
59 
60  // random number handling
61  std::mt19937_64 rng_engine; //RNG - Mersenne Twist - 64 bit
62  std::uniform_real_distribution<double> distribution{0.0, 1.0}; // Uniform distribution between 0 and 1
63  // Function to generate a random number between 0 and 1
64  double ran() {return distribution(rng_engine);}
65  // Function to get the random number generator
66  std::mt19937_64& getRandomGenerator() {return rng_engine;}
67 
68  // Static parameters, do not change
69  const double PI = 3.141592653589793;
70  double muPi0 = 0.;
71  const double GEVFM = 0.197327053;
72 
73  // Adjustable parameters
74  double xmq, xms, T, NUMSTEP;
75  double CellDX, CellDY, CellDZ, CellDT;
76 
77  // Gaussian weights and abscissa (50 pt)
78  // Used in numeric integration
79  int GPoints = 50; // Amount of Gaussian points for quadrature
80  double GWeight[50]; // Gaussian weights for integration
81  double GAbs[50]; // Gaussian abscissas for integration
82 
83  // Flags
84  bool SetNum, SetNumLight, SetNumStrange, ShuffleList;
85 
86  // Global vars between functions
87  double NewX, NewY, NewZ, NewP;
88  int num_ud, num_s;
89  std::vector<std::vector<double>> CDFTabLight; // Cumulative distribution for thermal light quarks
90  std::vector<std::vector<double>> CDFTabStrange; // Cumulative distribution for s quarks
91 
92  // Brick info
93  //L is the length of the brick sampled for thermal partons
94  //W is the width of the face of the brick - should be scaled somewhat against L
95  //Vx,Vy,Vz is a flow given to the brick
96  double L, W, Time, Vx, Vy, Vz;
97 
98  // HyperSurface
99  std::vector<std::vector<double>> surface;
100 };
101 
102 
103 #endif // THERMPTNSAMPLER_H