Version: SMASH-1.5
processstring.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2017-
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_PROCESSSTRING_H_
11 #define SRC_INCLUDE_PROCESSSTRING_H_
12 
13 #include <memory>
14 #include <string>
15 #include <utility>
16 #include <vector>
17 
18 #include "Pythia8/Pythia.h"
19 
20 #include "constants.h"
21 #include "logging.h"
22 #include "particledata.h"
23 
24 namespace smash {
25 
26 // \todo Sangwook: make file (processstring) and class (StringProcess) name
27 // consistent
28 
47  private:
48  // The following 4 variables are in the center of mass frame
50  double PPosA_;
52  double PPosB_;
54  double PNegA_;
56  double PNegB_;
58  double massA_;
60  double massB_;
62  double sqrtsAB_;
64  std::array<PdgCode, 2> PDGcodes_;
66  std::array<FourVector, 2> plab_;
68  std::array<FourVector, 2> pcom_;
77  std::array<ThreeVector, 3> evecBasisAB_;
81  std::array<int, 2> NpartString_;
104  double sigma_qperp_;
119  double soft_t_form_;
130  double sqrt2_;
131 
134 
139  ParticleList final_state_;
140 
142  std::unique_ptr<Pythia8::Pythia> pythia_parton_;
143 
145  std::unique_ptr<Pythia8::Pythia> pythia_hadron_;
146 
148  Pythia8::SigmaTotal pythia_sigmatot_;
149 
154  Pythia8::Event event_intermediate_;
155 
156  public:
157  // clang-format off
158 
195  StringProcess(double string_tension, double time_formation,
196  double gluon_beta, double gluon_pmin,
197  double quark_alpha, double quark_beta,
198  double strange_supp, double diquark_supp,
199  double sigma_perp, double leading_frag_mean,
200  double leading_frag_width, double stringz_a,
201  double stringz_b, double string_sigma_T,
202  double factor_t_form, bool use_yoyo_model,
203  double prob_proton_to_d_uu);
204 
222  void common_setup_pythia(Pythia8::Pythia *pythia_in, double strange_supp,
223  double diquark_supp, double stringz_a,
224  double stringz_b, double string_sigma_T);
225 
233  const auto &log = logger<LogArea::Pythia>();
234  const int seed_new =
236 
237  pythia_hadron_->rndm.init(seed_new);
238  log.debug("pythia_hadron_ : rndm is initialized with seed ", seed_new);
239  }
240 
241  // clang-format on
242 
247  Pythia8::Pythia *get_ptr_pythia_parton() { return pythia_parton_.get(); }
248 
258  std::array<double, 3> cross_sections_diffractive(int pdg_a, int pdg_b,
259  double sqrt_s) {
260  // This threshold magic is following Pythia. Todo(ryu): take care of this.
261  double sqrts_threshold = 2. * (1. + 1.0e-6);
262  /* In the case of mesons, the corresponding vector meson masses
263  * are used to evaluate the energy threshold. */
264  const int pdg_a_mod =
265  (std::abs(pdg_a) > 1000) ? pdg_a : 10 * (std::abs(pdg_a) / 10) + 3;
266  const int pdg_b_mod =
267  (std::abs(pdg_b) > 1000) ? pdg_b : 10 * (std::abs(pdg_b) / 10) + 3;
268  sqrts_threshold += pythia_hadron_->particleData.m0(pdg_a_mod) +
269  pythia_hadron_->particleData.m0(pdg_b_mod);
270  /* Constant cross-section for sub-processes below threshold equal to
271  * cross-section at the threshold. */
272  if (sqrt_s < sqrts_threshold) {
273  sqrt_s = sqrts_threshold;
274  }
275  pythia_sigmatot_.calc(pdg_a, pdg_b, sqrt_s);
276  return {pythia_sigmatot_.sigmaAX(), pythia_sigmatot_.sigmaXB(),
277  pythia_sigmatot_.sigmaXX()};
278  }
279 
294  void set_pmin_gluon_lightcone(double p_light_cone_min) {
295  pmin_gluon_lightcone_ = p_light_cone_min;
296  }
304  void set_pow_fgluon(double betapow) { pow_fgluon_beta_ = betapow; }
313  void set_pow_fquark(double alphapow, double betapow) {
314  pow_fquark_alpha_ = alphapow;
315  pow_fquark_beta_ = betapow;
316  }
321  void set_sigma_qperp_(double sigma_qperp) { sigma_qperp_ = sigma_qperp; }
326  void set_tension_string(double kappa_string) {
327  kappa_tension_string_ = kappa_string;
328  }
329 
330  // clang-format off
331 
339  void init(const ParticleList &incoming, double tcoll);
348  static void make_orthonormal_basis(ThreeVector &evec_polar,
349  std::array<ThreeVector, 3> &evec_basis);
365  const std::array<std::array<int, 2>, 2> &quarks,
366  const std::array<FourVector, 2> &pstr_com,
367  std::array<double, 2> &m_str,
368  std::array<ThreeVector, 2> &evec_str);
381  const std::array<std::array<int, 2>, 2> &quarks,
382  const std::array<FourVector, 2> &pstr_com,
383  const std::array<double, 2> &m_str,
384  const std::array<ThreeVector, 2> &evec_str,
385  bool flip_string_ends, bool separate_fragment_baryon);
386 
395  bool next_SDiff(bool is_AB_to_AX);
406  bool next_DDiff();
420  bool next_NDiffSoft();
426  bool next_NDiffHard();
437  bool next_BBbarAnn();
438 
454  static void find_excess_constituent(PdgCode &pdg_actual, PdgCode &pdg_mapped,
455  std::array<int, 5> &excess_quark,
456  std::array<int, 5> &excess_antiq);
478  void replace_constituent(Pythia8::Particle &particle,
479  std::array<int, 5> &excess_constituent);
480 
494  void find_total_number_constituent(Pythia8::Event &event_intermediate,
495  std::array<int, 5> &nquark_total,
496  std::array<int, 5> &nantiq_total);
497 
523  bool splitting_gluon_qqbar(Pythia8::Event &event_intermediate,
524  std::array<int, 5> &nquark_total, std::array<int, 5> &nantiq_total,
525  bool sign_constituent,
526  std::array<std::array<int, 5>, 2> &excess_constituent);
527 
555  void rearrange_excess(std::array<int, 5> &nquark_total,
556  std::array<std::array<int, 5>, 2> &excess_quark,
557  std::array<std::array<int, 5>, 2> &excess_antiq);
558 
596  bool restore_constituent(Pythia8::Event &event_intermediate,
597  std::array<std::array<int, 5>, 2> &excess_quark,
598  std::array<std::array<int, 5>, 2> &excess_antiq);
599 
624  void compose_string_parton(bool find_forward_string,
625  Pythia8::Event &event_intermediate,
626  Pythia8::Event &event_hadronize);
658  void compose_string_junction(bool &find_forward_string,
659  Pythia8::Event &event_intermediate,
660  Pythia8::Event &event_hadronize);
661 
683  void find_junction_leg(bool sign_color, std::vector<int> &col,
684  Pythia8::Event &event_intermediate,
685  Pythia8::Event &event_hadronize);
686 
703  int get_index_forward(bool find_forward, int np_end,
704  Pythia8::Event &event) {
705  int iforward = 1;
706  for (int ip = 2; ip < event.size() - np_end; ip++) {
707  const double y_quark_current = event[ip].y();
708  const double y_quark_forward = event[iforward].y();
709  if ((find_forward && y_quark_current > y_quark_forward) ||
710  (!find_forward && y_quark_current < y_quark_forward)) {
711  iforward = ip;
712  }
713  }
714  return iforward;
715  }
716 
722  ParticleList get_final_state() { return final_state_; }
723 
736  int append_final_state(ParticleList &intermediate_particles,
737  const FourVector &uString,
738  const ThreeVector &evecLong);
739 
748  static bool append_intermediate_list(int pdgid, FourVector momentum,
749  ParticleList &intermediate_particles) {
750  const std::string s = std::to_string(pdgid);
751  PdgCode pythia_code(s);
752  ParticleData new_particle(ParticleType::find(pythia_code));
753  new_particle.set_4momentum(momentum);
754  intermediate_particles.push_back(new_particle);
755  return true;
756  }
757 
762  static void convert_KaonLS(int &pythia_id) {
763  if (pythia_id == 310 || pythia_id == 130) {
764  pythia_id = (random::uniform_int(0, 1) == 0) ? 311 : -311;
765  }
766  }
767 
775  static void quarks_from_diquark(int diquark, int &q1, int &q2, int &deg_spin);
776 
783  static int diquark_from_quarks(int q1, int q2);
784 
792  static void make_string_ends(const PdgCode &pdgcode_in, int &idq1, int &idq2, double xi);
793 
800  static Pythia8::Vec4 set_Vec4(double energy, const ThreeVector &mom) {
801  return Pythia8::Vec4(mom.x1(), mom.x2(), mom.x3(), energy);
802  }
803 
815  static FourVector reorient(Pythia8::Particle &particle,
816  std::array<ThreeVector, 3> &evec_basis) {
817  ThreeVector three_momentum = evec_basis[0] * particle.pz() +
818  evec_basis[1] * particle.px() +
819  evec_basis[2] * particle.py();
820  return FourVector(particle.e(), three_momentum);
821  }
822 
840  int fragment_string(int idq1, int idq2, double mString,
841  ThreeVector &evecLong, bool flip_string_ends,
842  bool separate_fragment_baryon,
843  ParticleList &intermediate_particles);
844 
860  static void assign_all_scaling_factors(int baryon_string,
861  ParticleList& outgoing_particles,
862  const ThreeVector &evecLong,
863  double suppression_factor);
864 
879  static std::pair<int, int> find_leading(int nq1, int nq2, ParticleList& list);
880 
893  static void assign_scaling_factor(int nquark, ParticleData& data,
894  double suppression_factor);
895 
913  static int pdg_map_for_pythia(PdgCode &pdg);
914 
915  // clang-format on
916 };
917 
918 } // namespace smash
919 
920 #endif // SRC_INCLUDE_PROCESSSTRING_H_
double additional_xsec_supp_
additional cross-section suppression factor to take coherence effect into account.
std::array< int, 2 > NpartString_
number of particles fragmented from strings
Definition: processstring.h:81
bool next_NDiffSoft()
Soft Non-diffractive process is modelled in accordance with dual-topological approach Capella:1978ig...
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:30
double PPosA_
forward lightcone momentum p^{+} of incoming particle A in CM-frame [GeV]
Definition: processstring.h:50
static FourVector reorient(Pythia8::Particle &particle, std::array< ThreeVector, 3 > &evec_basis)
compute the four-momentum properly oriented in the lab frame.
double x3() const
Definition: threevector.h:163
static Pythia8::Vec4 set_Vec4(double energy, const ThreeVector &mom)
Easy setter of Pythia Vec4 from SMASH.
double pmin_gluon_lightcone_
the minimum lightcone momentum scale carried by a gluon [GeV]
Definition: processstring.h:83
String excitation processes used in SMASH.
Definition: processstring.h:46
bool make_final_state_2strings(const std::array< std::array< int, 2 >, 2 > &quarks, const std::array< FourVector, 2 > &pstr_com, const std::array< double, 2 > &m_str, const std::array< ThreeVector, 2 > &evec_str, bool flip_string_ends, bool separate_fragment_baryon)
Prepare kinematics of two strings, fragment them and append to final_state.
void set_pmin_gluon_lightcone(double p_light_cone_min)
set the minimum lightcone momentum scale carried by gluon.
void set_sigma_qperp_(double sigma_qperp)
set the average amount of transverse momentum transfer sigma_qperp_.
int NpartFinal_
total number of final state particles
Definition: processstring.h:79
static void make_string_ends(const PdgCode &pdgcode_in, int &idq1, int &idq2, double xi)
make a random selection to determine partonic contents at the string ends.
int fragment_string(int idq1, int idq2, double mString, ThreeVector &evecLong, bool flip_string_ends, bool separate_fragment_baryon, ParticleList &intermediate_particles)
perform string fragmentation to determine species and momenta of hadrons by implementing PYTHIA 8...
Collection of useful constants that are known at compile time.
void replace_constituent(Pythia8::Particle &particle, std::array< int, 5 > &excess_constituent)
Convert a partonic PYTHIA partice into the desired species and update the excess of constituents...
std::unique_ptr< Pythia8::Pythia > pythia_hadron_
PYTHIA object used in fragmentation.
std::array< FourVector, 2 > plab_
momenta of incoming particles in the lab frame [GeV]
Definition: processstring.h:66
int append_final_state(ParticleList &intermediate_particles, const FourVector &uString, const ThreeVector &evecLong)
compute the formation time and fill the arrays with final-state particles as described in Andersson:1...
void common_setup_pythia(Pythia8::Pythia *pythia_in, double strange_supp, double diquark_supp, double stringz_a, double stringz_b, double string_sigma_T)
Common setup of PYTHIA objects for soft and hard string routines.
static int pdg_map_for_pythia(PdgCode &pdg)
Take pdg code and map onto particle specie which can be handled by PYTHIA.
double x1() const
Definition: threevector.h:155
std::array< PdgCode, 2 > PDGcodes_
PdgCodes of incoming particles.
Definition: processstring.h:64
void find_total_number_constituent(Pythia8::Event &event_intermediate, std::array< int, 5 > &nquark_total, std::array< int, 5 > &nantiq_total)
Compute how many quarks and antiquarks we have in the system, and update the correspoing arrays with ...
double prob_proton_to_d_uu_
Probability of splitting a nucleon into the quark flavour it has only once and a diquark it has twice...
Pythia8::SigmaTotal pythia_sigmatot_
An object to compute cross-sections.
double PNegB_
backward lightcone momentum p^{-} of incoming particle B in CM-frame [GeV]
Definition: processstring.h:56
std::array< FourVector, 2 > pcom_
momenta of incoming particles in the center of mass frame [GeV]
Definition: processstring.h:68
std::unique_ptr< Pythia8::Pythia > pythia_parton_
PYTHIA object used in hard string routine.
double sqrtsAB_
sqrt of Mandelstam variable s of collision [GeV]
Definition: processstring.h:62
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
void rearrange_excess(std::array< int, 5 > &nquark_total, std::array< std::array< int, 5 >, 2 > &excess_quark, std::array< std::array< int, 5 >, 2 > &excess_antiq)
Take total number of quarks and check if the system has enough constitents that need to be converted ...
std::array< double, 3 > cross_sections_diffractive(int pdg_a, int pdg_b, double sqrt_s)
Interface to pythia_sigmatot_ to compute cross-sections of A+B-> different final states Schuler:1993w...
static void quarks_from_diquark(int diquark, int &q1, int &q2, int &deg_spin)
find two quarks from a diquark.
static bool append_intermediate_list(int pdgid, FourVector momentum, ParticleList &intermediate_particles)
append new particle from PYTHIA to a specific particle list
void init(const ParticleList &incoming, double tcoll)
initialization feed intial particles, time of collision and gamma factor of the center of mass...
static int diquark_from_quarks(int q1, int q2)
Construct diquark from two quarks.
static void make_orthonormal_basis(ThreeVector &evec_polar, std::array< ThreeVector, 3 > &evec_basis)
compute three orthonormal basis vectors from unit vector in the longitudinal direction ...
T uniform_int(T min, T max)
Definition: random.h:97
Pythia8::Event event_intermediate_
event record for intermediate partonic state in the hard string routine
double kappa_tension_string_
string tension [GeV/fm]
double pow_fquark_alpha_
parameter for the quark distribution function
Definition: processstring.h:93
static void assign_all_scaling_factors(int baryon_string, ParticleList &outgoing_particles, const ThreeVector &evecLong, double suppression_factor)
Assign a cross section scaling factor to all outgoing particles.
void compute_incoming_lightcone_momenta()
compute the lightcone momenta of incoming particles where the longitudinal direction is set to be sam...
bool next_SDiff(bool is_AB_to_AX)
Single-diffractive process is based on single pomeron exchange described in Ingelman:1984ns.
bool use_yoyo_model_
Whether to calculate the string formation times from the yoyo-model.
static void assign_scaling_factor(int nquark, ParticleData &data, double suppression_factor)
Assign a cross section scaling factor to the given particle.
void compose_string_parton(bool find_forward_string, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify a set of partons, which are connected to form a color-neutral string, from a given PYTHIA ev...
bool next_DDiff()
Double-diffractive process ( A + B -> X + X ) is similar to the single-diffractive process...
void set_4momentum(const FourVector &momentum_vector)
Set the particle&#39;s 4-momentum directly.
Definition: particledata.h:145
ThreeVector vcomAB_
velocity three vector of the center of mass in the lab frame
Definition: processstring.h:72
ParticleList final_state_
final state array which must be accessed after the collision
bool pythia_parton_initialized_
Remembers if Pythia is initialized or not.
static std::pair< int, int > find_leading(int nq1, int nq2, ParticleList &list)
Find the leading string fragments.
double leading_frag_mean_
mean value of the fragmentation function for the leading baryons
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
Definition: pdgcode.h:108
double PNegA_
backward lightcone momentum p^{-} of incoming particle A in CM-frame [GeV]
Definition: processstring.h:54
double PPosB_
forward lightcone momentum p^{+} of incoming particle B in CM-frame [GeV]
Definition: processstring.h:52
static void convert_KaonLS(int &pythia_id)
convert Kaon-L or Kaon-S into K0 or Anti-K0
void find_junction_leg(bool sign_color, std::vector< int > &col, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify partons, which are associated with junction legs, from a given PYTHIA event record...
Pythia8::Pythia * get_ptr_pythia_parton()
Function to get the PYTHIA object for hard string routine.
void compose_string_junction(bool &find_forward_string, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify a set of partons and junction(s), which are connected to form a color-neutral string...
FourVector ucomAB_
velocity four vector of the center of mass in the lab frame
Definition: processstring.h:70
double time_collision_
time of collision in the computational frame [fm]
void set_tension_string(double kappa_string)
set the string tension, which is used in append_final_state.
ParticleList get_final_state()
a function to get the final state particle list which is called after the collision ...
bool set_mass_and_direction_2strings(const std::array< std::array< int, 2 >, 2 > &quarks, const std::array< FourVector, 2 > &pstr_com, std::array< double, 2 > &m_str, std::array< ThreeVector, 2 > &evec_str)
Determine string masses and directions in which strings are stretched.
double soft_t_form_
factor to be multiplied to formation times in soft strings
double leading_frag_width_
width of the fragmentation function for the leading baryons
void set_pow_fquark(double alphapow, double betapow)
lightcone momentum fraction of quark is sampled according to probability distribution in non-diffrac...
bool restore_constituent(Pythia8::Event &event_intermediate, std::array< std::array< int, 5 >, 2 > &excess_quark, std::array< std::array< int, 5 >, 2 > &excess_antiq)
Take the intermediate partonic state from PYTHIA event with mapped hadrons and convert constituents i...
StringProcess(double string_tension, double time_formation, double gluon_beta, double gluon_pmin, double quark_alpha, double quark_beta, double strange_supp, double diquark_supp, double sigma_perp, double leading_frag_mean, double leading_frag_width, double stringz_a, double stringz_b, double string_sigma_T, double factor_t_form, bool use_yoyo_model, double prob_proton_to_d_uu)
Constructor, initializes pythia.
double pow_fgluon_beta_
parameter for the gluon distribution function
Definition: processstring.h:88
double sqrt2_
square root of 2 ( )
constexpr int maximum_rndm_seed_in_pythia
The maximum value of the random seed used in PYTHIA.
Definition: constants.h:113
std::array< ThreeVector, 3 > evecBasisAB_
Orthonormal basis vectors in the center of mass frame, where the 0th one is parallel to momentum of i...
Definition: processstring.h:77
void init_pythia_hadron_rndm()
Set PYTHIA random seeds to be desired values.
int get_index_forward(bool find_forward, int np_end, Pythia8::Event &event)
Obtain index of the most forward or backward particle in a given PYTHIA event record.
bool next_BBbarAnn()
Baryon-antibaryon annihilation process Based on what UrQMD Bass:1998ca, Bleicher:1999xi does...
void set_pow_fgluon(double betapow)
lightcone momentum fraction of gluon is sampled according to probability distribution P(x) = 1/x * (1...
double sigma_qperp_
Transverse momentum spread of the excited strings.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:32
static void find_excess_constituent(PdgCode &pdg_actual, PdgCode &pdg_mapped, std::array< int, 5 > &excess_quark, std::array< int, 5 > &excess_antiq)
Compare the valence quark contents of the actual and mapped hadrons and evaluate how many more consti...
bool next_NDiffHard()
Hard Non-diffractive process is based on PYTHIA 8 with partonic showers and interactions.
double massB_
mass of incoming particle B [GeV]
Definition: processstring.h:60
ParticleData contains the dynamic information of a certain particle.
Definition: particledata.h:52
double time_formation_const_
constant proper time in the case of constant formation time [fm]
double massA_
mass of incoming particle A [GeV]
Definition: processstring.h:58
double x2() const
Definition: threevector.h:159
Definition: action.h:24
bool splitting_gluon_qqbar(Pythia8::Event &event_intermediate, std::array< int, 5 > &nquark_total, std::array< int, 5 > &nantiq_total, bool sign_constituent, std::array< std::array< int, 5 >, 2 > &excess_constituent)
Take total number of quarks and check if the system has enough constituents that need to be converted...
double pow_fquark_beta_
parameter for the quark distribution function
Definition: processstring.h:98