Skip to content

Commit

Permalink
Fix rapidities in pythia from JETSCAPE 3.6 #160
Browse files Browse the repository at this point in the history
Fix rapidities in pythia IS modules and make
constants consistent #160
  • Loading branch information
latessa committed Oct 10, 2023
1 parent 051ad59 commit d46f3d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/framework/JetScapeConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) The JETSCAPE Collaboration, 2018
*
* Modular, task-based framework for simulating all aspects of heavy-ion collisions
*
*
* For the list of contributors see AUTHORS.
*
* Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
Expand Down Expand Up @@ -34,11 +34,10 @@ static double Nc = 3.0;
static double Lambda_QCD = 0.2;
// 0.4 is the value chosen in JETSET

static double fmToGeVinv = 5.0;
/// < should be 1/0.197, but 5 helps in debugging.

static const double hbarC = 0.197327053;

static const double fmToGeVinv = 1.0 / hbarC;

static double zeta3 = 1.20206;

static double mu = 0.722;
Expand Down
13 changes: 10 additions & 3 deletions src/initialstate/PGun.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PGun::ExecuteTask() {

double p[4], xLoc[4];

double pT, rapidity, phi;
double pT, rapidity, phi, pseudorapidity;
double eta_cut = 1.0;
double tempRand;
const double maxN = 1.0 * RAND_MAX;
Expand Down Expand Up @@ -91,6 +91,13 @@ void PGun::ExecuteTask() {
p[3] = sqrt(pT * pT + mass * mass) * sinh(rapidity);
p[0] = sqrt(pT * pT + mass * mass) * cosh(rapidity);

double p_abs = std::sqrt(pT*pT + p[3]*p[3]);
if(std::abs(p_abs - p[3]) > rounding_error){
pseudorapidity = 0.5 * std::log((p_abs + p[3]) / (p_abs - p[3]));
} else {
JSWARN << "Particle in PGun has infinite pseudorapidity.";
}

// Roll for a starting point
// See: https://stackoverflow.com/questions/15039688/random-generator-from-vector-with-probability-distribution-in-c
for (int i = 0; i <= 3; i++) {
Expand All @@ -115,9 +122,9 @@ void PGun::ExecuteTask() {
xLoc[3] = 0.0;

if (flag_useHybridHad != 1) {
AddParton(make_shared<Parton>(0, parID, 0, pT, rapidity, phi, p[0], xLoc));
AddParton(make_shared<Parton>(0, parID, 0, pT, pseudorapidity, phi, p[0], xLoc));
} else {
auto ptn = make_shared<Parton>(0, parID, 0, pT, rapidity, phi, p[0], xLoc);
auto ptn = make_shared<Parton>(0, parID, 0, pT, pseudorapidity, phi, p[0], xLoc);
ptn->set_color((parID > 0) ? 100 : 0);
ptn->set_anti_color(((parID > 0) || (parID == 21)) ? 0 : 101);
ptn->set_max_color(102);
Expand Down
13 changes: 7 additions & 6 deletions src/initialstate/PythiaGun.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ void PythiaGun::ExecuteTask() {
if (!printer.empty()){
std::ofstream sigma_printer;
sigma_printer.open(printer, std::ios::out | std::ios::app);

sigma_printer << "sigma = " << GetSigmaGen() << " Err = " << GetSigmaErr() << endl ;
//sigma_printer.close();

// JSINFO << BOLDYELLOW << " sigma = " << GetSigmaGen() << " sigma err = " << GetSigmaErr() << " printer = " << printer << " is " << sigma_printer.is_open() ;
};

Expand Down Expand Up @@ -275,12 +275,13 @@ void PythiaGun::ExecuteTask() {
// {
if (flag_useHybridHad != 1) {
AddParton(make_shared<Parton>(0, particle.id(), 0, particle.pT(),
particle.y(), particle.phi(), particle.e(),
xLoc));
particle.eta(), particle.phi(),
particle.e(), xLoc));
} else {
auto ptn =
make_shared<Parton>(0, particle.id(), 0, particle.pT(), particle.y(),
particle.phi(), particle.e(), xLoc);
make_shared<Parton>(0, particle.id(), 0, particle.pT(),
particle.eta(),particle.phi(),
particle.e(), xLoc);
ptn->set_color(particle.col());
ptn->set_anti_color(particle.acol());
ptn->set_max_color(1000 * (np + 1));
Expand Down

0 comments on commit d46f3d3

Please sign in to comment.