PYTHIA  8.313
FlavorVariations.h
1 // FlavorVariations.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2025 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  // Read and write string break counts.
46  vector<int> read(string breaks) {
47  pythia.settings.readString(key + " = " + breaks);
48  return pythia.settings.mvec(key);}
49  string write(const vector<int>& breaks) {
50  string out = "{";
51  for (const int& val : breaks) out += toString(val) + ",";
52  return out.substr(0, out.length() - 1) + "}";}
53 
54  // Calculate the derived parameters.
55  vector<double> parms(double xi, double rho, double x, double y) {
56  return pythia.info.weightContainerPtr
57  ->weightsFragmentation.flavParms(xi, rho, x, y);}
58 
59  // Calculate the weight.
60  double weight(const vector<double>& parms, const vector<int>& breaks) {
61  return pythia.info.weightContainerPtr
62  ->weightsFragmentation.flavWeight(parms, breaks);}
63 
64 private:
65 
66  // Pythia object.
67  Pythia pythia;
68 
69  // Key to serialize the string breaks.
70  string key{"VariationFrag:breaks"};
71 
72 };
73 
74 //==========================================================================
75 
76 } // end namespace Pythia8
77 
78 #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 flavor weight.
Definition: Weights.h:390
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1599
vector< int > read(string breaks)
Read and write string break counts.
Definition: FlavorVariations.h:46
WeightsFragmentation weightsFragmentation
Fragmentation weights.
Definition: Weights.h:460
Settings settings
Settings: databases of flags/modes/parms/words to control run.
Definition: Pythia.h:374
bool init()
Initialize.
Definition: Pythia.cc:402
bool readString(string line, bool warn=true, int subrun=SUBRUNDEFAULT)
Read in one update from a single line.
Definition: Settings.cc:384
string toString(bool val)
Convert a boolean to a string.
Definition: PythiaStdlib.h:217
Definition: FlavorVariations.h:20
double weight(const vector< double > &parms, const vector< int > &breaks)
Calculate the weight.
Definition: FlavorVariations.h:60
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 flavor parameters.
Definition: Weights.cc:849
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:71
const Info & info
Public information and statistic on the generation.
Definition: Pythia.h:368
vector< double > parms(double xi, double rho, double x, double y)
Calculate the derived parameters.
Definition: FlavorVariations.h:55
Definition: Settings.h:196