22 #ifndef Pythia8_ColourReconnectionHooks_H
23 #define Pythia8_ColourReconnectionHooks_H
26 #include "Pythia8/Pythia.h"
48 double fracGluonIn = 1.) : mode(modeIn), flip(flipIn), dLamCut(dLamCutIn),
49 fracGluon(fracGluonIn) { m2Ref = 1.; dLamCut = max(0., dLamCut); }
53 virtual bool canReconnectResonanceSystems() {
return true;}
56 virtual bool doReconnectResonanceSystems(
int,
Event& event) {
59 if (mode <= 0 || mode > 2)
return true;
63 if (infoPtr->isDiffractiveA() && infoPtr->isDiffractiveB())
return true;
66 if (!setupConfig( event))
return false;
69 if ( (mode == 1 && nGlu < 2) || (mode == 2 && nGlu < 1) )
return true;
72 bool hasRec = (mode == 1) ? doReconnectSwap( event)
73 : doReconnectMove( event);
74 if (!hasRec)
return false;
77 if (flip > 0)
return doReconnectFlip( event);
89 int mode, flip, nRec, nGlu, nAllCol, nCol;
90 double dLamCut, fracGluon, m2Ref, dLamTot;
96 vector<int> iToAllCol, iAllCol;
99 map<int, int> colMap, acolMap;
102 vector<double> lambdaij;
105 double lambda12(
int i,
int j) {
106 int iAC = iToAllCol[i];
int jAC = iToAllCol[j];
107 return lambdaij[nAllCol * min( iAC, jAC) + max( iAC, jAC)];
111 double lambda123(
int i,
int j,
int k) {
112 int iAC = iToAllCol[i];
int jAC = iToAllCol[j];
int kAC = iToAllCol[k];
113 return lambdaij[nAllCol * min( iAC, jAC) + max( iAC, jAC)]
114 + lambdaij[nAllCol * min( iAC, kAC) + max( iAC, kAC)]
115 - lambdaij[nAllCol * min( jAC, kAC) + max( jAC, kAC)];
121 InfoSwapMove(
int i1in = 0,
int i2in = 0) : i1(i1in), i2(i2in) {}
122 InfoSwapMove(
int i1in,
int i2in,
int iCol1in,
int iAcol1in,
int iCol2in,
123 int iAcol2in,
int dLamIn) : i1(i1in), i2(i2in), iCol1(iCol1in),
124 iAcol1(iAcol1in), iCol2(iCol2in), iAcol2(iAcol2in), dLam(dLamIn) {}
126 int i1, i2, col1, acol1, iCol1, iAcol1, col2, acol2, iCol2, iAcol2;
131 vector<InfoSwapMove> infoSM;
137 inline bool setupConfig(
Event& event) {
141 iToAllCol.resize( event.size() );
150 for (
int i = 3; i <
event.size(); ++i)
if (event[i].isFinal()) {
151 if (event[i].
id() == 21 && rndmPtr->flat() < fracGluon)
155 if (event[i].col() > 0 || event[i].acol() > 0) {
156 iToAllCol[i] = iAllCol.size();
157 iAllCol.push_back(i);
158 if (event[i].col() > 0) colMap[
event[i].col()] = i;
159 if (event[i].acol() > 0) acolMap[
event[i].acol()] = i;
164 for (
int iJun = 0; iJun <
event.sizeJunction(); ++iJun) {
165 if (event.kindJunction(iJun) == 1) {
166 for (
int j = 0; j < 3; ++j) {
167 int jCol =
event.colJunction( iJun, j);
168 for (map<int, int>::iterator colM = colMap.begin();
169 colM != colMap.end(); ++colM)
170 if (colM->first == jCol) {
174 for (
int iG = 0; iG < int(iGlu.size()); ++iG)
175 if (event[iGlu[iG]].col() == jCol) {
176 iGlu.erase(iGlu.begin() + iG);
180 }
else if (event.kindJunction(iJun) == 2) {
181 for (
int j = 0; j < 3; ++j) {
182 int jCol =
event.colJunction( iJun, j);
183 for (map<int, int>::iterator acolM = acolMap.begin();
184 acolM != acolMap.end(); ++acolM)
185 if (acolM->first == jCol) {
186 acolMap.erase( acolM);
189 for (
int iG = 0; iG < int(iGlu.size()); ++iG)
190 if (event[iGlu[iG]].acol() == jCol) {
191 iGlu.erase(iGlu.begin() + iG);
200 nCol = colMap.size();
201 if (
int(acolMap.size()) != nCol) {
202 infoPtr->errorMsg(
"Error in MBReconUserHooks: map sizes do not match");
205 map<int, int>::iterator colM = colMap.begin();
206 map<int, int>::iterator acolM = acolMap.begin();
207 for (
int iCol = 0; iCol < nCol; ++iCol) {
208 if (colM->first != acolM->first) {
209 infoPtr->errorMsg(
"Error in MBReconUserHooks: map elements"
218 nAllCol = iAllCol.size();
219 lambdaij.resize( pow2(nAllCol) );
221 for (
int iAC = 0; iAC < nAllCol - 1; ++iAC) {
223 for (
int jAC = iAC + 1; jAC < nAllCol; ++jAC) {
225 lambdaij[nAllCol * iAC + jAC]
226 = log(1. + m2( event[i], event[j]) / m2Ref);
239 inline bool doReconnectSwap(
Event& event) {
242 for (
int iG1 = 0; iG1 < nGlu - 1; ++iG1) {
244 for (
int iG2 = iG1 + 1; iG2 < nGlu; ++iG2) {
246 InfoSwapMove tmpSM( i1, i2);
247 calcLamSwap( tmpSM, event);
248 infoSM.push_back( tmpSM);
251 int nPair = infoSM.size();
254 for (
int iSwap = 0; iSwap < nGlu; ++iSwap) {
256 double dLamMin = 1e4;
259 for (
int iPair = 0; iPair < nPair; ++iPair)
260 if (infoSM[iPair].dLam < dLamMin) {
262 dLamMin = infoSM[iPair].dLam;
266 if (dLamMin > -dLamCut)
break;
269 int i1min = infoSM[iPairMin].i1;
270 int i2min = infoSM[iPairMin].i2;
273 int col1 =
event[i1min].col();
274 int acol1 =
event[i1min].acol();
275 int col2 =
event[i2min].col();
276 int acol2 =
event[i2min].acol();
277 event[i1min].cols( col2, acol2);
278 event[i2min].cols( col1, acol1);
281 colMap[col1] = i2min;
282 acolMap[acol1] = i2min;
283 colMap[col2] = i1min;
284 acolMap[acol2] = i1min;
287 infoSM[iPairMin] = infoSM.back();
292 for (
int iPair = 0; iPair < nPair; ++iPair) {
293 InfoSwapMove& tmpSM = infoSM[iPair];
294 if ( tmpSM.i1 == i1min || tmpSM.i1 == i2min
295 || tmpSM.i2 == i1min || tmpSM.i2 == i2min
296 || tmpSM.iCol1 == i1min || tmpSM.iCol1 == i2min
297 || tmpSM.iAcol1 == i1min || tmpSM.iAcol1 == i2min
298 || tmpSM.iCol2 == i1min || tmpSM.iCol2 == i2min
299 || tmpSM.iAcol2 == i1min || tmpSM.iAcol2 == i2min)
300 calcLamSwap( tmpSM, event);
313 inline void calcLamSwap( InfoSwapMove& tmpSM,
Event& event) {
316 tmpSM.col1 =
event[tmpSM.i1].col();
317 tmpSM.acol1 =
event[tmpSM.i1].acol();
318 tmpSM.iCol1 = acolMap[tmpSM.col1];
319 tmpSM.iAcol1 = colMap[tmpSM.acol1];
320 tmpSM.col2 =
event[tmpSM.i2].col();
321 tmpSM.acol2 =
event[tmpSM.i2].acol();
322 tmpSM.iCol2 = acolMap[tmpSM.col2];
323 tmpSM.iAcol2 = colMap[tmpSM.acol2];
326 double lam1c = lambda12( tmpSM.i1, tmpSM.iCol1);
327 double lam1a = lambda12( tmpSM.i1, tmpSM.iAcol1);
328 double lam2c = lambda12( tmpSM.i2, tmpSM.iCol2);
329 double lam2a = lambda12( tmpSM.i2, tmpSM.iAcol2);
330 double lam3c = lambda12( tmpSM.i1, tmpSM.iCol2);
331 double lam3a = lambda12( tmpSM.i1, tmpSM.iAcol2);
332 double lam4c = lambda12( tmpSM.i2, tmpSM.iCol1);
333 double lam4a = lambda12( tmpSM.i2, tmpSM.iAcol1);
334 if (tmpSM.col1 == tmpSM.acol2 && tmpSM.acol1 == tmpSM.col2)
336 else if (tmpSM.col1 == tmpSM.acol2)
337 tmpSM.dLam = (lam3c + lam4a) - (lam1a + lam2c);
338 else if (tmpSM.acol1 == tmpSM.col2)
339 tmpSM.dLam = (lam3a + lam4c) - (lam1c + lam2a);
340 else tmpSM.dLam = (lam3c + lam3a + lam4c + lam4a)
341 - (lam1c + lam1a + lam2c + lam2a);
350 inline bool doReconnectMove(
Event& event) {
353 int iNow, colNow, acolNow, iColNow, iAcolNow, col2Now;
357 for (
int iG = 0; iG < nGlu; ++iG) {
361 colNow =
event[iNow].col();
362 acolNow =
event[iNow].acol();
363 iColNow = acolMap[colNow];
364 iAcolNow = colMap[acolNow];
367 lamNow = lambda123( iNow, iColNow, iAcolNow);
370 for (map<int, int>::iterator colM = colMap.begin();
371 colM != colMap.end(); ++colM) {
372 col2Now = colM->first;
375 InfoSwapMove tmpSM( iNow);
377 tmpSM.acol1 = acolNow;
378 tmpSM.iCol1 = iColNow;
379 tmpSM.iAcol1 = iAcolNow;
380 tmpSM.lamNow = lamNow;
381 tmpSM.col2 = col2Now;
382 tmpSM.iCol2 = colMap[col2Now];
383 tmpSM.iAcol2 = acolMap[col2Now];
386 tmpSM.dLam = (tmpSM.iCol2 == tmpSM.i1 || tmpSM.iAcol2 == tmpSM.i1
387 || tmpSM.iCol1 == tmpSM.iAcol1) ? 2e4
388 : lambda123( tmpSM.i1, tmpSM.iCol2, tmpSM.iAcol2) - tmpSM.lamNow;
389 infoSM.push_back( tmpSM);
392 int nPair = infoSM.size();
395 for (
int iMove = 0; iMove < nGlu; ++iMove) {
397 double dLamMin = 1e4;
400 for (
int iPair = 0; iPair < nPair; ++iPair)
401 if (infoSM[iPair].dLam < dLamMin) {
403 dLamMin = infoSM[iPair].dLam;
407 if (dLamMin > -dLamCut)
break;
412 InfoSwapMove& selSM = infoSM[iPairMin];
413 int i1Sel = selSM.i1;
414 int iCol1Sel = selSM.iCol1;
415 int iAcol1Sel = selSM.iAcol1;
416 int iCol2Sel = selSM.iCol2;
417 int iAcol2Sel = selSM.iAcol2;
418 int iCol2Mod[3] = { iAcol1Sel , i1Sel , iCol2Sel };
419 int col2Mod[3] = { selSM.col1, selSM.col2, selSM.acol1};
422 for (
int i = 0; i < 3; ++i) {
423 event[ iCol2Mod[i] ].col( col2Mod[i] );
424 colMap[ col2Mod[i] ] = iCol2Mod[i];
429 bool doUpdate =
false;
430 for (
int iPair = 0; iPair < nPair; ++iPair) {
431 InfoSwapMove& tmpSM = infoSM[iPair];
432 if (tmpSM.i1 != i1Now) {
435 if (i1Now == i1Sel || i1Now == iCol1Sel || i1Now == iAcol1Sel
436 || i1Now == iCol2Sel || i1Now == iAcol2Sel) {
437 colNow =
event[i1Now].col();
438 acolNow =
event[i1Now].acol();
439 iColNow = acolMap[colNow];
440 iAcolNow = colMap[acolNow];
441 lamNow = lambda123( i1Now, iColNow, iAcolNow);
447 tmpSM.acol1 = acolNow;
448 tmpSM.iCol1 = iColNow;
449 tmpSM.iAcol1 = iAcolNow;
450 tmpSM.lamNow = lamNow;
455 for (
int iPair = 0; iPair < nPair; ++iPair) {
456 InfoSwapMove& tmpSM = infoSM[iPair];
458 for (
int i = 0; i < 3; ++i)
if (tmpSM.col2 == col2Mod[i]) iMod = i;
459 if (iMod > -1) tmpSM.iCol2 = iCol2Mod[iMod];
460 if (tmpSM.i1 == i1Sel || tmpSM.i1 == iCol1Sel || tmpSM.i1 == iAcol1Sel
461 || tmpSM.i1 == iCol2Sel || tmpSM.i1 == iAcol2Sel || iMod > -1)
462 tmpSM.dLam = (tmpSM.iCol2 == tmpSM.i1 || tmpSM.iAcol2 == tmpSM.i1
463 || tmpSM.iCol1 == tmpSM.iAcol1) ? 2e4
464 : lambda123( tmpSM.i1, tmpSM.iCol2, tmpSM.iAcol2) - tmpSM.lamNow;
479 inline bool doReconnectFlip(
Event& event) {
482 vector<int> iTmp, iVec, iBeg, iEnd;
485 for (
int i = 3; i <
event.size(); ++i)
486 if (event[i].isFinal() &&
event[i].col() > 0 &&
event[i].acol() == 0) {
492 map<int, int>::iterator acolM = acolMap.find( event[iNow].col() );
493 bool foundEnd =
false;
494 while (acolM != acolMap.end()) {
495 iNow = acolM->second;
496 iTmp.push_back( iNow);
497 if (event[iNow].col() == 0) {
501 acolM = acolMap.find( event[iNow].col() );
505 if (foundEnd || flip == 2) {
506 iBeg.push_back( iVec.size());
507 for (
int j = 0; j < int(iTmp.size()); ++j) iVec.push_back( iTmp[j]);
508 iEnd.push_back( iVec.size());
513 if (flip == 2)
for (
int i = 3; i <
event.size(); ++i)
514 if (event[i].isFinal() &&
event[i].acol() > 0 &&
event[i].col() == 0) {
520 map<int, int>::iterator colM = colMap.find( event[iNow].acol() );
521 bool foundEnd =
false;
522 while (colM != colMap.end()) {
524 iTmp.push_back( iNow);
525 if (event[iNow].acol() == 0) {
529 colM = colMap.find( event[iNow].acol() );
534 iBeg.push_back( iVec.size());
535 for (
int j = 0; j < int(iTmp.size()); ++j) iVec.push_back( iTmp[j]);
536 iEnd.push_back( iVec.size());
542 int nSys = iBeg.size();
543 int i1c, i1a, i2c, i2a, i1cMin, i1aMin, i2cMin, i2aMin, iSMin;
544 double dLam, dLamMin;
545 vector<InfoSwapMove> flipMin;
548 for (
int iSys1 = 0; iSys1 < nSys - 1; ++iSys1)
if (iBeg[iSys1] >= 0)
549 for (
int iSys2 = iSys1 + 1; iSys2 < nSys; ++iSys2) if (iBeg[iSys2] >= 0) {
557 for (
int j1 = iBeg[iSys1]; j1 < iEnd[iSys1] - 1; ++j1)
558 for (
int j2 = iBeg[iSys2]; j2 < iEnd[iSys2] - 1; ++j2) {
563 dLam = lambda12( i1c, i2a) + lambda12( i2c, i1a)
564 - lambda12( i1c, i1a) - lambda12( i2c, i2a);
565 if (dLam < dLamMin) {
575 if (dLamMin < -dLamCut) flipMin.push_back( InfoSwapMove(
576 iSys1, iSys2, i1cMin, i1aMin, i2cMin, i2aMin, dLamMin) );
578 int flipSize = flipMin.size();
581 for (
int iFlip = 0; iFlip < min( nSys / 2, flipSize); ++iFlip) {
584 for (
int iSys12 = 0; iSys12 < flipSize; ++iSys12)
585 if (flipMin[iSys12].i1 >= 0 && flipMin[iSys12].dLam < dLamMin) {
587 dLamMin = flipMin[iSys12].dLam;
592 InfoSwapMove& flipNow = flipMin[iSMin];
593 int iS1 = flipNow.i1;
594 int iS2 = flipNow.i2;
595 event[ flipNow.iAcol1 ].acol( event[flipNow.iCol2].col() );
596 event[ flipNow.iAcol2 ].acol( event[flipNow.iCol1].col() );
598 dLamTot += flipNow.dLam;
599 for (
int iSys12 = 0; iSys12 < flipSize; ++iSys12)
600 if ( flipMin[iSys12].i1 == iS1 || flipMin[iSys12].i1 == iS2
601 || flipMin[iSys12].i2 == iS1 || flipMin[iSys12].i2 == iS2)
602 flipMin[iSys12].i1 = -1;
638 strength(strengthIn) { iList = 0; nList = 0; pTolerance = 0.01;
643 virtual bool canReconnectResonanceSystems() {
return true;}
646 virtual bool doReconnectResonanceSystems(
int,
Event& event) {
649 if (mode <= 0 || mode > 5)
return true;
652 classifyFinalPartons(event);
655 if (!checkClassification(event))
return false;
658 if (iList++ < nList) {
659 listClassification();
664 bool tqrkFirst = (rndmPtr->flat() < 0.5);
665 doReconnect( tqrkFirst, event);
666 doReconnect(!tqrkFirst, event);
678 int mode, iList, nList, nRec;
679 double strength, pTolerance, m2Ref;
683 vector<int> iBqrk, iWpos, iTqrk, iBbar, iWneg, iTbar, iRest;
686 map<int, int> colMap, acolMap;
693 inline bool classifyFinalPartons(
Event& event) {
708 for (
int i = 3; i <
event.size(); ++i)
if (event[i].isFinal()) {
709 bool hasCol = (
event[i].colType() != 0);
712 bool fsrFromT =
false;
713 bool fromTqrk =
false;
714 bool fromBqrk =
false;
715 bool fromWpos =
false;
716 bool fromTbar =
false;
717 bool fromBbar =
false;
718 bool fromWneg =
false;
724 int idNow =
event[iNow].id();
727 if (abs(idNow) == 6 && (idOld == 21 || idOld == 22)) fsrFromT =
true;
730 else if (idNow == 6) fromTqrk =
true;
731 else if (idNow == 5) fromBqrk =
true;
732 else if (idNow == 24) fromWpos =
true;
733 else if (idNow == -6) fromTbar =
true;
734 else if (idNow == -5) fromBbar =
true;
735 else if (idNow == -24) fromWneg =
true;
738 iNow =
event[iNow].mother1();
740 }
while (iNow > 2 && !fsrFromT);
744 if (fromTqrk && fromWpos && hasCol) iWpos.push_back(i);
745 else if (fromTqrk && fromBqrk && hasCol) iBqrk.push_back(i);
746 else if (fromTqrk) iTqrk.push_back(i);
747 else if (fromTbar && fromWneg && hasCol) iWneg.push_back(i);
748 else if (fromTbar && fromBbar && hasCol) iBbar.push_back(i);
749 else if (fromTbar) iTbar.push_back(i);
750 else if (hasCol) iRest.push_back(i);
753 if (hasCol && (mode == 4 || mode == 5)) {
754 if (event[i].col() > 0) colMap[
event[i].col()] = i;
755 if (event[i].acol() > 0) acolMap[
event[i].acol()] = i;
768 inline bool checkClassification(
Event& event) {
773 for (
int i = 3; i <
event.size(); ++i) {
774 if(event[i].
id() == 6) iTqrkLoc = i;
775 if(event[i].
id() == -6) iTbarLoc = i;
779 Vec4 tqrkDiff =
event[iTqrkLoc].p();
780 for (
int i = 0; i < int(iBqrk.size()); ++i)
781 tqrkDiff -= event[iBqrk[i]].p();
782 for (
int i = 0; i < int(iWpos.size()); ++i)
783 tqrkDiff -= event[iWpos[i]].p();
784 for (
int i = 0; i < int(iTqrk.size()); ++i)
785 tqrkDiff -= event[iTqrk[i]].p();
788 Vec4 tbarDiff =
event[iTbarLoc].p();
789 for (
int i = 0; i < int(iBbar.size()); ++i)
790 tbarDiff -= event[iBbar[i]].p();
791 for (
int i = 0; i < int(iWneg.size()); ++i)
792 tbarDiff -= event[iWneg[i]].p();
793 for (
int i = 0; i < int(iTbar.size()); ++i)
794 tbarDiff -= event[iTbar[i]].p();
797 double totErr = abs(tqrkDiff.px()) + abs(tqrkDiff.py())
798 + abs(tqrkDiff.pz()) + abs(tqrkDiff.e()) + abs(tbarDiff.px())
799 + abs(tbarDiff.py()) + abs(tbarDiff.pz()) + abs(tqrkDiff.e());
800 if (totErr > pTolerance) {
801 infoPtr->errorMsg(
"Error in TopReconUserHooks::checkClassification");
802 cout <<
"\n Error in t/tbar daughter search: \n t difference "
803 << tqrkDiff <<
" tbar difference "<< tbarDiff;
804 listClassification();
809 return (totErr < pTolerance);
816 inline void listClassification() {
818 cout <<
"\n Final-state coloured partons classified by source: ";
819 cout <<
"\n From Bqrk:";
820 for (
int i = 0; i < int(iBqrk.size()); ++i) cout <<
" " << iBqrk[i];
821 cout <<
"\n From Wpos:";
822 for (
int i = 0; i < int(iWpos.size()); ++i) cout <<
" " << iWpos[i];
823 cout <<
"\n From Tqrk:";
824 for (
int i = 0; i < int(iTqrk.size()); ++i) cout <<
" " << iTqrk[i];
825 cout <<
"\n From Bbar:";
826 for (
int i = 0; i < int(iBbar.size()); ++i) cout <<
" " << iBbar[i];
827 cout <<
"\n From Wneg:";
828 for (
int i = 0; i < int(iWneg.size()); ++i) cout <<
" " << iWneg[i];
829 cout <<
"\n From Tbar:";
830 for (
int i = 0; i < int(iTbar.size()); ++i) cout <<
" " << iTbar[i];
831 cout <<
"\n From Rest:";
832 for (
int i = 0; i < int(iRest.size()); ++i) {
833 cout <<
" " << iRest[i];
834 if (i%20 == 19 && i + 1 !=
int(iRest.size())) cout <<
"\n ";
843 inline bool doReconnect(
bool doTqrk,
Event& event) {
848 for (
int i = 0; i < int(iBqrk.size()); ++i) iTdec.push_back(iBqrk[i]);
849 for (
int i = 0; i < int(iWpos.size()); ++i) iTdec.push_back(iWpos[i]);
851 for (
int i = 0; i < int(iBbar.size()); ++i) iTdec.push_back(iBbar[i]);
852 for (
int i = 0; i < int(iWneg.size()); ++i) iTdec.push_back(iWneg[i]);
857 for (
int i = 0; i < int(iTdec.size()); ++i) {
858 int colNow =
event[iTdec[i]].col();
859 int acolNow =
event[iTdec[i]].acol();
860 if (colNow > 0 && acolNow > 0) iGT.push_back(iTdec[i]);
862 int nGT = iGT.size();
865 if (nGT > 1)
for (
int i = 0; i < nGT; ++i) {
866 int j = min(
int(nGT * rndmPtr->flat()), nGT - 1 );
867 swap( iGT[i], iGT[j]);
872 for (
int i = 0; i < int(iRest.size()); ++i) {
873 int colNow =
event[iRest[i]].col();
874 int acolNow =
event[iRest[i]].acol();
875 if (colNow > 0 && acolNow > 0) iGR.push_back(iRest[i]);
877 int nGR = iGR.size();
878 int iR, colT, acolT, iColT, iAcolT, colR, acolR, iColR, iAcolR;
879 double mTR2, mTR2now, dLam, lamT, lamNow, lamRec;
882 if (nGT > 0 && nGR > 0)
883 for (
int iT = 0; iT < nGT; ++iT) {
884 if (strength < rndmPtr->flat())
continue;
887 if (mode == 1) iR = min(
int(nGR * rndmPtr->flat()), nGR - 1 );
892 mTR2 = m2( event[iGT[iT]], event[iGR[iR]]);
893 for (
int ii = 1; ii < nGR; ++ii) {
894 mTR2now = m2( event[iGT[iT]], event[iGR[ii]]);
895 if (mode == 2 && mTR2now < mTR2) {iR = ii; mTR2 = mTR2now;}
896 if (mode == 3 && mTR2now > mTR2) {iR = ii; mTR2 = mTR2now;}
903 colT =
event[iGT[iT]].col();
904 acolT =
event[iGT[iT]].acol();
905 iColT = acolMap[colT];
906 iAcolT = colMap[acolT];
907 lamT = log(1. + m2( event[iGT[iT]], event[iColT]) / m2Ref)
908 + log(1. + m2( event[iGT[iT]], event[iAcolT]) / m2Ref);
909 for (
int ii = 0; ii < nGR; ++ii) {
910 colR =
event[iGR[ii]].col();
911 acolR =
event[iGR[ii]].acol();
912 iColR = acolMap[colR];
913 iAcolR = colMap[acolR];
915 + log(1. + m2( event[iGR[ii]], event[iColR]) / m2Ref)
916 + log(1. + m2( event[iGR[ii]], event[iAcolR]) / m2Ref);
917 lamRec = log(1. + m2( event[iGT[iT]], event[iColR]) / m2Ref)
918 + log(1. + m2( event[iGT[iT]], event[iAcolR]) / m2Ref)
919 + log(1. + m2( event[iGR[ii]], event[iColT]) / m2Ref)
920 + log(1. + m2( event[iGR[ii]], event[iAcolT]) / m2Ref);
921 if (lamRec - lamNow < dLam) {iR = ii; dLam = lamRec - lamNow;}
924 if (mode == 5 && dLam > 0.)
continue;
928 swapCols( iGT[iT], iGR[iR], event);
940 inline void swapCols(
int i,
int j,
Event& event) {
943 int coli =
event[i].col();
944 int acoli =
event[i].acol();
945 int colj =
event[j].col();
946 int acolj =
event[j].acol();
947 event[i].cols( colj, acolj);
948 event[j].cols( coli, acoli);
964 #endif // end Pythia8_ColourReconnectionHooks_H