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/PythiaStdlib.h"
22 #include "Pythia8/SigmaProcess.h"
23 #include "Pythia8/SigmaTotal.h"
24 #include "Pythia8/Settings.h"
25 #include "Pythia8/StandardModel.h"
26 #include "Pythia8/UserHooks.h"
27 #include "Pythia8/GammaKinematics.h"
46 virtual ~PhaseSpace() {}
49 void init(
bool isFirst, SigmaProcess* sigmaProcessPtrIn,
50 Info* infoPtrIn, Settings* settingsPtrIn, ParticleData* particleDataPtrIn,
51 Rndm* rndmPtrIn, BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
52 Couplings* couplingsPtrIn, SigmaTotal* sigmaTotPtrIn,
53 UserHooks* userHooksPtrIn);
56 void newECM(
double eCMin) {eCM = eCMin; s = eCM * eCM;}
59 void setLHAPtr(LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;}
63 virtual bool setupSampling() = 0;
67 virtual bool trialKin(
bool inEvent =
true,
bool repeatSame =
false) = 0;
71 virtual bool finalKin() = 0;
74 void decayKinematics(
Event& process);
77 double sigmaNow()
const {
return sigmaNw;}
78 double sigmaMax()
const {
return sigmaMx;}
79 double biasSelectionWeight()
const {
return biasWt;}
80 bool newSigmaMax()
const {
return newSigmaMx;}
81 void setSigmaMax(
double sigmaMaxIn) {sigmaMx = sigmaMaxIn;}
84 virtual double sigmaSumSigned()
const {
return sigmaMx;}
87 Vec4 p(
int i)
const {
return pH[i];}
88 double m(
int i)
const {
return mH[i];}
91 void setP(
int i, Vec4 pNew) { pH[i] = pNew; }
94 double ecm()
const {
return eCM;}
95 double x1()
const {
return x1H;}
96 double x2()
const {
return x2H;}
97 double sHat()
const {
return sH;}
98 double tHat()
const {
return tH;}
99 double uHat()
const {
return uH;}
100 double pTHat()
const {
return pTH;}
101 double thetaHat()
const {
return theta;}
102 double phiHat()
const {
return phi;}
103 double runBW3()
const {
return runBW3H;}
104 double runBW4()
const {
return runBW4H;}
105 double runBW5()
const {
return runBW5H;}
108 virtual bool isResolved()
const {
return true;}
112 virtual void rescaleSigma(
double){}
113 virtual void rescaleMomenta(
double){}
116 virtual double weightGammaPDFApprox(){
return 1.;}
119 virtual void setGammaKinPtr( GammaKinematics*){}
127 static const int NMAXTRY, NTRY3BODY;
128 static const double SAFETYMARGIN, TINY, EVENFRAC, SAMESIGMA, MRESMINABS,
129 WIDTHMARGIN, SAMEMASS, MASSMARGIN, EXTRABWWTMAX,
130 THRESHOLDSIZE, THRESHOLDSTEP, YRANGEMARGIN, LEPTONXMIN,
131 LEPTONXMAX, LEPTONXLOGMIN, LEPTONXLOGMAX, LEPTONTAUMIN,
132 SHATMINZ, PT2RATMINZ, WTCORRECTION[11];
135 SigmaProcess* sigmaProcessPtr;
141 Settings* settingsPtr;
144 ParticleData* particleDataPtr;
150 BeamParticle* beamAPtr;
151 BeamParticle* beamBPtr;
154 Couplings* couplingsPtr;
157 SigmaTotal* sigmaTotPtr;
160 UserHooks* userHooksPtr;
166 bool useBreitWigners, doEnergySpread, showSearch, showViolation,
167 increaseMaximum, hasQ2Min;
169 double mHatGlobalMin, mHatGlobalMax, pTHatGlobalMin, pTHatGlobalMax,
170 Q2GlobalMin, pTHatMinDiverge, minWidthBreitWigners;
174 double mA, mB, eCM, s;
175 bool hasLeptonBeamA, hasLeptonBeamB, hasOneLeptonBeam, hasTwoLeptonBeams,
176 hasPointGammaA, hasPointGammaB, hasOnePointParticle,
177 hasTwoPointParticles;
180 bool newSigmaMx, canModifySigma, canBiasSelection, canBias2Sel;
182 double bias2SelPow, bias2SelRef, wtBW, sigmaNw, sigmaMx, sigmaPos,
186 double mHatMin, mHatMax, sHatMin, sHatMax, pTHatMin, pTHatMax,
187 pT2HatMin, pT2HatMax;
190 double x1H, x2H, m3, m4, m5, s3, s4, s5, mHat, sH, tH, uH, pAbs, p2Abs,
191 pTH, theta, phi, betaZ;
196 void decayKinematicsStep(
Event& process,
int iRes);
202 bool setupSampling123(
bool is2,
bool is3);
205 bool trialKin123(
bool is2,
bool is3,
bool inEvent =
true);
209 double mResA, mResB, GammaResA, GammaResB, tauResA, tauResB, widResA,
214 bool useMirrorWeight, hasNegZ, hasPosZ;
215 double tau, y, z, tauMin, tauMax, yMax, zMin, zMax, ratio34, unity34,
216 zNeg, zPos, wtTau, wtY, wtZ, wt3Body, runBW3H, runBW4H, runBW5H,
217 intTau0, intTau1, intTau2, intTau3, intTau4, intTau5, intTau6,
218 intY0, intY12, intY34, intY56, mTchan1, sTchan1, mTchan2, sTchan2,
219 frac3Flat, frac3Pow1, frac3Pow2, zNegMin, zNegMax, zPosMin, zPosMax;
220 Vec4 p3cm, p4cm, p5cm;
224 double tauCoef[8], yCoef[8], zCoef[8], tauCoefSum[8], yCoefSum[8],
228 bool limitTau(
bool is2,
bool is3);
233 void selectTau(
int iTau,
double tauVal,
bool is2);
234 void selectY(
int iY,
double yVal);
235 void selectZ(
int iZ,
double zVal);
239 void solveSys(
int n,
int bin[8],
double vec[8],
double mat[8][8],
245 double mPeak[6], sPeak[6], mWidth[6], mMin[6], mMax[6], mw[6], wmRat[6],
246 mLower[6], mUpper[6], sLower[6], sUpper[6], fracFlatS[6],
247 fracFlatM[6], fracInv[6], fracInv2[6], atanLower[6], atanUpper[6],
248 intBW[6], intFlatS[6], intFlatM[6], intInv[6], intInv2[6];
251 void setupMass1(
int iM);
252 void setupMass2(
int iM,
double distToThresh);
255 void trialMass(
int iM);
256 double weightMass(
int iM);
260 pair<double,double> tRange(
double sIn,
double s1In,
double s2In,
261 double s3In,
double s4In) {
262 double lambda12 = pow2( sIn - s1In - s2In) - 4. * s1In * s2In;
263 double lambda34 = pow2( sIn - s3In - s4In) - 4. * s3In * s4In;
264 if (lambda12 < 0. || lambda34 < 0.)
return make_pair( 0., 0.);
265 double tLow = -0.5 * (sIn - (s1In + s2In + s3In + s4In) + (s1In - s2In)
266 * (s3In - s4In) / sIn + sqrtpos(lambda12 * lambda34) / sIn);
267 double tUpp = ( (s3In - s1In) * (s4In - s2In) + (s1In + s4In - s2In - s3In)
268 * (s1In * s4In - s2In * s3In) / sIn ) / tLow;
269 return make_pair( tLow, tUpp); }
270 bool tInRange(
double tIn,
double sIn,
double s1In,
double s2In,
271 double s3In,
double s4In) {
272 pair<double, double> tRng = tRange( sIn, s1In, s2In, s3In, s4In);
273 return (tIn > tRng.first && tIn < tRng.second); }
287 class PhaseSpace2to1tauy :
public PhaseSpace {
292 PhaseSpace2to1tauy() {}
295 virtual bool setupSampling() {
if (!setupMass())
return false;
296 return setupSampling123(
false,
false);}
299 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {wtBW = 1.;
300 return trialKin123(
false,
false, inEvent);}
303 virtual bool finalKin();
316 class PhaseSpace2to2tauyz :
public PhaseSpace {
321 PhaseSpace2to2tauyz() {}
324 virtual bool setupSampling() {
if (!setupMasses())
return false;
325 return setupSampling123(
true,
false);}
328 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {
329 if (!trialMasses())
return false;
330 return trialKin123(
true,
false, inEvent);}
333 virtual bool finalKin();
337 virtual void rescaleMomenta (
double sHatNew);
340 virtual void rescaleSigma (
double sHatNew);
343 virtual double weightGammaPDFApprox();
354 bool constrainedM3M4();
355 bool constrainedM3();
356 bool constrainedM4();
364 class PhaseSpace2to2elastic :
public PhaseSpace {
369 PhaseSpace2to2elastic() {}
372 virtual bool setupSampling();
373 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
374 virtual bool finalKin();
377 virtual bool isResolved()
const {
return false;}
382 static const int NTRY;
383 static const double HBARC2, BNARROW, BWIDE, WIDEFRAC, TOFFSET;
386 bool isOneExp, useCoulomb;
387 double s1, s2, alphaEM0, lambda12S, tLow, tUpp, bSlope1, bSlope2,
388 sigRef1, sigRef2, sigRef, sigNorm1, sigNorm2, sigNorm3,
397 class PhaseSpace2to2diffractive :
public PhaseSpace {
402 PhaseSpace2to2diffractive(
bool isDiffAin =
false,
bool isDiffBin =
false)
403 : isDiffA(isDiffAin), isDiffB(isDiffBin) {isSD = !isDiffA || !isDiffB;}
406 virtual bool setupSampling();
407 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
408 virtual bool finalKin();
411 virtual bool isResolved()
const {
return false;}
416 static const int NTRY;
417 static const double BWID1, BWID2, BWID3, BWID4, FWID1SD, FWID2SD, FWID3SD,
418 FWID4SD, FWID1DD, FWID2DD, FWID3DD, FWID4DD, MAXFUDGESD,
419 MAXFUDGEDD, MAXFUDGET, DIFFMASSMARGIN, SPROTON;
422 bool isDiffA, isDiffB, isSD, splitxit;
425 double m3ElDiff, m4ElDiff, s1, s2, xiMin, xiMax, xiNow, sigNow, sigMax,
426 sigMaxNow, lambda12, lambda34, bNow, tempA, tempB, tempC,
427 tLow, tUpp, tWeight, fWid1, fWid2, fWid3, fWid4, fbWid1, fbWid2,
428 fbWid3, fbWid4, fbWid1234;
437 class PhaseSpace2to3diffractive :
public PhaseSpace {
442 PhaseSpace2to3diffractive() {}
445 virtual bool setupSampling();
446 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
447 virtual bool finalKin();
450 virtual bool isResolved()
const {
return false;}
455 static const int NTRY;
456 static const double BWID1, BWID2, BWID3, BWID4, FWID1, FWID2, FWID3,
457 MAXFUDGECD, MAXFUDGET, DIFFMASSMARGIN;
463 double s1, s2, m5min, s5min, m5, sigNow, sigMax, sigMaxNow, xiMin, xi1, xi2,
464 fWid1, fWid2, fWid3, fbWid1, fbWid2, fbWid3, fbWid123;
465 Vec4 p1, p2, p3, p4, p5;
474 class PhaseSpace2to2nondiffractive :
public PhaseSpace {
479 PhaseSpace2to2nondiffractive() {}
482 virtual bool setupSampling() {sigmaNw = sigmaProcessPtr->sigmaHat();
483 sigmaMx = sigmaNw;
return true;}
484 virtual bool trialKin(
bool ,
bool =
false) {
return true;}
485 virtual bool finalKin() {
return true;}
505 virtual bool setupSampling();
506 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
507 virtual bool finalKin() {gammaKinPtr->finalize();
return true;}
511 gammaKinPtr = gammaKinPtrIn; }
520 bool gammaA, gammaB, externalFlux, sampleQ2;
521 double Q2maxGamma, Wmin, sigmaNDestimate, sigmaNDmax, sCM, alphaEM,
522 m2BeamA, m2BeamB, m2sA, m2sB, log2xMinA, log2xMaxA, log2xMinB, log2xMaxB,
523 xGamma1, xGamma2, Q2gamma1, Q2gamma2, mGmGm, Q2min1, Q2min2;
540 virtual bool setupSampling() {
if (!setupMasses())
return false;
541 setup3Body();
return setupSampling123(
false,
true);}
544 virtual bool trialKin(
bool inEvent =
true,
bool =
false) {
545 if (!trialMasses())
return false;
546 return trialKin123(
false,
true, inEvent);}
549 virtual bool finalKin();
554 static const int NITERNR;
570 class PhaseSpace2to3yyycyl :
public PhaseSpace {
575 PhaseSpace2to3yyycyl() {}
578 virtual bool setupSampling();
581 virtual bool trialKin(
bool inEvent =
true,
bool =
false);
584 virtual bool finalKin();
589 double pTHat3Min, pTHat3Max, pTHat5Min, pTHat5Max, RsepMin, R2sepMin;
593 double pT3Min, pT3Max, pT5Min, pT5Max, y3Max, y4Max, y5Max,
594 pT3, pT4, pT5, phi3, phi4, phi5, y3, y4, y5, dphi;
603 class PhaseSpaceLHA :
public PhaseSpace {
608 PhaseSpaceLHA() {idProcSave = 0;}
611 virtual bool setupSampling();
614 virtual bool trialKin(
bool ,
bool repeatSame =
false);
617 virtual bool finalKin() {sigmaProcessPtr->setScale();
return true;}
620 virtual double sigmaSumSigned()
const {
return sigmaSgn;}
625 static const double CONVERTPB2MB;
628 int strategy, stratAbs, nProc, idProcSave;
629 double xMaxAbsSum, xSecSgnSum, sigmaSgn;
631 vector<double> xMaxAbsProc;
639 #endif // Pythia8_PhaseSpace_H