Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:02

0001 #ifndef THERMPTNSAMPLER_H
0002 #define THERMPTNSAMPLER_H
0003 
0004 #include "JetScapeLogger.h"
0005 #include <vector>
0006 #include <random>
0007 
0008 
0009 using namespace Jetscape;
0010 
0011 class ThermalPartonSampler
0012 {
0013  public:
0014     //constructor - initializes variables and random number generator

0015     ThermalPartonSampler(unsigned int ran_seed);
0016 
0017     //sampler - samples thermal partons (u,d,s) from brick or 2+1d / 3+1d hydro

0018     void samplebrick();
0019     void sample_2p1d(double eta_max);
0020     void sample_3p1d(bool Cartesian_hydro=false);
0021 
0022     //to load a hypersurface

0023     void set_hypersurface(std::vector<std::vector<double>> surf_in){surface = surf_in;}
0024 
0025     //setters for params

0026     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

0027     void brick_flow(double vx_in, double vy_in, double vz_in){Vx = vx_in; Vy = vy_in; Vz = vz_in;}
0028     void brick_Tc(double brick_Tc){T = brick_Tc/GEVFM;}
0029 
0030     //getters for thermal partons

0031     int nTot(         ){return Plist.size();}
0032     int th_Evnum(int i){return (int)Plist[i][0];}
0033     int th_pid(  int i){return (int)Plist[i][1];}
0034     int th_orig( int i){return (int)Plist[i][2];}
0035     int th_stat( int i){return (int)Plist[i][11];}
0036     double th_px(int i){return      Plist[i][3];}
0037     double th_py(int i){return      Plist[i][4];}
0038     double th_pz(int i){return      Plist[i][5];}
0039     double th_e( int i){return      Plist[i][6];}
0040     double th_x( int i){return      Plist[i][7];}
0041     double th_y( int i){return      Plist[i][8];}
0042     double th_z( int i){return      Plist[i][9];}
0043     double th_t( int i){return      Plist[i][10];}
0044     int th_nL(){return num_ud;}
0045     int th_nS(){return num_s;}
0046 
0047 
0048  private:
0049 
0050     //thermal parton list

0051     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 )

0052                                             // Same format as in shower data, event number is always 1, origin is always 0, particle status is always 0 (indicates a thermal quark)

0053 
0054     // Functions

0055     bool SplitSort (double goal, int floor, int ceiling, int quark);
0056     void MCSampler(double Temp, int quark);                 //Samples momentum distribution, redefines NewP, NewX, NewY, NewZ variables - momentum in rest frame

0057     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

0058     void CDFGenerator(double Temp, double M, int quark);                //generates cumulative distribution in thermal rest frame "quark" is 1 for light and 2 for strange

0059 
0060     // random number handling

0061     std::mt19937_64 rng_engine; //RNG - Mersenne Twist - 64 bit

0062     std::uniform_real_distribution<double> distribution{0.0, 1.0}; // Uniform distribution between 0 and 1

0063     // Function to generate a random number between 0 and 1

0064     double ran() {return distribution(rng_engine);}
0065     // Function to get the random number generator

0066     std::mt19937_64& getRandomGenerator() {return rng_engine;}
0067 
0068     // Static parameters, do not change

0069     const double PI = 3.141592653589793;
0070     double muPi0 = 0.;
0071     const double GEVFM = 0.197327053;
0072 
0073     // Adjustable parameters

0074     double xmq, xms, T, NUMSTEP;
0075     double CellDX, CellDY, CellDZ, CellDT;
0076 
0077     // Gaussian weights and abscissa (50 pt)

0078     // Used in numeric integration

0079     int GPoints = 50;       // Amount of Gaussian points for quadrature

0080     double GWeight[50];     // Gaussian weights for integration

0081     double GAbs[50];        // Gaussian abscissas for integration

0082 
0083     // Flags

0084     bool SetNum, SetNumLight, SetNumStrange, ShuffleList;
0085 
0086     // Global vars between functions

0087     double NewX, NewY, NewZ, NewP;
0088     int num_ud, num_s;
0089     std::vector<std::vector<double>> CDFTabLight;   // Cumulative distribution for thermal light quarks

0090     std::vector<std::vector<double>> CDFTabStrange; // Cumulative distribution for s quarks

0091 
0092     // Brick info

0093     //L is the length of the brick sampled for thermal partons

0094     //W is the width of the face of the brick - should be scaled somewhat against L

0095     //Vx,Vy,Vz is a flow given to the brick

0096     double L, W, Time, Vx, Vy, Vz;
0097 
0098     // HyperSurface

0099     std::vector<std::vector<double>> surface;
0100 };
0101 
0102 
0103 #endif // THERMPTNSAMPLER_H