File indexing completed on 2025-01-18 10:06:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef Pythia8_PhaseSpace_H
0012 #define Pythia8_PhaseSpace_H
0013
0014 #include "Pythia8/Basics.h"
0015 #include "Pythia8/BeamParticle.h"
0016 #include "Pythia8/Info.h"
0017 #include "Pythia8/LesHouches.h"
0018 #include "Pythia8/MultipartonInteractions.h"
0019 #include "Pythia8/ParticleData.h"
0020 #include "Pythia8/PartonDistributions.h"
0021 #include "Pythia8/PhysicsBase.h"
0022 #include "Pythia8/PythiaStdlib.h"
0023 #include "Pythia8/SigmaProcess.h"
0024 #include "Pythia8/SigmaTotal.h"
0025 #include "Pythia8/Settings.h"
0026 #include "Pythia8/StandardModel.h"
0027 #include "Pythia8/UserHooks.h"
0028 #include "Pythia8/GammaKinematics.h"
0029
0030 namespace Pythia8 {
0031
0032
0033
0034
0035 class UserHooks;
0036
0037
0038
0039
0040
0041
0042 class PhaseSpace : public PhysicsBase {
0043
0044 public:
0045
0046
0047 virtual ~PhaseSpace() {}
0048
0049
0050 void init(bool isFirst, SigmaProcessPtr sigmaProcessPtrIn);
0051
0052
0053 void updateBeamIDs() { idAold = idA; idBold = idB; idA = beamAPtr->id();
0054 idB = beamBPtr->id(); mA = beamAPtr->m(); mB = beamBPtr->m();
0055 sigmaProcessPtr->updateBeamIDs();}
0056
0057
0058 void newECM(double eCMin) {eCM = eCMin; s = eCM * eCM;}
0059
0060
0061 void setLHAPtr(LHAupPtr lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;}
0062
0063
0064
0065 virtual bool setupSampling() = 0;
0066
0067
0068
0069 virtual bool trialKin(bool inEvent = true, bool repeatSame = false) = 0;
0070
0071
0072
0073 virtual bool finalKin() = 0;
0074
0075
0076 void decayKinematics( Event& process);
0077
0078
0079 double sigmaNow() const {return sigmaNw;}
0080 double sigmaMax() const {return sigmaMx;}
0081 double biasSelectionWeight() const {return biasWt;}
0082 bool newSigmaMax() const {return newSigmaMx;}
0083 void setSigmaMax(double sigmaMaxIn) {sigmaMx = sigmaMaxIn;}
0084
0085
0086 double sigmaMaxSwitch() {sigmaNw = sigmaProcessPtr->sigmaHatWrap();
0087 sigmaMx = sigmaNw; return sigmaMx;}
0088
0089
0090 virtual double sigmaSumSigned() const {return sigmaMx;}
0091
0092
0093 Vec4 p(int i) const {return pH[i];}
0094 double m(int i) const {return mH[i];}
0095
0096
0097 void setP(int i, Vec4 pNew) { pH[i] = pNew; }
0098
0099
0100 double ecm() const {return eCM;}
0101 double x1() const {return x1H;}
0102 double x2() const {return x2H;}
0103 double sHat() const {return sH;}
0104 double tHat() const {return tH;}
0105 double uHat() const {return uH;}
0106 double pTHat() const {return pTH;}
0107 double thetaHat() const {return theta;}
0108 double phiHat() const {return phi;}
0109 double runBW3() const {return runBW3H;}
0110 double runBW4() const {return runBW4H;}
0111 double runBW5() const {return runBW5H;}
0112
0113
0114 virtual bool isResolved() const {return true;}
0115
0116
0117
0118 virtual void rescaleSigma( double){}
0119 virtual void rescaleMomenta( double){}
0120
0121
0122 virtual double weightGammaPDFApprox(){ return 1.;}
0123
0124
0125 virtual void setGammaKinPtr( GammaKinematics* gammaKinPtrIn) {
0126 gammaKinPtr = gammaKinPtrIn; }
0127
0128 protected:
0129
0130
0131 PhaseSpace() : sigmaProcessPtr(), lhaUpPtr(), gammaKinPtr(),
0132 useBreitWigners(), doEnergySpread(), showSearch(), showViolation(),
0133 increaseMaximum(), hasQ2Min(), gmZmodeGlobal(), mHatGlobalMin(),
0134 mHatGlobalMax(), pTHatGlobalMin(), pTHatGlobalMax(), Q2GlobalMin(),
0135 pTHatMinDiverge(), minWidthBreitWigners(), minWidthNarrowBW(), idA(),
0136 idB(), idAold(), idBold(), idAgm(), idBgm(), mA(), mB(), eCM(), s(),
0137 sigmaMxGm(), hasLeptonBeamA(), hasLeptonBeamB(), hasOneLeptonBeam(),
0138 hasTwoLeptonBeams(), hasPointGammaA(), hasPointGammaB(),
0139 hasOnePointParticle(), hasTwoPointParticles(), hasGamma(), hasVMD(),
0140 newSigmaMx(), canModifySigma(), canBiasSelection(), canBias2Sel(),
0141 gmZmode(), bias2SelPow(), bias2SelRef(), wtBW(), sigmaNw(),
0142 sigmaMx(), sigmaPos(), sigmaNeg(), biasWt(), mHatMin(), mHatMax(),
0143 sHatMin(), sHatMax(), pTHatMin(), pTHatMax(), pT2HatMin(), pT2HatMax(),
0144 x1H(), x2H(), m3(), m4(), m5(), s3(), s4(), s5(), mHat(), sH(), tH(), uH(),
0145 pAbs(), p2Abs(), pTH(), theta(), phi(), betaZ(), mH(), idResA(), idResB(),
0146 mResA(), mResB(), GammaResA(), GammaResB(), tauResA(), tauResB(),
0147 widResA(), widResB(), sameResMass(), useMirrorWeight(), hasNegZ(),
0148 hasPosZ(), tau(), y(), z(), tauMin(), tauMax(), yMax(), zMin(), zMax(),
0149 ratio34(), unity34(), zNeg(), zPos(), wtTau(), wtY(), wtZ(), wt3Body(),
0150 runBW3H(), runBW4H(), runBW5H(), intTau0(), intTau1(), intTau2(),
0151 intTau3(), intTau4(), intTau5(), intTau6(), intY0(), intY12(), intY34(),
0152 intY56(), mTchan1(), sTchan1(), mTchan2(), sTchan2(), frac3Flat(),
0153 frac3Pow1(), frac3Pow2(), zNegMin(), zNegMax(), zPosMin(), zPosMax(),
0154 nTau(), nY(), nZ(), tauCoef(), yCoef(), zCoef(), tauCoefSum(), yCoefSum(),
0155 zCoefSum(), useBW(), useNarrowBW(), idMass(), mPeak(), sPeak(), mWidth(),
0156 mMin(), mMax(), mw(), wmRat(), mLower(), mUpper(), sLower(), sUpper(),
0157 fracFlatS(), fracFlatM(), fracInv(), fracInv2(), atanLower(), atanUpper(),
0158 intBW(), intFlatS(), intFlatM(), intInv(), intInv2() {}
0159
0160
0161 static const int NMAXTRY, NTRY3BODY;
0162 static const double SAFETYMARGIN, TINY, EVENFRAC, SAMESIGMA, MRESMINABS,
0163 WIDTHMARGIN, SAMEMASS, MASSMARGIN, EXTRABWWTMAX,
0164 THRESHOLDSIZE, THRESHOLDSTEP, YRANGEMARGIN, LEPTONXMIN,
0165 LEPTONXMAX, LEPTONXLOGMIN, LEPTONXLOGMAX, LEPTONTAUMIN,
0166 SHATMINZ, PT2RATMINZ, WTCORRECTION[11];
0167
0168
0169 SigmaProcessPtr sigmaProcessPtr;
0170
0171
0172 LHAupPtr lhaUpPtr;
0173
0174
0175 GammaKinematics* gammaKinPtr;
0176
0177
0178 bool useBreitWigners, doEnergySpread, showSearch, showViolation,
0179 increaseMaximum, hasQ2Min;
0180 int gmZmodeGlobal;
0181 double mHatGlobalMin, mHatGlobalMax, pTHatGlobalMin, pTHatGlobalMax,
0182 Q2GlobalMin, pTHatMinDiverge, minWidthBreitWigners, minWidthNarrowBW;
0183
0184
0185 int idA, idB, idAold, idBold, idAgm, idBgm;
0186 double mA, mB, eCM, s, sigmaMxGm;
0187 bool hasLeptonBeamA, hasLeptonBeamB, hasOneLeptonBeam, hasTwoLeptonBeams,
0188 hasPointGammaA, hasPointGammaB, hasOnePointParticle,
0189 hasTwoPointParticles, hasGamma, hasVMD;
0190
0191
0192 bool newSigmaMx, canModifySigma, canBiasSelection, canBias2Sel;
0193 int gmZmode;
0194 double bias2SelPow, bias2SelRef, wtBW, sigmaNw, sigmaMx, sigmaPos,
0195 sigmaNeg, biasWt;
0196
0197
0198 double mHatMin, mHatMax, sHatMin, sHatMax, pTHatMin, pTHatMax,
0199 pT2HatMin, pT2HatMax;
0200
0201
0202 double x1H, x2H, m3, m4, m5, s3, s4, s5, mHat, sH, tH, uH, pAbs, p2Abs,
0203 pTH, theta, phi, betaZ;
0204 Vec4 pH[12];
0205 double mH[12];
0206
0207
0208 void decayKinematicsStep( Event& process, int iRes);
0209
0210
0211
0212
0213 void setup3Body();
0214 bool setupSampling123(bool is2, bool is3);
0215
0216
0217 bool trialKin123(bool is2, bool is3, bool inEvent = true);
0218
0219
0220 int idResA, idResB;
0221 double mResA, mResB, GammaResA, GammaResB, tauResA, tauResB, widResA,
0222 widResB;
0223 bool sameResMass;
0224
0225
0226 bool useMirrorWeight, hasNegZ, hasPosZ;
0227 double tau, y, z, tauMin, tauMax, yMax, zMin, zMax, ratio34, unity34,
0228 zNeg, zPos, wtTau, wtY, wtZ, wt3Body, runBW3H, runBW4H, runBW5H,
0229 intTau0, intTau1, intTau2, intTau3, intTau4, intTau5, intTau6,
0230 intY0, intY12, intY34, intY56, mTchan1, sTchan1, mTchan2, sTchan2,
0231 frac3Flat, frac3Pow1, frac3Pow2, zNegMin, zNegMax, zPosMin, zPosMax;
0232 Vec4 p3cm, p4cm, p5cm;
0233
0234
0235 int nTau, nY, nZ;
0236 double tauCoef[8], yCoef[8], zCoef[8], tauCoefSum[8], yCoefSum[8],
0237 zCoefSum[8];
0238
0239
0240 bool limitTau(bool is2, bool is3);
0241 bool limitY();
0242 bool limitZ();
0243
0244
0245 void selectTau(int iTau, double tauVal, bool is2);
0246 void selectY(int iY, double yVal);
0247 void selectZ(int iZ, double zVal);
0248 bool select3Body();
0249
0250
0251 void solveSys( int n, int bin[8], double vec[8], double mat[8][8],
0252 double coef[8]);
0253
0254
0255 bool useBW[6], useNarrowBW[6];
0256 int idMass[6];
0257 double mPeak[6], sPeak[6], mWidth[6], mMin[6], mMax[6], mw[6], wmRat[6],
0258 mLower[6], mUpper[6], sLower[6], sUpper[6], fracFlatS[6],
0259 fracFlatM[6], fracInv[6], fracInv2[6], atanLower[6], atanUpper[6],
0260 intBW[6], intFlatS[6], intFlatM[6], intInv[6], intInv2[6];
0261
0262
0263 void setupMass1(int iM);
0264 void setupMass2(int iM, double distToThresh);
0265
0266
0267 void trialMass(int iM);
0268 double weightMass(int iM);
0269
0270
0271
0272 pair<double,double> tRange( double sIn, double s1In, double s2In,
0273 double s3In, double s4In) {
0274 double lambda12 = pow2( sIn - s1In - s2In) - 4. * s1In * s2In;
0275 double lambda34 = pow2( sIn - s3In - s4In) - 4. * s3In * s4In;
0276 if (lambda12 < 0. || lambda34 < 0.) return make_pair( 0., 0.);
0277 double tLow = -0.5 * (sIn - (s1In + s2In + s3In + s4In) + (s1In - s2In)
0278 * (s3In - s4In) / sIn + sqrtpos(lambda12 * lambda34) / sIn);
0279 double tUpp = ( (s3In - s1In) * (s4In - s2In) + (s1In + s4In - s2In - s3In)
0280 * (s1In * s4In - s2In * s3In) / sIn ) / tLow;
0281 return make_pair( tLow, tUpp); }
0282 bool tInRange( double tIn, double sIn, double s1In, double s2In,
0283 double s3In, double s4In) {
0284 pair<double, double> tRng = tRange( sIn, s1In, s2In, s3In, s4In);
0285 return (tIn > tRng.first && tIn < tRng.second); }
0286
0287
0288
0289
0290
0291
0292
0293 };
0294
0295
0296
0297
0298
0299 class PhaseSpace2to1tauy : public PhaseSpace {
0300
0301 public:
0302
0303
0304 PhaseSpace2to1tauy() {}
0305
0306
0307 virtual bool setupSampling() {if (!setupMass()) return false;
0308 return setupSampling123(false, false);}
0309
0310
0311 virtual bool trialKin(bool inEvent = true, bool = false) {wtBW = 1.;
0312 return trialKin123(false, false, inEvent);}
0313
0314
0315 virtual bool finalKin();
0316
0317 private:
0318
0319
0320 bool setupMass();
0321
0322 };
0323
0324
0325
0326
0327
0328 class PhaseSpace2to2tauyz : public PhaseSpace {
0329
0330 public:
0331
0332
0333 PhaseSpace2to2tauyz() {}
0334
0335
0336 virtual bool setupSampling() {if (!setupMasses()) return false;
0337 return setupSampling123(true, false);}
0338
0339
0340 virtual bool trialKin(bool inEvent = true, bool = false) {
0341 if (!trialMasses()) return false;
0342 return trialKin123(true, false, inEvent);}
0343
0344
0345 virtual bool finalKin();
0346
0347
0348
0349 virtual void rescaleMomenta ( double sHatNew);
0350
0351
0352 virtual void rescaleSigma ( double sHatNew);
0353
0354
0355 virtual double weightGammaPDFApprox();
0356
0357 private:
0358
0359
0360 bool setupMasses();
0361
0362
0363 bool trialMasses();
0364
0365
0366 bool constrainedM3M4();
0367 bool constrainedM3();
0368 bool constrainedM4();
0369
0370 };
0371
0372
0373
0374
0375
0376 class PhaseSpace2to2elastic : public PhaseSpace {
0377
0378 public:
0379
0380
0381 PhaseSpace2to2elastic() : isOneExp(), useCoulomb(), s1(), s2(), alphaEM0(),
0382 lambda12S(), lambda12(), lambda34(), tempA(), tempB(), tempC(),
0383 tLow(), tUpp(), bSlope1(), bSlope2(), sigRef1(), sigRef2(),
0384 sigRef(), sigNorm1(), sigNorm2(), sigNorm3(), sigNormSum(), rel2() {}
0385
0386
0387 virtual bool setupSampling();
0388 virtual bool trialKin(bool inEvent = true, bool = false);
0389 virtual bool finalKin();
0390
0391
0392 virtual bool isResolved() const {return false;}
0393
0394 private:
0395
0396
0397 static const int NTRY;
0398 static const double BNARROW, BWIDE, WIDEFRAC, TOFFSET;
0399
0400
0401 bool isOneExp, useCoulomb;
0402 double s1, s2, alphaEM0, lambda12S, lambda12, lambda34, tempA, tempB, tempC,
0403 tLow, tUpp, bSlope1, bSlope2, sigRef1, sigRef2, sigRef,
0404 sigNorm1, sigNorm2, sigNorm3, sigNormSum, rel2;
0405
0406 };
0407
0408
0409
0410
0411
0412 class PhaseSpace2to2diffractive : public PhaseSpace {
0413
0414 public:
0415
0416
0417 PhaseSpace2to2diffractive(bool isDiffAin = false, bool isDiffBin = false)
0418 : isDiffA(isDiffAin), isDiffB(isDiffBin), splitxit(), m3ElDiff(),
0419 m4ElDiff(), s1(), s2(), xiMin(), xiMax(), xiNow(), sigNow(), sigMax(),
0420 sigMaxNow(), lambda12(), lambda34(), bNow(), tempA(), tempB(), tempC(),
0421 tLow(), tUpp(), tWeight(), fWid1(), fWid2(), fWid3(), fWid4(), fbWid1(),
0422 fbWid2(), fbWid3(), fbWid4(), fbWid1234() {isSD = !isDiffA || !isDiffB;}
0423
0424
0425 virtual bool setupSampling();
0426 virtual bool trialKin(bool inEvent = true, bool = false);
0427 virtual bool finalKin();
0428
0429
0430 virtual bool isResolved() const {return false;}
0431
0432 private:
0433
0434
0435 static const int NTRY;
0436 static const double BWID1, BWID2, BWID3, BWID4, FWID1SD, FWID2SD, FWID3SD,
0437 FWID4SD, FWID1DD, FWID2DD, FWID3DD, FWID4DD, MAXFUDGESD,
0438 MAXFUDGEDD, MAXFUDGET, DIFFMASSMARGIN, SPROTON;
0439
0440
0441 bool isDiffA, isDiffB, isSD, splitxit;
0442
0443
0444 double mPi;
0445
0446
0447 double m3ElDiff, m4ElDiff, s1, s2, xiMin, xiMax, xiNow, sigNow, sigMax,
0448 sigMaxNow, lambda12, lambda34, bNow, tempA, tempB, tempC,
0449 tLow, tUpp, tWeight, fWid1, fWid2, fWid3, fWid4, fbWid1, fbWid2,
0450 fbWid3, fbWid4, fbWid1234;
0451
0452 };
0453
0454
0455
0456
0457
0458
0459 class PhaseSpace2to3diffractive : public PhaseSpace {
0460
0461 public:
0462
0463
0464 PhaseSpace2to3diffractive() : PhaseSpace(), splitxit(), s1(), s2(), m5min(),
0465 s5min(), sigNow(), sigMax(), sigMaxNow(), xiMin(), xi1(), xi2(), fWid1(),
0466 fWid2(), fWid3(), fbWid1(), fbWid2(), fbWid3(), fbWid123() {}
0467
0468
0469 virtual bool setupSampling();
0470 virtual bool trialKin(bool inEvent = true, bool = false);
0471 virtual bool finalKin();
0472
0473
0474 virtual bool isResolved() const {return false;}
0475
0476 private:
0477
0478
0479 static const int NTRY;
0480 static const double BWID1, BWID2, BWID3, BWID4, FWID1, FWID2, FWID3,
0481 MAXFUDGECD, MAXFUDGET, DIFFMASSMARGIN;
0482
0483
0484 bool splitxit;
0485
0486
0487 double s1, s2, m5min, s5min, sigNow, sigMax, sigMaxNow, xiMin, xi1, xi2,
0488 fWid1, fWid2, fWid3, fbWid1, fbWid2, fbWid3, fbWid123;
0489 Vec4 p1, p2, p3, p4, p5;
0490
0491 };
0492
0493
0494
0495 class PhaseSpace2to2nondiffractive : public PhaseSpace {
0496
0497
0498
0499
0500 public:
0501
0502
0503 PhaseSpace2to2nondiffractive() {}
0504
0505
0506 virtual bool setupSampling();
0507 virtual bool trialKin( bool , bool = false);
0508 virtual bool finalKin() { if (hasGamma) gammaKinPtr->finalize();
0509 return true;}
0510
0511 private:
0512
0513 };
0514
0515
0516
0517
0518
0519
0520 class PhaseSpace2to3tauycyl : public PhaseSpace {
0521
0522 public:
0523
0524
0525 PhaseSpace2to3tauycyl() {}
0526
0527
0528 virtual bool setupSampling() {if (!setupMasses()) return false;
0529 setup3Body(); return setupSampling123(false, true);}
0530
0531
0532 virtual bool trialKin(bool inEvent = true, bool = false) {
0533 if (!trialMasses()) return false;
0534 return trialKin123(false, true, inEvent);}
0535
0536
0537 virtual bool finalKin();
0538
0539 private:
0540
0541
0542 static const int NITERNR;
0543
0544
0545 bool setupMasses();
0546
0547
0548 bool trialMasses();
0549
0550 };
0551
0552
0553
0554
0555
0556
0557
0558 class PhaseSpace2to3yyycyl : public PhaseSpace {
0559
0560 public:
0561
0562
0563 PhaseSpace2to3yyycyl() : pTHat3Min(), pTHat3Max(), pTHat5Min(), pTHat5Max(),
0564 RsepMin(), R2sepMin(), hasBaryonBeams(), pT3Min(), pT3Max(), pT5Min(),
0565 pT5Max(), y3Max(), y4Max(), y5Max(), pT3(), pT4(), pT5(), phi3(), phi4(),
0566 phi5(), y3(), y4(), y5(), dphi() {}
0567
0568
0569 virtual bool setupSampling();
0570
0571
0572 virtual bool trialKin(bool inEvent = true, bool = false);
0573
0574
0575 virtual bool finalKin();
0576
0577 private:
0578
0579
0580 double pTHat3Min, pTHat3Max, pTHat5Min, pTHat5Max, RsepMin, R2sepMin;
0581 bool hasBaryonBeams;
0582
0583
0584 double pT3Min, pT3Max, pT5Min, pT5Max, y3Max, y4Max, y5Max,
0585 pT3, pT4, pT5, phi3, phi4, phi5, y3, y4, y5, dphi;
0586 Vec4 pInSum;
0587
0588 };
0589
0590
0591
0592
0593
0594 class PhaseSpaceLHA : public PhaseSpace {
0595
0596 public:
0597
0598
0599 PhaseSpaceLHA() : strategy(), stratAbs(), nProc(), idProcSave(0),
0600 xMaxAbsSum(), xSecSgnSum(), sigmaSgn() {}
0601
0602
0603 virtual bool setupSampling();
0604
0605
0606 virtual bool trialKin( bool , bool repeatSame = false);
0607
0608
0609 virtual bool finalKin() {sigmaProcessPtr->setScale(); return true;}
0610
0611
0612 virtual double sigmaSumSigned() const {return sigmaSgn;}
0613
0614 private:
0615
0616
0617 static const double CONVERTPB2MB;
0618
0619
0620 int strategy, stratAbs, nProc, idProcSave;
0621 double xMaxAbsSum, xSecSgnSum, sigmaSgn;
0622 vector<int> idProc;
0623 vector<double> xMaxAbsProc;
0624
0625 };
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636 class Rambo {
0637
0638 public:
0639
0640
0641 Rambo() { rndmPtr=nullptr; isInitPtr=false;}
0642
0643
0644 Rambo(Rndm* rndmPtrIn) { initPtr(rndmPtrIn); }
0645
0646
0647 virtual ~Rambo() {}
0648
0649
0650 void initPtr(Rndm* rndmPtrIn) {rndmPtr = rndmPtrIn; isInitPtr = true;}
0651
0652
0653
0654 double genPoint(double eCM,int nOut,vector<Vec4>& pOut);
0655
0656
0657
0658
0659 double genPoint(double eCM,vector<double> mIn,vector<Vec4>& pOut);
0660
0661 private:
0662
0663
0664 bool isInitPtr;
0665
0666
0667 Rndm* rndmPtr;
0668
0669 };
0670
0671
0672
0673 }
0674
0675 #endif