StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PhaseSpace.h
1 // PhaseSpace.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2014 Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Header file for phase space generators in kinematics selection.
7 // PhaseSpace: base class for phase space generators.
8 // Base class for derived classes> 2 ->1 , 2 -> 2, 2 -> 2 elastic/diffractive,
9 // 2 -> 2 nondiffractive, 2 -> 3, Les Houches.
10 
11 #ifndef Pythia8_PhaseSpace_H
12 #define Pythia8_PhaseSpace_H
13 
14 #include "Pythia8/Basics.h"
15 #include "Pythia8/BeamParticle.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/LesHouches.h"
18 #include "Pythia8/MultipartonInteractions.h"
19 #include "Pythia8/ParticleData.h"
20 #include "Pythia8/PartonDistributions.h"
21 #include "Pythia8/PythiaStdlib.h"
22 #include "Pythia8/SigmaProcess.h"
23 #include "Pythia8/SigmaTotal.h"
24 #include "Pythia8/Settings.h"
25 #include "Pythia8/StandardModel.h"
26 #include "Pythia8/UserHooks.h"
27 
28 namespace Pythia8 {
29 
30 //==========================================================================
31 
32 // Forward reference to the UserHooks class.
33 class UserHooks;
34 
35 //==========================================================================
36 
37 // PhaseSpace is a base class for phase space generators
38 // used in the selection of hard-process kinematics.
39 
40 class PhaseSpace {
41 
42 public:
43 
44  // Destructor.
45  virtual ~PhaseSpace() {}
46 
47  // Perform simple initialization and store pointers.
48  void init(bool isFirst, SigmaProcess* sigmaProcessPtrIn,
49  Info* infoPtrIn, Settings* settingsPtrIn, ParticleData* particleDataPtrIn,
50  Rndm* rndmPtrIn, BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
51  Couplings* couplingsPtrIn, SigmaTotal* sigmaTotPtrIn,
52  UserHooks* userHooksPtrIn);
53 
54  // Update the CM energy of the event.
55  void newECM(double eCMin) {eCM = eCMin; s = eCM * eCM;}
56 
57  // Store or replace Les Houches pointer.
58  void setLHAPtr(LHAup* lhaUpPtrIn) {lhaUpPtr = lhaUpPtrIn;}
59 
60  // A pure virtual method, wherein an optimization procedure
61  // is used to determine how phase space should be sampled.
62  virtual bool setupSampling() = 0;
63 
64  // A pure virtual method, wherein a trial event kinematics
65  // is to be selected in the derived class.
66  virtual bool trialKin(bool inEvent = true, bool repeatSame = false) = 0;
67 
68  // A pure virtual method, wherein the accepted event kinematics
69  // is to be constructed in the derived class.
70  virtual bool finalKin() = 0;
71 
72  // Allow for nonisotropic decays when ME's available.
73  void decayKinematics( Event& process);
74 
75  // Give back current or maximum cross section, or set latter.
76  double sigmaNow() const {return sigmaNw;}
77  double sigmaMax() const {return sigmaMx;}
78  double biasSelectionWeight() const {return biasWt;}
79  bool newSigmaMax() const {return newSigmaMx;}
80  void setSigmaMax(double sigmaMaxIn) {sigmaMx = sigmaMaxIn;}
81 
82  // For Les Houches with negative event weight needs
83  virtual double sigmaSumSigned() const {return sigmaMx;}
84 
85  // Give back constructed four-vectors and known masses.
86  Vec4 p(int i) const {return pH[i];}
87  double m(int i) const {return mH[i];}
88 
89  // Give back other event properties.
90  double ecm() const {return eCM;}
91  double x1() const {return x1H;}
92  double x2() const {return x2H;}
93  double sHat() const {return sH;}
94  double tHat() const {return tH;}
95  double uHat() const {return uH;}
96  double pTHat() const {return pTH;}
97  double thetaHat() const {return theta;}
98  double phiHat() const {return phi;}
99  double runBW3() const {return runBW3H;}
100  double runBW4() const {return runBW4H;}
101  double runBW5() const {return runBW5H;}
102 
103  // Inform whether beam particles are resolved in partons or scatter directly.
104  virtual bool isResolved() const {return true;}
105 
106 protected:
107 
108  // Constructor.
109  PhaseSpace() {}
110 
111  // Constants: could only be changed in the code itself.
112  static const int NMAXTRY, NTRY3BODY;
113  static const double SAFETYMARGIN, TINY, EVENFRAC, SAMESIGMA, WIDTHMARGIN,
114  SAMEMASS, MASSMARGIN, EXTRABWWTMAX, THRESHOLDSIZE,
115  THRESHOLDSTEP, YRANGEMARGIN, LEPTONXMIN, LEPTONXMAX,
116  LEPTONXLOGMIN, LEPTONXLOGMAX, LEPTONTAUMIN,
117  SHATMINZ, PT2RATMINZ, WTCORRECTION[11];
118 
119  // MBR constants: form factor appoximation with two exponents.
120  static const double FFA1, FFA2,FFB1, FFB2;
121 
122  // Pointer to cross section.
123  SigmaProcess* sigmaProcessPtr;
124 
125  // Pointer to various information on the generation.
126  Info* infoPtr;
127 
128  // Pointer to the settings database.
129  Settings* settingsPtr;
130 
131  // Pointer to the particle data table.
132  ParticleData* particleDataPtr;
133 
134  // Pointer to the random number generator.
135  Rndm* rndmPtr;
136 
137  // Pointers to incoming beams.
138  BeamParticle* beamAPtr;
139  BeamParticle* beamBPtr;
140 
141  // Pointer to Standard Model couplings.
142  Couplings* couplingsPtr;
143 
144  // Pointer to the total/elastic/diffractive cross section object.
145  SigmaTotal* sigmaTotPtr;
146 
147  // Pointer to userHooks object for user interaction with program.
148  UserHooks* userHooksPtr;
149 
150  // Pointer to LHAup for generating external events.
151  LHAup* lhaUpPtr;
152 
153  // Initialization data, normally only set once.
154  bool useBreitWigners, doEnergySpread, showSearch, showViolation,
155  increaseMaximum;
156  int gmZmodeGlobal;
157  double mHatGlobalMin, mHatGlobalMax, pTHatGlobalMin, pTHatGlobalMax,
158  pTHatMinDiverge, minWidthBreitWigners, mRecalculate;
159 
160  // Information on incoming beams.
161  int idA, idB;
162  double mA, mB, eCM, s;
163  bool hasLeptonBeams, hasPointLeptons;
164 
165  // Cross section information.
166  bool newSigmaMx, canModifySigma, canBiasSelection, canBias2Sel;
167  int gmZmode;
168  double bias2SelPow, bias2SelRef, wtBW, sigmaNw, sigmaMx, sigmaPos,
169  sigmaNeg, biasWt;
170 
171  // Process-specific kinematics properties, almost always available.
172  double mHatMin, mHatMax, sHatMin, sHatMax, pTHatMin, pTHatMax,
173  pT2HatMin, pT2HatMax;
174 
175  // Event-specific kinematics properties, almost always available.
176  double x1H, x2H, m3, m4, m5, s3, s4, s5, mHat, sH, tH, uH, pAbs, p2Abs,
177  pTH, theta, phi, betaZ;
178  Vec4 pH[6];
179  double mH[6];
180 
181  // Reselect decay products momenta isotropically in phase space.
182  void decayKinematicsStep( Event& process, int iRes);
183 
184  // Much common code for normal 2 -> 1, 2 -> 2 and 2 -> 3 cases:
185 
186  // Determine how phase space should be sampled.
187  void setup3Body();
188  bool setupSampling123(bool is2, bool is3, ostream& os = cout);
189 
190  // Select a trial kinematics phase space point.
191  bool trialKin123(bool is2, bool is3, bool inEvent = true,
192  ostream& os = cout);
193 
194  // Presence and properties of any s-channel resonances.
195  int idResA, idResB;
196  double mResA, mResB, GammaResA, GammaResB, tauResA, tauResB, widResA,
197  widResB;
198  bool sameResMass;
199 
200  // Kinematics properties specific to 2 -> 1/2/3.
201  bool useMirrorWeight;
202  double tau, y, z, tauMin, tauMax, yMax, zMin, zMax, ratio34, unity34,
203  zNeg, zPos, wtTau, wtY, wtZ, wt3Body, runBW3H, runBW4H, runBW5H,
204  intTau0, intTau1, intTau2, intTau3, intTau4, intTau5, intTau6,
205  intY0, intY12, intY34, intY56, mTchan1, sTchan1, mTchan2, sTchan2,
206  frac3Flat, frac3Pow1, frac3Pow2;
207  Vec4 p3cm, p4cm, p5cm;
208 
209  // Coefficients for optimized selection in 2 -> 1/2/3.
210  int nTau, nY, nZ;
211  double tauCoef[8], yCoef[8], zCoef[8], tauCoefSum[8], yCoefSum[8],
212  zCoefSum[8];
213 
214  // Calculate kinematical limits for 2 -> 1/2/3.
215  bool limitTau(bool is2, bool is3);
216  bool limitY();
217  bool limitZ();
218 
219  // Select kinematical variable between defined limits for 2 -> 1/2/3.
220  void selectTau(int iTau, double tauVal, bool is2);
221  void selectY(int iY, double yVal);
222  void selectZ(int iZ, double zVal);
223  bool select3Body();
224 
225  // Solve equation system for better phase space coefficients in 2 -> 1/2/3.
226  void solveSys( int n, int bin[8], double vec[8], double mat[8][8],
227  double coef[8], ostream& os = cout);
228 
229  // Properties specific to resonance mass selection in 2 -> 2 and 2 -> 3.
230  bool useBW[6];
231  int idMass[6];
232  double mPeak[6], sPeak[6], mWidth[6], mMin[6], mMax[6], mw[6], wmRat[6],
233  mLower[6], mUpper[6], sLower[6], sUpper[6], fracFlat[6], fracInv[6],
234  fracInv2[6], atanLower[6], atanUpper[6], intBW[6], intFlat[6],
235  intInv[6], intInv2[6];
236 
237  // Setup mass selection for one resonance at a time. Split in two parts.
238  void setupMass1(int iM);
239  void setupMass2(int iM, double distToThresh);
240 
241  // Do mass selection and find the associated weight.
242  void trialMass(int iM);
243  double weightMass(int iM);
244 
245  // The error function erf(x) should normally be in your math library,
246  // but if not uncomment this simple parametrization by Sergei Winitzki.
247  //double erf(double x) { double x2 = x * x; double kx2 = 0.147 * x2;
248  // double tmp = sqrt(1. - exp(-x2 * (4./M_PI + kx2) / (1. + kx2)));
249  // return ((x >= 0.) ? tmp : -tmp); }
250 
251 };
252 
253 //==========================================================================
254 
255 // A derived class with 2 -> 1 kinematics set up in tau, y.
256 
257 class PhaseSpace2to1tauy : public PhaseSpace {
258 
259 public:
260 
261  // Constructor.
262  PhaseSpace2to1tauy() {}
263 
264  // Optimize subsequent kinematics selection.
265  virtual bool setupSampling() {if (!setupMass()) return false;
266  return setupSampling123(false, false);}
267 
268  // Construct the trial kinematics.
269  virtual bool trialKin(bool inEvent = true, bool = false) {wtBW = 1.;
270  return trialKin123(false, false, inEvent);}
271 
272  // Construct the final event kinematics.
273  virtual bool finalKin();
274 
275 private:
276 
277  // Set up allowed mass range.
278  bool setupMass();
279 
280 };
281 
282 //==========================================================================
283 
284 // A derived class with 2 -> 2 kinematics set up in tau, y, z = cos(theta).
285 
286 class PhaseSpace2to2tauyz : public PhaseSpace {
287 
288 public:
289 
290  // Constructor.
291  PhaseSpace2to2tauyz() {}
292 
293  // Optimize subsequent kinematics selection.
294  virtual bool setupSampling() {if (!setupMasses()) return false;
295  return setupSampling123(true, false);}
296 
297  // Construct the trial kinematics.
298  virtual bool trialKin(bool inEvent = true, bool = false) {
299  if (!trialMasses()) return false;
300  return trialKin123(true, false, inEvent);}
301 
302  // Construct the final event kinematics.
303  virtual bool finalKin();
304 
305 private:
306 
307  // Set up for fixed or Breit-Wigner mass selection.
308  bool setupMasses();
309 
310  // Select fixed or Breit-Wigner-distributed masses.
311  bool trialMasses();
312 
313  // Pick off-shell initialization masses when on-shell not allowed.
314  bool constrainedM3M4();
315  bool constrainedM3();
316  bool constrainedM4();
317 
318 };
319 
320 //==========================================================================
321 
322 // A derived class with 2 -> 2 kinematics set up for elastic scattering.
323 
324 class PhaseSpace2to2elastic : public PhaseSpace {
325 
326 public:
327 
328  // Constructor.
329  PhaseSpace2to2elastic() {}
330 
331  // Construct the trial or final event kinematics.
332  virtual bool setupSampling();
333  virtual bool trialKin(bool inEvent = true, bool = false);
334  virtual bool finalKin();
335 
336  // Are beam particles resolved in partons or scatter directly?
337  virtual bool isResolved() const {return false;}
338 
339 private:
340 
341  // Constants: could only be changed in the code itself.
342  static const double EXPMAX, CONVERTEL;
343 
344  // Kinematics properties specific to 2 -> 2 elastic.
345  bool useCoulomb;
346  double s1, s2, bSlope, lambda12S, tLow, tUpp, tAux, sigmaTot, rho,
347  lambda, tAbsMin, phaseCst, alphaEM0, sigmaNuc, sigmaCou, signCou;
348 
349  // Calculation of alphaElectromagnetic.
350  AlphaEM alphaEM;
351 
352 };
353 
354 //==========================================================================
355 
356 // A derived class with 2 -> 2 kinematics set up for diffractive scattering.
357 
358 class PhaseSpace2to2diffractive : public PhaseSpace {
359 
360 public:
361 
362  // Constructor.
363  PhaseSpace2to2diffractive(bool isDiffAin = false, bool isDiffBin = false)
364  : isDiffA(isDiffAin), isDiffB(isDiffBin) {}
365 
366  // Construct the trial or final event kinematics.
367  virtual bool setupSampling();
368  virtual bool trialKin(bool inEvent = true, bool = false);
369  virtual bool finalKin();
370 
371  // Are beam particles resolved in partons or scatter directly?
372  virtual bool isResolved() const {return false;}
373 
374 private:
375 
376  // Constants: could only be changed in the code itself.
377  static const int NTRY;
378  static const double EXPMAX, DIFFMASSMARGIN;
379 
380  // Initialization data, in constructor or read from Settings.
381  bool isDiffA, isDiffB;
382  int PomFlux;
383  double epsilonPF, alphaPrimePF;
384 
385  // Initialization: kinematics properties specific to 2 -> 2 diffractive.
386  double m3ElDiff, m4ElDiff, s1, s2, lambda12, lambda34, tLow, tUpp,
387  cRes, sResXB, sResAX, sProton, bMin, bSlope, bSlope1, bSlope2,
388  probSlope1, xIntPF, xtCorPF, mp24DL, coefDL, tAux, tAux1, tAux2;
389 
390  // Parameters for MBR model.
391  double sdpmax, ddpmax, dymin0, dymax, amx, am1, am2, t;
392  double eps, alph, alph2, m2min, dyminSD, dyminDD, dyminSigSD, dyminSigDD;
393 
394 };
395 
396 //==========================================================================
397 
398 // A derived class with 2 -> 3 kinematics set up for central diffractive
399 // scattering.
400 
402 
403 public:
404 
405  // Constructor.
407 
408  // Construct the trial or final event kinematics.
409  virtual bool setupSampling();
410  virtual bool trialKin(bool inEvent = true, bool = false);
411  virtual bool finalKin();
412 
413  // Are beam particles resolved in partons or scatter directly?
414  virtual bool isResolved() const {return false;}
415 
416  private:
417 
418  // Constants: could only be changed in the code itself.
419  static const int NTRY, NINTEG2;
420  static const double EXPMAX, DIFFMASSMIN, DIFFMASSMARGIN;
421 
422  // Local variables to calculate DPE kinematics.
423  int PomFlux;
424  double epsilonPF, alphaPrimePF, s1, s2, m5min, s5min, tLow[2], tUpp[2],
425  bMin[2], tAux[2], bSlope1, bSlope2, probSlope1[2], tAux1[2],
426  tAux2[2], bSlope, xIntPF, xIntInvPF, xtCorPF, mp24DL, coefDL,
427  epsMBR, alphMBR, m2minMBR, dyminMBR, dyminSigMBR, dyminInvMBR,
428  dpepmax, t1, t2;
429  Vec4 p1, p2, p3, p4, p5;
430 
431 };
432 
433 //==========================================================================
434 
435 // A derived class for nondiffractive events. Hardly does anything, since
436 // the real action is taken care of by the MultipartonInteractions class.
437 
439 
440 public:
441 
442  // Constructor.
444 
445  // Construct the trial or final event kinematics.
446  virtual bool setupSampling() {sigmaNw = sigmaProcessPtr->sigmaHat();
447  sigmaMx = sigmaNw; return true;}
448  virtual bool trialKin( bool , bool = false) {return true;}
449  virtual bool finalKin() {return true;}
450 
451 private:
452 
453 };
454 
455 //==========================================================================
456 
457 // A derived class with 2 -> 3 kinematics 1 + 2 -> 3 + 4 + 5 set up in
458 // tau, y, pT2_4, pT2_5, phi_4, phi_5 and y_3 (partial cylindrical symmetry).
459 
460 class PhaseSpace2to3tauycyl : public PhaseSpace {
461 
462 public:
463 
464  // Constructor.
466 
467  // Optimize subsequent kinematics selection.
468  virtual bool setupSampling() {if (!setupMasses()) return false;
469  setup3Body(); return setupSampling123(false, true);}
470 
471  // Construct the trial kinematics.
472  virtual bool trialKin(bool inEvent = true, bool = false) {
473  if (!trialMasses()) return false;
474  return trialKin123(false, true, inEvent);}
475 
476  // Construct the final event kinematics.
477  virtual bool finalKin();
478 
479 private:
480 
481  // Constants: could only be changed in the code itself.
482  static const int NITERNR;
483 
484  // Set up for fixed or Breit-Wigner mass selection.
485  bool setupMasses();
486 
487  // Select fixed or Breit-Wigner-distributed masses.
488  bool trialMasses();
489 
490 };
491 
492 //==========================================================================
493 
494 // A derived class with 2 -> 3 kinematics 1 + 2 -> 3 + 4 + 5 set up in
495 // y3, y4, y5, pT2_3, pT2_5, phi_3 and phi_5, and with R separation cut.
496 // Intended specifically for (essentially massless) 2 -> 3 QCD processes.
497 
498 class PhaseSpace2to3yyycyl : public PhaseSpace {
499 
500 public:
501 
502  // Constructor.
503  PhaseSpace2to3yyycyl() {}
504 
505  // Optimize subsequent kinematics selection.
506  virtual bool setupSampling();
507 
508  // Construct the trial kinematics.
509  virtual bool trialKin(bool inEvent = true, bool = false);
510 
511  // Construct the final event kinematics.
512  virtual bool finalKin();
513 
514 private:
515 
516  // Phase space cuts specifically for 2 -> 3 QCD processes.
517  double pTHat3Min, pTHat3Max, pTHat5Min, pTHat5Max, RsepMin, R2sepMin;
518  bool hasBaryonBeams;
519 
520  // Event kinematics choices.
521  double pT3Min, pT3Max, pT5Min, pT5Max, y3Max, y4Max, y5Max,
522  pT3, pT4, pT5, phi3, phi4, phi5, y3, y4, y5, dphi;
523  Vec4 pInSum;
524 
525 };
526 
527 //==========================================================================
528 
529 // A derived class for Les Houches events.
530 
531 class PhaseSpaceLHA : public PhaseSpace {
532 
533 public:
534 
535  // Constructor.
536  PhaseSpaceLHA() {idProcSave = 0;}
537 
538  // Find maximal cross section for comparison with internal processes.
539  virtual bool setupSampling();
540 
541  // Construct the next process, by interface to Les Houches class.
542  virtual bool trialKin( bool , bool repeatSame = false);
543 
544  // Set scale, alpha_s and alpha_em if not done.
545  virtual bool finalKin() {sigmaProcessPtr->setScale(); return true;}
546 
547  // For Les Houches with negative event weight needs
548  virtual double sigmaSumSigned() const {return sigmaSgn;}
549 
550 private:
551 
552  // Constants.
553  static const double CONVERTPB2MB;
554 
555  // Local properties.
556  int strategy, stratAbs, nProc, idProcSave;
557  double xMaxAbsSum, xSecSgnSum, sigmaSgn;
558  vector<int> idProc;
559  vector<double> xMaxAbsProc;
560 
561 };
562 
563 //==========================================================================
564 
565 } // end namespace Pythia8
566 
567 #endif // Pythia8_PhaseSpace_H
568 
Definition: AgUStep.h:26