StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ProcessContainer.cc
1 // ProcessContainer.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2018 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
7 // ProcessContainer and SetupContainers classes.
8 
9 #include "Pythia8/ProcessContainer.h"
10 
11 // Internal headers for special processes.
12 #include "Pythia8/SigmaCompositeness.h"
13 #include "Pythia8/SigmaEW.h"
14 #include "Pythia8/SigmaExtraDim.h"
15 #include "Pythia8/SigmaGeneric.h"
16 #include "Pythia8/SigmaHiggs.h"
17 #include "Pythia8/SigmaLeftRightSym.h"
18 #include "Pythia8/SigmaLeptoquark.h"
19 #include "Pythia8/SigmaNewGaugeBosons.h"
20 #include "Pythia8/SigmaQCD.h"
21 #include "Pythia8/SigmaSUSY.h"
22 #include "Pythia8/SigmaDM.h"
23 
24 namespace Pythia8 {
25 
26 //==========================================================================
27 
28 // ProcessContainer class.
29 // Information allowing the generation of a specific process.
30 
31 //--------------------------------------------------------------------------
32 
33 // Constants: could be changed here if desired, but normally should not.
34 // These are of technical nature, as described for each.
35 
36 // Number of event tries to check maximization finding reliability.
37 const int ProcessContainer::N12SAMPLE = 100;
38 
39 // Ditto, but increased for 2 -> 3 processes.
40 const int ProcessContainer::N3SAMPLE = 1000;
41 
42 //--------------------------------------------------------------------------
43 
44 // Initialize phase space and counters.
45 // Argument isFirst distinguishes two hard processes in same event.
46 
47 bool ProcessContainer::init(bool isFirst, Info* infoPtrIn,
48  Settings& settings, ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
49  BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn, Couplings* couplingsPtr,
50  SigmaTotal* sigmaTotPtrIn, ResonanceDecays* resDecaysPtrIn,
51  SLHAinterface* slhaInterfacePtr, UserHooks* userHooksPtrIn,
52  GammaKinematics* gammaKinPtrIn) {
53 
54  // Extract info about current process from SigmaProcess object.
55  isLHA = sigmaProcessPtr->isLHA();
56  isNonDiff = sigmaProcessPtr->isNonDiff();
57  isResolved = sigmaProcessPtr->isResolved();
58  isDiffA = sigmaProcessPtr->isDiffA();
59  isDiffB = sigmaProcessPtr->isDiffB();
60  isDiffC = sigmaProcessPtr->isDiffC();
61  isCentralDiff = isDiffC;
62  isDoubleDiff = isDiffA && isDiffB;
63  isSingleDiff = isDiff && !isDoubleDiff && !isCentralDiff;
64  isQCD3body = sigmaProcessPtr->isQCD3body();
65  int nFin = sigmaProcessPtr->nFinal();
66  lhaStrat = (isLHA) ? lhaUpPtr->strategy() : 0;
67  lhaStratAbs = abs(lhaStrat);
68  allowNegSig = sigmaProcessPtr->allowNegativeSigma();
69 
70  // Switch to ensure that the scales set in a LH input event are
71  // respected, even in resonance showers.
72  useStrictLHEFscales = settings.flag("Beams:strictLHEFscale");
73 
74  // Maximal number of events for more in-depth control of
75  // how many events are selected/tried/accepted.
76  nTryRequested = settings.mode("Main:numberOfTriedEvents");
77  nSelRequested = settings.mode("Main:numberOfSelectedEvents");
78  nAccRequested = settings.mode("Main:numberOfAcceptedEvents");
79 
80  // Flag for maximum violation handling.
81  increaseMaximum = settings.flag("PhaseSpace:increaseMaximum");
82 
83  // Store whether beam particle has a photon and save the mode.
84  beamAPtr = beamAPtrIn;
85  beamBPtr = beamBPtrIn;
86  gammaKinPtr = gammaKinPtrIn;
87  beamHasGamma = settings.flag("PDF:lepton2gamma");
88  int gammaMode = settings.mode("Photon:ProcessType");
89  bool resolvedGamma = beamHasGamma && (gammaMode < 2);
90 
91  // Use external photon flux.
92  externalFlux = (settings.mode("PDF:lepton2gammaSet") == 2);
93 
94  // Pick and create phase space generator. Send pointers where required.
95  if (phaseSpacePtr != 0) ;
96  else if (isLHA) phaseSpacePtr = new PhaseSpaceLHA();
97  else if (isNonDiff && !beamHasGamma)
98  phaseSpacePtr = new PhaseSpace2to2nondiffractive();
99  else if (isNonDiff && resolvedGamma)
100  phaseSpacePtr = new PhaseSpace2to2nondiffractiveGamma();
101  else if (!isResolved && !isDiffA && !isDiffB && !isDiffC )
102  phaseSpacePtr = new PhaseSpace2to2elastic();
103  else if (!isResolved && !isDiffA && !isDiffB && isDiffC)
104  phaseSpacePtr = new PhaseSpace2to3diffractive();
105  else if (!isResolved) phaseSpacePtr = new PhaseSpace2to2diffractive(
106  isDiffA, isDiffB);
107  else if (nFin == 1) phaseSpacePtr = new PhaseSpace2to1tauy();
108  else if (nFin == 2) phaseSpacePtr = new PhaseSpace2to2tauyz();
109  else if (isQCD3body) phaseSpacePtr = new PhaseSpace2to3yyycyl();
110  else phaseSpacePtr = new PhaseSpace2to3tauycyl();
111 
112  // Store pointers and perform simple initialization.
113  infoPtr = infoPtrIn;
114  particleDataPtr = particleDataPtrIn;
115  rndmPtr = rndmPtrIn;
116  resDecaysPtr = resDecaysPtrIn;
117  sigmaTotPtr = sigmaTotPtrIn;
118  userHooksPtr = userHooksPtrIn;
119  canVetoResDecay = (userHooksPtr != 0)
120  ? userHooksPtr->canVetoResonanceDecays() : false;
121  if (isLHA) {
122  sigmaProcessPtr->setLHAPtr(lhaUpPtr);
123  phaseSpacePtr->setLHAPtr(lhaUpPtr);
124  }
125  sigmaProcessPtr->init(infoPtr, &settings, particleDataPtr, rndmPtr,
126  beamAPtr, beamBPtr, couplingsPtr, sigmaTotPtr, slhaInterfacePtr);
127 
128  // Store the state of photon beams using inFlux: 0 = not a photon beam;
129  // 1 = resolved photon; 2 = unresolved photon.
130  string inState = sigmaProcessPtr->inFlux();
131  beamAgammaMode = 0;
132  beamBgammaMode = 0;
133  gammaModeEvent = 0;
134  if ( beamAPtr->isGamma() || (beamHasGamma && beamAPtr->isLepton() ) ) {
135  if ( inState == "gmg" || inState == "gmq" || inState == "gmgm" )
136  beamAgammaMode = 2;
137  else if ( !(beamAPtr->isHadron()) ) beamAgammaMode = 1;
138  }
139  if ( beamBPtr->isGamma() || (beamHasGamma && beamBPtr->isLepton() ) ) {
140  if ( inState == "ggm" || inState == "qgm" || inState == "gmgm" )
141  beamBgammaMode = 2;
142  else if ( !(beamBPtr->isHadron()) ) beamBgammaMode = 1;
143  }
144 
145  // Save the photon modes and propagate further.
146  if ( ( beamAPtr->isGamma() || beamBPtr->isGamma() ) || beamHasGamma )
147  setBeamModes();
148 
149  // Save the state of photon beams.
150  beamAhasResGamma = beamAPtr->hasResGamma();
151  beamBhasResGamma = beamBPtr->hasResGamma();
152  beamHasResGamma = beamAhasResGamma || beamBhasResGamma;
153 
154  // Initialize also phaseSpace pointer.
155  phaseSpacePtr->init( isFirst, sigmaProcessPtr, infoPtr, &settings,
156  particleDataPtr, rndmPtr, beamAPtr, beamBPtr, couplingsPtr, sigmaTotPtr,
157  userHooksPtr);
158 
159  // Send the pointer to gammaKinematics for non-diffractive processes.
160  if ( (beamAhasResGamma || beamBhasResGamma) && isNonDiffractive() )
161  phaseSpacePtr->setGammaKinPtr( gammaKinPtr);
162 
163  // Reset cross section statistics.
164  nTry = 0;
165  nSel = 0;
166  nAcc = 0;
167  nTryStat = 0;
168  sigmaMx = 0.;
169  sigmaSum = 0.;
170  sigma2Sum = 0.;
171  sigmaNeg = 0.;
172  sigmaAvg = 0.;
173  sigmaFin = 0.;
174  deltaFin = 0.;
175  wtAccSum = 0.;
176 
177  // Reset temporary cross section summand.
178  sigmaTemp = 0.;
179  sigma2Temp = 0.;
180 
181  // Initialize process and allowed incoming partons.
182  sigmaProcessPtr->initProc();
183  if (!sigmaProcessPtr->initFlux()) return false;
184 
185  // Find maximum of differential cross section * phasespace.
186  bool physical = phaseSpacePtr->setupSampling();
187  sigmaMx = phaseSpacePtr->sigmaMax();
188  double sigmaHalfWay = sigmaMx;
189 
190  // Separate signed maximum needed for LHA with negative weight.
191  sigmaSgn = phaseSpacePtr->sigmaSumSigned();
192 
193  // Check maximum by a few events, and extrapolate a further increase.
194  if (physical & !isLHA) {
195  int nSample = (nFin < 3) ? N12SAMPLE : N3SAMPLE;
196  for (int iSample = 0; iSample < nSample; ++iSample) {
197  bool test = false;
198  while (!test) test = phaseSpacePtr->trialKin(false);
199  if (iSample == nSample/2) sigmaHalfWay = phaseSpacePtr->sigmaMax();
200  }
201  double sigmaFullWay = phaseSpacePtr->sigmaMax();
202  sigmaMx = (sigmaHalfWay > 0.) ? pow2(sigmaFullWay) / sigmaHalfWay
203  : sigmaFullWay;
204  phaseSpacePtr->setSigmaMax(sigmaMx);
205  }
206 
207  // Allow Pythia to overwrite incoming beams or parts of Les Houches input.
208  idRenameBeams = settings.mode("LesHouches:idRenameBeams");
209  setLifetime = settings.mode("LesHouches:setLifetime");
210  setQuarkMass = settings.mode("LesHouches:setQuarkMass");
211  setLeptonMass = settings.mode("LesHouches:setLeptonMass");
212  mRecalculate = settings.parm("LesHouches:mRecalculate");
213  matchInOut = settings.flag("LesHouches:matchInOut");
214  for (int i = 0; i < 6; ++i) idNewM[i] = i;
215  for (int i = 6; i < 9; ++i) idNewM[i] = 2 * i - 1;
216  for (int i = 1; i < 9; ++i) mNewM[i] = particleDataPtr->m0(idNewM[i]);
217 
218  // Done.
219  return physical;
220 }
221 
222 //--------------------------------------------------------------------------
223 
224 // Generate a trial event; selected or not.
225 
226 bool ProcessContainer::trialProcess() {
227 
228  // Weights for photon flux oversampling with external flux.
229  double wtPDF = 1.;
230  double wtFlux = 1.;
231 
232  // For photon beams set PDF pointer to resolved or unresolved.
233  if ( beamAPtr->isGamma() || beamBPtr->isGamma() || beamHasGamma )
234  setBeamModes();
235 
236  // Loop over tries only occurs for Les Houches strategy = +-2.
237  for (int iTry = 0; ; ++iTry) {
238 
239  // Generate a trial phase space point, if meaningful.
240  if (sigmaMx == 0.) return false;
241  infoPtr->setEndOfFile(false);
242  bool repeatSame = (iTry > 0);
243  bool physical = phaseSpacePtr->trialKin(true, repeatSame);
244 
245  // For acceptable kinematics sample also kT for photons from leptons.
246  if ( physical && !isNonDiffractive() && beamHasGamma ) {
247 
248  // Save the x_gamma values for unresolved photons.
249  if ( !beamAhasResGamma ) beamAPtr->xGamma( x1());
250  if ( !beamBhasResGamma ) beamBPtr->xGamma( x2());
251 
252  // Sample the kinematics of virtual photons.
253  if ( !gammaKinPtr->sampleKTgamma() ) physical = false;
254 
255  // Processes with direct photons rescale momenta and cross section.
256  if ( physical && !(beamAhasResGamma && beamBhasResGamma) ) {
257  double sHatNew = gammaKinPtr->calcNewSHat( phaseSpacePtr->sHat() );
258  phaseSpacePtr->rescaleSigma( sHatNew);
259  phaseSpacePtr->rescaleMomenta( sHatNew);
260  }
261 
262  // With external photon flux calculate weight wrt. approximated fluxes.
263  if ( beamHasGamma && externalFlux ) {
264  wtPDF = phaseSpacePtr->weightGammaPDFApprox();
265  wtFlux = gammaKinPtr->fluxWeight();
266  }
267 
268  }
269 
270  // Flag to check if more events should be generated.
271  bool doTryNext = true;
272 
273  // Note if at end of Les Houches file, else do statistics.
274  if (isLHA && !physical) infoPtr->setEndOfFile(true);
275  else {
276 
277  // Check if the number of selected events should be limited.
278  if (nSelRequested > 0) doTryNext = (nTry < nSelRequested);
279 
280  // Only add to counter if event should count towards cross section.
281  if (doTryNext) ++nTry;
282 
283  // Statistics for separate Les Houches process codes. Insert new codes.
284  if (isLHA) {
285  int codeLHANow = lhaUpPtr->idProcess();
286  int iFill = -1;
287  for (int i = 0; i < int(codeLHA.size()); ++i)
288  if (codeLHANow == codeLHA[i]) iFill = i;
289  if (iFill >= 0) {
290  // Only add to counter if event should count towards cross section.
291  if (doTryNext) ++nTryLHA[iFill];
292  } else {
293  codeLHA.push_back(codeLHANow);
294  nTryLHA.push_back(1);
295  nSelLHA.push_back(0);
296  nAccLHA.push_back(0);
297  for (int i = int(codeLHA.size()) - 1; i > 0; --i) {
298  if (codeLHA[i] < codeLHA[i - 1]) {
299  swap(codeLHA[i], codeLHA[i - 1]);
300  swap(nTryLHA[i], nTryLHA[i - 1]);
301  swap(nSelLHA[i], nSelLHA[i - 1]);
302  swap(nAccLHA[i], nAccLHA[i - 1]);
303  }
304  else break;
305  }
306  }
307  }
308  }
309 
310  // Incoming top beams will not be handled, although allowed by LHAPDF.
311  if (isLHA && (abs(lhaUpPtr->id(1)) == 6 || abs(lhaUpPtr->id(2)) == 6)) {
312  infoPtr->errorMsg("Error in ProcessContainer::trialProcess(): top not "
313  "allowed incoming beam parton; event skipped");
314  return false;
315  }
316 
317  // Possibly fail, else cross section.
318  if (!physical) return false;
319  double sigmaNow = phaseSpacePtr->sigmaNow();
320 
321  // For photons with external flux correct the cross section.
322  if (beamHasGamma && externalFlux) sigmaNow *= wtFlux * wtPDF;
323 
324  // Tell if this event comes with weight from cross section.
325  double sigmaWeight = 1.;
326  if (!isLHA && !increaseMaximum && sigmaNow > sigmaMx)
327  sigmaWeight = sigmaNow / sigmaMx;
328  if ( lhaStrat < 0 && sigmaNow < 0.) sigmaWeight = -1.;
329  if ( lhaStratAbs == 4) sigmaWeight = sigmaNow;
330 
331  // Also compensating weight from biased phase-space selection.
332  double biasWeight = phaseSpacePtr->biasSelectionWeight();
333  weightNow = sigmaWeight * biasWeight;
334 
335  // Set event weight to zero if this event should not count.
336  if (!doTryNext) weightNow = 0.0;
337 
338  infoPtr->setWeight( weightNow, lhaStrat);
339 
340  // Check that not negative cross section when not allowed.
341  if (!allowNegSig) {
342  if (sigmaNow < sigmaNeg) {
343  infoPtr->errorMsg("Warning in ProcessContainer::trialProcess: neg"
344  "ative cross section set 0", "for " + sigmaProcessPtr->name() );
345  sigmaNeg = sigmaNow;
346  }
347  if (sigmaNow < 0.) sigmaNow = 0.;
348  }
349 
350  // Cross section of process may come with a weight. Update sum.
351  double sigmaAdd = sigmaNow * biasWeight;
352  if (lhaStratAbs == 2 || lhaStratAbs == 3) sigmaAdd = sigmaSgn;
353 
354  // Do not add event weight to the cross section if it should not count.
355  if (!doTryNext) {
356  sigmaAdd=0.;
357  // Reset stored weight.
358  sigmaTemp = 0.;
359  sigma2Temp = 0.;
360  }
361 
362  // Only update once an event is accepted, as is needed if the event weight
363  // can still change by a finite amount due to reweighting.
364  if (lhaStratAbs >= 3 ) {
365  sigmaTemp = sigmaAdd;
366  sigma2Temp = pow2(sigmaAdd);
367  } else {
368  sigmaTemp += sigmaAdd;
369  sigma2Temp += pow2(sigmaAdd);
370  }
371 
372  // Check if maximum violated.
373  newSigmaMx = phaseSpacePtr->newSigmaMax();
374  if (newSigmaMx) sigmaMx = phaseSpacePtr->sigmaMax();
375 
376  // Select or reject trial point. Statistics.
377  bool select = true;
378  if (lhaStratAbs < 3) select
379  = (newSigmaMx || rndmPtr->flat() * abs(sigmaMx) < abs(sigmaNow));
380  if (select) {
381  // Only add to counter if event should count towards cross section.
382  if (doTryNext) ++nSel;
383 
384  if (isLHA) {
385  int codeLHANow = lhaUpPtr->idProcess();
386  int iFill = -1;
387  for (int i = 0; i < int(codeLHA.size()); ++i)
388  if (codeLHANow == codeLHA[i]) iFill = i;
389  // Only add to counter if event should count towards cross section.
390  if (iFill >= 0 && doTryNext) ++nSelLHA[iFill];
391  }
392  }
393  if (select || lhaStratAbs != 2) return select;
394 
395  }
396 
397 }
398 
399 //--------------------------------------------------------------------------
400 
401 // Accumulate statistics after user veto, including LHA code.
402 
403 void ProcessContainer::accumulate() {
404 
405  // Only update for non-vanishing weight - vanishing weight means
406  // event should not count as accepted.
407  double wgtNow = infoPtr->weight();
408  if (wgtNow != 0.0) {
409 
410  ++nAcc;
411 
412  // infoPtr->weight() performs coversion to pb if lhaStratAbs = 4
413  if (lhaStratAbs == 4) wgtNow /= 1e9;
414 
415  wtAccSum += wgtNow;
416  if (isLHA) {
417  int codeLHANow = lhaUpPtr->idProcess();
418  int iFill = -1;
419  for (int i = 0; i < int(codeLHA.size()); ++i)
420  if (codeLHANow == codeLHA[i]) iFill = i;
421  if (iFill >= 0) ++nAccLHA[iFill];
422  }
423  }
424 
425 }
426 
427 //--------------------------------------------------------------------------
428 
429 // Pick flavours and colour flow of process.
430 
431 bool ProcessContainer::constructState() {
432 
433  // Construct flavour and colours for selected event.
434  if (isResolved && !isNonDiff) sigmaProcessPtr->pickInState();
435  sigmaProcessPtr->setIdColAcol();
436 
437  // Set beam modes correctly for given process.
438  if ( beamAPtr->isResolvedUnresolved() || beamBPtr->isResolvedUnresolved() )
439  setBeamModes();
440 
441  // Done.
442  return true;
443 
444 }
445 
446 //--------------------------------------------------------------------------
447 
448 // Set the photon modes according to the process.
449 
450 void ProcessContainer::setBeamModes() {
451 
452  // Set the modes for the current beams.
453  beamAPtr->setGammaMode(beamAgammaMode);
454  beamBPtr->setGammaMode(beamBgammaMode);
455 
456  // Set the gammaMode for given process.
457  if (beamAgammaMode <= 1 && beamBgammaMode <= 1) gammaModeEvent = 1;
458  else if (beamAgammaMode <= 1 && beamBgammaMode == 2) gammaModeEvent = 2;
459  else if (beamAgammaMode == 2 && beamBgammaMode <= 1) gammaModeEvent = 3;
460  else if (beamAgammaMode == 2 && beamBgammaMode == 2) gammaModeEvent = 4;
461  else gammaModeEvent = 0;
462 
463  // Propagate gammaMode and VMD state to info pointer.
464  infoPtr->setGammaMode(gammaModeEvent);
465  if (gammaModeEvent != 4) {
466  double scale[3] = {0.00331524, 0.00030905, 0.00039639};
467  pair<int, int> idAB = chooseVMDstates(beamAPtr->id(), beamBPtr->id());
468  if (idAB.first == 113 || idAB.first == 223 || idAB.first == 333) {
469  double mA = particleDataPtr->mSel(idAB.first);
470  double scA = scale[idAB.first/100 - 1];
471  beamAPtr->setVMDstate(true, idAB.first, mA, scA, false);
472  infoPtr->setVMDstateA(true, idAB.first, mA, scA);
473  }
474  if (idAB.second == 113 || idAB.second == 223 || idAB.second == 333) {
475  double mB = particleDataPtr->mSel(idAB.second);
476  double scB = scale[idAB.second/100 - 1];
477  beamBPtr->setVMDstate(true, idAB.second, mB, scB, false);
478  infoPtr->setVMDstateB(true, idAB.second, mB, scB);
479  }
480  }
481 
482 }
483 
484 //--------------------------------------------------------------------------
485 
486 // VMD processes: Choose particle.
487 
488 pair<int, int> ProcessContainer::chooseVMDstates( int idA, int idB) {
489 
490  // Constants and initial values.
491  double gammaFac[3] = {2.2, 23.6, 18.4};
492  double alphaEM = 0.00729353;
493  double idVMD[3] = {113, 223, 333};
494  double pVP[3] = {};
495  double pVV[3][3] = {};
496  double pSum = 0.;
497 
498  // gamma-gamma.
499  if (idA == 22 && idB == 22) {
500  for (int i = 0; i < 3; ++i)
501  for (int j = 0; j < 3; ++j) {
502  // Evaluate the cross sections individually.
503  sigmaTotPtr->calc(idVMD[i], idVMD[j], infoPtr->eCM());
504  pVV[i][j] = pow2(alphaEM) / (gammaFac[i] * gammaFac[j]);
505  if (isSingleDiff && isDiffA) pVV[i][j] *= sigmaTotPtr->sigmaXB();
506  else if (isSingleDiff && isDiffB) pVV[i][j] *= sigmaTotPtr->sigmaAX();
507  else if (isDoubleDiff) pVV[i][j] *= sigmaTotPtr->sigmaXX();
508  else return make_pair(idA, idB);
509  pSum += pVV[i][j];
510  }
511  // Choose VMD states based on relative fractions.
512  double pickMode = rndmPtr->flat() * pSum;
513  for (int i = 0; i < 3; ++i)
514  for (int j = 0; j < 3; ++j) {
515  pickMode -= pVV[i][j];
516  if (pickMode < 0.) return make_pair(113 + 110 * i, 113 + 110 * j);
517  }
518  return make_pair(113, 113);
519 
520  // gamma + p.
521  } else if (idA == 22 && idB == 2212) {
522  for (int i = 0; i < 3; ++i) {
523  // Evaluate the cross sections individually.
524  sigmaTotPtr->calc(idVMD[i], 2212, infoPtr->eCM());
525  pVP[i] = alphaEM / gammaFac[i];
526  if (isSingleDiff && isDiffA) pVP[i] *= sigmaTotPtr->sigmaXB();
527  else if (isSingleDiff && isDiffB) pVP[i] *= sigmaTotPtr->sigmaAX();
528  else if (isDoubleDiff) pVP[i] *= sigmaTotPtr->sigmaXX();
529  else return make_pair(idA, idB);
530  pSum += pVP[i];
531  }
532  // Choose VMD state based on relative fractions.
533  double pickMode = rndmPtr->flat() * pSum;
534  if (pickMode > pVP[1] + pVP[2]) return make_pair(113, 2212);
535  else if (pickMode > pVP[2]) return make_pair(223, 2212);
536  else return make_pair(333, 2212);
537 
538  // p + gamma.
539  } else if (idA == 2212 && idB == 22) {
540  for (int i = 0; i < 3; ++i) {
541  // Evaluate the cross sections individually.
542  sigmaTotPtr->calc(2212, idVMD[i], infoPtr->eCM());
543  pVP[i] = alphaEM / gammaFac[i];
544  if (isSingleDiff && isDiffA) pVP[i] *= sigmaTotPtr->sigmaXB();
545  else if (isSingleDiff && isDiffB) pVP[i] *= sigmaTotPtr->sigmaAX();
546  else if (isDoubleDiff) pVP[i] *= sigmaTotPtr->sigmaXX();
547  else return make_pair(idA, idB);
548  pSum += pVP[i];
549  }
550  // Choose VMD state based on relative fractions.
551  double pickMode = rndmPtr->flat() * pSum;
552  if (pickMode > pVP[1] + pVP[2]) return make_pair(2212, 113);
553  else if (pickMode > pVP[2]) return make_pair(2212, 223);
554  else return make_pair(2212, 333);
555 
556  // Do nothing for other beam combinations.
557  } else return make_pair(idA, idB);
558 
559 }
560 
561 //--------------------------------------------------------------------------
562 
563 // Give the hard subprocess with kinematics.
564 
565 bool ProcessContainer::constructProcess( Event& process, bool isHardest) {
566 
567  // Construct kinematics from selected phase space point.
568  if (!phaseSpacePtr->finalKin()) return false;
569  int nFin = sigmaProcessPtr->nFinal();
570 
571  // Basic info on process.
572  if (isHardest) infoPtr->setType( name(), code(), nFin, isNonDiff,
573  isResolved, isDiffA, isDiffB, isDiffC, isLHA);
574 
575  // Save sampled values for further use, requires info stored by setType.
576  if ( beamHasGamma && !isNonDiffractive() ) gammaKinPtr->finalize();
577 
578  // Rescale the momenta again when unresolved photons after finalKin.
579  if ( beamHasGamma && !(beamAhasResGamma && beamBhasResGamma) ) {
580  double sHatNew = infoPtr->sHatNew();
581  phaseSpacePtr->rescaleMomenta( sHatNew);
582  }
583 
584  // Let hard process record begin with the event as a whole and
585  // the two incoming beam particles.
586  int idA = infoPtr->idA();
587  if (abs(idA) == idRenameBeams) idA = 16;
588  int idB = infoPtr->idB();
589  if (abs(idB) == idRenameBeams) idB = -16;
590  process.append( 90, -11, 0, 0, 0, 0, 0, 0,
591  Vec4(0., 0., 0., infoPtr->eCM()), infoPtr->eCM(), 0. );
592  process.append( idA, -12, 0, 0, 0, 0, 0, 0,
593  Vec4(0., 0., infoPtr->pzA(), infoPtr->eA()), infoPtr->mA(), 0. );
594  process.append( idB, -12, 0, 0, 0, 0, 0, 0,
595  Vec4(0., 0., infoPtr->pzB(), infoPtr->eB()), infoPtr->mB(), 0. );
596 
597  // Add intermediate gammas for lepton -> gamma -> parton processes
598  // for both non-diffractive and hard processes, including direct-resolved.
599  // Add a copy of hadron beam when e->gamma + p.
600  int nOffsetGamma = 0;
601  bool isGammaHadronDir = (beamAgammaMode == 2 && beamBgammaMode == 0)
602  || (beamAgammaMode == 0 && beamBgammaMode == 2);
603  if ( beamHasResGamma || (isGammaHadronDir && beamHasGamma) ) {
604  double xGm1 = beamAPtr->xGamma();
605  if ( beamAPtr->isHadron()) {
606  process.append( beamAPtr->id(), -13, 1, 0, 0, 0, 0, 0,
607  Vec4(0., 0., infoPtr->pzA(), infoPtr->eA()), beamAPtr->m(), 0. );
608  } else {
609  process.append( 22, -13, 1, 0, 0, 0, 0, 0,
610  Vec4(0., 0., xGm1*infoPtr->pzA(), xGm1*infoPtr->eA()), 0, 0. );
611  }
612  process[1].daughter1(3);
613  ++nOffsetGamma;
614  double xGm2 = beamBPtr->xGamma();
615  if ( beamBPtr->isHadron()) {
616  process.append( beamBPtr->id(), -13, 2, 0, 0, 0, 0, 0,
617  Vec4(0., 0., infoPtr->pzB(), infoPtr->eB()), beamBPtr->m(), 0. );
618  } else {
619  process.append( 22, -13, 2, 0, 0, 0, 0, 0,
620  Vec4(0., 0., xGm2*infoPtr->pzB(), xGm2*infoPtr->eB()), 0, 0. );
621  }
622  process[1 + nOffsetGamma].daughter1(3 + nOffsetGamma);
623  ++nOffsetGamma;
624  }
625 
626  // For nondiffractive process no interaction selected so far, so done.
627  if (isNonDiff) return true;
628 
629  // Entries 3 and 4, now to be added, come from 1 and 2.
630  // Offset from normal locations possible due to intermediate photons.
631  process[1 + nOffsetGamma].daughter1(3 + nOffsetGamma);
632  process[2 + nOffsetGamma].daughter1(4 + nOffsetGamma);
633  double scale = 0.;
634  double scalup = 0.;
635 
636  // For DiffC entries 3 - 5 come jointly from 1 and 2 (to keep HepMC happy).
637  if (isDiffC) {
638  process[1].daughters(3, 5);
639  process[2].daughters(3, 5);
640  }
641 
642  // Insert the subprocess partons - resolved processes.
643  int idRes = sigmaProcessPtr->idSChannel();
644  if (isResolved && !isLHA) {
645 
646  // NOAM: Mothers and daughters without/with intermediate state.
647  int m_M1 = 3;
648  int m_M2 = 4;
649  int m_D1 = 5;
650  int m_D2 = (nFin == 1) ? 0 : 4 + nFin;
651  if (idRes != 0) {
652  m_M1 = 5;
653  m_M2 = 0;
654  m_D1 = 5;
655  m_D2 = 0;
656  }
657 
658  // Find scale from which to begin MPI/ISR/FSR evolution.
659  scale = sqrt(Q2Fac());
660  process.scale( scale );
661 
662  // Loop over incoming and outgoing partons.
663  int colOffset = process.lastColTag();
664  for (int i = 1; i <= 2 + nFin; ++i) {
665 
666  // Read out particle info from SigmaProcess object.
667  int id = sigmaProcessPtr->id(i);
668  int status = (i <= 2) ? -21 : 23;
669  int mother1 = (i <= 2) ? i : m_M1 ;
670  int mother2 = (i <= 2) ? 0 : m_M2 ;
671  int daughter1 = (i <= 2) ? m_D1 : 0;
672  int daughter2 = (i <= 2) ? m_D2 : 0;
673  int col = sigmaProcessPtr->col(i);
674  if (col > 0) col += colOffset;
675  else if (col < 0) col -= colOffset;
676  int acol = sigmaProcessPtr->acol(i);
677  if (acol > 0) acol += colOffset;
678  else if (acol < 0) acol -= colOffset;
679 
680  // If extra photons in event record, offset the mother/daughter list.
681  if ( beamAhasResGamma || beamBhasResGamma
682  || (beamAgammaMode == 2 && beamBgammaMode == 0)
683  || (beamAgammaMode == 0 && beamBgammaMode == 2) ) {
684  if (mother1 > 0) mother1 += nOffsetGamma;
685  if (mother2 > 0) mother2 += nOffsetGamma;
686  if (daughter1 > 0) daughter1 += nOffsetGamma;
687  if (daughter2 > 0) daughter2 += nOffsetGamma;
688  }
689 
690  // Append to process record.
691  int iNow = process.append( id, status, mother1, mother2,
692  daughter1, daughter2, col, acol, phaseSpacePtr->p(i),
693  phaseSpacePtr->m(i), scale);
694 
695  // NOAM: If there is an intermediate state, insert the it in
696  // the process record after the two incoming particles.
697  if (i == 2 && idRes != 0) {
698 
699  // Sign of intermediate state: go by charge.
700  if (particleDataPtr->hasAnti(idRes)
701  && process[3].chargeType() + process[4].chargeType() < 0)
702  idRes *= -1;
703 
704  // The colour configuration of the intermediate state has to be
705  // resolved separately.
706  col = 0;
707  acol = 0;
708  int m_col1 = sigmaProcessPtr->col(1);
709  int m_acol1 = sigmaProcessPtr->acol(1);
710  int m_col2 = sigmaProcessPtr->col(2);
711  int m_acol2 = sigmaProcessPtr->acol(2);
712  if (m_col1 == m_acol2 && m_col2 != m_acol1) {
713  col = m_col2;
714  acol = m_acol1;
715  } else if (m_col2 == m_acol1 && m_col1 != m_acol2) {
716  col = m_col1;
717  acol = m_acol2;
718  }
719  if ( col > 0) col += colOffset;
720  else if ( col < 0) col -= colOffset;
721  if (acol > 0) acol += colOffset;
722  else if (acol < 0) acol -= colOffset;
723 
724  // Insert the intermediate state into the event record.
725  Vec4 pIntMed = phaseSpacePtr->p(1) + phaseSpacePtr->p(2);
726  process.append( idRes, -22, 3, 4, 6, 5 + nFin, col, acol,
727  pIntMed, pIntMed.mCalc(), scale);
728  }
729 
730  // Pick lifetime where relevant, else not.
731  if (process[iNow].tau0() > 0.) process[iNow].tau(
732  process[iNow].tau0() * rndmPtr->exp() );
733  }
734  }
735 
736  // Insert the outgoing particles - unresolved processes.
737  else if (!isLHA) {
738  int id3 = sigmaProcessPtr->id(3);
739  int status3 = (id3 == process[1].id()) ? 14 : 15;
740  process.append( id3, status3, 1, 0, 0, 0, 0, 0,
741  phaseSpacePtr->p(3), phaseSpacePtr->m(3));
742  int id4 = sigmaProcessPtr->id(4);
743  int status4 = (id4 == process[2].id()) ? 14 : 15;
744  process.append( id4, status4, 2, 0, 0, 0, 0, 0,
745  phaseSpacePtr->p(4), phaseSpacePtr->m(4));
746 
747  // For central diffraction: two scattered protons inserted so far,
748  // but modify mothers, add also centrally-produced hadronic system.
749  if (isDiffC) {
750  process[3].mothers( 1, 2);
751  process[4].mothers( 1, 2);
752  int id5 = sigmaProcessPtr->id(5);
753  int status5 = 15;
754  process.append( id5, status5, 1, 2, 0, 0, 0, 0,
755  phaseSpacePtr->p(5), phaseSpacePtr->m(5));
756  }
757  }
758 
759  // Insert the outgoing particles - Les Houches Accord processes.
760  else {
761 
762  // Since LHA partons may be out of order, determine correct one.
763  // (Recall that zeroth particle is empty.)
764  vector<int> newPos;
765  newPos.reserve(lhaUpPtr->sizePart());
766  newPos.push_back(0);
767  for (int iNew = 0; iNew < lhaUpPtr->sizePart(); ++iNew) {
768  // For iNew == 0 look for the two incoming partons, then for
769  // partons having them as mothers, and so on layer by layer.
770  for (int i = 1; i < lhaUpPtr->sizePart(); ++i)
771  if (lhaUpPtr->mother1(i) == newPos[iNew]) newPos.push_back(i);
772  if (int(newPos.size()) <= iNew) break;
773  }
774 
775  // Find scale from which to begin MPI/ISR/FSR evolution.
776  scalup = lhaUpPtr->scale();
777  scale = scalup;
778  double scalePr = (scale < 0.) ? sqrt(Q2Fac()) : scale;
779  process.scale( scalePr);
780 
781  // Copy over info from LHA event to process, in proper order.
782  vector<int> iFinal;
783  for (int i = 1; i < lhaUpPtr->sizePart(); ++i) {
784  int iOld = newPos[i];
785  int id = lhaUpPtr->id(iOld);
786  if (i == 1 && abs(id) == idRenameBeams) id = 16;
787  if (i == 2 && abs(id) == idRenameBeams) id = -16;
788  int idAbs = abs(id);
789 
790  // Translate from LHA status codes.
791  int lhaStatus = lhaUpPtr->status(iOld);
792  int status = -21;
793  if (lhaStatus == 2 || lhaStatus == 3) status = -22;
794  if (lhaStatus == 1) status = 23;
795 
796  // Find where mothers have been moved by reordering.
797  int mother1Old = lhaUpPtr->mother1(iOld);
798  int mother2Old = lhaUpPtr->mother2(iOld);
799  int mother1 = 0;
800  int mother2 = 0;
801  for (int im = 1; im < i; ++im) {
802  if (mother1Old == newPos[im]) mother1 = im + 2;
803  if (mother2Old == newPos[im]) mother2 = im + 2;
804  }
805  if (i <= 2) mother1 = i;
806 
807  // Ensure that second mother = 0 except for bona fide carbon copies.
808  if (mother1 > 0 && mother2 == mother1) {
809  int sister1 = process[mother1].daughter1();
810  int sister2 = process[mother1].daughter2();
811  if (sister2 != sister1 && sister2 != 0) mother2 = 0;
812  }
813 
814  // Find daughters and where they have been moved by reordering.
815  // (Values shifted two steps to account for inserted beams.)
816  int daughter1 = 0;
817  int daughter2 = 0;
818  for (int im = i + 1; im < lhaUpPtr->sizePart(); ++im) {
819  if (lhaUpPtr->mother1(newPos[im]) == iOld
820  || lhaUpPtr->mother2(newPos[im]) == iOld) {
821  if (daughter1 == 0 || im + 2 < daughter1) daughter1 = im + 2;
822  if (daughter2 == 0 || im + 2 > daughter2) daughter2 = im + 2;
823  }
824  }
825  // For 2 -> 1 hard scatterings reset second daughter to 0.
826  if (daughter2 == daughter1) daughter2 = 0;
827 
828  // Colour trivial, except reset irrelevant colour indices.
829  int colType = particleDataPtr->colType(id);
830  int col1 = (colType == 1 || colType == 2 || abs(colType) == 3)
831  ? lhaUpPtr->col1(iOld) : 0;
832  int col2 = (colType == -1 || colType == 2 || abs(colType) == 3)
833  ? lhaUpPtr->col2(iOld) : 0;
834 
835  // Copy momentum and ensure consistent (E, p, m) set.
836  double px = lhaUpPtr->px(iOld);
837  double py = lhaUpPtr->py(iOld);
838  double pz = lhaUpPtr->pz(iOld);
839  double e = lhaUpPtr->e(iOld);
840  double m = lhaUpPtr->m(iOld);
841  if (mRecalculate > 0. && m > mRecalculate)
842  m = sqrtpos( e*e - px*px - py*py - pz*pz);
843  else e = sqrt( m*m + px*px + py*py + pz*pz);
844 
845  // Polarization.
846  double pol = lhaUpPtr->spin(iOld);
847 
848  // Allow scale setting for generic partons.
849  double scaleShow = lhaUpPtr->scale(iOld);
850 
851  // For resonance decay products use resonance mass as scale.
852  double scaleNow = scalePr;
853  if (mother1 > 4 && !useStrictLHEFscales) scaleNow = process[mother1].m();
854  if (scaleShow >= 0.0) scaleNow = scaleShow;
855 
856  // Store Les Houches Accord partons.
857  int iNow = process.append( id, status, mother1, mother2, daughter1,
858  daughter2, col1, col2, Vec4(px, py, pz, e), m, scaleNow, pol);
859 
860  // Check if need to store lifetime.
861  double tau = lhaUpPtr->tau(iOld);
862  if ( (setLifetime == 1 && idAbs == 15) || setLifetime == 2)
863  tau = process[iNow].tau0() * rndmPtr->exp();
864  if (tau > 0.) process[iNow].tau(tau);
865 
866  // Track outgoing final particles.
867  if (status == 23) iFinal.push_back( iNow);
868  }
869 
870  // Second pass to catch vanishing final lepton and quark masses.
871  int iFinalSz = iFinal.size();
872  for (int iF = 0; iF < iFinalSz; ++iF) {
873  int iMod = iFinal[iF];
874  int iQLmod = 0;
875  double mOld = process[iMod].m();
876  for (int iQL = 1; iQL < 9; ++iQL)
877  if (process[iMod].idAbs() == idNewM[iQL]) {
878  if ( iQL < 6 && setQuarkMass > 0 && (iQL == 4 || iQL == 5
879  || setQuarkMass == 2) && (mOld < 0.5 * mNewM[iQL]
880  || mOld > 1.5 * mNewM[iQL]) ) iQLmod = iQL;
881  if ( iQL > 5 && setLeptonMass > 0 && (setLeptonMass == 2
882  || mOld < 0.9 * mNewM[iQL] || mOld > 1.1 * mNewM[iQL]) )
883  iQLmod = iQL;
884  }
885  if (iQLmod == 0) continue;
886  double mNew = mNewM[iQLmod];
887 
888  // Find partner to exchange energy and momentum with: general.
889  int iRec = 0;
890  if (iFinalSz == 2) iRec = iFinal[1 - iF];
891  else if (process[iMod].mother1() > 2) {
892  int iMother = process[iMod].mother1();
893  int iMDau1 = process[iMother].daughter1();
894  int iMDau2 = process[iMother].daughter2();
895  if (iMDau2 == iMDau1 + 1 && iMod == iMDau1) iRec = iMDau2;
896  if (iMDau2 == iMDau1 + 1 && iMod == iMDau2) iRec = iMDau1;
897  }
898 
899  // Find partner to exchange energy and momentum with: lepton.
900  if (iRec == 0 && iQLmod > 5) {
901  for (int iR = 0; iR < iFinalSz; ++iR) if (iR != iF) {
902  int iRtmp = iFinal[iR];
903  if (process[iRtmp].idAbs() == idNewM[iQLmod] + 1
904  && process[iRtmp].id() * process[iMod].id() < 0) iRec = iRtmp;
905  }
906  }
907  if (iRec == 0 && iQLmod > 5) {
908  for (int iR = 0; iR < iFinalSz; ++iR) if (iR != iF) {
909  int iRtmp = iFinal[iR];
910  if (process[iRtmp].id() == -process[iMod].id()) iRec = iRtmp;
911  }
912  }
913 
914  // Find partner to exchange energy and momentum with: quark.
915  if (iRec == 0 && iQLmod < 6 && process[iMod].col() != 0) {
916  for (int iR = 0; iR < iFinalSz; ++iR) if (iR != iF) {
917  int iRtmp = iFinal[iR];
918  if (process[iRtmp].acol() == process[iMod].col()) iRec = iRtmp;
919  }
920  }
921  if (iRec == 0 && iQLmod < 6 && process[iMod].acol() != 0) {
922  for (int iR = 0; iR < iFinalSz; ++iR) if (iR != iF) {
923  int iRtmp = iFinal[iR];
924  if (process[iRtmp].col() == process[iMod].acol()) iRec = iRtmp;
925  }
926  }
927 
928  // Find partner to exchange energy and momentum with: largest mass.
929  if (iRec == 0) {
930  double mMax = 0.;
931  for (int iR = 0; iR < iFinalSz; ++iR) if (iR != iF) {
932  int iRtmp = iFinal[iR];
933  double mTmp = m( process[iMod], process[iRtmp]) - process[iRtmp].m();
934  if (mTmp > mMax) { iRec = iRtmp; mMax = mTmp;}
935  }
936  }
937 
938  // Carry out exchange of energy and momentum, if possible.
939  bool doneShift = false;
940  Vec4 pMod = process[iMod].p();
941  if (iRec != 0) {
942  Vec4 pRecOld = process[iRec].p();
943  Vec4 pRecNew = pRecOld;
944  double mRec = process[iRec].m();
945  if ( pShift( pMod, pRecNew, mNew, mRec) ) {
946  process[iMod].p( pMod);
947  process[iMod].m( mNew);
948  process[iRec].p( pRecNew);
949  // Recursive boost of recoiler decay products, if necessary.
950  if (!process[iRec].isFinal()) {
951  vector<int> iDauRec = process[iRec].daughterListRecursive();
952  RotBstMatrix Mdau;
953  Mdau.bst( pRecOld, pRecNew);
954  for (int iD = 0; iD < int(iDauRec.size()); ++iD)
955  process[iDauRec[iD]].rotbst( Mdau);
956  }
957  doneShift = true;
958  }
959  }
960 
961  // Emergency solution: just add energy as needed, => new incoming.
962  if (!doneShift) {
963  pMod.e( sqrtpos( pMod.pAbs2() + mNew * mNew) );
964  process[iMod].p( pMod);
965  process[iMod].m( mNew);
966  infoPtr->errorMsg("Warning in ProcessContainer::constructProcess: "
967  "unsuitable recoiler found");
968  }
969  }
970 
971  // Reassign momenta and masses for incoming partons.
972  if (matchInOut) {
973  Vec4 pSumOut;
974  for (int iF = 0; iF < iFinalSz; ++iF)
975  pSumOut += process[iFinal[iF]].p();
976  double e1 = 0.5 * (pSumOut.e() + pSumOut.pz());
977  double e2 = 0.5 * (pSumOut.e() - pSumOut.pz());
978  process[3].pz( e1);
979  process[3].e( e1);
980  process[3].m( 0.);
981  process[4].pz(-e2);
982  process[4].e( e2);
983  process[4].m( 0.);
984  if (max(e1, e2) > 0.500001 * process[0].e()) {
985  infoPtr->errorMsg("Error in ProcessContainer::constructProcess: "
986  "setting mass failed");
987  return false;
988  }
989  }
990  }
991 
992  // Loop through decay chains and set secondary vertices when needed.
993  for (int i = 3; i < process.size(); ++i) {
994  int iMother = process[i].mother1();
995 
996  // If sister to already assigned vertex then assign same.
997  if ( process[i - 1].mother1() == iMother && process[i - 1].hasVertex() )
998  process[i].vProd( process[i - 1].vProd() );
999 
1000  // Else if mother already has vertex and/or lifetime then assign.
1001  else if ( process[iMother].hasVertex() || process[iMother].tau() > 0.)
1002  process[i].vProd( process[iMother].vDec() );
1003  }
1004 
1005  // Further info on process. Reset quantities that may or may not be known.
1006  int id1Now = process[3 + nOffsetGamma].id();
1007  int id2Now = process[4 + nOffsetGamma].id();
1008  int id1pdf = 0;
1009  int id2pdf = 0;
1010  double x1pdf = 0.;
1011  double x2pdf = 0.;
1012  double pdf1 = 0.;
1013  double pdf2 = 0.;
1014  double tHat = 0.;
1015  double uHat = 0.;
1016  double pTHatL = 0.;
1017  double m3 = 0.;
1018  double m4 = 0.;
1019  double theta = 0.;
1020  double phi = 0.;
1021  double x1Now, x2Now, Q2FacNow, alphaEM, alphaS, Q2Ren, sHat;
1022 
1023  // Internally generated and stored information.
1024  if (!isLHA) {
1025  id1pdf = id1Now;
1026  id2pdf = id2Now;
1027  x1Now = phaseSpacePtr->x1();
1028  x2Now = phaseSpacePtr->x2();
1029  x1pdf = x1Now;
1030  x2pdf = x2Now;
1031  pdf1 = sigmaProcessPtr->pdf1();
1032  pdf2 = sigmaProcessPtr->pdf2();
1033  Q2FacNow = sigmaProcessPtr->Q2Fac();
1034  alphaEM = sigmaProcessPtr->alphaEMRen();
1035  alphaS = sigmaProcessPtr->alphaSRen();
1036  Q2Ren = sigmaProcessPtr->Q2Ren();
1037  sHat = phaseSpacePtr->sHat();
1038  tHat = phaseSpacePtr->tHat();
1039  uHat = phaseSpacePtr->uHat();
1040  pTHatL = phaseSpacePtr->pTHat();
1041  m3 = phaseSpacePtr->m(3);
1042  m4 = phaseSpacePtr->m(4);
1043  theta = phaseSpacePtr->thetaHat();
1044  phi = phaseSpacePtr->phiHat();
1045  }
1046 
1047  // Les Houches Accord process partly available, partly to be constructed.
1048  else {
1049  x1Now = 2. * process[3].e() / infoPtr->eCM();
1050  x2Now = 2. * process[4].e() / infoPtr->eCM();
1051  Q2FacNow = (scale < 0.) ? sigmaProcessPtr->Q2Fac() : pow2(scale);
1052  alphaEM = lhaUpPtr->alphaQED();
1053  if (alphaEM < 0.001) alphaEM = sigmaProcessPtr->alphaEMRen();
1054  alphaS = lhaUpPtr->alphaQCD();
1055  if (alphaS < 0.001) alphaS = sigmaProcessPtr->alphaSRen();
1056  Q2Ren = (scale < 0.) ? sigmaProcessPtr->Q2Ren() : pow2(scale);
1057  Vec4 pSum = process[3].p() + process[4].p();
1058  sHat = pSum * pSum;
1059  int nFinLH = 0;
1060  double pTLH = 0.;
1061  for (int i = 5; i < process.size(); ++i)
1062  if (process[i].mother1() == 3 && process[i].mother2() == 4) {
1063  ++nFinLH;
1064  pTLH += process[i].pT();
1065  }
1066  if (nFinLH > 0) pTHatL = pTLH / nFinLH;
1067 
1068  // Read info on parton densities if provided.
1069  id1pdf = lhaUpPtr->id1pdf();
1070  id2pdf = lhaUpPtr->id2pdf();
1071  x1pdf = lhaUpPtr->x1pdf();
1072  x2pdf = lhaUpPtr->x2pdf();
1073  if (lhaUpPtr->pdfIsSet()) {
1074  pdf1 = lhaUpPtr->pdf1();
1075  pdf2 = lhaUpPtr->pdf2();
1076  Q2FacNow = pow2(lhaUpPtr->scalePDF());
1077  }
1078 
1079  // Reconstruct kinematics of 2 -> 2 processes from momenta.
1080  if (nFin == 2) {
1081  Vec4 pDifT = process[3].p() - process[5].p();
1082  tHat = pDifT * pDifT;
1083  Vec4 pDifU = process[3].p() - process[6].p();
1084  uHat = pDifU * pDifU;
1085  pTHatL = process[5].pT();
1086  m3 = process[5].m();
1087  m4 = process[6].m();
1088  Vec4 p5 = process[5].p();
1089  p5.bstback(pSum);
1090  theta = p5.theta();
1091  phi = process[5].phi();
1092  }
1093  }
1094 
1095  // Store information.
1096  if (isHardest) {
1097  infoPtr->setPDFalpha( 0, id1pdf, id2pdf, x1pdf, x2pdf, pdf1, pdf2,
1098  Q2FacNow, alphaEM, alphaS, Q2Ren, scalup);
1099  infoPtr->setKin( 0, id1Now, id2Now, x1Now, x2Now, sHat, tHat, uHat,
1100  pTHatL, m3, m4, theta, phi);
1101  }
1102  infoPtr->setTypeMPI( code(), pTHatL);
1103 
1104  // For Les Houches event store subprocess classification.
1105  if (isLHA) {
1106  int codeSub = lhaUpPtr->idProcess();
1107  ostringstream nameSub;
1108  nameSub << "user process " << codeSub;
1109  infoPtr->setSubType( 0, nameSub.str(), codeSub, nFin);
1110  }
1111 
1112  // Done.
1113  return true;
1114 
1115 }
1116 
1117 //--------------------------------------------------------------------------
1118 
1119 // Give the hard resonance decay chain from Les Houches input.
1120 // Note: mildly modified copy of some constructProcess code; to streamline.
1121 
1122 bool ProcessContainer::constructDecays( Event& process) {
1123 
1124  // Let hard process record begin with the event as a whole.
1125  process.clear();
1126  process.append( 90, -11, 0, 0, 0, 0, 0, 0, Vec4(0., 0., 0., 0.), 0., 0. );
1127 
1128  // Since LHA partons may be out of order, determine correct one.
1129  // (Recall that zeroth particle is empty.)
1130  vector<int> newPos;
1131  newPos.reserve(lhaUpPtr->sizePart());
1132  newPos.push_back(0);
1133  for (int iNew = 0; iNew < lhaUpPtr->sizePart(); ++iNew) {
1134  // For iNew == 0 look for the two incoming partons, then for
1135  // partons having them as mothers, and so on layer by layer.
1136  for (int i = 1; i < lhaUpPtr->sizePart(); ++i)
1137  if (lhaUpPtr->mother1(i) == newPos[iNew]) newPos.push_back(i);
1138  if (int(newPos.size()) <= iNew) break;
1139  }
1140 
1141  // Find scale from which to begin MPI/ISR/FSR evolution.
1142  double scale = lhaUpPtr->scale();
1143  process.scale( scale);
1144  Vec4 pSum;
1145 
1146  // Copy over info from LHA event to process, in proper order.
1147  for (int i = 1; i < lhaUpPtr->sizePart(); ++i) {
1148  int iOld = newPos[i];
1149  int id = lhaUpPtr->id(iOld);
1150 
1151  // Translate from LHA status codes.
1152  int lhaStatus = lhaUpPtr->status(iOld);
1153  int status = -21;
1154  if (lhaStatus == 2 || lhaStatus == 3) status = -22;
1155  if (lhaStatus == 1) status = 23;
1156 
1157  // Find where mothers have been moved by reordering.
1158  int mother1Old = lhaUpPtr->mother1(iOld);
1159  int mother2Old = lhaUpPtr->mother2(iOld);
1160  int mother1 = 0;
1161  int mother2 = 0;
1162  for (int im = 1; im < i; ++im) {
1163  if (mother1Old == newPos[im]) mother1 = im;
1164  if (mother2Old == newPos[im]) mother2 = im;
1165  }
1166 
1167  // Ensure that second mother = 0 except for bona fide carbon copies.
1168  if (mother1 > 0 && mother2 == mother1) {
1169  int sister1 = process[mother1].daughter1();
1170  int sister2 = process[mother1].daughter2();
1171  if (sister2 != sister1 && sister2 != 0) mother2 = 0;
1172  }
1173 
1174  // Find daughters and where they have been moved by reordering.
1175  int daughter1 = 0;
1176  int daughter2 = 0;
1177  for (int im = i + 1; im < lhaUpPtr->sizePart(); ++im) {
1178  if (lhaUpPtr->mother1(newPos[im]) == iOld
1179  || lhaUpPtr->mother2(newPos[im]) == iOld) {
1180  if (daughter1 == 0 || im < daughter1) daughter1 = im;
1181  if (daughter2 == 0 || im > daughter2) daughter2 = im;
1182  }
1183  }
1184  // For 2 -> 1 hard scatterings reset second daughter to 0.
1185  if (daughter2 == daughter1) daughter2 = 0;
1186 
1187  // Colour trivial, except reset irrelevant colour indices.
1188  int colType = particleDataPtr->colType(id);
1189  int col1 = (colType == 1 || colType == 2 || abs(colType) == 3)
1190  ? lhaUpPtr->col1(iOld) : 0;
1191  int col2 = (colType == -1 || colType == 2 || abs(colType) == 3)
1192  ? lhaUpPtr->col2(iOld) : 0;
1193 
1194  // Momentum trivial.
1195  double px = lhaUpPtr->px(iOld);
1196  double py = lhaUpPtr->py(iOld);
1197  double pz = lhaUpPtr->pz(iOld);
1198  double e = lhaUpPtr->e(iOld);
1199  double m = lhaUpPtr->m(iOld);
1200  if (status > 0) pSum += Vec4( px, py, pz, e);
1201 
1202  // Polarization.
1203  double pol = lhaUpPtr->spin(iOld);
1204 
1205  // For resonance decay products use resonance mass as scale.
1206  double scaleNow = scale;
1207  if (mother1 > 0) scaleNow = process[mother1].m();
1208 
1209  // Store Les Houches Accord partons.
1210  int iNow = process.append( id, status, mother1, mother2, daughter1,
1211  daughter2, col1, col2, Vec4(px, py, pz, e), m, scaleNow, pol);
1212 
1213  // Check if need to store lifetime.
1214  double tau = lhaUpPtr->tau(iOld);
1215  if ( (setLifetime == 1 && abs(id) == 15) || setLifetime == 2)
1216  tau = process[iNow].tau0() * rndmPtr->exp();
1217  if (tau > 0.) process[iNow].tau(tau);
1218  }
1219 
1220  // Update four-momentum of system as a whole.
1221  process[0].p( pSum);
1222  process[0].m( pSum.mCalc());
1223 
1224  // Loop through decay chains and set secondary vertices when needed.
1225  for (int i = 1; i < process.size(); ++i) {
1226  int iMother = process[i].mother1();
1227 
1228  // If sister to already assigned vertex then assign same.
1229  if ( process[i - 1].mother1() == iMother && process[i - 1].hasVertex()
1230  && i > 1) process[i].vProd( process[i - 1].vProd() );
1231 
1232  // Else if mother already has vertex and/or lifetime then assign.
1233  else if ( process[iMother].hasVertex() || process[iMother].tau() > 0.)
1234  process[i].vProd( process[iMother].vDec() );
1235  }
1236 
1237  // Done.
1238  return true;
1239 
1240 }
1241 
1242 //--------------------------------------------------------------------------
1243 
1244 // Handle resonance decays.
1245 
1246 bool ProcessContainer::decayResonances( Event& process) {
1247 
1248  // Save current event-record size and status codes.
1249  process.saveSize();
1250  vector<int> statusSave( process.size());
1251  for (int i = 0; i < process.size(); ++i)
1252  statusSave[i] = process[i].status();
1253  bool physical = true;
1254  bool newChain = false;
1255  bool newFlavours = false;
1256 
1257  // Do loop over user veto.
1258  do {
1259 
1260  // Do sequential chain of uncorrelated isotropic decays.
1261  do {
1262  physical = resDecaysPtr->next( process);
1263  if (!physical) return false;
1264 
1265  // Check whether flavours should be correlated.
1266  // (Currently only relevant for f fbar -> gamma*/Z0 gamma*/Z0.)
1267  newFlavours = ( sigmaProcessPtr->weightDecayFlav( process)
1268  < rndmPtr->flat() );
1269 
1270  // Reset the decay chains if have to redo.
1271  if (newFlavours) {
1272  process.restoreSize();
1273  for (int i = 0; i < process.size(); ++i)
1274  process[i].status( statusSave[i]);
1275  }
1276 
1277  // Loop back where required to generate new decays with new flavours.
1278  } while (newFlavours);
1279 
1280  // Correct to nonisotropic decays.
1281  phaseSpacePtr->decayKinematics( process);
1282 
1283  // Optionally user hooks check/veto on decay chain.
1284  if (canVetoResDecay)
1285  newChain = userHooksPtr->doVetoResonanceDecays( process);
1286 
1287  // Reset the decay chains if have to redo.
1288  if (newChain) {
1289  process.restoreSize();
1290  for (int i = 0; i < process.size(); ++i)
1291  process[i].status( statusSave[i]);
1292  }
1293 
1294  // Loop back where required to generate new decay chain.
1295  } while(newChain);
1296 
1297  // Done.
1298  return true;
1299 
1300 }
1301 
1302 //--------------------------------------------------------------------------
1303 
1304 // Reset event generation statistics; but NOT maximum of cross section.
1305 
1306 void ProcessContainer::reset() {
1307 
1308  nTry = 0;
1309  nSel = 0;
1310  nAcc = 0;
1311  nTryStat = 0;
1312  sigmaSum = 0.;
1313  sigma2Sum = 0.;
1314  sigmaNeg = 0.;
1315  sigmaAvg = 0.;
1316  sigmaFin = 0.;
1317  deltaFin = 0.;
1318  wtAccSum = 0.;
1319  sigmaTemp = 0.;
1320  sigma2Temp= 0.;
1321 
1322 }
1323 
1324 //--------------------------------------------------------------------------
1325 
1326 // Estimate integrated cross section and its uncertainty.
1327 
1328 void ProcessContainer::sigmaDelta() {
1329 
1330  // Initial values. No analysis meaningful unless accepted events.
1331  nTryStat = nTry;
1332  sigmaAvg = 0.;
1333  sigmaFin = 0.;
1334  deltaFin = 0.;
1335  if (nAcc == 0) return;
1336 
1337  // Only update once an event is accepted, as is needed if the event weight
1338  // can still change by a finite amount due to reweighting.
1339  double wgtNow = infoPtr->weight();
1340  // infoPtr->weight() performs coversion to pb if lhaStratAbs = 4
1341  if (lhaStrat == 0) wgtNow = sigmaTemp;
1342  if (lhaStratAbs == 3) wgtNow *= sigmaTemp;
1343  if (lhaStratAbs == 4) wgtNow /= 1e9;
1344  sigmaSum += wgtNow;
1345 
1346  double wgtNow2 = 1.0;
1347  if (lhaStrat == 0) wgtNow2 = sigma2Temp;
1348  if (lhaStratAbs == 3) wgtNow2 = pow2(wgtNow)*sigma2Temp;
1349  if (lhaStratAbs == 4) wgtNow2 = pow2(wgtNow/1e9);
1350  sigma2Sum += wgtNow2;
1351 
1352  sigmaTemp = 0.0;
1353  sigma2Temp = 0.0;
1354 
1355  // Average value. No error analysis unless at least two events.
1356  double nTryInv = 1. / nTry;
1357  double nSelInv = 1. / nSel;
1358  double nAccInv = 1. / nAcc;
1359  sigmaAvg = sigmaSum * nTryInv;
1360  double fracAcc = nAcc * nSelInv;
1361 
1362  // If Pythia should not perform the unweighting, always simply add accepted
1363  // event weights.
1364  if (lhaStratAbs >= 3 ) fracAcc = 1.;
1365 
1366  sigmaFin = sigmaAvg * fracAcc;
1367  deltaFin = sigmaFin;
1368 
1369  if (nAcc == 1) return;
1370 
1371  // Estimated error. Quadratic sum of cross section term and
1372  // binomial from accept/reject step.
1373  double delta2Sig = (lhaStratAbs != 3)
1374  ? (sigma2Sum * nTryInv - pow2(sigmaAvg)) * nTryInv / pow2(sigmaAvg)
1375  : pow2( lhaUpPtr->xErrSum() / lhaUpPtr->xSecSum());
1376  double delta2Veto = (nSel - nAcc) * nAccInv * nSelInv;
1377  double delta2Sum = delta2Sig + delta2Veto;
1378  deltaFin = sqrtpos(delta2Sum) * sigmaFin;
1379 
1380 }
1381 
1382 //==========================================================================
1383 
1384 // SetupContainer class.
1385 // Turns list of user-desired processes into a vector of containers.
1386 
1387 //--------------------------------------------------------------------------
1388 
1389 // Main routine to initialize list of processes.
1390 
1391 bool SetupContainers::init(vector<ProcessContainer*>& containerPtrs,
1392  Info *infoPtr, Settings& settings, ParticleData* particleDataPtr,
1393  Couplings* couplings) {
1394 
1395  // Reset process list, if filled in previous subrun.
1396  if (containerPtrs.size() > 0) {
1397  for (int i = 0; i < int(containerPtrs.size()); ++i)
1398  delete containerPtrs[i];
1399  containerPtrs.clear();
1400  }
1401  SigmaProcess* sigmaPtr;
1402 
1403  // Set up requested objects for soft QCD processes.
1404  bool softQCD = settings.flag("SoftQCD:all");
1405  bool inelastic = settings.flag("SoftQCD:inelastic");
1406  if (softQCD || inelastic || settings.flag("SoftQCD:nonDiffractive")) {
1407  sigmaPtr = new Sigma0nonDiffractive;
1408  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1409  }
1410  if (softQCD || settings.flag("SoftQCD:elastic")) {
1411  sigmaPtr = new Sigma0AB2AB;
1412  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1413  }
1414  if (softQCD || inelastic || settings.flag("SoftQCD:singleDiffractive")) {
1415  sigmaPtr = new Sigma0AB2XB;
1416  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1417  sigmaPtr = new Sigma0AB2AX;
1418  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1419  }
1420  if (softQCD || inelastic || settings.flag("SoftQCD:doubleDiffractive")) {
1421  sigmaPtr = new Sigma0AB2XX;
1422  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1423  }
1424  if (softQCD || inelastic || settings.flag("SoftQCD:centralDiffractive")) {
1425  sigmaPtr = new Sigma0AB2AXB;
1426  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1427  }
1428 
1429  // Set up requested objects for hard QCD processes.
1430  bool hardQCD = settings.flag("HardQCD:all");
1431  if (hardQCD || settings.flag("HardQCD:gg2gg")) {
1432  sigmaPtr = new Sigma2gg2gg;
1433  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1434  }
1435  if (hardQCD || settings.flag("HardQCD:gg2qqbar")) {
1436  sigmaPtr = new Sigma2gg2qqbar;
1437  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1438  }
1439  if (hardQCD || settings.flag("HardQCD:qg2qg")) {
1440  sigmaPtr = new Sigma2qg2qg;
1441  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1442  }
1443  if (hardQCD || settings.flag("HardQCD:qq2qq")) {
1444  sigmaPtr = new Sigma2qq2qq;
1445  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1446  }
1447  if (hardQCD || settings.flag("HardQCD:qqbar2gg")) {
1448  sigmaPtr = new Sigma2qqbar2gg;
1449  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1450  }
1451  if (hardQCD || settings.flag("HardQCD:qqbar2qqbarNew")) {
1452  sigmaPtr = new Sigma2qqbar2qqbarNew;
1453  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1454  }
1455 
1456  // Set up requested objects for c cbar and b bbar, also hard QCD.
1457  bool hardccbar = settings.flag("HardQCD:hardccbar");
1458  if (hardQCD || hardccbar || settings.flag("HardQCD:gg2ccbar")) {
1459  sigmaPtr = new Sigma2gg2QQbar(4, 121);
1460  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1461  }
1462  if (hardQCD || hardccbar || settings.flag("HardQCD:qqbar2ccbar")) {
1463  sigmaPtr = new Sigma2qqbar2QQbar(4, 122);
1464  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1465  }
1466  bool hardbbbar = settings.flag("HardQCD:hardbbbar");
1467  if (hardQCD || hardbbbar || settings.flag("HardQCD:gg2bbbar")) {
1468  sigmaPtr = new Sigma2gg2QQbar(5, 123);
1469  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1470  }
1471  if (hardQCD || hardbbbar || settings.flag("HardQCD:qqbar2bbbar")) {
1472  sigmaPtr = new Sigma2qqbar2QQbar(5, 124);
1473  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1474  }
1475 
1476  // Set up requested objects for hard QCD 2 -> 3 processes.
1477  bool hardQCD3parton = settings.flag("HardQCD:3parton");
1478  if (hardQCD3parton || settings.flag("HardQCD:gg2ggg")) {
1479  sigmaPtr = new Sigma3gg2ggg;
1480  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1481  }
1482  if (hardQCD3parton || settings.flag("HardQCD:qqbar2ggg")) {
1483  sigmaPtr = new Sigma3qqbar2ggg;
1484  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1485  }
1486  if (hardQCD3parton || settings.flag("HardQCD:qg2qgg")) {
1487  sigmaPtr = new Sigma3qg2qgg;
1488  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1489  }
1490  if (hardQCD3parton || settings.flag("HardQCD:qq2qqgDiff")) {
1491  sigmaPtr = new Sigma3qq2qqgDiff;
1492  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1493  }
1494  if (hardQCD3parton || settings.flag("HardQCD:qq2qqgSame")) {
1495  sigmaPtr = new Sigma3qq2qqgSame;
1496  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1497  }
1498  if (hardQCD3parton || settings.flag("HardQCD:qqbar2qqbargDiff")) {
1499  sigmaPtr = new Sigma3qqbar2qqbargDiff;
1500  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1501  }
1502  if (hardQCD3parton || settings.flag("HardQCD:qqbar2qqbargSame")) {
1503  sigmaPtr = new Sigma3qqbar2qqbargSame;
1504  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1505  }
1506  if (hardQCD3parton || settings.flag("HardQCD:gg2qqbarg")) {
1507  sigmaPtr = new Sigma3gg2qqbarg;
1508  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1509  }
1510  if (hardQCD3parton || settings.flag("HardQCD:qg2qqqbarDiff")) {
1511  sigmaPtr = new Sigma3qg2qqqbarDiff;
1512  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1513  }
1514  if (hardQCD3parton || settings.flag("HardQCD:qg2qqqbarSame")) {
1515  sigmaPtr = new Sigma3qg2qqqbarSame;
1516  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1517  }
1518 
1519  // Set up requested objects for prompt photon processes.
1520  bool promptPhotons = settings.flag("PromptPhoton:all");
1521  if (promptPhotons
1522  || settings.flag("PromptPhoton:qg2qgamma")) {
1523  sigmaPtr = new Sigma2qg2qgamma;
1524  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1525  }
1526  if (promptPhotons
1527  || settings.flag("PromptPhoton:qqbar2ggamma")) {
1528  sigmaPtr = new Sigma2qqbar2ggamma;
1529  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1530  }
1531  if (promptPhotons
1532  || settings.flag("PromptPhoton:gg2ggamma")) {
1533  sigmaPtr = new Sigma2gg2ggamma;
1534  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1535  }
1536  if (promptPhotons
1537  || settings.flag("PromptPhoton:ffbar2gammagamma")) {
1538  sigmaPtr = new Sigma2ffbar2gammagamma;
1539  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1540  }
1541  if (promptPhotons
1542  || settings.flag("PromptPhoton:gg2gammagamma")) {
1543  sigmaPtr = new Sigma2gg2gammagamma;
1544  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1545  }
1546 
1547  // Set up requested objects for weak gauge boson t-channel exchange.
1548  bool weakBosonExchanges = settings.flag("WeakBosonExchange:all");
1549  if (weakBosonExchanges
1550  || settings.flag("WeakBosonExchange:ff2ff(t:gmZ)")) {
1551  sigmaPtr = new Sigma2ff2fftgmZ;
1552  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1553  }
1554  if (weakBosonExchanges
1555  || settings.flag("WeakBosonExchange:ff2ff(t:W)")) {
1556  sigmaPtr = new Sigma2ff2fftW;
1557  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1558  }
1559 
1560  // Set up requested objects for weak gauge boson processes.
1561  bool weakSingleBosons = settings.flag("WeakSingleBoson:all");
1562  if (weakSingleBosons
1563  || settings.flag("WeakSingleBoson:ffbar2gmZ")) {
1564  sigmaPtr = new Sigma1ffbar2gmZ;
1565  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1566  }
1567  if (weakSingleBosons
1568  || settings.flag("WeakSingleBoson:ffbar2W")) {
1569  sigmaPtr = new Sigma1ffbar2W;
1570  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1571  }
1572 
1573  // Set up requested object for s-channel gamma exchange.
1574  // Subset of gamma*/Z0 above, intended for multiparton interactions.
1575  if (settings.flag("WeakSingleBoson:ffbar2ffbar(s:gm)")) {
1576  sigmaPtr = new Sigma2ffbar2ffbarsgm;
1577  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1578  }
1579 
1580  // Set up requested object for s-channel gamma*/Z0 or W+- exchange.
1581  if (settings.flag("WeakSingleBoson:ffbar2ffbar(s:gmZ)")) {
1582  sigmaPtr = new Sigma2ffbar2ffbarsgmZ;
1583  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1584  }
1585  if (settings.flag("WeakSingleBoson:ffbar2ffbar(s:W)")) {
1586  sigmaPtr = new Sigma2ffbar2ffbarsW;
1587  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1588  }
1589 
1590  // Set up requested objects for weak gauge boson pair processes.
1591  bool weakDoubleBosons = settings.flag("WeakDoubleBoson:all");
1592  if (weakDoubleBosons
1593  || settings.flag("WeakDoubleBoson:ffbar2gmZgmZ")) {
1594  sigmaPtr = new Sigma2ffbar2gmZgmZ;
1595  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1596  }
1597  if (weakDoubleBosons
1598  || settings.flag("WeakDoubleBoson:ffbar2ZW")) {
1599  sigmaPtr = new Sigma2ffbar2ZW;
1600  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1601  }
1602  if (weakDoubleBosons
1603  || settings.flag("WeakDoubleBoson:ffbar2WW")) {
1604  sigmaPtr = new Sigma2ffbar2WW;
1605  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1606  }
1607 
1608  // Set up requested objects for weak gauge boson + parton processes.
1609  bool weakBosonAndPartons = settings.flag("WeakBosonAndParton:all");
1610  if (weakBosonAndPartons
1611  || settings.flag("WeakBosonAndParton:qqbar2gmZg")) {
1612  sigmaPtr = new Sigma2qqbar2gmZg;
1613  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1614  }
1615  if (weakBosonAndPartons
1616  || settings.flag("WeakBosonAndParton:qg2gmZq")) {
1617  sigmaPtr = new Sigma2qg2gmZq;
1618  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1619  }
1620  if (weakBosonAndPartons
1621  || settings.flag("WeakBosonAndParton:ffbar2gmZgm")) {
1622  sigmaPtr = new Sigma2ffbar2gmZgm;
1623  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1624  }
1625  if (weakBosonAndPartons
1626  || settings.flag("WeakBosonAndParton:fgm2gmZf")) {
1627  sigmaPtr = new Sigma2fgm2gmZf;
1628  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1629  }
1630  if (weakBosonAndPartons
1631  || settings.flag("WeakBosonAndParton:qqbar2Wg")) {
1632  sigmaPtr = new Sigma2qqbar2Wg;
1633  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1634  }
1635  if (weakBosonAndPartons
1636  || settings.flag("WeakBosonAndParton:qg2Wq")) {
1637  sigmaPtr = new Sigma2qg2Wq;
1638  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1639  }
1640  if (weakBosonAndPartons
1641  || settings.flag("WeakBosonAndParton:ffbar2Wgm")) {
1642  sigmaPtr = new Sigma2ffbar2Wgm;
1643  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1644  }
1645  if (weakBosonAndPartons
1646  || settings.flag("WeakBosonAndParton:fgm2Wf")) {
1647  sigmaPtr = new Sigma2fgm2Wf;
1648  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1649  }
1650 
1651  // Set up requested objects for photon collision processes.
1652  bool photonCollisions = settings.flag("PhotonCollision:all");
1653  bool hasGamma = settings.flag("PDF:lepton2gamma");
1654  int photonMode = settings.mode("Photon:ProcessType");
1655  bool initGmGm = ( ( (photonMode == 4) || (photonMode == 0) )
1656  && hasGamma ) || !hasGamma;
1657  if ( initGmGm && ( photonCollisions
1658  || settings.flag("PhotonCollision:gmgm2qqbar") ) ) {
1659  sigmaPtr = new Sigma2gmgm2ffbar(1, 261);
1660  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1661  }
1662  if ( initGmGm && ( photonCollisions
1663  || settings.flag("PhotonCollision:gmgm2ccbar") ) ) {
1664  sigmaPtr = new Sigma2gmgm2ffbar(4, 262);
1665  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1666  }
1667  if ( initGmGm && ( photonCollisions
1668  || settings.flag("PhotonCollision:gmgm2bbbar") ) ) {
1669  sigmaPtr = new Sigma2gmgm2ffbar(5, 263);
1670  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1671  }
1672  if ( initGmGm && ( photonCollisions
1673  || settings.flag("PhotonCollision:gmgm2ee") ) ) {
1674  sigmaPtr = new Sigma2gmgm2ffbar(11, 264);
1675  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1676  }
1677  if ( initGmGm && ( photonCollisions
1678  || settings.flag("PhotonCollision:gmgm2mumu") ) ) {
1679  sigmaPtr = new Sigma2gmgm2ffbar(13, 265);
1680  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1681  }
1682  if ( initGmGm && ( photonCollisions
1683  || settings.flag("PhotonCollision:gmgm2tautau") ) ) {
1684  sigmaPtr = new Sigma2gmgm2ffbar(15, 266);
1685  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1686  }
1687 
1688  // Read in settings related to photon beams.
1689  bool photonParton = settings.flag("PhotonParton:all");
1690  bool beamAisHadron = abs(infoPtr->idA()) > 100;
1691  bool beamBisHadron = abs(infoPtr->idB()) > 100;
1692  bool isGammaGamma = infoPtr->idA() == 22 && infoPtr->idB() == 22;
1693  bool isGammaHadron = (infoPtr->idA() == 22 && beamBisHadron)
1694  || (infoPtr->idB() == 22 && beamAisHadron);
1695 
1696  // Check if photon beams present.
1697  int idAbsA = abs(infoPtr->idA());
1698  int idAbsB = abs(infoPtr->idB());
1699  bool hasGammaA = hasGamma && (idAbsA == 11 || idAbsA == 13 || idAbsA == 15);
1700  bool hasGammaB = hasGamma && (idAbsB == 11 || idAbsB == 13 || idAbsB == 15);
1701  bool gammaA = hasGammaA || idAbsA == 22;
1702  bool gammaB = hasGammaB || idAbsB == 22;
1703 
1704  // Initialize necessary amount of processes with initiating photons.
1705  // When no photon beams initialize one instance (initGammaB == true).
1706  bool initGammaA = gammaA && (photonMode == 0 || photonMode == 3);
1707  bool initGammaB = !(isGammaGamma || hasGamma || isGammaHadron)
1708  || ( (photonMode == 0 || photonMode == 2) && gammaB);
1709 
1710  // Set up requested objects for photon-parton processes.
1711  // In case of unresolved photons insert process with correct initiator.
1712  if (photonParton || settings.flag("PhotonParton:ggm2qqbar")) {
1713  if ( initGammaB ) {
1714  sigmaPtr = new Sigma2ggm2qqbar(1, 271, "ggm");
1715  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1716  }
1717  if ( initGammaA ) {
1718  sigmaPtr = new Sigma2ggm2qqbar(1, 281, "gmg");
1719  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1720  }
1721  }
1722  if (photonParton || settings.flag("PhotonParton:ggm2ccbar")) {
1723  if ( initGammaB ) {
1724  sigmaPtr = new Sigma2ggm2qqbar(4, 272, "ggm");
1725  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1726  }
1727  if ( initGammaA) {
1728  sigmaPtr = new Sigma2ggm2qqbar(4, 282, "gmg");
1729  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1730  }
1731  }
1732  if (photonParton || settings.flag("PhotonParton:ggm2bbbar")) {
1733  if ( initGammaB ) {
1734  sigmaPtr = new Sigma2ggm2qqbar(5, 273, "ggm");
1735  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1736  }
1737  if ( initGammaA ) {
1738  sigmaPtr = new Sigma2ggm2qqbar(5, 283, "gmg");
1739  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1740  }
1741  }
1742  if (photonParton || settings.flag("PhotonParton:qgm2qg")) {
1743  if ( initGammaB ) {
1744  sigmaPtr = new Sigma2qgm2qg(274, "qgm");
1745  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1746  }
1747  if ( initGammaA ) {
1748  sigmaPtr = new Sigma2qgm2qg(284, "gmq");
1749  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1750  }
1751  }
1752  if (settings.flag("PhotonParton:qgm2qgm")) {
1753  if ( initGammaB ) {
1754  sigmaPtr = new Sigma2qgm2qgm(275, "qgm");
1755  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1756  }
1757  if ( initGammaA ) {
1758  sigmaPtr = new Sigma2qgm2qgm(285, "gmq");
1759  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1760  }
1761  }
1762 
1763  // Set up requested objects for onia production.
1764  charmonium = SigmaOniaSetup(infoPtr, &settings, particleDataPtr, 4);
1765  bottomonium = SigmaOniaSetup(infoPtr, &settings, particleDataPtr, 5);
1766  vector<SigmaProcess*> charmoniumSigmaPtrs, bottomoniumSigmaPtrs;
1767  charmonium.setupSigma2gg(charmoniumSigmaPtrs);
1768  charmonium.setupSigma2qg(charmoniumSigmaPtrs);
1769  charmonium.setupSigma2qq(charmoniumSigmaPtrs);
1770  charmonium.setupSigma2dbl(charmoniumSigmaPtrs);
1771  bottomonium.setupSigma2gg(bottomoniumSigmaPtrs);
1772  bottomonium.setupSigma2qg(bottomoniumSigmaPtrs);
1773  bottomonium.setupSigma2qq(bottomoniumSigmaPtrs);
1774  bottomonium.setupSigma2dbl(bottomoniumSigmaPtrs);
1775  for (unsigned int i = 0; i < charmoniumSigmaPtrs.size(); ++i)
1776  containerPtrs.push_back( new ProcessContainer(charmoniumSigmaPtrs[i]) );
1777  for (unsigned int i = 0; i < bottomoniumSigmaPtrs.size(); ++i)
1778  containerPtrs.push_back( new ProcessContainer(bottomoniumSigmaPtrs[i]) );
1779 
1780  // Set up requested objects for top production.
1781  bool tops = settings.flag("Top:all");
1782  if (tops || settings.flag("Top:gg2ttbar")) {
1783  sigmaPtr = new Sigma2gg2QQbar(6, 601);
1784  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1785  }
1786  if (tops || settings.flag("Top:qqbar2ttbar")) {
1787  sigmaPtr = new Sigma2qqbar2QQbar(6, 602);
1788  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1789  }
1790  if (tops || settings.flag("Top:qq2tq(t:W)")) {
1791  sigmaPtr = new Sigma2qq2QqtW(6, 603);
1792  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1793  }
1794  if (tops || settings.flag("Top:ffbar2ttbar(s:gmZ)")) {
1795  sigmaPtr = new Sigma2ffbar2FFbarsgmZ(6, 604);
1796  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1797  }
1798  if (tops || settings.flag("Top:ffbar2tqbar(s:W)")) {
1799  sigmaPtr = new Sigma2ffbar2FfbarsW(6, 0, 605);
1800  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1801  }
1802  if (tops || settings.flag("Top:gmgm2ttbar")) {
1803  sigmaPtr = new Sigma2gmgm2ffbar(6, 606);
1804  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1805  }
1806 
1807  // Set up requested objects for fourth-generation b' production
1808  bool bPrimes = settings.flag("FourthBottom:all");
1809  if (bPrimes || settings.flag("FourthBottom:gg2bPrimebPrimebar")) {
1810  sigmaPtr = new Sigma2gg2QQbar(7, 801);
1811  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1812  }
1813  if (bPrimes || settings.flag("FourthBottom:qqbar2bPrimebPrimebar")) {
1814  sigmaPtr = new Sigma2qqbar2QQbar(7, 802);
1815  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1816  }
1817  if (bPrimes || settings.flag("FourthBottom:qq2bPrimeq(t:W)")) {
1818  sigmaPtr = new Sigma2qq2QqtW(7, 803);
1819  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1820  }
1821  if (bPrimes || settings.flag("FourthBottom:ffbar2bPrimebPrimebar(s:gmZ)")) {
1822  sigmaPtr = new Sigma2ffbar2FFbarsgmZ(7, 804);
1823  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1824  }
1825  if (bPrimes || settings.flag("FourthBottom:ffbar2bPrimeqbar(s:W)")) {
1826  sigmaPtr = new Sigma2ffbar2FfbarsW(7, 0, 805);
1827  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1828  }
1829  if (bPrimes || settings.flag("FourthBottom:ffbar2bPrimetbar(s:W)")) {
1830  sigmaPtr = new Sigma2ffbar2FfbarsW(7, 6, 806);
1831  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1832  }
1833 
1834  // Set up requested objects for fourth-generation t' production
1835  bool tPrimes = settings.flag("FourthTop:all");
1836  if (tPrimes || settings.flag("FourthTop:gg2tPrimetPrimebar")) {
1837  sigmaPtr = new Sigma2gg2QQbar(8, 821);
1838  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1839  }
1840  if (tPrimes || settings.flag("FourthTop:qqbar2tPrimetPrimebar")) {
1841  sigmaPtr = new Sigma2qqbar2QQbar(8, 822);
1842  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1843  }
1844  if (tPrimes || settings.flag("FourthTop:qq2tPrimeq(t:W)")) {
1845  sigmaPtr = new Sigma2qq2QqtW(8, 823);
1846  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1847  }
1848  if (tPrimes || settings.flag("FourthTop:ffbar2tPrimetPrimebar(s:gmZ)")) {
1849  sigmaPtr = new Sigma2ffbar2FFbarsgmZ(8, 824);
1850  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1851  }
1852  if (tPrimes || settings.flag("FourthTop:ffbar2tPrimeqbar(s:W)")) {
1853  sigmaPtr = new Sigma2ffbar2FfbarsW(8, 0, 825);
1854  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1855  }
1856 
1857  // Set up requested objects for two different fourth-generation fermions.
1858  if (bPrimes || tPrimes
1859  || settings.flag("FourthPair:ffbar2tPrimebPrimebar(s:W)")) {
1860  sigmaPtr = new Sigma2ffbar2FfbarsW(8, 7, 841);
1861  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1862  }
1863  if (settings.flag("FourthPair:ffbar2tauPrimenuPrimebar(s:W)")) {
1864  sigmaPtr = new Sigma2ffbar2FfbarsW(17, 18, 842);
1865  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1866  }
1867 
1868  // Flag for global choice between SM and BSM Higgses.
1869  bool useBSMHiggses = settings.flag("Higgs:useBSM");
1870 
1871  // Set up requested objects for Standard-Model Higgs production.
1872  if (!useBSMHiggses) {
1873  bool HiggsesSM = settings.flag("HiggsSM:all");
1874  if (HiggsesSM || settings.flag("HiggsSM:ffbar2H")) {
1875  sigmaPtr = new Sigma1ffbar2H(0);
1876  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1877  }
1878  if (HiggsesSM || settings.flag("HiggsSM:gg2H")) {
1879  sigmaPtr = new Sigma1gg2H(0);
1880  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1881  }
1882  if (HiggsesSM || settings.flag("HiggsSM:gmgm2H")) {
1883  sigmaPtr = new Sigma1gmgm2H(0);
1884  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1885  }
1886  if (HiggsesSM || settings.flag("HiggsSM:ffbar2HZ")) {
1887  sigmaPtr = new Sigma2ffbar2HZ(0);
1888  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1889  }
1890  if (HiggsesSM || settings.flag("HiggsSM:ffbar2HW")) {
1891  sigmaPtr = new Sigma2ffbar2HW(0);
1892  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1893  }
1894  if (HiggsesSM || settings.flag("HiggsSM:ff2Hff(t:ZZ)")) {
1895  sigmaPtr = new Sigma3ff2HfftZZ(0);
1896  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1897  }
1898  if (HiggsesSM || settings.flag("HiggsSM:ff2Hff(t:WW)")) {
1899  sigmaPtr = new Sigma3ff2HfftWW(0);
1900  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1901  }
1902  if (HiggsesSM || settings.flag("HiggsSM:gg2Httbar")) {
1903  sigmaPtr = new Sigma3gg2HQQbar(6,0);
1904  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1905  }
1906  if (HiggsesSM || settings.flag("HiggsSM:qqbar2Httbar")) {
1907  sigmaPtr = new Sigma3qqbar2HQQbar(6,0);
1908  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1909  }
1910 
1911  // Further Standard-Model Higgs processes, not included in "all".
1912  if (settings.flag("HiggsSM:qg2Hq")) {
1913  sigmaPtr = new Sigma2qg2Hq(4,0);
1914  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1915  sigmaPtr = new Sigma2qg2Hq(5,0);
1916  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1917  }
1918  if (settings.flag("HiggsSM:gg2Hbbbar")) {
1919  sigmaPtr = new Sigma3gg2HQQbar(5,0);
1920  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1921  }
1922  if (settings.flag("HiggsSM:qqbar2Hbbbar")) {
1923  sigmaPtr = new Sigma3qqbar2HQQbar(5,0);
1924  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1925  }
1926  if (settings.flag("HiggsSM:gg2Hg(l:t)")) {
1927  sigmaPtr = new Sigma2gg2Hglt(0);
1928  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1929  }
1930  if (settings.flag("HiggsSM:qg2Hq(l:t)")) {
1931  sigmaPtr = new Sigma2qg2Hqlt(0);
1932  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1933  }
1934  if (settings.flag("HiggsSM:qqbar2Hg(l:t)")) {
1935  sigmaPtr = new Sigma2qqbar2Hglt(0);
1936  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1937  }
1938  }
1939 
1940  // Common switch for the group of Higgs production BSM.
1941  if (useBSMHiggses) {
1942  bool HiggsesBSM = settings.flag("HiggsBSM:all");
1943 
1944  // Set up requested objects for BSM H1 production.
1945  bool HiggsesH1 = settings.flag("HiggsBSM:allH1");
1946  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:ffbar2H1")) {
1947  sigmaPtr = new Sigma1ffbar2H(1);
1948  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1949  }
1950  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:gg2H1")) {
1951  sigmaPtr = new Sigma1gg2H(1);
1952  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1953  }
1954  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:gmgm2H1")) {
1955  sigmaPtr = new Sigma1gmgm2H(1);
1956  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1957  }
1958  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:ffbar2H1Z")) {
1959  sigmaPtr = new Sigma2ffbar2HZ(1);
1960  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1961  }
1962  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:ffbar2H1W")) {
1963  sigmaPtr = new Sigma2ffbar2HW(1);
1964  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1965  }
1966  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:ff2H1ff(t:ZZ)")) {
1967  sigmaPtr = new Sigma3ff2HfftZZ(1);
1968  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1969  }
1970  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:ff2H1ff(t:WW)")) {
1971  sigmaPtr = new Sigma3ff2HfftWW(1);
1972  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1973  }
1974  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:gg2H1ttbar")) {
1975  sigmaPtr = new Sigma3gg2HQQbar(6,1);
1976  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1977  }
1978  if (HiggsesBSM || HiggsesH1 || settings.flag("HiggsBSM:qqbar2H1ttbar")) {
1979  sigmaPtr = new Sigma3qqbar2HQQbar(6,1);
1980  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1981  }
1982 
1983  // Further BSM H1 processes, not included in "all".
1984  if (settings.flag("HiggsBSM:qg2H1q")) {
1985  sigmaPtr = new Sigma2qg2Hq(4,1);
1986  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1987  sigmaPtr = new Sigma2qg2Hq(5,1);
1988  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1989  }
1990  if (settings.flag("HiggsBSM:gg2H1bbbar")) {
1991  sigmaPtr = new Sigma3gg2HQQbar(5,1);
1992  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1993  }
1994  if (settings.flag("HiggsBSM:qqbar2H1bbbar")) {
1995  sigmaPtr = new Sigma3qqbar2HQQbar(5,1);
1996  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
1997  }
1998  if (settings.flag("HiggsBSM:gg2H1g(l:t)")) {
1999  sigmaPtr = new Sigma2gg2Hglt(1);
2000  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2001  }
2002  if (settings.flag("HiggsBSM:qg2H1q(l:t)")) {
2003  sigmaPtr = new Sigma2qg2Hqlt(1);
2004  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2005  }
2006  if (settings.flag("HiggsBSM:qqbar2H1g(l:t)")) {
2007  sigmaPtr = new Sigma2qqbar2Hglt(1);
2008  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2009  }
2010 
2011  // Set up requested objects for BSM H2 production.
2012  bool HiggsesH2 = settings.flag("HiggsBSM:allH2");
2013  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:ffbar2H2")) {
2014  sigmaPtr = new Sigma1ffbar2H(2);
2015  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2016  }
2017  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:gg2H2")) {
2018  sigmaPtr = new Sigma1gg2H(2);
2019  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2020  }
2021  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:gmgm2H2")) {
2022  sigmaPtr = new Sigma1gmgm2H(2);
2023  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2024  }
2025  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:ffbar2H2Z")) {
2026  sigmaPtr = new Sigma2ffbar2HZ(2);
2027  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2028  }
2029  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:ffbar2H2W")) {
2030  sigmaPtr = new Sigma2ffbar2HW(2);
2031  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2032  }
2033  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:ff2H2ff(t:ZZ)")) {
2034  sigmaPtr = new Sigma3ff2HfftZZ(2);
2035  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2036  }
2037  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:ff2H2ff(t:WW)")) {
2038  sigmaPtr = new Sigma3ff2HfftWW(2);
2039  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2040  }
2041  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:gg2H2ttbar")) {
2042  sigmaPtr = new Sigma3gg2HQQbar(6,2);
2043  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2044  }
2045  if (HiggsesBSM || HiggsesH2 || settings.flag("HiggsBSM:qqbar2H2ttbar")) {
2046  sigmaPtr = new Sigma3qqbar2HQQbar(6,2);
2047  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2048  }
2049 
2050  // Further BSM H2 processes, not included in "all".
2051  if (settings.flag("HiggsBSM:qg2H2q")) {
2052  sigmaPtr = new Sigma2qg2Hq(4,2);
2053  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2054  sigmaPtr = new Sigma2qg2Hq(5,2);
2055  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2056  }
2057  if (settings.flag("HiggsBSM:gg2H2bbbar")) {
2058  sigmaPtr = new Sigma3gg2HQQbar(5,2);
2059  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2060  }
2061  if (settings.flag("HiggsBSM:qqbar2H2bbbar")) {
2062  sigmaPtr = new Sigma3qqbar2HQQbar(5,2);
2063  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2064  }
2065  if (settings.flag("HiggsBSM:gg2H2g(l:t)")) {
2066  sigmaPtr = new Sigma2gg2Hglt(2);
2067  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2068  }
2069  if (settings.flag("HiggsBSM:qg2H2q(l:t)")) {
2070  sigmaPtr = new Sigma2qg2Hqlt(2);
2071  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2072  }
2073  if (settings.flag("HiggsBSM:qqbar2H2g(l:t)")) {
2074  sigmaPtr = new Sigma2qqbar2Hglt(2);
2075  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2076  }
2077 
2078  // Set up requested objects for BSM A3 production.
2079  bool HiggsesA3 = settings.flag("HiggsBSM:allA3");
2080  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:ffbar2A3")) {
2081  sigmaPtr = new Sigma1ffbar2H(3);
2082  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2083  }
2084  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:gg2A3")) {
2085  sigmaPtr = new Sigma1gg2H(3);
2086  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2087  }
2088  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:gmgm2A3")) {
2089  sigmaPtr = new Sigma1gmgm2H(3);
2090  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2091  }
2092  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:ffbar2A3Z")) {
2093  sigmaPtr = new Sigma2ffbar2HZ(3);
2094  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2095  }
2096  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:ffbar2A3W")) {
2097  sigmaPtr = new Sigma2ffbar2HW(3);
2098  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2099  }
2100  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:ff2A3ff(t:ZZ)")) {
2101  sigmaPtr = new Sigma3ff2HfftZZ(3);
2102  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2103  }
2104  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:ff2A3ff(t:WW)")) {
2105  sigmaPtr = new Sigma3ff2HfftWW(3);
2106  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2107  }
2108  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:gg2A3ttbar")) {
2109  sigmaPtr = new Sigma3gg2HQQbar(6,3);
2110  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2111  }
2112  if (HiggsesBSM || HiggsesA3 || settings.flag("HiggsBSM:qqbar2A3ttbar")) {
2113  sigmaPtr = new Sigma3qqbar2HQQbar(6,3);
2114  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2115  }
2116 
2117  // Further BSM A3 processes, not included in "all".
2118  if (settings.flag("HiggsBSM:qg2A3q")) {
2119  sigmaPtr = new Sigma2qg2Hq(4,3);
2120  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2121  sigmaPtr = new Sigma2qg2Hq(5,3);
2122  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2123  }
2124  if (settings.flag("HiggsBSM:gg2A3bbbar")) {
2125  sigmaPtr = new Sigma3gg2HQQbar(5,3);
2126  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2127  }
2128  if (settings.flag("HiggsBSM:qqbar2A3bbbar")) {
2129  sigmaPtr = new Sigma3qqbar2HQQbar(5,3);
2130  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2131  }
2132  if (settings.flag("HiggsBSM:gg2A3g(l:t)")) {
2133  sigmaPtr = new Sigma2gg2Hglt(3);
2134  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2135  }
2136  if (settings.flag("HiggsBSM:qg2A3q(l:t)")) {
2137  sigmaPtr = new Sigma2qg2Hqlt(3);
2138  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2139  }
2140  if (settings.flag("HiggsBSM:qqbar2A3g(l:t)")) {
2141  sigmaPtr = new Sigma2qqbar2Hglt(3);
2142  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2143  }
2144 
2145  // Set up requested objects for Charged Higgs production
2146  bool HiggsesChg = settings.flag("HiggsBSM:allH+-");
2147  if (HiggsesBSM || HiggsesChg || settings.flag("HiggsBSM:ffbar2H+-")) {
2148  sigmaPtr = new Sigma1ffbar2Hchg;
2149  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2150  }
2151  if (HiggsesBSM || HiggsesChg || settings.flag("HiggsBSM:bg2H+-t")) {
2152  sigmaPtr = new Sigma2qg2Hchgq(6, 1062, "b g -> H+- t");
2153  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2154  }
2155 
2156  // Set up requested objects for Higgs pair-production
2157  bool HiggsesPairs = settings.flag("HiggsBSM:allHpair");
2158  if (HiggsesBSM || HiggsesPairs || settings.flag("HiggsBSM:ffbar2A3H1")) {
2159  sigmaPtr = new Sigma2ffbar2A3H12(1);
2160  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2161  }
2162  if (HiggsesBSM || HiggsesPairs || settings.flag("HiggsBSM:ffbar2A3H2")) {
2163  sigmaPtr = new Sigma2ffbar2A3H12(2);
2164  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2165  }
2166  if (HiggsesBSM || HiggsesPairs || settings.flag("HiggsBSM:ffbar2H+-H1")) {
2167  sigmaPtr = new Sigma2ffbar2HchgH12(1);
2168  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2169  }
2170  if (HiggsesBSM || HiggsesPairs || settings.flag("HiggsBSM:ffbar2H+-H2")) {
2171  sigmaPtr = new Sigma2ffbar2HchgH12(2);
2172  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2173  }
2174  if (HiggsesBSM || HiggsesPairs || settings.flag("HiggsBSM:ffbar2H+H-")) {
2175  sigmaPtr = new Sigma2ffbar2HposHneg();
2176  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2177  }
2178  }
2179 
2180  // Set up requested objects for SUSY pair processes.
2181  if (couplings->isSUSY) {
2182  CoupSUSY* coupSUSY = (CoupSUSY *) couplings;
2183 
2184  bool SUSYs = settings.flag("SUSY:all");
2185  bool nmssm = settings.flag("SLHA:NMSSM");
2186 
2187  // Preselected SUSY codes.
2188  setupIdVecs( settings);
2189 
2190  // MSSM: 4 neutralinos
2191  int nNeut = 4;
2192  if (nmssm) nNeut = 5;
2193 
2194  // Gluino-gluino
2195  if (SUSYs || settings.flag("SUSY:gg2gluinogluino")) {
2196  // Skip if outgoing codes not asked for
2197  if (allowIdVals( 1000021, 1000021)) {
2198  sigmaPtr = new Sigma2gg2gluinogluino();
2199  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2200  }
2201  }
2202  if (SUSYs || settings.flag("SUSY:qqbar2gluinogluino")) {
2203  // Skip if outgoing codes not asked for
2204  if (allowIdVals( 1000021, 1000021)) {
2205  sigmaPtr = new Sigma2qqbar2gluinogluino();
2206  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2207  }
2208  }
2209 
2210  // Gluino-squark
2211  if (SUSYs || settings.flag("SUSY:qg2squarkgluino")) {
2212  int iproc = 1202;
2213  for (int idx = 1; idx <= 6; ++idx) {
2214  for (int iso = 1; iso <= 2; ++iso) {
2215  iproc += 2;
2216  int id3 = iso + ((idx <= 3)
2217  ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2218  int id4 = 1000021;
2219  // Skip if outgoing codes not asked for
2220  if (!allowIdVals( id3, id4)) continue;
2221  sigmaPtr = new Sigma2qg2squarkgluino(id3,iproc-1);
2222  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2223  sigmaPtr = new Sigma2qg2squarkgluino(-id3,iproc);
2224  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2225  }
2226  }
2227  }
2228 
2229  // Squark-antisquark (gg initiated)
2230  if (SUSYs || settings.flag("SUSY:gg2squarkantisquark")) {
2231  int iproc = 1214;
2232  for (int idx = 1; idx <= 6; ++idx) {
2233  for (int iso = 1; iso <= 2; ++iso) {
2234  iproc++;
2235  int id = iso + ((idx <= 3)
2236  ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2237  // Skip if outgoing codes not asked for
2238  if (!allowIdVals( id, id)) continue;
2239  sigmaPtr = new Sigma2gg2squarkantisquark(id,iproc);
2240  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2241  }
2242  }
2243  }
2244 
2245  // Squark-antisquark (qqbar initiated)
2246  if (SUSYs || settings.flag("SUSY:qqbar2squarkantisquark")) {
2247  int iproc = 1230;
2248  for (int idx = 1; idx <= 6; ++idx) {
2249  for (int iso = 1; iso <= 2; ++iso) {
2250  for (int jso = iso; jso >= 1; --jso) {
2251  for (int jdx = 1; jdx <= 6; ++jdx) {
2252  if (iso == jso && jdx < idx) continue;
2253  int id1 = iso + ((idx <= 3) ? 1000000+2*(idx-1)
2254  : 2000000+2*(idx-4));
2255  int id2 = jso + ((jdx <= 3) ? 1000000+2*(jdx-1)
2256  : 2000000+2*(jdx-4));
2257  // Update process number counter (for ~q~q, +2 if not self-conj)
2258  //if (iproc == 1302) iproc=1310;
2259  iproc++;
2260  if (iso == jso && id1 != id2) iproc++;
2261  // Skip if outgoing codes not asked for
2262  if (!allowIdVals( id1, id2)) continue;
2263  if (iso == jso && id1 != id2) {
2264  sigmaPtr = new Sigma2qqbar2squarkantisquark(id1,-id2,iproc-1);
2265  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2266  sigmaPtr = new Sigma2qqbar2squarkantisquark(id2,-id1,iproc);
2267  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2268  } else {
2269  sigmaPtr = new Sigma2qqbar2squarkantisquark(id1,-id2,iproc);
2270  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2271  }
2272  }
2273  }
2274  }
2275  }
2276  }
2277 
2278  // Squark-squark
2279  if (SUSYs || settings.flag("SUSY:qq2squarksquark")) {
2280  int iproc = 1350;
2281  for (int idx = 1; idx <= 6; ++idx) {
2282  for (int iso = 1; iso <= 2; ++iso) {
2283  for (int jso = iso; jso >= 1; jso--) {
2284  for (int jdx = 1; jdx <= 6; ++jdx) {
2285  if (iso == jso && jdx < idx) continue;
2286  iproc++;
2287  int id1 = iso + ((idx <= 3)
2288  ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2289  int id2 = jso + ((jdx <= 3)
2290  ? 1000000+2*(jdx-1) : 2000000+2*(jdx-4));
2291  // Skip if outgoing codes not asked for.
2292  if (!allowIdVals( id1, id2)) continue;
2293  sigmaPtr = new Sigma2qq2squarksquark(id1,id2,iproc);
2294  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2295  }
2296  }
2297  }
2298  }
2299  }
2300 
2301  // Neutralino + squark
2302  if (SUSYs || settings.flag("SUSY:qg2chi0squark")) {
2303  int iproc = 1430;
2304  for (int iNeut= 1; iNeut <= nNeut; iNeut++) {
2305  for (int idx = 1; idx <= 6; idx++) {
2306  bool isUp = false;
2307  for (int iso = 1; iso <= 2; iso++) {
2308  if (iso == 2) isUp = true;
2309  iproc++;
2310  int id3 = coupSUSY->idNeut(iNeut);
2311  int id4 = iso + ((idx <= 3)
2312  ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2313  // Skip if outgoing codes not asked for
2314  if (!allowIdVals( id3, id4)) continue;
2315  sigmaPtr = new Sigma2qg2chi0squark(iNeut,idx,isUp,iproc);
2316  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2317  }
2318  }
2319  }
2320  }
2321 
2322  // Chargino + squark
2323  if (SUSYs || settings.flag("SUSY:qg2chi+-squark")) {
2324  int iproc = 1490;
2325  for (int iChar = 1; iChar <= 2; iChar++) {
2326  for (int idx = 1; idx <= 6; idx++) {
2327  bool isUp = false;
2328  for (int iso = 1; iso <= 2; iso++) {
2329  if (iso == 2) isUp = true;
2330  iproc++;
2331  int id3 = coupSUSY->idChar(iChar);
2332  int id4 = iso + ((idx <= 3)
2333  ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2334  // Skip if outgoing codes not asked for
2335  if (!allowIdVals( id3, id4)) continue;
2336  sigmaPtr = new Sigma2qg2charsquark(iChar,idx,isUp,iproc);
2337  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2338  }
2339  }
2340  }
2341  }
2342 
2343  // Neutralino pairs
2344  if (SUSYs || settings.flag("SUSY:qqbar2chi0chi0")) {
2345  int iproc = 1550;
2346  for (int iNeut2 = 1; iNeut2 <= nNeut; iNeut2++) {
2347  for (int iNeut1 = 1; iNeut1 <= iNeut2; iNeut1++) {
2348  iproc++;
2349  // Skip if outgoing codes not asked for
2350  if (!allowIdVals( coupSUSY->idNeut(iNeut1),
2351  coupSUSY->idNeut(iNeut2) ) ) continue;
2352  sigmaPtr = new Sigma2qqbar2chi0chi0(iNeut1, iNeut2,iproc);
2353  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2354  }
2355  }
2356  }
2357 
2358  // Neutralino-Chargino
2359  if (SUSYs || settings.flag("SUSY:qqbar2chi+-chi0")) {
2360  int iproc = 1570;
2361  for (int iNeut = 1; iNeut <= nNeut; iNeut++) {
2362  for (int iChar = 1; iChar <= 2; ++iChar) {
2363  iproc += 2;
2364  // Skip if outgoing codes not asked for
2365  if (!allowIdVals( coupSUSY->idNeut(iNeut),
2366  coupSUSY->idChar(iChar) ) ) continue;
2367  sigmaPtr = new Sigma2qqbar2charchi0( iChar, iNeut, iproc-1);
2368  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2369  sigmaPtr = new Sigma2qqbar2charchi0(-iChar, iNeut, iproc);
2370  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2371  }
2372  }
2373  }
2374 
2375  // Chargino-Chargino
2376  if (SUSYs || settings.flag("SUSY:qqbar2chi+chi-")) {
2377  int iproc = 1590;
2378  for (int i = 1; i <= 2; ++i) {
2379  for (int j = 1; j <= 2; ++j) {
2380  iproc++;
2381  // Skip if outgoing codes not asked for
2382  if (!allowIdVals( coupSUSY->idChar(i),
2383  coupSUSY->idChar(j) ) ) continue;
2384  sigmaPtr = new Sigma2qqbar2charchar( i,-j, iproc);
2385  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2386  }
2387  }
2388  }
2389 
2390  // RPV squark production
2391  if(SUSYs || settings.flag("SUSY:qq2antisquark")) {
2392  for (int idx = 1; idx <= 6; ++idx) {
2393  for (int iso = 1; iso <= 2; ++iso) {
2394  int id1 = iso + ((idx <= 3) ? 1000000+2*(idx-1) : 2000000+2*(idx-4));
2395  // Skip if outgoing code not asked for
2396  if (!allowIdVals( id1, 0)) continue;
2397  sigmaPtr = new Sigma1qq2antisquark(id1);
2398  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2399  }
2400  }
2401  }
2402 
2403  // Neutralino-gluino
2404  if (SUSYs || settings.flag("SUSY:qqbar2chi0gluino")) {
2405  int iproc = 1600;
2406  for (int iNeut = 1; iNeut <= nNeut; iNeut++) {
2407  iproc++;
2408  // Skip if outgoing codes not asked for
2409  if (!allowIdVals( coupSUSY->idNeut(iNeut), 1000021)) continue;
2410  sigmaPtr = new Sigma2qqbar2chi0gluino(iNeut, iproc);
2411  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2412  }
2413  }
2414 
2415  // Chargino-Gluino
2416  if (SUSYs || settings.flag("SUSY:qqbar2chi+-gluino")) {
2417  int iproc = 1620;
2418  for (int iChar = 1; iChar <= 2; ++iChar) {
2419  iproc += 2;
2420  // Skip if outgoing codes not asked for
2421  if (!allowIdVals( coupSUSY->idChar(iChar), 1000021)) continue;
2422  sigmaPtr = new Sigma2qqbar2chargluino( iChar, iproc-1);
2423  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2424  sigmaPtr = new Sigma2qqbar2chargluino( -iChar, iproc);
2425  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2426 
2427  }
2428  }
2429 
2430  // Slepton-antislepton (qqbar initiated); Currently no RH sneutrinos
2431  if (SUSYs || settings.flag("SUSY:qqbar2sleptonantislepton")) {
2432  int iproc = 1650;
2433  for (int idx = 1; idx <= 6; ++idx) {
2434  for (int iso = 1; iso <= 2; ++iso) {
2435  for (int jso = iso; jso >= 1; --jso) {
2436  for (int jdx = 1; jdx <= 6; ++jdx) {
2437  if (iso == jso && jdx < idx) continue;
2438  int id1 = iso + ((idx <= 3) ? 1000010+2*(idx-1)
2439  : 2000010+2*(idx-4));
2440  int id2 = jso + ((jdx <= 3) ? 1000010+2*(jdx-1)
2441  : 2000010+2*(jdx-4));
2442  // Update process number counter
2443  iproc++;
2444  if (iso == jso && id1 != id2) iproc++;
2445  // Exclude RH neutrinos from allowed final states
2446  if (abs(id1) >= 2000012 && id1 % 2 == 0) continue;
2447  if (abs(id2) >= 2000012 && id2 % 2 == 0) continue;
2448  // Skip if outgoing codes not asked for
2449  if (!allowIdVals( id1, id2)) continue;
2450  if (iso == jso && id1 != id2) {
2451  sigmaPtr
2452  = new Sigma2qqbar2sleptonantislepton(id1,-id2,iproc-1);
2453  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2454  sigmaPtr = new Sigma2qqbar2sleptonantislepton(id2,-id1,iproc);
2455  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2456  } else {
2457  sigmaPtr = new Sigma2qqbar2sleptonantislepton(id1,-id2,iproc);
2458  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2459  }
2460  }
2461  }
2462  }
2463  }
2464  }
2465 
2466  } // End of SUSY processes.
2467 
2468  // Set up requested objects for New-Gauge-Boson processes.
2469  if (settings.flag("NewGaugeBoson:ffbar2gmZZprime")) {
2470  sigmaPtr = new Sigma1ffbar2gmZZprime();
2471  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2472  }
2473  if (settings.flag("NewGaugeBoson:ffbar2Wprime")) {
2474  sigmaPtr = new Sigma1ffbar2Wprime();
2475  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2476  }
2477  if (settings.flag("NewGaugeBoson:ffbar2R0")) {
2478  sigmaPtr = new Sigma1ffbar2Rhorizontal();
2479  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2480  }
2481 
2482  // Set up requested objects for Left-Right-Symmetry processes.
2483  bool leftrights = settings.flag("LeftRightSymmmetry:all");
2484  if (leftrights || settings.flag("LeftRightSymmmetry:ffbar2ZR")) {
2485  sigmaPtr = new Sigma1ffbar2ZRight();
2486  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2487  }
2488  if (leftrights || settings.flag("LeftRightSymmmetry:ffbar2WR")) {
2489  sigmaPtr = new Sigma1ffbar2WRight();
2490  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2491  }
2492  if (leftrights || settings.flag("LeftRightSymmmetry:ll2HL")) {
2493  sigmaPtr = new Sigma1ll2Hchgchg(1);
2494  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2495  }
2496  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HLe")) {
2497  sigmaPtr = new Sigma2lgm2Hchgchgl(1, 11);
2498  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2499  }
2500  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HLmu")) {
2501  sigmaPtr = new Sigma2lgm2Hchgchgl(1, 13);
2502  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2503  }
2504  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HLtau")) {
2505  sigmaPtr = new Sigma2lgm2Hchgchgl(1, 15);
2506  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2507  }
2508  if (leftrights || settings.flag("LeftRightSymmmetry:ff2HLff")) {
2509  sigmaPtr = new Sigma3ff2HchgchgfftWW(1);
2510  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2511  }
2512  if (leftrights || settings.flag("LeftRightSymmmetry:ffbar2HLHL")) {
2513  sigmaPtr = new Sigma2ffbar2HchgchgHchgchg(1);
2514  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2515  }
2516  if (leftrights || settings.flag("LeftRightSymmmetry:ll2HR")) {
2517  sigmaPtr = new Sigma1ll2Hchgchg(2);
2518  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2519  }
2520  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HRe")) {
2521  sigmaPtr = new Sigma2lgm2Hchgchgl(2, 11);
2522  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2523  }
2524  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HRmu")) {
2525  sigmaPtr = new Sigma2lgm2Hchgchgl(2, 13);
2526  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2527  }
2528  if (leftrights || settings.flag("LeftRightSymmmetry:lgm2HRtau")) {
2529  sigmaPtr = new Sigma2lgm2Hchgchgl(2, 15);
2530  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2531  }
2532  if (leftrights || settings.flag("LeftRightSymmmetry:ff2HRff")) {
2533  sigmaPtr = new Sigma3ff2HchgchgfftWW(2);
2534  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2535  }
2536  if (leftrights || settings.flag("LeftRightSymmmetry:ffbar2HRHR")) {
2537  sigmaPtr = new Sigma2ffbar2HchgchgHchgchg(2);
2538  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2539  }
2540 
2541  // Set up requested objects for leptoquark LQ processes.
2542  bool leptoquarks = settings.flag("LeptoQuark:all");
2543  if (leptoquarks || settings.flag("LeptoQuark:ql2LQ")) {
2544  sigmaPtr = new Sigma1ql2LeptoQuark;
2545  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2546  }
2547  if (leptoquarks || settings.flag("LeptoQuark:qg2LQl")) {
2548  sigmaPtr = new Sigma2qg2LeptoQuarkl;
2549  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2550  }
2551  if (leptoquarks || settings.flag("LeptoQuark:gg2LQLQbar")) {
2552  sigmaPtr = new Sigma2gg2LQLQbar;
2553  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2554  }
2555  if (leptoquarks || settings.flag("LeptoQuark:qqbar2LQLQbar")) {
2556  sigmaPtr = new Sigma2qqbar2LQLQbar;
2557  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2558  }
2559 
2560  // Set up requested objects for excited-fermion processes.
2561  bool excitedfermions = settings.flag("ExcitedFermion:all");
2562  if (excitedfermions || settings.flag("ExcitedFermion:dg2dStar")) {
2563  sigmaPtr = new Sigma1qg2qStar(1);
2564  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2565  }
2566  if (excitedfermions || settings.flag("ExcitedFermion:ug2uStar")) {
2567  sigmaPtr = new Sigma1qg2qStar(2);
2568  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2569  }
2570  if (excitedfermions || settings.flag("ExcitedFermion:sg2sStar")) {
2571  sigmaPtr = new Sigma1qg2qStar(3);
2572  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2573  }
2574  if (excitedfermions || settings.flag("ExcitedFermion:cg2cStar")) {
2575  sigmaPtr = new Sigma1qg2qStar(4);
2576  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2577  }
2578  if (excitedfermions || settings.flag("ExcitedFermion:bg2bStar")) {
2579  sigmaPtr = new Sigma1qg2qStar(5);
2580  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2581  }
2582  if (excitedfermions || settings.flag("ExcitedFermion:egm2eStar")) {
2583  sigmaPtr = new Sigma1lgm2lStar(11);
2584  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2585  }
2586  if (excitedfermions || settings.flag("ExcitedFermion:mugm2muStar")) {
2587  sigmaPtr = new Sigma1lgm2lStar(13);
2588  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2589  }
2590  if (excitedfermions || settings.flag("ExcitedFermion:taugm2tauStar")) {
2591  sigmaPtr = new Sigma1lgm2lStar(15);
2592  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2593  }
2594  if (excitedfermions || settings.flag("ExcitedFermion:qq2dStarq")) {
2595  sigmaPtr = new Sigma2qq2qStarq(1);
2596  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2597  }
2598  if (excitedfermions || settings.flag("ExcitedFermion:qq2uStarq")) {
2599  sigmaPtr = new Sigma2qq2qStarq(2);
2600  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2601  }
2602  if (excitedfermions || settings.flag("ExcitedFermion:qq2sStarq")) {
2603  sigmaPtr = new Sigma2qq2qStarq(3);
2604  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2605  }
2606  if (excitedfermions || settings.flag("ExcitedFermion:qq2cStarq")) {
2607  sigmaPtr = new Sigma2qq2qStarq(4);
2608  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2609  }
2610  if (excitedfermions || settings.flag("ExcitedFermion:qq2bStarq")) {
2611  sigmaPtr = new Sigma2qq2qStarq(5);
2612  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2613  }
2614  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2eStare")) {
2615  sigmaPtr = new Sigma2qqbar2lStarlbar(11);
2616  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2617  }
2618  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2nueStarnue")) {
2619  sigmaPtr = new Sigma2qqbar2lStarlbar(12);
2620  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2621  }
2622  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2muStarmu")) {
2623  sigmaPtr = new Sigma2qqbar2lStarlbar(13);
2624  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2625  }
2626  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2numuStarnumu")) {
2627  sigmaPtr = new Sigma2qqbar2lStarlbar(14);
2628  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2629  }
2630  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2tauStartau")) {
2631  sigmaPtr = new Sigma2qqbar2lStarlbar(15);
2632  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2633  }
2634  if (excitedfermions
2635  || settings.flag("ExcitedFermion:qqbar2nutauStarnutau")) {
2636  sigmaPtr = new Sigma2qqbar2lStarlbar(16);
2637  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2638  }
2639  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2eStareStar")) {
2640  sigmaPtr = new Sigma2qqbar2lStarlStarBar(11);
2641  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2642  }
2643  if (excitedfermions
2644  || settings.flag("ExcitedFermion:qqbar2nueStarnueStar")) {
2645  sigmaPtr = new Sigma2qqbar2lStarlStarBar(12);
2646  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2647  }
2648  if (excitedfermions || settings.flag("ExcitedFermion:qqbar2muStarmuStar")) {
2649  sigmaPtr = new Sigma2qqbar2lStarlStarBar(13);
2650  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2651  }
2652  if (excitedfermions
2653  || settings.flag("ExcitedFermion:qqbar2numuStarnumuStar")) {
2654  sigmaPtr = new Sigma2qqbar2lStarlStarBar(14);
2655  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2656  }
2657  if (excitedfermions
2658  || settings.flag("ExcitedFermion:qqbar2tauStartauStar")) {
2659  sigmaPtr = new Sigma2qqbar2lStarlStarBar(15);
2660  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2661  }
2662  if (excitedfermions
2663  || settings.flag("ExcitedFermion:qqbar2nutauStarnutauStar")) {
2664  sigmaPtr = new Sigma2qqbar2lStarlStarBar(16);
2665  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2666  }
2667 
2668  // Set up requested objects for contact interaction processes.
2669  if (settings.flag("ContactInteractions:QCqq2qq")) {
2670  sigmaPtr = new Sigma2QCqq2qq();
2671  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2672  }
2673  if (settings.flag("ContactInteractions:QCqqbar2qqbar")) {
2674  sigmaPtr = new Sigma2QCqqbar2qqbar();
2675  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2676  }
2677  if (settings.flag("ContactInteractions:QCffbar2eebar")) {
2678  sigmaPtr = new Sigma2QCffbar2llbar(11, 4203);
2679  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2680  }
2681  if (settings.flag("ContactInteractions:QCffbar2mumubar")) {
2682  sigmaPtr = new Sigma2QCffbar2llbar(13, 4204);
2683  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2684  }
2685  if (settings.flag("ContactInteractions:QCffbar2tautaubar")) {
2686  sigmaPtr = new Sigma2QCffbar2llbar(15, 4205);
2687  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2688  }
2689 
2690  // Set spin of particles in the Hidden Valley scenario.
2691  int spinFv = settings.mode("HiddenValley:spinFv");
2692  for (int i = 1; i < 7; ++i) {
2693  if (particleDataPtr->spinType( 4900000 + i) != spinFv + 1)
2694  particleDataPtr->spinType( 4900000 + i, spinFv + 1);
2695  if (particleDataPtr->spinType( 4900010 + i) != spinFv + 1)
2696  particleDataPtr->spinType( 4900010 + i, spinFv + 1);
2697  }
2698  if (spinFv != 1) {
2699  if (particleDataPtr->spinType( 4900101) != 2)
2700  particleDataPtr->spinType( 4900101, 2);
2701  } else {
2702  int spinqv = settings.mode("HiddenValley:spinqv");
2703  if (particleDataPtr->spinType( 4900101) != 2 * spinqv + 1)
2704  particleDataPtr->spinType( 4900101, 2 * spinqv + 1);
2705  }
2706 
2707  // Set up requested objects for HiddenValley processes.
2708  bool hiddenvalleys = settings.flag("HiddenValley:all");
2709  if (hiddenvalleys || settings.flag("HiddenValley:gg2DvDvbar")) {
2710  sigmaPtr = new Sigma2gg2qGqGbar( 4900001, 4901, spinFv,
2711  "g g -> Dv Dvbar");
2712  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2713  }
2714  if (hiddenvalleys || settings.flag("HiddenValley:gg2UvUvbar")) {
2715  sigmaPtr = new Sigma2gg2qGqGbar( 4900002, 4902, spinFv,
2716  "g g -> Uv Uvbar");
2717  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2718  }
2719  if (hiddenvalleys || settings.flag("HiddenValley:gg2SvSvbar")) {
2720  sigmaPtr = new Sigma2gg2qGqGbar( 4900003, 4903, spinFv,
2721  "g g -> Sv Svbar");
2722  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2723  }
2724  if (hiddenvalleys || settings.flag("HiddenValley:gg2CvCvbar")) {
2725  sigmaPtr = new Sigma2gg2qGqGbar( 4900004, 4904, spinFv,
2726  "g g -> Cv Cvbar");
2727  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2728  }
2729  if (hiddenvalleys || settings.flag("HiddenValley:gg2BvBvbar")) {
2730  sigmaPtr = new Sigma2gg2qGqGbar( 4900005, 4905, spinFv,
2731  "g g -> Bv Bvbar");
2732  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2733  }
2734  if (hiddenvalleys || settings.flag("HiddenValley:gg2TvTvbar")) {
2735  sigmaPtr = new Sigma2gg2qGqGbar( 4900006, 4906, spinFv,
2736  "g g -> Tv Tvbar");
2737  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2738  }
2739  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2DvDvbar")) {
2740  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900001, 4911, spinFv,
2741  "q qbar -> Dv Dvbar");
2742  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2743  }
2744  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2UvUvbar")) {
2745  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900002, 4912, spinFv,
2746  "q qbar -> Uv Uvbar");
2747  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2748  }
2749  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2SvSvbar")) {
2750  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900003, 4913, spinFv,
2751  "q qbar -> Sv Svbar");
2752  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2753  }
2754  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2CvCvbar")) {
2755  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900004, 4914, spinFv,
2756  "q qbar -> Cv Cvbar");
2757  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2758  }
2759  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2BvBvbar")) {
2760  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900005, 4915, spinFv,
2761  "q qbar -> Bv Bvbar");
2762  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2763  }
2764  if (hiddenvalleys || settings.flag("HiddenValley:qqbar2TvTvbar")) {
2765  sigmaPtr = new Sigma2qqbar2qGqGbar( 4900006, 4916, spinFv,
2766  "q qbar -> Tv Tvbar");
2767  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2768  }
2769  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2DvDvbar")) {
2770  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900001, 4921, spinFv,
2771  "f fbar -> Dv Dvbar");
2772  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2773  }
2774  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2UvUvbar")) {
2775  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900002, 4922, spinFv,
2776  "f fbar -> Uv Uvbar");
2777  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2778  }
2779  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2SvSvbar")) {
2780  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900003, 4923, spinFv,
2781  "f fbar -> Sv Svbar");
2782  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2783  }
2784  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2CvCvbar")) {
2785  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900004, 4924, spinFv,
2786  "f fbar -> Cv Cvbar");
2787  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2788  }
2789  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2BvBvbar")) {
2790  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900005, 4925, spinFv,
2791  "f fbar -> Bv Bvbar");
2792  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2793  }
2794  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2TvTvbar")) {
2795  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900006, 4926, spinFv,
2796  "f fbar -> Tv Tvbar");
2797  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2798  }
2799  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2EvEvbar")) {
2800  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900011, 4931, spinFv,
2801  "f fbar -> Ev Evbar");
2802  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2803  }
2804  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2nuEvnuEvbar")) {
2805  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900012, 4932, spinFv,
2806  "f fbar -> nuEv nuEvbar");
2807  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2808  }
2809  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2MUvMUvbar")) {
2810  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900013, 4933, spinFv,
2811  "f fbar -> MUv MUvbar");
2812  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2813  }
2814  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2nuMUvnuMUvbar")) {
2815  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900014, 4934, spinFv,
2816  "f fbar -> nuMUv nuMUvbar");
2817  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2818  }
2819  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2TAUvTAUvbar")) {
2820  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900015, 4935, spinFv,
2821  "f fbar -> TAUv TAUvbar");
2822  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2823  }
2824  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2nuTAUvnuTAUvbar")) {
2825  sigmaPtr = new Sigma2ffbar2fGfGbar( 4900016, 4936, spinFv,
2826  "f fbar -> nuTAUv nuTAUvbar");
2827  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2828  }
2829  if (hiddenvalleys || settings.flag("HiddenValley:ffbar2Zv")) {
2830  sigmaPtr = new Sigma1ffbar2Zv();
2831  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2832  }
2833 
2834  // Set up requested objects for RS extra-dimensional G* processes.
2835  bool extraDimGstars = settings.flag("ExtraDimensionsG*:all");
2836  if (extraDimGstars || settings.flag("ExtraDimensionsG*:gg2G*")) {
2837  sigmaPtr = new Sigma1gg2GravitonStar;
2838  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2839  }
2840  if (extraDimGstars || settings.flag("ExtraDimensionsG*:ffbar2G*")) {
2841  sigmaPtr = new Sigma1ffbar2GravitonStar;
2842  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2843  }
2844  if (settings.flag("ExtraDimensionsG*:gg2G*g")) {
2845  sigmaPtr = new Sigma2gg2GravitonStarg;
2846  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2847  }
2848  if (settings.flag("ExtraDimensionsG*:qg2G*q")) {
2849  sigmaPtr = new Sigma2qg2GravitonStarq;
2850  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2851  }
2852  if (settings.flag("ExtraDimensionsG*:qqbar2G*g")) {
2853  sigmaPtr = new Sigma2qqbar2GravitonStarg;
2854  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2855  }
2856 
2857  // Set up requested objects for RS extra-dimensional KKgluon processes.
2858  if (settings.flag("ExtraDimensionsG*:qqbar2KKgluon*")) {
2859  sigmaPtr = new Sigma1qqbar2KKgluonStar;
2860  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2861  }
2862 
2863  // NOAM: Set up requested objects for TEV extra-dimensional processes.
2864  if (settings.flag("ExtraDimensionsTEV:ffbar2ddbar")) {
2865  sigmaPtr = new Sigma2ffbar2TEVffbar(1, 5061);
2866  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2867  }
2868  if (settings.flag("ExtraDimensionsTEV:ffbar2uubar")) {
2869  sigmaPtr = new Sigma2ffbar2TEVffbar(2, 5062);
2870  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2871  }
2872  if (settings.flag("ExtraDimensionsTEV:ffbar2ssbar")) {
2873  sigmaPtr = new Sigma2ffbar2TEVffbar(3, 5063);
2874  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2875  }
2876  if (settings.flag("ExtraDimensionsTEV:ffbar2ccbar")) {
2877  sigmaPtr = new Sigma2ffbar2TEVffbar(4, 5064);
2878  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2879  }
2880  if (settings.flag("ExtraDimensionsTEV:ffbar2bbbar")) {
2881  sigmaPtr = new Sigma2ffbar2TEVffbar(5, 5065);
2882  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2883  }
2884  if (settings.flag("ExtraDimensionsTEV:ffbar2ttbar")) {
2885  sigmaPtr = new Sigma2ffbar2TEVffbar(6, 5066);
2886  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2887  }
2888  if (settings.flag("ExtraDimensionsTEV:ffbar2e+e-")) {
2889  sigmaPtr = new Sigma2ffbar2TEVffbar(11, 5071);
2890  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2891  }
2892  if (settings.flag("ExtraDimensionsTEV:ffbar2nuenuebar")) {
2893  sigmaPtr = new Sigma2ffbar2TEVffbar(12, 5072);
2894  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2895  }
2896  if (settings.flag("ExtraDimensionsTEV:ffbar2mu+mu-")) {
2897  sigmaPtr = new Sigma2ffbar2TEVffbar(13, 5073);
2898  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2899  }
2900  if (settings.flag("ExtraDimensionsTEV:ffbar2numunumubar")) {
2901  sigmaPtr = new Sigma2ffbar2TEVffbar(14, 5074);
2902  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2903  }
2904  if (settings.flag("ExtraDimensionsTEV:ffbar2tau+tau-")) {
2905  sigmaPtr = new Sigma2ffbar2TEVffbar(15, 5075);
2906  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2907  }
2908  if (settings.flag("ExtraDimensionsTEV:ffbar2nutaunutaubar")) {
2909  sigmaPtr = new Sigma2ffbar2TEVffbar(16, 5076);
2910  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2911  }
2912 
2913  // Set up requested objects for large extra-dimensional G processes.
2914  bool extraDimLEDmono = settings.flag("ExtraDimensionsLED:monojet");
2915  if (extraDimLEDmono || settings.flag("ExtraDimensionsLED:gg2Gg")) {
2916  sigmaPtr = new Sigma2gg2LEDUnparticleg( true );
2917  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2918  }
2919  if (extraDimLEDmono || settings.flag("ExtraDimensionsLED:qg2Gq")) {
2920  sigmaPtr = new Sigma2qg2LEDUnparticleq( true );
2921  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2922  }
2923  if (extraDimLEDmono || settings.flag("ExtraDimensionsLED:qqbar2Gg")) {
2924  sigmaPtr = new Sigma2qqbar2LEDUnparticleg( true );
2925  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2926  }
2927  if (settings.flag("ExtraDimensionsLED:ffbar2GZ")) {
2928  sigmaPtr = new Sigma2ffbar2LEDUnparticleZ( true );
2929  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2930  }
2931  if (settings.flag("ExtraDimensionsLED:ffbar2Ggamma")) {
2932  sigmaPtr = new Sigma2ffbar2LEDUnparticlegamma( true );
2933  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2934  }
2935  if (settings.flag("ExtraDimensionsLED:ffbar2gammagamma")) {
2936  sigmaPtr = new Sigma2ffbar2LEDgammagamma( true );
2937  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2938  }
2939  if (settings.flag("ExtraDimensionsLED:gg2gammagamma")) {
2940  sigmaPtr = new Sigma2gg2LEDgammagamma( true );
2941  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2942  }
2943  if (settings.flag("ExtraDimensionsLED:ffbar2llbar")) {
2944  sigmaPtr = new Sigma2ffbar2LEDllbar( true );
2945  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2946  }
2947  if (settings.flag("ExtraDimensionsLED:gg2llbar")) {
2948  sigmaPtr = new Sigma2gg2LEDllbar( true );
2949  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2950  }
2951  bool extraDimLEDdij = settings.flag("ExtraDimensionsLED:dijets");
2952  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:gg2DJgg")) {
2953  sigmaPtr = new Sigma2gg2LEDgg;
2954  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2955  }
2956  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:gg2DJqqbar")) {
2957  sigmaPtr = new Sigma2gg2LEDqqbar;
2958  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2959  }
2960  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:qg2DJqg")) {
2961  sigmaPtr = new Sigma2qg2LEDqg;
2962  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2963  }
2964  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:qq2DJqq")) {
2965  sigmaPtr = new Sigma2qq2LEDqq;
2966  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2967  }
2968  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:qqbar2DJgg")) {
2969  sigmaPtr = new Sigma2qqbar2LEDgg;
2970  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2971  }
2972  if (extraDimLEDdij || settings.flag("ExtraDimensionsLED:qqbar2DJqqbarNew")) {
2973  sigmaPtr = new Sigma2qqbar2LEDqqbarNew;
2974  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2975  }
2976 
2977  // Set up requested objects for unparticle processes.
2978  bool extraDimUnpartmono = settings.flag("ExtraDimensionsUnpart:monojet");
2979  if (extraDimUnpartmono || settings.flag("ExtraDimensionsUnpart:gg2Ug")) {
2980  sigmaPtr = new Sigma2gg2LEDUnparticleg( false );
2981  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2982  }
2983  if (extraDimUnpartmono || settings.flag("ExtraDimensionsUnpart:qg2Uq")) {
2984  sigmaPtr = new Sigma2qg2LEDUnparticleq( false );
2985  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2986  }
2987  if (extraDimUnpartmono || settings.flag("ExtraDimensionsUnpart:qqbar2Ug")) {
2988  sigmaPtr = new Sigma2qqbar2LEDUnparticleg( false );
2989  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2990  }
2991  if (settings.flag("ExtraDimensionsUnpart:ffbar2UZ")) {
2992  sigmaPtr = new Sigma2ffbar2LEDUnparticleZ( false );
2993  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2994  }
2995  if (settings.flag("ExtraDimensionsUnpart:ffbar2Ugamma")) {
2996  sigmaPtr = new Sigma2ffbar2LEDUnparticlegamma( false );
2997  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
2998  }
2999  if (settings.flag("ExtraDimensionsUnpart:ffbar2gammagamma")) {
3000  sigmaPtr = new Sigma2ffbar2LEDgammagamma( false );
3001  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3002  }
3003  if (settings.flag("ExtraDimensionsUnpart:gg2gammagamma")) {
3004  sigmaPtr = new Sigma2gg2LEDgammagamma( false );
3005  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3006  }
3007  if (settings.flag("ExtraDimensionsUnpart:ffbar2llbar")) {
3008  sigmaPtr = new Sigma2ffbar2LEDllbar( false );
3009  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3010  }
3011  if (settings.flag("ExtraDimensionsUnpart:gg2llbar")) {
3012  sigmaPtr = new Sigma2gg2LEDllbar( false );
3013  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3014  }
3015 
3016  // Set up requested objects for Dark Matter processes.
3017  if (settings.flag("DM:ffbar2Zp2XX")) {
3018  sigmaPtr = new Sigma1ffbar2Zp2XX();
3019  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3020  }
3021  if (settings.flag("DM:ffbar2Zp2XXj")) {
3022  sigmaPtr = new Sigma2qqbar2Zpg2XXj();
3023  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3024  }
3025  if (settings.flag("DM:ffbar2ZpH")) {
3026  sigmaPtr = new Sigma2ffbar2ZpH();
3027  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3028  }
3029  if (settings.flag("DM:gg2S2XX")) {
3030  sigmaPtr = new Sigma1gg2S2XX();
3031  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3032  }
3033  if (settings.flag("DM:gg2S2XXj")) {
3034  sigmaPtr = new Sigma2gg2Sg2XXj();
3035  containerPtrs.push_back( new ProcessContainer(sigmaPtr) );
3036  }
3037 
3038  // Done.
3039  return true;
3040 
3041 }
3042 
3043 //--------------------------------------------------------------------------
3044 
3045 // Routine to initialize list of second hard processes.
3046 
3047 bool SetupContainers::init2(vector<ProcessContainer*>& container2Ptrs,
3048  Settings& settings) {
3049 
3050  // Reset process list, if filled in previous subrun.
3051  if (container2Ptrs.size() > 0) {
3052  for (int i = 0; i < int(container2Ptrs.size()); ++i)
3053  delete container2Ptrs[i];
3054  container2Ptrs.clear();
3055  }
3056  SigmaProcess* sigmaPtr;
3057 
3058  // Two hard QCD jets.
3059  if (settings.flag("SecondHard:TwoJets")) {
3060  sigmaPtr = new Sigma2gg2gg;
3061  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3062  sigmaPtr = new Sigma2gg2qqbar;
3063  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3064  sigmaPtr = new Sigma2qg2qg;
3065  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3066  sigmaPtr = new Sigma2qq2qq;
3067  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3068  sigmaPtr = new Sigma2qqbar2gg;
3069  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3070  sigmaPtr = new Sigma2qqbar2qqbarNew;
3071  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3072  sigmaPtr = new Sigma2gg2QQbar(4, 121);
3073  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3074  sigmaPtr = new Sigma2qqbar2QQbar(4, 122);
3075  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3076  sigmaPtr = new Sigma2gg2QQbar(5, 123);
3077  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3078  sigmaPtr = new Sigma2qqbar2QQbar(5, 124);
3079  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3080  }
3081 
3082  // A prompt photon and a hard jet.
3083  if (settings.flag("SecondHard:PhotonAndJet")) {
3084  sigmaPtr = new Sigma2qg2qgamma;
3085  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3086  sigmaPtr = new Sigma2qqbar2ggamma;
3087  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3088  sigmaPtr = new Sigma2gg2ggamma;
3089  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3090  }
3091 
3092  // Two prompt photons.
3093  if (settings.flag("SecondHard:TwoPhotons")) {
3094  sigmaPtr = new Sigma2ffbar2gammagamma;
3095  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3096  sigmaPtr = new Sigma2gg2gammagamma;
3097  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3098  }
3099 
3100  // Charmonium.
3101  if (settings.flag("SecondHard:Charmonium")) {
3102  vector<SigmaProcess*> charmoniumSigmaPtrs;
3103  charmonium.setupSigma2gg(charmoniumSigmaPtrs, true);
3104  charmonium.setupSigma2qg(charmoniumSigmaPtrs, true);
3105  charmonium.setupSigma2qq(charmoniumSigmaPtrs, true);
3106  for (unsigned int i = 0; i < charmoniumSigmaPtrs.size(); ++i)
3107  container2Ptrs.push_back( new ProcessContainer(charmoniumSigmaPtrs[i]));
3108  }
3109 
3110  // Bottomonium.
3111  if (settings.flag("SecondHard:Bottomonium")) {
3112  vector<SigmaProcess*> bottomoniumSigmaPtrs;
3113  bottomonium.setupSigma2gg(bottomoniumSigmaPtrs, true);
3114  bottomonium.setupSigma2qg(bottomoniumSigmaPtrs, true);
3115  bottomonium.setupSigma2qq(bottomoniumSigmaPtrs, true);
3116  for (unsigned int i = 0; i < bottomoniumSigmaPtrs.size(); ++i)
3117  container2Ptrs.push_back( new ProcessContainer(bottomoniumSigmaPtrs[i]));
3118  }
3119 
3120  // A single gamma*/Z0.
3121  if (settings.flag("SecondHard:SingleGmZ")) {
3122  sigmaPtr = new Sigma1ffbar2gmZ;
3123  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3124  }
3125 
3126  // A single W+-.
3127  if (settings.flag("SecondHard:SingleW")) {
3128  sigmaPtr = new Sigma1ffbar2W;
3129  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3130  }
3131 
3132  // A gamma*/Z0 and a hard jet.
3133  if (settings.flag("SecondHard:GmZAndJet")) {
3134  sigmaPtr = new Sigma2qqbar2gmZg;
3135  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3136  sigmaPtr = new Sigma2qg2gmZq;
3137  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3138  }
3139 
3140  // A W+- and a hard jet.
3141  if (settings.flag("SecondHard:WAndJet")) {
3142  sigmaPtr = new Sigma2qqbar2Wg;
3143  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3144  sigmaPtr = new Sigma2qg2Wq;
3145  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3146  }
3147 
3148  // Top pair production.
3149  if (settings.flag("SecondHard:TopPair")) {
3150  sigmaPtr = new Sigma2gg2QQbar(6, 601);
3151  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3152  sigmaPtr = new Sigma2qqbar2QQbar(6, 602);
3153  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3154  sigmaPtr = new Sigma2ffbar2FFbarsgmZ(6, 604);
3155  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3156  }
3157 
3158  // Single top production.
3159  if (settings.flag("SecondHard:SingleTop")) {
3160  sigmaPtr = new Sigma2qq2QqtW(6, 603);
3161  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3162  sigmaPtr = new Sigma2ffbar2FfbarsW(6, 0, 605);
3163  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3164  }
3165 
3166  // Two b jets - already part of TwoJets sample above.
3167  if (settings.flag("SecondHard:TwoBJets")) {
3168  sigmaPtr = new Sigma2gg2QQbar(5, 123);
3169  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3170  sigmaPtr = new Sigma2qqbar2QQbar(5, 124);
3171  container2Ptrs.push_back( new ProcessContainer(sigmaPtr) );
3172  }
3173 
3174  // Done.
3175  return true;
3176 
3177 }
3178 
3179 //--------------------------------------------------------------------------
3180 
3181 // Set up arrays of allowed outgoing SUSY particles.
3182 
3183 void SetupContainers::setupIdVecs( Settings& settings) {
3184 
3185  // First array either none, one or many particles.
3186  idVecA.resize(0);
3187  if (settings.mode("SUSY:idA") != 0) {
3188  idVecA.push_back( abs(settings.mode("SUSY:idA")) );
3189  } else {
3190  vector<int> idTmpA = settings.mvec("SUSY:idVecA");
3191  for (int i = 0; i < int(idTmpA.size()); ++i)
3192  if (idTmpA[i] != 0) idVecA.push_back( abs(idTmpA[i]) );
3193  }
3194  nVecA = idVecA.size();
3195 
3196  // Second array either none, one or many particles.
3197  idVecB.resize(0);
3198  if (settings.mode("SUSY:idB") != 0) {
3199  idVecB.push_back( abs(settings.mode("SUSY:idB")) );
3200  } else {
3201  vector<int> idTmpB = settings.mvec("SUSY:idVecB");
3202  for (int i = 0; i < int(idTmpB.size()); ++i)
3203  if (idTmpB[i] != 0) idVecB.push_back( abs(idTmpB[i]) );
3204  }
3205  nVecB = idVecB.size();
3206 
3207 }
3208 
3209 //--------------------------------------------------------------------------
3210 
3211 // Check final state for allowed outgoing SUSY particles.
3212 // Normally check two codes, but allow for only one.
3213 
3214 bool SetupContainers::allowIdVals( int idCheck1, int idCheck2) {
3215 
3216  // If empty arrays or id's no need for checks. Else need absolute values.
3217  if (nVecA == 0 && nVecB == 0) return true;
3218  if (idCheck1 == 0 && idCheck2 == 0) return true;
3219  int idChk1 = abs(idCheck1);
3220  int idChk2 = abs(idCheck2);
3221 
3222  // If only one outgoing particle then check idVecA and idVecB.
3223  if (idChk1 == 0) swap(idChk1, idChk2);
3224  if (idChk2 == 0) {
3225  for (int i = 0; i < nVecA; ++i) if (idChk1 == idVecA[i]) return true;
3226  for (int i = 0; i < nVecB; ++i) if (idChk1 == idVecB[i]) return true;
3227  return false;
3228  }
3229 
3230  // If empty array idVecB then compare with idVecA.
3231  if (nVecB == 0) {
3232  for (int i = 0; i < nVecA; ++i)
3233  if (idChk1 == idVecA[i] || idChk2 == idVecA[i]) return true;
3234  return false;
3235  }
3236 
3237  // If empty array idVecA then compare with idVecB.
3238  if (nVecA == 0) {
3239  for (int i = 0; i < nVecB; ++i)
3240  if (idChk1 == idVecB[i] || idChk2 == idVecB[i]) return true;
3241  return false;
3242  }
3243 
3244  // Else check that pair matches allowed combinations.
3245  for (int i = 0; i < nVecA; ++i)
3246  for (int j = 0; j < nVecB; ++j)
3247  if ( (idChk1 == idVecA[i] && idChk2 == idVecB[j])
3248  || (idChk2 == idVecA[i] && idChk1 == idVecB[j]) ) return true;
3249  return false;
3250 
3251 }
3252 
3253 //==========================================================================
3254 
3255 } // end namespace Pythia8
Definition: AgUStep.h:26