1 // PhaseSpace.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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.
6 // Header file for phase space generators in kinematics selection.
7 // PhaseSpace: base class for phase space generators.
8 // Base class for derived classes> 2 ->1 , 2 -> 2, 2 -> 2 elastic/diffractive,
9 // 2 -> 2 minbias, 2 -> 3, Les Houches.
11 #ifndef Pythia8_PhaseSpace_H
12 #define Pythia8_PhaseSpace_H
15 #include "BeamParticle.h"
17 #include "LesHouches.h"
18 #include "MultipleInteractions.h"
19 #include "ParticleData.h"
20 #include "PartonDistributions.h"
21 #include "PythiaStdlib.h"
22 #include "SigmaProcess.h"
23 #include "SigmaTotal.h"
25 #include "StandardModel.h"
26 #include "UserHooks.h"
30 //==========================================================================
32 // Forward reference to the UserHooks class.
35 //==========================================================================
37 // PhaseSpace is a base class for phase space generators
38 // used in the selection of hard-process kinematics.
45 virtual ~PhaseSpace() {}
47 // Perform simple initialization and store pointers.
48 void init(bool isFirst, SigmaProcess* sigmaProcessPtrIn,
49 Info* infoPtrIn, Settings* settingsPtrIn, ParticleData* particleDataPtrIn,
50 Rndm* rndmPtrIn, BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
51 Couplings* couplingsPtrIn, SigmaTotal* sigmaTotPtrIn, UserHooks* userHooksPtrIn);
53 // Update the CM energy of the event.
54 void newECM(double eCMin) {eCM = eCMin; s = eCM * eCM;}
56 // Store or replace Les Houches pointer.
57 void setLHAPtr(LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;}
59 // A pure virtual method, wherein an optimization procedure
60 // is used to determine how phase space should be sampled.
61 virtual bool setupSampling() = 0;
63 // A pure virtual method, wherein a trial event kinematics
64 // is to be selected in the derived class.
65 virtual bool trialKin(bool inEvent = true, bool repeatSame = false) = 0;
67 // A pure virtual method, wherein the accepted event kinematics
68 // is to be constructed in the derived class.
69 virtual bool finalKin() = 0;
71 // Allow for nonisotropic decays when ME's available.
72 void decayKinematics( Event& process);
74 // Give back current or maximum cross section, or set latter.
75 double sigmaNow() const {return sigmaNw;}
76 double sigmaMax() const {return sigmaMx;}
77 bool newSigmaMax() const {return newSigmaMx;}
78 void setSigmaMax(double sigmaMaxIn) {sigmaMx = sigmaMaxIn;}
80 // For Les Houches with negative event weight needs
81 virtual double sigmaSumSigned() const {return sigmaMx;}
83 // Give back constructed four-vectors and known masses.
84 Vec4 p(int i) const {return pH[i];}
85 double m(int i) const {return mH[i];}
87 // Give back other event properties.
88 double ecm() const {return eCM;}
89 double x1() const {return x1H;}
90 double x2() const {return x2H;}
91 double sHat() const {return sH;}
92 double tHat() const {return tH;}
93 double uHat() const {return uH;}
94 double pTHat() const {return pTH;}
95 double thetaHat() const {return theta;}
96 double phiHat() const {return phi;}
97 double runBW3() const {return runBW3H;}
98 double runBW4() const {return runBW4H;}
99 double runBW5() const {return runBW5H;}
101 // Inform whether beam particles are resolved in partons or scatter directly.
102 virtual bool isResolved() const {return true;}
109 // Constants: could only be changed in the code itself.
110 static const int NMAXTRY, NTRY3BODY;
111 static const double SAFETYMARGIN, TINY, EVENFRAC, SAMESIGMA, WIDTHMARGIN,
112 SAMEMASS, MASSMARGIN, EXTRABWWTMAX, THRESHOLDSIZE,
113 THRESHOLDSTEP, YRANGEMARGIN, LEPTONXMIN, LEPTONXMAX,
114 LEPTONXLOGMIN, LEPTONXLOGMAX, LEPTONTAUMIN,
115 SHATMINZ, PT2RATMINZ, WTCORRECTION[11];
117 // Pointer to cross section.
118 SigmaProcess* sigmaProcessPtr;
120 // Pointer to various information on the generation.
123 // Pointer to the settings database.
124 Settings* settingsPtr;
126 // Pointer to the particle data table.
127 ParticleData* particleDataPtr;
129 // Pointer to the random number generator.
132 // Pointers to incoming beams.
133 BeamParticle* beamAPtr;
134 BeamParticle* beamBPtr;
136 // Pointer to Standard Model couplings.
137 Couplings* couplingsPtr;
139 // Pointer to the total/elastic/diffractive cross section object.
140 SigmaTotal* sigmaTotPtr;
142 // Pointer to userHooks object for user interaction with program.
143 UserHooks* userHooksPtr;
145 // Pointer to LHAup for generating external events.
148 // Initialization data, normally only set once.
149 bool useBreitWigners, doEnergySpread, showSearch, showViolation,
152 double mHatGlobalMin, mHatGlobalMax, pTHatGlobalMin, pTHatGlobalMax,
153 pTHatMinDiverge, minWidthBreitWigners;
155 // Information on incoming beams.
157 double mA, mB, eCM, s;
158 bool hasLeptonBeams, hasPointLeptons;
160 // Cross section information.
161 bool newSigmaMx, canModifySigma;
163 double wtBW, sigmaNw, sigmaMx, sigmaPos, sigmaNeg;
165 // Process-specific kinematics properties, almost always available.
166 double mHatMin, mHatMax, sHatMin, sHatMax, pTHatMin, pTHatMax,
167 pT2HatMin, pT2HatMax;
169 // Event-specific kinematics properties, almost always available.
170 double x1H, x2H, m3, m4, m5, s3, s4, s5, mHat, sH, tH, uH, pAbs, p2Abs,
171 pTH, theta, phi, betaZ;
175 // Reselect decay products momenta isotropically in phase space.
176 void decayKinematicsStep( Event& process, int iRes);
178 // Much common code for normal 2 -> 1, 2 -> 2 and 2 -> 3 cases:
180 // Determine how phase space should be sampled.
182 bool setupSampling123(bool is2, bool is3, ostream& os = cout);
184 // Select a trial kinematics phase space point.
185 bool trialKin123(bool is2, bool is3, bool inEvent = true, ostream& os = cout);
187 // Presence and properties of any s-channel resonances.
189 double mResA, mResB, GammaResA, GammaResB, tauResA, tauResB, widResA,
193 // Kinematics properties specific to 2 -> 1/2/3.
194 bool useMirrorWeight;
195 double tau, y, z, tauMin, tauMax, yMax, zMin, zMax, ratio34, unity34,
196 zNeg, zPos, wtTau, wtY, wtZ, wt3Body, runBW3H, runBW4H, runBW5H,
197 intTau0, intTau1, intTau2, intTau3, intTau4, intTau5, intTau6,
198 intY0, intY12, intY34, intY56, mTchan1, sTchan1, mTchan2, sTchan2,
199 frac3Flat, frac3Pow1, frac3Pow2;
200 Vec4 p3cm, p4cm, p5cm;
202 // Coefficients for optimized selection in 2 -> 1/2/3.
204 double tauCoef[8], yCoef[8], zCoef[8], tauCoefSum[8], yCoefSum[8],
207 // Calculate kinematical limits for 2 -> 1/2/3.
208 bool limitTau(bool is2, bool is3);
212 // Select kinematical variable between defined limits for 2 -> 1/2/3.
213 void selectTau(int iTau, double tauVal, bool is2);
214 void selectY(int iY, double yVal);
215 void selectZ(int iZ, double zVal);
218 // Solve equation system for better phase space coefficients in 2 -> 1/2/3.
219 void solveSys( int n, int bin[8], double vec[8], double mat[8][8],
220 double coef[8], ostream& os = cout);
222 // Properties specific to resonance mass selection in 2 -> 2 and 2 -> 3.
225 double mPeak[6], sPeak[6], mWidth[6], mMin[6], mMax[6], mw[6], wmRat[6],
226 mLower[6], mUpper[6], sLower[6], sUpper[6], fracFlat[6], fracInv[6],
227 fracInv2[6], atanLower[6], atanUpper[6], intBW[6], intFlat[6],
228 intInv[6], intInv2[6];
230 // Setup mass selection for one resonance at a time. Split in two parts.
231 void setupMass1(int iM);
232 void setupMass2(int iM, double distToThresh);
234 // Do mass selection and find the associated weight.
235 void trialMass(int iM);
236 double weightMass(int iM);
240 //==========================================================================
242 // A derived class with 2 -> 1 kinematics set up in tau, y.
244 class PhaseSpace2to1tauy : public PhaseSpace {
249 PhaseSpace2to1tauy() {}
251 // Optimize subsequent kinematics selection.
252 virtual bool setupSampling() {if (!setupMass()) return false;
253 return setupSampling123(false, false);}
255 // Construct the trial kinematics.
256 virtual bool trialKin(bool inEvent = true, bool = false) {wtBW = 1.;
257 return trialKin123(false, false, inEvent);}
259 // Construct the final event kinematics.
260 virtual bool finalKin();
264 // Set up allowed mass range.
269 //==========================================================================
271 // A derived class with 2 -> 2 kinematics set up in tau, y, z = cos(theta).
273 class PhaseSpace2to2tauyz : public PhaseSpace {
278 PhaseSpace2to2tauyz() {}
280 // Optimize subsequent kinematics selection.
281 virtual bool setupSampling() {if (!setupMasses()) return false;
282 return setupSampling123(true, false);}
284 // Construct the trial kinematics.
285 virtual bool trialKin(bool inEvent = true, bool = false) {
286 if (!trialMasses()) return false;
287 return trialKin123(true, false, inEvent);}
289 // Construct the final event kinematics.
290 virtual bool finalKin();
294 // Set up for fixed or Breit-Wigner mass selection.
297 // Select fixed or Breit-Wigner-distributed masses.
300 // Pick off-shell initialization masses when on-shell not allowed.
301 bool constrainedM3M4();
302 bool constrainedM3();
303 bool constrainedM4();
307 //==========================================================================
309 // A derived class with 2 -> 2 kinematics set up for elastic scattering.
311 class PhaseSpace2to2elastic : public PhaseSpace {
316 PhaseSpace2to2elastic() {}
318 // Construct the trial or final event kinematics.
319 virtual bool setupSampling();
320 virtual bool trialKin(bool inEvent = true, bool = false);
321 virtual bool finalKin();
323 // Are beam particles resolved in partons or scatter directly?
324 virtual bool isResolved() const {return false;}
328 // Constants: could only be changed in the code itself.
329 static const double EXPMAX, CONVERTEL;
331 // Kinematics properties specific to 2 -> 2 elastic.
333 double s1, s2, bSlope, lambda12S, tLow, tUpp, tAux, sigmaTot, rho,
334 lambda, tAbsMin, phaseCst, alphaEM0, sigmaNuc, sigmaCou, signCou;
336 // Calculation of alphaElectromagnetic.
341 //==========================================================================
343 // A derived class with 2 -> 2 kinematics set up for diffractive scattering.
345 class PhaseSpace2to2diffractive : public PhaseSpace {
350 PhaseSpace2to2diffractive(bool isDiffAin = false, bool isDiffBin = false)
351 : isDiffA(isDiffAin), isDiffB(isDiffBin) {}
353 // Construct the trial or final event kinematics.
354 virtual bool setupSampling();
355 virtual bool trialKin(bool inEvent = true, bool = false);
356 virtual bool finalKin();
358 // Are beam particles resolved in partons or scatter directly?
359 virtual bool isResolved() const {return false;}
363 // Constants: could only be changed in the code itself.
364 static const int NTRY;
365 static const double EXPMAX, DIFFMASSMAX;
367 // Initialization data, in constructor or read from Settings.
368 bool isDiffA, isDiffB;
370 double epsilonPF, alphaPrimePF;
372 // Initialization: kinematics properties specific to 2 -> 2 diffractive.
373 double m3ElDiff, m4ElDiff, s1, s2, lambda12, lambda34, tLow, tUpp,
374 cRes, sResXB, sResAX, sProton, bMin, bSlope, bSlope1, bSlope2,
375 probSlope1, xIntPF, xtCorPF, mp24DL, coefDL, tAux, tAux1, tAux2;
379 //==========================================================================
381 // A derived class for minumum bias events. Hardly does anything, since
382 // the real action is taken care of by the MultipleInteractions class.
384 class PhaseSpace2to2minbias : public PhaseSpace {
389 PhaseSpace2to2minbias() {}
391 // Construct the trial or final event kinematics.
392 virtual bool setupSampling() {sigmaNw = sigmaProcessPtr->sigmaHat();
393 sigmaMx = sigmaNw; return true;}
394 virtual bool trialKin( bool , bool = false) {return true;}
395 virtual bool finalKin() {return true;}
401 //==========================================================================
403 // A derived class with 2 -> 3 kinematics 1 + 2 -> 3 + 4 + 5 set up in
404 // tau, y, pT2_4, pT2_5, phi_4, phi_5 and y_3 (partial cylindrical symmetry).
406 class PhaseSpace2to3tauycyl : public PhaseSpace {
411 PhaseSpace2to3tauycyl() {}
413 // Optimize subsequent kinematics selection.
414 virtual bool setupSampling() {if (!setupMasses()) return false;
415 setup3Body(); return setupSampling123(false, true);}
417 // Construct the trial kinematics.
418 virtual bool trialKin(bool inEvent = true, bool = false) {
419 if (!trialMasses()) return false;
420 return trialKin123(false, true, inEvent);}
422 // Construct the final event kinematics.
423 virtual bool finalKin();
427 // Constants: could only be changed in the code itself.
428 static const int NITERNR;
430 // Set up for fixed or Breit-Wigner mass selection.
433 // Select fixed or Breit-Wigner-distributed masses.
438 //==========================================================================
440 // A derived class with 2 -> 3 kinematics 1 + 2 -> 3 + 4 + 5 set up in
441 // y3, y4, y5, pT2_3, pT2_5, phi_3 and phi_5, and with R separation cut.
442 // Intended specifically for (essentially massless) 2 -> 3 QCD processes.
444 class PhaseSpace2to3yyycyl : public PhaseSpace {
449 PhaseSpace2to3yyycyl() {}
451 // Optimize subsequent kinematics selection.
452 virtual bool setupSampling();
454 // Construct the trial kinematics.
455 virtual bool trialKin(bool inEvent = true, bool = false);
457 // Construct the final event kinematics.
458 virtual bool finalKin();
462 // Phase space cuts specifically for 2 -> 3 QCD processes.
463 double pTHat3Min, pTHat3Max, pTHat5Min, pTHat5Max, RsepMin, R2sepMin;
466 // Event kinematics choices.
467 double pT3Min, pT3Max, pT5Min, pT5Max, y3Max, y4Max, y5Max,
468 pT3, pT4, pT5, phi3, phi4, phi5, y3, y4, y5, dphi;
473 //==========================================================================
475 // A derived class for Les Houches events.
477 class PhaseSpaceLHA : public PhaseSpace {
482 PhaseSpaceLHA() {idProcSave = 0;}
484 // Find maximal cross section for comparison with internal processes.
485 virtual bool setupSampling();
487 // Construct the next process, by interface to Les Houches class.
488 virtual bool trialKin( bool , bool repeatSame = false);
490 // Set scale, alpha_s and alpha_em if not done.
491 virtual bool finalKin() {sigmaProcessPtr->setScale(); return true;}
493 // For Les Houches with negative event weight needs
494 virtual double sigmaSumSigned() const {return sigmaSgn;}
499 static const double CONVERTPB2MB;
502 int strategy, stratAbs, nProc, idProcSave;
503 double xMaxAbsSum, xSecSgnSum, sigmaSgn;
505 vector<double> xMaxAbsProc;
509 //==========================================================================
511 } // end namespace Pythia8
513 #endif // Pythia8_PhaseSpace_H