9 #include "Pythia8/VinciaFSR.h"
10 #include "Pythia8/VinciaISR.h"
22 void TrialGeneratorISR::initPtr(Info* infoPtrIn) {
24 rndmPtr = infoPtr->rndmPtr;
25 settingsPtr = infoPtr->settingsPtr;
32 void TrialGeneratorISR::init(
double mcIn,
double mbIn) {
34 TINYPDFtrial = pow(10,-10);
38 shhSav = infoPtr->s();
40 nGtoQISRSav = settingsPtr->mode(
"Vincia:nGluonToQuark");
42 if (!settingsPtr->flag(
"Vincia:convertGluonToQuark")) nGtoQISRSav = 0;
48 trialPDFratioSav = 1.0;
49 verbose = settingsPtr->mode(
"Vincia:Verbose");
58 double TrialGeneratorISR::aTrial(
double saj,
double sjb,
double sAB) {
59 if (saj < 0. || sjb < 0.)
return 0.;
60 const double sab = sAB + saj + sjb;
61 const double ant = 2*pow2(sab)/saj/sjb/sAB;
62 const double xFactor = sab/sAB;
70 double TrialGeneratorISR::genQ2run(
double q2old,
double sAB,
71 double zMin,
double zMax,
double colFac,
double PDFratio,
72 double b0,
double kR,
double Lambda,
double,
double,
73 double headroomFac,
double enhanceFac) {
76 if (!checkInit())
return 0.0;
77 if (sAB < 0. || q2old < 0.)
return 0.0;
80 enhanceFac = max(enhanceFac,1.0);
83 double Iz = getIz(zMin,zMax);
84 double comFac = 2.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
85 double ran = rndmPtr->flat();
86 double facLam = pow2(Lambda/kR);
87 return exp(pow(ran,comFac) * log(q2old/facLam)) * facLam;
95 double TrialGeneratorISR::genQ2(
double q2old,
double sAB,
double zMin,
96 double zMax,
double colFac,
double alphaS,
double PDFratio,
97 double,
double,
double headroomFac,
double enhanceFac) {
100 if (!checkInit())
return 0.0;
101 if (sAB < 0. || q2old < 0.)
return 0.0;
104 enhanceFac = max(enhanceFac,1.0);
107 double Iz = getIz(zMin,zMax);
108 double comFac = 2.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
109 double ran = rndmPtr->flat();
110 return q2old * pow(ran,comFac/alphaS);
119 double TrialGeneratorISR::genQ2thres(
double,
double,
double,
120 double,
double,
double,
double,
int,
int,
double,
double,
bool,
double,
121 double) {
return 0.0;}
127 double TrialGeneratorISR::genZ(
double zMin,
double zMax) {
128 if (zMin > zMax || zMin < 0.)
return -1.;
129 double ran = rndmPtr->flat();
130 double invZ = 1.0 + (1.0-zMin)/zMin*pow(zMin*(1.0-zMax)/zMax/(1.0-zMin),ran);
138 double TrialGeneratorISR::getIz(
double zMin,
double zMax) {
139 if (zMin > zMax || zMin < 0.)
return 0.0;
140 return log(zMax*(1.0-zMin)/zMin/(1.0-zMax));
147 double TrialGeneratorISR::getZmin(
double Qt2,
double sAB,
double,
double) {
148 if (((shhSav-sAB)*(shhSav-sAB) - (4.0*Qt2*shhSav))
149 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/shhSav;
150 double sajm = 0.5*(shhSav - sAB - sqrt((shhSav - sAB)*(shhSav - sAB) -
155 double TrialGeneratorISR::getZmax(
double Qt2,
double sAB,
double,
double) {
156 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
157 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/shhSav;
158 double sajp = 0.5*(shhSav - sAB + sqrt((shhSav - sAB)*(shhSav - sAB) -
167 double TrialGeneratorISR::getS1j(
double Qt2,
double zeta,
double sAB) {
170 if (zeta < 0)
return getSj2(Qt2, -zeta, sAB);
172 if (Qt2 < 0. || zeta <= 0.) {
173 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": Unphysical input");
179 double TrialGeneratorISR::getSj2(
double Qt2,
double zeta,
double sAB) {
182 if (zeta < 0)
return getS1j(Qt2,-zeta,sAB);
184 if (Qt2 < 0. || zeta <= 0.) {
185 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": Unphysical input");
188 return (Qt2 + sAB*zeta)/(1.0 - zeta);
195 double TrialGeneratorISR::trialPDFratio(BeamParticle*, BeamParticle*,
196 int,
int,
int,
double,
double,
double,
double) {
197 trialPDFratioSav = 1.0;
198 return trialPDFratioSav;
205 bool TrialGeneratorISR::checkInit() {
206 if (isInit)
return true;
207 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": Not initialized");
219 double TrialIIGCollA::aTrial(
double saj,
double sjb,
double sAB) {
220 if (saj < 0. || sjb < 0.)
return 0.;
221 const double sab = sAB + saj + sjb;
222 const double ant = 2.0 * pow2(sab/sAB)/saj;
230 double TrialIIGCollA::genQ2run(
double q2old,
double sAB,
231 double zMin,
double zMax,
double colFac,
double PDFratio,
232 double b0,
double kR,
double Lambda,
double,
double,
233 double headroomFac,
double enhanceFac) {
236 if (!checkInit())
return 0.0;
237 if (sAB < 0. || q2old < 0.)
return 0.0;
240 enhanceFac = max(enhanceFac, 1.0);
243 double Iz = getIz(zMin, zMax);
244 double comFac = 2.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
245 double ran = rndmPtr->flat();
246 double facLam = pow2(Lambda/kR);
247 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
255 double TrialIIGCollA::genQ2(
double q2old,
double sAB,
256 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
257 double,
double,
double headroomFac,
double enhanceFac) {
260 if (!checkInit())
return 0.0;
261 if (sAB < 0. || q2old < 0.)
return 0.0;
264 enhanceFac = max(enhanceFac, 1.0);
267 double Iz = getIz(zMin, zMax);
268 double comFac = 2.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
269 double ran = rndmPtr->flat();
270 return q2old * pow(ran, comFac/alphaS);
278 double TrialIIGCollA::genZ(
double zMin,
double zMax) {
279 if (zMin > zMax || zMin < 0.)
return -1.;
280 double ran = rndmPtr->flat();
281 double z = -1.0 + (1.0+zMin)*pow((1.0+zMax)/(1.0+zMin),ran);
289 double TrialIIGCollA::getIz(
double zMin,
double zMax) {
290 if (zMin > zMax || zMin < 0.)
return 0.0;
291 return log((1.0+zMax)/(1.0+zMin));
298 double TrialIIGCollA::getZmin(
double Qt2,
double sAB,
double,
double) {
299 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
300 < TINYPDFtrial )
return 0.5*(shhSav - sAB)/sAB;
301 double sajm = 0.5*(shhSav - sAB - sqrt((shhSav - sAB)*(shhSav - sAB) -
306 double TrialIIGCollA::getZmax(
double Qt2,
double sAB,
double,
double) {
307 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
308 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/sAB;
309 double sajp = 0.5*(shhSav - sAB + sqrt((shhSav - sAB)*(shhSav - sAB) -
318 double TrialIIGCollA::getS1j(
double Qt2,
double zeta,
double sAB) {
321 if (zeta < 0)
return getSj2(Qt2,-zeta,sAB);
323 if (Qt2 < 0. || zeta <= 0.) {
324 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
327 return Qt2*(1.0+zeta)/(zeta-Qt2/sAB);
331 double TrialIIGCollA::getSj2(
double Qt2,
double zeta,
double sAB) {
334 if (zeta < 0)
return getS1j(Qt2,-zeta,sAB);
336 if (Qt2 < 0. || zeta <= 0.) {
337 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
352 double TrialIISplitA::aTrial(
double saj,
double sjb,
double sAB) {
353 if (saj < 0. || sjb < 0.)
return 0.;
354 const double sab = sAB + saj + sjb;
355 const double ant = sab/saj/sAB;
356 const double xFactor = sab/sAB;
357 return xFactor * ant;
364 double TrialIISplitA::genQ2run(
double q2old,
double sAB,
365 double zMin,
double zMax,
double colFac,
double PDFratio,
366 double b0,
double kR,
double Lambda,
double,
double,
367 double headroomFac,
double enhanceFac) {
370 if (!checkInit())
return 0.0;
371 if (sAB < 0. || q2old < 0.)
return 0.0;
374 enhanceFac = max(enhanceFac, 1.0);
377 double Iz = getIz(zMin, zMax);
378 double comFac = 4.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
379 double ran = rndmPtr->flat();
380 double facLam = pow2(Lambda/kR);
381 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
389 double TrialIISplitA::genQ2(
double q2old,
double sAB,
390 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
391 double,
double,
double headroomFac,
double enhanceFac) {
394 if (!checkInit())
return 0.0;
395 if (sAB < 0. || q2old < 0.)
return 0.0;
398 enhanceFac = max(enhanceFac, 1.0);
401 double Iz = getIz(zMin, zMax);
402 double comFac = 4.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
403 double ran = rndmPtr->flat();
404 return q2old * pow(ran, comFac/alphaS);
413 double TrialIISplitA::genQ2thres(
double q2old,
double sAB,
double zMin,
414 double zMax,
double colFac,
double alphaS,
double PDFratio,
int idA,
int,
415 double,
double,
bool,
double headroomFac,
double enhanceFac) {
419 double mQ = (abs(idA) == 4 ? mcSav : mbSav);
422 if (!checkInit())
return 0.0;
423 if (sAB < 0. || q2old < 0.)
return 0.0;
426 enhanceFac = max(enhanceFac, 1.0);
429 double Iz = getIz(zMin, zMax);
430 double comFac = 4.0*M_PI/Iz/colFac/alphaS/PDFratio/(headroomFac*enhanceFac);
431 double ran = rndmPtr->flat();
432 return (exp(pow(ran, comFac) * log(q2old/pow2(mQ))) * pow2(mQ));
440 double TrialIISplitA::genZ(
double zMin,
double zMax) {
441 if (zMin > zMax || zMin < 0.)
return -1.;
442 double ran = rndmPtr->flat();
443 if (useMevolSav)
return zMin *pow(zMax/zMin, ran);
444 else return (-1.0 + (1.0 + zMin)*pow((1.0 + zMax)/(1.0 + zMin), ran));
451 double TrialIISplitA::getIz(
double zMin,
double zMax) {
452 if (zMin > zMax || zMin < 0.)
return 0.0;
453 if (useMevolSav)
return log(zMax/zMin);
454 else return log((1.0 + zMax)/(1.0 + zMin));
461 double TrialIISplitA::getZmin(
double Qt2,
double sAB,
double,
double) {
462 if (useMevolSav)
return (Qt2+sAB)/sAB;
463 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
464 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/sAB;
465 double sajm = 0.5*(shhSav - sAB - sqrt((shhSav - sAB)*(shhSav - sAB) -
470 double TrialIISplitA::getZmax(
double Qt2,
double sAB,
double,
double) {
471 if (useMevolSav)
return (shhSav/sAB);
472 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
473 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/sAB;
474 double sajp = 0.5*(shhSav - sAB + sqrt((shhSav - sAB)*(shhSav - sAB) -
483 double TrialIISplitA::getS1j(
double Qt2,
double zeta,
double sAB) {
486 if (zeta < 0)
return getSj2(Qt2, -zeta, sAB);
488 if (Qt2 < 0. || zeta <= 0.) {
489 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
492 double saj = Qt2*(1.0 + zeta)/(zeta - Qt2/sAB);
493 if (useMevolSav) saj = Qt2;
498 double TrialIISplitA::getSj2(
double Qt2,
double zeta,
double sAB) {
500 if (zeta < 0)
return getS1j(Qt2, -zeta, sAB);
502 if (Qt2 < 0. || zeta <= 0.) {
503 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
506 double sjb = zeta*sAB;
507 if (useMevolSav) sjb = sAB*(zeta - 1) - Qt2;
516 double TrialIISplitA::trialPDFratio(BeamParticle* beamAPtr, BeamParticle*,
517 int iSys,
int idA,
int,
double eA,
double,
double Qt2A,
double) {
518 double xA = eA/(sqrt(shhSav)/2.0);
519 double newPdf = max(beamAPtr->xfISR(iSys, 21, xA, Qt2A), TINYPDFtrial);
520 double oldPdf = max(beamAPtr->xfISR(iSys, idA, xA, Qt2A), TINYPDFtrial);
521 trialPDFratioSav = 1.0*newPdf/oldPdf;
522 return trialPDFratioSav;
533 double TrialIIConvA::aTrial(
double saj,
double sjb,
double sAB) {
534 if (saj < 0. || sjb < 0.)
return 0.;
535 const double sab = sAB + saj + sjb;
536 const double ant = pow2(sab/sAB)/saj;
544 double TrialIIConvA::genQ2run(
double q2old,
double sAB,
545 double zMin,
double zMax,
double colFac,
double PDFratio,
546 double b0,
double kR,
double Lambda,
double,
double,
547 double headroomFac,
double enhanceFac) {
550 if (!checkInit())
return 0.0;
551 if (sAB < 0. || q2old < 0.)
return 0.0;
554 enhanceFac = max(enhanceFac,1.0);
557 double Iz = getIz(zMin, zMax);
558 double comFac = 4.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
559 double ran = rndmPtr->flat();
560 double facLam = pow2(Lambda/kR);
561 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
569 double TrialIIConvA::genQ2(
double q2old,
double sAB,
570 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
571 double,
double,
double headroomFac,
double enhanceFac) {
574 if (!checkInit())
return 0.0;
575 if (sAB < 0. || q2old < 0.)
return 0.0;
578 enhanceFac = max(enhanceFac, 1.0);
581 double Iz = getIz(zMin, zMax);
582 double comFac = 4.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
583 double ran = rndmPtr->flat();
584 return q2old * pow(ran, comFac/alphaS);
592 double TrialIIConvA::genZ(
double zMin,
double zMax) {
593 if (zMin > zMax || zMin < 0.)
return -1.;
594 double ran = rndmPtr->flat();
595 if (useMevolSav)
return zMax*pow(zMin/zMax, ran);
596 else return (-1.0 + (1.0 + zMin)*pow((1.0 + zMax)/(1.0 + zMin), ran));
603 double TrialIIConvA::getIz(
double zMin,
double zMax) {
604 if (zMin > zMax || zMin < 0.)
return 0.0;
605 if (useMevolSav)
return log(zMax/zMin);
606 else return log((1.0 + zMax)/(1.0 + zMin));
613 double TrialIIConvA::getZmin(
double Qt2,
double sAB,
double,
double) {
614 if (useMevolSav)
return ((Qt2 + sAB)/sAB);
615 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
616 < TINYPDFtrial)
return 0.5*(shhSav - sAB)/sAB;
617 double sajm = 0.5*(shhSav - sAB - sqrt((shhSav - sAB)*(shhSav - sAB) -
622 double TrialIIConvA::getZmax(
double Qt2,
double sAB,
double,
double) {
623 if (useMevolSav)
return (shhSav/sAB);
624 if (((shhSav - sAB)*(shhSav - sAB) - (4.0*Qt2*shhSav))
625 < TINYPDFtrial )
return 0.5*(shhSav - sAB)/sAB;
626 double sajp = 0.5*(shhSav - sAB + sqrt((shhSav - sAB)*(shhSav - sAB) -
635 double TrialIIConvA::getS1j(
double Qt2,
double zeta,
double sAB) {
638 if (zeta < 0)
return getSj2(Qt2, -zeta, sAB);
640 if (Qt2 < 0. || zeta <= 0.) {
641 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
644 double saj = Qt2*(1.0 + zeta)/(zeta - Qt2/sAB);
645 if (useMevolSav) saj = Qt2;
650 double TrialIIConvA::getSj2(
double Qt2,
double zeta,
double sAB) {
653 if (zeta < 0)
return getS1j(Qt2, -zeta, sAB);
655 if (Qt2 < 0. || zeta <= 0.) {
656 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
659 double sjb = zeta*sAB;
660 if (useMevolSav) sjb = sAB*(zeta - 1) - Qt2;
669 double TrialIIConvA::trialPDFratio(BeamParticle* beamAPtr, BeamParticle*,
670 int iSys,
int,
int,
double eA,
double,
double Qt2A,
double) {
672 double xA = eA/(sqrt(shhSav)/2.0);
673 int nQuark = nGtoQISRSav;
674 if (nQuark >= 4 && Qt2A <= 4.0*mcSav*mcSav) nQuark = 3;
675 else if (nQuark >= 5 && Qt2A <= 4.0*mbSav*mbSav) nQuark = 4;
676 double oldPdf = max(beamAPtr->xfISR(iSys, 21, xA, Qt2A),TINYPDFtrial);
679 map<int, double> trialPdfWeight;
680 double trialPdfWeightSum = 0.0;
681 for (
int idQ = -nQuark; idQ <= nQuark; idQ++) {
683 if (idQ==0)
continue;
685 double fac = 2.0 + 0.5 * beamAPtr->nValence(idQ);
686 trialPdfWeight[idQ] =
687 max(fac * beamAPtr->xfISR(iSys, idQ, xA, Qt2A),TINYPDFtrial);
688 trialPdfWeightSum += trialPdfWeight[idQ];
692 double ranFlav = rndmPtr->flat() * trialPdfWeightSum;
693 map<int,double>::iterator it;
694 for (it = trialPdfWeight.begin(); it != trialPdfWeight.end(); ++it) {
695 double newPdf = it->second;
698 trialFlavSav = it->first;
699 trialPDFratioSav = newPdf/oldPdf;
704 return trialPdfWeightSum/oldPdf;
716 double TrialIFSoft::aTrial(
double saj,
double sjk,
double sAK) {
717 if (saj < 0. || sjk < 0.)
return 0.;
718 const double ant = 2. * pow2(sAK + sjk)/saj/sjk/sAK;
726 double TrialIFSoft::genQ2run(
double q2old,
double sAK,
727 double zMin,
double zMax,
double colFac,
double PDFratio,
728 double b0,
double kR,
double Lambda,
double,
double,
729 double headroomFac,
double enhanceFac) {
732 if (!checkInit())
return 0.0;
733 if (sAK < 0. || q2old < 0.)
return 0.0;
736 enhanceFac = max(enhanceFac, 1.0);
739 double Iz = getIz(zMin, zMax);
740 double comFac = 2.0*M_PI*b0/(Iz*colFac*PDFratio*headroomFac*enhanceFac);
741 double ran = rndmPtr->flat();
742 double facLam = pow2(Lambda/kR);
743 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
751 double TrialIFSoft::genQ2(
double q2old,
double sAK,
752 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
753 double,
double,
double headroomFac,
double enhanceFac) {
756 if (!checkInit())
return 0.0;
757 if (sAK < 0. || q2old < 0.)
return 0.0;
760 enhanceFac = max(enhanceFac, 1.0);
763 double Iz = getIz(zMin, zMax);
764 double comFac = 2.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
765 double ran = rndmPtr->flat();
766 return q2old * pow(ran, comFac/alphaS);
774 double TrialIFSoft::genZ(
double zMin,
double zMax) {
775 if (zMin > zMax || zMin < 0.)
return -1.;
776 const double ran = rndmPtr->flat();
777 const double facRan = pow( zMin * (zMax-1.) / zMax / (zMin -1.), ran );
778 const double z = zMin * 1./(zMin - (zMin - 1) * facRan);
786 double TrialIFSoft::getIz(
double zMin,
double zMax) {
787 if (zMin >= zMax || zMin <= 1.)
return 0.0;
788 const double c = (zMax - 1) * zMin / ( (zMin - 1) * zMax );
796 double TrialIFSoft::getZmin(
double Qt2,
double sAK,
double,
double) {
797 return (Qt2 + sAK)/sAK;
800 double TrialIFSoft::getZmax(
double,
double,
double eA,
double eBeamUsed) {
801 const double xA = eA/(sqrt(shhSav)/2.0);
802 const double eAmax = ( (sqrt(shhSav)/2.0) - (eBeamUsed-eA) );
803 const double xAmax = eAmax/(sqrt(shhSav)/2.0);
811 double TrialIFSoft::getS1j(
double Qt2,
double zeta,
double sAK) {
814 if (zeta < 0)
return getSj2(Qt2, -zeta, sAK);
816 if (Qt2 < 0. || zeta <= 0.) {
817 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
820 return Qt2*zeta/(zeta - 1.0);
824 double TrialIFSoft::getSj2(
double Qt2,
double zeta,
double sAK) {
827 if (zeta < 0)
return getS1j(Qt2,-zeta,sAK);
830 if (Qt2 < 0. || zeta <= 0.) {
831 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
834 return sAK*(zeta - 1.0);
842 double TrialIFSoft::trialPDFratio(BeamParticle*, BeamParticle*,
843 int,
int,
int,
double,
double,
double,
double) {
844 trialPDFratioSav = 1.3;
845 return trialPDFratioSav;
858 double TrialVFSoft::aTrial(
double saj,
double sjk,
double sAK) {
859 if (saj < 0. || sjk < 0.)
return 0.;
860 const double ant = 2. * pow2(sAK + sjk)/saj/sjk/sAK;
861 const double xFactor = (sAK + sjk)/sAK;
862 return xFactor * ant;
869 double TrialVFSoft::genZ(
double zMin,
double zMax) {
870 if (zMin > zMax || zMin < 0.)
return -1.;
871 double ran = rndmPtr->flat();
872 double z = 1 + (zMin - 1.) * pow( (zMax - 1.)/(zMin - 1.),ran);
880 double TrialVFSoft::getIz(
double zMin,
double zMax) {
881 if (zMin >= zMax || zMin <= 1.)
return 0.0;
882 const double c = (zMax - 1) / (zMin - 1);
894 double TrialIFGCollA::aTrial(
double saj,
double sjk,
double sAK) {
895 if (saj < 0. || sjk < 0.)
return 0.;
896 return 2.*pow2((sAK + sjk)/sAK)/saj;
903 double TrialIFGCollA::genQ2run(
double q2old,
double sAK,
904 double zMin,
double zMax,
double colFac,
double PDFratio,
905 double b0,
double kR,
double Lambda,
double,
double,
906 double headroomFac,
double enhanceFac) {
909 if (!checkInit())
return 0.0;
910 if (sAK < 0. || q2old < 0.)
return 0.0;
913 enhanceFac = max(enhanceFac, 1.0);
916 double Iz = getIz(zMin, zMax);
917 double comFac = 2.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
918 double ran = rndmPtr->flat();
919 double facLam = pow2(Lambda/kR) ;
920 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
928 double TrialIFGCollA::genQ2(
double q2old,
double sAK,
929 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
930 double,
double,
double headroomFac,
double enhanceFac) {
933 if (!checkInit())
return 0.0;
934 if (sAK < 0. || q2old < 0.)
return 0.0;
937 enhanceFac = max(enhanceFac,1.0);
940 double Iz = getIz(zMin, zMax);
941 double comFac = 2.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
942 double ran = rndmPtr->flat();
943 return q2old * pow(ran, comFac/alphaS);
950 double TrialIFGCollA::genZ(
double zMin,
double zMax) {
951 if (zMin > zMax || zMin < 0.)
return -1.;
952 double ran = rndmPtr->flat();
953 return zMax*pow(zMin/zMax,ran);
960 double TrialIFGCollA::getIz(
double zMin,
double zMax) {
961 if (zMin > zMax || zMin < 0.)
return 0.0;
962 return log(zMax/zMin);
969 double TrialIFGCollA::getZmin(
double Qt2,
double sAK,
double,
double) {
970 return (Qt2+sAK)/sAK;
973 double TrialIFGCollA::getZmax(
double,
double,
double eA,
double eBeamUsed) {
974 const double xA = eA/(sqrt(shhSav)/2.0);
975 const double eAmax = ( (sqrt(shhSav)/2.0) - (eBeamUsed - eA) );
976 const double xAmax = eAmax/(sqrt(shhSav)/2.0);
984 double TrialIFGCollA::getS1j(
double Qt2,
double zeta,
double sAK) {
987 if (zeta < 0)
return getSj2(Qt2,-zeta,sAK);
989 if (Qt2 < 0. || zeta <= 0.) {
990 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
993 return Qt2*zeta/(zeta - 1.0);
997 double TrialIFGCollA::getSj2(
double Qt2,
double zeta,
double sAK) {
1000 if (zeta < 0)
return getS1j(Qt2,-zeta,sAK);
1002 if (Qt2 < 0. || zeta <= 0.) {
1003 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1006 return sAK*(zeta - 1.0);
1014 double TrialIFGCollA::trialPDFratio(BeamParticle*, BeamParticle*,
1015 int,
int,
int,
double,
double,
double,
double) {
1016 trialPDFratioSav = 1.3;
1017 return trialPDFratioSav;
1028 double TrialIFSplitA::aTrial(
double saj,
double sjk,
double sAK) {
1029 if (saj < 0. || sjk < 0.)
return 0.;
1030 return 2.0/sAK*(sAK + sjk)/saj;
1037 double TrialIFSplitA::genQ2run(
double q2old,
double sAK,
1038 double zMin,
double zMax,
double colFac,
double PDFratio,
1039 double b0,
double kR,
double Lambda,
double,
double,
1040 double headroomFac,
double enhanceFac) {
1043 if (!checkInit())
return 0.0;
1044 if (sAK < 0. || q2old < 0.)
return 0.0;
1047 enhanceFac = max(enhanceFac, 1.0);
1050 double Iz = getIz(zMin,zMax);
1051 double comFac = 2.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1052 double ran = rndmPtr->flat();
1053 double facLam = pow2(Lambda/kR);
1054 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
1062 double TrialIFSplitA::genQ2(
double q2old,
double sAK,
1063 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
1064 double,
double,
double headroomFac,
double enhanceFac) {
1067 if (!checkInit())
return 0.0;
1068 if (sAK < 0. || q2old < 0.)
return 0.0;
1071 enhanceFac = max(enhanceFac, 1.0);
1074 double Iz = getIz(zMin,zMax);
1075 double comFac = 2.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1076 double ran = rndmPtr->flat();
1077 return q2old * pow(ran, comFac/alphaS);
1086 double TrialIFSplitA::genQ2thres(
double q2old,
double sAK,
1087 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
1088 int idA,
int,
double,
double,
bool,
1089 double headroomFac,
double enhanceFac) {
1093 double mQ = (abs(idA) == 4 ? mcSav : mbSav);
1096 if (!checkInit())
return 0.0;
1097 if (sAK < 0. || q2old < 0.)
return 0.0;
1100 enhanceFac = max(enhanceFac, 1.0);
1103 double Iz = getIz(zMin, zMax);
1104 double comFac = 2.0*M_PI/Iz/colFac/alphaS/PDFratio/(headroomFac*enhanceFac);
1105 double ran = rndmPtr->flat();
1106 return (exp(pow(ran, comFac) * log(q2old/pow2(mQ))) * pow2(mQ));
1114 double TrialIFSplitA::genZ(
double zMin,
double zMax) {
1115 if (zMin > zMax || zMin < 0.)
return -1.;
1116 double ran = rndmPtr->flat();
1117 return pow(ran*(1./zMax - 1./zMin) + 1./zMin, -1.0);
1124 double TrialIFSplitA::getIz(
double zMin,
double zMax) {
1125 if (zMin > zMax || zMin < 0.)
return 0.0;
1126 return (1./zMin - 1./zMax);
1133 double TrialIFSplitA::getZmin(
double Qt2,
double sAK,
double,
double) {
1134 if (useMevolSav)
return max(1.0, Qt2/sAK);
1135 else return (Qt2 + sAK)/sAK;
1138 double TrialIFSplitA::getZmax(
double,
double,
double eA,
double eBeamUsed) {
1139 double xA = eA/(sqrt(shhSav)/2.0);
1140 double eAmax = ((sqrt(shhSav)/2.0) - (eBeamUsed - eA));
1141 double xAmax = eAmax/(sqrt(shhSav)/2.0);
1149 double TrialIFSplitA::getS1j(
double Qt2,
double zeta,
double sAK) {
1152 if (zeta < 0)
return getSj2(Qt2, -zeta, sAK);
1154 if (Qt2 < 0. || zeta <= 0.) {
1155 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1159 if (!useMevolSav) saj *= zeta/(zeta - 1.0);
1164 double TrialIFSplitA::getSj2(
double Qt2,
double zeta,
double sAK) {
1167 if (zeta < 0)
return getS1j(Qt2, -zeta, sAK);
1169 if (Qt2 < 0. || zeta <= 0.) {
1170 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1173 double sjk = sAK*(zeta - 1.0);
1174 if (useMevolSav) sjk = (zeta - 1.0)*sAK;
1183 double TrialIFSplitA::trialPDFratio(BeamParticle* beamAPtr, BeamParticle*,
1184 int iSys,
int idA,
int,
double eA,
double,
double Qt2A,
double) {
1185 double xA = eA/(sqrt(shhSav)/2.0);
1186 double newPdf = max(beamAPtr->xfISR(iSys, 21, xA, Qt2A), TINYPDFtrial);
1187 double oldPdf = max(beamAPtr->xfISR(iSys, idA, xA, Qt2A), TINYPDFtrial);
1188 trialPDFratioSav = newPdf/oldPdf;
1189 return trialPDFratioSav;
1200 double TrialIFSplitK::aTrial(
double saj,
double sjk,
double sAK) {
1201 if (saj < 0. || sjk < 0.)
return 0.;
1202 return 1.0/2.0/sjk*pow2((sAK + sjk)/sAK);
1209 double TrialIFSplitK::genQ2run(
double q2old,
double sAK,
1210 double zMin,
double zMax,
double colFac,
double PDFratio,
1211 double b0,
double kR,
double Lambda,
double,
double,
1212 double headroomFac,
double enhanceFac) {
1215 if (!checkInit())
return 0.0;
1216 if (sAK < 0. || q2old < 0.)
return 0.0;
1219 enhanceFac = max(enhanceFac, 1.0);
1222 double Iz = getIz(zMin, zMax);
1223 double comFac = 8.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1224 double ran = rndmPtr->flat();
1225 double facLam = pow2(Lambda/kR);
1226 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
1234 double TrialIFSplitK::genQ2(
double q2old,
double sAK,
1235 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
1236 double,
double,
double headroomFac,
double enhanceFac) {
1239 if (!checkInit())
return 0.0;
1240 if (sAK < 0. || q2old < 0.)
return 0.0;
1243 enhanceFac = max(enhanceFac, 1.0);
1246 double Iz = getIz(zMin, zMax);
1247 double comFac = 8.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1248 double ran = rndmPtr->flat();
1249 return q2old * pow(ran, comFac/alphaS);
1257 double TrialIFSplitK::genZ(
double zMin,
double zMax) {
1258 if (zMin > zMax || zMin < 0.)
return -1.;
1259 double ran = rndmPtr->flat();
1260 return ran*(zMin - zMax)+zMax;
1267 double TrialIFSplitK::getIz(
double zMin,
double zMax) {
1268 if (zMin > zMax || zMin < 0.)
return 0.0;
1269 return (zMax - zMin);
1276 double TrialIFSplitK::getZmin(
double Qt2,
double sAK,
double eA,
1278 if (useMevolSav)
return 0.0;
1279 double xA = eA/(sqrt(shhSav)/2.0);
1280 double eAmax = ( (sqrt(shhSav)/2.0) - (eBeamUsed-eA) );
1281 double xAmax = eAmax/(sqrt(shhSav)/2.0);
1282 double sjkmax = sAK*(xAmax - xA)/xA;
1286 double TrialIFSplitK::getZmax(
double,
double,
double,
double) {
1294 double TrialIFSplitK::getS1j(
double Qt2,
double zeta,
double sAK) {
1297 if (zeta < 0)
return getSj2(Qt2, -zeta, sAK);
1299 if (Qt2 < 0. || zeta <= 0.) {
1300 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1303 double saj = Qt2+zeta*sAK;
1304 if (useMevolSav) saj = zeta*(sAK + Qt2);
1309 double TrialIFSplitK::getSj2(
double Qt2,
double zeta,
double sAK) {
1312 if (zeta < 0)
return getS1j(Qt2,-zeta,sAK);
1314 if (Qt2 < 0. || zeta <= 0.) {
1315 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1319 if (!useMevolSav) sjk /= zeta;
1328 double TrialIFSplitK::trialPDFratio(BeamParticle*, BeamParticle*,
1329 int,
int,
int,
double,
double,
double,
double) {
1330 trialPDFratioSav = 1.0;
1331 return trialPDFratioSav;
1342 double TrialIFConvA::aTrial(
double saj,
double sjk,
double sAK) {
1343 if (saj < 0. || sjk < 0. || sAK < 0.)
return 0.;
1344 return 1.0/saj*pow2((sAK + sjk)/sAK);
1351 double TrialIFConvA::genQ2run(
double q2old,
double sAK,
1352 double zMin,
double zMax,
double colFac,
double PDFratio,
1353 double b0,
double kR,
double Lambda,
double,
double,
1354 double headroomFac,
double enhanceFac) {
1357 if (!checkInit())
return 0.0;
1358 if (sAK < 0. || q2old < 0.)
return 0.0;
1361 enhanceFac = max(enhanceFac,1.0);
1364 double Iz = getIz(zMin, zMax);
1365 double comFac = 4.0*M_PI*b0/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1366 double ran = rndmPtr->flat();
1367 double facLam = pow2(Lambda/kR);
1368 return exp(pow(ran, comFac) * log(q2old/facLam)) * facLam;
1376 double TrialIFConvA::genQ2(
double q2old,
double sAK,
1377 double zMin,
double zMax,
double colFac,
double alphaS,
double PDFratio,
1378 double,
double,
double headroomFac,
double enhanceFac) {
1381 if (!checkInit())
return 0.0;
1382 if (sAK < 0. || q2old < 0.)
return 0.0;
1385 enhanceFac = max(enhanceFac, 1.0);
1388 double Iz = getIz(zMin, zMax);
1389 double comFac = 4.0*M_PI/Iz/colFac/PDFratio/(headroomFac*enhanceFac);
1390 double ran = rndmPtr->flat();
1391 return q2old * pow(ran, comFac/alphaS);
1399 double TrialIFConvA::genZ(
double zMin,
double zMax) {
1400 if (zMin > zMax || zMin < 0.)
return -1.;
1401 double ran = rndmPtr->flat();
1402 return zMax*pow(zMin/zMax, ran);
1409 double TrialIFConvA::getIz(
double zMin,
double zMax) {
1410 if (zMin > zMax || zMin < 0.)
return 0.0;
1411 return log(zMax/zMin);
1418 double TrialIFConvA::getZmin(
double Qt2,
double sAK,
double,
double) {
1420 if (Qt2<sAK)
return 1.0;
1421 else return Qt2/sAK;
1423 return (Qt2+sAK)/sAK;
1426 double TrialIFConvA::getZmax(
double,
double sAK,
double eA,
1428 double xA = eA/(sqrt(shhSav)/2.0);
1429 double eAmax = ((sqrt(shhSav)/2.0) - (eBeamUsed - eA));
1430 double xAmax = eAmax/(sqrt(shhSav)/2.0);
1431 double sjkmax = sAK*(xAmax - xA)/xA;
1432 return (sjkmax+sAK)/sAK;
1439 double TrialIFConvA::getS1j(
double Qt2,
double zeta,
double sAK) {
1442 if (zeta < 0)
return getSj2(Qt2, -zeta, sAK);
1444 if (Qt2 < 0. || zeta <= 0.) {
1445 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1449 if (!useMevolSav) saj *= zeta/(zeta - 1.0);
1454 double TrialIFConvA::getSj2(
double Qt2,
double zeta,
double sAK) {
1457 if (zeta < 0)
return getS1j(Qt2,-zeta,sAK);
1459 if (Qt2 < 0. || zeta <= 0.) {
1460 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": unphysical input");
1463 double sjk = sAK*(zeta - 1.0);
1464 if (useMevolSav) sjk = (zeta - 1.0)*sAK;
1473 double TrialIFConvA::trialPDFratio(BeamParticle* beamAPtr, BeamParticle*,
1474 int iSys,
int,
int,
double eOldA,
double,
double Qt2A,
double) {
1477 double xOldA = eOldA/(sqrt(shhSav)/2.0);
1478 int nQuark = nGtoQISRSav;
1479 if (nQuark >= 4 && Qt2A <= 4.0*mcSav*mcSav) nQuark = 3;
1480 else if (nQuark >= 5 && Qt2A <= 4.0*mbSav*mbSav) nQuark = 4;
1483 double oldPdf = max(beamAPtr->xfISR(iSys, 21, xOldA, Qt2A),TINYPDFtrial);
1486 map<int, double> trialPdfWeight;
1487 double trialPdfWeightSum = 0.0;
1488 for (
int idQ = -nQuark; idQ <= nQuark; idQ++) {
1490 if (idQ == 0)
continue;
1492 double fac = 2.0 + 0.5 * beamAPtr->nValence(idQ);
1493 trialPdfWeight[idQ] =
1494 max(fac * beamAPtr->xfISR(iSys, idQ, xOldA, Qt2A),TINYPDFtrial);
1495 trialPdfWeightSum += trialPdfWeight[idQ];
1499 double ranFlav = rndmPtr->flat() * trialPdfWeightSum;
1500 for (map<int,double>::iterator it = trialPdfWeight.begin();
1501 it != trialPdfWeight.end(); ++it) {
1502 double newPdf = it->second;
1505 trialFlavSav = it->first;
1506 trialPDFratioSav = newPdf/oldPdf;
1511 return trialPdfWeightSum/oldPdf;
1522 void BranchElementalISR::reset(
int iSysIn,
Event& event,
int i1In,
int i2In,
1523 int colIn,
bool isVal1In,
bool isVal2In) {
1528 isIIsav = ( !
event[i1In].isFinal() && !
event[i2In].isFinal() );
1532 if (isIIsav) swap = (
event[i1In].pz() < 0.0);
1533 else swap = (
event[i1In].isFinal());
1536 isVal1sav = isVal2In;
1537 isVal2sav = (isIIsav ? isVal1In :
false);
1543 isVal1sav = isVal1In;
1544 isVal2sav = (isIIsav ? isVal2In :
false);
1550 is1Asav = (
event[i1sav].pz() > 0);
1551 id1sav =
event[i1sav].id();
1552 id2sav =
event[i2sav].id();
1553 colType1sav =
event[i1sav].colType();
1554 colType2sav =
event[i2sav].colType();
1556 h1sav =
event[i1sav].pol();
1557 h2sav =
event[i2sav].pol();
1558 e1sav =
event[i1sav].e();
1559 e2sav =
event[i2sav].e();
1561 m2AntSav = m2(event[i1sav].p(),event[i2sav].p());
1562 mAntSav = m2AntSav >= 0 ? sqrt(m2AntSav) : sqrt(-m2AntSav);
1563 sAntSav = 2 *
event[i1sav].p() *
event[i2sav].p();
1565 clearTrialGenerators();
1573 new1=Particle(0,-41,i1sav,i2sav,0,0,0,0,0.);
1574 new2=Particle(0,43,i1sav,i2sav,0,0,0,0,0.);
1575 new3=Particle(0,isIIsav?-41:44,i1sav,i2sav,0,0,0,0,0.);
1577 new1.setEvtPtr(&event);
1578 new2.setEvtPtr(&event);
1579 new3.setEvtPtr(&event);
1587 void BranchElementalISR::clearTrialGenerators() {
1588 trialGenPtrsSav.resize(0);
1589 iAntPhysSav.resize(0);
1590 isSwappedSav.resize(0);
1591 hasSavedTrial.resize(0);
1593 scaleOldSav.resize(0);
1596 colFacSav.resize(0);
1598 physPDFratioSav.resize(0);
1599 trialPDFratioSav.resize(0);
1600 trialFlavSav.resize(0);
1601 extraMassPDFfactorSav.resize(0);
1602 headroomSav.resize(0);
1603 enhanceFacSav.resize(0);
1604 nShouldRescue.resize(0);
1614 void BranchElementalISR::addTrialGenerator(
int iAntPhysIn,
bool swapIn,
1615 TrialGeneratorISR* trialGenPtrIn) {
1616 trialGenPtrsSav.push_back(trialGenPtrIn);
1617 iAntPhysSav.push_back(iAntPhysIn);
1618 isSwappedSav.push_back(swapIn);
1619 hasSavedTrial.push_back(
false);
1620 scaleSav.push_back(-1.0);
1621 scaleOldSav.push_back(-1.0);
1622 zMinSav.push_back(0.0);
1623 zMaxSav.push_back(0.0);
1624 colFacSav.push_back(0.0);
1625 alphaSav.push_back(0.0);
1626 physPDFratioSav.push_back(0.0);
1627 trialPDFratioSav.push_back(0.0);
1628 trialFlavSav.push_back(0);
1629 extraMassPDFfactorSav.push_back(0.0);
1630 headroomSav.push_back(1.0);
1631 enhanceFacSav.push_back(1.0);
1632 nShouldRescue.push_back(0);
1639 void BranchElementalISR::saveTrial(
int iTrial,
double qOld,
double qTrial,
1640 double zMin,
double zMax,
double colFac,
double alphaEff,
double pdfRatio,
1641 int trialFlav,
double extraMpdf,
double headroom,
double enhanceFac) {
1642 hasSavedTrial[iTrial] =
true;
1643 scaleOldSav[iTrial] = qOld;
1644 scaleSav[iTrial] = qTrial;
1645 if (qTrial <= 0.)
return;
1646 zMinSav[iTrial] = zMin;
1647 zMaxSav[iTrial] = zMax;
1648 colFacSav[iTrial] = colFac;
1649 alphaSav[iTrial] = alphaEff;
1650 trialPDFratioSav[iTrial] = pdfRatio;
1651 trialFlavSav[iTrial] = trialFlav;
1652 extraMassPDFfactorSav[iTrial] = extraMpdf;
1653 headroomSav[iTrial] = headroom;
1654 enhanceFacSav[iTrial] = enhanceFac;
1661 bool BranchElementalISR::genTrialInvariants(
double& s1j,
double& sj2,
1662 double eBeamUsed,
int iTrial) {
1666 if (iGen == -1) iGen = getTrialIndex();
1667 if (iGen <= -1)
return false;
1668 double z = trialGenPtrsSav[iGen]->genZ(zMinSav[iGen],zMaxSav[iGen]);
1672 double Q2E = pow2(scaleSav[iGen]);
1673 if (abs(z) < trialGenPtrsSav[iGen]->getZmin(Q2E,sAntSav,e1sav,eBeamUsed) ||
1674 abs(z) > trialGenPtrsSav[iGen]->getZmax(Q2E,sAntSav,e1sav,eBeamUsed))
1677 s1j = trialGenPtrsSav[iGen]->getS1j(Q2E,z,sAntSav);
1678 sj2 = trialGenPtrsSav[iGen]->getSj2(Q2E,z,sAntSav);
1687 int BranchElementalISR::getTrialIndex()
const {
1690 for (
int i = 0; i < int(scaleSav.size()); ++i) {
1691 if (hasSavedTrial[i]) {
1692 double qSav = scaleSav[i];
1706 double BranchElementalISR::getTrialScale()
const {
1708 for (
int i = 0; i < int(scaleSav.size()); ++i) {
1709 if (hasSavedTrial[i]) qMax = max(qMax,scaleSav[i]);
1711 printOut(__METHOD_NAME__,
1712 +
"Error! not all trials have saved scales");
1722 void BranchElementalISR::list(
bool header,
bool footer)
const {
1725 cout<<
"\n -------- VINCIA ISR Dipole-Antenna Listing -------------"
1726 <<
"--------- (S=sea, V=val, F=final) "
1727 <<
"----------------------------------"
1729 <<
" sys type mothers colTypes col ID codes hels"
1730 <<
" m TrialGenerators\n";
1732 cout << setw(5) << system <<
" ";
1734 if (isIIsav) cout << (isVal1sav ?
"V" :
"S") << (isVal2sav ?
"V" :
"S");
1735 else cout << (isVal1sav ?
"V" :
"S") <<
"F";
1736 cout << setw(5) << i1sav <<
" " << setw(5) << i2sav <<
" ";
1737 cout << setw(3) << colType1sav <<
" ";
1738 cout << setw(3) << colType2sav <<
" ";
1739 cout << setw(6) << colSav <<
" ";
1740 cout << setw(9) << id1sav;
1741 cout << setw(9) << id2sav <<
" ";
1743 cout << setw(2) << h1sav <<
" " << setw(2) << h2sav <<
" ";
1744 cout << setw(10) << mAnt() <<
" ";
1745 for (
int j = 0; j < (int)trialGenPtrsSav.size(); j++) {
1746 string trialName = trialGenPtrsSav[j]->name();
1747 trialName.erase(0, 5);
1748 cout <<
" " << trialName;
1752 cout <<
"\n -------- End VINCIA SpaceShower Antenna Listing --------"
1754 <<
"-----------------------------------------------------------\n";
1766 void VinciaISR::init(BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn) {
1770 if (settingsPtr->word(
"Merging:Process").compare(
"void") == 0)
return;
1771 if (verbose >= veryloud) printOut(__METHOD_NAME__,
"begin --------------");
1778 nCallPythiaNext = 0;
1779 verbose = settingsPtr->mode(
"Vincia:verbose");
1782 doII = settingsPtr->flag(
"PartonLevel:ISR")
1783 && settingsPtr->flag(
"Vincia:doII");
1784 doIF = settingsPtr->flag(
"PartonLevel:ISR")
1785 && settingsPtr->flag(
"Vincia:doIF");
1788 beamFrameType = settingsPtr->mode(
"Beams:frameType");
1791 beamAPtr = beamAPtrIn;
1792 beamBPtr = beamBPtrIn;
1793 if (beamAPtr->pz() < 0)
1794 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__+
": beamA has pz < 0");
1797 m2BeamsSav = m2(beamAPtr->p(), beamBPtr->p());
1798 eCMBeamsSav = sqrt(m2BeamsSav);
1799 eBeamA = beamAPtr->e();
1800 eBeamB = beamBPtr->e();
1803 hasUserHooks = (userHooksPtr != 0);
1804 canVetoEmission = (hasUserHooks && userHooksPtr->canVetoISREmission());
1807 nGluonToQuarkI = settingsPtr->mode(
"Vincia:nGluonToQuark");
1808 nGluonToQuarkF = settingsPtr->mode(
"Vincia:nGluonToQuark");
1809 convGluonToQuarkI = settingsPtr->flag(
"Vincia:convertGluonToQuark");
1810 convQuarkToGluonI = settingsPtr->flag(
"Vincia:convertQuarkToGluon");
1813 nFlavZeroMass = settingsPtr->mode(
"Vincia:nFlavZeroMass");
1815 helicityShower = settingsPtr->flag(
"Vincia:helicityShower");
1817 sectorShower = settingsPtr->flag(
"Vincia:sectorShower");
1819 kineMapIFretry = settingsPtr->flag(
"Vincia:kineMapIFretry");
1829 cutoffScaleII = settingsPtr->parm(
"Vincia:cutoffScaleII");
1830 cutoffScaleIF = settingsPtr->parm(
"Vincia:cutoffScaleIF");
1834 bool insideBounds =
true;
1835 if (beamAPtr->isHadron()) {
1836 if (doII && !beamAPtr->insideBounds(xTest, pow2(cutoffScaleII)))
1837 insideBounds =
false;
1838 if (doIF && !beamAPtr->insideBounds(xTest, pow2(cutoffScaleIF)))
1839 insideBounds =
false;
1841 if (beamBPtr->isHadron()) {
1842 if (doII && !beamBPtr->insideBounds(xTest, pow2(cutoffScaleII)))
1843 insideBounds =
false;
1844 if (doIF && !beamBPtr->insideBounds(xTest, pow2(cutoffScaleIF)))
1845 insideBounds =
false;
1847 if (!insideBounds) {
1848 infoPtr->errorMsg(
"Warning in VinciaISR::init: PDF QMin scale is "
1849 "above ISR shower cutoff.",
"PDFs will be treated as frozen below QMin.");
1853 useCMW = settingsPtr->flag(
"Vincia:useCMW");
1854 alphaSptr = &vinComPtr->alphaStrong;
1855 if (useCMW) alphaSptr = &vinComPtr->alphaStrongCMW;
1858 alphaSorder = settingsPtr->mode(
"Vincia:alphaSorder");
1859 alphaSvalue = settingsPtr->parm(
"Vincia:alphaSvalue");
1860 aSkMu2EmitI = settingsPtr->parm(
"Vincia:renormMultFacEmitI");
1861 aSkMu2SplitI = settingsPtr->parm(
"Vincia:renormMultFacSplitI");
1862 aSkMu2Conv = settingsPtr->parm(
"Vincia:renormMultFacConvI");
1863 aSkMu2SplitF = settingsPtr->parm(
"Vincia:renormMultFacSplitF");
1864 alphaSmax = settingsPtr->parm(
"Vincia:alphaSmax");
1865 alphaSmuFreeze = settingsPtr->parm(
"Vincia:alphaSmuFreeze");
1866 mu2freeze = pow2(alphaSmuFreeze);
1869 alphaSmuMin = max(alphaSmuFreeze, 1.05 *alphaSptr->Lambda3());
1870 mu2min = pow2(alphaSmuMin);
1873 if (alphaSorder >= 1) alphaSmax = min(alphaSmax, alphaSptr->alphaS(mu2min));
1877 BeamParticle* beamUsePtr =
1878 ((abs(beamAPtr->id()) < 100) ? beamBPtr : beamAPtr);
1879 if ((abs(beamUsePtr->id()) > 100) && (nFlavZeroMass < 5)) {
1880 vector<double> masses;
1882 masses[0] = settingsPtr->parm(
"Vincia:ThresholdMB");
1883 masses[1] = settingsPtr->parm(
"Vincia:ThresholdMC");
1884 for (
int i = 0; i < (5 - nFlavZeroMass); i++) {
1886 if (beamUsePtr->mQuarkPDF(5 - i) > 0.0) {
1887 masses[i] = beamUsePtr->mQuarkPDF(5 - i);
1891 double startMass = masses[i];
1893 double scale2Last = pow2(startMass);
1894 double xfLast = beamUsePtr->xf(5 - i ,0.001, scale2Last);
1895 for (
int j = 1; j <= maxTry; j++) {
1896 double scale2Now = pow2( startMass + 0.005*((
double)(j)) );
1897 double xfNow = beamUsePtr->xf(5 - i, 0.001 ,scale2Now);
1899 if ((xfNow-xfLast) > TINY) {
1900 masses[i] = sqrt(scale2Last);
1904 scale2Last = scale2Now;
1908 for (
int i = 0; i < (int)masses.size(); i++) {
1909 (i == 0 ? mb : mc) = masses[i];
1910 if (verbose >= quiteloud)
1911 printOut(__METHOD_NAME__,
"Found " + num2str(masses[i]) +
1912 (i==0 ?
" as b mass." :
" as c mass."));
1920 regMinScalesMtSav.clear();
1921 regMinScalesSav.clear();
1922 regMinScalesNow.clear();
1924 regMinScalesMtSav.push_back(mc/16.0);
1925 regMinScalesMtSav.push_back(mc/5.0);
1926 regMinScalesMtSav.push_back(mc);
1927 regMinScalesMtSav.push_back(mb);
1928 regMinScalesMtSav.push_back(mtb);
1929 regMinScalesMtSav.push_back(mt);
1931 regMinScalesSav = regMinScalesMtSav;
1932 double qMinNow = 2.0*mt;
1933 double multFac = 2.0;
1934 while (qMinNow < eCMBeamsSav) {
1935 int iRegNew = int(log(qMinNow/mt)/log(5) + 5);
1936 int iRegMax = int(regMinScalesSav.size()) - 1;
1937 if (iRegNew > iRegMax)
1938 regMinScalesSav.push_back(pow(5, (
double)(iRegMax+1) - 5.0)*mt);
1943 vector<TrialGeneratorISR*> trialGenerators;
1944 trialGenerators.push_back(&trialIISoft);
1945 trialGenerators.push_back(&trialIIGCollA);
1946 trialGenerators.push_back(&trialIIGCollB);
1947 trialGenerators.push_back(&trialIISplitA);
1948 trialGenerators.push_back(&trialIISplitB);
1949 trialGenerators.push_back(&trialIIConvA);
1950 trialGenerators.push_back(&trialIIConvB);
1951 trialGenerators.push_back(&trialIFSoft);
1952 trialGenerators.push_back(&trialVFSoft);
1953 trialGenerators.push_back(&trialIFGCollA);
1954 trialGenerators.push_back(&trialIFSplitA);
1955 trialGenerators.push_back(&trialIFSplitK);
1956 trialGenerators.push_back(&trialIFConvA);
1957 for (
int indx = 0; indx < int(trialGenerators.size()); ++indx) {
1958 trialGenerators[indx]->initPtr(infoPtr);
1959 trialGenerators[indx]->init(mc, mb);
1963 enhanceInHard = settingsPtr->flag(
"Vincia:enhanceInHardProcess");
1964 enhanceInMPI = settingsPtr->flag(
"Vincia:enhanceInMPIshowers");
1965 enhanceAll = settingsPtr->parm(
"Vincia:enhanceFacAll");
1966 enhanceBottom = settingsPtr->parm(
"Vincia:enhanceFacBottom");
1967 enhanceCharm = settingsPtr->parm(
"Vincia:enhanceFacCharm");
1968 enhanceCutoff = settingsPtr->parm(
"Vincia:enhanceCutoff");
1971 Paccept.resize(max(weightsPtr->nWeights(), 1));
1978 int nAntPhysMax = 20;
1979 nTrials.resize(nAntPhysMax + 1);
1980 nTrialsAccepted.resize(nAntPhysMax + 1);
1981 nFailedVeto.resize(nAntPhysMax + 1);
1982 rFailedVetoPDF.resize(nAntPhysMax + 1);
1983 nFailedHull.resize(nAntPhysMax + 1);
1984 nFailedKine.resize(nAntPhysMax + 1);
1985 nFailedMass.resize(nAntPhysMax + 1);
1986 nFailedCutoff.resize(nAntPhysMax + 1);
1987 nClosePSforHQ.resize(nAntPhysMax + 1);
1988 nSectorReject.resize(nAntPhysMax + 1);
1996 pTmaxMatch = settingsPtr->mode(
"Vincia:pTmaxMatch");
1997 pTmaxFudge = settingsPtr->parm(
"Vincia:pTmaxFudge");
1998 pT2maxFudge = pow2(pTmaxFudge);
1999 pT2maxFudgeMPI = pow2(settingsPtr->parm(
"Vincia:pTmaxFudgeMPI"));
2000 TINYPDF = pow(10, -10);
2003 if (verbose >= debug) cout <<
" VinciaISR(): initializing antennaSet" << endl;
2007 if (!qedShowerPtr->isInit()) {
2008 if (verbose >= debug)
2009 cout <<
" VinciaISR(): initializing QED shower module" << endl;
2010 qedShowerPtr->init(beamAPtrIn, beamBPtrIn);
2015 if (verbose >= normal) fsrPtr->header();
2017 if (verbose >= veryloud) printOut(__METHOD_NAME__,
"end --------------");
2025 bool VinciaISR::limitPTmax(
Event& event,
double,
double) {
2028 if (pTmaxMatch == 1)
return true;
2029 else if (pTmaxMatch == 2)
return false;
2032 else if (infoPtr->isNonDiffractive() || infoPtr->isDiffractiveA() ||
2033 infoPtr->isDiffractiveB() || infoPtr->isDiffractiveC())
2038 const int iSysHard = 0;
2039 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSysHard); ++i) {
2040 int idAbs =
event[partonSystemsPtr->getOut(iSysHard, i)].idAbs();
2041 if (idAbs <= 5 || idAbs == 21 || idAbs == 22)
return true;
2042 else if (idAbs == 6 && nGluonToQuarkF == 6)
return true;
2054 void VinciaISR::prepare(
int iSys,
Event& event,
bool) {
2057 if (!(doII || doIF))
return;
2058 if (infoPtr->getAbortPartonLevel()) {
2059 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
": Aborting.");
2062 if (verbose >= debug){
2063 printOut(__METHOD_NAME__,
"begin --------------");
2064 if (verbose >= louddebug) {
2066 ss <<
"Preparing system " << iSys;
2067 printOut(__METHOD_NAME__, ss.str());
2069 if (verbose >= superdebug) {
2071 partonSystemsPtr->list();
2074 nAccepted = max(nAccepted, infoPtr->nAccepted());
2077 bool firstCallInEvent = (iSys == 0);
2079 int nCallPythiaNextNow = infoPtr->getCounter(3);
2080 if (nCallPythiaNextNow > nCallPythiaNext) {
2081 nCallPythiaNext = nCallPythiaNextNow;
2084 firstCallInEvent =
true;
2087 long nSelectedNow = infoPtr->nSelected();
2088 if (nSelectedNow > nSelected) {
2089 nSelected = nSelectedNow;
2092 firstCallInEvent =
true;
2096 int nVetoUserHooksNow = (infoPtr->getCounter(10)-1);
2097 if (nVetoUserHooksNow > nVetoUserHooks) {
2098 nVetoUserHooks = nVetoUserHooksNow;
2099 firstCallInEvent =
true;
2104 int nFailHadLevelNow = (infoPtr->getCounter(14)-1);
2105 if (nFailHadLevelNow > nFailHadLevel) {
2106 nFailHadLevel = nFailHadLevelNow;
2107 firstCallInEvent =
true;
2111 if (firstCallInEvent) {
2113 vinComPtr->resetCounters();
2116 weightsPtr->resetWeights(infoPtr->nAccepted());
2124 regMinScalesNow.clear();
2125 regMinScalesNow = regMinScalesMtSav;
2126 regMinScalesNow.push_back(sqrt(infoPtr->Q2Fac()));
2128 stable_sort(regMinScalesNow.begin(), regMinScalesNow.end());
2130 double qMinOld = regMinScalesNow[(int)regMinScalesNow.size()-1];
2131 double qMinNow = 2.0*qMinOld;
2132 double multFac = 2.0;
2133 while (qMinNow < eCMBeamsSav) {
2134 int iRegNew = int(log(qMinNow/qMinOld)/log(6) + 6);
2135 int iRegMax = int(regMinScalesNow.size()) - 1;
2136 if (iRegNew > iRegMax)
2137 regMinScalesNow.push_back(pow(6, (
double)(iRegMax+1)-6.0)*qMinOld);
2144 for (
int j = 0; j < 11; ++j) {
2145 qBranch[iSys][j] = 0.0;
2146 pTphys[iSys][j] = 0.0;
2150 int sizeSystem = partonSystemsPtr->sizeAll(iSys);
2151 if (sizeSystem <= 1)
return;
2154 hasPrepared[iSys] =
false;
2155 if ( !partonSystemsPtr->hasInAB(iSys) )
return;
2161 hasPrepared[iSys] =
true;
2167 nBranchISR[iSys] = 0;
2169 bool finalOnly =
false;
2171 polarisedSys[iSys] = mecsPtr->isPolarised(iSys, event, finalOnly);
2172 else polarisedSys[iSys] =
false;
2173 if (verbose >= superdebug)
2174 printOut(__METHOD_NAME__,
"Checking process class for MECs");
2178 if (partonSystemsPtr->hasInAB(iSys)) nIn = 2;
2179 if (nIn == 2 && iSys == 0) isHardSys[iSys] =
true;
2182 bool makeNewCopies =
false;
2183 if (!vinComPtr->mapToMassless(iSys, event, partonSystemsPtr, makeNewCopies))
2189 for (
int iBeam = 0; iBeam <= 1; ++iBeam) {
2190 int iNew = (iBeam == 0) ? partonSystemsPtr->getInA(iSys) :
2191 partonSystemsPtr->getInB(iSys);
2192 if (iNew == 0)
continue;
2193 BeamParticle& beamNow = (
event[iNew].pz() > 0.0 ?
2194 *beamAPtr : *beamBPtr);
2195 double eBeamNow = (
event[iNew].pz() > 0.0 ? eBeamA : eBeamB);
2196 beamNow[iSys].update( iNew, event[iNew].
id(), event[iNew].e()/eBeamNow );
2200 doMECsSys[iSys] = mecsPtr->prepare(iSys, event);
2203 if (doMECsSys[iSys] && helicityShower)
2204 polarisedSys[iSys] = mecsPtr->polarise(iSys, event);
2207 if (doMECsSys[iSys]) doMECsSys[iSys] = mecsPtr->doMEC(iSys, 1);
2210 fsrPtr->polarisedSys[iSys] = polarisedSys[iSys];
2211 fsrPtr->doMECsSys[iSys] = doMECsSys[iSys];
2212 fsrPtr->isHardSys[iSys] = isHardSys[iSys];
2213 fsrPtr->isResonanceSys[iSys] =
false;
2216 colourPtr->colourise(iSys,event);
2217 if (verbose >= superdebug) {
2218 printOut(__METHOD_NAME__,
"Event after colourise.");
2220 printOut(__METHOD_NAME__,
"Making colour maps");
2224 map<int,int> indexOfAcol;
2225 map<int,int> indexOfCol;
2228 for (
int i = 0; i < sizeSystem; ++i) {
2229 int i1 = partonSystemsPtr->getAll( iSys, i);
2230 if ( i1 <= 0 )
continue;
2232 int col =
event[i1].col();
2233 int acol =
event[i1].acol();
2235 if (!event[i1].isFinal()) {
2237 acol =
event[i1].col();
2238 if (event[i1].pz() > 0.0) {
2239 initialA[iSys] =
event[i1];
2240 eBeamAUsed +=
event[i1].e();
2242 initialB[iSys] =
event[i1];
2243 eBeamBUsed +=
event[i1].e();
2246 if (col > 0) indexOfCol[col] = i1;
2247 else if (col < 0) indexOfAcol[-col] = i1;
2248 if (acol > 0) indexOfAcol[acol] = i1;
2249 else if (acol < 0) indexOfCol[-acol] = i1;
2253 int sizeOld = branchElementals.size();
2254 for (map<int,int>::iterator it = indexOfCol.begin();
2255 it != indexOfCol.end(); ++it) {
2257 int col = it->first;
2260 int i1 = it->second;
2261 int i2 = indexOfAcol[col];
2262 if (col == 0 || i1 == 0 || i2 == 0)
continue;
2264 if ((event[i1].isFinal()) && (
event[i2].isFinal()))
continue;
2265 if (verbose >= louddebug ) {
2266 stringstream ss(
"Creating antenna between ");
2267 ss << i1 <<
" , " << i2 <<
" col = " << col;
2268 printOut(__METHOD_NAME__, ss.str());
2273 if (!event[i1].isFinal()) {
2274 BeamParticle& beam1 = (
event[i1].pz() > 0.0) ? *beamAPtr : *beamBPtr;
2275 isVal1 = beam1[iSys].isValence();
2279 if (!event[i2].isFinal()) {
2280 BeamParticle& beam2 = (
event[i2].pz() > 0.0) ? *beamAPtr : *beamBPtr;
2281 isVal2 = beam2[iSys].isValence();
2285 BranchElementalISR trial(iSys, event, i1, i2, col, isVal1, isVal2);
2286 resetTrialGenerators(&trial);
2288 branchElementals.push_back(trial);
2294 for (
int i = 0; i < (int)partsSav[iSys].size(); i++) {
2295 if (partsSav[iSys][i].
id() == 21) nG[iSys]++;
2296 else if (abs(partsSav[iSys][i].
id()) < 7) nQQ[iSys]++;
2299 nQQ[iSys] = nQQ[iSys]/2;
2302 if ((
int)branchElementals.size() == sizeOld) {
2303 if (verbose >= debug)
2304 printOut(__METHOD_NAME__,
"did not find any antennae: exiting.");
2309 setStartScale(iSys,event);
2311 if (verbose >= debug) {
2312 if (verbose >= superdebug) list();
2313 printOut(__METHOD_NAME__,
"end --------------");
2321 void VinciaISR::update(
int iSys,
Event& event,
bool) {
2324 if (!(doII || doIF) || !isPrepared)
return;
2325 if (!partonSystemsPtr->hasInAB(iSys))
return;
2326 if (verbose >= debug) {
2327 printOut(__METHOD_NAME__,
"begin --------------");
2328 if (verbose >= superdebug) {
2330 ss <<
"Updating iSys: " << iSys;
2331 printOut(__METHOD_NAME__, ss.str());
2333 printOut(__METHOD_NAME__,
"list of ISR dipoles before update:");
2335 partonSystemsPtr->list();
2338 int inA = partonSystemsPtr->getInA(iSys);
2339 int inB = partonSystemsPtr->getInB(iSys);
2340 if (inA <= 0 || inB <= 0 ) {
2342 ss <<
"in system " << iSys <<
" inA = " << inA <<
" inB = " << inB;
2343 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__
2344 +
": Incoming particles nonpositive",ss.str());
2353 map<int,int> indexOfAcol;
2354 map<int,int> indexOfCol;
2358 for (
int i = 0; i < partonSystemsPtr->sizeAll(iSys); ++i) {
2359 int i1 = partonSystemsPtr->getAll( iSys, i);
2360 if (i1 <= 0)
continue;
2362 if (i1 > event.size()) {
2364 cout <<
" iSys = " << iSys <<
" / nSys = " << partonSystemsPtr->sizeSys()
2365 <<
" i = " << i <<
" / n = " << partonSystemsPtr->sizeAll(iSys)
2366 <<
" i1 = " << i1 <<
" / event.size() = " <<
event.size() << endl;
2368 int col =
event[i1].col();
2369 int acol =
event[i1].acol();
2372 if (!event[i1].isFinal()) {
2374 acol =
event[i1].col();
2376 if (col > 0) indexOfCol[col] = i1;
2377 else if (col < 0) indexOfAcol[-col] = i1;
2378 if (acol > 0) indexOfAcol[acol] = i1;
2379 else if (acol < 0) indexOfCol[-acol] = i1;
2382 if (event[i1].
id() == 21) nG[iSys]++;
2383 else if (event[i1].idAbs() < 7) nQQ[iSys]++;
2385 nQQ[iSys] = nQQ[iSys]/2;
2390 for (vector<BranchElementalISR>::iterator antIt = branchElementals.end() - 1;
2391 antIt != branchElementals.begin() - 1; --antIt) {
2393 if (antIt->system != iSys)
continue;
2394 bool doUpdate =
false;
2395 bool doRemove =
false;
2396 bool foundColour=
true;
2397 int antCol = antIt->col();
2398 int i1 = antIt->geti1();
2399 int i2 = antIt->geti2();
2405 if (indexOfAcol.find(antCol) == indexOfAcol.end()) {
2406 if (verbose >= normal) infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
2407 +
": Could not find antenna colour in list of anti-colour indices.");
2408 foundColour =
false;
2411 if (indexOfCol.find(antCol) == indexOfCol.end()) {
2412 if (verbose >= normal) infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
2413 +
": Could not find antenna colour in list of colour indices.");
2414 foundColour =
false;
2419 if (antIt->isII()) {
2423 if (event[i1].col() >0 &&
event[i1].col() == antCol)
2424 i1New = indexOfAcol[antCol];
2425 else i1New = indexOfCol[antCol];
2429 if (event[i2].col() >0 &&
event[i2].col() == antCol)
2430 i2New = indexOfAcol[antCol];
2431 else i2New = indexOfCol[antCol];
2436 bool QEDbackwards=
false;
2437 if (event[i1New].isFinal() &&
event[i1New].mother1()==inA &&
2438 event[inA].id()==22) QEDbackwards=
true;
2440 if (!QEDbackwards && verbose >= normal) {
2441 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
2442 +
": Could not find iA in II antenna! Removing.");
2451 bool QEDbackwards =
false;
2452 if(event[i2New].isFinal() && event[i2New].mother1() == inB &&
2453 event[inB].
id() == 22) QEDbackwards =
true;
2455 if (!QEDbackwards && verbose >= normal) {
2456 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__+
2457 ": Could not find iB in II antenna! Removing.");
2463 if (!doRemove && (i1 != i1New || i2 != i2New)) doUpdate =
true;
2470 if (event[i1].col() >0 && event[i1].col() == antCol)
2471 i1New = indexOfAcol[antCol];
2472 else i1New = indexOfCol[antCol];
2475 if(event[i2].col()>0 && event[i2].col()==antCol)
2476 i2New = indexOfCol[antCol];
2477 else i2New = indexOfAcol[antCol];
2480 int inX = antIt->is1A() ? inA : inB;
2484 bool QEDbackwards =
false;
2485 if(event[i1New].isFinal() && event[i1New].mother1() == inX &&
2486 event[inX].
id() == 22) QEDbackwards =
true;
2488 if (!QEDbackwards && verbose >= normal) {
2489 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
2490 +
": Could not find inA/inB in IF antenna! Removing.");
2496 else if(i1 != i1New || i2 != i2New) doUpdate =
true;
2502 antIt->reset(iSys, event, i1New,i2New, antCol,
2503 antIt->isVal1(), antIt->isVal2());
2504 resetTrialGenerators(&(*antIt));
2506 indexOfAcol.erase(antCol);
2507 indexOfCol.erase(antCol);
2512 if (doRemove) branchElementals.erase(antIt);
2518 for (map<int,int>::iterator colIt = indexOfCol.begin();
2519 colIt != indexOfCol.end(); ++colIt) {
2520 int colNow = colIt->first;
2521 int i1Now = colIt->second;
2522 if (indexOfAcol.find(colNow) == indexOfAcol.end()) {
2523 if (verbose>=normal) {
2525 ss <<
" Colour tag = " << colNow <<
" event index: " << i1Now;
2526 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__
2527 +
": Unmatched colour index. Aborting.",ss.str());
2528 infoPtr->setAbortPartonLevel(
true);
2532 int i2Now=indexOfAcol[colNow];
2533 if (i1Now <=0 || i2Now <= 0) {
2534 if (verbose >= normal) infoPtr->errorMsg(
"Error in "+__METHOD_NAME__
2535 +
": Colour tag attached to impossible event index!");
2537 }
else if(!event[i1Now].isFinal() || !event[i2Now].isFinal()) {
2538 if (verbose >= louddebug) {
2539 stringstream ss(
"Creating antenna between ");
2540 ss << i1Now <<
" , " << i2Now <<
" col = "<< colNow;
2541 printOut(__METHOD_NAME__, ss.str());
2543 BeamParticle& beam1 = (
event[i1Now].pz() > 0.0) ?
2544 *beamAPtr : *beamBPtr;
2545 BeamParticle& beam2 = (
event[i2Now].pz() > 0.0) ?
2546 *beamAPtr : *beamBPtr;
2547 bool isVal1 = beam1[iSys].isValence();
2548 bool isVal2 = beam2[iSys].isValence();
2552 BranchElementalISR trial(iSys, event, i1Now, i2Now, colNow, isVal1,
2554 resetTrialGenerators(&trial);
2556 branchElementals.push_back(trial);
2558 indexOfAcol.erase(colNow);
2563 if (indexOfAcol.size() > 0) {
2564 if (verbose >= normal)
2565 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__
2566 +
": Unmatched anticolour index!");
2567 infoPtr->setAbortPartonLevel(
true);
2573 if (doMECsSys[iSys] && !mecsPtr->doMEC(iSys, nBranch[iSys])) {
2574 doMECsSys[iSys] =
false;
2575 for (
int i = 0; i < (int)branchElementals.size(); i++) {
2576 BranchElementalISR* trial = &branchElementals[i];
2577 if (trial->system == iSys) trial->renewTrial();
2582 if (branchElementals.size() <= 0) {
2583 if (verbose >= debug)
2584 printOut(
"VinciaISR::update",
"did not find any antennae: exiting.");
2587 if (verbose > debug) {
2588 if (!checkAntennae(event)) {
2590 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__
2591 +
": Failed checkAntennae. Aborting.");
2592 infoPtr->setAbortPartonLevel(
true);
2596 if (verbose >= debug) {
2597 if (verbose >= superdebug) list();
2598 printOut(__METHOD_NAME__,
"end --------------");
2607 double VinciaISR::pTnext(
Event& event,
double pTevolBegAll,
2608 double pTevolEndAll,
int,
bool) {
2611 if (infoPtr->getAbortPartonLevel() || !(doII || doIF))
return 0.;
2612 if (verbose >= debug) printOut(__METHOD_NAME__,
"begin --------------");
2613 if (branchElementals.size() <= 0)
return 0.0;
2614 if (verbose >= louddebug){
2615 stringstream ss(
"(re)starting evolution between pTevolBegAll = ");
2616 ss << num2str(pTevolBegAll) <<
" and pTevolEndAll = " << pTevolEndAll;
2617 printOut(__METHOD_NAME__, ss.str());
2621 bool allSkipped =
true;
2622 bool qEndsmallerCutoff =
true;
2625 double qOld = pTevolBegAll;
2626 double qEndAll = pTevolEndAll;
2630 winnerPtr =
nullptr;
2635 unsigned int nAnt = branchElementals.size();
2636 if (verbose >= superdebug) {
2637 stringstream ss(
"Looping over ");
2638 ss << nAnt <<
" antennae.";
2639 printOut(__METHOD_NAME__, ss.str());
2641 for (
unsigned int iAnt = 0; iAnt < nAnt; iAnt++) {
2644 BranchElementalISR* trialPtr = &branchElementals[iAnt];
2645 int iSys = trialPtr->system;
2646 double qMax = min(qOld, sqrt(Q2hat[iSys]));
2647 double s12 = trialPtr->sAnt();
2648 int id1 = trialPtr->id1sav;
2649 int id2 = trialPtr->id2sav;
2650 double e1 = trialPtr->e1sav;
2651 double e2 = trialPtr->e2sav;
2652 bool isII = trialPtr->isII();
2653 bool is1A = trialPtr->is1A();
2656 if (isII && !doII)
continue;
2657 else if (!isII && !doIF)
continue;
2658 if (verbose >= superdebug) {
2659 stringstream ss(
"Processing antenna ");
2660 ss << iAnt+1 <<
" / " << nAnt;
2661 printOut(__METHOD_NAME__, ss.str());
2663 ss << iSys <<
" id1 = " << id1 <<
" id2 = " << id2 <<
" nTrialGens = "
2664 << trialPtr->nTrialGenerators() <<
" qMax = " << qMax;
2665 printOut(__METHOD_NAME__, ss.str());
2669 double qBegin = qMax;
2671 double qEnd = qEndAll;
2673 double cutoffScale = (isII ? cutoffScaleII : cutoffScaleIF);
2675 if (trialPtr->nTrialGenerators() == 0)
continue;
2678 double qTrialMax = 0.0;
2680 for (
int indx = 0; indx < (int)trialPtr->nTrialGenerators(); ++indx) {
2683 TrialGeneratorISR* trialGenPtr = trialPtr->trialGenPtrsSav[indx];
2684 int iAntPhys = trialPtr->getPhysIndex(indx);
2685 bool swapped = trialPtr->getIsSwapped(indx);
2686 double qBeginNow = qBegin;
2687 double qEndNow = qEnd;
2690 qBeginNow = min(qBeginNow, sqrt(trialGenPtr->getQ2max(s12, e1,
2691 is1A ? eBeamAUsed : eBeamBUsed)));
2694 if (qBeginNow < qWin || qBeginNow < qTrialMax)
continue;
2695 if (qEndAll > cutoffScale) qEndsmallerCutoff =
false;
2698 if ((qBeginNow <= cutoffScale) || (qBeginNow <= qEndNow)) {
2700 if (verbose >= superdebug) printOut(__METHOD_NAME__,
2701 "skipping this trial since qBeginNow = " + num2str(qBeginNow) +
2702 " cutoffScale = " + num2str(cutoffScale) +
2703 " qEndNow = " + num2str(qEndNow));
2709 double qTrial = qBeginNow;
2712 bool acceptRegion =
false;
2713 int iRegion = getRegion(qTrial);
2716 while (!acceptRegion) {
2719 double qMinNow = max(cutoffScale, getQmin(iRegion));
2720 double q2MinNow = pow2(qMinNow);
2721 double zMinNow = trialGenPtr->getZmin(q2MinNow, s12, e1,
2722 is1A ? eBeamAUsed : eBeamBUsed);
2723 double zMaxNow = trialGenPtr->getZmax(q2MinNow, s12, e1,
2724 is1A ? eBeamAUsed : eBeamBUsed);
2727 double headroomFac = getHeadroomFac(iSys, iAntPhys, qMinNow);
2728 if (headroomFac < 1.)
2729 cout <<
" headroomFac = " << headroomFac << endl;
2732 if (doRescue && trialPtr->getNshouldRescue(indx) >= nRescue) {
2734 double logRescue = ((double)(trialPtr->getNshouldRescue(indx))) /
2735 ((double)(nRescue));
2736 headroomFac *= pow(10.0,-logRescue);
2737 if (verbose >= verylouddebug){
2738 stringstream ss(
"Applying rescue mechanism, nShouldRescue = ");
2739 ss << trialPtr->getNshouldRescue(indx)
2740 <<
", multiplying headroom with 10^-" << logRescue;
2741 printOut(__METHOD_NAME__, ss.str());
2748 double PDFscale = pow2(qTrial);
2749 double pdfRatio = trialGenPtr->trialPDFratio(
2750 ((isII || is1A) ? beamAPtr : beamBPtr),
2751 ((isII || is1A) ? beamBPtr : beamAPtr),
2752 iSys, id1, id2, e1, e2, PDFscale, PDFscale);
2756 int trialFlav = trialGenPtr->trialFlav();
2757 double pdfRatioFlav = trialGenPtr->getTrialPDFratio();
2760 double colFac = getAnt(iAntPhys)->chargeFac();
2761 int nF = getNf(iRegion);
2762 if (iAntPhys == iXGsplitIF) colFac *= min(nF,nGluonToQuarkF);
2765 double kR = aSkMu2EmitI;
2766 if (iAntPhys == iQXsplitII || iAntPhys == iQXsplitIF)
2768 else if (iAntPhys == iGXconvII || iAntPhys == iGXconvIF)
2770 else if (iAntPhys == iXGsplitIF) kR = aSkMu2SplitF;
2774 bool runAlpha = (alphaSorder >= 1);
2776 if (qMinNow < 2.5*alphaSptr->Lambda3()/kR) runAlpha =
false;
2782 for (
int i = 0; i < (5 - nFlavZeroMass); i++) {
2783 if ((abs(id1) == 5 - i) && (iRegion == 3 - i)) {
2784 if ((iAntPhys == iQXsplitII && !swapped) ||
2785 (iAntPhys == iQXsplitIF) ) idCheck = 5 - i;
2787 if (isII && (abs(id2) == 5-i) && (iRegion == 3-i)) {
2788 if (iAntPhys == iQXsplitII && swapped) idCheck = 5-i;
2791 bool usePDFmassThreshold = (idCheck > 0);
2794 bool doEnhance =
false;
2795 double enhanceFac = 1.0;
2796 if (qTrial > enhanceCutoff) {
2797 if (isHardSys[iSys] && enhanceInHard) doEnhance =
true;
2798 else if (!isHardSys[iSys] && partonSystemsPtr->hasInAB(iSys) &&
2799 enhanceInMPI) doEnhance =
true;
2801 enhanceFac *= enhanceAll;
2805 if (min(nF,nGluonToQuarkF) >= 4 && iAntPhys == iXGsplitIF)
2806 enhanceFac *= max(enhanceCharm, enhanceBottom);
2807 else if ( nGluonToQuarkI >= 4 &&
2808 (iAntPhys == iGXconvII || iAntPhys == iGXconvIF))
2809 enhanceFac *= max(enhanceCharm,enhanceBottom);
2814 if (colFac < TINY || headroomFac < TINY) {
2815 double qTmp = qTrial;
2817 trialPtr->saveTrial(indx,qTmp,qTrial,0.,0.,0.,0.,pdfRatioFlav,
2818 trialFlav, 0.,0.,0.);
2822 else if (usePDFmassThreshold) {
2823 double qTmp = qTrial;
2826 headroomFac *= (iAntPhys == iQXsplitII ? 2.0 : 1.3);
2828 double mu2eff = mu2min + pow2(kR*qMinNow);
2830 double facAlphaS = min(alphaSmax, alphaSptr->alphaS(mu2eff));
2831 if (alphaSorder == 0) facAlphaS = alphaSvalue;
2833 double q2trial = trialGenPtr->genQ2thres(pow2(qTrial), s12,
2834 zMinNow, zMaxNow, colFac, facAlphaS, pdfRatio, id1, id2,
2835 e1, e2,
true, headroomFac, enhanceFac);
2836 qTrial = sqrt(q2trial);
2837 double massNow = (idCheck == 4 ? mc : mb);
2838 double extraMassPDFfactor = log(q2trial/pow2(massNow));
2840 trialPtr->saveTrial(indx, qTmp, qTrial, zMinNow, zMaxNow, colFac,
2841 facAlphaS, pdfRatioFlav, trialFlav, extraMassPDFfactor,
2842 headroomFac, enhanceFac);
2843 if (verbose >= superdebug) printOut(__METHOD_NAME__,
2844 "Using vanishing pdfs towards the mass threshold for id1 " +
2845 num2str(id1) +
" and id2 " + num2str(id2));
2848 }
else if (runAlpha) {
2849 double qTmp = qTrial;
2851 double b0 = (33.0 - 2.0*nF) / (12.0 * M_PI);
2853 double lambdaEff = alphaSptr->Lambda3();
2855 double q2trial = trialGenPtr->genQ2run(pow2(qTrial), s12,
2856 zMinNow, zMaxNow, colFac, pdfRatio, b0, kR, lambdaEff,
2857 e1, e2, headroomFac, enhanceFac);
2858 qTrial = sqrt(q2trial);
2860 if (qTrial > cutoffScale) {
2861 double muEff = max( 1.01, kR*qTrial/lambdaEff );
2862 double alphaEff = 1.0/b0/log(pow2(muEff));
2863 trialPtr->saveTrial(indx, qTmp, qTrial, zMinNow, zMaxNow, colFac,
2864 alphaEff, pdfRatioFlav, trialFlav, 1.0, headroomFac, enhanceFac);
2866 trialPtr->saveTrial(indx, qTmp, 0.);
2871 double qTmp = qTrial;
2873 double facAlphaS = ( (alphaSorder >= 1) ? alphaSmax
2876 double q2trial = trialGenPtr->genQ2(pow2(qTrial), s12,
2877 zMinNow, zMaxNow, colFac, facAlphaS, pdfRatio, e1, e2,
2878 headroomFac, enhanceFac);
2879 qTrial = sqrt(q2trial);
2881 trialPtr->saveTrial(indx, qTmp, qTrial, zMinNow, zMaxNow, colFac,
2882 facAlphaS,pdfRatioFlav,trialFlav,1.0,headroomFac,enhanceFac);
2886 if (qTrial > qMinNow) acceptRegion =
true;
2887 else if (qMinNow < qWin || qMinNow < qTrialMax) {
2888 if (verbose >= verylouddebug) printOut(__METHOD_NAME__,
2889 "stopping evolution, already found scale that is bigger");
2890 acceptRegion =
true;
2891 trialPtr->renewTrial(indx);
2893 }
else if (iRegion == 0 || qTrial < cutoffScale) {
2894 acceptRegion =
true;
2902 if ((qTrial > qTrialMax) && (qTrial > cutoffScale)) {
2908 if (doRescue && abs(qBeginNow-qTrial) < rescueMin)
2909 trialPtr->addRescue(indx);
2913 if (qTrialMax >= qWin || qWin <= 0.0) {
2914 winnerPtr = trialPtr;
2919 if (verbose >= louddebug) {
2921 ss <<
"qTrialMax = " << qTrialMax;
2923 ss <<
" (" << trialPtr->trialGenPtrsSav[indxMax]->name() <<
")";
2924 if(iAnt + 1 == nAnt) ss <<
" final qWin = ";
2925 else ss <<
" current qWin = ";
2926 ss << qWin <<
" i1 i2 = " << winnerPtr->i1sav <<
" " << winnerPtr->i2sav
2927 <<
" in system " << iSysWin;
2928 printOut(__METHOD_NAME__, ss.str());
2933 if ((qWin > qEndAll) && (qWin > 0.0)) {
2934 if (verbose >= louddebug) {
2935 stringstream ss(
"Winner at scale qWin = ");
2936 ss << qWin <<
" trial type "
2937 << winnerPtr->trialGenPtrsSav[indxWin]->name();
2938 printOut(__METHOD_NAME__, ss.str());
2939 if (verbose >= verylouddebug) {
2940 ss.str(
"pdf ratio ");
2941 ss << winnerPtr->getPDFratioTrial(indxWin)
2942 <<
" col1 = " <<
event[winnerPtr->i1sav].col()
2943 <<
" acol1 = " <<
event[winnerPtr->i1sav].acol()
2944 <<
" col2 = " <<
event[winnerPtr->i2sav].col()
2945 <<
" acol2 = " <<
event[winnerPtr->i2sav].acol()
2946 <<
" in System " << iSysWin;
2952 if (qEndsmallerCutoff) {
2953 if (verbose >= debug) {
2954 printOut(__METHOD_NAME__,
"=== All trials now below cutoff "
2955 "qEndAll = " + num2str(qEndAll, 3) +
".");
2956 if (verbose >= superdebug) {
2957 printOut(__METHOD_NAME__,
"Final configuration was:");
2962 weightsPtr->doWeighting();
2967 bool forceSplitNow =
false;
2968 if ((!allSkipped) && heavyQuarkLeft(max(qWin,qEndAll))) {
2969 if (verbose >= louddebug)
2970 printOut(__METHOD_NAME__,
2971 "Going to force a splitting! qWin was " + num2str(qWin) +
2972 " with id1 = " + num2str(winnerPtr->id1sav) +
2973 " with id2 = " + num2str(winnerPtr->id2sav));
2975 qWin = winnerPtr->scaleSav[indxWin];
2976 winnerPtr->forceSplittingSav =
true;
2977 forceSplitNow =
true;
2978 }
else if (winnerPtr != NULL) winnerPtr->forceSplittingSav =
false;
2979 if (verbose >= debug ) {
2980 if (verbose >= superdebug) list();
2981 printOut(__METHOD_NAME__,
"finished --------------");
2984 if (qWin > pTevolBegAll && !forceSplitNow) {
2985 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
2986 +
": Generated scale > pTevolBegAll. Returning 0.");
2991 if ((qWin > 0.0) && forceSplitNow)
return (pTevolEndAll-TINY);
3000 bool VinciaISR::branch(
Event& event) {
3003 if (verbose >= debug) printOut(__METHOD_NAME__,
"begin --------------");
3004 int iTrial = indxWin;
3005 double qNew = winnerPtr->getTrialScale(iTrial);
3006 double q2new = pow2(qNew);
3007 int iAntPhys = winnerPtr->getPhysIndex(iTrial);
3008 bool isII = winnerPtr->isII();
3009 bool is1A = winnerPtr->is1A();
3010 bool isSwapped = (isII ? winnerPtr->getIsSwapped(iTrial) :
false);
3016 nTrials[iAntPhys]++;
3017 if (verbose >= louddebug) {
3019 ss <<
"Processing Branching at scale Q = " << qNew;
3020 printOut(__METHOD_NAME__, ss.str());
3024 vector<Vec4> recoilers;
3026 for (
int j = 0; j < partonSystemsPtr->sizeOut(iSysWin); ++j) {
3027 int ip = partonSystemsPtr->getOut(iSysWin, j);
3028 if (ip != winnerPtr->i1sav && ip != winnerPtr->i2sav) {
3029 recoilers.push_back(event[ip].p());
3030 iRecs.push_back(partonSystemsPtr->getOut(iSysWin,j));
3035 bool forceSplitting =
false;
3036 if (winnerPtr->forceSplittingSav) {
3037 forceSplitting =
true;
3038 if (verbose >= louddebug) {
3040 ss <<
"Forcing a splitting at q = " << qNew;
3041 printOut(__METHOD_NAME__, ss.str());
3044 double e1 = winnerPtr->e1sav;
3046 winnerPtr->trialGenPtrsSav[iTrial]->getQ2max(winnerPtr->sAnt(),
3047 e1, is1A ? eBeamAUsed : eBeamBUsed);
3048 if (q2max < q2new) {
3051 winnerPtr->scaleSav[iTrial] = 0.99*qNew;
3052 if (verbose >= louddebug ){
3054 ss <<
"adjusted scale to q = " << qNew;
3055 printOut(__METHOD_NAME__,ss.str());
3061 if (!generateKinematics(event, winnerPtr, recoilers)) {
3063 winnerPtr->renewTrial(iTrial);
3064 if (verbose >= louddebug)
3065 printOut(__METHOD_NAME__,
"Branching outside phase space.");
3069 if (recoilers.size() <= 0) iRecs.clear();
3073 if (forceSplitting) {
3075 qNew = winnerPtr->getTrialScale(iTrial);
3081 bool usedColTag = assignColourFlow(event, winnerPtr);
3084 vector<Particle> parts = mecsPtr->makeParticleList(iSysWin, event);
3085 if (!forceSplitting)
3086 if (!checkHeavyQuarkPhaseSpace(parts,iSysWin)) {
3087 if (verbose >= louddebug) printOut(__METHOD_NAME__,
3088 "branching rejected because phase space after branching "
3089 "does not allow forced splittings");
3091 winnerPtr->renewTrial(iTrial);
3092 ++nClosePSforHQ[iAntPhys];
3098 double cutoffScale = (isII ? cutoffScaleII : cutoffScaleIF);
3100 if (!forceSplitting && sqrt(q2new) < cutoffScale) {
3101 bool isMassiveQsplit =
false;
3102 if (iAntPhys == iQXsplitIF)
3103 isMassiveQsplit = (abs(winnerPtr->id1sav) > nFlavZeroMass);
3104 else if (iAntPhys==iQXsplitII) {
3105 isMassiveQsplit = ( isSwapped
3106 ? (abs(winnerPtr->id2sav) > nFlavZeroMass)
3107 : (abs(winnerPtr->id1sav) > nFlavZeroMass) );
3111 if (!isMassiveQsplit) {
3112 winnerPtr->renewTrial(iTrial);
3113 ++nFailedCutoff[iAntPhys];
3114 if (verbose > superdebug)
3115 printOut(__METHOD_NAME__,
"Branching is below cutoff: reject.");
3122 if (!forceSplitting) {
3123 if (!acceptTrial(event, winnerPtr)) {
3125 winnerPtr->renewTrial(iTrial);
3126 if (verbose > superdebug)
3127 printOut(__METHOD_NAME__,
"Branching rejected.");
3134 Event evtOld = event;
3135 int evtSizeOld = evtOld.size();
3136 int i1sav = winnerPtr->i1sav;
3137 int i2sav = winnerPtr->i2sav;
3138 winnerPtr->new1.scale(qNew);
3139 winnerPtr->new2.scale(qNew);
3140 winnerPtr->new3.scale(qNew);
3141 int iNew1 =
event.append(winnerPtr->new1);
3142 int iNew3 =
event.append(winnerPtr->new3);
3143 int iNew2 =
event.append(winnerPtr->new2);
3145 vector< pair<int,int> > iRecNew; iRecNew.clear(); iRecNew.resize(0);
3146 if (iRecs.size() >= 1)
3147 for (
int j = 0; j <
event.size(); ++j)
3148 if (event[j].isFinal())
3149 for (
int k = 0; k < (int)iRecs.size(); k++)
3151 if (iRecs[k] == j) {
3152 int inew =
event.copy(j,44);
3153 event[inew].p(recoilers[k]);
3154 iRecNew.push_back(make_pair(iRecs[k],inew));
3157 event.restorePtrs();
3162 if ( event[i1sav].pol() != 9 && event[i2sav].pol() != 9 &&
3163 (event[iNew1].pol() == 9 || event[iNew2].pol() == 9 ||
3164 event[iNew3].pol() == 9)) {
3165 if (verbose >= louddebug)
3166 printOut(__METHOD_NAME__,
"Depolarizing parton state");
3170 int sizeSystem = partonSystemsPtr->sizeOut(iSysWin);
3171 for (
int i = 0; i < sizeSystem; ++i) {
3172 int i1 = partonSystemsPtr->getOut( iSysWin, i);
3174 if ( i1 <= 0 || !event[i1].isFinal())
continue;
3176 if ( i1 == winnerPtr->i1sav || i1 == winnerPtr->i2sav)
continue;
3178 if ( event[i1].pol() != 9 )
event[i1].pol(9);
3181 winnerPtr->new1.pol(9);
3182 winnerPtr->new2.pol(9);
3183 winnerPtr->new3.pol(9);
3187 event[i1sav].statusNeg();
3188 event[i2sav].statusNeg();
3191 event[iNew1].mothers(event[i1sav].mother1(), event[i1sav].mother2());
3192 event[iNew3].mothers(event[i2sav].mother1(), event[i2sav].mother2());
3194 if (event[iNew2].
id() == 21) {
3196 event[iNew1].daughters(iNew2, i1sav);
3198 event[iNew3].daughters(iNew2, i2sav);
3200 event[iNew2].mothers(iNew1, iNew3);
3203 }
else if (!isSwapped) {
3205 event[iNew1].daughters(iNew2, i1sav);
3207 event[iNew3].daughters(i2sav, 0);
3209 event[iNew2].mothers(iNew1, 0);
3214 event[iNew1].daughters(i1sav, 0);
3216 event[iNew3].daughters(iNew2, i2sav);
3218 event[iNew2].mothers(iNew3 ,0);
3221 event[i1sav].mothers(iNew1, 0);
3223 event[i2sav].mothers(iNew3, 0);
3225 event[iNew2].daughters(0, 0);
3227 if (isHardSys[iSysWin]) {
3228 bool founda =
false;
3229 bool foundb =
false;
3230 for (
int i=0; i<(int)event.size(); i++) {
3232 if (event[i].daughter1() == i1sav) {
3233 event[i].daughters(iNew1, 0);
3237 if (event[i].daughter1() == i2sav) {
3238 event[i].daughters(iNew3, 0);
3241 if (founda && foundb)
break;
3246 event[iNew1].mothers(event[i1sav].mother1(), event[i1sav].mother2());
3248 if (event[iNew2].
id()==21) {
3250 event[iNew1].daughters(iNew2, i1sav);
3252 event[i2sav].daughters(iNew2, iNew3);
3254 event[iNew3].mothers(i2sav, 0);
3256 event[iNew2].mothers(i2sav, iNew1);
3259 }
else if (iAntPhys==iQXsplitIF || iAntPhys==iGXconvIF) {
3261 event[iNew1].daughters(iNew2, i1sav);
3263 event[i2sav].daughters(iNew3, 0);
3265 event[iNew3].mothers(i2sav, 0);
3267 event[iNew2].mothers(iNew1, 0);
3272 event[iNew1].daughters(i1sav, 0);
3274 event[i2sav].daughters(iNew2, iNew3);
3276 event[iNew3].mothers(i2sav, 0);
3278 event[iNew2].mothers(i2sav, 0);
3281 event[i1sav].mothers(iNew1, 0);
3283 event[iNew3].daughters(0, 0);
3285 event[iNew2].daughters(0, 0);
3287 if (isHardSys[iSysWin])
3288 for (
int i = 0; i < (int)event.size(); i++)
3289 if (event[i].daughter1() == i1sav) {
3290 event[i].daughters(iNew1, 0);
3296 if (canVetoEmission)
3297 if (userHooksPtr->doVetoISREmission(evtSizeOld, event, iSysWin)) {
3299 if (verbose >= superdebug)
3300 printOut(__METHOD_NAME__,
"Branching vetoed by user.");
3305 if (verbose >= superdebug) {
3306 printOut(__METHOD_NAME__,
"Branching accepted.");
3308 printOut(__METHOD_NAME__,
"PartonSystems before update:");
3309 partonSystemsPtr->list();
3312 partonSystemsPtr->replace(iSysWin, i1sav, iNew1);
3313 partonSystemsPtr->addOut(iSysWin, iNew2);
3314 partonSystemsPtr->replace(iSysWin, i2sav, iNew3);
3317 partonSystemsPtr->setInA(iSysWin, iNew1);
3318 partonSystemsPtr->setInB(iSysWin, iNew3);
3319 }
else if (is1A) partonSystemsPtr->setInA(iSysWin, iNew1);
3320 else partonSystemsPtr->setInB(iSysWin, iNew1);
3322 for (
int k = 0; k < (int)iRecNew.size(); k++)
3323 partonSystemsPtr->replace(iSysWin, iRecNew[k].first, iRecNew[k].second);
3324 double shat = (
event[partonSystemsPtr->getInA(iSysWin)].p() +
3325 event[partonSystemsPtr->getInB(iSysWin)].p()).m2Calc();
3326 partonSystemsPtr->setSHat(iSysWin, shat);
3328 if (verbose >= superdebug) {
3329 printOut(__METHOD_NAME__,
"PartonSystems after update:");
3330 partonSystemsPtr->list();
3334 bool isValN1 =
false;
3335 bool isValN3 =
false;
3339 BeamParticle& beam1 = *beamAPtr;
3340 beam1[iSysWin].update(iNew1, event[iNew1].
id(), event[iNew1].e()/eBeamA);
3342 if (event[i1sav].
id() != event[iNew1].
id()) {
3343 double PDFscale = q2new;
3344 beam1.xfISR(iSysWin,event[iNew1].
id(),event[iNew1].e()/eBeamA,
3346 beam1.pickValSeaComp();
3348 isValN1 = beam1[iSysWin].isValence();
3350 BeamParticle& beam2 = *beamBPtr;
3351 beam2[iSysWin].update(iNew3, event[iNew3].
id(), event[iNew3].e()/eBeamB);
3353 if (event[i2sav].
id() != event[iNew3].
id()) {
3354 double PDFscale = q2new;
3355 beam2.xfISR( iSysWin, event[iNew3].
id(), event[iNew3].e()/eBeamB,
3357 beam2.pickValSeaComp();
3359 isValN3 = beam2[iSysWin].isValence();
3363 BeamParticle&
beam = (is1A ? *beamAPtr : *beamBPtr);
3364 beam[iSysWin].update( iNew1, event[iNew1].
id(), event[iNew1].e()
3365 /(is1A ? eBeamA : eBeamB) );
3367 if (event[i1sav].
id() != event[iNew1].
id()) {
3368 double PDFscale = q2new;
3369 beam.xfISR( iSysWin, event[iNew1].
id(), event[iNew1].e()
3370 /(is1A ? eBeamA : eBeamB), PDFscale );
3371 beam.pickValSeaComp();
3373 isValN1 = beam[iSysWin].isValence();
3377 if (iRecNew.size() >= 1)
3378 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
3379 BranchElementalISR* antPtr = &branchElementals[iAnt];
3381 if (antPtr->system != iSysWin)
continue;
3382 int i2 = antPtr->i2sav;
3384 for (
int k = 0; k < (int)iRecNew.size(); k++)
3386 if (i2 == iRecNew[k].first) antPtr->i2sav = iRecNew[k].second;
3390 if (iAntPhys == iGXconvII || iAntPhys == iGXconvIF ||
3391 iAntPhys == iXGsplitIF) {
3394 }
else ++nG[iSysWin];
3397 indexSav[iSysWin].clear(); indexSav[iSysWin].resize(0);
3398 int sizeSystem = partonSystemsPtr->sizeAll(iSysWin);
3399 for (
int i = 0; i < sizeSystem; ++i) {
3400 int i1 = partonSystemsPtr->getAll( iSysWin, i);
3401 if ( i1 <= 0 )
continue;
3402 indexSav[iSysWin].push_back( i1 );
3403 if (!event[i1].isFinal()) {
3404 if (event[i1].pz() > 0.0) initialA[iSysWin] =
event[i1];
3405 else initialB[iSysWin] =
event[i1];
3410 for (map<int,Particle>::iterator it = initialA.begin();
3411 it != initialA.end(); ++it) {
3413 eBeamAUsed += initialA[i].e();
3414 eBeamBUsed += initialB[i].e();
3416 if (verbose >= louddebug)
3417 printOut(__METHOD_NAME__,
"Updating dipole-antenna(e)");
3425 if (winnerPtr->new2.id() == 21) {
3430 int col = ( (
event[iNew1].col() ==
event[iNew2].col()) ?
3431 event[iNew2].col() :
event[iNew2].acol() );
3432 winnerPtr->reset(iSysWin,event,iNew1,iNew2,col,isValN1,
false);
3433 resetTrialGenerators(winnerPtr);
3438 col = ((
event[iNew3].col() ==
event[iNew2].col()) ?
3439 event[iNew2].col() :
event[iNew2].acol());
3440 BranchElementalISR newTrial(iSysWin,event,iNew3,iNew2,col,isValN3,
false);
3441 resetTrialGenerators(&newTrial);
3445 branchElementals.push_back(newTrial);
3449 }
else if (iAntPhys == iQXsplitII || iAntPhys == iQXsplitIF) {
3453 if (winnerPtr->isII())
3454 col = ((event[iNew1].col() == event[iNew3].acol()) ?
3455 event[iNew3].acol() :
event[iNew3].col() );
3457 col = ((
event[iNew1].col() ==
event[iNew3].col()) ?
3458 event[iNew3].col() :
event[iNew3].acol() );
3461 winnerPtr->reset(iSysWin,event,iNew1,iNew3,col,isValN1,isValN3);
3462 resetTrialGenerators(winnerPtr);
3464 int iSplitGluon = (isSwapped ? iNew3 : iNew1);
3465 col = ((
event[iSplitGluon].col() ==
event[iNew2].col()) ?
3466 event[iNew2].col() :
event[iNew2].acol() );
3467 BranchElementalISR newTrial(iSysWin,event,iSplitGluon,iNew2,col,
3469 resetTrialGenerators(&newTrial);
3472 branchElementals.push_back(newTrial);
3475 }
else if (iAntPhys == iGXconvII || iAntPhys == iGXconvIF) {
3478 int colFSQ = (
event[iFSQ].id() > 0 ?
event[iFSQ].col()
3479 :
event[iFSQ].acol() );
3480 int iISQ = (isSwapped ? iNew3 : iNew1);
3481 int colISQ = (
event[iISQ].id() > 0 ?
event[iISQ].col()
3482 :
event[iISQ].acol() );
3485 bool isValQL =
false;
3486 if (colFSQ == winnerPtr->col()) {
3488 int iPartner = (isSwapped ? iNew1 : iNew3);
3489 bool isPval = (isSwapped ? isValN1 : isValN3);
3490 winnerPtr->reset(iSysWin,event,iPartner,iFSQ,colFSQ,isPval,
false);
3494 isValQL = (isSwapped ? isValN3 : isValN1);
3495 }
else if (colISQ == winnerPtr->col()) {
3497 winnerPtr->reset(iSysWin,event,iNew1,iNew3,colISQ,isValN1,isValN3);
3503 resetTrialGenerators(winnerPtr);
3506 int iConvGluon = (isSwapped ? i2sav : i1sav);
3509 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); iAnt++) {
3510 BranchElementalISR* antPtr = &branchElementals[iAnt];
3512 if (antPtr->system != iSysWin)
continue;
3513 if (antPtr->i1sav == iConvGluon) {
3514 antPtr->reset(iSysWin,event,antPtr->i2sav,iQLeft,colQLeft,
3515 antPtr->isVal2(),isValQL);
3516 resetTrialGenerators(antPtr);
3517 }
else if (antPtr->i2sav == iConvGluon) {
3519 antPtr->reset(iSysWin,event,antPtr->i1sav,iQLeft,colQLeft,
3520 antPtr->isVal1(),isValQL);
3521 resetTrialGenerators(antPtr);
3527 else if (iAntPhys == iXGsplitIF) {
3531 int col = ( (
event[iNew2].col() != 0) ?
3532 event[iNew2].col() :
event[iNew2].acol() );
3533 winnerPtr->reset(iSysWin,event,iNew1,iNew2,col,isValN1,
false);
3535 resetTrialGenerators(winnerPtr);
3537 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
3538 BranchElementalISR* antPtr = &branchElementals[iAnt];
3540 if (antPtr->system != iSysWin)
continue;
3542 if (antPtr->i2sav == i2sav) {
3543 col = antPtr->col();
3544 antPtr->reset(iSysWin,event,antPtr->i1sav,iNew3,col,
3545 antPtr->isVal1(),
false);
3546 resetTrialGenerators(antPtr);
3552 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
3553 BranchElementalISR* antPtr = &branchElementals[iAnt];
3556 if (antPtr->system != iSysWin)
continue;
3559 int i1 = antPtr->i1sav;
3560 int i2 = antPtr->i2sav;
3563 bool isVal1new = antPtr->isVal1();
3564 bool isVal2new = antPtr->isVal2();
3565 if ((i1 == i1sav) || (i1 == i2sav) || (i2 == i1sav) || (i2 == i2sav)) {
3568 isVal1new = isValN1;
3569 }
else if (i1 == i2sav) {
3571 isVal1new = isValN3;
3575 isVal2new = isValN1;
3576 }
else if (i2 == i2sav) {
3578 isVal2new = isValN3;
3580 int col = antPtr->col();
3581 antPtr->reset(iSysWin, event, i1new, i2new, col, isVal1new, isVal2new);
3582 resetTrialGenerators(antPtr);
3590 for (
int k=0; k<(int)iRecNew.size(); k++)
3592 if (i2 == iRecNew[k].first) {
3593 int i2now = iRecNew[k].second;
3594 bool isVal1 = antPtr->isVal1();
3595 bool isVal2 = antPtr->isVal2();
3596 int col = antPtr->col();
3597 antPtr->reset(iSysWin, event, i1, i2now, col, isVal1, isVal2);
3598 resetTrialGenerators(antPtr);
3602 antPtr->resetRescue();
3606 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
3607 BranchElementalISR* antPtr = &branchElementals[iAnt];
3608 if (event[antPtr->i1sav].isFinal() &&
event[antPtr->i2sav].isFinal())
3609 branchElementals.erase(branchElementals.begin() + iAnt);
3613 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
3615 if (branchElementals[iAnt].system == iSysWin)
continue;
3617 branchElementals[iAnt].resetRescue();
3618 if (isII || (is1A && branchElementals[iAnt].is1A()) ||
3619 (!is1A && !branchElementals[iAnt].is1A()))
3620 branchElementals[iAnt].renewTrial();
3625 nBranchISR[iSysWin]++;
3628 if (doMECsSys[iSysWin] && !mecsPtr->doMEC(iSysWin, nBranch[iSysWin])) {
3629 doMECsSys[iSysWin] =
false;
3630 for (
int i = 0; i < (int)branchElementals.size(); i++) {
3631 BranchElementalISR* trial = &branchElementals[i];
3632 if (trial->system == iSysWin) trial->renewTrial();
3636 if (verbose > debug && !checkAntennae(event)) {
3637 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__
3638 +
": Failed checkAntennae. Aborting.");
3639 infoPtr->setAbortPartonLevel(
true);
3646 if (event[iNew2].
id() == 21) {
3647 int lastTag =
event.lastColTag();
3648 int colMax = max(event[iNew2].col(),event[iNew2].acol());
3649 while (colMax > lastTag) lastTag =
event.nextColTag();
3654 if(!vinComPtr->checkCoM(iSysWin,event,partonSystemsPtr)){
3655 infoPtr->setAbortPartonLevel(
true);
3656 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
3657 ": Failed momentum conservation test. Aborting.");
3662 if(!vinComPtr->showerChecks(event,
true)){
3663 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
3664 ": Failed shower checks. Aborting.");
3665 infoPtr->setAbortPartonLevel(
true);
3670 if (iSysWin < 4 && nBranchISR[iSysWin] < 11) {
3671 qBranch[iSysWin][nBranchISR[iSysWin]] = qNew;
3672 pTphys[iSysWin][nBranchISR[iSysWin]] =
event[iNew2].pT();
3674 if (verbose >= debug) {
3675 if (verbose >= superdebug) {
3679 printOut(__METHOD_NAME__,
"end --------------");
3681 nTrialsAccepted[iAntPhys]++;
3690 void VinciaISR::list()
const {
3691 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt)
3692 if (branchElementals.size() == 1) branchElementals[iAnt].list(
true,
true);
3693 else if ( iAnt == 0 ) branchElementals[iAnt].list(
true,
false);
3694 else if ( iAnt ==
int(branchElementals.size()) - 1 )
3695 branchElementals[iAnt].list(
false,
true);
3696 else branchElementals[iAnt].list();
3703 void VinciaISR::initVinciaPtrs(
3704 Colour* colourPtrIn, shared_ptr<VinciaFSR> fsrPtrIn,
3705 QEDShower* qedPtrIn,MECs* mecsPtrIn,Resolution* resolutionPtrIn,
3706 VinciaCommon* vinComPtrIn,VinciaWeights* vinWeightsPtrIn) {
3707 colourPtr = colourPtrIn;
3709 qedShowerPtr = qedPtrIn;
3710 mecsPtr = mecsPtrIn;
3711 resolutionPtr = resolutionPtrIn;
3712 vinComPtr = vinComPtrIn;
3713 weightsPtr = vinWeightsPtrIn;
3720 void VinciaISR::clearContainers() {
3721 hasPrepared.clear();
3722 branchElementals.clear();
3725 isResonanceSys.clear();
3726 polarisedSys.clear();
3742 void VinciaISR::printInfo(
bool pluginCall) {
3745 cout <<
" *-------- End VINCIA FSR and ISR Statistics -------------"
3746 <<
"-------------------------------------------------------*\n\n";
3751 int nTotWeightsInt = weightsPtr->nTotWeights;
3752 int nNonunityInitialWeight = weightsPtr->nNonunityInitialWeight;
3753 int nNegativeInitialWeight = weightsPtr->nNegativeInitialWeight;
3754 int nNonunityWeight = weightsPtr->nNonunityWeight;
3755 int nNegativeWeight = weightsPtr->nNegativeWeight;
3756 double nTotWeights = max(1.0,((
double)(nTotWeightsInt)));
3757 vector<double> weightSum = weightsPtr->weightSum;
3758 vector<double> weightMax = weightsPtr->weightsMax;
3759 vector<double> weightMin = weightsPtr->weightsMin;
3761 cout <<
" | - - - - ISR only Statistics - - - - - - - - - - - - - - - "
3762 <<
"- - - - - - - - - - - - - - - - - - - - - - - - - - |\n";
3765 cout <<
" *-------- VINCIA ISR Statistics ----------------------------"
3766 <<
"----------------------------------------------------*\n";
3770 <<
" " << setw(40) <<
" " <<
" |\n";
3771 cout <<
" | Total Number of (accepted) events ="
3772 <<
" " << num2str(nTotWeightsInt,9) << setw(40) <<
" " <<
" |\n";
3773 cout <<
" | Number of events with nonunity initial weight ="
3774 <<
" " << ( (nNonunityInitialWeight <= 0) ?
3776 : num2str(nNonunityInitialWeight,9)
3777 +
" <-- (INITIALLY) WEIGHTED EVENTS" )
3778 << setw(8) <<
" " <<
" |\n";
3779 cout <<
" | Number of events with negative initial weight ="
3780 <<
" " << ( (nNegativeInitialWeight <= 0) ?
" none"
3781 : num2str(nNegativeWeight,9))
3782 << setw(40) <<
" " <<
" |\n";
3783 cout <<
" | Number of events with nonunity reweight ="
3784 <<
" " << ( (nNonunityWeight <= 0) ?
" none "
3785 : num2str(nNonunityWeight,9)+
" <-- REWEIGHTED EVENTS" )
3786 << setw(18) <<
" " <<
" |\n";
3787 cout <<
" | Number of events with negative reweight ="
3788 <<
" " << ( (nNegativeWeight <= 0) ?
" none"
3789 : num2str(min(nNegativeWeight,nNonunityWeight),9))
3790 << setw(40) <<
" " <<
" |\n";
3792 <<
" " << setw(40) <<
" " <<
" |\n";
3793 cout <<
" | weight(i) Avg Wt Avg Dev "
3794 <<
"rms(dev) kUnwt Expected effUnw |\n";
3795 cout <<
" | This run i = IsUnw <w> <w-1> "
3796 <<
" 1/<w> Max Wt <w>/MaxWt Min Wt |\n";
3797 cout <<
" |" << setw(4) <<
" " <<
"User settings 0 ";
3798 cout << ( (abs(1.0-weightSum[0]/nTotWeights) < TINY) ?
3800 cout << num2str(weightSum[0]/nTotWeights,9) <<
" ";
3801 cout << num2str(weightSum[0]/nTotWeights-1.0,9) <<
" ";
3802 cout << setw(9) <<
"-" <<
" ";
3803 cout << ((weightSum[0] != 0.0) ? num2str(nTotWeights/weightSum[0],9) :
3805 cout << num2str(weightMax[0],14) <<
" ";
3806 cout << ((weightMax[0] != 0.0) ?
3807 num2str(weightSum[0]/nTotWeights/weightMax[0],9) :
3808 num2str(0.0,9)) <<
" ";
3809 cout << num2str(weightMin[0],9) <<
" ";
3812 if (verbose >= normal && nTrialsSum > 0) {
3813 cout <<
" | ----------------"
3814 <<
"------ P(Reject) ---------------------------" << setw(7) <<
"|"
3816 <<
" | Trial Veto Rates: nTrials nAcc eff Zeta kinMap "
3817 <<
"Veto (<RPDF>) Sector IR mMin HQPS" << setw(7) <<
"|"
3819 for (
int iAntPhys=0; iAntPhys<(int)nTrials.size(); ++iAntPhys) {
3820 double nTot = nTrials[iAntPhys];
3821 if (nTot <= 0)
continue;
3822 cout <<
" | " << setw(17);
3823 if (iAntPhys == iQQemitII) cout <<
"QQemitII";
3824 else if (iAntPhys == iGQemitII) cout <<
"GQemitII";
3825 else if (iAntPhys == iGGemitII) cout <<
"GGEmitII";
3826 else if (iAntPhys == iQXsplitII) cout <<
"QXsplitII";
3827 else if (iAntPhys == iGXconvII) cout <<
"GXconvII";
3828 else if (iAntPhys == iQQemitIF) cout <<
"QQemitIF";
3829 else if (iAntPhys == iQGemitIF) cout <<
"QGemitIF";
3830 else if (iAntPhys == iGQemitIF) cout <<
"GQemitIF";
3831 else if (iAntPhys == iGGemitIF) cout <<
"GGemitIF";
3832 else if (iAntPhys == iQXsplitIF) cout <<
"QXsplitIF";
3833 else if (iAntPhys == iGXconvIF) cout <<
"GXconvIF";
3834 else if (iAntPhys == iXGsplitIF) cout <<
"XGsplitIF";
3835 cout << fixed << setprecision(2)
3836 <<
" " << num2str(
int(nTot+0.5),9)
3837 <<
" " << num2str(
int(nTrialsAccepted[iAntPhys]+0.5),8)
3838 <<
" " << nTrialsAccepted[iAntPhys]/nTot
3839 <<
" " << nFailedHull[iAntPhys]*1.0/nTot;
3840 nTot -= nFailedHull[iAntPhys];
3841 cout <<
" " << nFailedKine[iAntPhys]*1.0/max(1.,nTot);
3842 nTot -= nFailedKine[iAntPhys];
3843 cout <<
" " << nFailedVeto[iAntPhys]*1.0/max(1.,nTot)
3844 <<
" (" << rFailedVetoPDF[iAntPhys]/max(1.,
3845 double(nFailedVeto[iAntPhys])) <<
")";
3846 nTot -= nFailedVeto[iAntPhys];
3847 cout <<
" " << nSectorReject[iAntPhys]*1.0/max(1.,nTot);
3848 nTot -= nSectorReject[iAntPhys];
3849 cout <<
" " << nFailedCutoff[iAntPhys]*1.0/max(1.,nTot);
3850 nTot -= nFailedCutoff[iAntPhys];
3851 cout <<
" " << nFailedMass[iAntPhys]*1.0/max(1.,nTot);
3852 nTot -= nFailedMass[iAntPhys];
3853 cout <<
" " << nClosePSforHQ[iAntPhys]*1.0/max(1.,nTot);
3854 cout << setw(8) <<
"|\n";
3856 cout <<
" |" << setw(113) <<
" " <<
"|\n";
3859 cout <<
" *-------- End VINCIA FSR and ISR Statistics -----------------"
3860 <<
"---------------------------------------------------*\n\n";
3862 cout <<
" *-------- End VINCIA ISR Statistics --------------------------"
3863 <<
"---------------------------------------------------*\n\n";
3870 void VinciaISR::resetTrialGenerators(BranchElementalISR* trial) {
3873 trial->clearTrialGenerators();
3875 int id1 = abs(trial->id1sav);
3877 int id2 = abs(trial->id2sav);
3878 bool isOctetOnium2 = ( (id2>6 && id2!=21) ?
true :
false );
3879 bool isVal1 = trial->isVal1();
3880 bool isVal2 = trial->isVal2();
3881 bool isII = trial->isII();
3882 bool is1A = trial->is1A();
3884 int colType1abs = abs(trial->colType1());
3885 int colType2abs = abs(trial->colType2());
3890 if ( colType1abs == 1 && colType2abs == 1 ) {
3891 iAntPhys = iQQemitII;
3892 if (getAnt(iAntPhys)->chargeFac() > 0.)
3893 trial->addTrialGenerator(iAntPhys,
false, &trialIISoft);
3894 iAntPhys = iQXsplitII;
3895 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.) {
3896 if (!isVal1) trial->addTrialGenerator(iAntPhys,
false, &trialIISplitA);
3897 if (!isVal2) trial->addTrialGenerator(iAntPhys,
true, &trialIISplitB);
3900 }
else if ( colType1abs == 2 && colType2abs == 2 ) {
3901 iAntPhys = iGGemitII;
3902 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3903 trial->addTrialGenerator(iAntPhys,
false, &trialIISoft);
3904 trial->addTrialGenerator(iAntPhys,
false, &trialIIGCollA);
3905 trial->addTrialGenerator(iAntPhys,
false, &trialIIGCollB);
3907 iAntPhys = iGXconvII;
3908 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.) {
3909 trial->addTrialGenerator(iAntPhys,
false, &trialIIConvA);
3910 trial->addTrialGenerator(iAntPhys,
true, &trialIIConvB);
3913 }
else if ( colType1abs == 1 && colType2abs == 2 ) {
3914 iAntPhys = iGQemitII;
3915 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3916 trial->addTrialGenerator(iAntPhys,
true, &trialIISoft);
3917 trial->addTrialGenerator(iAntPhys,
true, &trialIIGCollB);
3919 iAntPhys = iGXconvII;
3920 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.)
3921 trial->addTrialGenerator(iAntPhys,
true, &trialIIConvB);
3922 iAntPhys = iQXsplitII;
3923 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.)
3924 if (!isVal1) trial->addTrialGenerator(iAntPhys,
false, &trialIISplitA);
3926 }
else if ( colType1abs == 2 && colType2abs == 1 ) {
3927 iAntPhys = iGQemitII;
3928 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3929 trial->addTrialGenerator(iAntPhys,
false, &trialIISoft);
3930 trial->addTrialGenerator(iAntPhys,
false, &trialIIGCollA);
3932 iAntPhys = iGXconvII;
3933 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.)
3934 trial->addTrialGenerator(iAntPhys,
false, &trialIIConvA);
3935 iAntPhys = iQXsplitII;
3936 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.)
3937 if (!isVal2) trial->addTrialGenerator(iAntPhys,
true, &trialIISplitB);
3943 if ( colType1abs == 1 && colType2abs == 1 ) {
3944 iAntPhys = iQQemitIF;
3945 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3948 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSoft);
3950 trial->addTrialGenerator(iAntPhys, !is1A, &trialVFSoft);
3952 iAntPhys = iQXsplitIF;
3953 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.)
3954 if (!isVal1) trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSplitA);
3956 }
else if ( colType1abs == 2 && colType2abs == 2 ) {
3957 iAntPhys = iGGemitIF;
3958 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3959 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSoft);
3960 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFGCollA);
3962 iAntPhys = iXGsplitIF;
3963 if (id2 == 21 && nGluonToQuarkF > 0 && getAnt(iAntPhys)->chargeFac()>0.)
3964 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSplitK);
3965 iAntPhys = iGXconvIF;
3966 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.)
3967 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFConvA);
3969 }
else if ( colType1abs == 2 && colType2abs == 1 ) {
3970 iAntPhys = iGQemitIF;
3971 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3972 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSoft);
3973 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFGCollA);
3975 iAntPhys = iGXconvIF;
3976 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.)
3977 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFConvA);
3979 }
else if ( colType1abs == 1 && colType2abs == 2 ) {
3980 iAntPhys = iQGemitIF;
3981 if (getAnt(iAntPhys)->chargeFac() > 0.) {
3983 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSoft);
3985 trial->addTrialGenerator(iAntPhys, !is1A, &trialVFSoft);
3987 iAntPhys = iXGsplitIF;
3988 if (id2 == 21 && nGluonToQuarkF > 0 && getAnt(iAntPhys)->chargeFac()>0.)
3989 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSplitK);
3990 iAntPhys = iQXsplitIF;
3991 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.)
3992 if (!isVal1) trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSplitA);
3994 }
else if ( id1 == 21 && isOctetOnium2 ) {
3995 iAntPhys = iGXconvIF;
3996 if (convGluonToQuarkI && getAnt(iAntPhys)->chargeFac() > 0.)
3997 trial->addTrialGenerator(iAntPhys, !is1A, &trialIFConvA);
3999 }
else if ( colType1abs == 1 && isOctetOnium2 ) {
4000 iAntPhys = iQXsplitIF;
4001 if (convQuarkToGluonI && getAnt(iAntPhys)->chargeFac() > 0.)
4002 if (!isVal1) trial->addTrialGenerator(iAntPhys, !is1A, &trialIFSplitA);
4013 bool VinciaISR::checkHeavyQuarkPhaseSpace(vector<Particle> parts,
int) {
4015 vector<int> isToCheck; isToCheck.resize(0);
4016 for (
int i = 0; i < (int)parts.size(); i++)
4017 if (!parts[i].isFinal() && parts[i].idAbs() > nFlavZeroMass &&
4018 parts[i].idAbs() < 6) isToCheck.push_back(i);
4021 for (
int i = 0; i < (int)isToCheck.size(); i++) {
4022 Particle heavyQuark = parts[isToCheck[i]];
4023 int hQcol = ( (heavyQuark.col() == 0) ?
4024 heavyQuark.acol() : heavyQuark.col() );
4025 double mass = ((heavyQuark.idAbs() == 4) ? mc : mb);
4026 bool is1A = (heavyQuark.pz() > 0.0);
4028 for (
int j = 0; j < (int)parts.size(); j++)
4029 if (j != isToCheck[i]) {
4030 if ( (parts[j].col() != hQcol) && (parts[j].acol() != hQcol) )
4032 Particle colPartner = parts[i];
4033 double sHqCp = m2(heavyQuark, colPartner);
4035 if (colPartner.isFinal())
4036 Q2max = trialIFSplitA.getQ2max(sHqCp, colPartner.e(), is1A ?
4037 eBeamAUsed : eBeamBUsed);
4039 Q2max = trialIISplitA.getQ2max(sHqCp, colPartner.e(), is1A ?
4040 eBeamAUsed : eBeamBUsed);
4042 if (sqrt(Q2max) < mass)
return false;
4043 if (colPartner.isFinal()) {
4045 double eA = heavyQuark.e();
4046 double eamax = ( is1A ? (0.98*eBeamA - (eBeamAUsed-eA)) :
4047 (0.98*eBeamB - (eBeamBUsed-eA)) );
4049 double sjkmax = sHqCp*(eamax-eA)/eA;
4051 double sakmax = (sHqCp+sjkmax-(mass*mass));
4053 if ( (sjkmax < 0.5) || (sakmax < 0.5) )
return false;
4064 bool VinciaISR::heavyQuarkLeft(
double qTrial) {
4066 if (qTrial > 1.02*mb)
return false;
4067 bool foundQuark =
false;
4069 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt) {
4070 BranchElementalISR* trialPtr = &branchElementals[iAnt];
4071 int iSys = trialPtr->system;
4072 int id1 = abs(trialPtr->id1sav);
4073 int id2 = abs(trialPtr->id2sav);
4074 bool foundQuarkNow =
false;
4075 int splitGenTndex = -1;
4076 if ( (id1 > nFlavZeroMass) && (id1 < 6) ) {
4077 double mass = ((id1 == 4) ? mc : mb);
4079 if (qTrial < (1.02*mass)) {
4080 foundQuarkNow =
true;
4082 for (
int indx = 0; indx < (int)trialPtr->nTrialGenerators(); ++indx) {
4083 if ( (trialPtr->getPhysIndex(indx) == iQXsplitIF) ||
4084 (trialPtr->getPhysIndex(indx) == iQXsplitII) ) {
4085 splitGenTndex = indx;
4086 trialPtr->scaleSav[indx] = mass;
4092 if ( trialPtr->isII() && (id2 > nFlavZeroMass) && (id2 < 6) ) {
4093 double mass = ((id2 == 4) ? mc : mb);
4095 if (qTrial < (1.02*mass)) {
4096 foundQuarkNow =
true;
4098 for (
int indx = 0; indx < (int)trialPtr->nTrialGenerators(); ++indx) {
4099 if (trialPtr->getPhysIndex(indx) == iQXsplitII) {
4100 splitGenTndex = indx;
4101 trialPtr->scaleSav[indx] = mass;
4106 if (foundQuarkNow && (splitGenTndex>=0)) {
4107 winnerPtr = trialPtr;
4109 indxWin = splitGenTndex;
4110 foundQuark = foundQuarkNow;
4111 }
else if (foundQuarkNow) {
4112 if (verbose >= quiet ) {
4113 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4114 ": Found heavy quark but no splitting trial generator.",
4115 "Not going to force a splitting.");
4117 cout <<
" Current scale = " << qTrial << endl;
4129 bool VinciaISR::checkAntennae(
const Event& event){
4131 map<int,int> nIIAntInSys;
4132 map<int,int> nIFAntInSys;
4133 for (vector<BranchElementalISR >::iterator ibrancher =
4134 branchElementals.begin(); ibrancher!= branchElementals.end();
4136 int i1 = ibrancher->geti1();
4137 int i2 = ibrancher->geti2();
4138 int iSysNow = ibrancher->getSystem();
4142 if (!partonSystemsPtr->hasInAB(iSysNow)) {
4144 ss <<
"iSysNow = " << iSysNow;
4145 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4146 ": No incoming particles in system.",ss.str());
4149 inA = partonSystemsPtr->getInA(iSysNow);
4150 inB = partonSystemsPtr->getInB(iSysNow);
4152 if (inA <= 0 || inB <= 0 ) {
4154 ss <<
"iSysNow = " << iSysNow
4155 <<
". inA = " << inA <<
" inB = " << inB;
4156 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4157 ": Non-positive incoming particles in system.", ss.str());
4162 if (nIIAntInSys.find(iSysNow)==nIIAntInSys.end())
4163 nIIAntInSys[iSysNow] = 0;
4164 if(nIFAntInSys.find(iSysNow)==nIFAntInSys.end())
4165 nIFAntInSys[iSysNow] = 0;
4166 if (ibrancher->isII()) {
4169 ss <<
"iSysNow = "<<iSysNow<<
". i1 = " << i1;
4170 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4171 ": i1 not incoming in system.", ss.str());
4173 }
else if (i2 != inB) {
4175 ss <<
"iSysNow = "<<iSysNow<<
". i2 = " << i2;
4176 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4177 ": i2 not incoming in system.", ss.str());
4180 nIIAntInSys[iSysNow]++;
4183 if(!event[i2].isFinal()) {
4185 ss <<
"iSysNow = "<<iSysNow<<
". i2 = " << i2;
4186 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4187 ": i2 not outgoing in system.", ss.str());
4191 if (ibrancher->is1A() && i1 != inA) {
4193 ss <<
"iSysNow = "<<iSysNow<<
". i1 = " << i1;
4194 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4195 ": i1 not incoming from A in system.", ss.str());
4198 }
else if(!ibrancher->is1A() && i1 != inB) {
4200 ss <<
"iSysNow = "<<iSysNow<<
". i1 = " << i1;
4201 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4202 ": i1 not incoming from B in system.", ss.str());
4205 nIFAntInSys[iSysNow]++;
4211 for (
int iSysTest = 0; iSysTest < partonSystemsPtr->sizeSys(); ++iSysTest) {
4212 if (!partonSystemsPtr->hasInAB(iSysTest))
continue;
4213 int inA = partonSystemsPtr->getInA(iSysTest);
4214 int inB = partonSystemsPtr->getInB(iSysTest);
4217 int nEndsExpected = abs(event[inA].colType())
4218 + abs(event[inB].colType());
4222 if (nIIAntInSys.find(iSysTest)!=nIIAntInSys.end())
4223 nAntEnds += 2*nIIAntInSys[iSysTest];
4224 if (nIFAntInSys.find(iSysTest)!=nIFAntInSys.end())
4225 nAntEnds += nIFAntInSys[iSysTest];
4226 if (nAntEnds < nEndsExpected) {
4228 ss <<
"iSys = " << iSysTest;
4229 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4230 ": Too few initial antennae in system",ss.str());
4231 cout <<
"colType A: " <<
event[inA].colType()
4232 <<
" colType B: " <<
event[inB].colType()
4233 <<
" nEnds: " << nAntEnds
4234 <<
" nEnds expected: " << nEndsExpected
4235 <<
" nII: " << nIIAntInSys[iSysTest]
4236 <<
" nIF: " << nIFAntInSys[iSysTest]
4239 }
else if (nAntEnds > nEndsExpected) {
4241 ss <<
"iSys = " << iSysTest;
4242 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
4243 ": Too many initial antennae in system.",ss.str());
4244 cout <<
"colType A: " <<
event[inA].colType()
4245 <<
" colType B: " <<
event[inB].colType()
4246 <<
" nEnds: " << nAntEnds
4247 <<
" nEnds expected: " << nEndsExpected
4248 <<
" nII: " << nIIAntInSys[iSysTest]
4249 <<
" nIF: " << nIFAntInSys[iSysTest]
4262 void VinciaISR::setStartScale(
int iSys,
Event& event){
4265 if (!partonSystemsPtr->hasInAB(iSys)) Q2hat[iSys] = 0.0;
4268 else if (isHardSys[iSys]) {
4270 if (verbose >= superdebug)
4271 printOut(__METHOD_NAME__,
"Setting ISR starting scale for hard system");
4273 if (pTmaxMatch == 1) Q2hat[iSys] = pT2maxFudge * infoPtr->Q2Fac();
4275 else if (pTmaxMatch == 2) Q2hat[iSys] = m2BeamsSav;
4278 bool hasRad =
false;
4279 for (
int i = 0; i < partonSystemsPtr->sizeOut(iSys); ++i) {
4280 int idAbs =
event[partonSystemsPtr->getOut(iSys,i)].idAbs();
4281 if (idAbs <= 5 || idAbs == 21 || idAbs == 22) hasRad =
true;
4282 if (idAbs == 6 && nGluonToQuarkF == 6) hasRad =
true;
4286 if (hasRad) Q2hat[iSys] = pT2maxFudge * infoPtr->Q2Fac();
4287 else Q2hat[iSys] = m2BeamsSav;
4293 if (verbose >= superdebug)
4294 printOut(__METHOD_NAME__,
"Setting ISR starting scale of MPI system");
4297 int in1 = partonSystemsPtr->getInA(iSys);
4298 int in2 = partonSystemsPtr->getInB(iSys);
4299 Q2hat[iSys] = pT2maxFudgeMPI
4300 * pow2(min(event[in1].scale(),event[in2].scale()));
4301 if (verbose >= louddebug) printOut(__METHOD_NAME__,
4302 "Renewing all trials since we got non-hard system!");
4303 for (
int iAnt = 0; iAnt < (int)branchElementals.size(); ++iAnt)
4304 if (branchElementals[iAnt].system != iSys)
4305 branchElementals[iAnt].renewTrial();
4314 double VinciaISR::getHeadroomFac(
int iSys,
int iAntPhys,
double) {
4317 double headroomFac = 1.0;
4318 if (doMECsSys[iSys] && mecsPtr->doMEC(iSys,nBranch[iSys] + 1)) {
4321 if (iAntPhys == iXGsplitIF) headroomFac *= 1.5;
4323 if (helicityShower && polarisedSys[iSys]) headroomFac *= 1.5;
4335 bool VinciaISR::generateKinematicsII(
Event& event,
4336 BranchElementalISR* trialPtr, vector<Vec4>& pRec) {
4339 if (verbose >= louddebug) printOut(__METHOD_NAME__,
"begin --------------");
4340 int iTrial = indxWin;
4341 if (iTrial < 0)
return false;
4342 double qNew = trialPtr->getTrialScale(iTrial);
4343 double q2new = pow2(qNew);
4344 int iAntPhys = trialPtr->getPhysIndex(iTrial);
4345 bool isSwapped = trialPtr->getIsSwapped(iTrial);
4348 TrialGeneratorISR* trialGenPtr = trialPtr->trialGenPtrsSav[iTrial];
4349 int idA = trialPtr->id1sav;
4350 int idB = trialPtr->id2sav;
4353 bool forceSplitting = trialPtr->forceSplittingSav;
4354 if (forceSplitting) {
4355 trialPtr->zMinSav[iTrial] =
4356 trialPtr->trialGenPtrsSav[iTrial]->getZmin(q2new, trialPtr->sAnt(),
4357 trialPtr->e1sav, 0.0);
4358 trialPtr->zMaxSav[iTrial] =
4359 trialPtr->trialGenPtrsSav[iTrial]->getZmax(q2new, trialPtr->sAnt(),
4360 trialPtr->e1sav, 0.0);
4365 if (!trialPtr->genTrialInvariants(saj, sjb, 0.0, iTrial)) {
4366 if (verbose >= verylouddebug)
4367 printOut(__METHOD_NAME__,
"z outside physical range, returning.");
4369 ++nFailedHull[iAntPhys];
4374 double sAB = trialPtr->sAnt();
4375 double sab = sAB + saj + sjb;
4376 if (sab > m2BeamsSav) {
4377 if (verbose >= verylouddebug)
4378 printOut(__METHOD_NAME__,
"sab > shh = " + num2str(m2BeamsSav)
4381 ++nFailedHull[iAntPhys];
4388 int idConv = (iAntPhys == iGXconvII) ? trialPtr->getTrialFlav() : 0;
4391 if (iAntPhys == iQQemitII || iAntPhys == iGQemitII ||
4392 iAntPhys == iGGemitII) {
4393 trialPtr->new1.id(idA);
4394 trialPtr->new2.id(21);
4395 trialPtr->new3.id(idB);
4396 trialPtr->new1.m(0.0);
4397 trialPtr->new2.m(0.0);
4398 trialPtr->new3.m(0.0);
4401 }
else if (iAntPhys == iQXsplitII) {
4404 trialPtr->new1.id(21);
4405 trialPtr->new2.id(-idA);
4406 trialPtr->new3.id(idB);
4407 trialPtr->new1.m(0.0);
4409 mj = (abs(idA) <= nFlavZeroMass) ? 0.0 :
4410 particleDataPtr->m0(abs(idA));
4411 trialPtr->new2.m(mj);
4412 trialPtr->new3.m(0.0);
4415 trialPtr->new1.id(idA);
4416 trialPtr->new2.id(-idB);
4417 trialPtr->new3.id(21);
4418 trialPtr->new1.m(0.0);
4420 mj = (abs(idB) <= nFlavZeroMass) ? 0.0 :
4421 particleDataPtr->m0(abs(idB));
4422 trialPtr->new2.m(mj);
4423 trialPtr->new3.m(0.0);
4427 }
else if (iAntPhys == iGXconvII) {
4429 mj = (abs(idConv) <= nFlavZeroMass) ? 0.0 :
4430 particleDataPtr->m0(abs(idConv));
4433 trialPtr->new1.id(idConv);
4434 trialPtr->new2.id(idConv);
4435 trialPtr->new3.id(idB);
4436 trialPtr->new1.m(0.0);
4437 trialPtr->new2.m(mj);
4438 trialPtr->new3.m(0.0);
4441 trialPtr->new1.id(idA);
4442 trialPtr->new2.id(idConv);
4443 trialPtr->new3.id(idConv);
4444 trialPtr->new1.m(0.0);
4445 trialPtr->new2.m(mj);
4446 trialPtr->new3.m(0.0);
4452 sab = sAB + saj + sjb -m2j;
4453 if (sab <0.)
return false;
4457 double phi = 2 * M_PI * rndmPtr->flat();
4459 vector<Vec4> pOld, pNew;
4460 pOld.push_back(event[trialPtr->i1sav].p());
4461 pOld.push_back(event[trialPtr->i2sav].p());
4462 if (!forceSplitting &&
4463 !vinComPtr->map2to3II(pNew, pRec, pOld, sAB, saj, sjb, sab, phi, m2j)) {
4464 if (verbose >= louddebug ) printOut(__METHOD_NAME__,
"Failed map2to3II.");
4466 ++nFailedKine[iAntPhys];
4470 trialPtr->new1.p(pNew[0]);
4471 trialPtr->new2.p(pNew[1]);
4472 trialPtr->new3.p(pNew[2]);
4474 trialPtr->new1.pol(9);
4475 trialPtr->new2.pol(9);
4476 trialPtr->new3.pol(9);
4477 if (verbose >= verylouddebug) {
4478 printOut(__METHOD_NAME__,
"Printing pre-branching momenta");
4479 for (
int i = 0; i < 2; i++) cout <<
" " << pOld[i];
4480 printOut(__METHOD_NAME__,
"Printing post-branching momenta and recoiler");
4481 for (
int i = 0; i < 3; i++) cout <<
" " << pNew[i];
4482 for (
int i = 0; i < (int)pRec.size(); i++) cout <<
" " << pRec[i];
4486 double eOldA = trialPtr->e1sav;
4487 double eOldB = trialPtr->e2sav;
4488 double eNewA = sqrt(eOldA/eOldB*(sAB+sjb)/(sAB+saj)*sab)/2.0;
4489 double eNewB = sqrt(eOldB/eOldA*(sAB+saj)/(sAB+sjb)*sab)/2.0;
4490 double eBeamAUsedNow = eBeamAUsed - eOldA + eNewA;
4491 double eBeamBUsedNow = eBeamBUsed - eOldB + eNewB;
4492 if ( (eBeamAUsedNow>0.98*eBeamA) || (eBeamBUsedNow>0.98*eBeamB) ) {
4493 if (verbose >= verylouddebug)
4494 infoPtr->errorMsg(
"Warning in "+__METHOD_NAME__+
": Incoming x>1.");
4496 if (forceSplitting) {
4497 if (verbose >= verylouddebug)
4498 printOut(__METHOD_NAME__,
"Forced splitting, lowering saj and sjb.");
4500 double lowera = 0.01*saj;
4501 double lowerb = 0.01*sjb;
4504 saj = max(0.0,saj-lowera);
4505 sjb = max(0.0,sjb-lowerb);
4506 sab = sAB + saj + sjb;
4507 eNewA = sqrt(eOldA/eOldB*(sAB+sjb)/(sAB+saj)*sab)/2.0;
4508 eNewB = sqrt(eOldB/eOldA*(sAB+saj)/(sAB+sjb)*sab)/2.0;
4509 eBeamAUsedNow = eBeamAUsed - eOldA + eNewA;
4510 eBeamBUsedNow = eBeamBUsed - eOldB + eNewB;
4511 if ( (eBeamAUsedNow<0.98*eBeamA)
4512 && (eBeamBUsedNow<0.98*eBeamB) ) take =
true;
4513 }
while (!take && saj>0.0 && sjb>0.0);
4514 q2new = trialGenPtr->getQ2(saj,sjb,sAB);
4516 trialPtr->scaleSav[iTrial] = qNew;
4519 ++nFailedHull[iAntPhys];
4522 }
else if ( (eNewA < eOldA) || (eNewB < eOldB) ) {
4523 if (verbose >= verylouddebug)
4524 printOut(__METHOD_NAME__,
"Incoming energy decreased, returning.");
4526 ++nFailedHull[iAntPhys];
4531 double PDFscale = q2new;
4535 int idNewA = trialPtr->new1.id();
4536 double xOldA = eOldA / eBeamA;
4537 double xNewA = eNewA / eBeamA;
4538 if (verbose > normal && !beamAPtr->insideBounds(xNewA, PDFscale))
4539 printf(
"%s::PDFratio {xa,Q2a} outside boundaries\n",
4540 trialGenPtr->name().c_str());
4542 max(beamAPtr->xfISR(iSysWin,idNewA,xNewA,PDFscale),TINYPDF)
4543 / max(beamAPtr->xfISR(iSysWin,idOldA,xOldA,PDFscale),TINYPDF);
4547 int idNewB = trialPtr->new3.id();
4548 double xOldB = eOldB / eBeamB;
4549 double xNewB = eNewB / eBeamB;
4550 if (verbose > normal && !beamBPtr->insideBounds(xNewB, PDFscale))
4551 printf(
"%s::PDFratio {xb,Q2b} outside boundaries\n",
4552 trialGenPtr->name().c_str());
4554 max(beamBPtr->xfISR(iSysWin,idNewB,xNewB,PDFscale),TINYPDF)
4555 / max(beamBPtr->xfISR(iSysWin,idOldB,xOldB,PDFscale),TINYPDF);
4560 trialPtr->addPDF(iTrial, pdfRatioA*pdfRatioB);
4561 if (verbose >= louddebug) printOut(__METHOD_NAME__,
"end --------------");
4570 bool VinciaISR::generateKinematicsIF(
Event& event,
4571 BranchElementalISR* trialPtr, vector<Vec4>& pRec) {
4574 if (verbose >= louddebug) printOut(__METHOD_NAME__,
"begin --------------");
4575 int iTrial = indxWin;
4576 if (iTrial < 0)
return false;
4577 double qNew = trialPtr->getTrialScale(iTrial);
4578 double q2new = pow2(qNew);
4579 int iAntPhys = trialPtr->getPhysIndex(iTrial);
4580 bool is1A = trialPtr->is1A();
4581 double eBeamUsed = (is1A ? eBeamAUsed : eBeamBUsed);
4584 TrialGeneratorISR* trialGenPtr = trialPtr->trialGenPtrsSav[iTrial];
4585 int idA = trialPtr->id1sav;
4586 int idK = trialPtr->id2sav;
4589 bool forceSplitting = trialPtr->forceSplittingSav;
4590 if (forceSplitting) {
4591 trialPtr->zMinSav[iTrial] =
4592 trialPtr->trialGenPtrsSav[iTrial]->getZmin(q2new, trialPtr->sAnt(),
4593 trialPtr->e1sav, eBeamUsed);
4594 trialPtr->zMaxSav[iTrial] =
4595 trialPtr->trialGenPtrsSav[iTrial]->getZmax(q2new, trialPtr->sAnt(),
4596 trialPtr->e1sav, eBeamUsed);
4597 if (verbose >= superdebug)
4598 printOut(__METHOD_NAME__,
"Note: this is a forced splitting");
4604 double sAK = trialPtr->sAnt();
4605 bool pass = trialPtr->genTrialInvariants(saj, sjk, eBeamUsed, iTrial);
4607 if (verbose >= verylouddebug)
4608 printOut(__METHOD_NAME__,
"z outside physical range, returning.");
4610 ++nFailedHull[iAntPhys];
4615 if (verbose >= normal) {
4616 double sAntSav = trialPtr->sAnt();
4617 double sCheck = 2 *
event[trialPtr->i1sav].p()*
event[trialPtr->i2sav].p();
4618 if (abs(sAntSav - sCheck) > TINY) {
4621 cout <<
" sAK doesn't look preserved sAnt = " << sAntSav <<
" sCheck = "
4628 int idConv = (iAntPhys == iGXconvIF) ? trialPtr->getTrialFlav() : 0;
4631 double mKold=
event[trialPtr->i2sav].m();
4634 if (iAntPhys == iQQemitIF || iAntPhys == iQGemitIF ||
4635 iAntPhys == iGQemitIF || iAntPhys == iGGemitIF) {
4637 trialPtr->new1.id(idA);
4638 trialPtr->new2.id(21);
4639 trialPtr->new3.id(idK);
4642 trialPtr->new1.m(0.0);
4643 trialPtr->new2.m(0.0);
4644 trialPtr->new3.m(mk);
4647 }
else if (iAntPhys == iQXsplitIF) {
4649 trialPtr->new1.id(21);
4650 trialPtr->new2.id(-idA);
4651 trialPtr->new3.id(idK);
4653 mj = (abs(idA) <= nFlavZeroMass) ? 0.0
4654 : particleDataPtr->m0(abs(idA));
4656 trialPtr->new1.m(0.0);
4657 trialPtr->new2.m(mj);
4658 trialPtr->new3.m(mk);
4661 }
else if (iAntPhys == iGXconvIF) {
4663 trialPtr->new1.id(idConv);
4664 trialPtr->new2.id(idConv);
4665 trialPtr->new3.id(idK);
4667 mj = (abs(idConv) <= nFlavZeroMass) ? 0.0
4668 : particleDataPtr->m0(abs(idConv));
4670 trialPtr->new1.m(0.0);
4671 trialPtr->new2.m(mj);
4672 trialPtr->new3.m(mk);
4673 if (verbose == superdebug) {
4675 ss <<
"Gluon backwards evolving to id = " << idConv
4677 <<
" mK = " << trialPtr->new3.m();
4678 printOut(__METHOD_NAME__,ss.str());
4682 }
else if (iAntPhys == iXGsplitIF) {
4684 double nF = min((
int)trialPtr->getColFac(iTrial),nGluonToQuarkF);
4685 int splitFlavor = int(rndmPtr->flat() * nF) + 1;
4687 int nFmax = (int)nF;
4688 if (q2new > 4.0*pow2(mb)) nFmax = min(nFmax,5);
4689 else if (q2new > 4.0*pow2(mc)) nFmax = min(nFmax,4);
4690 else if (q2new > 4.0*pow2(ms)) nFmax = min(nFmax,3);
4691 else nFmax = min(nFmax,2);
4692 if (nFmax < splitFlavor)
return false;
4693 trialPtr->new1.id(idA);
4695 if (abs(event[trialPtr->i1sav].col()) ==
4696 abs(event[trialPtr->i2sav].col()) ) {
4698 trialPtr->new2.id( splitFlavor);
4699 trialPtr->new3.id(-splitFlavor);
4702 trialPtr->new2.id(-splitFlavor);
4703 trialPtr->new3.id( splitFlavor);
4706 mj = (abs(splitFlavor) <= nFlavZeroMass) ? 0.0
4707 : particleDataPtr->m0(abs(splitFlavor));
4709 trialPtr->new1.m(event[trialPtr->i1sav].m());
4710 trialPtr->new2.m(mj);
4711 trialPtr->new3.m(mk);
4717 int kineMap = getAnt(iAntPhys)->kineMap();
4719 double phi = 2 * M_PI * rndmPtr->flat();
4723 double m2Kold = mKold*mKold;
4724 double sak = sAK + sjk - saj + m2j + m2k -m2Kold;
4727 vector<Vec4> pOld, pNew;
4728 pOld.push_back(event[trialPtr->i1sav].p());
4729 pOld.push_back(event[trialPtr->i2sav].p());
4732 bool useLocalMap = (kineMap == 1);
4733 if (kineMap == 2 && iAntPhys == iXGsplitIF) useLocalMap =
true;
4734 if (saj >= sAK) useLocalMap =
true;
4737 double probGlobal = pow2(sAK - saj) / (pow2(sAK + sjk) + pow2(sAK - saj));
4738 if (rndmPtr->flat() < probGlobal) {
4740 int iB = partonSystemsPtr->getInB(iSysWin);
4741 if (iB == trialPtr->i1sav) iB = partonSystemsPtr->getInA(iSysWin);
4742 Vec4 pB =
event[iB].p();
4743 pass = vinComPtr->map2to3IFglobal(pNew, pRec, pOld, pB,
4744 sAK, saj, sjk, sak, phi, m2Kold, m2j, m2k);
4746 if (!pass && kineMapIFretry) useLocalMap =
true;
4748 }
else useLocalMap =
true;
4753 pass = vinComPtr->map2to3IFlocal(pNew, pOld, sAK, saj, sjk, sak, phi,
4756 if (!pass && !forceSplitting) {
4757 if (verbose >= louddebug ) printOut(__METHOD_NAME__,
"Failed map2to3IF.");
4759 ++nFailedKine[iAntPhys];
4764 double eBeam = (is1A ? eBeamA : eBeamB);
4765 double eBeamUsedNow = eBeamUsed - pOld[0].e() + pNew[0].e();
4766 if (eBeamUsedNow > 0.98*eBeam) {
4768 ++nFailedKine[iAntPhys];
4773 trialPtr->new1.p(pNew[0]);
4774 trialPtr->new2.p(pNew[1]);
4775 trialPtr->new3.p(pNew[2]);
4777 trialPtr->new1.pol(9);
4778 trialPtr->new2.pol(9);
4779 trialPtr->new3.pol(9);
4780 if (verbose >= verylouddebug) {
4781 printOut(__METHOD_NAME__,
"Printing pre-branching momenta");
4782 for (
int i = 0; i < 2; i++) cout <<
" " << pOld[i];
4783 printOut(__METHOD_NAME__,
"Printing post-branching momenta and recoiler");
4784 for (
int i = 0; i < 3; i++) cout <<
" " << pNew[i];
4785 for (
int i = 0; i < (int)pRec.size(); i++) cout <<
" " << pRec[i];
4792 BeamParticle* beamPtr = is1A ? beamAPtr : beamBPtr;
4793 double PDFscale = q2new;
4795 int idNew = trialPtr->new1.id();
4796 double eOld = pOld[0].e();
4797 double xOld = eOld / eBeam;
4798 double eNew = pNew[0].e();
4799 double xNew = eNew / eBeam;
4800 if (verbose > normal && !beamPtr->insideBounds(xNew, PDFscale))
4801 printf(
"%s::PDFratio {x,Q2} outside boundaries\n",
4802 trialGenPtr->name().c_str());
4803 double newPDF = beamPtr->xfISR(iSysWin,idNew,xNew,PDFscale);
4807 ++nFailedKine[iAntPhys];
4810 double oldPDF = beamPtr->xfISR(iSysWin,idOld,xOld,PDFscale);
4811 double pdfRatio = max(newPDF,TINYPDF) / max(oldPDF,TINYPDF);
4814 if (oldPDF <= 0.0 && verbose > normal) {
4815 cout <<
" PDF ratio = " << num2str(pdfRatio)
4816 <<
" for idOld = " << idOld <<
" idNew = " << idNew
4817 <<
" xOld = " << num2str(xOld) <<
" xNew = " << num2str(xNew)
4818 <<
" qPDF = " << num2str(sqrt(PDFscale))
4820 cout <<
" Numerator = "
4821 << num2str(beamPtr->xfISR(iSysWin,idNew,xNew,PDFscale))
4823 << num2str(beamPtr->xfISR(iSysWin,idOld,xOld,PDFscale))
4824 <<
" iSys = " << iSysWin <<
" nSys = "
4825 << partonSystemsPtr->sizeSys() << endl;
4829 trialPtr->addPDF(iTrial, pdfRatio);
4832 double eAotherSys = 0.0;
4833 double eBeamNow = 0.0;
4836 for (map<int, Particle>::iterator it = initialA.begin();
4837 it != initialA.end(); it++) {
4839 if (i!=iSysWin) eAotherSys+=initialA[i].e();
4844 for (map<int, Particle>::iterator it = initialB.begin();
4845 it != initialB.end(); it++) {
4847 if (i!=iSysWin) eAotherSys+=initialB[i].e();
4851 if ((eNew+eAotherSys) > 0.98*eBeamNow) {
4852 if (verbose >= verylouddebug) printOut(__METHOD_NAME__,
4853 "Energy of incoming partons exceed beam energy, returning.");
4855 if (forceSplitting) {
4856 if (verbose >= verylouddebug)
4857 printOut(__METHOD_NAME__,
"Forced splitting, lowering sjk.");
4858 eNew = (0.98*eBeamNow - eAotherSys);
4859 sjk = sAK*(eNew-eOld)/eOld;
4862 if (sjk <= 0.0) sjk = pow(10.0,-10.0);
4863 if (verbose >= verylouddebug) printOut(__METHOD_NAME__,
4864 "Need to choose sjk = "+ num2str(sjk) +
" probably due to MPI");
4866 eNew = eOld*(sAK+sjk)/sAK;
4867 sak = sAK + sjk - saj + m2j + m2k -m2Kold;
4872 saj = sAK + sjk - sak + m2j + m2k -m2Kold;
4873 }
while (saj <= sak);
4875 q2new = trialGenPtr->getQ2(saj,sjk,sAK);
4877 trialPtr->scaleSav[iTrial] = qNew;
4880 ++nFailedHull[iAntPhys];
4892 if (!forceSplitting) {
4893 double mMin23 = vinComPtr->mHadMin(trialPtr->new2.id(),
4894 trialPtr->new3.id());
4895 if (sjk < pow2(1.01*mMin23)) {
4896 if (verbose >= debug)
4897 printOut(__METHOD_NAME__,
"=== Branching Vetoed. m23 < 1.01*mMes.");
4899 ++nFailedCutoff[iAntPhys];
4907 if (verbose >= louddebug) printOut(__METHOD_NAME__,
"end --------------");
4917 bool VinciaISR::acceptTrial(
const Event& event, BranchElementalISR* trialPtr) {
4920 if (verbose >= debug) printOut(__METHOD_NAME__,
"begin --------------");
4921 int iTrial = indxWin;
4923 if (verbose >= debug) printOut(__METHOD_NAME__,
"iTrial < 0 ");
4926 double qNew = trialPtr->getTrialScale(iTrial);
4927 int iAntPhys = trialPtr->getPhysIndex(iTrial);
4928 int iSys = trialPtr->system;
4929 bool isII = trialPtr->isII();
4930 bool isSwapped = (isII ? trialPtr->getIsSwapped(iTrial) :
false);
4935 TrialGeneratorISR* trialGenPtr = trialPtr->trialGenPtrsSav[iTrial];
4938 double S12 = trialPtr->sAnt();
4939 double s1j = trialPtr->s12();
4940 double sj2 = trialPtr->s23();
4944 double hA =
event[trialPtr->i1sav].pol();
4945 double hB =
event[trialPtr->i2sav].pol();
4946 bool isPolarised = polarisedSys[iSys] && (hA != 9 && hB != 9);
4950 double antPDFtrialSum = 0.0;
4951 double nTrialTerms = 0;
4952 for (
int iTerm = 0; iTerm < (int)trialPtr->nTrialGenerators(); ++iTerm) {
4954 if (trialPtr->getPhysIndex(iTerm) != iAntPhys)
continue;
4956 if (isII && trialPtr->getIsSwapped(iTerm) != isSwapped)
continue;
4957 antPDFtrialSum += trialPtr->headroomSav[iTerm]
4958 * trialPtr->trialGenPtrsSav[iTerm]->aTrial(s1j, sj2, S12)
4959 * trialPtr->trialPDFratioSav[iTerm]
4960 * trialPtr->getColFac(iTerm);
4966 double enhanceFac = trialPtr->getEnhanceFac(iTrial);
4971 if (enhanceFac > 1.0 && qNew <= enhanceCutoff) {
4972 if ( rndmPtr->flat() > 1./enhanceFac ) {
4973 if (verbose >= verylouddebug)
4974 printOut(__METHOD_NAME__,
"Trial vetoed at enhancement stage.");
4984 double s1jant = s1j;
4985 double sj2ant = sj2;
4986 double m1ant = trialPtr->new1.m();
4987 double mjant = trialPtr->new2.m();
4988 double m2ant = trialPtr->new3.m();
4994 m1ant = trialPtr->new3.m();
4995 m2ant = trialPtr->new1.m();
4998 vector<double> invariants;
4999 invariants.push_back(S12);
5000 invariants.push_back(s1jant);
5001 invariants.push_back(sj2ant);
5002 invariants.push_back(trialPtr->s13());
5004 vector<double> mNew;
5005 mNew.push_back(m1ant);
5006 mNew.push_back(mjant);
5007 mNew.push_back(m2ant);
5010 helBef.push_back(hAant);
5011 helBef.push_back(hBant);
5013 vector<int> helUnpol;
5014 helUnpol.push_back(9);
5015 helUnpol.push_back(9);
5016 helUnpol.push_back(9);
5020 AntennaFunctionIX* antPtr = getAnt(iAntPhys);
5022 if (verbose >= verylouddebug)
5023 printOut(__METHOD_NAME__,
"Evaluating antenna function and PDF ratio");
5026 if (!isPolarised) helSum = antPtr->antFun(invariants,mNew);
5028 else helSum = antPtr->antFun(invariants, mNew, helBef, helUnpol);
5030 if (verbose > normal) {
5031 infoPtr->errorMsg(
"Error in "+__METHOD_NAME__+
5032 "Negative Antenna Function.",
"iAnt = "+num2str(iAntPhys));
5036 if (verbose >= verylouddebug)
5037 printOut(__METHOD_NAME__,
"helSum = "+num2str(helSum));
5040 double antPhys = helSum;
5042 antPhys *= antPtr->chargeFac();
5044 double PDFphys = trialPtr->physPDFratioSav[iTrial];
5046 double extraMassPDFfactor = trialPtr->extraMassPDFfactorSav[iTrial];
5047 PDFphys *= extraMassPDFfactor;
5050 Paccept[0] = antPhys*PDFphys/antPDFtrialSum;
5051 if (verbose >= superdebug ||
5052 (Paccept[0] > 1.02 && qNew > 1.0 && verbose >= quiteloud)) {
5053 if (nTrialTerms == 1) {
5054 printOut(__METHOD_NAME__,
"Single trial:");
5055 cout <<
" TrialGenerator= " << trialGenPtr->name() << endl;
5056 cout <<
" AntTrial/s = " << setprecision(6)
5057 << trialGenPtr->aTrial(s1j, sj2, S12) <<
" * "
5058 << trialPtr->headroomSav[iTrial] <<
" (headroom)"
5059 <<
" s1j, s2j = " << s1j <<
" " << sj2 <<
" sOld = " << S12 << endl;
5060 cout <<
" AntPhys/s = " << setprecision(6)
5061 << antPhys/antPtr->chargeFac() << endl;
5062 cout <<
" massPDFfactor = " << setprecision(6) << extraMassPDFfactor
5064 cout <<
" PDFtrial = " << setprecision(6)
5065 << trialPtr->trialPDFratioSav[iTrial] << endl;
5066 cout <<
" PDFphys = " << setprecision(6)
5069 printOut(__METHOD_NAME__,
5070 "Combination of seveveral trials (gluon emission):");
5071 cout <<
" Win Generator = " << trialGenPtr->name() << endl;
5072 cout <<
" AntPhys/s = " << setprecision(6) << antPhys << endl;
5073 cout <<
" PDFphys = " << setprecision(6) << PDFphys << endl;
5075 if (isII) cout <<
" II isSwapped = " << bool2str(isSwapped) << endl;
5076 else cout <<
" IF is1A = " << bool2str(trialPtr->is1A()) << endl;
5077 cout <<
" idOld = " << trialPtr->id1sav <<
" "
5078 << trialPtr->id2sav;
5079 cout <<
" idNew = " << trialPtr->new1.id() <<
" "
5080 << trialPtr->new2.id() <<
" " << trialPtr->new3.id() << endl;
5081 cout <<
" xOld = " << trialPtr->e1sav/eBeamA;
5082 if (isII) cout <<
" " << trialPtr->e2sav/eBeamB << endl;
5084 cout <<
" isVal = " << bool2str(trialPtr->isVal1());
5085 if (isII) cout <<
" " << bool2str(trialPtr->isVal2());
5087 cout <<
" Q = " << qNew << endl;
5088 cout <<
" AntPDFtrial = " << setprecision(6) << antPDFtrialSum
5090 cout <<
" AntPDFphys = " << setprecision(6) << antPhys*PDFphys
5092 cout <<
" Paccept = " << setprecision(6) << Paccept[0] << endl;
5093 cout <<
" Enhancement = " << setprecision(6) << enhanceFac << endl;
5099 if ( isPolarised ) {
5101 double randHel = rndmPtr->flat() * helSum;
5103 int hi(0), hj(0), hk(0);
5104 for (hi = hAant; abs(hi) <= 1; hi -= 2*hAant) {
5105 for (hk = hBant; abs(hk) <= 1; hk -= 2*hBant) {
5106 for (hj = hAant; abs(hj) <= 1; hj -= 2*hAant) {
5108 helNow.push_back(hi);
5109 helNow.push_back(hj);
5110 helNow.push_back(hk);
5111 aHel = antPtr->antFun(invariants, mNew, helBef, helNow);
5113 if (verbose >= verylouddebug){
5115 ss<<
"antPhys("<< hAant <<
" " << hBant
5116 <<
" -> "<< hi <<
" " << hj <<
" "<< hk <<
") = " << aHel
5117 <<
" isSwapped = " << isSwapped
5118 <<
" sum = " << helSum;
5119 printOut(__METHOD_NAME__, ss.str());
5121 if (randHel < 0.)
break;
5123 if (randHel < 0.)
break;
5125 if (randHel < 0.)
break;
5127 if (verbose >= louddebug)
5128 printOut(__METHOD_NAME__,
"selected" + num2str(
int(hAant)) +
5129 " " + num2str(
int(hBant)) +
" -> " + num2str(hi) +
" " +
5130 num2str(hj) +
" " + num2str(hk) +
", isSwapped = " +
5131 bool2str(isSwapped)+
"\n");
5134 trialPtr->new1.pol(hi);
5135 trialPtr->new2.pol(hj);
5136 trialPtr->new3.pol(hk);
5138 trialPtr->new1.pol(hk);
5139 trialPtr->new2.pol(hj);
5140 trialPtr->new3.pol(hi);
5144 trialPtr->new1.pol(9);
5145 trialPtr->new2.pol(9);
5146 trialPtr->new3.pol(9);
5147 polarisedSys[iSys] =
false;
5155 double alphaTrial = trialPtr->getAlphaTrial(iTrial);
5156 if (std::isnan(alphaTrial)) cout <<
" alphaStrial is NAN!!!" << endl;
5157 if (alphaTrial != alphaTrial)
5158 cout <<
" alphaStrial is != alphaStrial" << endl;
5159 double mu2 = pow2(qNew);
5160 double kMu2Usr = aSkMu2EmitI;
5161 if (iAntPhys == iXGsplitIF) kMu2Usr = aSkMu2SplitF;
5162 else if (iAntPhys == iQXsplitIF || iAntPhys == iQXsplitII)
5163 kMu2Usr = aSkMu2SplitI;
5164 else if (iAntPhys == iGXconvIF || iAntPhys == iGXconvII)
5165 kMu2Usr = aSkMu2Conv;
5166 double mu2Usr = max(mu2min, mu2freeze + mu2*kMu2Usr);
5168 double alphaSusr = min(alphaSmax, alphaSptr->alphaS(mu2Usr));
5169 if (verbose >= verylouddebug ||
5170 (verbose >= quiteloud && alphaTrial < alphaSusr)) {
5172 ss <<
"alphaTrial = " << alphaTrial <<
", alphaSusr = " << alphaSusr
5173 <<
" at q = " << qNew <<
", Trial Generator " << trialGenPtr->name();
5174 printOut(__METHOD_NAME__, ss.str() );
5178 Paccept[0] *= alphaSusr / alphaTrial;
5182 bool doMEC = doMECsSys[iSys];
5185 if (doMEC) doMEC =
false;
5188 int branchOrder = 1;
5189 int showerOrder = branchOrder
5190 + partonSystemsPtr->sizeOut(iSys) - mecsPtr->sizeOutBorn(iSys);
5191 if (doMEC) doMEC =
false;
5193 if (doMEC) doMEC =
false;
5199 Event eventNew = event;
5200 int iSysNew = partonSystemsPtr->addSys();
5203 partonSystemsPtr->setInA(iSysNew, partonSystemsPtr->getInA(iSys));
5204 partonSystemsPtr->setInB(iSysNew, partonSystemsPtr->getInB(iSys));
5205 for (
int i=0; i<partonSystemsPtr->sizeOut(iSys); ++i)
5206 partonSystemsPtr->addOut(iSysNew, partonSystemsPtr->getOut(iSys,i));
5219 partonSystemsPtr->popBack();
5223 if (verbose >= verylouddebug)
5224 printOut(__METHOD_NAME__,
" Trial Paccept = " + num2str(Paccept[0]));
5225 bool violation = (Paccept[0] > 1.0 + TINY);
5226 bool negPaccept = (Paccept[0] < 0.0);
5227 if (violation || negPaccept) {
5228 if (verbose >= quiteloud ) {
5230 if(doMEC) ss <<
"Paccept (shower and ME, order = ";
5231 else ss <<
"Paccept (shower, order = ";
5232 ss << showerOrder <<
" ) = " << Paccept[0] <<
" at q = " << qNew
5233 <<
" in Trial Generator " << trialGenPtr->name();
5234 printOut(__METHOD_NAME__, ss.str());
5235 if (extraMassPDFfactor != 1.0)
5236 printOut(__METHOD_NAME__,
" == Note: PDFs close to mass threshold");
5237 if (verbose >= loud || Paccept[0] > 100.0) {
5238 if (doMEC) cout <<
" MEC factor = " << pMEC << endl;
5239 cout << (isII ?
" AB -> ajb = " :
" AK -> ajk = ") << trialPtr->id1sav
5240 <<
" " << trialPtr->id2sav <<
" -> " << trialPtr->new1.id() <<
" "
5241 << trialPtr->new2.id() <<
" " << trialPtr->new3.id() <<
" maj = "
5242 << sqrt(m2(trialPtr->new1.p()+trialPtr->new2.p()))
5244 " mjk")<<
" = "<<sqrt(m2(trialPtr->new2.p()+trialPtr->new3.p()))
5245 << (isII ?
" mAB" :
" mAK") <<
" = " << sqrt(S12)<<endl;
5247 if (verbose >= debug) trialPtr->list();
5248 if (Paccept[0] > 100.0) {
5249 int nResc = trialPtr->getNshouldRescue(iTrial);
5250 double PDFphysTrial = trialPtr->physPDFratioSav[iTrial]/
5251 trialPtr->trialPDFratioSav[iTrial];
5252 if (nResc>0 || PDFphysTrial>100.0) {
5253 if (nResc>0) cout <<
" Had " << nResc <<
" pTnext ~ pTold,";
5255 cout <<
" Headroom = " << trialPtr->headroomSav[iTrial]
5256 <<
", PDFphys/ PDFtrial = " << PDFphysTrial << endl;
5266 if (rndmPtr->flat() > min(1.0,enhanceFac)*Paccept[0]) {
5269 if (enhanceFac != 1.0)
5270 weightsPtr->scaleWeightEnhanceReject(Paccept[0],enhanceFac);
5274 ++nFailedVeto[iAntPhys];
5275 rFailedVetoPDF[iAntPhys] += trialPtr->physPDFratioSav[iTrial]/
5276 trialPtr->trialPDFratioSav[iTrial];
5277 if (verbose >= debug ) {
5278 printOut(__METHOD_NAME__,
"Branching vetoed.");
5279 if (verbose >= verylouddebug) {
5281 ss <<
"Paccept = " << Paccept[0] <<
" Enhancefac = " << enhanceFac;
5282 printOut(__METHOD_NAME__, ss.str());
5289 if (enhanceFac != 1.0)
5290 weightsPtr->scaleWeightEnhanceAccept(enhanceFac);
5291 if (verbose >= debug) printOut(__METHOD_NAME__,
"end --------------");
5301 bool VinciaISR::assignColourFlow(
Event& event, BranchElementalISR* trialPtr) {
5304 bool usedColTag =
false;
5305 int iTrial = indxWin;
5306 int iAntPhys = trialPtr->getPhysIndex(iTrial);
5307 bool isSwapped = trialPtr->getIsSwapped(iTrial);
5308 int colOld = trialPtr->col();
5309 int col1 =
event[trialPtr->i1sav].col();
5310 int acol1 =
event[trialPtr->i1sav].acol();
5311 int col2 =
event[trialPtr->i2sav].col();
5312 int acol2 =
event[trialPtr->i2sav].acol();
5315 if (trialPtr->new2.id() == 21) {
5316 double s12 = trialPtr->new1.p()*trialPtr->new2.p();
5317 double s23 = trialPtr->new2.p()*trialPtr->new3.p();
5319 bool inh12 = colourPtr->inherit01(s12,s23);
5322 int nTag =
event.lastColTag()+1;
5327 if (trialPtr->colType1sav == 2) {
5328 if (colOld == col1) colL =
event[trialPtr->i1sav].acol();
5329 else colL =
event[trialPtr->i1sav].col();
5331 if (trialPtr->colType2sav == 2) {
5332 if (colOld == col2) colR =
event[trialPtr->i2sav].acol();
5333 else colR =
event[trialPtr->i2sav].col();
5335 int nextTag = 10*int(nTag/10) + 10;
5336 int colNew = nextTag + int(colOld%10 + rndmPtr->flat()*8)%9 + 1;
5339 while (colNew%10 == colR%10)
5340 colNew = nextTag + int(colOld%10 + rndmPtr->flat()*8)%9 + 1;
5341 trialPtr->new1.acol(acol1);
5342 trialPtr->new1.col(col1);
5343 trialPtr->new2.acol(colOld == col1 ? colNew : colOld);
5344 trialPtr->new2.col(colOld == col1 ? colOld : colNew);
5345 trialPtr->new3.acol(colOld == acol2 ? colNew : acol2);
5346 trialPtr->new3.col(colOld == acol2 ? col2 : colNew);
5349 while (colNew%10 == colL%10)
5350 colNew = nextTag + int(colOld%10 + rndmPtr->flat()*8)%9 + 1;
5351 trialPtr->new1.acol(colOld == col1 ? acol1 : colNew);
5352 trialPtr->new1.col(colOld == col1 ? colNew : col1);
5353 trialPtr->new2.acol(colOld == col1 ? colOld : colNew);
5354 trialPtr->new2.col(colOld == col1 ? colNew : colOld);
5355 trialPtr->new3.acol(acol2);
5356 trialPtr->new3.col(col2);
5360 }
else if ((iAntPhys == iQXsplitII && !isSwapped) ||
5361 iAntPhys == iQXsplitIF) {
5366 int nTag =
event.lastColTag()+1;
5369 if (colOld == col1) {
5370 trialPtr->new1.acol(nTag);
5371 trialPtr->new1.col(col1);
5372 trialPtr->new2.acol(nTag);
5373 trialPtr->new2.col(0);
5376 trialPtr->new1.acol(acol1);
5377 trialPtr->new1.col(nTag);
5378 trialPtr->new2.acol(0);
5379 trialPtr->new2.col(nTag);
5381 trialPtr->new3.acol(acol2);
5382 trialPtr->new3.col(col2);
5386 else if (iAntPhys == iQXsplitII && isSwapped) {
5391 int nTag =
event.lastColTag()+1;
5394 if (colOld == col2) {
5395 trialPtr->new2.acol(nTag);
5396 trialPtr->new2.col(0);
5397 trialPtr->new3.acol(nTag);
5398 trialPtr->new3.col(col2);
5401 trialPtr->new2.acol(0);
5402 trialPtr->new2.col(nTag);
5403 trialPtr->new3.acol(acol2);
5404 trialPtr->new3.col(nTag);
5406 trialPtr->new1.acol(acol1);
5407 trialPtr->new1.col(col1);
5411 else if ((iAntPhys == iGXconvII && !isSwapped) || iAntPhys == iGXconvIF) {
5415 if (trialPtr->new2.id() > 0) {
5416 trialPtr->new1.acol(0);
5417 trialPtr->new1.col(col1);
5418 trialPtr->new2.acol(0);
5419 trialPtr->new2.col(acol1);
5422 trialPtr->new1.acol(acol1);
5423 trialPtr->new1.col(0);
5424 trialPtr->new2.acol(col1);
5425 trialPtr->new2.col(0);
5427 trialPtr->new3.acol(acol2);
5428 trialPtr->new3.col(col2);
5432 else if (iAntPhys == iGXconvII && isSwapped) {
5436 if (trialPtr->new2.id() > 0) {
5437 trialPtr->new2.acol(0);
5438 trialPtr->new2.col(acol2);
5439 trialPtr->new3.acol(0);
5440 trialPtr->new3.col(col2);
5443 trialPtr->new2.acol(col2);
5444 trialPtr->new2.col(0);
5445 trialPtr->new3.acol(acol2);
5446 trialPtr->new3.col(0);
5448 trialPtr->new1.acol(acol1);
5449 trialPtr->new1.col(col1);
5453 else if ( iAntPhys == iXGsplitIF) {
5457 if (trialPtr->new2.id() > 0) {
5458 trialPtr->new2.acol(0);
5459 trialPtr->new2.col(col2);
5460 trialPtr->new3.acol(acol2);
5461 trialPtr->new3.col(0);
5464 trialPtr->new2.acol(acol2);
5465 trialPtr->new2.col(0);
5466 trialPtr->new3.acol(0);
5467 trialPtr->new3.col(col2);
5469 trialPtr->new1.acol(acol1);
5470 trialPtr->new1.col(col1);