]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8170/include/TimeShower.h
Update to pythi8.170
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8170 / include / TimeShower.h
1 // TimeShower.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, 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 "Basics.h"
14 #include "BeamParticle.h"
15 #include "Event.h"
16 #include "Info.h"
17 #include "ParticleData.h"
18 #include "PartonSystems.h"
19 #include "PythiaStdlib.h"
20 #include "Settings.h"
21 #include "StandardModel.h"
22 #include "UserHooks.h"
23
24 namespace Pythia8 {
25
26 //==========================================================================
27
28 // Data on radiating dipole ends; only used inside TimeShower class.
29
30 class TimeDipoleEnd {
31
32 public:
33
34   // Constructors.
35   TimeDipoleEnd() : iRadiator(-1), iRecoiler(-1), pTmax(0.), colType(0), 
36     chgType(0), gamType(0), isrType(0), system(0), systemRec(0), MEtype(0), 
37     iMEpartner(-1), isOctetOnium(false), isHiddenValley(false), colvType(0),
38     MEmix(0.), MEorder(true), MEsplit(true), MEgluinoRec(false),
39     isFlexible(false) { }  
40   TimeDipoleEnd(int iRadiatorIn, int iRecoilerIn, double pTmaxIn = 0., 
41     int colIn = 0, int chgIn = 0, int gamIn = 0, int isrIn = 0, 
42     int systemIn = 0, int MEtypeIn = 0, int iMEpartnerIn = -1, 
43     bool isOctetOniumIn = false, bool isHiddenValleyIn = false,
44     int colvTypeIn = 0, double MEmixIn = 0., bool MEorderIn = true, 
45     bool MEsplitIn = true, bool MEgluinoRecIn = false, 
46     bool isFlexibleIn = false) : 
47     iRadiator(iRadiatorIn), iRecoiler(iRecoilerIn), pTmax(pTmaxIn), 
48     colType(colIn), chgType(chgIn), gamType(gamIn), isrType(isrIn), 
49     system(systemIn), systemRec(systemIn) , MEtype(MEtypeIn), 
50     iMEpartner(iMEpartnerIn), isOctetOnium(isOctetOniumIn), 
51     isHiddenValley(isHiddenValleyIn), colvType(colvTypeIn), MEmix(MEmixIn), 
52     MEorder (MEorderIn), MEsplit(MEsplitIn), MEgluinoRec(MEgluinoRecIn),
53     isFlexible(isFlexibleIn)  { }
54
55   // Basic properties related to dipole and matrix element corrections.
56   int    iRadiator, iRecoiler;
57   double pTmax;
58   int    colType, chgType, gamType, isrType, system, systemRec,
59          MEtype, iMEpartner;
60   bool   isOctetOnium, isHiddenValley;
61   int    colvType;
62   double MEmix;
63   bool   MEorder, MEsplit, MEgluinoRec;
64   bool   isFlexible;
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;   
70   
71 } ;
72
73 //==========================================================================
74
75 // The TimeShower class does timelike showers.
76
77 class TimeShower {
78
79 public:
80
81   // Constructor.
82   TimeShower() {beamOffset = 0;}
83
84   // Destructor.
85   virtual ~TimeShower() {}
86
87   // Initialize various pointers. 
88   // (Separated from rest of init since not virtual.)
89   void initPtr(Info* infoPtrIn, Settings* settingsPtrIn, 
90     ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
91     CoupSM* coupSMPtrIn, PartonSystems* partonSystemsPtrIn, 
92     UserHooks* userHooksPtrIn) { infoPtr = infoPtrIn; 
93     settingsPtr = settingsPtrIn; particleDataPtr = particleDataPtrIn; 
94     rndmPtr = rndmPtrIn; coupSMPtr = coupSMPtrIn;
95     partonSystemsPtr = partonSystemsPtrIn; userHooksPtr = userHooksPtrIn;}
96
97   // Initialize alphaStrong and related pTmin parameters.
98   virtual void init( BeamParticle* beamAPtrIn = 0, 
99     BeamParticle* beamBPtrIn = 0);
100
101   // New beams possible for handling of hard diffraction. (Not virtual.)
102   void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
103     int beamOffsetIn = 0) {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;
104     beamOffset = beamOffsetIn;}
105
106   // Find whether to limit maximum scale of emissions, and whether to dampen.
107   virtual bool limitPTmax( Event& event, double Q2Fac = 0., 
108     double Q2Ren = 0.);
109
110   // Potential enhancement factor of pTmax scale for hardest emission.
111   double enhancePTmax() {return pTmaxFudge;}
112
113   // Top-level routine to do a full time-like shower in resonance decay.
114   virtual int shower( int iBeg, int iEnd, Event& event, double pTmax,
115     int nBranchMax = 0);
116
117   // Provide the pT scale of the last branching in the above shower.
118   double pTLastInShower() {return pTLastBranch;}
119
120   // Prepare system for evolution after each new interaction; identify ME.
121   virtual void prepare( int iSys, Event& event, bool limitPTmaxIn = true);
122
123   // Update dipole list after a multiparton interactions rescattering.
124   virtual void rescatterUpdate( int iSys, Event& event);
125
126   // Update dipole list after each ISR emission.  
127   virtual void update( int iSys, Event& event);
128
129   // Select next pT in downwards evolution.
130   virtual double pTnext( Event& event, double pTbegAll, double pTendAll);
131
132   // ME corrections and kinematics that may give failure.
133   virtual bool branch( Event& event, bool isInterleaved = false); 
134
135   // Tell which system was the last processed one.
136   int system() const {return iSysSel;}; 
137
138   // Print dipole list; for debug mainly.
139   virtual void list( ostream& os = cout) const;
140
141 protected:
142
143   // Pointer to various information on the generation.
144   Info*          infoPtr;
145
146   // Pointer to the settings database.
147   Settings*      settingsPtr;
148
149   // Pointer to the particle data table.
150   ParticleData*  particleDataPtr;
151
152   // Pointer to the random number generator.
153   Rndm*          rndmPtr;
154
155   // Pointer to Standard Model couplings.
156   CoupSM*        coupSMPtr;
157
158   // Pointers to the two incoming beams. Offset their location in event.
159   BeamParticle*  beamAPtr;
160   BeamParticle*  beamBPtr;
161   int            beamOffset;
162
163   // Pointer to information on subcollision parton locations.
164   PartonSystems* partonSystemsPtr;
165
166   // Pointer to userHooks object for user interaction with program.
167   UserHooks*     userHooksPtr;
168
169   // Store properties to be returned by methods.
170   int    iSysSel;
171   double pTmaxFudge, pTLastBranch;
172
173 private:
174
175   // Constants: could only be changed in the code itself.
176   static const double SIMPLIFYROOT, XMARGIN, XMARGINCOMB, TINYPDF, LARGEM2, 
177                       THRESHM2, LAMBDA3MARGIN;
178   // Rescatter: try to fix up recoil between systems
179   static const bool   FIXRESCATTER, VETONEGENERGY;
180   static const double MAXVIRTUALITYFRACTION, MAXNEGENERGYFRACTION;
181
182   // Initialization data, normally only set once.
183   bool   doQCDshower, doQEDshowerByQ, doQEDshowerByL, doQEDshowerByGamma, 
184          doMEcorrections, doMEafterFirst, doPhiPolAsym, doInterleave, 
185          allowBeamRecoil, dampenBeamRecoil, recoilToColoured, 
186          allowRescatter, canVetoEmission, doHVshower, brokenHVsym,
187          globalRecoil, useLocalRecoilNow;
188   int    pTmaxMatch, pTdampMatch, alphaSorder, nGluonToQuark, 
189          alphaEMorder, nGammaToQuark, nGammaToLepton, nCHV, idHV,
190          nMaxGlobalRecoil;
191   double pTdampFudge, mc, mb, m2c, m2b, renormMultFac, factorMultFac,
192          alphaSvalue, alphaS2pi, Lambda3flav, Lambda4flav, Lambda5flav, 
193          Lambda3flav2, Lambda4flav2, Lambda5flav2, pTcolCutMin, pTcolCut, 
194          pT2colCut, pTchgQCut, pT2chgQCut, pTchgLCut, pT2chgLCut, 
195          mMaxGamma, m2MaxGamma, octetOniumFraction, octetOniumColFac, 
196          mZ, gammaZ, thetaWRat, CFHV, alphaHVfix, pThvCut, pT2hvCut, 
197          mHV, pTmaxFudgeMPI;
198
199   // alphaStrong and alphaEM calculations.
200   AlphaStrong alphaS;
201   AlphaEM     alphaEM;
202
203   // Some current values.
204   bool   dopTdamp;
205   double pT2damp, kRad, kEmt;
206
207   // All dipole ends and a pointer to the selected hardest dipole end.
208   vector<TimeDipoleEnd> dipEnd;
209   TimeDipoleEnd* dipSel;
210   int iDipSel;
211
212   // Setup a dipole end, either QCD, QED/photon or Hidden Valley one.
213   void setupQCDdip( int iSys, int i, int colTag,  int colSign, Event& event,
214     bool isOctetOnium = false, bool limitPTmaxIn = true);
215   void setupQEDdip( int iSys, int i, int chgType, int gamType, Event& event, 
216     bool limitPTmaxIn = true); 
217   void setupHVdip( int iSys, int i, Event& event, bool limitPTmaxIn = true); 
218
219   // Evolve a QCD dipole end. 
220   void pT2nextQCD( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
221     Event& event);
222
223   // Evolve a QED dipole end, either charged or photon. 
224   void pT2nextQED( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
225     Event& event);
226
227   // Evolve a Hidden Valley dipole end. 
228   void pT2nextHV( double pT2begDip, double pT2sel, TimeDipoleEnd& dip,
229     Event& );
230
231   // Find kind of QCD ME correction.
232   void findMEtype( Event& event, TimeDipoleEnd& dip);
233
234   // Find type of particle; used by findMEtype.
235   int findMEparticle( int id, bool isHiddenColour = false);
236
237   // Find mixture of V and A in gamma/Z: energy- and flavour-dependent. 
238   double gammaZmix( Event& event, int iRes, int iDau1, int iDau2);
239
240   // Set up to calculate QCD ME correction with calcMEcorr.
241   double findMEcorr(TimeDipoleEnd* dip, Particle& rad, Particle& partner, 
242    Particle& emt);
243
244   // Calculate value of QCD ME correction.
245   double calcMEcorr( int kind, int combiIn, double mixIn, double x1, 
246     double x2, double r1, double r2, double r3 = 0.);
247
248   // Find coefficient of azimuthal asymmetry from gluon polarization.
249   void findAsymPol( Event& event, TimeDipoleEnd* dip);
250
251   // Rescatter: propagate dipole recoil to internal lines connecting systems.
252   bool rescatterPropagateRecoil( Event& event, Vec4& pNew);
253
254 };
255
256 //==========================================================================
257
258 } // end namespace Pythia8
259
260 #endif // Pythia8_TimeShower_H
261