9 #include "Pythia8/DireSplittingsU1new.h"
10 #include "Pythia8/DireSpace.h"
11 #include "Pythia8/DireTimes.h"
21 void DireSplittingU1new::init() {
23 int nGammaToQuark = settingsPtr->mode(
"TimeShower:nGammaToQuark");
24 int nGammaToLepton = settingsPtr->mode(
"TimeShower:nGammaToLepton");
26 sumCharge2L = max(0, min(3, nGammaToLepton));
28 if (nGammaToQuark > 4) sumCharge2Q = 11. / 9.;
29 else if (nGammaToQuark > 3) sumCharge2Q = 10. / 9.;
30 else if (nGammaToQuark > 2) sumCharge2Q = 6. / 9.;
31 else if (nGammaToQuark > 1) sumCharge2Q = 5. / 9.;
32 else if (nGammaToQuark > 0) sumCharge2Q = 1. / 9.;
33 sumCharge2Tot = sumCharge2L + 3. * sumCharge2Q;
36 int alphaEMorder = settingsPtr->mode(
"SpaceShower:alphaEMorder");
38 alphaEM.init( alphaEMorder, settingsPtr);
40 ax0 = settingsPtr->parm(
"Dire:U1new:alphaX");
42 enhance = settingsPtr->parm(
"Enhance:"+
id);
44 splitInfo.canUseForBranching(
true);
46 doU1NEWshowerByQ = (is_fsr) ? settingsPtr->flag(
"TimeShower:U1newShowerByQ")
47 : settingsPtr->flag(
"SpaceShower:U1newShowerByQ");
48 doU1NEWshowerByL = (is_fsr) ? settingsPtr->flag(
"TimeShower:U1newShowerByL")
49 : settingsPtr->flag(
"SpaceShower:U1newShowerByL");
58 double DireSplittingU1new::aem2Pi(
double pT2,
int ) {
60 double scale = pT2*renormMultFac;
63 double aemPT2pi = alphaEM.alphaEM(scale) / (2.*M_PI);
77 bool Dire_fsr_u1new_Q2QA::canRadiate (
const Event& state, pair<int,int> ints,
78 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
79 return ( state[ints.first].isFinal()
80 && state[ints.first].isQuark() && state[ints.second].isCharged()
81 && bools[
"doQEDshowerByQ"]);
84 bool Dire_fsr_u1new_Q2QA::canRadiate (
const Event& state,
int iRadBef,
85 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
86 return ( state[iRadBef].isFinal()
87 && state[iRadBef].isQuark() && state[iRecBef].isCharged()
91 int Dire_fsr_u1new_Q2QA::kinMap() {
return 1;}
92 int Dire_fsr_u1new_Q2QA::motherID(
int idDaughter) {
return idDaughter;}
93 int Dire_fsr_u1new_Q2QA::sisterID(
int) {
return 900032;}
95 double Dire_fsr_u1new_Q2QA::gaugeFactor (
int idRadBef,
int idRecBef) {
96 double chgRad = particleDataPtr->charge(idRadBef);
97 double chgRec = particleDataPtr->charge(idRecBef);
98 double charge = -1.*chgRad*chgRec;
99 if (!splitInfo.radBef()->isFinal) charge *= -1.;
100 if (!splitInfo.recBef()->isFinal) charge *= -1.;
101 if (idRadBef != 0 && idRecBef != 0)
return charge;
106 double Dire_fsr_u1new_Q2QA::symmetryFactor (
int,
int ) {
return 1.;}
108 int Dire_fsr_u1new_Q2QA::radBefID(
int idRad,
int idEmt) {
109 if (particleDataPtr->isQuark(idRad) && idEmt == 900032 )
return idRad;
113 pair<int,int> Dire_fsr_u1new_Q2QA::radBefCols(
114 int colRadAfter,
int acolRadAfter,
115 int,
int) {
return make_pair(colRadAfter,acolRadAfter); }
117 vector<int>Dire_fsr_u1new_Q2QA::recPositions(
const Event& state,
int iRad,
121 if ( !state[iRad].isFinal()
122 || !state[iRad].isQuark()
123 || state[iEmt].
id() != 900032)
return recs;
126 vector<int> iExc(createvector<int>(iRad)(iEmt));
128 for (
int i=0; i < state.size(); ++i) {
129 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
130 if ( state[i].isCharged() && state[i].isQuark()) {
131 if (state[i].isFinal())
133 if (state[i].mother1() == 1 && state[i].mother2() == 0)
135 if (state[i].mother1() == 2 && state[i].mother2() == 0)
145 double Dire_fsr_u1new_Q2QA::zSplit(
double zMinAbs,
double,
double m2dip) {
146 double Rz = rndmPtr->flat();
147 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
148 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
149 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
154 double Dire_fsr_u1new_Q2QA::overestimateInt(
double zMinAbs,
double,
155 double,
double m2dip,
int) {
157 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
158 double preFac = symmetryFactor() * abs(charge);
160 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
161 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
166 double Dire_fsr_u1new_Q2QA::overestimateDiff(
double z,
double m2dip,
int) {
168 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
169 double preFac = symmetryFactor() * abs(charge);
170 double kappaOld2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
171 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
176 bool Dire_fsr_u1new_Q2QA::calc(
const Event& state,
int orderNow) {
179 if (
false) cout << state[0].e() << orderNow << endl;
182 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
183 m2dip(splitInfo.kinematics()->m2Dip),
184 m2RadBef(splitInfo.kinematics()->m2RadBef),
185 m2Rad(splitInfo.kinematics()->m2RadAft),
186 m2Rec(splitInfo.kinematics()->m2Rec),
187 m2Emt(splitInfo.kinematics()->m2EmtAft);
188 int splitType(splitInfo.type);
197 gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
198 vector <int> in, out;
199 for (
int i=0; i < state.size(); ++i) {
200 if (state[i].isFinal()) out.push_back(state[i].id());
201 if (state[i].mother1() == 1 && state[i].mother2() == 0)
202 in.push_back(state[i].id());
203 if (state[i].mother1() == 2 && state[i].mother2() == 0)
204 in.push_back(state[i].id());
206 out.push_back(900032);
207 bool hasME = pT2 > pow2(settingsPtr->parm(
"Dire:pTminMECs"))
208 && settingsPtr->flag(
"Dire:doMECs") && fsr->weights->hasME(in,out);
209 if (hasME && chargeFac < 0.0) chargeFac = abs(chargeFac);
211 double preFac = symmetryFactor() * chargeFac;
212 double kappa2 = pT2/m2dip;
213 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
216 bool doMassive = (abs(splitType) == 2);
219 if (!doMassive && orderNow >= 0) wt += -preFac * ( 1.+z );
222 if (doMassive && orderNow >= 0) {
224 double pipj = 0., vijkt = 1., vijk = 1.;
227 if (splitType == 2) {
230 double yCS = kappa2 / (1.-z);
231 double nu2RadBef = m2RadBef/m2dip;
232 double nu2Rad = m2Rad/m2dip;
233 double nu2Emt = m2Emt/m2dip;
234 double nu2Rec = m2Rec/m2dip;
235 vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
236 double Q2mass = m2dip + m2Rad + m2Rec + m2Emt;
237 vijkt = pow2(Q2mass/m2dip - nu2RadBef - nu2Rec)
238 - 4.*nu2RadBef*nu2Rec;
239 vijk = sqrt(vijk) / (1-yCS);
240 vijkt = sqrt(vijkt)/ (Q2mass/m2dip - nu2RadBef - nu2Rec);
241 pipj = m2dip * yCS/2.;
243 }
else if (splitType ==-2) {
246 double xCS = 1 - kappa2/(1.-z);
249 pipj = m2dip/2. * (1-xCS)/xCS;
253 double massCorr = -1.*vijkt/vijk*( 1. + z + m2RadBef/pipj);
254 wt += preFac*massCorr;
258 if (orderNow < 0 && chargeFac < 0.) wt = 0.;
265 unordered_map<string,double> wts;
266 wts.insert( make_pair(
"base", wt ));
269 if (settingsPtr->parm(
"Variations:muRfsrDown") != 1.)
270 wts.insert( make_pair(
"Variations:muRfsrDown", wt ));
271 if (settingsPtr->parm(
"Variations:muRfsrUp") != 1.)
272 wts.insert( make_pair(
"Variations:muRfsrUp", wt ));
277 for ( unordered_map<string,double>::iterator it = wts.begin();
278 it != wts.end(); ++it )
279 kernelVals.insert(make_pair( it->first, it->second ));
294 bool Dire_fsr_u1new_Q2AQ::canRadiate (
const Event& state, pair<int,int> ints,
295 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
296 return ( state[ints.first].isFinal()
297 && state[ints.first].isQuark() && state[ints.second].isCharged()
298 && bools[
"doQEDshowerByQ"]);
301 bool Dire_fsr_u1new_Q2AQ::canRadiate (
const Event& state,
int iRadBef,
302 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
303 return ( state[iRadBef].isFinal()
304 && state[iRadBef].isQuark() && state[iRecBef].isCharged()
305 && doU1NEWshowerByQ);
308 int Dire_fsr_u1new_Q2AQ::kinMap() {
return 1;}
309 int Dire_fsr_u1new_Q2AQ::motherID(
int idDaughter) {
return idDaughter;}
310 int Dire_fsr_u1new_Q2AQ::sisterID(
int) {
return 900032;}
312 double Dire_fsr_u1new_Q2AQ::gaugeFactor (
int idRadBef,
int idRecBef) {
313 double chgRad = particleDataPtr->charge(idRadBef);
314 double chgRec = particleDataPtr->charge(idRecBef);
315 double charge = -1.*chgRad*chgRec;
316 if (!splitInfo.radBef()->isFinal) charge *= -1.;
317 if (!splitInfo.recBef()->isFinal) charge *= -1.;
318 if (idRadBef != 0 && idRecBef != 0)
return charge;
323 double Dire_fsr_u1new_Q2AQ::symmetryFactor (
int,
int ) {
return 1.;}
325 int Dire_fsr_u1new_Q2AQ::radBefID(
int idRad,
int idEmt) {
326 if (idRad == 900032 && particleDataPtr->isQuark(idEmt))
return idEmt;
327 if (idEmt == 900032 && particleDataPtr->isQuark(idRad))
return idRad;
331 pair<int,int> Dire_fsr_u1new_Q2AQ::radBefCols(
332 int colRadAfter,
int acolRadAfter,
333 int,
int) {
return make_pair(colRadAfter,acolRadAfter); }
335 vector<int>Dire_fsr_u1new_Q2AQ::recPositions(
const Event& state,
int iRad,
339 if ( !state[iRad].isFinal()
340 || !state[iRad].isQuark()
341 || state[iEmt].
id() != 900032)
return recs;
344 vector<int> iExc(createvector<int>(iRad)(iEmt));
346 for (
int i=0; i < state.size(); ++i) {
347 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
348 if ( state[i].isCharged() && state[i].isQuark()) {
349 if (state[i].isFinal())
351 if (state[i].mother1() == 1 && state[i].mother2() == 0)
353 if (state[i].mother1() == 2 && state[i].mother2() == 0)
363 double Dire_fsr_u1new_Q2AQ::zSplit(
double zMinAbs,
double,
double m2dip) {
364 double Rz = rndmPtr->flat();
365 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
366 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
367 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
372 double Dire_fsr_u1new_Q2AQ::overestimateInt(
double zMinAbs,
double,
373 double,
double m2dip,
int) {
375 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
376 double preFac = symmetryFactor() * abs(charge);
378 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
379 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
384 double Dire_fsr_u1new_Q2AQ::overestimateDiff(
double z,
double m2dip,
int) {
386 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
387 double preFac = symmetryFactor() * abs(charge);
388 double kappaOld2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgQ"))/m2dip;
389 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
394 bool Dire_fsr_u1new_Q2AQ::calc(
const Event& state,
int orderNow) {
397 if (
false) cout << state[0].e() << orderNow << endl;
400 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
401 m2dip(splitInfo.kinematics()->m2Dip),
402 m2RadBef(splitInfo.kinematics()->m2RadBef),
403 m2Rad(splitInfo.kinematics()->m2RadAft),
404 m2Rec(splitInfo.kinematics()->m2Rec),
405 m2Emt(splitInfo.kinematics()->m2EmtAft);
406 int splitType(splitInfo.type);
414 double chargeFac = gaugeFactor(splitInfo.radBef()->id,
415 splitInfo.recBef()->id);
416 vector <int> in, out;
417 for (
int i=0; i < state.size(); ++i) {
418 if (state[i].isFinal()) out.push_back(state[i].id());
419 if (state[i].mother1() == 1 && state[i].mother2() == 0)
420 in.push_back(state[i].id());
421 if (state[i].mother1() == 2 && state[i].mother2() == 0)
422 in.push_back(state[i].id());
424 out.push_back(900032);
425 bool hasME = pT2 > pow2(settingsPtr->parm(
"Dire:pTminMECs"))
426 && settingsPtr->flag(
"Dire:doMECs") && fsr->weights->hasME(in,out);
427 if (hasME && chargeFac < 0.0) chargeFac = abs(chargeFac);
429 double preFac = symmetryFactor() * chargeFac;
430 double kappa2 = pT2/m2dip;
431 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
434 bool doMassive = (abs(splitType) == 2);
437 if (!doMassive && orderNow >= 0) wt += -preFac * ( 1.+z );
440 if (doMassive && orderNow >= 0) {
442 double pipj = 0., vijkt = 1., vijk = 1.;
445 if (splitType == 2) {
448 double yCS = kappa2 / (1.-z);
449 double nu2RadBef = m2RadBef/m2dip;
450 double nu2Rad = m2Rad/m2dip;
451 double nu2Emt = m2Emt/m2dip;
452 double nu2Rec = m2Rec/m2dip;
453 vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
454 double Q2mass = m2dip + m2Rad + m2Rec + m2Emt;
455 vijkt = pow2(Q2mass/m2dip - nu2RadBef - nu2Rec)
456 - 4.*nu2RadBef*nu2Rec;
457 vijk = sqrt(vijk) / (1-yCS);
458 vijkt = sqrt(vijkt)/ (Q2mass/m2dip - nu2RadBef - nu2Rec);
459 pipj = m2dip * yCS/2.;
461 }
else if (splitType ==-2) {
464 double xCS = 1 - kappa2/(1.-z);
467 pipj = m2dip/2. * (1-xCS)/xCS;
471 double massCorr = -1.*vijkt/vijk*( 1. + z + m2RadBef/pipj);
472 wt += preFac*massCorr;
476 if (orderNow < 0 && chargeFac < 0.) wt = 0.;
483 unordered_map<string,double> wts;
484 wts.insert( make_pair(
"base", wt ));
487 if (settingsPtr->parm(
"Variations:muRfsrDown") != 1.)
488 wts.insert( make_pair(
"Variations:muRfsrDown", wt ));
489 if (settingsPtr->parm(
"Variations:muRfsrUp") != 1.)
490 wts.insert( make_pair(
"Variations:muRfsrUp", wt ));
495 for ( unordered_map<string,double>::iterator it = wts.begin();
496 it != wts.end(); ++it )
497 kernelVals.insert(make_pair( it->first, it->second ));
510 bool Dire_fsr_u1new_L2LA::canRadiate (
const Event& state, pair<int,int> ints,
511 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
512 return (state[ints.first].isFinal() && (state[ints.first].isLepton()
513 || state[ints.first].idAbs() == 900012
514 || state[ints.first].idAbs() == 900040)
515 && (state[ints.second].isLepton()
516 || state[ints.second].idAbs() == 900012
517 || state[ints.second].idAbs() == 900040)
518 && bools[
"doQEDshowerByL"]);
521 bool Dire_fsr_u1new_L2LA::canRadiate (
const Event& state,
int iRadBef,
522 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
523 return ( state[iRadBef].isFinal()
524 && (state[iRadBef].isLepton() || state[iRadBef].idAbs() == 900012
525 || state[iRadBef].idAbs() == 900040)
526 && (state[iRecBef].isLepton() || state[iRecBef].idAbs() == 900012
527 || state[iRecBef].idAbs() == 900040)
528 && doU1NEWshowerByL);
531 int Dire_fsr_u1new_L2LA::kinMap() {
return 1;}
532 int Dire_fsr_u1new_L2LA::motherID(
int idDaughter) {
return idDaughter;}
533 int Dire_fsr_u1new_L2LA::sisterID(
int) {
return 900032;}
535 double Dire_fsr_u1new_L2LA::gaugeFactor (
int,
int) {
539 double Dire_fsr_u1new_L2LA::symmetryFactor (
int,
int ) {
return 1.;}
541 int Dire_fsr_u1new_L2LA::radBefID(
int idRad,
int idEmt) {
543 && ( particleDataPtr->isLepton(idRad) || abs(idRad) == 900012) )
548 pair<int,int> Dire_fsr_u1new_L2LA::radBefCols(
549 int colRadAfter,
int acolRadAfter,
550 int,
int) {
return make_pair(colRadAfter,acolRadAfter); }
552 vector<int>Dire_fsr_u1new_L2LA::recPositions(
const Event& state,
int iRad,
556 if ( !state[iRad].isFinal()
557 || !(state[iRad].isLepton() || state[iRad].idAbs() == 900012)
558 || state[iEmt].
id() != 900032)
return recs;
561 vector<int> iExc(createvector<int>(iRad)(iEmt));
563 for (
int i=0; i < state.size(); ++i) {
564 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
565 if ( state[i].isLepton() || state[i].idAbs() == 900012) {
566 if (state[i].mother1() == 1 && state[i].mother2() == 0)
568 if (state[i].mother1() == 2 && state[i].mother2() == 0)
578 double Dire_fsr_u1new_L2LA::zSplit(
double zMinAbs,
double,
double m2dip) {
579 double Rz = rndmPtr->flat();
580 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
581 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
582 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
587 double Dire_fsr_u1new_L2LA::overestimateInt(
double zMinAbs,
double,
588 double,
double m2dip,
int) {
590 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
591 double preFac = symmetryFactor() * abs(charge);
593 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
594 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
599 double Dire_fsr_u1new_L2LA::overestimateDiff(
double z,
double m2dip,
int) {
601 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
602 double preFac = symmetryFactor() * abs(charge);
603 double kappaOld2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
604 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
609 bool Dire_fsr_u1new_L2LA::calc(
const Event& state,
int orderNow) {
612 if (
false) cout << state[0].e() << orderNow << endl;
615 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
616 m2dip(splitInfo.kinematics()->m2Dip),
617 m2RadBef(splitInfo.kinematics()->m2RadBef),
618 m2Rad(splitInfo.kinematics()->m2RadAft),
619 m2Rec(splitInfo.kinematics()->m2Rec),
620 m2Emt(splitInfo.kinematics()->m2EmtAft);
621 int splitType(splitInfo.type);
629 double chargeFac = gaugeFactor(splitInfo.radBef()->id,
630 splitInfo.recBef()->id);
632 double preFac = symmetryFactor() * chargeFac;
633 double kappa2 = pT2/m2dip;
634 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
637 bool doMassive = (abs(splitType) == 2);
640 if (!doMassive && orderNow >= 0) wt += -preFac * ( 1.+z );
643 if (doMassive && orderNow >= 0) {
645 double pipj = 0., vijkt = 1., vijk = 1.;
648 if (splitType == 2) {
651 double yCS = kappa2 / (1.-z);
652 double nu2RadBef = m2RadBef/m2dip;
653 double nu2Rad = m2Rad/m2dip;
654 double nu2Emt = m2Emt/m2dip;
655 double nu2Rec = m2Rec/m2dip;
656 vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
657 double Q2mass = m2dip + m2Rad + m2Rec + m2Emt;
658 vijkt = pow2(Q2mass/m2dip - nu2RadBef - nu2Rec)
659 - 4.*nu2RadBef*nu2Rec;
660 vijk = sqrt(vijk) / (1-yCS);
661 vijkt = sqrt(vijkt)/ (Q2mass/m2dip - nu2RadBef - nu2Rec);
662 pipj = m2dip * yCS/2.;
664 }
else if (splitType ==-2) {
667 double xCS = 1 - kappa2/(1.-z);
670 pipj = m2dip/2. * (1-xCS)/xCS;
674 double massCorr = -1.*vijkt/vijk*( 1. + z + m2RadBef/pipj);
675 wt += preFac*massCorr;
679 if (orderNow < 0 && chargeFac < 0.) wt = 0.;
686 unordered_map<string,double> wts;
687 wts.insert( make_pair(
"base", wt ));
690 if (settingsPtr->parm(
"Variations:muRfsrDown") != 1.)
691 wts.insert( make_pair(
"Variations:muRfsrDown", wt ));
692 if (settingsPtr->parm(
"Variations:muRfsrUp") != 1.)
693 wts.insert( make_pair(
"Variations:muRfsrUp", wt ));
698 for ( unordered_map<string,double>::iterator it = wts.begin();
699 it != wts.end(); ++it )
700 kernelVals.insert(make_pair( it->first, it->second ));
715 bool Dire_fsr_u1new_L2AL::canRadiate (
const Event& state, pair<int,int> ints,
716 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
717 return ( state[ints.first].isFinal()
718 && (state[ints.first].isLepton() || state[ints.first].idAbs() == 900012
719 || state[ints.first].idAbs() == 900040)
720 && (state[ints.second].isLepton() || state[ints.second].idAbs() == 900012
721 || state[ints.second].idAbs() == 900040)
722 && bools[
"doQEDshowerByL"]);
725 bool Dire_fsr_u1new_L2AL::canRadiate (
const Event& state,
int iRadBef,
726 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
727 return ( state[iRadBef].isFinal()
728 && (state[iRadBef].isLepton() || state[iRadBef].idAbs() == 900012
729 || state[iRadBef].idAbs() == 900040)
730 && (state[iRecBef].isLepton() || state[iRecBef].idAbs() == 900012
731 || state[iRecBef].idAbs() == 900040)
732 && doU1NEWshowerByL);
735 int Dire_fsr_u1new_L2AL::kinMap() {
return 1;}
736 int Dire_fsr_u1new_L2AL::motherID(
int idDaughter) {
return idDaughter;}
737 int Dire_fsr_u1new_L2AL::sisterID(
int) {
return 900032;}
739 double Dire_fsr_u1new_L2AL::gaugeFactor (
int,
int) {
743 double Dire_fsr_u1new_L2AL::symmetryFactor (
int,
int ) {
return 1.;}
745 int Dire_fsr_u1new_L2AL::radBefID(
int idRad,
int idEmt) {
746 if (idRad == 900032 && (particleDataPtr->isLepton(idEmt)
747 || abs(idEmt) == 900012)
748 && particleDataPtr->charge(idEmt) != 0)
return idEmt;
749 if (idEmt == 900032 && (particleDataPtr->isLepton(idRad)
750 || abs(idRad) == 900012)
751 && particleDataPtr->charge(idRad) != 0)
return idRad;
755 pair<int,int> Dire_fsr_u1new_L2AL::radBefCols(
756 int colRadAfter,
int acolRadAfter,
757 int,
int) {
return make_pair(colRadAfter,acolRadAfter); }
759 vector<int>Dire_fsr_u1new_L2AL::recPositions(
const Event& state,
int iRad,
763 if ( !state[iRad].isFinal()
764 || !(state[iRad].isLepton() || state[iRad].idAbs() == 900012)
765 || state[iEmt].
id() != 900032)
return recs;
768 vector<int> iExc(createvector<int>(iRad)(iEmt));
770 for (
int i=0; i < state.size(); ++i) {
771 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
772 if ( state[i].isLepton() || state[i].idAbs() == 900012) {
773 if (state[i].isFinal())
775 if (state[i].mother1() == 1 && state[i].mother2() == 0)
777 if (state[i].mother1() == 2 && state[i].mother2() == 0)
787 double Dire_fsr_u1new_L2AL::zSplit(
double zMinAbs,
double,
double m2dip) {
788 double Rz = rndmPtr->flat();
789 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
790 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
791 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
796 double Dire_fsr_u1new_L2AL::overestimateInt(
double zMinAbs,
double,
797 double,
double m2dip,
int) {
799 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
800 double preFac = symmetryFactor() * abs(charge);
802 double kappa2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
803 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
808 double Dire_fsr_u1new_L2AL::overestimateDiff(
double z,
double m2dip,
int) {
810 double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
811 double preFac = symmetryFactor() * abs(charge);
812 double kappaOld2 = pow2(settingsPtr->parm(
"TimeShower:pTminChgL"))/m2dip;
813 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
818 bool Dire_fsr_u1new_L2AL::calc(
const Event& state,
int orderNow) {
821 if (
false) cout << state[0].e() << orderNow << endl;
824 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
825 m2dip(splitInfo.kinematics()->m2Dip),
826 m2RadBef(splitInfo.kinematics()->m2RadBef),
827 m2Rad(splitInfo.kinematics()->m2RadAft),
828 m2Rec(splitInfo.kinematics()->m2Rec),
829 m2Emt(splitInfo.kinematics()->m2EmtAft);
830 int splitType(splitInfo.type);
838 double chargeFac = gaugeFactor(splitInfo.radBef()->id,
839 splitInfo.recBef()->id);
841 vector <int> in, out;
842 for (
int i=0; i < state.size(); ++i) {
843 if (state[i].isFinal()) out.push_back(state[i].id());
844 if (state[i].mother1() == 1 && state[i].mother2() == 0)
845 in.push_back(state[i].id());
846 if (state[i].mother1() == 2 && state[i].mother2() == 0)
847 in.push_back(state[i].id());
849 out.push_back(900032);
850 bool hasME = pT2 > pow2(settingsPtr->parm(
"Dire:pTminMECs"))
851 && settingsPtr->flag(
"Dire:doMECs") && fsr->weights->hasME(in,out);
852 if (hasME && chargeFac < 0.0) chargeFac = abs(chargeFac);
854 double preFac = symmetryFactor() * chargeFac;
855 double kappa2 = pT2/m2dip;
856 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
859 bool doMassive = (abs(splitType) == 2);
862 if (!doMassive && orderNow >= 0) wt += -preFac * ( 1.+z );
865 if (doMassive && orderNow >= 0) {
867 double pipj = 0., vijkt = 1., vijk = 1.;
870 if (splitType == 2) {
873 double yCS = kappa2 / (1.-z);
874 double nu2RadBef = m2RadBef/m2dip;
875 double nu2Rad = m2Rad/m2dip;
876 double nu2Emt = m2Emt/m2dip;
877 double nu2Rec = m2Rec/m2dip;
878 vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
879 double Q2mass = m2dip + m2Rad + m2Rec + m2Emt;
880 vijkt = pow2(Q2mass/m2dip - nu2RadBef - nu2Rec)
881 - 4.*nu2RadBef*nu2Rec;
882 vijk = sqrt(vijk) / (1-yCS);
883 vijkt = sqrt(vijkt)/ (Q2mass/m2dip - nu2RadBef - nu2Rec);
884 pipj = m2dip * yCS/2.;
886 }
else if (splitType ==-2) {
889 double xCS = 1 - kappa2/(1.-z);
892 pipj = m2dip/2. * (1-xCS)/xCS;
896 double massCorr = -1.*vijkt/vijk*( 1. + z + m2RadBef/pipj);
897 wt += preFac*massCorr;
901 if (orderNow < 0 && chargeFac < 0.) wt = 0.;
908 unordered_map<string,double> wts;
909 wts.insert( make_pair(
"base", wt ));
912 if (settingsPtr->parm(
"Variations:muRfsrDown") != 1.)
913 wts.insert( make_pair(
"Variations:muRfsrDown", wt ));
914 if (settingsPtr->parm(
"Variations:muRfsrUp") != 1.)
915 wts.insert( make_pair(
"Variations:muRfsrUp", wt ));
920 for ( unordered_map<string,double>::iterator it = wts.begin();
921 it != wts.end(); ++it )
922 kernelVals.insert(make_pair( it->first, it->second ));
935 bool Dire_isr_u1new_Q2QA::canRadiate (
const Event& state, pair<int,int> ints,
936 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
937 return (!state[ints.first].isFinal()
938 && state[ints.first].isQuark()
939 && state[ints.second].isCharged()
940 && bools[
"doQEDshowerByQ"] );
943 bool Dire_isr_u1new_Q2QA::canRadiate (
const Event& state,
int iRadBef,
944 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
945 return (!state[iRadBef].isFinal()
946 && state[iRadBef].isQuark()
947 && state[iRecBef].isCharged()
948 && doU1NEWshowerByQ);
951 int Dire_isr_u1new_Q2QA::kinMap() {
return 1;}
952 int Dire_isr_u1new_Q2QA::motherID(
int idDaughter) {
return idDaughter;}
953 int Dire_isr_u1new_Q2QA::sisterID(
int) {
return 900032;}
955 double Dire_isr_u1new_Q2QA::gaugeFactor (
int idRadBef,
int idRecBef) {
956 double chgRad = particleDataPtr->charge(idRadBef);
957 double chgRec = particleDataPtr->charge(idRecBef);
958 double charge = -1.*chgRad*chgRec;
959 if (!splitInfo.radBef()->isFinal) charge *= -1.;
960 if (!splitInfo.recBef()->isFinal) charge *= -1.;
961 if (idRadBef != 0 && idRecBef != 0)
return charge;
966 double Dire_isr_u1new_Q2QA::symmetryFactor (
int,
int ) {
return 1.;}
968 int Dire_isr_u1new_Q2QA::radBefID(
int idRad,
int idEmt) {
969 if (particleDataPtr->isQuark(idRad) && idEmt == 900032 )
return idRad;
973 pair<int,int> Dire_isr_u1new_Q2QA::radBefCols(
int colRadAfter,
974 int acolRadAfter,
int,
int) {
975 bool isQuark = (colRadAfter > 0);
976 if (isQuark)
return make_pair(colRadAfter,0);
977 return make_pair(0,acolRadAfter);
980 vector<int>Dire_isr_u1new_Q2QA::recPositions(
const Event& state,
int iRad,
984 if ( state[iRad].isFinal() || !state[iRad].isQuark()
985 || state[iEmt].
id() != 900032)
return recs;
988 vector<int> iExc(createvector<int>(iRad)(iEmt));
990 for (
int i=0; i < state.size(); ++i) {
991 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
992 if ( state[i].isCharged() && state[i].isQuark()) {
993 if (state[i].isFinal())
995 if (state[i].mother1() == 1 && state[i].mother2() == 0)
997 if (state[i].mother1() == 2 && state[i].mother2() == 0)
1007 double Dire_isr_u1new_Q2QA::zSplit(
double zMinAbs,
double,
double m2dip) {
1008 double Rz = rndmPtr->flat();
1009 double kappa2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgQ"))/m2dip;
1010 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
1011 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
1016 double Dire_isr_u1new_Q2QA::overestimateInt(
double zMinAbs,
double,
1017 double,
double m2dip,
int) {
1019 double preFac = symmetryFactor() * abs(gaugeFactor(splitInfo.radBef()->id,
1020 splitInfo.recBef()->id));
1021 double kappa2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgQ"))/m2dip;
1022 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
1028 double Dire_isr_u1new_Q2QA::overestimateDiff(
double z,
double m2dip,
int) {
1030 double preFac = symmetryFactor() * abs(gaugeFactor(splitInfo.radBef()->id,
1031 splitInfo.recBef()->id));
1032 double kappaOld2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgQ"))/m2dip;
1033 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
1038 bool Dire_isr_u1new_Q2QA::calc(
const Event& state,
int orderNow) {
1041 if (
false) cout << state[0].e() << orderNow << endl;
1044 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
1045 m2dip(splitInfo.kinematics()->m2Dip);
1049 double chargeFac = gaugeFactor(splitInfo.radBef()->id,
1050 splitInfo.recBef()->id);
1051 vector <int> in, out;
1052 for (
int i=0; i < state.size(); ++i) {
1053 if (state[i].isFinal()) out.push_back(state[i].id());
1054 if (state[i].mother1() == 1 && state[i].mother2() == 0)
1055 in.push_back(state[i].id());
1056 if (state[i].mother1() == 2 && state[i].mother2() == 0)
1057 in.push_back(state[i].id());
1059 out.push_back(900032);
1060 bool hasME = pT2 > pow2(settingsPtr->parm(
"Dire:pTminMECs"))
1061 && settingsPtr->flag(
"Dire:doMECs") && isr->weights->hasME(in,out);
1062 if (hasME && chargeFac < 0.0) chargeFac = abs(chargeFac);
1064 double preFac = symmetryFactor() * chargeFac;
1065 double kappa2 = pT2/m2dip;
1066 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
1067 if (orderNow >= 0) wt += -preFac * (1.+z);
1068 if (orderNow < 0 && chargeFac < 0.) wt = 0.;
1071 unordered_map<string,double> wts;
1072 wts.insert( make_pair(
"base", wt ));
1075 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1076 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1077 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1078 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1083 for ( unordered_map<string,double>::iterator it = wts.begin();
1084 it != wts.end(); ++it )
1085 kernelVals.insert(make_pair( it->first, it->second ));
1098 bool Dire_isr_u1new_A2QQ::canRadiate (
const Event& state, pair<int,int> ints,
1099 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1100 return (!state[ints.first].isFinal()
1101 && state[ints.first].isQuark()
1102 && bools[
"doQEDshowerByQ"] );
1105 bool Dire_isr_u1new_A2QQ::canRadiate (
const Event& state,
int iRadBef,
1106 int, Settings*, PartonSystems*, BeamParticle*){
1107 return (!state[iRadBef].isFinal()
1108 && state[iRadBef].isQuark()
1109 && doU1NEWshowerByQ);
1112 int Dire_isr_u1new_A2QQ::kinMap() {
return 1;}
1113 int Dire_isr_u1new_A2QQ::motherID(
int) {
return 900032;}
1114 int Dire_isr_u1new_A2QQ::sisterID(
int idDaughter) {
return -idDaughter;}
1115 double Dire_isr_u1new_A2QQ::gaugeFactor (
int,
int ) {
return 1.;}
1116 double Dire_isr_u1new_A2QQ::symmetryFactor (
int,
int ) {
return 1.;}
1118 int Dire_isr_u1new_A2QQ::radBefID(
int,
int idEA){
return -idEA;}
1119 pair<int,int> Dire_isr_u1new_A2QQ::radBefCols(
int,
int,
int colEmtAfter,
1121 if ( acolEmtAfter > 0 )
return make_pair(acolEmtAfter,0);
1122 return make_pair(0, colEmtAfter);
1126 double Dire_isr_u1new_A2QQ::zSplit(
double zMinAbs,
double zMaxAbs,
double) {
1129 double res = zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs);
1134 double Dire_isr_u1new_A2QQ::overestimateInt(
double zMinAbs,
double zMaxAbs,
1135 double,
double,
int) {
1137 double preFac = symmetryFactor() * gaugeFactor();
1140 wt = enhance * preFac
1141 * 2. * ( zMaxAbs - zMinAbs);
1146 double Dire_isr_u1new_A2QQ::overestimateDiff(
double,
double,
int) {
1148 double preFac = symmetryFactor() * gaugeFactor();
1151 wt = enhance * preFac
1157 bool Dire_isr_u1new_A2QQ::calc(
const Event& state,
int orderNow) {
1160 if (
false) cout << state[0].e() << orderNow << endl;
1163 double z(splitInfo.kinematics()->z);
1166 double preFac = symmetryFactor() * gaugeFactor();
1167 wt = preFac * (pow(1.-z,2.) + pow(z,2.));
1169 if (orderNow >= 0) wt = 0.;
1172 unordered_map<string,double> wts;
1173 wts.insert( make_pair(
"base", wt ));
1176 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1177 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1178 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1179 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1184 for ( unordered_map<string,double>::iterator it = wts.begin();
1185 it != wts.end(); ++it )
1186 kernelVals.insert(make_pair( it->first, it->second ));
1199 bool Dire_isr_u1new_Q2AQ::canRadiate (
const Event& state, pair<int,int> ints,
1200 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1201 return (!state[ints.first].isFinal()
1202 && state[ints.first].id() == 900032
1203 && bools[
"doQEDshowerByQ"] );
1206 bool Dire_isr_u1new_Q2AQ::canRadiate (
const Event& state,
int iRadBef,
1207 int, Settings*, PartonSystems*, BeamParticle*){
1208 return (!state[iRadBef].isFinal()
1209 && state[iRadBef].
id() == 900032
1210 && doU1NEWshowerByQ);
1213 int Dire_isr_u1new_Q2AQ::kinMap() {
return 1;}
1214 int Dire_isr_u1new_Q2AQ::motherID(
int) {
return 1;}
1215 int Dire_isr_u1new_Q2AQ::sisterID(
int) {
return 1;}
1216 double Dire_isr_u1new_Q2AQ::gaugeFactor (
int,
int ) {
return 1.;}
1217 double Dire_isr_u1new_Q2AQ::symmetryFactor (
int,
int ) {
return 0.5;}
1219 int Dire_isr_u1new_Q2AQ::radBefID(
int,
int){
return 900032;}
1220 pair<int,int> Dire_isr_u1new_Q2AQ::radBefCols(
int,
int,
int,
int) {
1221 return make_pair(0,0); }
1224 double Dire_isr_u1new_Q2AQ::zSplit(
double zMinAbs,
double,
double) {
1225 double R = rndmPtr->flat();
1226 double res = pow(zMinAbs,3./4.)
1227 / ( pow(1. + R*(-1. + pow(zMinAbs,-3./8.)),2./3.)
1228 *pow(R - (-1. + R)*pow(zMinAbs,3./8.),2.));
1233 double Dire_isr_u1new_Q2AQ::overestimateInt(
double zMinAbs,
double,
1234 double,
double,
int) {
1236 double preFac = symmetryFactor() * gaugeFactor();
1237 wt = enhance * preFac * 2./3. * (8.*(-1. + pow(zMinAbs,-3./8.)));
1242 double Dire_isr_u1new_Q2AQ::overestimateDiff(
double z,
double,
int) {
1244 double preFac = symmetryFactor() * gaugeFactor();
1245 wt = enhance * preFac * 2. / pow(z,11./8.);
1250 bool Dire_isr_u1new_Q2AQ::calc(
const Event& state,
int orderNow) {
1253 if (
false) cout << state[0].e() << orderNow << endl;
1256 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
1257 m2dip(splitInfo.kinematics()->m2Dip),
1258 m2Rec(splitInfo.kinematics()->m2Rec);
1259 int splitType(splitInfo.type);
1262 double preFac = symmetryFactor() * gaugeFactor();
1263 double kappa2 = pT2 / m2dip;
1264 wt = preFac * 2.*z / (pow2(z)+kappa2);
1266 if (orderNow >= 0) wt += preFac*(z-2);
1269 bool doMassive = ( m2Rec > 0. && splitType == 2);
1271 if (doMassive && orderNow >= 0) {
1273 double uCS = kappa2 / (1-z);
1275 double massCorr = -2. * m2Rec / m2dip * uCS / (1.-uCS);
1277 wt += preFac * massCorr;
1282 unordered_map<string,double> wts;
1283 wts.insert( make_pair(
"base", wt ));
1286 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1287 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1288 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1289 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1294 for ( unordered_map<string,double>::iterator it = wts.begin();
1295 it != wts.end(); ++it )
1296 kernelVals.insert(make_pair( it->first, it->second ));
1309 bool Dire_isr_u1new_L2LA::canRadiate (
const Event& state, pair<int,int> ints,
1310 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1311 return (!state[ints.first].isFinal()
1312 && (state[ints.first].isLepton() || state[ints.first].idAbs() == 900012
1313 || state[ints.first].idAbs() == 900040)
1314 && (state[ints.second].isLepton() || state[ints.second].idAbs() == 900012
1315 || state[ints.second].idAbs() == 900040)
1316 && bools[
"doQEDshowerByL"]);
1319 bool Dire_isr_u1new_L2LA::canRadiate (
const Event& state,
int iRadBef,
1320 int iRecBef, Settings*, PartonSystems*, BeamParticle*){
1321 return (!state[iRadBef].isFinal()
1322 && (state[iRadBef].isLepton() || state[iRadBef].idAbs() == 900012
1323 || state[iRadBef].idAbs() == 900040)
1324 && (state[iRecBef].isLepton() || state[iRecBef].idAbs() == 900012
1325 || state[iRecBef].idAbs() == 900040)
1326 && doU1NEWshowerByL);
1329 int Dire_isr_u1new_L2LA::kinMap() {
return 1;}
1330 int Dire_isr_u1new_L2LA::motherID(
int idDaughter) {
return idDaughter;}
1331 int Dire_isr_u1new_L2LA::sisterID(
int) {
return 900032;}
1333 double Dire_isr_u1new_L2LA::gaugeFactor (
int idRadBef,
int idRecBef) {
1334 double chgRad = particleDataPtr->charge(idRadBef);
1335 double chgRec = particleDataPtr->charge(idRecBef);
1336 double charge = -1.*chgRad*chgRec;
1337 if (!splitInfo.radBef()->isFinal) charge *= -1.;
1338 if (!splitInfo.recBef()->isFinal) charge *= -1.;
1339 if (idRadBef != 0 && idRecBef != 0)
return charge;
1344 double Dire_isr_u1new_L2LA::symmetryFactor (
int,
int ) {
return 1.;}
1346 int Dire_isr_u1new_L2LA::radBefID(
int idRad,
int idEmt) {
1347 if ( (particleDataPtr->isLepton(idRad) || abs(idRad) == 900012)
1348 && idEmt == 900032 )
return idRad;
1353 pair<int,int> Dire_isr_u1new_L2LA::radBefCols(
int colRadAfter,
1354 int acolRadAfter,
int,
int) {
1355 bool isQuark = (colRadAfter > 0);
1356 if (isQuark)
return make_pair(colRadAfter,0);
1357 return make_pair(0,acolRadAfter);
1360 vector<int>Dire_isr_u1new_L2LA::recPositions(
const Event& state,
int iRad,
1364 if ( state[iRad].isFinal()
1365 || !(state[iRad].isLepton() || state[iRad].idAbs() == 900012)
1366 || state[iEmt].
id() != 900032)
return recs;
1369 vector<int> iExc(createvector<int>(iRad)(iEmt));
1371 for (
int i=0; i < state.size(); ++i) {
1372 if ( find(iExc.begin(), iExc.end(), i) != iExc.end() )
continue;
1373 if ( state[i].isLepton() || state[i].idAbs() == 900012) {
1374 if (state[i].isFinal())
1376 if (state[i].mother1() == 1 && state[i].mother2() == 0)
1378 if (state[i].mother1() == 2 && state[i].mother2() == 0)
1388 double Dire_isr_u1new_L2LA::zSplit(
double zMinAbs,
double,
double m2dip) {
1389 double Rz = rndmPtr->flat();
1390 double kappa2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgL"))/m2dip;
1391 double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
1392 double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
1397 double Dire_isr_u1new_L2LA::overestimateInt(
double zMinAbs,
double,
1398 double,
double m2dip,
int) {
1400 double preFac = symmetryFactor() * abs(gaugeFactor(splitInfo.radBef()->id,
1401 splitInfo.recBef()->id));
1402 double kappa2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgL"))/m2dip;
1403 wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
1408 double Dire_isr_u1new_L2LA::overestimateDiff(
double z,
double m2dip,
int) {
1410 double preFac = symmetryFactor() * abs(gaugeFactor(splitInfo.radBef()->id,
1411 splitInfo.recBef()->id));
1412 double kappaOld2 = pow2(settingsPtr->parm(
"SpaceShower:pTminChgL"))/m2dip;
1413 wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
1418 bool Dire_isr_u1new_L2LA::calc(
const Event& state,
int orderNow) {
1421 if (
false) cout << state[0].e() << orderNow << endl;
1424 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
1425 m2dip(splitInfo.kinematics()->m2Dip);
1429 double chargeFac = gaugeFactor(splitInfo.radBef()->id,
1430 splitInfo.recBef()->id);
1431 vector <int> in, out;
1432 for (
int i=0; i < state.size(); ++i) {
1433 if (state[i].isFinal()) out.push_back(state[i].id());
1434 if (state[i].mother1() == 1 && state[i].mother2() == 0)
1435 in.push_back(state[i].id());
1436 if (state[i].mother1() == 2 && state[i].mother2() == 0)
1437 in.push_back(state[i].id());
1439 out.push_back(900032);
1440 bool hasME = pT2 > pow2(settingsPtr->parm(
"Dire:pTminMECs"))
1441 && settingsPtr->flag(
"Dire:doMECs") && isr->weights->hasME(in,out);
1442 if (hasME && chargeFac < 0.0) chargeFac = abs(chargeFac);
1444 double preFac = symmetryFactor() * chargeFac;
1445 double kappa2 = pT2/m2dip;
1446 wt = preFac * ( 2.* (1.-z) / ( pow2(1.-z) + kappa2) );
1447 if (orderNow >= 0) wt += -preFac * (1.+z);
1450 unordered_map<string,double> wts;
1451 wts.insert( make_pair(
"base", wt ));
1454 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1455 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1456 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1457 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1462 for ( unordered_map<string,double>::iterator it = wts.begin();
1463 it != wts.end(); ++it )
1464 kernelVals.insert(make_pair( it->first, it->second ));
1477 bool Dire_isr_u1new_A2LL::canRadiate (
const Event& state, pair<int,int> ints,
1478 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1479 return (!state[ints.first].isFinal()
1480 && state[ints.first].isLepton() && state[ints.first].isCharged()
1481 && bools[
"doQEDshowerByL"]);
1484 bool Dire_isr_u1new_A2LL::canRadiate (
const Event& state,
int iRadBef,
1485 int, Settings*, PartonSystems*, BeamParticle*){
1486 return (!state[iRadBef].isFinal()
1487 && state[iRadBef].isLepton()
1488 && state[iRadBef].isCharged()
1489 && doU1NEWshowerByL);
1492 int Dire_isr_u1new_A2LL::kinMap() {
return 1;}
1493 int Dire_isr_u1new_A2LL::motherID(
int) {
return 900032;}
1494 int Dire_isr_u1new_A2LL::sisterID(
int idDaughter) {
return -idDaughter;}
1495 double Dire_isr_u1new_A2LL::gaugeFactor (
int,
int ) {
return 1.;}
1496 double Dire_isr_u1new_A2LL::symmetryFactor (
int,
int ) {
return 1.;}
1498 int Dire_isr_u1new_A2LL::radBefID(
int,
int idEA){
return -idEA;}
1499 pair<int,int> Dire_isr_u1new_A2LL::radBefCols(
int,
int,
int colEmtAfter,
1501 if ( acolEmtAfter > 0 )
return make_pair(acolEmtAfter,0);
1502 return make_pair(0, colEmtAfter);
1506 double Dire_isr_u1new_A2LL::zSplit(
double zMinAbs,
double zMaxAbs,
double) {
1509 double res = zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs);
1514 double Dire_isr_u1new_A2LL::overestimateInt(
double zMinAbs,
double zMaxAbs,
1515 double,
double,
int) {
1517 double preFac = symmetryFactor() * gaugeFactor();
1520 wt = enhance * preFac
1521 * 2. * ( zMaxAbs - zMinAbs);
1526 double Dire_isr_u1new_A2LL::overestimateDiff(
double,
double,
int) {
1528 double preFac = symmetryFactor() * gaugeFactor();
1531 wt = enhance * preFac
1537 bool Dire_isr_u1new_A2LL::calc(
const Event& state,
int orderNow) {
1540 if (
false) cout << state[0].e() << orderNow << endl;
1543 double z(splitInfo.kinematics()->z);
1546 double preFac = symmetryFactor() * gaugeFactor();
1547 wt = preFac * (pow(1.-z,2.) + pow(z,2.));
1549 if (orderNow == -1) wt = 0.0;
1552 unordered_map<string,double> wts;
1553 wts.insert( make_pair(
"base", wt ));
1556 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1557 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1558 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1559 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1564 for ( unordered_map<string,double>::iterator it = wts.begin();
1565 it != wts.end(); ++it )
1566 kernelVals.insert(make_pair( it->first, it->second ));
1579 bool Dire_isr_u1new_L2AL::canRadiate (
const Event& state, pair<int,int> ints,
1580 unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1581 return (!state[ints.first].isFinal()
1582 && state[ints.first].id() == 900032
1583 && bools[
"doQEDshowerByL"]);
1586 bool Dire_isr_u1new_L2AL::canRadiate (
const Event& state,
int iRadBef,
1587 int, Settings*, PartonSystems*, BeamParticle*){
1588 return (!state[iRadBef].isFinal()
1589 && state[iRadBef].
id() == 900032
1590 && doU1NEWshowerByL);
1593 int Dire_isr_u1new_L2AL::kinMap() {
return 1;}
1594 int Dire_isr_u1new_L2AL::motherID(
int) {
return 1;}
1595 int Dire_isr_u1new_L2AL::sisterID(
int) {
return 1;}
1596 double Dire_isr_u1new_L2AL::gaugeFactor (
int,
int ) {
return 1.;}
1597 double Dire_isr_u1new_L2AL::symmetryFactor (
int,
int ) {
return 0.5;}
1599 int Dire_isr_u1new_L2AL::radBefID(
int,
int){
return 900032;}
1600 pair<int,int> Dire_isr_u1new_L2AL::radBefCols(
int,
int,
int,
int) {
1601 return make_pair(0,0); }
1604 double Dire_isr_u1new_L2AL::zSplit(
double zMinAbs,
double,
double) {
1605 double R = rndmPtr->flat();
1606 double res = pow(zMinAbs,3./4.)
1607 / ( pow(1. + R*(-1. + pow(zMinAbs,-3./8.)),2./3.)
1608 *pow(R - (-1. + R)*pow(zMinAbs,3./8.),2.));
1613 double Dire_isr_u1new_L2AL::overestimateInt(
double zMinAbs,
double,
1614 double,
double,
int) {
1616 double preFac = symmetryFactor() * gaugeFactor();
1617 wt = enhance * preFac * 2./3. * (8.*(-1. + pow(zMinAbs,-3./8.)));
1622 double Dire_isr_u1new_L2AL::overestimateDiff(
double z,
double,
int) {
1624 double preFac = symmetryFactor() * gaugeFactor();
1625 wt = enhance * preFac * 2. / pow(z,11./8.);
1630 bool Dire_isr_u1new_L2AL::calc(
const Event& state,
int orderNow) {
1633 if (
false) cout << state[0].e() << orderNow << endl;
1636 double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
1637 m2dip(splitInfo.kinematics()->m2Dip),
1638 m2Rec(splitInfo.kinematics()->m2Rec);
1639 int splitType(splitInfo.type);
1642 double preFac = symmetryFactor() * gaugeFactor();
1643 double kappa2 = pT2 / m2dip;
1644 wt = preFac * 2.*z / (pow2(z)+kappa2);
1646 if (orderNow >= 0) wt += preFac*(z-2.);
1649 bool doMassive = ( m2Rec > 0. && splitType == 2);
1651 if (doMassive && orderNow >= 0) {
1653 double uCS = kappa2 / (1-z);
1655 double massCorr = -2. * m2Rec / m2dip * uCS / (1.-uCS);
1657 wt += preFac * massCorr;
1662 unordered_map<string,double> wts;
1663 wts.insert( make_pair(
"base", wt ));
1666 if (settingsPtr->parm(
"Variations:muRisrDown") != 1.)
1667 wts.insert( make_pair(
"Variations:muRisrDown", wt ));
1668 if (settingsPtr->parm(
"Variations:muRisrUp") != 1.)
1669 wts.insert( make_pair(
"Variations:muRisrUp", wt ));
1674 for ( unordered_map<string,double>::iterator it = wts.begin();
1675 it != wts.end(); ++it )
1676 kernelVals.insert(make_pair( it->first, it->second ));