PYTHIA  8.316
SimpleTimeShower.h
1 // SimpleTimeShower.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2025 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Header file for the original simple timelike final-state showers.
7 // TimeDipoleEnd: data on a radiating dipole end in FSR.
8 // SimpleTimeShower: handles the showering description.
9 
10 #ifndef Pythia8_SimpleTimeShower_H
11 #define Pythia8_SimpleTimeShower_H
12 
13 #include "Pythia8/TimeShower.h"
14 #include "Pythia8/SimpleWeakShowerMEs.h"
15 
16 namespace Pythia8 {
17 
18 // Forward declaration of SplitOnia;
19 class SplitOnia;
20 
21 //==========================================================================
22 
23 // Data on radiating dipole ends; only used inside SimpleTimeShower class.
24 
26 
27 public:
28 
29  // Constructors.
30  TimeDipoleEnd() : iRadiator(-1), iRecoiler(-1), pTmax(0.), colType(0),
31  chgType(0), gamType(0), weakType(0), isrType(0), system(0), systemRec(0),
32  MEtype(0), iMEpartner(-1), weakPol(0), oniumType(0), isHiddenValley(false),
33  colvType(0), MEmix(0.), MEorder(true), MEsplit(true), MEgluinoRec(false),
34  isFlexible(false), hasJunction(false), flavour(), iAunt(),
35  mRad(), m2Rad(), mRec(), m2Rec(), mDip(), m2Dip(), m2DipCorr(), pT2(),
36  m2(), z(), mFlavour(), asymPol(), flexFactor(), pAccept() {}
37  TimeDipoleEnd(int iRadiatorIn, int iRecoilerIn, double pTmaxIn = 0.,
38  int colIn = 0, int chgIn = 0, int gamIn = 0, int weakTypeIn = 0,
39  int isrIn = 0, int systemIn = 0, int MEtypeIn = 0, int iMEpartnerIn = -1,
40  int weakPolIn = 0, int oniumTypeIn = 0,
41  bool isHiddenValleyIn = false, int colvTypeIn = 0, double MEmixIn = 0.,
42  bool MEorderIn = true, bool MEsplitIn = true, bool MEgluinoRecIn = false,
43  bool isFlexibleIn = false, bool hasJunctionIn = false) :
44  iRadiator(iRadiatorIn), iRecoiler(iRecoilerIn), pTmax(pTmaxIn),
45  colType(colIn), chgType(chgIn), gamType(gamIn), weakType(weakTypeIn),
46  isrType(isrIn), system(systemIn), systemRec(systemIn), MEtype(MEtypeIn),
47  iMEpartner(iMEpartnerIn), weakPol(weakPolIn), oniumType(oniumTypeIn),
48  isHiddenValley(isHiddenValleyIn), colvType(colvTypeIn), MEmix(MEmixIn),
49  MEorder (MEorderIn), MEsplit(MEsplitIn), MEgluinoRec(MEgluinoRecIn),
50  isFlexible(isFlexibleIn), hasJunction(hasJunctionIn),
51  flavour(), iAunt(), mRad(), m2Rad(), mRec(), m2Rec(), mDip(), m2Dip(),
52  m2DipCorr(), pT2(), m2(), z(), mFlavour(), asymPol(), flexFactor(),
53  pAccept() {}
54 
55  // Basic properties related to dipole and matrix element corrections.
56  int iRadiator, iRecoiler;
57  double pTmax;
58  int colType, chgType, gamType, weakType, isrType, system, systemRec,
59  MEtype, iMEpartner, weakPol, oniumType;
60  bool isHiddenValley;
61  int colvType;
62  double MEmix;
63  bool MEorder, MEsplit, MEgluinoRec, isFlexible;
64  bool hasJunction;
65 
66  // Properties specific to current trial emission.
67  int flavour, iAunt;
68  double mRad, m2Rad, mRec, m2Rec, mDip, m2Dip, m2DipCorr,
69  pT2, m2, z, mFlavour, asymPol, flexFactor, pAccept;
70  double m2A{0}, m2B{0}, m2C{0}, m2gg{-1};
71 
72  // Pointer to an onium emission object, if present.
73  shared_ptr<SplitOnia> emissionPtr{};
74 
75 };
76 
77 //==========================================================================
78 
79 // The SimpleTimeShower class does timelike showers.
80 
81 class SimpleTimeShower : public TimeShower {
82 
83 public:
84 
85  // Constructor.
86  SimpleTimeShower() : hasWeaklyRadiated(), iSysSel(), pTmaxFudge(),
87  pTLastBranch(), doQCDshower(), doQEDshowerByQ(), doQEDshowerByL(),
88  doQEDshowerByOther(), doQEDshowerByGamma(), doWeakShower(),
89  doMEcorrections(), doMEextended(), doMEafterFirst(), doPhiPolAsym(),
90  doPhiPolAsymHard(), doInterleave(), doInterleaveResDec(),
91  allowBeamRecoil(), dampenBeamRecoil(), useFixedFacScale(),
92  allowRescatter(), canVetoEmission(), doHVshower(), brokenHVsym(),
93  setLambdaHV(), globalRecoil(), useLocalRecoilNow(), doSecondHard(),
94  hasUserHooks(), singleWeakEmission(), alphaSuseCMW(), vetoWeakJets(),
95  allowMPIdipole(), weakExternal(), recoilDeadCone(),
96  doDipoleRecoil(), doPartonVertex(), recoilRFUseParents(false),
97  pTmaxMatch(), pTdampMatch(), alphaSorder(), alphaSnfmax(),
98  nGluonToQuark(), weightGluonToQuark(), recoilStrategyRF(),
99  alphaEMorder(), nGammaToQuark(), nGammaToLepton(), nCHV(),
100  nFlavHV(), idHV(), alphaHVorder(), nMaxGlobalRecoil(), weakMode(),
101  pTdampFudge(), mc(), mb(), m2c(), m2b(), renormMultFac(),
102  factorMultFac(), fixedFacScale2(), alphaSvalue(), alphaSmax(), alphaS2pi(),
103  Lambda3flav(), Lambda4flav(), Lambda5flav(), Lambda3flav2(),
104  Lambda4flav2(), Lambda5flav2(), scaleGluonToQuark(),
105  extraGluonToQuark(), weightRF(1), pTcolCutMin(), pTcolCut(),
106  pT2colCut(), pTchgQCut(), pT2chgQCut(), pTchgLCut(), pT2chgLCut(),
107  pTweakCut(), pT2weakCut(), mMaxGamma(), m2MaxGamma(), mZ(),
108  gammaZ(), thetaWRat(), mW(), gammaW(), CFHV(), alphaHVfix(),
109  alphaHVref(), LambdaHV(), pThvCut(), pT2hvCut(), mHV(),
110  pTmaxFudgeMPI(), weakEnhancement(), vetoWeakDeltaR2(),
111  twoHard(), dopTlimit1(), dopTlimit2(), dopTdamp(), pT2damp(),
112  kRad(), kEmt(), pdfScale2(), doTrialNow(), canEnhanceEmission(),
113  canEnhanceTrial(), canEnhanceET(), doUncertaintiesNow(), dipSel(),
114  iDipSel(), nHard(), nFinalBorn(), nMaxGlobalBranch(), nGlobal(),
115  globalRecoilMode(), limitMUQ(), weakHardSize() { beamOffset = 0;
116  pdfMode = 0; useSystems = true; }
117 
118  // Destructor.
119  virtual ~SimpleTimeShower() override {}
120 
121  // Initialize alphaStrong and related pTmin parameters.
122  virtual void init( BeamParticle* beamAPtrIn = nullptr,
123  BeamParticle* beamBPtrIn = nullptr) override;
124 
125  // Find whether to limit maximum scale of emissions, and whether to dampen.
126  virtual bool limitPTmax( Event& event, double Q2Fac = 0.,
127  double Q2Ren = 0.) override;
128 
129  // Top-level routine to do a full time-like shower in resonance decay.
130  virtual int shower( int iBeg, int iEnd, Event& event, double pTmax,
131  int nBranchMax = 0) override;
132 
133  // Top-level routine for QED radiation in hadronic decay to two leptons.
134  virtual int showerQED( int i1, int i2, Event& event, double pTmax = -1.)
135  override;
136 
137  // Prepare process-level event for shower + interleaved resonance decays.
138  // Usage: prepareProcess( process, event, iPos).
139  // iPos provides mapping from process to event entries (before showering).
140  virtual void prepareProcess( Event& process, Event&, vector<int>&) override;
141 
142  // Global recoil: reset counters and store locations of outgoing partons.
143  virtual void prepareGlobal( Event& event) override;
144 
145  // Prepare system for evolution after each new interaction; identify ME.
146  virtual void prepare( int iSys, Event& event, bool limitPTmaxIn = true)
147  override;
148 
149  // Update dipole list after a multiparton interactions rescattering.
150  virtual void rescatterUpdate( int iSys, Event& event) override;
151 
152  // Update dipole list after each ISR emission.
153  virtual void update( int iSys, Event& event, bool hasWeakRad = false)
154  override;
155 
156  // Select next pT for FSR in downwards evolution.
157  virtual double pTnext( Event& event, double pTbegAll, double pTendAll,
158  bool isFirstTrial = false, bool doTrialIn = false) override;
159 
160  // Select next pT for interleaved resonance decays.
161  virtual double pTnextResDec() override;
162 
163  // ME corrections and kinematics that may give failure.
164  virtual bool branch( Event& event, bool isInterleaved = false) override;
165 
166  // Do a resonance decay + resonance shower (including any nested decays).
167  // May be called recursively for nested decays.
168  // Usage: resonanceShower( process, event, iPos, pTmerge), where iPos
169  // maps process to event entries, and pTmerge is the scale at which this
170  // system should be merged into its parent system.
171  virtual bool resonanceShower(Event& process, Event& event,
172  vector<int>& iPos, double qRestart) override;
173 
174  // Print dipole list; for debug mainly.
175  virtual void list() const override;
176 
177  // Initialize data members for calculation of uncertainty bands.
178  virtual bool initUncertainties() override;
179 
180  // Initialize data members for application of enhancements.
181  virtual bool initEnhancements() override;
182 
183  // Tell whether FSR has done a weak emission.
184  virtual bool getHasWeaklyRadiated() override {return hasWeaklyRadiated;}
185 
186  // Tell which system was the last processed one.
187  virtual int system() const override {return iSysSel;}
188 
189  // Potential enhancement factor of pTmax scale for hardest emission.
190  virtual double enhancePTmax() override {return pTmaxFudge;}
191 
192  // Provide the pT scale of the last branching in the above shower.
193  virtual double pTLastInShower() override {return pTLastBranch;}
194 
195  // Functions to directly extract the probability of no emission between two
196  // scales. These functions are not used in the Pythia core code, but can be
197  // used by external programs to interface with the shower directly.
198  double noEmissionProbability( double pTbegAll, double pTendAll, double m2dip,
199  int id, int type, double s = -1., double x = -1.) override;
200  double pTnext( vector<TimeDipoleEnd> dipEnds, Event event, double pTbegAll,
201  double pTendAll, double m2dip, int id, int type, double s = -1.,
202  double x = -1.);
203  int pdfMode;
204  bool useSystems;
205 
206 private:
207 
208  // Constants: could only be changed in the code itself.
209  static const double MCMIN, MBMIN, SIMPLIFYROOT, XMARGIN, XMARGINCOMB,
210  WTRATIOMAX,TINYPDF, LARGEM2, THRESHM2, LAMBDA3MARGIN1ORD,
211  LAMBDA3MARGIN2ORD,WEAKPSWEIGHT, WG2QEXTRA, REJECTFACTOR,
212  PROBLIMIT;
213  static const int NLOOPMAX;
214  // Rescatter: try to fix up recoil between systems
215  static const bool FIXRESCATTER, VETONEGENERGY;
216  static const double MAXVIRTUALITYFRACTION, MAXNEGENERGYFRACTION;
217 
218  // Store properties to be returned by methods.
219  bool hasWeaklyRadiated;
220  int iSysSel;
221  double pTmaxFudge, pTLastBranch;
222 
223  // Initialization data, normally only set once.
224  bool doQCDshower, doQEDshowerByQ, doQEDshowerByL, doQEDshowerByOther,
225  doQEDshowerByGamma, doWeakShower, doMEcorrections, doMEextended,
226  doMEafterFirst, doPhiPolAsym, doPhiPolAsymHard, doInterleave,
227  doInterleaveResDec, allowBeamRecoil, dampenBeamRecoil,
228  useFixedFacScale, allowRescatter, canVetoEmission, doHVshower,
229  brokenHVsym, setLambdaHV, globalRecoil, useLocalRecoilNow,
230  doSecondHard, hasUserHooks, singleWeakEmission, alphaSuseCMW,
231  vetoWeakJets, allowMPIdipole, weakExternal, recoilDeadCone,
232  doDipoleRecoil, doPartonVertex, recoilRFUseParents;
233  int pdfModeSave;
234  int pTmaxMatch, pTdampMatch, alphaSorder, alphaSnfmax, nGluonToQuark,
235  weightGluonToQuark, recoilStrategyRF, alphaEMorder, nGammaToQuark,
236  nGammaToLepton, nCHV, nFlavHV, idHV, alphaHVorder, nMaxGlobalRecoil,
237  weakMode;
238  double pTdampFudge, mc, mb, m2c, m2b, renormMultFac,
239  factorMultFac, fixedFacScale2, alphaSvalue, alphaSmax, alphaS2pi,
240  Lambda3flav, Lambda4flav, Lambda5flav, Lambda3flav2, Lambda4flav2,
241  Lambda5flav2, scaleGluonToQuark, extraGluonToQuark, weightRF,
242  pTcolCutMin, pTcolCut, pT2colCut, pTchgQCut, pT2chgQCut,
243  pTchgLCut, pT2chgLCut, pTweakCut, pT2weakCut, mMaxGamma, m2MaxGamma,
244  mZ, gammaZ, thetaWRat, mW, gammaW, CFHV,
245  alphaHVfix, alphaHVref, LambdaHV, pThvCut, pT2hvCut, mHV,
246  pTmaxFudgeMPI, weakEnhancement, vetoWeakDeltaR2;
247 
248  // Optional nonsingular and 2nd-order terms.
249  bool doLOT{false}, doHOT{false};
250  double cEmitG{0.}, cEmitQ{0.}, cEmitC{0.}, cEmitB{0.},
251  cSplit{0.}, cSplitC{0.}, cSplitB{0.}, hEmitHard{0.}, hEmitColl{0.},
252  hEmitSoft{0.}, hSplitHard{0.}, hSplitColl{0.};
253 
254  // Oversample when using finite corrections to the QCD shower.
255  void finiteOversample(int colTypeAbs, double& overFacLog,
256  double& overFacLin, double& overFacSplit);
257 
258  // Return weight for different finite corrections to QCD shower.
259  double finiteCorrection(TimeDipoleEnd& dip, Event& event, bool doLOTNow,
260  int colTypeAbs);
261 
262  // alphaStrong, alphaEM and alpha_HV calculations.
263  AlphaStrong alphaS;
264  AlphaEM alphaEM;
265  AlphaSUN alphaHV;
266 
267  // Weak matrix elements used for corrections both of ISR and FSR.
268  SimpleWeakShowerMEs simpleWeakShowerMEs;
269 
270  // Some current values.
271  bool twoHard, dopTlimit1, dopTlimit2, dopTdamp;
272  double pT2damp, kRad, kEmt, pdfScale2;
273 
274  // Bookkeeping of enhanced actual or trial emissions (see EPJC (2013) 73).
275  bool doTrialNow, canEnhanceEmission, canEnhanceTrial, canEnhanceET,
276  doUncertaintiesNow;
277  string splittingNameNow, splittingNameSel;
278  map< double, pair<string,double> > enhanceFactors;
279  void storeEnhanceFactor(double pT2, string name, double enhanceFactorIn)
280  { enhanceFactors.insert(make_pair(pT2,make_pair(name,enhanceFactorIn)));}
281 
282  // All dipole ends and a pointer to the selected hardest dipole end.
283  vector<TimeDipoleEnd> dipEnd;
284  TimeDipoleEnd* dipSel;
285  int iDipSel;
286 
287  // Setup a dipole end, either QCD, QED/photon, weak or Hidden Valley one.
288  void setupQCDdip( int iSys, int i, int colTag, int colSign, Event& event,
289  bool isOctetOnium = false, bool limitPTmaxIn = true);
290  void setupQEDdip( int iSys, int i, int chgType, int gamType, Event& event,
291  bool limitPTmaxIn = true);
292  void setupWeakdip( int iSys, int i,int weakType, Event& event,
293  bool limitPTmaxIn = true);
294  // Special setup for weak dipoles if already specified in info ptr.
295  void setupWeakdipExternal(Event& event, bool limitPTmaxIn = true);
296  void setupHVdip( int iSys, int i, int colvType, Event& event,
297  bool limitPTmaxIn = true);
298 
299  // Apply ME corrections for a specific subsystem.
300  bool applyMECorrections(const Event& event, TimeDipoleEnd* dipBranch,
301  int iSysBranch);
302 
303  // Special setup for onium.
304  void regenerateOniumDipoles(Event & event);
305 
306  // Evolve a QCD dipole end.
307  void pT2nextQCD( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
308  Event& event);
309 
310  // Evolve a QED dipole end, either charged or photon.
311  void pT2nextQED( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
312  Event& event);
313 
314  // Evolve a weak dipole end.
315  void pT2nextWeak( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
316  Event& event);
317 
318  // Evolve a Hidden Valley dipole end.
319  void pT2nextHV( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
320  Event& );
321 
322  // Evolve an onium dipole end.
323  void pT2nextOnium( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
324  Event& );
325 
326  // Find kind of QCD ME correction.
327  void findMEtype( Event& event, TimeDipoleEnd& dip);
328 
329  // Find type of particle; used by findMEtype.
330  int findMEparticle( int id, bool isHiddenColour = false);
331 
332  // Find mixture of V and A in gamma/Z: energy- and flavour-dependent.
333  double gammaZmix( Event& event, int iRes, int iDau1, int iDau2);
334 
335  // Set up to calculate QCD ME correction with calcMEcorr.
336  double findMEcorr(TimeDipoleEnd* dip, Particle& rad, Particle& partner,
337  Particle& emt, bool cutEdge = true);
338 
339  // Set up to calculate weak ME corrections for t-channel processes.
340  double findMEcorrWeak(TimeDipoleEnd* dip, Vec4 rad, Vec4 rec,
341  Vec4 emt, Vec4 p3, Vec4 p4, Vec4 radBef, Vec4 recBef);
342 
343  // Calculate value of QCD ME correction.
344  double calcMEcorr( int kind, int combiIn, double mixIn, double x1,
345  double x2, double r1, double r2, double r3 = 0., bool cutEdge = true);
346 
347  // Find coefficient of azimuthal asymmetry from gluon polarization.
348  void findAsymPol( Event& event, TimeDipoleEnd* dip);
349 
350  // Compute scale for interleaved resonance decays
351  double calcPTresDec(Particle& res);
352 
353  // Rescatter: propagate dipole recoil to internal lines connecting systems.
354  bool rescatterPropagateRecoil( Event& event, Vec4& pNew);
355 
356  // Properties stored for (some) global recoil schemes.
357  // Vectors of event indices defining the hard process.
358  vector<int> hardPartons;
359  // Number of partons in current hard event, number of partons in Born-type
360  // hard event (to distinguish between S and H), maximally allowed number of
361  // global recoil branchings.
362  int nHard, nFinalBorn, nMaxGlobalBranch;
363  // Number of proposed splittings in hard scattering systems.
364  map<int,int> nProposed;
365  // Number of splittings with global recoil (currently only 1).
366  int nGlobal, globalRecoilMode;
367  // Switch to constrain recoiling system.
368  bool limitMUQ;
369 
370  // Calculate uncertainty-band weights for accepted/rejected trial branching.
371  void calcUncertainties( bool accept, double pAccept,
372  double enhance, TimeDipoleEnd* dip, Particle* radPtr,
373  Particle* emtPtr, Particle* recPtr );
374 
375  // 2 -> 2 information needed for the external weak setup.
376  vector<Vec4> weakMomenta;
377  vector<int> weak2to2lines;
378  int weakHardSize;
379 
380  // Settings and member variables for interleaved resonance decays.
381  bool doFSRinResonances{};
382  int resDecScaleChoice{-1}, iHardResDecSav{}, nRecurseResDec{};
383  vector<int> idResDecSav;
384  vector<double> pTresDecSav;
385 
386  // Settings and containers for control of MECs.
387  bool skipFirstMECinHardProc;
388  vector<int> skipFirstMECinResDecIDs{};
389 
390  // Onium emissions.
391  bool doOniumShower{false};
392  vector<SplitOniaPtr> oniumEmissions;
393  set<double> oniumThresholds;
394 
395 };
396 
397 //==========================================================================
398 
399 } // end namespace Pythia8
400 
401 #endif // Pythia8_SimpleTimeShower_H
SimpleTimeShower()
Constructor.
Definition: SimpleTimeShower.h:86
Definition: StandardModel.h:23
virtual double enhancePTmax() override
Potential enhancement factor of pTmax scale for hardest emission.
Definition: SimpleTimeShower.h:190
The Event class holds all info on the generated event.
Definition: Event.h:408
The TimeShower class does timelike showers.
Definition: TimeShower.h:33
Definition: BeamParticle.h:133
TimeDipoleEnd()
Constructors.
Definition: SimpleTimeShower.h:30
int flavour
Properties specific to current trial emission.
Definition: SimpleTimeShower.h:67
Definition: StandardModel.h:113
shared_ptr< SplitOnia > emissionPtr
Pointer to an onium emission object, if present.
Definition: SimpleTimeShower.h:73
Definition: StandardModel.h:233
virtual bool getHasWeaklyRadiated() override
Tell whether FSR has done a weak emission.
Definition: SimpleTimeShower.h:184
Data on radiating dipole ends; only used inside SimpleTimeShower class.
Definition: SimpleTimeShower.h:25
virtual double pTLastInShower() override
Provide the pT scale of the last branching in the above shower.
Definition: SimpleTimeShower.h:193
Definition: Event.h:32
virtual ~SimpleTimeShower() override
Destructor.
Definition: SimpleTimeShower.h:119
Definition: SimpleWeakShowerMEs.h:26
virtual int system() const override
Tell which system was the last processed one.
Definition: SimpleTimeShower.h:187
int iRadiator
Basic properties related to dipole and matrix element corrections.
Definition: SimpleTimeShower.h:56
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
The SimpleTimeShower class does timelike showers.
Definition: SimpleTimeShower.h:81
Definition: Basics.h:32