PYTHIA  8.312
ExternalMEs.h
1 // ExternalMEs.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 Peter Skands, Stefan Prestel, Philip Ilten, Torbjorn
3 // 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 // This file contains the functionality to interface external matrix
8 // elements for matrix element corrections to parton showers.
9 
10 #ifndef Pythia8_ExternalMEs_H
11 #define Pythia8_ExternalMEs_H
12 
13 // Include Pythia headers.
14 #include "Pythia8/Basics.h"
15 #include "Pythia8/PythiaComplex.h"
16 #include "Pythia8/Event.h"
17 #include "Pythia8/Info.h"
18 #include "Pythia8/ParticleData.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/Settings.h"
21 #include "Pythia8/StandardModel.h"
22 #include "Pythia8/SusyLesHouches.h"
23 
24 namespace Pythia8 {
25 
26 //==========================================================================
27 
28 // Base class for external matrix-element interfaces.
29 
30 class ExternalMEs {
31 
32 public:
33 
34  // Destructor.
35  ExternalMEs() = default;
36  virtual ~ExternalMEs() = default;
37 
38  // Initialisers for pointers.
39  virtual void initPtrs(Info* infoPtrIn);
40 
41  // Initialisers.
42  virtual bool init() {return false;}
43  virtual bool initVincia(Info* /*infoPtrIn*/) {return false;}
44  virtual bool initDire(Info* /*infoPtrIn*/, string /*card*/) {return false;}
45 
46  // Methods to check availability of matrix elements for list of in/out
47  // ID codes, an event (ignoring any event entries before iBeg), or a vector
48  // of particles.
49  virtual bool isAvailable(vector<int> /*idIn*/, vector<int> /*idOut*/) {
50  return false;}
51  virtual bool isAvailable(const Event& /*event*/) {return false;}
52  virtual bool isAvailable(const Event& /*event*/, const int /*iBeg*/) {
53  return false;}
54  virtual bool isAvailable(const vector<Particle>& /*state*/) {return false;}
55 
56  // Calculate the matrix element squared for a particle state or event
57  // (ignoring any event entries before iBeg).
58  virtual double calcME2(const vector<Particle>& /*state*/) {return 0;}
59  virtual double calcME2(const Event& /*event*/, const int /*iBeg*/) {
60  return 0;}
61 
62  // Setters.
63  virtual void setColourMode(int colModeIn) {
64  colMode = colModeIn;}
65  virtual void setHelicityMode(int helModeIn) {
66  helMode = helModeIn;}
67  virtual void setIncludeSymmetryFac(bool doInclIn) {
68  inclSymFac = doInclIn;}
69  virtual void setIncludeHelicityAvgFac(bool doInclIn) {
70  inclHelAvgFac = doInclIn;}
71  virtual void setIncludeColourAvgFac(bool doInclIn) {
72  inclColAvgFac = doInclIn;}
73 
74  // Getters.
75  virtual int colourMode() {return colMode;}
76  virtual int helicityMode() {return helMode;}
77  virtual bool includeSymmetryFac() {return inclSymFac;}
78  virtual bool includeHelicityAvgFac() {return inclHelAvgFac;}
79  virtual bool includeColourAvgFac() {return inclColAvgFac;}
80  virtual map<vector<int>, double> getHelicityAmplitudes() {return me2hel;}
81 
82 protected:
83 
84  // Fill a vector of IDs, from an event, starting from entry i = iBeg.
85  void fillIds(const Event& event, vector<int>& in, vector<int>& out,
86  int iBeg = 3) const;
87  // Fill a vector of momenta, from an event, starting from entry i = iBeg.
88  void fillMoms(const Event& event, vector<Vec4>& p, int iBeg = 3) const;
89  // Fill a vector of colors, from an event, starting from entry i = iBeg.
90  void fillCols(const Event& event, vector<int>& colors, int iBeg = 3) const;
91  // Return the momenta, from an event, starting from entry i = iBeg.
92  vector<vector<double> > fillMoms(const Event& event, int iBeg = 3) const;
93 
94  // Colour mode (0: strict LC, 1: LC, 2: LC sum, 3: FC).
95  int colMode{1};
96 
97  // Saved list of helicity components for last ME evaluated.
98  map<vector<int>, double> me2hel;
99 
100  // Helicity mode (0: explicit helicity sum, 1: implicit helicity sum).
101  int helMode{1};
102 
103  // Symmetry and averaging factors.
104  bool inclSymFac{false}, inclHelAvgFac{false}, inclColAvgFac{false};
105 
106  // Pointers to VINCIA and Pythia 8 objects.
108  Logger* loggerPtr{};
109  CoupSM* coupSMPtr{};
110  ParticleData* particleDataPtr{};
111  Rndm* rndmPtr{};
112  Settings* settingsPtr{};
113  SusyLesHouches* slhaPtr{};
114 
115  // Is initialized.
116  bool isInitPtr{false}, isInit{false};
117 
118 };
119 
120 //==========================================================================
121 
122 // A helicity sampler using external matrix elements.
123 
125 
126  public:
127  // Constructor, destructor, and assignment.
129  ~HelicitySampler() = default;
130 
131  // Initialise pointers to required Pythia objects.
132  void initPtrs(ExternalMEsPtr mePluginPtrIn, Rndm* rndmPtrIn) {
133  mePluginPtr = mePluginPtrIn;
134  rndmPtr = rndmPtrIn;
135  isInitPtr = true;}
136 
137  // Set helicities for a particle state.
138  bool selectHelicities(vector<Particle>& state, bool force);
139 
140  private:
141 
142  // Pointers to Pythia objects.
143  ExternalMEsPtr mePluginPtr;
144  Rndm* rndmPtr;
145 
146  // Flag whether we have all pointers.
147  bool isInitPtr;
148 
149 };
150 
151 //==========================================================================
152 
153 } // end namespace Pythia8
154 
155 #endif // end Pythia8_ExternalMEs_H
int colMode
Colour mode (0: strict LC, 1: LC, 2: LC sum, 3: FC).
Definition: ExternalMEs.h:95
virtual void initPtrs(Info *infoPtrIn)
Initialisers for pointers.
Definition: ExternalMEs.cc:22
virtual double calcME2(const vector< Particle > &)
Definition: ExternalMEs.h:58
Definition: Info.h:45
int helMode
Helicity mode (0: explicit helicity sum, 1: implicit helicity sum).
Definition: ExternalMEs.h:101
The Event class holds all info on the generated event.
Definition: Event.h:453
A helicity sampler using external matrix elements.
Definition: ExternalMEs.h:124
virtual bool isAvailable(vector< int >, vector< int >)
Definition: ExternalMEs.h:49
ExternalMEs()=default
Destructor.
void fillCols(const Event &event, vector< int > &colors, int iBeg=3) const
Fill a vector of colors, from an event, starting from entry i = iBeg.
Definition: ExternalMEs.cc:60
virtual void setColourMode(int colModeIn)
Setters.
Definition: ExternalMEs.h:63
void fillMoms(const Event &event, vector< Vec4 > &p, int iBeg=3) const
Fill a vector of momenta, from an event, starting from entry i = iBeg.
Definition: ExternalMEs.cc:50
Definition: Logger.h:23
bool inclSymFac
Symmetry and averaging factors.
Definition: ExternalMEs.h:104
map< vector< int >, double > me2hel
Saved list of helicity components for last ME evaluated.
Definition: ExternalMEs.h:98
virtual int colourMode()
Getters.
Definition: ExternalMEs.h:75
HelicitySampler()
Constructor, destructor, and assignment.
Definition: ExternalMEs.h:128
Definition: Basics.h:386
Definition: SusyLesHouches.h:393
Base class for external matrix-element interfaces.
Definition: ExternalMEs.h:30
Definition: StandardModel.h:135
void initPtrs(ExternalMEsPtr mePluginPtrIn, Rndm *rndmPtrIn)
Initialise pointers to required Pythia objects.
Definition: ExternalMEs.h:132
void fillIds(const Event &event, vector< int > &in, vector< int > &out, int iBeg=3) const
Fill a vector of IDs, from an event, starting from entry i = iBeg.
Definition: ExternalMEs.cc:37
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
virtual bool init()
Initialisers.
Definition: ExternalMEs.h:42
Info * infoPtr
Pointers to VINCIA and Pythia 8 objects.
Definition: ExternalMEs.h:107
This class holds a map of all ParticleDataEntries.
Definition: ParticleData.h:422
bool isInitPtr
Is initialized.
Definition: ExternalMEs.h:116
Definition: Settings.h:195