11 #include "Pythia8/StringLength.h"
26 const double StringLength::TINY = 1e-20;
27 const double StringLength::MINANGLE = 1e-7;
31 void StringLength::init(Info* infoPtrIn, Settings& settings) {
37 m0 = settings.parm(
"ColourReconnection:m0");
39 juncCorr = settings.parm(
"ColourReconnection:junctionCorrection");
41 lambdaForm = settings.mode(
"ColourReconnection:lambdaForm");
48 double StringLength::getStringLength(
Event& event,
int i,
int j) {
51 Vec4 p1 =
event[i].p();
52 Vec4 p2 =
event[j].p();
54 return getStringLength(p1, p2);
61 double StringLength::getStringLength( Vec4 p1, Vec4 p2) {
64 if (p1.e() < TINY || p2.e() < TINY || theta(p1,p2) < MINANGLE)
return 1e9;
72 Vec4 p0( 0., 0., 0., 1.);
74 return getLength(p1,p0) + getLength(p2,p0);
83 double StringLength::getLength(Vec4 p, Vec4 v,
bool isJunc) {
86 if (isJunc) m *= juncCorr;
88 if (lambdaForm == 0)
return log (1. + sqrt2 * v * p/ m );
89 else if (lambdaForm == 1)
return log (1. + 2 * v * p/ m );
90 else if (lambdaForm == 2)
return log (2. * v * p / m);
98 double StringLength::getJuncLength(
Event& event,
int i,
int j,
int k) {
100 if (i == j || i == k || j == k)
return 1e9;
102 Vec4 p1 =
event[i].p();
103 Vec4 p2 =
event[j].p();
104 Vec4 p3 =
event[k].p();
106 return getJuncLength(p1, p2, p3);
112 double StringLength::getJuncLength(Vec4 p1, Vec4 p2, Vec4 p3) {
115 if (p1.e() < TINY || p2.e() < TINY || p3.e() < TINY
116 || theta(p1,p2) < MINANGLE || theta(p1,p3) < MINANGLE
117 || theta(p2,p3) < MINANGLE)
return 1e9;
120 RotBstMatrix MfromJRF1 = stringFragmentation.junctionRestFrame(p1,p2,p3);
122 Vec4 v1( 0., 0., 0., 1.);
123 v1.rotbst(MfromJRF1);
126 if ( pow2(p1*v1) - p1*p1 < 0. || pow2(p2*v1) - p2*p2 < 0.
127 || pow2(p3*v1) - p3*p3 < 0.)
return 1e9;
130 return getLength(p1, v1,
true) + getLength(p2, v1,
true)
131 + getLength(p3, v1,
true);
139 double StringLength::getJuncLength(
Event& event,
int i,
int j,
int k,
int l) {
141 if (i == j || i == k || i == l || j == k || j == l || k == l)
return 1e9;
144 double origLength = getStringLength(event, i, k)
145 + getStringLength(event, j, l);
146 double minLength = getStringLength(event, i, j)
147 + getStringLength(event, k, l);
149 if (origLength < minLength)
return minLength;
151 Vec4 p1 =
event[i].p();
152 Vec4 p2 =
event[j].p();
153 Vec4 p3 =
event[k].p();
154 Vec4 p4 =
event[l].p();
156 return getJuncLength(p1, p2, p3, p4);
164 double StringLength::getJuncLength(Vec4 p1, Vec4 p2, Vec4 p3, Vec4 p4) {
167 if ( p1.e() < TINY || p2.e() < TINY || p3.e() < TINY || p4.e() < TINY
168 || theta(p1,p2) < MINANGLE || theta(p1,p3) < MINANGLE
169 || theta(p1,p4) < MINANGLE || theta(p2,p3) < MINANGLE
170 || theta(p2,p4) < MINANGLE || theta(p3,p4) < MINANGLE)
return 1e9;
175 RotBstMatrix MfromJRF1 = stringFragmentation.junctionRestFrame(p1,p2,pSum1);
177 Vec4 v1( 0., 0., 0., 1.);
178 v1.rotbst(MfromJRF1);
181 Vec4 pSum2 = p1 + p2;
183 RotBstMatrix MfromJRF2 = stringFragmentation.junctionRestFrame(p3,p4,pSum2);
185 Vec4 v2( 0., 0., 0., 1.);
186 v2.rotbst(MfromJRF2);
189 if ( pow2(p1*v1) - p1*p1 < 0. || pow2(p2*v1) - p2*p2 < 0.
190 || pow2(p3*v2) - p3*p3 < 0. || pow2(p4*v2) - p4*p4 < 0.)
return 1e9;
192 return getLength(p1, v1,
true) + getLength(p2, v1,
true)
193 + getLength(p3, v2,
true) + getLength(p4, v2,
true)
194 + log(v1*v2 + sqrt(pow2(v1*v2)-1));