11 #include "Pythia8/HardDiffraction.h"
20 const double HardDiffraction::TINYPDF = 1e-10;
23 const double HardDiffraction::POMERONMASS = 1.;
24 const double HardDiffraction::RHOMASS = 0.77549;
25 const double HardDiffraction::PROTONMASS = 0.93827;
28 const double HardDiffraction::DIFFMASSMARGIN = 0.2;
31 void HardDiffraction::init(BeamParticle* beamAPtrIn,
32 BeamParticle* beamBPtrIn) {
35 beamAPtr = beamAPtrIn;
36 beamBPtr = beamBPtrIn;
39 pomFlux = mode(
"SigmaDiffractive:PomFlux");
42 idA = (beamAPtr != 0) ? beamAPtr->id() : 0;
43 idB = (beamBPtr != 0) ? beamBPtr->id() : 0;
44 mA = (beamAPtr != 0) ? beamAPtr->m() : 0.;
45 mB = (beamBPtr != 0) ? beamBPtr->m() : 0.;
46 isGammaA = (beamAPtr != 0) ? beamAPtr->isGamma() :
false;
47 isGammaB = (beamBPtr != 0) ? beamBPtr->isGamma() :
false;
48 isGammaGamma = (isGammaA && isGammaB);
51 rescale = parm(
"Diffraction:PomFluxRescale");
52 a0 = 1. + parm(
"SigmaDiffractive:PomFluxEpsilon");
53 ap = parm(
"SigmaDiffractive:PomFluxAlphaPrime");
56 double sigmaRefPomP = parm(
"Diffraction:sigmaRefPomP");
57 normPom = pow2(sigmaRefPomP) * 0.02;
59 }
else if (pomFlux == 2) {
65 }
else if (pomFlux == 3) {
67 normPom = pow2(beta)/(16.*M_PI);
69 }
else if (pomFlux == 4) {
71 normPom = 9. * pow2(beta) / (4. * pow2(M_PI));
78 }
else if (pomFlux == 5) {
83 a0 = 1. + parm(
"SigmaDiffractive:MBRepsilon");
84 ap = parm(
"SigmaDiffractive:MBRalpha");
85 bool renormalize = flag(
"Diffraction:useMBRrenormalization");
87 double m2min = parm(
"SigmaDiffractive:MBRm2Min");
88 double dyminSDflux = parm(
"SigmaDiffractive:MBRdyminSDflux");
89 double dymaxSD = log(infoPtr->eCM()*infoPtr->eCM() / m2min);
92 double step = (dymaxSD - dyminSDflux) / 1000.;
95 for (
int i = 0; i < 1000; ++i) {
96 double dy = dyminSDflux + (i + 0.5) * step;
97 double f = exp(2.*(a0 - 1.)*dy) * ( (A1/(a1 + 2.*ap*dy))
98 + (A2/(a2 + 2. * ap*dy)) );
99 nGap += step * cflux * f;
102 if (nGap < 1.) nGap = 1.;
103 normPom = cflux/nGap;
104 }
else if (pomFlux == 6 || pomFlux == 7) {
108 if (pomFlux == 6) a0 = 1.1182;
110 double xNorm = 0.003;
111 double b = b0 + 2. * ap * log(1./xNorm);
112 double mMin = (isGammaA || isGammaB) ? RHOMASS : PROTONMASS;
113 double tmin = -pow(mMin * xNorm, 2.)/(1. - xNorm);
115 double fNorm = exp(log(1./xNorm) * ( 2.*a0 - 2.));
116 fNorm *= (exp(b*tmin) - exp(b*tcut))/b;
121 xPomA = tPomA = thetaPomA = 0.;
122 xPomB = tPomB = thetaPomB = 0.;
126 if (isGammaA || isGammaB) {
127 sigmaTotPtr->calc(22, 2212, infoPtr->eCM());
128 double sigGamP = sigmaTotPtr->sigmaTot();
129 sigmaTotPtr->calc(2212, 2212, infoPtr->eCM());
130 double sigPP = sigmaTotPtr->sigmaTot();
131 sigTotRatio = sigGamP / sigPP;
139 bool HardDiffraction::isDiffractive(
int iBeamIn,
int partonIn,
140 double xIn,
double Q2In,
double xfIncIn) {
147 int parton = partonIn;
150 double xfInc = xfIncIn;
151 tmpPomPtr = (iBeam == 1) ? beamPomAPtr : beamPomBPtr;
152 usePomInPhoton = ((iBeam == 1 && isGammaA) || (iBeam == 2 && isGammaB))
156 if (xfInc < TINYPDF) {
157 infoPtr->errorMsg(
"Warning in HardDiffraction::isDiffractive: "
158 "inclusive PDF is zero");
163 double xNow = pow(x, rndmPtr->flat());
168 double xfEst = log(1./x) * xfPom(xNow) * tmpPomPtr->xf(parton, x/xNow, Q2);
173 msg <<
", id = " << parton;
174 infoPtr->errorMsg(
"Warning in HardDiffraction::isDiffractive: "
175 "weight above unity", msg.str());
178 if (xfEst < rndmPtr->flat() * xfInc)
return false;
183 double mMin = (usePomInPhoton) ? RHOMASS : PROTONMASS;
184 double m2Diff = xNow * pow2( infoPtr->eCM());
185 double mDiff = sqrt(m2Diff);
186 double mDiffA = (iBeam == 1) ? 0. : mMin;
187 double mDiffB = (iBeam == 2) ? 0. : mMin;
188 double m2DiffA = mDiffA * mDiffA;
189 double m2DiffB = mDiffB * mDiffB;
190 double eDiff = (iBeam == 1)
191 ? 0.5 * (m2Diff + m2DiffA - m2DiffB) / mDiff
192 : 0.5 * (m2Diff + m2DiffB - m2DiffA) / mDiff;
193 if ( 1. - x / xNow < POMERONMASS / eDiff) {
194 infoPtr->errorMsg(
"Warning in HardDiffraction::isDiffractive: "
195 "No momentum left for beam remnant.");
200 double m3 = ((iBeam == 1 && isGammaA) || (iBeam == 2 && isGammaB))
201 ? RHOMASS : PROTONMASS;
203 if (m3 + m4 + DIFFMASSMARGIN >= infoPtr->eCM()) {
204 infoPtr->errorMsg(
"Warning in HardDiffraction::isDiffractive: "
205 "Too high diffractive mass.");
210 double tNow = pickTNow(xNow);
211 double thetaNow = getThetaNow(xNow, tNow);
217 thetaPomA = thetaNow;
221 thetaPomB = thetaNow;
233 double HardDiffraction::xfPom(
double xIn) {
236 pair<double, double> tLim = tRange(xIn);
237 double tMin = tLim.first;
238 double tMax = tLim.second;
241 if (tMin > 0. || tMax > 0.)
return 0.;
247 double b = b0 + ap * log(1./x);
248 xFlux = normPom/(2.*b) * ( exp(2.*b*tMax) - exp(2.*b*tMin));
254 else if (pomFlux == 2) {
255 xFlux = normPom * (A1/a1 * (exp(a1*tMax) - exp(a1*tMin))
256 + A2/a2 * (exp(a2*tMax) - exp(a2*tMin)));
262 else if (pomFlux == 3) {
263 double b = (a1 + 2. * ap * log(1./x));
264 xFlux = normPom * exp(log(1./x) * (2.*a0 - 2.));
265 xFlux *= (exp(b*tMax) - exp(b*tMin))/b;
273 else if (pomFlux == 4) {
274 double Q = 2. * ap * log(1./x);
275 xFlux = normPom * exp(log(1./x) * (2.*a0 - 2.));
276 xFlux *= (A1/(Q + a1) * (exp((Q + a1)*tMax) - exp((Q + a1)*tMin))
277 + A2/(Q + a2) * (exp((Q + a2)*tMax) - exp((Q + a2)*tMin))
278 + A3/(Q + a3) * (exp((Q + a3)*tMax) - exp((Q + a3)*tMin)));
286 else if (pomFlux == 5) {
287 double Q = 2. * ap * log(1./x);
288 xFlux = normPom * exp(log(1./x) * ( 2.*a0 - 2.));
289 xFlux *= (A1/(Q + a1) * (exp((Q + a1)*tMax) - exp((Q + a1)*tMin))
290 + A2/(Q + a2) * (exp((Q + a2)*tMax) - exp((Q + a2)*tMin)));
296 else if (pomFlux == 6 || pomFlux == 7) {
297 double b = b0 + 2. * ap * log(1./x);
298 xFlux = normPom * exp(log(1./x) * ( 2.*a0 - 2.));
299 xFlux *= (exp(b*tMax) - exp(b*tMin))/b;
303 if (usePomInPhoton)
return xFlux * rescale * sigTotRatio;
304 else return xFlux * rescale;
312 double HardDiffraction::pickTNow(
double xIn) {
315 pair<double, double> tLim = HardDiffraction::tRange(xIn);
316 double tMin = tLim.first;
317 double tMax = tLim.second;
319 double rndm = rndmPtr->flat();
323 double b = b0 + ap * log(1./xIn);
324 tTmp = log( rndm*exp(2.*b*tMin) + (1. - rndm)*exp(2.*b*tMax))/(2.*b);
328 else if (pomFlux == 2) {
329 double prob1 = A1/a1 * (exp(a1*tMax) - exp(a1*tMin));
330 double prob2 = A2/a2 * (exp(a2*tMax) - exp(a2*tMin));
331 prob1 /= (prob1 + prob2);
332 tTmp = (prob1 > rndmPtr->flat())
333 ? log( rndm * exp(a1*tMin) + (1. - rndm) * exp(a1*tMax))/a1
334 : log( rndm * exp(a2*tMin) + (1. - rndm) * exp(a2*tMax))/a2;
338 else if (pomFlux == 3) {
339 double b = (2. * ap * log(1./xIn) + a1);
340 tTmp = log( rndm * exp(b*tMin) + (1. - rndm) * exp(b*tMax))/b;
344 else if (pomFlux == 4) {
345 double b1 = 2. * ap * log(1./xIn) + a1;
346 double b2 = 2. * ap * log(1./xIn) + a2;
347 double b3 = 2. * ap * log(1./xIn) + a3;
348 double prob1 = A1/b1 * ( exp(b1*tMax) - exp(b1*tMin));
349 double prob2 = A2/b2 * ( exp(b2*tMax) - exp(b2*tMin));
350 double prob3 = A3/b3 * ( exp(b3*tMax) - exp(b3*tMin));
351 double rndmProb = (prob1 + prob2 + prob3) * rndmPtr->flat() ;
352 if (rndmProb < prob1)
353 tTmp = log( rndm * exp(b1*tMin) + (1. - rndm) * exp(b1*tMax))/b1;
354 else if ( rndmProb < prob1 + prob2)
355 tTmp = log( rndm * exp(b2*tMin) + (1. - rndm) * exp(b2*tMax))/b2;
357 tTmp = log( rndm * exp(b3*tMin) + (1. - rndm) * exp(b3*tMax))/b3;
361 else if (pomFlux == 5) {
362 double b1 = a1 + 2. * ap * log(1./xIn);
363 double b2 = a2 + 2. * ap * log(1./xIn);
364 double prob1 = A1/b1 * (exp(b1*tMax) - exp(b1*tMin));
365 double prob2 = A2/b2 * (exp(b2*tMax) - exp(b2*tMin));
366 prob1 /= (prob1 + prob2);
367 tTmp = (prob1 > rndmPtr->flat())
368 ? log( rndm * exp(b1*tMin) + (1. - rndm) * exp(b1*tMax))/b1
369 : log( rndm * exp(b2*tMin) + (1. - rndm) * exp(b2*tMax))/b2;
373 else if (pomFlux == 6 || pomFlux == 7){
374 double b = b0 + 2. * ap * log(1./xIn);
375 tTmp = log( rndm * exp(b*tMin) + (1. - rndm) * exp(b*tMax))/b;
387 double HardDiffraction::xfPomWithT(
double xIn,
double tIn) {
396 double b = b0 + ap * log(1./x);
397 xFlux = normPom * exp( 2.*b*t);
401 else if (pomFlux == 2)
402 xFlux = normPom * (A1 * exp(a1*t) + A2 * exp(a2*t));
405 else if (pomFlux == 3) {
406 xFlux = normPom * exp(log(1./x) * (2.*a0 - 2.))
407 * exp(t * (a1 + 2.*ap*log(1./x)));
411 else if (pomFlux == 4){
412 double sqrF1 = A1 * exp(a1*t) + A2 * exp(a2*t) + A3 * exp(a3*t);
413 xFlux = normPom * pow(x, 2. + 2. * (a0 + ap*t)) * sqrF1;
417 else if (pomFlux == 5) {
418 double sqrF1 = A1 * exp(a1*t) + A2 * exp(a2*t);
419 xFlux = normPom * sqrF1 * exp(log(1./x) * (-2. + a0 + ap*t));
423 else if (pomFlux == 6 || pomFlux == 7)
424 xFlux = normPom * exp(b0*t)/pow(x, 2. * (a0 + ap*t) - 2.);
427 if (usePomInPhoton)
return xFlux * rescale * sigTotRatio;
428 else return xFlux * rescale;
436 pair<double, double> HardDiffraction::tRange(
double xIn) {
442 double eCM = infoPtr->eCM();
447 s3 = (iBeam == 1) ? s1 : M2;
448 s4 = (iBeam == 2) ? s2 : M2;
451 if (sqrt(s3) + sqrt(s4) >= eCM)
return make_pair( 1., 1.);
454 double lambda12 = sqrtpos(pow2(s - s1 - s2) - 4. * s1 * s2);
455 double lambda34 = sqrtpos(pow2(s - s3 - s4) - 4. * s3 * s4);
456 double tmp1 = s - (s1 + s2 + s3 + s4) + (s1 - s2) * (s3 - s4) / s;
457 double tmp2 = lambda12 * lambda34 / s;
458 double tmp3 = (s1 + s4 - s2 - s3) * (s1 * s4 - s2 * s3) / s
459 + (s3 - s1) * (s4 - s2);
460 double tMin = -0.5 * (tmp1 + tmp2);
461 double tMax = tmp3 / tMin;
464 return make_pair(tMin, tMax);
472 double HardDiffraction::getThetaNow(
double xIn,
double tIn) {
478 double eCM = infoPtr->eCM();
483 s3 = (iBeam == 1) ? s1 : M2;
484 s4 = (iBeam == 2) ? s2 : M2;
487 double lambda12 = sqrtpos(pow2(s - s1 - s2) - 4. * s1 * s2);
488 double lambda34 = sqrtpos(pow2(s - s3 - s4) - 4. * s3 * s4);
489 double tmp1 = s - (s1 + s2 + s3 + s4) + (s1 - s2) * (s3 - s4)/s;
490 double tmp2 = lambda12 * lambda34 / s;
491 double tmp3 = (s1 + s4 - s2 - s3) * (s1 * s4 - s2 * s3) / s
492 + (s3 - s1) * (s4 - s2);
493 double cosTheta = min(1., max(-1., (tmp1 + 2. * tIn) / tmp2));
494 double sinTheta = 2. * sqrtpos( -(tmp3 + tmp1 * tIn + tIn * tIn) ) / tmp2;
495 double theta = asin( min(1., sinTheta));
497 if (cosTheta < 0.) theta = M_PI - theta;