PYTHIA  8.317
FlavorVariations.h
1 // FlavorVariations.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2026 Stephen Mrenna, Christian Bierlich, Philip Ilten,
3 // Torbjorn Sjostrand.
4 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
5 // Please respect the MCnet Guidelines, see GUIDELINES for details.
6 
7 #ifndef Pythia8_FlavorVariations_H
8 #define Pythia8_FlavorVariations_H
9 
10 // Include Pythia headers.
11 #include "Pythia8/Pythia.h"
12 
13 namespace Pythia8 {
14 
15 //==========================================================================
16 
17 // Calculate the weight for an event given a different set of flavor
18 // parameters used in the hadronization.
19 
21 
22 public:
23 
24  // Constructor, given an intialized Pythia object.
26  settings.parm("StringFlav:ProbQQtoQ"),
27  settings.parm("StringFlav:ProbStoUD"),
28  settings.parm("StringFlav:ProbSQtoQQ"),
29  settings.parm("StringFlav:ProbQQ1toQQ0")) {}
30 
31  // Constructor, given the default base parameters.
32  FlavorVariations(double xi, double rho, double x, double y) :
33  pythia("", false) {
34  pythia.settings.flag("ProcessLevel:all", false);
35  pythia.settings.flag("Print:quiet", true);
36  pythia.settings.flag("VariationFrag:flav", true);
37  pythia.settings.parm("StringFlav:ProbQQtoQ", xi);
38  pythia.settings.parm("StringFlav:ProbStoUD", rho);
39  pythia.settings.parm("StringFlav:ProbSQtoQQ", x);
40  pythia.settings.parm("StringFlav:ProbQQ1toQQ0", y);
41  pythia.settings.addMVec(key, vector<int>(14, 0), false, false, 0, 0);
42  pythia.init();
43  }
44 
45  // Write string break counts.
46  string write(const vector<int>& breaks) {
47  string out = "{";
48  for (const int& val : breaks) out += toString(val) + ",";
49  return out.substr(0, out.length() - 1) + "}";}
50 
51  // Calculate the derived parameters.
52  vector<double> parms(double xi, double rho, double x, double y) {
53  return pythia.info.weightContainerPtr
54  ->weightsFragmentation.flavParms(xi, rho, x, y);}
55 
56  // Calculate the weight.
57  double weight(const vector<double>& parms, const vector<int>& breaks) {
58  return pythia.info.weightContainerPtr
59  ->weightsFragmentation.flavWeight(parms, breaks);}
60 
61 private:
62 
63  // Pythia object.
64  Pythia pythia;
65 
66  // Key to serialize the string breaks.
67  string key{"VariationFrag:flavBreaks"};
68 
69 };
70 
71 //==========================================================================
72 
73 } // end namespace Pythia8
74 
75 #endif // end Pythia8_FlavorVariations_H
FlavorVariations(double xi, double rho, double x, double y)
Constructor, given the default base parameters.
Definition: FlavorVariations.h:32
double flavWeight(const vector< double > &parms)
Calculate a flavour weight.
Definition: Weights.h:397
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1615
WeightsFragmentation weightsFragmentation
Fragmentation weights.
Definition: Weights.h:495
Settings settings
Settings: databases of flags/modes/parms/words to control run.
Definition: Pythia.h:386
bool init()
Initialize.
Definition: Pythia.cc:422
string toString(bool val)
Convert a boolean to a string.
Definition: PythiaStdlib.h:210
string write(const vector< int > &breaks)
Write string break counts.
Definition: FlavorVariations.h:46
Definition: FlavorVariations.h:20
double weight(const vector< double > &parms, const vector< int > &breaks)
Calculate the weight.
Definition: FlavorVariations.h:57
FlavorVariations(Settings &settings)
Constructor, given an intialized Pythia object.
Definition: FlavorVariations.h:25
vector< double > flavParms(double xi, double rho, double x, double y)
Calculate the derived flavour parameters.
Definition: Weights.cc:872
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The Pythia class contains the top-level routines to generate an event.
Definition: Pythia.h:72
const Info & info
Public information and statistic on the generation.
Definition: Pythia.h:380
vector< double > parms(double xi, double rho, double x, double y)
Calculate the derived parameters.
Definition: FlavorVariations.h:52
Definition: Settings.h:196