11 #ifndef Pythia8_PhaseSpace_H
12 #define Pythia8_PhaseSpace_H
14 #include "Pythia8/Basics.h"
15 #include "Pythia8/BeamParticle.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/LesHouches.h"
18 #include "Pythia8/MultipartonInteractions.h"
19 #include "Pythia8/ParticleData.h"
20 #include "Pythia8/PartonDistributions.h"
21 #include "Pythia8/PhysicsBase.h"
22 #include "Pythia8/PythiaStdlib.h"
23 #include "Pythia8/SigmaProcess.h"
24 #include "Pythia8/SigmaTotal.h"
25 #include "Pythia8/Settings.h"
26 #include "Pythia8/StandardModel.h"
27 #include "Pythia8/UserHooks.h"
28 #include "Pythia8/GammaKinematics.h"
42 class PhaseSpace :
public PhysicsBase {
47 virtual ~PhaseSpace() {}
50 void init(
bool isFirst, SigmaProcess* sigmaProcessPtrIn);
53 void newECM(
double eCMin) {eCM = eCMin; s = eCM * eCM;}
56 void setLHAPtr(LHAupPtr lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;}
60 virtual bool setupSampling() = 0;
64 virtual bool trialKin(
bool inEvent =
true,
bool repeatSame =
false) = 0;
68 virtual bool finalKin() = 0;
71 void decayKinematics(
Event& process);
74 double sigmaNow()
const {
return sigmaNw;}
75 double sigmaMax()
const {
return sigmaMx;}
76 double biasSelectionWeight()
const {
return biasWt;}
77 bool newSigmaMax()
const {
return newSigmaMx;}
78 void setSigmaMax(
double sigmaMaxIn) {sigmaMx = sigmaMaxIn;}
81 virtual double sigmaSumSigned()
const {
return sigmaMx;}
84 Vec4 p(
int i)
const {
return pH[i];}
85 double m(
int i)
const {
return mH[i];}
88 void setP(
int i, Vec4 pNew) { pH[i] = pNew; }
91 double ecm()
const {
return eCM;}
92 double x1()
const {
return x1H;}
93 double x2()
const {
return x2H;}
94 double sHat()
const {
return sH;}
95 double tHat()
const {
return tH;}
96 double uHat()
const {
return uH;}
97 double pTHat()
const {
return pTH;}
98 double thetaHat()
const {
return theta;}
99 double phiHat()
const {
return phi;}
100 double runBW3()
const {
return runBW3H;}
101 double runBW4()
const {
return runBW4H;}
102 double runBW5()
const {
return runBW5H;}
105 virtual bool isResolved()
const {
return true;}
109 virtual void rescaleSigma(
double){}
110 virtual void rescaleMomenta(
double){}
113 virtual double weightGammaPDFApprox(){
return 1.;}
116 virtual void setGammaKinPtr( GammaKinematics* gammaKinPtrIn) {
117 gammaKinPtr = gammaKinPtrIn; }
122 PhaseSpace() : sigmaProcessPtr(), lhaUpPtr(), gammaKinPtr(),
123 useBreitWigners(), doEnergySpread(), showSearch(), showViolation(),
124 increaseMaximum(), hasQ2Min(), gmZmodeGlobal(), mHatGlobalMin(),
125 mHatGlobalMax(), pTHatGlobalMin(), pTHatGlobalMax(), Q2GlobalMin(),
126 pTHatMinDiverge(), minWidthBreitWigners(), minWidthNarrowBW(), idA(),
127 idB(), idAgm(), idBgm(), mA(), mB(), eCM(), s(), sigmaMxGm(),
128 hasLeptonBeamA(), hasLeptonBeamB(), hasOneLeptonBeam(),
129 hasTwoLeptonBeams(), hasPointGammaA(), hasPointGammaB(),
130 hasOnePointParticle(), hasTwoPointParticles(), hasGamma(),
131 hasVMD(), newSigmaMx(),
132 canModifySigma(), canBiasSelection(), canBias2Sel(), gmZmode(),
133 bias2SelPow(), bias2SelRef(), wtBW(), sigmaNw(),
134 sigmaMx(), sigmaPos(), sigmaNeg(), biasWt(), mHatMin(), mHatMax(),
135 sHatMin(), sHatMax(), pTHatMin(), pTHatMax(), pT2HatMin(), pT2HatMax(),
136 x1H(), x2H(), m3(), m4(), m5(), s3(), s4(), s5(), mHat(), sH(), tH(), uH(),
137 pAbs(), p2Abs(), pTH(), theta(), phi(), betaZ(), mH(), idResA(), idResB(),
138 mResA(), mResB(), GammaResA(), GammaResB(), tauResA(), tauResB(),
139 widResA(), widResB(), sameResMass(), useMirrorWeight(), hasNegZ(),
140 hasPosZ(), tau(), y(), z(), tauMin(), tauMax(), yMax(), zMin(), zMax(),
141 ratio34(), unity34(), zNeg(), zPos(), wtTau(), wtY(), wtZ(), wt3Body(),
142 runBW3H(), runBW4H(), runBW5H(), intTau0(), intTau1(), intTau2(),
143 intTau3(), intTau4(), intTau5(), intTau6(), intY0(), intY12(), intY34(),
144 intY56(), mTchan1(), sTchan1(), mTchan2(), sTchan2(), frac3Flat(),
145 frac3Pow1(), frac3Pow2(), zNegMin(), zNegMax(), zPosMin(), zPosMax(),
146 nTau(), nY(), nZ(), tauCoef(), yCoef(), zCoef(), tauCoefSum(), yCoefSum(),
147 zCoefSum(), useBW(), useNarrowBW(), idMass(), mPeak(), sPeak(), mWidth(),
148 mMin(), mMax(), mw(), wmRat(), mLower(), mUpper(), sLower(), sUpper(),
149 fracFlatS(), fracFlatM(), fracInv(), fracInv2(), atanLower(), atanUpper(),
150 intBW(), intFlatS(), intFlatM(), intInv(), intInv2() {}
153 static const int NMAXTRY, NTRY3BODY;
154 static const double SAFETYMARGIN, TINY, EVENFRAC, SAMESIGMA, MRESMINABS,
155 WIDTHMARGIN, SAMEMASS, MASSMARGIN, EXTRABWWTMAX,
156 THRESHOLDSIZE, THRESHOLDSTEP, YRANGEMARGIN, LEPTONXMIN,
157 LEPTONXMAX, LEPTONXLOGMIN, LEPTONXLOGMAX, LEPTONTAUMIN,
158 SHATMINZ, PT2RATMINZ, WTCORRECTION[11];
161 SigmaProcess* sigmaProcessPtr;
167 GammaKinematics* gammaKinPtr;
170 bool useBreitWigners, doEnergySpread, showSearch, showViolation,
171 increaseMaximum, hasQ2Min;
173 double mHatGlobalMin, mHatGlobalMax, pTHatGlobalMin, pTHatGlobalMax,
174 Q2GlobalMin, pTHatMinDiverge, minWidthBreitWigners, minWidthNarrowBW;
177 int idA, idB, idAgm, idBgm;
178 double mA, mB, eCM, s, sigmaMxGm;
179 bool hasLeptonBeamA, hasLeptonBeamB, hasOneLeptonBeam, hasTwoLeptonBeams,
180 hasPointGammaA, hasPointGammaB, hasOnePointParticle,
181 hasTwoPointParticles, hasGamma, hasVMD;
184 bool newSigmaMx, canModifySigma, canBiasSelection, canBias2Sel;
186 double bias2SelPow, bias2SelRef, wtBW, sigmaNw, sigmaMx, sigmaPos,
190 double mHatMin, mHatMax, sHatMin, sHatMax, pTHatMin, pTHatMax,
191 pT2HatMin, pT2HatMax;
194 double x1H, x2H, m3, m4, m5, s3, s4, s5, mHat, sH, tH, uH, pAbs, p2Abs,
195 pTH, theta, phi, betaZ;
200 void decayKinematicsStep(
Event& process,
int iRes);
206 bool setupSampling123(
bool is2,
bool is3);
209 bool trialKin123(
bool is2,
bool is3,
bool inEvent =
true);
213 double mResA, mResB, GammaResA, GammaResB, tauResA, tauResB, widResA,
218 bool useMirrorWeight, hasNegZ, hasPosZ;
219 double tau, y, z, tauMin, tauMax, yMax, zMin, zMax, ratio34, unity34,
220 zNeg, zPos, wtTau, wtY, wtZ, wt3Body, runBW3H, runBW4H, runBW5H,
221 intTau0, intTau1, intTau2, intTau3, intTau4, intTau5, intTau6,
222 intY0, intY12, intY34, intY56, mTchan1, sTchan1, mTchan2, sTchan2,
223 frac3Flat, frac3Pow1, frac3Pow2, zNegMin, zNegMax, zPosMin, zPosMax;
224 Vec4 p3cm, p4cm, p5cm;
228 double tauCoef[8], yCoef[8], zCoef[8], tauCoefSum[8], yCoefSum[8],
232 bool limitTau(
bool is2,
bool is3);
237 void selectTau(
int iTau,
double tauVal,
bool is2);
238 void selectY(
int iY,
double yVal);
239 void selectZ(
int iZ,
double zVal);
243 void solveSys(
int n,
int bin[8],
double vec[8],
double mat[8][8],
247 bool useBW[6], useNarrowBW[6];
249 double mPeak[6], sPeak[6], mWidth[6], mMin[6], mMax[6], mw[6], wmRat[6],
250 mLower[6], mUpper[6], sLower[6], sUpper[6], fracFlatS[6],
251 fracFlatM[6], fracInv[6], fracInv2[6], atanLower[6], atanUpper[6],
252 intBW[6], intFlatS[6], intFlatM[6], intInv[6], intInv2[6];
255 void setupMass1(
int iM);
256 void setupMass2(
int iM,
double distToThresh);
259 void trialMass(
int iM);
260 double weightMass(
int iM);
264 pair<double,double> tRange(
double sIn,
double s1In,
double s2In,
265 double s3In,
double s4In) {
266 double lambda12 = pow2( sIn - s1In - s2In) - 4. * s1In * s2In;
267 double lambda34 = pow2( sIn - s3In - s4In) - 4. * s3In * s4In;
268 if (lambda12 < 0. || lambda34 < 0.)
return make_pair( 0., 0.);
269 double tLow = -0.5 * (sIn - (s1In + s2In + s3In + s4In) + (s1In - s2In)
270 * (s3In - s4In) / sIn + sqrtpos(lambda12 * lambda34) / sIn);
271 double tUpp = ( (s3In - s1In) * (s4In - s2In) + (s1In + s4In - s2In - s3In)
272 * (s1In * s4In - s2In * s3In) / sIn ) / tLow;
273 return make_pair( tLow, tUpp); }
274 bool tInRange(
double tIn,
double sIn,
double s1In,
double s2In,
275 double s3In,
double s4In) {
276 pair<double, double> tRng = tRange( sIn, s1In, s2In, s3In, s4In);
277 return (tIn > tRng.first && tIn < tRng.second); }
291 class PhaseSpace2to1tauy :
public PhaseSpace {
296 PhaseSpace2to1tauy() {}
299 virtual bool setupSampling() {
if (!setupMass())
return false;
300 return setupSampling123(
false,
false);}
303 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {wtBW = 1.;
304 return trialKin123(
false,
false, inEvent);}
307 virtual bool finalKin();
320 class PhaseSpace2to2tauyz :
public PhaseSpace {
325 PhaseSpace2to2tauyz() {}
328 virtual bool setupSampling() {
if (!setupMasses())
return false;
329 return setupSampling123(
true,
false);}
332 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {
333 if (!trialMasses())
return false;
334 return trialKin123(
true,
false, inEvent);}
337 virtual bool finalKin();
341 virtual void rescaleMomenta (
double sHatNew);
344 virtual void rescaleSigma (
double sHatNew);
347 virtual double weightGammaPDFApprox();
358 bool constrainedM3M4();
359 bool constrainedM3();
360 bool constrainedM4();
368 class PhaseSpace2to2elastic :
public PhaseSpace {
373 PhaseSpace2to2elastic() : isOneExp(), useCoulomb(), s1(), s2(), alphaEM0(),
374 lambda12S(), lambda12(), lambda34(), tempA(), tempB(), tempC(),
375 tLow(), tUpp(), bSlope1(), bSlope2(), sigRef1(), sigRef2(),
376 sigRef(), sigNorm1(), sigNorm2(), sigNorm3(), sigNormSum(), rel2() {}
379 virtual bool setupSampling();
380 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
381 virtual bool finalKin();
384 virtual bool isResolved()
const {
return false;}
389 static const int NTRY;
390 static const double BNARROW, BWIDE, WIDEFRAC, TOFFSET;
393 bool isOneExp, useCoulomb;
394 double s1, s2, alphaEM0, lambda12S, lambda12, lambda34, tempA, tempB, tempC,
395 tLow, tUpp, bSlope1, bSlope2, sigRef1, sigRef2, sigRef,
396 sigNorm1, sigNorm2, sigNorm3, sigNormSum, rel2;
404 class PhaseSpace2to2diffractive :
public PhaseSpace {
409 PhaseSpace2to2diffractive(
bool isDiffAin =
false,
bool isDiffBin =
false)
410 : isDiffA(isDiffAin), isDiffB(isDiffBin), splitxit(), m3ElDiff(),
411 m4ElDiff(), s1(), s2(), xiMin(), xiMax(), xiNow(), sigNow(), sigMax(),
412 sigMaxNow(), lambda12(), lambda34(), bNow(), tempA(), tempB(), tempC(),
413 tLow(), tUpp(), tWeight(), fWid1(), fWid2(), fWid3(), fWid4(), fbWid1(),
414 fbWid2(), fbWid3(), fbWid4(), fbWid1234() {isSD = !isDiffA || !isDiffB;}
417 virtual bool setupSampling();
418 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
419 virtual bool finalKin();
422 virtual bool isResolved()
const {
return false;}
427 static const int NTRY;
428 static const double BWID1, BWID2, BWID3, BWID4, FWID1SD, FWID2SD, FWID3SD,
429 FWID4SD, FWID1DD, FWID2DD, FWID3DD, FWID4DD, MAXFUDGESD,
430 MAXFUDGEDD, MAXFUDGET, DIFFMASSMARGIN, SPROTON;
433 bool isDiffA, isDiffB, isSD, splitxit;
436 double m3ElDiff, m4ElDiff, s1, s2, xiMin, xiMax, xiNow, sigNow, sigMax,
437 sigMaxNow, lambda12, lambda34, bNow, tempA, tempB, tempC,
438 tLow, tUpp, tWeight, fWid1, fWid2, fWid3, fWid4, fbWid1, fbWid2,
439 fbWid3, fbWid4, fbWid1234;
448 class PhaseSpace2to3diffractive :
public PhaseSpace {
453 PhaseSpace2to3diffractive() : PhaseSpace(), splitxit(), s1(), s2(), m5min(),
454 s5min(), sigNow(), sigMax(), sigMaxNow(), xiMin(), xi1(), xi2(), fWid1(),
455 fWid2(), fWid3(), fbWid1(), fbWid2(), fbWid3(), fbWid123() {}
458 virtual bool setupSampling();
459 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
460 virtual bool finalKin();
463 virtual bool isResolved()
const {
return false;}
468 static const int NTRY;
469 static const double BWID1, BWID2, BWID3, BWID4, FWID1, FWID2, FWID3,
470 MAXFUDGECD, MAXFUDGET, DIFFMASSMARGIN;
476 double s1, s2, m5min, s5min, sigNow, sigMax, sigMaxNow, xiMin, xi1, xi2,
477 fWid1, fWid2, fWid3, fbWid1, fbWid2, fbWid3, fbWid123;
478 Vec4 p1, p2, p3, p4, p5;
484 class PhaseSpace2to2nondiffractive :
public PhaseSpace {
492 PhaseSpace2to2nondiffractive() {}
495 virtual bool setupSampling();
496 virtual bool trialKin(
bool ,
bool =
false);
497 virtual bool finalKin() {
if (hasGamma) gammaKinPtr->finalize();
509 class PhaseSpace2to3tauycyl :
public PhaseSpace {
514 PhaseSpace2to3tauycyl() {}
517 virtual bool setupSampling() {
if (!setupMasses())
return false;
518 setup3Body();
return setupSampling123(
false,
true);}
521 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {
522 if (!trialMasses())
return false;
523 return trialKin123(
false,
true, inEvent);}
526 virtual bool finalKin();
531 static const int NITERNR;
547 class PhaseSpace2to3yyycyl :
public PhaseSpace {
552 PhaseSpace2to3yyycyl() : pTHat3Min(), pTHat3Max(), pTHat5Min(), pTHat5Max(),
553 RsepMin(), R2sepMin(), hasBaryonBeams(), pT3Min(), pT3Max(), pT5Min(),
554 pT5Max(), y3Max(), y4Max(), y5Max(), pT3(), pT4(), pT5(), phi3(), phi4(),
555 phi5(), y3(), y4(), y5(), dphi() {}
558 virtual bool setupSampling();
561 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
564 virtual bool finalKin();
569 double pTHat3Min, pTHat3Max, pTHat5Min, pTHat5Max, RsepMin, R2sepMin;
573 double pT3Min, pT3Max, pT5Min, pT5Max, y3Max, y4Max, y5Max,
574 pT3, pT4, pT5, phi3, phi4, phi5, y3, y4, y5, dphi;
583 class PhaseSpaceLHA :
public PhaseSpace {
588 PhaseSpaceLHA() : strategy(), stratAbs(), nProc(), idProcSave(0),
589 xMaxAbsSum(), xSecSgnSum(), sigmaSgn() {}
592 virtual bool setupSampling();
595 virtual bool trialKin(
bool ,
bool repeatSame =
false);
598 virtual bool finalKin() {sigmaProcessPtr->setScale();
return true;}
601 virtual double sigmaSumSigned()
const {
return sigmaSgn;}
606 static const double CONVERTPB2MB;
609 int strategy, stratAbs, nProc, idProcSave;
610 double xMaxAbsSum, xSecSgnSum, sigmaSgn;
612 vector<double> xMaxAbsProc;
620 #endif // Pythia8_PhaseSpace_H