StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TimeShower.h
1 // TimeShower.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2018 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 timelike final-state showers.
7 // TimeDipoleEnd: data on a radiating dipole end.
8 // TimeShower: handles the showering description.
9 
10 #ifndef Pythia8_TimeShower_H
11 #define Pythia8_TimeShower_H
12 
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/BeamParticle.h"
15 #include "Pythia8/Event.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/ParticleData.h"
18 #include "Pythia8/PartonSystems.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/WeakShowerMEs.h"
26 
27 namespace Pythia8 {
28 
29 //==========================================================================
30 
31 // Data on radiating dipole ends; only used inside TimeShower class.
32 
33 class TimeDipoleEnd {
34 
35 public:
36 
37  // Constructors.
38  TimeDipoleEnd() : iRadiator(-1), iRecoiler(-1), pTmax(0.), colType(0),
39  chgType(0), gamType(0), weakType(0), isrType(0), system(0), systemRec(0),
40  MEtype(0), iMEpartner(-1), weakPol(0), isOctetOnium(false),
41  isHiddenValley(false), colvType(0), MEmix(0.), MEorder(true),
42  MEsplit(true), MEgluinoRec(false), isFlexible(false) { }
43  TimeDipoleEnd(int iRadiatorIn, int iRecoilerIn, double pTmaxIn = 0.,
44  int colIn = 0, int chgIn = 0, int gamIn = 0, int weakTypeIn = 0,
45  int isrIn = 0, int systemIn = 0, int MEtypeIn = 0, int iMEpartnerIn = -1,
46  int weakPolIn = 0, bool isOctetOniumIn = false,
47  bool isHiddenValleyIn = false, int colvTypeIn = 0, double MEmixIn = 0.,
48  bool MEorderIn = true, bool MEsplitIn = true, bool MEgluinoRecIn = false,
49  bool isFlexibleIn = false) :
50  iRadiator(iRadiatorIn), iRecoiler(iRecoilerIn), pTmax(pTmaxIn),
51  colType(colIn), chgType(chgIn), gamType(gamIn), weakType(weakTypeIn),
52  isrType(isrIn), system(systemIn), systemRec(systemIn), MEtype(MEtypeIn),
53  iMEpartner(iMEpartnerIn), weakPol(weakPolIn), isOctetOnium(isOctetOniumIn),
54  isHiddenValley(isHiddenValleyIn), colvType(colvTypeIn), MEmix(MEmixIn),
55  MEorder (MEorderIn), MEsplit(MEsplitIn), MEgluinoRec(MEgluinoRecIn),
56  isFlexible(isFlexibleIn) { }
57 
58  // Basic properties related to dipole and matrix element corrections.
59  int iRadiator, iRecoiler;
60  double pTmax;
61  int colType, chgType, gamType, weakType, isrType, system, systemRec,
62  MEtype, iMEpartner, weakPol;
63  bool isOctetOnium, isHiddenValley;
64  int colvType;
65  double MEmix;
66  bool MEorder, MEsplit, MEgluinoRec, isFlexible;
67 
68  // Properties specific to current trial emission.
69  int flavour, iAunt;
70  double mRad, m2Rad, mRec, m2Rec, mDip, m2Dip, m2DipCorr,
71  pT2, m2, z, mFlavour, asymPol, flexFactor, pAccept;
72 
73 };
74 
75 //==========================================================================
76 
77 // The TimeShower class does timelike showers.
78 
79 class TimeShower {
80 
81 public:
82 
83  // Constructor.
84  TimeShower() {beamOffset = 0;}
85 
86  // Destructor.
87  virtual ~TimeShower() {}
88 
89  // Initialize various pointers.
90  // (Separated from rest of init since not virtual.)
91  void initPtr(Info* infoPtrIn, Settings* settingsPtrIn,
92  ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
93  CoupSM* coupSMPtrIn, PartonSystems* partonSystemsPtrIn,
94  UserHooks* userHooksPtrIn, MergingHooks* mergingHooksPtrIn,
95  PartonVertex* partonVertexPtrIn) { infoPtr = infoPtrIn;
96  settingsPtr = settingsPtrIn; particleDataPtr = particleDataPtrIn;
97  rndmPtr = rndmPtrIn; coupSMPtr = coupSMPtrIn;
98  partonSystemsPtr = partonSystemsPtrIn; userHooksPtr = userHooksPtrIn;
99  mergingHooksPtr = mergingHooksPtrIn; partonVertexPtr = partonVertexPtrIn;
100  }
101 
102  // Initialize alphaStrong and related pTmin parameters.
103  virtual void init( BeamParticle* beamAPtrIn = 0,
104  BeamParticle* beamBPtrIn = 0);
105 
106  // New beams possible for handling of hard diffraction. (Not virtual.)
107  void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
108  int beamOffsetIn = 0) {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
109  beamOffset = beamOffsetIn;}
110 
111  // Find whether to limit maximum scale of emissions, and whether to dampen.
112  virtual bool limitPTmax( Event& event, double Q2Fac = 0.,
113  double Q2Ren = 0.);
114 
115  // Potential enhancement factor of pTmax scale for hardest emission.
116  virtual double enhancePTmax() {return pTmaxFudge;}
117 
118  // Top-level routine to do a full time-like shower in resonance decay.
119  virtual int shower( int iBeg, int iEnd, Event& event, double pTmax,
120  int nBranchMax = 0);
121 
122  // Top-level routine for QED radiation in hadronic decay to two leptons.
123  virtual int showerQED( int i1, int i2, Event& event, double pTmax);
124 
125  // Provide the pT scale of the last branching in the above shower.
126  double pTLastInShower() {return pTLastBranch;}
127 
128  // Global recoil: reset counters and store locations of outgoing partons.
129  virtual void prepareGlobal( Event& event);
130 
131  // Prepare system for evolution after each new interaction; identify ME.
132  virtual void prepare( int iSys, Event& event, bool limitPTmaxIn = true);
133 
134  // Update dipole list after a multiparton interactions rescattering.
135  virtual void rescatterUpdate( int iSys, Event& event);
136 
137  // Update dipole list after each ISR emission.
138  virtual void update( int iSys, Event& event, bool hasWeakRad = false);
139 
140  // Select next pT in downwards evolution.
141  virtual double pTnext( Event& event, double pTbegAll, double pTendAll,
142  bool isFirstTrial = false, bool doTrialIn = false);
143 
144  // ME corrections and kinematics that may give failure.
145  virtual bool branch( Event& event, bool isInterleaved = false);
146 
147  // Initialize data members for calculation of uncertainty bands.
148  bool initUncertainties();
149 
150  // Calculate uncertainty-band weights for accepted/rejected trial branching.
151  void calcUncertainties(bool accept, double pAccept, double enhance,
152  double vp, TimeDipoleEnd* dip, Particle* radPtr, Particle* emtPtr,
153  Particle* recPtr);
154 
155  // Tell which system was the last processed one.
156  virtual int system() const {return iSysSel;};
157 
158  // Tell whether FSR has done a weak emission.
159  bool getHasWeaklyRadiated() {return hasWeaklyRadiated;}
160 
161  // Print dipole list; for debug mainly.
162  virtual void list() const;
163 
164  // Functions to allow usage of shower kinematics, evolution variables,
165  // and splitting probabilities outside of shower.
166  // Virtual so that shower plugins can overwrite these functions.
167  // This makes it possible for another piece of the code to request
168  // these - which is very convenient for merging.
169  // Function variable names are not included to avoid compiler warnings.
170  // Please see the documentation under "Implement New Showers" for details.
171 
172  // Return clustering kinematics - as needed for merging.
173  virtual Event clustered( const Event& , int , int , int , string )
174  { return Event();}
175 
176  // Return the evolution variable(s).
177  // Important note: this map must contain the following entries
178  // - a key "t" for the value of the shower evolution variable;
179  // - a key "tRS" for the value of the shower evolution variable
180  // from which the shower would be restarted after a branching;
181  // - a key "scaleAS" for the argument of alpha_s used for the branching;
182  // - a key "scalePDF" for the argument of the PDFs used for the branching.
183  // Usage: getStateVariables( event, iRad, iEmt, iRec, name)
184  virtual map<string, double> getStateVariables (const Event& , int , int ,
185  int , string ) { return map<string,double>();}
186 
187  // Check if attempted clustering is handled by timelike shower
188  // Usage: isTimelike( event, iRad, iEmt, iRec, name)
189  virtual bool isTimelike(const Event& , int , int , int , string )
190  { return false; }
191 
192  // Return a string identifier of a splitting.
193  // Usage: getSplittingName( event, iRad, iEmt, iRec)
194  virtual vector<string> getSplittingName( const Event& , int, int , int)
195  { return vector<string>();}
196 
197  // Return the splitting probability.
198  // Usage: getSplittingProb( event, iRad, iEmt, iRec)
199  virtual double getSplittingProb( const Event& , int , int , int , string )
200  { return 0.;}
201 
202  virtual bool allowedSplitting( const Event& , int , int)
203  { return true; }
204  virtual vector<int> getRecoilers( const Event&, int, int, string)
205  { return vector<int>(); }
206 
207  // Pointer to MergingHooks object for NLO merging.
208  MergingHooks* mergingHooksPtr;
209 
210 protected:
211 
212  // Pointer to various information on the generation.
213  Info* infoPtr;
214 
215  // Pointer to the settings database.
216  Settings* settingsPtr;
217 
218  // Pointer to the particle data table.
219  ParticleData* particleDataPtr;
220 
221  // Pointer to the random number generator.
222  Rndm* rndmPtr;
223 
224  // Pointer to Standard Model couplings.
225  CoupSM* coupSMPtr;
226 
227  // Pointers to the two incoming beams. Offset their location in event.
228  BeamParticle* beamAPtr;
229  BeamParticle* beamBPtr;
230  int beamOffset;
231 
232  // Pointer to information on subcollision parton locations.
233  PartonSystems* partonSystemsPtr;
234 
235  // Pointer to userHooks object for user interaction with program.
236  UserHooks* userHooksPtr;
237 
238  // Pointer to assign space-time vertices during parton evolution.
239  PartonVertex* partonVertexPtr;
240 
241  // Weak matrix elements used for corrections both of ISR and FSR.
242  WeakShowerMEs weakShowerMEs;
243 
244  // Store properties to be returned by methods.
245  int iSysSel;
246  double pTmaxFudge, pTLastBranch;
247 
248 private:
249 
250  // Constants: could only be changed in the code itself.
251  static const double MCMIN, MBMIN, SIMPLIFYROOT, XMARGIN, XMARGINCOMB,
252  TINYPDF, LARGEM2, THRESHM2, LAMBDA3MARGIN, WEAKPSWEIGHT, WG2QEXTRA,
253  REJECTFACTOR, PROBLIMIT;
254  // Rescatter: try to fix up recoil between systems
255  static const bool FIXRESCATTER, VETONEGENERGY;
256  static const double MAXVIRTUALITYFRACTION, MAXNEGENERGYFRACTION;
257 
258  // Initialization data, normally only set once.
259  bool doQCDshower, doQEDshowerByQ, doQEDshowerByL, doQEDshowerByOther,
260  doQEDshowerByGamma, doWeakShower, doMEcorrections, doMEextended,
261  doMEafterFirst, doPhiPolAsym, doPhiPolAsymHard, doInterleave,
262  allowBeamRecoil, dampenBeamRecoil, recoilToColoured, useFixedFacScale,
263  allowRescatter, canVetoEmission, doHVshower, brokenHVsym,
264  globalRecoil, useLocalRecoilNow, doSecondHard, hasUserHooks,
265  singleWeakEmission, alphaSuseCMW, vetoWeakJets, allowMPIdipole,
266  weakExternal, recoilDeadCone, doUncertainties, uVarMuSoftCorr,
267  uVarMPIshowers, doDipoleRecoil, doPartonVertex, noResVariations,
268  noProcVariations;
269  int pTmaxMatch, pTdampMatch, alphaSorder, alphaSnfmax, nGluonToQuark,
270  weightGluonToQuark, alphaEMorder, nGammaToQuark, nGammaToLepton,
271  nCHV, idHV, alphaHVorder, nMaxGlobalRecoil, weakMode;
272  double pTdampFudge, mc, mb, m2c, m2b, renormMultFac, factorMultFac,
273  fixedFacScale2, alphaSvalue, alphaS2pi, Lambda3flav, Lambda4flav,
274  Lambda5flav, Lambda3flav2, Lambda4flav2, Lambda5flav2,
275  scaleGluonToQuark, extraGluonToQuark, pTcolCutMin, pTcolCut,
276  pT2colCut, pTchgQCut, pT2chgQCut, pTchgLCut, pT2chgLCut,
277  pTweakCut, pT2weakCut, mMaxGamma, m2MaxGamma, octetOniumFraction,
278  octetOniumColFac, mZ, gammaZ, thetaWRat, mW, gammaW, CFHV, nFlavHV,
279  alphaHVfix, LambdaHV, pThvCut, pT2hvCut, mHV, pTmaxFudgeMPI,
280  weakEnhancement, vetoWeakDeltaR2, dASmax, cNSpTmin, uVarpTmin2,
281  overFactor;
282 
283  // alphaStrong and alphaEM calculations.
284  AlphaStrong alphaS;
285  AlphaEM alphaEM;
286 
287  // Some current values.
288  bool dopTlimit1, dopTlimit2, dopTdamp, hasWeaklyRadiated;
289  double pT2damp, kRad, kEmt, pdfScale2;
290 
291  // Bookkeeping of enhanced actual or trial emissions (see EPJC (2013) 73).
292  bool doTrialNow, canEnhanceEmission, canEnhanceTrial, canEnhanceET,
293  doUncertaintiesNow;
294  string splittingNameNow, splittingNameSel;
295  map< double, pair<string,double> > enhanceFactors;
296  void storeEnhanceFactor(double pT2, string name, double enhanceFactorIn)
297  { enhanceFactors.insert(make_pair(pT2,make_pair(name,enhanceFactorIn)));}
298 
299  // All dipole ends and a pointer to the selected hardest dipole end.
300  vector<TimeDipoleEnd> dipEnd;
301  TimeDipoleEnd* dipSel;
302  int iDipSel;
303 
304  // Setup a dipole end, either QCD, QED/photon, weak or Hidden Valley one.
305  void setupQCDdip( int iSys, int i, int colTag, int colSign, Event& event,
306  bool isOctetOnium = false, bool limitPTmaxIn = true);
307  void setupQEDdip( int iSys, int i, int chgType, int gamType, Event& event,
308  bool limitPTmaxIn = true);
309  void setupWeakdip( int iSys, int i,int weakType, Event& event,
310  bool limitPTmaxIn = true);
311  // Special setup for weak dipoles if already specified in info ptr.
312  void setupWeakdipExternal(Event& event, bool limitPTmaxIn = true);
313  void setupHVdip( int iSys, int i, Event& event, bool limitPTmaxIn = true);
314 
315  // Evolve a QCD dipole end.
316  void pT2nextQCD( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
317  Event& event);
318 
319  // Evolve a QED dipole end, either charged or photon.
320  void pT2nextQED( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
321  Event& event);
322 
323  // Evolve a weak dipole end.
324  void pT2nextWeak( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
325  Event& event);
326 
327  // Evolve a Hidden Valley dipole end.
328  void pT2nextHV( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
329  Event& );
330 
331  // Find kind of QCD ME correction.
332  void findMEtype( Event& event, TimeDipoleEnd& dip);
333 
334  // Find type of particle; used by findMEtype.
335  int findMEparticle( int id, bool isHiddenColour = false);
336 
337  // Find mixture of V and A in gamma/Z: energy- and flavour-dependent.
338  double gammaZmix( Event& event, int iRes, int iDau1, int iDau2);
339 
340  // Set up to calculate QCD ME correction with calcMEcorr.
341  double findMEcorr(TimeDipoleEnd* dip, Particle& rad, Particle& partner,
342  Particle& emt, bool cutEdge = true);
343 
344  // Set up to calculate weak ME corrections for t-channel processes.
345  double findMEcorrWeak(TimeDipoleEnd* dip, Vec4 rad, Vec4 rec,
346  Vec4 emt, Vec4 p3, Vec4 p4, Vec4 radBef, Vec4 recBef);
347 
348  // Calculate value of QCD ME correction.
349  double calcMEcorr( int kind, int combiIn, double mixIn, double x1,
350  double x2, double r1, double r2, double r3 = 0., bool cutEdge = true);
351 
352  // Find coefficient of azimuthal asymmetry from gluon polarization.
353  void findAsymPol( Event& event, TimeDipoleEnd* dip);
354 
355  // Rescatter: propagate dipole recoil to internal lines connecting systems.
356  bool rescatterPropagateRecoil( Event& event, Vec4& pNew);
357 
358  // Properties stored for (some) global recoil schemes.
359  // Vectors of event indices defining the hard process.
360  vector<int> hardPartons;
361  // Number of partons in current hard event, number of partons in Born-type
362  // hard event (to distinguish between S and H), maximally allowed number of
363  // global recoil branchings.
364  int nHard, nFinalBorn, nMaxGlobalBranch;
365  // Number of proposed splittings in hard scattering systems.
366  map<int,int> nProposed;
367  // Number of splittings with global recoil (currently only 1).
368  int nGlobal, globalRecoilMode;
369  // Switch to constrain recoiling system.
370  bool limitMUQ;
371 
372  // 2 -> 2 information needed for the external weak setup.
373  vector<Vec4> weakMomenta;
374  vector<int> weak2to2lines;
375  int weakHardSize;
376 
377  // Store uncertainty variations relevant to TimeShower.
378  int nUncertaintyVariations, nVarQCD, uVarNflavQ;
379  map<int,double> varG2GGmuRfac;
380  map<int,double> varQ2QGmuRfac, varG2QQmuRfac, varX2XGmuRfac;
381  map<int,double> varG2GGcNS, varQ2QGcNS, varG2QQcNS, varX2XGcNS;
382  map<int,double>* varPDFplus;
383  map<int,double>* varPDFminus;
384  map<int,double>* varPDFmember;
385 
386 };
387 
388 //==========================================================================
389 
390 } // end namespace Pythia8
391 
392 #endif // Pythia8_TimeShower_H
Definition: AgUStep.h:26