PYTHIA  8.312
TimeShower.h
1 // TimeShower.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2024 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 base class of timelike final-state showers.
7 // TimeShower: handles the showering description.
8 
9 #ifndef Pythia8_TimeShower_H
10 #define Pythia8_TimeShower_H
11 
12 #include "Pythia8/Basics.h"
13 #include "Pythia8/BeamParticle.h"
14 #include "Pythia8/Event.h"
15 #include "Pythia8/Info.h"
16 #include "Pythia8/ParticleData.h"
17 #include "Pythia8/PartonSystems.h"
18 #include "Pythia8/PhysicsBase.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/PartonVertex.h"
21 #include "Pythia8/Settings.h"
22 #include "Pythia8/StandardModel.h"
23 #include "Pythia8/UserHooks.h"
24 #include "Pythia8/MergingHooks.h"
25 #include "Pythia8/Weights.h"
26 
27 namespace Pythia8 {
28 
29 //==========================================================================
30 
31 // The TimeShower class does timelike showers.
32 
33 class TimeShower : public PhysicsBase {
34 
35 public:
36 
37  // Constructor.
38  TimeShower() = default;
39 
40  // Destructor.
41  virtual ~TimeShower() {}
42 
43  // Initialize various pointers.
44  // (Separated from rest of init since not virtual.)
45  void initPtrs(MergingHooksPtr mergingHooksPtrIn,
46  PartonVertexPtr partonVertexPtrIn,
47  WeightContainer* weightContainerPtrIn) {
49  mergingHooksPtr = mergingHooksPtrIn;
50  partonVertexPtr = partonVertexPtrIn;
51  weightContainerPtr = weightContainerPtrIn;
52  }
53 
54  // New beams possible for handling of hard diffraction. (Not virtual.)
55  void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
56  int beamOffsetIn = 0) {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
57  beamOffset = beamOffsetIn;}
58 
59  // Initialize alphaStrong and related pTmin parameters.
60  // Usage: init( beamAPtr, beamBPtr).
61  virtual void init( BeamParticle* = 0, BeamParticle* = 0) {}
62 
63  // Find whether to limit maximum scale of emissions, and whether to dampen.
64  // Usage: limitPTmax( event, Q2Fac, double Q2Ren).
65  virtual bool limitPTmax( Event& , double = 0., double = 0.) {return true;}
66 
67  // Top-level routine to do a full time-like shower in resonance decay.
68  // Usage: shower( iBeg, iEnd, event, pTmax, nBranchMax).
69  virtual int shower( int , int , Event& , double , int = 0) {return 0;}
70 
71  // Top-level routine for QED radiation in hadronic decay to two leptons.
72  // Usage: showerQED( i1, i2, event, pTmax).
73  virtual int showerQED( int , int , Event& , double ) {return 0;}
74 
75  // Optional method to add QED showers after remnants have been added
76  // but before hadronisation. (Called from PartonLevel.)
77  virtual int showerQEDafterRemnants(Event&) { return 0; }
78 
79  // Prepare process-level event for shower + interleaved resonance decays.
80  // Usage: prepareProcess( process, event, iPos).
81  // iPos provides mapping from process to event entries (before showering).
82  virtual void prepareProcess( Event&, Event&, vector<int>&) {};
83 
84  // Global recoil: reset counters and store locations of outgoing partons.
85  // Usage: prepareGlobal( event).
86  virtual void prepareGlobal( Event& ) {}
87 
88  // Prepare system for evolution after each new interaction; identify ME.
89  // Usage: prepare( iSys, event, limitPTmax).
90  virtual void prepare( int , Event& , bool = true) {}
91 
92  // Update dipole list after a multiparton interactions rescattering.
93  // Usage: rescatterUpdate( iSys, event).
94  virtual void rescatterUpdate( int , Event& ) {}
95 
96  // Update dipole list after each ISR emission.
97  // Usage: update( iSys, event, hasWeakRad).
98  virtual void update( int , Event& , bool = false) {}
99 
100  // Select next pT in downwards evolution.
101  // Usage: pTnext( event, pTbegAll, pTendAll, isFirstTrial, doTrialIn).
102  virtual double pTnext( Event& , double , double , bool = false, bool = false)
103  { return 0.;}
104 
105  // Select next pT for interleaved resonance decays.
106  virtual double pTnextResDec() { return 0.; }
107 
108  // ME corrections and kinematics that may give failure.
109  // Usage: branch( event, isInterleaved).
110  virtual bool branch( Event& , bool = false) {return true;}
111 
112  // Handle a resonance decay + resonance shower (including any nested decays).
113  // Assumes decay channel and kinematics already selected and present in
114  // either the process or event record.
115  // May be called recursively for nested decays.
116  // Usage: resonanceShower( process, event, iPos, pTmerge), where iPos
117  // maps process to event entries, and pTmerge is the scale at which this
118  // system should be merged into its parent system.
119  virtual bool resonanceShower( Event&, Event&, vector<int>&, double = 0.)
120  { return false;}
121 
122  // Print dipole list; for debug mainly.
123  virtual void list() const {}
124 
125  // Initialize data members for calculation of uncertainty bands.
126  virtual bool initUncertainties() {return false;}
127 
128  // Initialize data members for application of enhancements.
129  virtual bool initEnhancements() {return false;}
130 
131  // Tell whether FSR has done a weak emission.
132  virtual bool getHasWeaklyRadiated() {return false;}
133 
134  // Tell which system was the last processed one.
135  virtual int system() const {return 0;}
136 
137  // Potential enhancement factor of pTmax scale for hardest emission.
138  virtual double enhancePTmax() {return 1.;}
139 
140  // Provide the pT scale of the last branching in the above shower.
141  virtual double pTLastInShower() {return 0.;}
142 
143  // Functions to allow usage of shower kinematics, evolution variables,
144  // and splitting probabilities outside of shower.
145  // Virtual so that shower plugins can overwrite these functions.
146  // This makes it possible for another piece of the code to request
147  // these - which is very convenient for merging.
148  // Function variable names are not included to avoid compiler warnings.
149  // Please see the documentation under "Implement New Showers" for details.
150 
151  // Return clustering kinematics - as needed for merging.
152  virtual Event clustered( const Event& , int , int , int , string )
153  { return Event();}
154 
155  // Return the evolution variable(s).
156  // Important note: this map must contain the following entries
157  // - a key "t" for the value of the shower evolution variable;
158  // - a key "tRS" for the value of the shower evolution variable
159  // from which the shower would be restarted after a branching;
160  // - a key "scaleAS" for the argument of alpha_s used for the branching;
161  // - a key "scalePDF" for the argument of the PDFs used for the branching.
162  // Usage: getStateVariables( event, iRad, iEmt, iRec, name)
163  virtual map<string, double> getStateVariables (const Event& , int , int ,
164  int , string ) { return map<string,double>();}
165 
166  // Check if attempted clustering is handled by timelike shower
167  // Usage: isTimelike( event, iRad, iEmt, iRec, name)
168  virtual bool isTimelike(const Event& , int , int , int , string )
169  { return false; }
170 
171  // Return a string identifier of a splitting.
172  // Usage: getSplittingName( event, iRad, iEmt, iRec)
173  virtual vector<string> getSplittingName( const Event& , int, int , int)
174  { return vector<string>();}
175 
176  // Return the splitting probability.
177  // Usage: getSplittingProb( event, iRad, iEmt, iRec)
178  virtual double getSplittingProb( const Event& , int , int , int , string )
179  { return 0.;}
180  virtual bool allowedSplitting( const Event& , int , int)
181  { return true; }
182  virtual vector<int> getRecoilers( const Event&, int, int, string)
183  { return vector<int>(); }
184 
185  virtual double enhanceFactor(const string& name) {
186  unordered_map<string, double>::iterator it = enhanceFSR.find(name);
187  if ( it == enhanceFSR.end() ) return 1.;
188  return it->second;
189  }
190 
191  // Functions to directly extract the probability of no emission between two
192  // scales. This functions is not used in the Pythia core code, but can be
193  // used by external programs to interface with the shower directly.
194  virtual double noEmissionProbability( double, double, double, int, int,
195  double, double) { return 1.; }
196 
197  // Pointer to MergingHooks object for NLO merging.
198  MergingHooksPtr mergingHooksPtr{};
199 
200  WeightContainer* weightContainerPtr{};
201 
202 protected:
203 
204  // Beam location offset in event.
205  int beamOffset{};
206 
207  // Pointer to assign space-time vertices during parton evolution.
208  PartonVertexPtr partonVertexPtr{};
209 
210  // Store uncertainty variations relevant to TimeShower.
211  bool doUncertainties{}, uVarMuSoftCorr{}, uVarMPIshowers{},
212  noResVariations{}, noProcVariations{};
213  int nUncertaintyVariations{}, nVarQCD{}, uVarNflavQ{};
214  double dASmax{}, cNSpTmin{}, uVarpTmin2{}, overFactor{}, overFactorEnhance{};
215  map<int,double> varG2GGmuRfac, varQ2QGmuRfac, varG2QQmuRfac, varX2XGmuRfac,
216  varG2GGcNS, varQ2QGcNS, varG2QQcNS, varX2XGcNS;
217  map<int,double>* varPDFplus;
218  map<int,double>* varPDFminus;
219  map<int,double>* varPDFmember;
220  unordered_map<string,double> enhanceFSR;
221 
222 };
223 
224 //==========================================================================
225 
226 } // end namespace Pythia8
227 
228 #endif // Pythia8_TimeShower_H
virtual bool isTimelike(const Event &, int, int, int, string)
Definition: TimeShower.h:168
virtual bool resonanceShower(Event &, Event &, vector< int > &, double=0.)
Definition: TimeShower.h:119
virtual double getSplittingProb(const Event &, int, int, int, string)
Definition: TimeShower.h:178
Definition: PhysicsBase.h:27
virtual bool initUncertainties()
Initialize data members for calculation of uncertainty bands.
Definition: TimeShower.h:126
virtual map< string, double > getStateVariables(const Event &, int, int, int, string)
Definition: TimeShower.h:163
The Event class holds all info on the generated event.
Definition: Event.h:453
The TimeShower class does timelike showers.
Definition: TimeShower.h:33
Definition: BeamParticle.h:133
Definition: Weights.h:394
virtual void init(BeamParticle *=0, BeamParticle *=0)
Definition: TimeShower.h:61
virtual int showerQED(int, int, Event &, double)
Definition: TimeShower.h:73
CoupSM * coupSMPtr
Pointers to Standard Model and Beyond SM couplings.
Definition: Info.h:95
virtual int shower(int, int, Event &, double, int=0)
Definition: TimeShower.h:69
virtual void prepareGlobal(Event &)
Definition: TimeShower.h:86
TimeShower()=default
Constructor.
virtual int system() const
Tell which system was the last processed one.
Definition: TimeShower.h:135
virtual ~TimeShower()
Destructor.
Definition: TimeShower.h:41
MergingHooksPtr mergingHooksPtr
Pointer to MergingHooks object for NLO merging.
Definition: TimeShower.h:198
virtual void update(int, Event &, bool=false)
Definition: TimeShower.h:98
void initPtrs(MergingHooksPtr mergingHooksPtrIn, PartonVertexPtr partonVertexPtrIn, WeightContainer *weightContainerPtrIn)
Definition: TimeShower.h:45
virtual bool limitPTmax(Event &, double=0., double=0.)
Definition: TimeShower.h:65
int beamOffset
Beam location offset in event.
Definition: TimeShower.h:205
virtual bool getHasWeaklyRadiated()
Tell whether FSR has done a weak emission.
Definition: TimeShower.h:132
virtual Event clustered(const Event &, int, int, int, string)
Return clustering kinematics - as needed for merging.
Definition: TimeShower.h:152
virtual void rescatterUpdate(int, Event &)
Definition: TimeShower.h:94
void reassignBeamPtrs(BeamParticle *beamAPtrIn, BeamParticle *beamBPtrIn, int beamOffsetIn=0)
New beams possible for handling of hard diffraction. (Not virtual.)
Definition: TimeShower.h:55
virtual vector< string > getSplittingName(const Event &, int, int, int)
Definition: TimeShower.h:173
virtual void prepareProcess(Event &, Event &, vector< int > &)
Definition: TimeShower.h:82
virtual double noEmissionProbability(double, double, double, int, int, double, double)
Definition: TimeShower.h:194
virtual bool initEnhancements()
Initialize data members for application of enhancements.
Definition: TimeShower.h:129
CoupSM * coupSMPtr
Pointers to SM and SUSY couplings.
Definition: PhysicsBase.h:96
virtual bool branch(Event &, bool=false)
Definition: TimeShower.h:110
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
PartonVertexPtr partonVertexPtr
Pointer to assign space-time vertices during parton evolution.
Definition: TimeShower.h:208
Info * infoPtr
Definition: PhysicsBase.h:78
virtual void prepare(int, Event &, bool=true)
Definition: TimeShower.h:90
virtual void list() const
Print dipole list; for debug mainly.
Definition: TimeShower.h:123
virtual double pTLastInShower()
Provide the pT scale of the last branching in the above shower.
Definition: TimeShower.h:141
virtual double pTnext(Event &, double, double, bool=false, bool=false)
Definition: TimeShower.h:102
virtual double pTnextResDec()
Select next pT for interleaved resonance decays.
Definition: TimeShower.h:106
bool doUncertainties
Store uncertainty variations relevant to TimeShower.
Definition: TimeShower.h:211
virtual int showerQEDafterRemnants(Event &)
Definition: TimeShower.h:77
virtual double enhancePTmax()
Potential enhancement factor of pTmax scale for hardest emission.
Definition: TimeShower.h:138