StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DireSplittingsEW.cc
1 // DireSplitingsEW.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2020 Stefan Prestel, Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Function definitions (not found in the header) for the Dire
7 // electroweak splittings.
8 
9 #include "Pythia8/DireSplittingsEW.h"
10 #include "Pythia8/DireSpace.h"
11 #include "Pythia8/DireTimes.h"
12 #include "Pythia8/DireHistory.h"
13 
14 namespace Pythia8 {
15 
16 //==========================================================================
17 
18 // The SplittingEW class.
19 
20 //--------------------------------------------------------------------------
21 
22 void DireSplittingEW::init() {
23 
24  // Parameters of alphaEM.
25  int alphaEMorder = settingsPtr->mode("SpaceShower:alphaEMorder");
26  // Initialize alphaEM.
27  alphaEM.init( alphaEMorder, settingsPtr);
28 
29  // Z0 and W+- properties needed for gamma/Z0 mixing and weak showers.
30  mZ = particleDataPtr->m0(23);
31  gammaZ = particleDataPtr->mWidth(23);
32  thetaW = 1. / (16. * coupSMPtr->sin2thetaW()
33  * coupSMPtr->cos2thetaW());
34  mW = particleDataPtr->m0(24);
35  gammaW = particleDataPtr->mWidth(24);
36 
37  aem0 = settingsPtr->parm("StandardModel:alphaEM0");
38 
39  enhance = settingsPtr->parm("Enhance:"+ id);
40 
41  doQEDshowerByQ = (is_fsr) ? settingsPtr->flag("TimeShower:QEDshowerByQ")
42  : settingsPtr->flag("SpaceShower:QEDshowerByQ");
43  doQEDshowerByL = (is_fsr) ? settingsPtr->flag("TimeShower:QEDshowerByL")
44  : settingsPtr->flag("SpaceShower:QEDshowerByL");
45 
46 }
47 
48 //--------------------------------------------------------------------------
49 
50 // Function to calculate the correct alphaem/2*Pi value, including
51 // renormalisation scale variations + threshold matching.
52 
53 double DireSplittingEW::aem2Pi( double pT2 ) {
54 
55  double scale = pT2*renormMultFac;
56 
57  // Get alphaEM(k*pT^2) and subtractions.
58  double aemPT2pi = alphaEM.alphaEM(scale) / (2.*M_PI);
59 
60  // Done.
61  return aemPT2pi;
62 
63 }
64 
65 //==========================================================================
66 
67 // Class inheriting from Splitting class.
68 
69 // Splitting function Q->QZ (FSR)
70 
71 // Return true if this kernel should partake in the evolution.
72 bool Dire_fsr_ew_Q2QZ::canRadiate ( const Event& state, pair<int,int> ints,
73  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
74  int nFinPartons(0), nFinQ(0), nFinOther(0);
75  for(int i=0; i < state.size(); ++i) {
76  if (!state[i].isFinal()) continue;
77  if ( state[i].colType() !=0) {
78  nFinPartons++;
79  if ( abs(state[i].colType()) == 1) nFinQ++;
80  } else nFinOther++;
81  }
82  return ( nFinPartons == 2 && nFinQ > 0 && nFinOther == 0
83  && state[ints.first].isFinal()
84  && state[ints.first].isQuark() );
85 }
86 
87 int Dire_fsr_ew_Q2QZ::kinMap() { return 1;}
88 int Dire_fsr_ew_Q2QZ::motherID(int idDaughter) { return idDaughter;}
89 int Dire_fsr_ew_Q2QZ::sisterID(int) { return 23;}
90 double Dire_fsr_ew_Q2QZ::gaugeFactor ( int, int) { return thetaW; }
91 double Dire_fsr_ew_Q2QZ::symmetryFactor ( int, int ) { return 1.;}
92 int Dire_fsr_ew_Q2QZ::radBefID(int idRA, int) { return idRA;}
93 
94 pair<int,int> Dire_fsr_ew_Q2QZ::radBefCols(
95  int colRadAfter, int acolRadAfter,
96  int, int) { return make_pair(colRadAfter,acolRadAfter); }
97 
98 // Pick z for new splitting.
99 double Dire_fsr_ew_Q2QZ::zSplit(double zMinAbs, double, double m2dip) {
100  double Rz = rndmPtr->flat();
101  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
102  double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
103  double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
104  return res;
105 }
106 
107 // New overestimates, z-integrated versions.
108 double Dire_fsr_ew_Q2QZ::overestimateInt(double zMinAbs, double,
109  double, double m2dip, int) {
110  double wt = 0.;
111  double preFac = symmetryFactor() * gaugeFactor();
112  // Q -> QG, soft part (currently also used for collinear part).
113  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
114  wt = preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
115  return wt;
116 }
117 
118 // Return overestimate for new splitting.
119 double Dire_fsr_ew_Q2QZ::overestimateDiff(double z, double m2dip, int) {
120  double wt = 0.;
121  double preFac = symmetryFactor() * gaugeFactor();
122  double kappaOld2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
123  wt = preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
124  return wt;
125 }
126 
127 // Return kernel for new splitting.
128 bool Dire_fsr_ew_Q2QZ::calc(const Event& state, int orderNow) {
129 
130  // Dummy statement to avoid compiler warnings.
131  if (false) cout << state[0].e() << orderNow << endl;
132 
133  // Read all splitting variables.
134  double z(splitInfo.kinematics()->z);
135 
136  double wt = 0.;
137  if ( fsr->weights->hasME(fsr->makeHardEvent(0,state,true)) ) {
138 
139  // Calculate kernel as ratio of matrix elements.
140  Event trialEvent(state);
141  if (splitInfo.recBef()->isFinal)
142  fsr->branch_FF(trialEvent, true, &splitInfo);
143  else
144  fsr->branch_FI(trialEvent, true, &splitInfo);
145 
146  // Calculate kernel as ratio of matrix elements.
147  if ( fsr->weights->hasME(fsr->makeHardEvent(0,trialEvent,true)) ) {
148 
149  // Ensure that histories do not try to access kernel again, thus
150  // potentially producing an infinite loop.
151  splitInfo.addExtra("unitKernel",1.0);
152 
153  // Numerator is just the p p --> j j W matrix element.
154  double wtNum = fsr->weights->getME(trialEvent);
155 
156  // Denominator is sum of all p p --> j j matrix elements.
157  // --> Use History class to produce all p p --> j j phase space points.
158 
159  // Store previous settings.
160  string procSave = settingsPtr->word("Merging:process");
161  int nRequestedSave = settingsPtr->mode("Merging:nRequested");
162 
163  // Reset hard process to p p --> j j
164  string procNow = "pp>jj";
165  settingsPtr->word("Merging:process", procNow);
166  fsr->mergingHooksPtr->hardProcess->clear();
167  fsr->mergingHooksPtr->hardProcess->initOnProcess
168  (procNow, particleDataPtr);
169  fsr->mergingHooksPtr->processSave = procNow;
170 
171  // Denominator is sum of all p p --> j j matrix elements.
172  fsr->mergingHooksPtr->orderHistories(false);
173  Event newProcess( fsr->mergingHooksPtr->bareEvent(
174  fsr->makeHardEvent(0, trialEvent, true), true) );
175 
176  // Get the maximal quark flavour counted as "additional" parton.
177  int nPartons = 0;
178  int nQuarksMerge = settingsPtr->mode("Merging:nQuarksMerge");
179  // Loop through event and count.
180  for(int i=0; i < int(newProcess.size()); ++i)
181  if ( newProcess[i].isFinal()
182  && newProcess[i].colType()!= 0
183  && ( newProcess[i].id() == 21
184  || newProcess[i].idAbs() <= nQuarksMerge))
185  nPartons++;
186  nPartons -= 2;
187 
188  // Set number of requested partons.
189  settingsPtr->mode("Merging:nRequested", nPartons);
190  fsr->mergingHooksPtr->nRequestedSave
191  = settingsPtr->mode("Merging:nRequested");
192 
193  // Store candidates.
194  fsr->mergingHooksPtr->storeHardProcessCandidates( newProcess );
195 
196  // Calculate number of clustering steps
197  int nSteps = 1;
198 
199  // Set dummy process scale.
200  newProcess.scale(0.0);
201  // Generate all histories
202  DireHistory myHistory( nSteps, 0.0, newProcess, DireClustering(),
203  fsr->mergingHooksPtr, (*beamAPtr), (*beamBPtr), particleDataPtr,
204  infoPtr,
205  NULL, fsr, isr, fsr->weights, coupSMPtr, true, true,
206  1.0, 1.0, 1.0, 1.0, 0);
207  // Project histories onto desired branches, e.g. only ordered paths.
208  myHistory.projectOntoDesiredHistories();
209 
210  double wtDen(0.);
211  for ( map<double, DireHistory*>::iterator it =
212  myHistory.goodBranches.begin();
213  it != myHistory.goodBranches.end(); ++it ) {
214  Event psppoint = it->second->state;
215  wtDen += fsr->weights->getME(psppoint);
216  }
217 
218  // Reset all merging settings.
219  settingsPtr->word("Merging:process", procSave);
220  settingsPtr->mode("Merging:nRequested",nRequestedSave);
221  fsr->mergingHooksPtr->nRequestedSave
222  = settingsPtr->mode("Merging:nRequested");
223  fsr->mergingHooksPtr->hardProcess->initOnProcess
224  (procSave, particleDataPtr);
225  fsr->mergingHooksPtr->processSave = procSave;
226  unordered_map<string, double>::iterator it =
227  splitInfo.extras.find("unitKernel");
228  splitInfo.extras.erase(it);
229 
230  // No valid underlying processes means vanishing splitting probability.
231  if (myHistory.goodBranches.size() == 0) { wtNum = 0.; wtDen = 1.; }
232 
233  wt = wtNum/wtDen;
234  }
235  }
236 
237  // Now multiply with z to project out Q->QG,
238  // i.e. the gluon is soft and the quark is identified.
239  wt *= z;
240 
241  // Trivial map of values, since kernel does not depend on coupling.
242  unordered_map<string,double> wts;
243  wts.insert( make_pair("base", wt ));
244  if (doVariations) {
245  // Create muR-variations.
246  if (settingsPtr->parm("Variations:muRfrDown") != 1.)
247  wts.insert( make_pair("Variations:muRfsrDown", wt ));
248  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
249  wts.insert( make_pair("Variations:muRfsrUp", wt ));
250  }
251 
252  // Store kernel values.
253  clearKernels();
254  for ( unordered_map<string,double>::iterator it = wts.begin();
255  it != wts.end(); ++it )
256  kernelVals.insert(make_pair( it->first, it->second ));
257 
258  return true;
259 
260 }
261 
262 //==========================================================================
263 
264 // Class inheriting from Splitting class.
265 
266 // Splitting function Q->ZQ (FSR)
267 
268 // Return true if this kernel should partake in the evolution.
269 bool Dire_fsr_ew_Q2ZQ::canRadiate ( const Event& state, pair<int,int> ints,
270  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
271  int nFinPartons(0), nFinQ(0), nFinOther(0);
272  for(int i=0; i < state.size(); ++i) {
273  if (!state[i].isFinal()) continue;
274  if ( state[i].colType() !=0) {
275  nFinPartons++;
276  if ( abs(state[i].colType()) == 1) nFinQ++;
277  } else nFinOther++;
278  }
279  return ( nFinPartons == 2 && nFinQ > 0 && nFinOther == 0
280  && state[ints.first].isFinal()
281  && state[ints.first].isQuark() );
282 }
283 
284 int Dire_fsr_ew_Q2ZQ::kinMap() { return 1;}
285 int Dire_fsr_ew_Q2ZQ::motherID(int idDaughter) { return idDaughter;}
286 int Dire_fsr_ew_Q2ZQ::sisterID(int) { return 23;}
287 double Dire_fsr_ew_Q2ZQ::gaugeFactor ( int, int) { return thetaW; }
288 double Dire_fsr_ew_Q2ZQ::symmetryFactor ( int, int ) { return 1.;}
289 int Dire_fsr_ew_Q2ZQ::radBefID(int idRA, int) { return idRA;}
290 
291 pair<int,int> Dire_fsr_ew_Q2ZQ::radBefCols( int colRadAfter, int acolRadAfter,
292  int, int) { return make_pair(colRadAfter,acolRadAfter); }
293 
294 // Pick z for new splitting.
295 double Dire_fsr_ew_Q2ZQ::zSplit(double zMinAbs, double, double m2dip) {
296  double Rz = rndmPtr->flat();
297  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
298  double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
299  double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
300  return res;
301 }
302 
303 // New overestimates, z-integrated versions.
304 double Dire_fsr_ew_Q2ZQ::overestimateInt(double zMinAbs, double,
305  double, double m2dip, int) {
306  double wt = 0.;
307  double preFac = symmetryFactor() * gaugeFactor();
308  // Q -> QG, soft part (currently also used for collinear part).
309  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
310  wt = preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
311  return wt;
312 }
313 
314 // Return overestimate for new splitting.
315 double Dire_fsr_ew_Q2ZQ::overestimateDiff(double z, double m2dip, int) {
316  double wt = 0.;
317  double preFac = symmetryFactor() * gaugeFactor();
318  double kappaOld2 = pow2(settingsPtr->parm("TimeShower:pTmin"))/m2dip;
319  wt = preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
320  return wt;
321 }
322 
323 // Return kernel for new splitting.
324 bool Dire_fsr_ew_Q2ZQ::calc(const Event& state, int orderNow) {
325 
326  // Dummy statement to avoid compiler warnings.
327  if (false) cout << state[0].e() << orderNow << endl;
328 
329  // Read all splitting variables.
330  double z(splitInfo.kinematics()->z);
331 
332  double wt = 0.;
333  if ( fsr->weights->hasME(fsr->makeHardEvent(0,state,true)) ) {
334 
335  // Calculate kernel as ratio of matrix elements.
336  Event trialEvent(state);
337  if (splitInfo.recBef()->isFinal)
338  fsr->branch_FF(trialEvent, true, &splitInfo);
339  else
340  fsr->branch_FI(trialEvent, true, &splitInfo);
341 
342  // Calculate kernel as ratio of matrix elements.
343  if ( fsr->weights->hasME(fsr->makeHardEvent(0,trialEvent,true)) ) {
344 
345  // Ensure that histories do not try to access kernel again, thus
346  // potentially producing an infinite loop.
347  splitInfo.addExtra("unitKernel",1.0);
348 
349  // Numerator is just the p p --> j j W matrix element.
350  double wtNum = fsr->weights->getME(trialEvent);
351 
352  // Denominator is sum of all p p --> j j matrix elements.
353  // --> Use History class to produce all p p --> j j phase space points.
354 
355  // Store previous settings.
356  string procSave = settingsPtr->word("Merging:process");
357  int nRequestedSave = settingsPtr->mode("Merging:nRequested");
358 
359  // Reset hard process to p p --> j j
360  string procNow = "pp>jj";
361  settingsPtr->word("Merging:process", procNow);
362  fsr->mergingHooksPtr->hardProcess->clear();
363  fsr->mergingHooksPtr->hardProcess->initOnProcess
364  (procNow, particleDataPtr);
365  fsr->mergingHooksPtr->processSave = procNow;
366 
367  // Denominator is sum of all p p --> j j matrix elements.
368  fsr->mergingHooksPtr->orderHistories(false);
369  Event newProcess( fsr->mergingHooksPtr->bareEvent(
370  fsr->makeHardEvent(0, trialEvent, true), true) );
371 
372  // Get the maximal quark flavour counted as "additional" parton.
373  int nPartons = 0;
374  int nQuarksMerge = settingsPtr->mode("Merging:nQuarksMerge");
375  // Loop through event and count.
376  for(int i=0; i < int(newProcess.size()); ++i)
377  if ( newProcess[i].isFinal()
378  && newProcess[i].colType()!= 0
379  && ( newProcess[i].id() == 21
380  || newProcess[i].idAbs() <= nQuarksMerge))
381  nPartons++;
382  nPartons -= 2;
383 
384  // Set number of requested partons.
385  settingsPtr->mode("Merging:nRequested", nPartons);
386  fsr->mergingHooksPtr->nRequestedSave
387  = settingsPtr->mode("Merging:nRequested");
388 
389  // Store candidates.
390  fsr->mergingHooksPtr->storeHardProcessCandidates( newProcess );
391 
392  // Calculate number of clustering steps
393  int nSteps = 1;
394 
395  // Set dummy process scale.
396  newProcess.scale(0.0);
397  // Generate all histories
398  DireHistory myHistory( nSteps, 0.0, newProcess, DireClustering(),
399  fsr->mergingHooksPtr, (*beamAPtr), (*beamBPtr), particleDataPtr,
400  infoPtr,
401  NULL, fsr, isr, fsr->weights, coupSMPtr, true, true,
402  1.0, 1.0, 1.0, 1.0, 0);
403  // Project histories onto desired branches, e.g. only ordered paths.
404  myHistory.projectOntoDesiredHistories();
405 
406  double wtDen(0.);
407  for ( map<double, DireHistory*>::iterator it =
408  myHistory.goodBranches.begin();
409  it != myHistory.goodBranches.end(); ++it ) {
410  Event psppoint = it->second->state;
411  wtDen += fsr->weights->getME(psppoint);
412  }
413 
414  // Reset all merging settings.
415  settingsPtr->word("Merging:process", procSave);
416  settingsPtr->mode("Merging:nRequested",nRequestedSave);
417  fsr->mergingHooksPtr->nRequestedSave
418  = settingsPtr->mode("Merging:nRequested");
419  fsr->mergingHooksPtr->hardProcess->initOnProcess
420  (procSave, particleDataPtr);
421  fsr->mergingHooksPtr->processSave = procSave;
422 
423  unordered_map<string, double>::iterator it = splitInfo.extras.find
424  ("unitKernel");
425  splitInfo.extras.erase(it);
426 
427  // No valid underlying processes means vanishing splitting probability.
428  if (myHistory.goodBranches.size() == 0) { wtNum = 0.; wtDen = 1.; }
429 
430  wt = wtNum/wtDen;
431  }
432  }
433 
434  // Now multiply with (1-z) to project out Q->GQ,
435  // i.e. the quark is soft and the gluon is identified.
436  wt *= ( 1. - z );
437 
438  // Trivial map of values, since kernel does not depend on coupling.
439  unordered_map<string,double> wts;
440  wts.insert( make_pair("base", wt ));
441  if (doVariations) {
442  // Create muR-variations.
443  if (settingsPtr->parm("Variations:muRfrDown") != 1.)
444  wts.insert( make_pair("Variations:muRfsrDown", wt ));
445  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
446  wts.insert( make_pair("Variations:muRfsrUp", wt ));
447  }
448 
449  // Store kernel values.
450  clearKernels();
451  for ( unordered_map<string,double>::iterator it = wts.begin();
452  it != wts.end(); ++it )
453  kernelVals.insert(make_pair( it->first, it->second ));
454 
455  return true;
456 
457 }
458 
459 //==========================================================================
460 // Class inheriting from Splitting class.
461 
462 // Splitting function Z->QQ (FSR)
463 
464 // Return true if this kernel should partake in the evolution.
465 bool Dire_fsr_ew_Z2QQ1::canRadiate ( const Event& state, pair<int,int> ints,
466  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
467  return ( state[ints.first].isFinal()
468  && state[ints.first].idAbs() == 23 );
469 }
470 
471 int Dire_fsr_ew_Z2QQ1::kinMap() { return 1;}
472 int Dire_fsr_ew_Z2QQ1::motherID(int) { return 1;}
473 int Dire_fsr_ew_Z2QQ1::sisterID(int) { return 1;}
474 double Dire_fsr_ew_Z2QQ1::gaugeFactor ( int, int ) { return 1.;}
475 double Dire_fsr_ew_Z2QQ1::symmetryFactor ( int, int ) { return 1.0;}
476 
477 int Dire_fsr_ew_Z2QQ1::radBefID(int, int) { return 23;}
478 pair<int,int> Dire_fsr_ew_Z2QQ1::radBefCols( int, int, int, int)
479  { return make_pair(0,0); }
480 
481 // Pick z for new splitting.
482 double Dire_fsr_ew_Z2QQ1::zSplit(double zMinAbs, double zMaxAbs, double) {
483  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
484 }
485 
486 // New overestimates, z-integrated versions.
487 double Dire_fsr_ew_Z2QQ1::overestimateInt(double zMinAbs,double zMaxAbs,
488  double, double, int) {
489  double wt = 0.;
490  double preFac = symmetryFactor() * gaugeFactor();
491  wt = 2.*preFac * 0.5 * ( zMaxAbs - zMinAbs);
492  return wt;
493 }
494 
495 // Return overestimate for new splitting.
496 double Dire_fsr_ew_Z2QQ1::overestimateDiff(double, double, int) {
497  double wt = 0.;
498  double preFac = symmetryFactor() * gaugeFactor();
499  wt = 2.*preFac * 0.5;
500  return wt;
501 }
502 
503 // Return kernel for new splitting.
504 bool Dire_fsr_ew_Z2QQ1::calc(const Event& state, int orderNow) {
505 
506  // Dummy statement to avoid compiler warnings.
507  if (false) cout << state[0].e() << orderNow << endl;
508 
509  // Read all splitting variables.
510  double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
511  m2dip(splitInfo.kinematics()->m2Dip),
512  m2Rad(splitInfo.kinematics()->m2RadAft),
513  m2Rec(splitInfo.kinematics()->m2Rec),
514  m2Emt(splitInfo.kinematics()->m2EmtAft);
515  int splitType(splitInfo.type);
516 
517  double wt = 0.;
518  double preFac = symmetryFactor() * gaugeFactor();
519  double kappa2 = pT2/m2dip;
520  wt = preFac
521  * (pow(1.-z,2.) + pow(z,2.));
522 
523  // Correction for massive splittings.
524  bool doMassive = (abs(splitType) == 2);
525 
526  if (doMassive) {
527 
528  double vijk = 1., pipj = 0.;
529 
530  // splitType == 2 -> Massive FF
531  if (splitType == 2) {
532  // Calculate CS variables.
533  double yCS = kappa2 / (1.-z);
534  double nu2Rad = m2Rad/m2dip;
535  double nu2Emt = m2Emt/m2dip;
536  double nu2Rec = m2Rec/m2dip;
537  vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
538  vijk = sqrt(vijk) / (1-yCS);
539  pipj = m2dip * yCS /2.;
540 
541  // splitType ==-2 -> Massive FI
542  } else if (splitType ==-2) {
543  // Calculate CS variables.
544  double xCS = 1 - kappa2/(1.-z);
545  vijk = 1.;
546  pipj = m2dip/2. * (1-xCS)/xCS;
547  }
548 
549  // Reset kernel for massive splittings.
550  wt = preFac * 1. / vijk * ( pow2(1.-z) + pow2(z)
551  + m2Emt / ( pipj + m2Emt) );
552  }
553 
554  // Multiply with z to project out part where emitted quark is soft,
555  // and antiquark is identified.
556  wt *= z;
557 
558  // Trivial map of values, since kernel does not depend on coupling.
559  unordered_map<string,double> wts;
560  wts.insert( make_pair("base", wt ));
561  if (doVariations) {
562  // Create muR-variations.
563  if (settingsPtr->parm("Variations:muRfrDown") != 1.)
564  wts.insert( make_pair("Variations:muRfsrDown", wt ));
565  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
566  wts.insert( make_pair("Variations:muRfsrUp", wt ));
567  }
568 
569  // Store kernel values.
570  clearKernels();
571  for ( unordered_map<string,double>::iterator it = wts.begin();
572  it != wts.end(); ++it )
573  kernelVals.insert(make_pair( it->first, it->second ));
574 
575  return true;
576 
577 }
578 
579 //==========================================================================
580 
581 // Class inheriting from Splitting class.
582 
583 // Splitting function G->QQ (FSR)
584 
585 // Return true if this kernel should partake in the evolution.
586 bool Dire_fsr_ew_Z2QQ2::canRadiate ( const Event& state, pair<int,int> ints,
587  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
588  return ( state[ints.first].isFinal()
589  && state[ints.first].idAbs() == 23 );
590 }
591 
592 int Dire_fsr_ew_Z2QQ2::kinMap() { return 1;}
593 int Dire_fsr_ew_Z2QQ2::motherID(int) { return -1;}
594 int Dire_fsr_ew_Z2QQ2::sisterID(int) { return -1;}
595 double Dire_fsr_ew_Z2QQ2::gaugeFactor ( int, int ) { return 1.;}
596 double Dire_fsr_ew_Z2QQ2::symmetryFactor ( int, int ) { return 1.0;}
597 
598 int Dire_fsr_ew_Z2QQ2::radBefID(int, int){ return 23;}
599 pair<int,int> Dire_fsr_ew_Z2QQ2::radBefCols( int, int, int, int)
600  { return make_pair(0,0); }
601 
602 // Pick z for new splitting.
603 double Dire_fsr_ew_Z2QQ2::zSplit(double zMinAbs, double zMaxAbs, double) {
604  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
605 }
606 
607 // New overestimates, z-integrated versions.
608 double Dire_fsr_ew_Z2QQ2::overestimateInt(double zMinAbs,double zMaxAbs,
609  double pT2old, double, int) {
610  double wt = 0.;
611  double preFac = symmetryFactor() * gaugeFactor();
612  double m2z = particleDataPtr->m0(23);
613  wt = 2.* preFac * 0.5 * ( zMaxAbs - zMinAbs)
614  / ( pT2old - m2z);
615  return wt;
616 }
617 
618 // Return overestimate for new splitting.
619 double Dire_fsr_ew_Z2QQ2::overestimateDiff(double, double, int) {
620  double wt = 0.;
621  double preFac = symmetryFactor() * gaugeFactor();
622  wt = 2.*preFac * 0.5;
623  return wt;
624 }
625 
626 // Return kernel for new splitting.
627 bool Dire_fsr_ew_Z2QQ2::calc(const Event& state, int orderNow) {
628 
629  // Dummy statement to avoid compiler warnings.
630  if (false) cout << state[0].e() << orderNow << endl;
631 
632  // Read all splitting variables.
633  double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
634  m2dip(splitInfo.kinematics()->m2Dip),
635  m2Rad(splitInfo.kinematics()->m2RadAft),
636  m2Rec(splitInfo.kinematics()->m2Rec),
637  m2Emt(splitInfo.kinematics()->m2EmtAft);
638  int splitType(splitInfo.type);
639 
640  double wt = 0.;
641  double preFac = symmetryFactor() * gaugeFactor();
642  double kappa2 = pT2/m2dip;
643  wt = preFac
644  * (pow(1.-z,2.) + pow(z,2.));
645 
646  // Correction for massive splittings.
647  bool doMassive = (abs(splitType) == 2);
648 
649  if (doMassive) {
650 
651  double vijk = 1., pipj = 0.;
652 
653  // splitType == 2 -> Massive FF
654  if (splitType == 2) {
655  // Calculate CS variables.
656  double yCS = kappa2 / (1.-z);
657  double nu2Rad = m2Rad/m2dip;
658  double nu2Emt = m2Emt/m2dip;
659  double nu2Rec = m2Rec/m2dip;
660  vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
661  vijk = sqrt(vijk) / (1-yCS);
662  pipj = m2dip * yCS /2.;
663 
664  // splitType ==-2 -> Massive FI
665  } else if (splitType ==-2) {
666  // Calculate CS variables.
667  double xCS = 1 - kappa2/(1.-z);
668  vijk = 1.;
669  pipj = m2dip/2. * (1-xCS)/xCS;
670  }
671 
672  // Reset kernel for massive splittings.
673  wt = preFac * 1. / vijk * ( pow2(1.-z) + pow2(z)
674  + m2Emt / ( pipj + m2Emt) );
675  }
676 
677  // and quark is identified.
678  wt *= (1.-z);
679 
680  // Trivial map of values, since kernel does not depend on coupling.
681  unordered_map<string,double> wts;
682  wts.insert( make_pair("base", wt ));
683  if (doVariations) {
684  // Create muR-variations.
685  if (settingsPtr->parm("Variations:muRfrDown") != 1.)
686  wts.insert( make_pair("Variations:muRfsrDown", wt ));
687  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
688  wts.insert( make_pair("Variations:muRfsrUp", wt ));
689  }
690 
691  // Store kernel values.
692  clearKernels();
693  for ( unordered_map<string,double>::iterator it = wts.begin();
694  it != wts.end(); ++it )
695  kernelVals.insert(make_pair( it->first, it->second ));
696 
697  return true;
698 
699 }
700 
701 //==========================================================================
702 // Class inheriting from Splitting class.
703 
704 // Splitting function G->QQ (FSR)
705 
706 // Return true if this kernel should partake in the evolution.
707 bool Dire_fsr_ew_W2QQ1::canRadiate ( const Event& state, pair<int,int> ints,
708  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
709  return ( state[ints.first].isFinal()
710  && state[ints.first].idAbs() == 24 );
711 }
712 
713 int Dire_fsr_ew_W2QQ1::kinMap() { return 1;}
714 int Dire_fsr_ew_W2QQ1::motherID(int) { return 1;} // Use 1 as dummy variable.
715 int Dire_fsr_ew_W2QQ1::sisterID(int) { return 1;} // Use 1 as dummy variable.
716 double Dire_fsr_ew_W2QQ1::gaugeFactor ( int, int ) { return 1.;}
717 double Dire_fsr_ew_W2QQ1::symmetryFactor ( int, int ) { return 1.0;}
718 
719 int Dire_fsr_ew_W2QQ1::radBefID(int idRad, int idEmt) {
720  int chg = particleDataPtr->charge(idRad) + particleDataPtr->charge(idEmt);
721  if (chg > 0) return 24;
722  return -24;
723 }
724 
725 pair<int,int> Dire_fsr_ew_W2QQ1::radBefCols( int, int, int, int)
726  { return make_pair(0,0); }
727 
728 // Pick z for new splitting.
729 double Dire_fsr_ew_W2QQ1::zSplit(double zMinAbs, double zMaxAbs, double) {
730  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
731 }
732 
733 // New overestimates, z-integrated versions.
734 double Dire_fsr_ew_W2QQ1::overestimateInt(double zMinAbs,double zMaxAbs,
735  double, double, int) {
736  double wt = 0.;
737  double preFac = symmetryFactor() * gaugeFactor();
738  wt = 2.*preFac * 0.5 * ( zMaxAbs - zMinAbs);
739  return wt;
740 }
741 
742 // Return overestimate for new splitting.
743 double Dire_fsr_ew_W2QQ1::overestimateDiff(double, double, int) {
744  double wt = 0.;
745  double preFac = symmetryFactor() * gaugeFactor();
746  wt = 2.*preFac * 0.5;
747  return wt;
748 }
749 
750 // Return kernel for new splitting.
751 bool Dire_fsr_ew_W2QQ1::calc(const Event& state, int orderNow) {
752 
753  // Dummy statement to avoid compiler warnings.
754  if (false) cout << state[0].e() << orderNow << endl;
755 
756  // Read all splitting variables.
757  double z(splitInfo.kinematics()->z);
758 
759  double wt = 0.;
760  double preFac = symmetryFactor() * gaugeFactor();
761  wt = preFac
762  * (pow(1.-z,2.) + pow(z,2.));
763 
764  // Multiply with z to project out part where emitted quark is soft,
765  // and antiquark is identified.
766  wt *= z;
767 
768  // Trivial map of values, since kernel does not depend on coupling.
769  unordered_map<string,double> wts;
770  wts.insert( make_pair("base", wt ));
771  if (doVariations) {
772  // Create muR-variations.
773  if (settingsPtr->parm("Variations:muRfrDown") != 1.)
774  wts.insert( make_pair("Variations:muRfsrDown", wt ));
775  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
776  wts.insert( make_pair("Variations:muRfsrUp", wt ));
777  }
778 
779  // Store kernel values.
780  clearKernels();
781  for ( unordered_map<string,double>::iterator it = wts.begin();
782  it != wts.end(); ++it )
783  kernelVals.insert(make_pair( it->first, it->second ));
784 
785  return true;
786 
787 }
788 
789 //==========================================================================
790 
791 // Class inheriting from Splitting class.
792 
793 // Splitting function G->QQ (FSR)
794 
795 // Return true if this kernel should partake in the evolution.
796 bool Dire_fsr_ew_H2AA::canRadiate ( const Event& state, pair<int,int> ints,
797  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
798  return ( state[ints.first].isFinal()
799  && state[ints.first].idAbs() == 25 );
800 }
801 
802 int Dire_fsr_ew_H2AA::couplingType (int, int) { return 2; }
803 double Dire_fsr_ew_H2AA::coupling (double, double, double, double,
804  pair<int,bool>, pair<int,bool>) {
805  return widthToAA;
806 }
807 
808 bool Dire_fsr_ew_H2AA::canRadiate ( const Event& state, int iRadBef,
809  int, Settings*, PartonSystems*, BeamParticle*){
810  return ( state[iRadBef].isFinal() && state[iRadBef].id() == 25);
811 }
812 
813 int Dire_fsr_ew_H2AA::kinMap() { return 1;}
814 int Dire_fsr_ew_H2AA::motherID(int) { return 22;} // Use -1 as dummy variable.
815 int Dire_fsr_ew_H2AA::sisterID(int) { return 22;} // Use -1 as dummy variable.
816 double Dire_fsr_ew_H2AA::gaugeFactor ( int, int ) { return widthToAA;}
817 double Dire_fsr_ew_H2AA::symmetryFactor ( int, int ) { return 1.0;}
818 
819 int Dire_fsr_ew_H2AA::radBefID(int idRA, int idEA){
820  if (idRA == 22 && idEA == 22) return 25;
821  return 0;
822 }
823 
824 pair<int,int> Dire_fsr_ew_H2AA::radBefCols( int, int, int, int)
825  { return make_pair(0,0); }
826 
827 vector<int>Dire_fsr_ew_H2AA::recPositions(const Event& state, int iRad,
828  int iEmt) {
829 
830  vector<int> recs;
831  if ( !state[iRad].isFinal()
832  || state[iRad].id() != 22
833  || state[iEmt].id() != 22) return recs;
834 
835  // Particles to exclude as recoilers.
836  vector<int> iExc(createvector<int>(iRad)(iEmt));
837  // Find charged particles.
838  for (int i=0; i < state.size(); ++i) {
839  if ( find(iExc.begin(), iExc.end(), i) != iExc.end() ) continue;
840  if ( state[i].id() == 21) {
841  if (state[i].isFinal())
842  recs.push_back(i);
843  if (state[i].mother1() == 1 && state[i].mother2() == 0)
844  recs.push_back(i);
845  if (state[i].mother1() == 2 && state[i].mother2() == 0)
846  recs.push_back(i);
847  }
848  }
849  // Done.
850  return recs;
851 
852 }
853 
854 // Pick z for new splitting.
855 double Dire_fsr_ew_H2AA::zSplit(double zMinAbs, double zMaxAbs, double) {
856  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
857 }
858 
859 // New overestimates, z-integrated versions.
860 double Dire_fsr_ew_H2AA::overestimateInt(double zMinAbs,double zMaxAbs,
861  double, double, int) {
862  double wt = 0.;
863  double preFac = symmetryFactor() * gaugeFactor();
864  wt = 2.* preFac * 0.5 * ( zMaxAbs - zMinAbs);
865  return wt;
866 }
867 
868 // Return overestimate for new splitting.
869 double Dire_fsr_ew_H2AA::overestimateDiff(double, double, int) {
870  double wt = 0.;
871  double preFac = symmetryFactor() * gaugeFactor();
872  wt = 2.*preFac * 0.5;
873  return wt;
874 }
875 
876 // Return kernel for new splitting.
877 bool Dire_fsr_ew_H2AA::calc(const Event& state, int orderNow) {
878 
879  // Dummy statement to avoid compiler warnings.
880  if (false) cout << state[0].e() << orderNow << endl;
881  double preFac = symmetryFactor();
882 
883  // Calculate decay width.
884  double sH = splitInfo.radBef()->m2;
885  double mH = sqrt(sH);
886  // Calculate Breit-Wigner
887  double m2Res = pow2(particleDataPtr->m0(25));
888  double widthTotNow = (widthTot > 0.) ? widthTot
889  : particleDataPtr->particleDataEntryPtr(25)->resWidth
890  (25,mH);
891  double sigBW = 8. * M_PI/ ( pow2(sH - m2Res) + pow2(mH * widthTotNow) );
892 
893 
894  // Overall result.
895  double wt = preFac * sigBW * pow2(sH);
896 
897  // Trivial map of values, since kernel does not depend on coupling.
898  unordered_map<string,double> wts;
899  wts.insert( make_pair("base", wt ));
900  if (doVariations) {
901  // Create muR-variations.
902  if (settingsPtr->parm("Variations:muRfsrDown") != 1.)
903  wts.insert( make_pair("Variations:muRfsrDown", wt ));
904  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
905  wts.insert( make_pair("Variations:muRfsrUp", wt ));
906  }
907 
908  // Store kernel values.
909  clearKernels();
910  for ( unordered_map<string,double>::iterator it = wts.begin();
911  it != wts.end(); ++it )
912  kernelVals.insert(make_pair( it->first, it->second ));
913 
914  return true;
915 
916 }
917 
918 //==========================================================================
919 
920 // Class inheriting from Splitting class.
921 
922 // Splitting function G->QQ (FSR)
923 
924 // Return true if this kernel should partake in the evolution.
925 bool Dire_fsr_ew_H2GG::canRadiate ( const Event& state, pair<int,int> ints,
926  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
927  return ( state[ints.first].isFinal()
928  && state[ints.first].idAbs() == 25 );
929 }
930 
931 int Dire_fsr_ew_H2GG::couplingType (int, int) { return 2; }
932 double Dire_fsr_ew_H2GG::coupling (double, double, double, double,
933  pair<int,bool>, pair<int,bool>) {
934  return widthToGG;
935 }
936 
937 bool Dire_fsr_ew_H2GG::canRadiate ( const Event& state, int iRadBef,
938  int, Settings*, PartonSystems*, BeamParticle*){
939  return ( state[iRadBef].isFinal() && state[iRadBef].id() == 25);
940 }
941 
942 int Dire_fsr_ew_H2GG::kinMap() { return 1;}
943 int Dire_fsr_ew_H2GG::motherID(int) { return 21;} // Use -1 as dummy variable.
944 int Dire_fsr_ew_H2GG::sisterID(int) { return 21;} // Use -1 as dummy variable.
945 double Dire_fsr_ew_H2GG::gaugeFactor ( int, int ) { return widthToGG;}
946 double Dire_fsr_ew_H2GG::symmetryFactor ( int, int ) { return 1.0;}
947 
948 int Dire_fsr_ew_H2GG::radBefID(int idRA, int idEA){
949  if (idRA == 21 && idEA == 21) return 25;
950  return 0;
951 }
952 
953 pair<int,int> Dire_fsr_ew_H2GG::radBefCols( int, int, int, int)
954  { return make_pair(0,0); }
955 
956 vector<int>Dire_fsr_ew_H2GG::recPositions(const Event& state, int iRad,
957  int iEmt) {
958 
959  vector<int> recs;
960  if ( !state[iRad].isFinal()
961  || state[iRad].id() != 21
962  || state[iEmt].id() != 21
963  || state[iRad].col() != state[iEmt].acol()
964  || state[iRad].acol() != state[iEmt].col()) return recs;
965 
966  // Particles to exclude as recoilers.
967  vector<int> iExc(createvector<int>(iRad)(iEmt));
968  // Find charged particles.
969  for (int i=0; i < state.size(); ++i) {
970  if ( find(iExc.begin(), iExc.end(), i) != iExc.end() ) continue;
971  if ( state[i].id() == 21) {
972  if (state[i].isFinal())
973  recs.push_back(i);
974  if (state[i].mother1() == 1 && state[i].mother2() == 0)
975  recs.push_back(i);
976  if (state[i].mother1() == 2 && state[i].mother2() == 0)
977  recs.push_back(i);
978  }
979  }
980  // Done.
981  return recs;
982 
983 }
984 
985 // Pick z for new splitting.
986 double Dire_fsr_ew_H2GG::zSplit(double zMinAbs, double zMaxAbs, double) {
987  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
988 }
989 
990 // New overestimates, z-integrated versions.
991 double Dire_fsr_ew_H2GG::overestimateInt(double zMinAbs,double zMaxAbs,
992  double, double, int) {
993  double wt = 0.;
994  double preFac = symmetryFactor() * gaugeFactor();
995  wt = 2.* preFac * 0.5 * ( zMaxAbs - zMinAbs);
996  return wt;
997 }
998 
999 // Return overestimate for new splitting.
1000 double Dire_fsr_ew_H2GG::overestimateDiff(double, double, int) {
1001  double wt = 0.;
1002  double preFac = symmetryFactor() * gaugeFactor();
1003  wt = 2.*preFac * 0.5;
1004  return wt;
1005 }
1006 
1007 // Return kernel for new splitting.
1008 bool Dire_fsr_ew_H2GG::calc(const Event& state, int orderNow) {
1009 
1010  // Dummy statement to avoid compiler warnings.
1011  if (false) cout << state[0].e() << orderNow << endl;
1012 
1013  double preFac = symmetryFactor();
1014  // Calculate decay width.
1015  double sH = splitInfo.radBef()->m2;
1016  double mH = sqrt(sH);
1017  // Calculate Breit-Wigner
1018  double m2Res = pow2(particleDataPtr->m0(25));
1019  double widthTotNow = (widthTot > 0.) ? widthTot
1020  : particleDataPtr->particleDataEntryPtr(25)->resWidth
1021  (25,mH);
1022  double sigBW = 8. * M_PI/ ( pow2(sH - m2Res) + pow2(mH * widthTotNow) );
1023 
1024  // Overall result.
1025  double wt = preFac * sigBW * pow2(sH);
1026 
1027  // Trivial map of values, since kernel does not depend on coupling.
1028  unordered_map<string,double> wts;
1029  wts.insert( make_pair("base", wt ));
1030  if (doVariations) {
1031  // Create muR-variations.
1032  if (settingsPtr->parm("Variations:muRfsrDown") != 1.)
1033  wts.insert( make_pair("Variations:muRfsrDown", wt ));
1034  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
1035  wts.insert( make_pair("Variations:muRfsrUp", wt ));
1036  }
1037 
1038  // Store kernel values.
1039  clearKernels();
1040  for ( unordered_map<string,double>::iterator it = wts.begin();
1041  it != wts.end(); ++it )
1042  kernelVals.insert(make_pair( it->first, it->second ));
1043 
1044  return true;
1045 
1046 }
1047 
1048 
1049 //==========================================================================
1050 
1051 // Class inheriting from Splitting class.
1052 
1053 // Splitting function G->QQ (FSR)
1054 
1055 // Return true if this kernel should partake in the evolution.
1056 bool Dire_fsr_ew_H2WW::canRadiate ( const Event& state, pair<int,int> ints,
1057  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
1058  return ( state[ints.first].isFinal()
1059  && state[ints.first].idAbs() == 25 );
1060 }
1061 
1062 int Dire_fsr_ew_H2WW::kinMap() { return 1;}
1063 int Dire_fsr_ew_H2WW::motherID(int) { return 24;} // Use -1 as dummy variable.
1064 int Dire_fsr_ew_H2WW::sisterID(int) { return 24;} // Use -1 as dummy variable.
1065 double Dire_fsr_ew_H2WW::gaugeFactor ( int, int ) { return 1.;}
1066 double Dire_fsr_ew_H2WW::symmetryFactor ( int, int ) { return 1.0;}
1067 
1068 int Dire_fsr_ew_H2WW::radBefID(int, int) { return 25; }
1069 
1070 pair<int,int> Dire_fsr_ew_H2WW::radBefCols( int, int, int, int)
1071  { return make_pair(0,0); }
1072 
1073 // Pick z for new splitting.
1074 double Dire_fsr_ew_H2WW::zSplit(double zMinAbs, double zMaxAbs, double) {
1075  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
1076 }
1077 
1078 // New overestimates, z-integrated versions.
1079 double Dire_fsr_ew_H2WW::overestimateInt(double zMinAbs,double zMaxAbs,
1080  double, double, int) {
1081  double wt = 0.;
1082  double preFac = symmetryFactor() * gaugeFactor();
1083  wt = 2.* preFac * 0.5 * ( zMaxAbs - zMinAbs);
1084  return wt;
1085 }
1086 
1087 // Return overestimate for new splitting.
1088 double Dire_fsr_ew_H2WW::overestimateDiff(double, double, int) {
1089  double wt = 0.;
1090  double preFac = symmetryFactor() * gaugeFactor();
1091  wt = 2.*preFac * 0.5;
1092  return wt;
1093 }
1094 
1095 // Return kernel for new splitting.
1096 bool Dire_fsr_ew_H2WW::calc(const Event& state, int orderNow) {
1097 
1098  // Dummy statement to avoid compiler warnings.
1099  if (false) cout << state[0].e() << orderNow << endl;
1100 
1101  Event trialEvent(state);
1102  if (splitInfo.recBef()->isFinal)
1103  fsr->branch_FF(trialEvent, true, &splitInfo);
1104  else
1105  fsr->branch_FI(trialEvent, true, &splitInfo);
1106 
1107  Vec4 pW1(trialEvent[trialEvent.size()-3].p());
1108  Vec4 pW2(trialEvent[trialEvent.size()-2].p());
1109  Vec4 pRec(trialEvent[trialEvent.size()-1].p());
1110 
1111  // Perform resonance decays.
1112  double m2Bef = pW1.m2Calc();
1113  double m2Emt = 0.0;
1114  double m2Rad = 0.0;
1115  double m2Rec = 0.0;
1116  double yCS = (m2Bef - m2Emt - m2Rad)
1117  / (m2Bef - m2Emt - m2Rad + 2.*pW1*pRec);
1118  double zCS = rndmPtr->flat();
1119  double phi = 2.*M_PI*rndmPtr->flat();
1120  pair < Vec4, Vec4 > decayW1( fsr->decayWithOnshellRec( zCS, yCS, phi, m2Rec,
1121  m2Rad, m2Emt, pW1, pRec) );
1122 
1123  m2Bef = pW2.m2Calc();
1124  m2Emt = 0.0;
1125  m2Rad = 0.0;
1126  m2Rec = 0.0;
1127  yCS = (m2Bef - m2Emt - m2Rad) / (m2Bef - m2Emt - m2Rad + 2.*pW2*pRec);
1128  zCS = rndmPtr->flat();
1129  phi = 2.*M_PI*rndmPtr->flat();
1130  pair < Vec4, Vec4 > decayW2( fsr->decayWithOnshellRec( zCS, yCS, phi, m2Rec,
1131  m2Rad, m2Emt, pW2, pRec) );
1132 
1133  if (false) cout << decayW1.first << decayW1.second
1134  << decayW2.first << decayW2.second;
1135 
1136  double wt = 0.;
1137  // Trivial map of values, since kernel does not depend on coupling.
1138  unordered_map<string,double> wts;
1139  wts.insert( make_pair("base", wt ));
1140  if (doVariations) {
1141  // Create muR-variations.
1142  if (settingsPtr->parm("Variations:muRfsrDown") != 1.)
1143  wts.insert( make_pair("Variations:muRfsrDown", wt ));
1144  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
1145  wts.insert( make_pair("Variations:muRfsrUp", wt ));
1146  }
1147 
1148  // Store kernel values.
1149  clearKernels();
1150  for ( unordered_map<string,double>::iterator it = wts.begin();
1151  it != wts.end(); ++it )
1152  kernelVals.insert(make_pair( it->first, it->second ));
1153 
1154  return true;
1155 
1156 }
1157 
1158 //==========================================================================
1159 
1160 // Class inheriting from Splitting class.
1161 
1162 // Splitting function G->QQ (FSR)
1163 
1164 // Return true if this kernel should partake in the evolution.
1165 bool Dire_fsr_ew_W2QQ2::canRadiate ( const Event& state, pair<int,int> ints,
1166  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*){
1167  return ( state[ints.first].isFinal()
1168  && state[ints.first].idAbs() == 24 );
1169 }
1170 
1171 int Dire_fsr_ew_W2QQ2::kinMap() { return 1;}
1172 int Dire_fsr_ew_W2QQ2::motherID(int) { return -1;} // Use -1 as dummy variable.
1173 int Dire_fsr_ew_W2QQ2::sisterID(int) { return -1;} // Use -1 as dummy variable.
1174 double Dire_fsr_ew_W2QQ2::gaugeFactor ( int, int ) { return 1.;}
1175 double Dire_fsr_ew_W2QQ2::symmetryFactor ( int, int ) { return 1.0;}
1176 
1177 int Dire_fsr_ew_W2QQ2::radBefID(int idRad, int idEmt) {
1178  int chg = particleDataPtr->charge(idRad) + particleDataPtr->charge(idEmt);
1179  if (chg > 0) return 24;
1180  return -24;
1181 }
1182 
1183 pair<int,int> Dire_fsr_ew_W2QQ2::radBefCols( int, int, int, int)
1184  { return make_pair(0,0); }
1185 
1186 // Pick z for new splitting.
1187 double Dire_fsr_ew_W2QQ2::zSplit(double zMinAbs, double zMaxAbs, double) {
1188  return (zMinAbs + rndmPtr->flat() * (zMaxAbs - zMinAbs));
1189 }
1190 
1191 // New overestimates, z-integrated versions.
1192 double Dire_fsr_ew_W2QQ2::overestimateInt(double zMinAbs,double zMaxAbs,
1193  double pT2old, double, int) {
1194  double wt = 0.;
1195  double preFac = symmetryFactor() * gaugeFactor();
1196  double m2z = particleDataPtr->m0(23);
1197  wt = 2.* preFac * 0.5 * ( zMaxAbs - zMinAbs)
1198  / ( pT2old - m2z);
1199  return wt;
1200 }
1201 
1202 // Return overestimate for new splitting.
1203 double Dire_fsr_ew_W2QQ2::overestimateDiff(double, double, int) {
1204  double wt = 0.;
1205  double preFac = symmetryFactor() * gaugeFactor();
1206  wt = 2.*preFac * 0.5;
1207  return wt;
1208 }
1209 
1210 // Return kernel for new splitting.
1211 bool Dire_fsr_ew_W2QQ2::calc(const Event& state, int orderNow) {
1212 
1213  // Dummy statement to avoid compiler warnings.
1214  if (false) cout << state[0].e() << orderNow << endl;
1215 
1216  // Read all splitting variables.
1217  double z(splitInfo.kinematics()->z);
1218 
1219  double wt = 0.;
1220  double preFac = symmetryFactor() * gaugeFactor();
1221  wt = preFac
1222  * (pow(1.-z,2.) + pow(z,2.));
1223 
1224  // and quark is identified.
1225  wt *= (1.-z);
1226 
1227  // Trivial map of values, since kernel does not depend on coupling.
1228  unordered_map<string,double> wts;
1229  wts.insert( make_pair("base", wt ));
1230  if (doVariations) {
1231  // Create muR-variations.
1232  if (settingsPtr->parm("Variations:muRfsrDown") != 1.)
1233  wts.insert( make_pair("Variations:muRfsrDown", wt ));
1234  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
1235  wts.insert( make_pair("Variations:muRfsrUp", wt ));
1236  }
1237 
1238  // Store kernel values.
1239  clearKernels();
1240  for ( unordered_map<string,double>::iterator it = wts.begin();
1241  it != wts.end(); ++it )
1242  kernelVals.insert(make_pair( it->first, it->second ));
1243 
1244  return true;
1245 
1246 }
1247 
1248 //==========================================================================
1249 
1250 // Return true if this kernel should partake in the evolution.
1251 bool Dire_fsr_ew_W2WA::canRadiate ( const Event& state, pair<int,int> ints,
1252  unordered_map<string,bool> bools, Settings*, PartonSystems*, BeamParticle*){
1253  return ( state[ints.first].isFinal()
1254  && state[ints.first].idAbs() == 24
1255  && state[ints.second].isCharged()
1256  && (bools["doQEDshowerByL"] || bools["doQEDshowerByQ"]));
1257 }
1258 
1259 bool Dire_fsr_ew_W2WA::canRadiate ( const Event& state, int iRadBef,
1260  int iRecBef, Settings*, PartonSystems*, BeamParticle*){
1261  return ( state[iRadBef].isFinal()
1262  && state[iRadBef].idAbs() == 24
1263  && state[iRecBef].isCharged()
1264  && (doQEDshowerByL || doQEDshowerByQ));
1265 }
1266 
1267 int Dire_fsr_ew_W2WA::kinMap() { return 1;}
1268 int Dire_fsr_ew_W2WA::motherID(int idDaughter) { return idDaughter;}
1269 int Dire_fsr_ew_W2WA::sisterID(int) { return 22;}
1270 
1271 double Dire_fsr_ew_W2WA::gaugeFactor ( int idRadBef, int idRecBef) {
1272  double chgRad = particleDataPtr->charge(idRadBef);
1273  double chgRec = particleDataPtr->charge(idRecBef);
1274  double charge = -1.*chgRad*chgRec;
1275  if (!splitInfo.radBef()->isFinal) charge *= -1.;
1276  if (!splitInfo.recBef()->isFinal) charge *= -1.;
1277  if (idRadBef != 0 && idRecBef != 0) return charge;
1278  // Set probability to zero.
1279  return 0.;
1280 }
1281 
1282 double Dire_fsr_ew_W2WA::symmetryFactor ( int, int ) { return 1.;}
1283 
1284 int Dire_fsr_ew_W2WA::radBefID(int idRad, int idEmt) {
1285  if (idEmt == 22 && abs(idRad) == 24) return idRad;
1286  return 0;
1287 }
1288 
1289 pair<int,int> Dire_fsr_ew_W2WA::radBefCols(int, int, int, int) {
1290  return make_pair(0,0);
1291 }
1292 
1293 vector<int>Dire_fsr_ew_W2WA::recPositions(const Event&, int, int) {
1294  // Not yet implemented.
1295  vector<int> recs;
1296  return recs;
1297 }
1298 
1299 // Pick z for new splitting.
1300 double Dire_fsr_ew_W2WA::zSplit(double zMinAbs, double, double m2dip) {
1301  double Rz = rndmPtr->flat();
1302  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTminChgL"))/m2dip;
1303  double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
1304  double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
1305  return res;
1306 }
1307 
1308 // New overestimates, z-integrated versions.
1309 double Dire_fsr_ew_W2WA::overestimateInt(double zMinAbs, double,
1310  double, double m2dip, int) {
1311  double wt = 0.;
1312  double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
1313  double preFac = symmetryFactor() * abs(charge);
1314  // Q -> QG, soft part (currently also used for collinear part).
1315  double kappa2 = pow2(settingsPtr->parm("TimeShower:pTminChgL"))/m2dip;
1316  wt = enhance * preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
1317  return wt;
1318 }
1319 
1320 // Return overestimate for new splitting.
1321 double Dire_fsr_ew_W2WA::overestimateDiff(double z, double m2dip, int) {
1322  double wt = 0.;
1323  double charge = gaugeFactor(splitInfo.radBef()->id, splitInfo.recBef()->id);
1324  double preFac = symmetryFactor() * abs(charge);
1325  double kappaOld2 = pow2(settingsPtr->parm("TimeShower:pTminChgL"))/m2dip;
1326  wt = enhance * preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
1327  return wt;
1328 }
1329 
1330 // Return kernel for new splitting.
1331 bool Dire_fsr_ew_W2WA::calc(const Event& state, int orderNow) {
1332 
1333  // Dummy statement to avoid compiler warnings.
1334  if (false) cout << state[0].e() << orderNow << endl;
1335 
1336  // Read all splitting variables.
1337  double z(splitInfo.kinematics()->z), pT2(splitInfo.kinematics()->pT2),
1338  m2dip(splitInfo.kinematics()->m2Dip),
1339  m2RadBef(splitInfo.kinematics()->m2RadBef),
1340  m2Rad(splitInfo.kinematics()->m2RadAft),
1341  m2Rec(splitInfo.kinematics()->m2Rec),
1342  m2Emt(splitInfo.kinematics()->m2EmtAft);
1343  int splitType(splitInfo.type);
1344 
1345  // Calculate kernel.
1346  // Note: We are calculating the z <--> 1-z symmetrised kernel here,
1347  // and later multiply with z to project out Q->QQ,
1348  // i.e. the gluon is soft and the quark is identified.
1349  double wt = 0.;
1350 
1351  double chargeFac = gaugeFactor(splitInfo.radBef()->id,
1352  splitInfo.recBef()->id);
1353  double preFac = symmetryFactor() * chargeFac;
1354  double kappa2 = pT2/m2dip;
1355  wt = preFac * ( 2. * z * (1.-z) / ( pow2(1.-z) + kappa2) );
1356 
1357  // Correction for massive splittings.
1358  bool doMassive = (abs(splitType) == 2);
1359 
1360  // Add collinear term for massless splittings.
1361  if (!doMassive && orderNow >= 0) wt += preFac * ( 1.-z );
1362 
1363  // Add collinear term for massive splittings.
1364  if (doMassive && orderNow >= 0) {
1365 
1366  double pipj = 0., vijkt = 1., vijk = 1.;
1367 
1368  // splitType == 2 -> Massive FF
1369  if (splitType == 2) {
1370 
1371  // Calculate CS variables.
1372  double yCS = kappa2 / (1.-z);
1373  double nu2RadBef = m2RadBef/m2dip;
1374  double nu2Rad = m2Rad/m2dip;
1375  double nu2Emt = m2Emt/m2dip;
1376  double nu2Rec = m2Rec/m2dip;
1377  vijk = pow2(1.-yCS) - 4.*(yCS+nu2Rad+nu2Emt)*nu2Rec;
1378  double Q2mass = m2dip + m2Rad + m2Rec + m2Emt;
1379  vijkt = pow2(Q2mass/m2dip - nu2RadBef - nu2Rec)
1380  - 4.*nu2RadBef*nu2Rec;
1381  vijk = sqrt(vijk) / (1-yCS);
1382  vijkt = sqrt(vijkt)/ (Q2mass/m2dip - nu2RadBef - nu2Rec);
1383  pipj = m2dip * yCS/2.;
1384  // splitType ==-2 -> Massive FI
1385  } else if (splitType ==-2) {
1386 
1387  // Calculate CS variables.
1388  double xCS = 1 - kappa2/(1.-z);
1389  vijk = 1.;
1390  vijkt = 1.;
1391  pipj = m2dip/2. * (1-xCS)/xCS;
1392  }
1393 
1394  // Add B1 for massive splittings.
1395  double massCorr = vijkt/vijk*( 1. - z - m2RadBef/pipj);
1396  wt += preFac*massCorr;
1397 
1398  }
1399 
1400  if (orderNow < 0 && chargeFac < 0.) wt = 0.;
1401 
1402  // Trivial map of values, since kernel does not depend on coupling.
1403  unordered_map<string,double> wts;
1404  wts.insert( make_pair("base", wt ));
1405  if (doVariations) {
1406  // Create muR-variations.
1407  if (settingsPtr->parm("Variations:muRfsrDown") != 1.)
1408  wts.insert( make_pair("Variations:muRfsrDown", wt ));
1409  if (settingsPtr->parm("Variations:muRfsrUp") != 1.)
1410  wts.insert( make_pair("Variations:muRfsrUp", wt ));
1411  }
1412 
1413  // Store kernel values.
1414  clearKernels();
1415  for ( unordered_map<string,double>::iterator it = wts.begin();
1416  it != wts.end(); ++it )
1417  kernelVals.insert(make_pair( it->first, it->second ));
1418 
1419  return true;
1420 
1421 }
1422 
1423 //==========================================================================
1424 
1425 // Class inheriting from SplittingQCD class.
1426 
1427 // SplittingQCD function Q->QG (ISR)
1428 
1429 // Return true if this kernel should partake in the evolution.
1430 bool Dire_isr_ew_Q2QZ::canRadiate ( const Event& state, pair<int,int> ints,
1431  unordered_map<string,bool>, Settings*, PartonSystems*, BeamParticle*) {
1432  int nFinPartons(0), nFinOther(0);
1433  for(int i=0; i < state.size(); ++i) {
1434  if (!state[i].isFinal()) continue;
1435  if ( state[i].colType() !=0)
1436  nFinPartons++;
1437  else nFinOther++;
1438  }
1439  return ( nFinPartons == 2 && nFinOther == 0
1440  && !state[ints.first].isFinal()
1441  && state[ints.first].isQuark() );
1442 }
1443 
1444 int Dire_isr_ew_Q2QZ::kinMap() { return 1;}
1445 int Dire_isr_ew_Q2QZ::motherID(int idDaughter) { return idDaughter;}
1446 int Dire_isr_ew_Q2QZ::sisterID(int) { return 23;}
1447 double Dire_isr_ew_Q2QZ::gaugeFactor ( int, int ) { return thetaW;}
1448 double Dire_isr_ew_Q2QZ::symmetryFactor ( int, int ) { return 1.;}
1449 
1450 int Dire_isr_ew_Q2QZ::radBefID(int idRA, int){ return idRA;}
1451 pair<int,int> Dire_isr_ew_Q2QZ::radBefCols(
1452  int colRadAfter, int acolRadAfter,
1453  int , int ) {
1454  return make_pair(colRadAfter,acolRadAfter);
1455 }
1456 
1457 // Pick z for new splitting.
1458 double Dire_isr_ew_Q2QZ::zSplit(double zMinAbs, double, double m2dip) {
1459  double Rz = rndmPtr->flat();
1460  double kappa2 = pow2(settingsPtr->parm("SpaceShower:pTmin"))/m2dip;
1461  double p = pow( 1. + pow2(1-zMinAbs)/kappa2, Rz );
1462  double res = 1. - sqrt( p - 1. )*sqrt(kappa2);
1463  return res;
1464 }
1465 
1466 // New overestimates, z-integrated versions.
1467 double Dire_isr_ew_Q2QZ::overestimateInt(double zMinAbs, double,
1468  double, double m2dip, int ) {
1469  double wt = 0.;
1470  double preFac = symmetryFactor() * gaugeFactor();
1471  double kappa2 = pow2(settingsPtr->parm("SpaceShower:pTmin"))/m2dip;
1472  wt = preFac * 2. * 0.5 * log( 1. + pow2(1.-zMinAbs)/kappa2);
1473  return wt;
1474 }
1475 
1476 // Return overestimate for new splitting.
1477 double Dire_isr_ew_Q2QZ::overestimateDiff(double z, double m2dip, int ) {
1478  double wt = 0.;
1479  double preFac = symmetryFactor() * gaugeFactor();
1480  double kappaOld2 = pow2(settingsPtr->parm("SpaceShower:pTmin"))/m2dip;
1481  wt = preFac * 2.* (1.-z) / ( pow2(1.-z) + kappaOld2);
1482  return wt;
1483 }
1484 
1485 // Return kernel for new splitting.
1486 bool Dire_isr_ew_Q2QZ::calc(const Event& state, int orderNow) {
1487 
1488  // Dummy statement to avoid compiler warnings.
1489  if (false) cout << state[0].e() << orderNow << endl;
1490 
1491  double wt = 0.;
1492  if ( isr->weights->hasME(isr->makeHardEvent(0,state,true)) ) {
1493 
1494  // Calculate kernel as ratio of matrix elements.
1495  Event trialEvent(state);
1496  if (splitInfo.recBef()->isFinal)
1497  isr->branch_IF(trialEvent, true, &splitInfo);
1498  else
1499  isr->branch_II(trialEvent, true, &splitInfo);
1500 
1501  // Calculate kernel as ratio of matrix elements.
1502  if ( isr->weights->hasME(isr->makeHardEvent(0,trialEvent,true)) ) {
1503 
1504  // Ensure that histories do not try to access kernel again, thus
1505  // potentially producing an infinite loop.
1506  splitInfo.addExtra("unitKernel",1.0);
1507 
1508  // Numerator is just the p p --> j j W matrix element.
1509  double wtNum = isr->weights->getME(trialEvent);
1510 
1511  // Denominator is sum of all p p --> j j matrix elements.
1512  // --> Use History class to produce all p p --> j j phase space points.
1513 
1514  // Store previous settings.
1515  string procSave = settingsPtr->word("Merging:process");
1516  int nRequestedSave = settingsPtr->mode("Merging:nRequested");
1517 
1518  // Reset hard process to p p --> j j
1519  string procNow = "pp>jj";
1520  settingsPtr->word("Merging:process", procNow);
1521  isr->mergingHooksPtr->hardProcess->clear();
1522  isr->mergingHooksPtr->hardProcess->
1523  initOnProcess(procNow, particleDataPtr);
1524  isr->mergingHooksPtr->processSave = procNow;
1525 
1526  // Denominator is sum of all p p --> j j matrix elements.
1527  isr->mergingHooksPtr->orderHistories(false);
1528  Event newProcess( isr->mergingHooksPtr->bareEvent(
1529  isr->makeHardEvent(0, trialEvent, true), true) );
1530 
1531  // Get the maximal quark flavour counted as "additional" parton.
1532  int nPartons = 0;
1533  int nQuarksMerge = settingsPtr->mode("Merging:nQuarksMerge");
1534  // Loop through event and count.
1535  for(int i=0; i < int(newProcess.size()); ++i)
1536  if ( newProcess[i].isFinal()
1537  && newProcess[i].colType()!= 0
1538  && ( newProcess[i].id() == 21
1539  || newProcess[i].idAbs() <= nQuarksMerge))
1540  nPartons++;
1541  nPartons -= 2;
1542 
1543  // Set number of requested partons.
1544  settingsPtr->mode("Merging:nRequested", nPartons);
1545  isr->mergingHooksPtr->nRequestedSave
1546  = settingsPtr->mode("Merging:nRequested");
1547 
1548  // Store candidates.
1549  isr->mergingHooksPtr->storeHardProcessCandidates( newProcess );
1550 
1551  // Calculate number of clustering steps
1552  int nSteps = 1;
1553 
1554  // Set dummy process scale.
1555  newProcess.scale(0.0);
1556  // Generate all histories
1557  DireHistory myHistory( nSteps, 0.0, newProcess, DireClustering(),
1558  isr->mergingHooksPtr, (*beamAPtr), (*beamBPtr), particleDataPtr,
1559  infoPtr,
1560  NULL, fsr, isr, isr->weights, coupSMPtr, true, true,
1561  1.0, 1.0, 1.0, 1.0, 0);
1562  // Project histories onto desired branches, e.g. only ordered paths.
1563  myHistory.projectOntoDesiredHistories();
1564 
1565  double wtDen(0.);
1566  for ( map<double, DireHistory*>::iterator it =
1567  myHistory.goodBranches.begin();
1568  it != myHistory.goodBranches.end(); ++it ) {
1569  Event psppoint = it->second->state;
1570  wtDen += isr->weights->getME(psppoint);
1571  }
1572 
1573  // Reset all merging settings.
1574  settingsPtr->word("Merging:process", procSave);
1575  settingsPtr->mode("Merging:nRequested",nRequestedSave);
1576  isr->mergingHooksPtr->nRequestedSave
1577  = settingsPtr->mode("Merging:nRequested");
1578  isr->mergingHooksPtr->hardProcess->initOnProcess
1579  (procSave, particleDataPtr);
1580  isr->mergingHooksPtr->processSave = procSave;
1581 
1582  unordered_map<string, double>::iterator it =
1583  splitInfo.extras.find("unitKernel");
1584  splitInfo.extras.erase(it);
1585 
1586  // No valid underlying processes means vanishing splitting probability.
1587  if (myHistory.goodBranches.size() == 0) { wtNum = 0.; wtDen = 1.; }
1588 
1589  wt = wtNum/wtDen;
1590  }
1591  }
1592 
1593  unordered_map<string,double> wts;
1594  wts.insert( make_pair("base", wt) );
1595 
1596  if (doVariations) {
1597  // Create muR-variations.
1598  if (settingsPtr->parm("Variations:muRisrDown") != 1.)
1599  wts.insert( make_pair("Variations:muRisrDown", wt));
1600  if (settingsPtr->parm("Variations:muRisrUp") != 1.)
1601  wts.insert( make_pair("Variations:muRisrUp", wt));
1602  }
1603 
1604  // Store kernel values.
1605  clearKernels();
1606  for ( unordered_map<string,double>::iterator it = wts.begin();
1607  it != wts.end(); ++it )
1608  kernelVals.insert(make_pair( it->first, it->second ));
1609 
1610  return true;
1611 
1612 }
1613 
1614 //==========================================================================
1615 
1616 
1617 } // end namespace Pythia8
Definition: AgUStep.h:26