StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PartonVertex.cc
1 // PartonVertex.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 PartonVertex class.
7 
8 #include "Pythia8/PartonVertex.h"
9 
10 namespace Pythia8 {
11 
12 //==========================================================================
13 
14 // The PartonVertex class.
15 
16 //--------------------------------------------------------------------------
17 
18 // Find relevant settings.
19 
20 void PartonVertex::init() {
21 
22  doVertex = settingsPtr->flag("PartonVertex:setVertex");
23  modeVertex = settingsPtr->mode("PartonVertex:modeVertex");
24  rProton = settingsPtr->parm("PartonVertex:ProtonRadius");
25  pTmin = settingsPtr->parm("PartonVertex:pTmin");
26  widthEmission = settingsPtr->parm("PartonVertex:EmissionWidth");
27  bScale = 2.187 / (2. * rProton);
28 
29 }
30 
31 //--------------------------------------------------------------------------
32 
33 // Select vertex for a beam (remnant) particle.
34 
35 void PartonVertex::vertexBeam( int iNow, int iBeam, Event& event) {
36  if(iBeam == 0)
37  event[iNow].vProd(-bNow/2., 0., 0., 0.);
38  else if(iBeam == 1)
39  event[iNow].vProd(bNow/2., 0. ,0. ,0.);
40  else
41  infoPtr->errorMsg("Error in PartonVertex:vertexBeam: Wrong beam index.");
42 }
43 
44 //--------------------------------------------------------------------------
45 
46 // Select vertex or vertices for an MPI.
47 
48 void PartonVertex::vertexMPI( int iBeg, int nAdd, double bNowIn,
49  Event& event) {
50 
51  // Skip if not implemented option.
52  if (!doVertex || modeVertex < 1 || modeVertex > 2) return;
53 
54  // Convert the impact parameter to physical units. Prepare selection.
55  bNow = bNowIn / bScale;
56  if (modeVertex == 1) {
57  xMax = rProton - bNow / 2.;
58  yMax = sqrt( 4. * rProton * rProton - bNow * bNow);
59  } else if (modeVertex == 2) {
60  mux = bNow / 2.0;
61  }
62 
63  // Partons are given separate vertices for current models.
64  for (int iNow = iBeg; iNow < iBeg + nAdd; ++iNow) {
65  double x = 0.0, y = 0.0;
66 
67  // Sample x and y inside a box, and then require it to be within disks.
68  if (modeVertex == 1) {
69  bool reject = true;
70  while (reject) {
71  x = (2. * rndmPtr->flat() - 1.) * xMax;
72  y = (2. * rndmPtr->flat() - 1.) * yMax;
73  if ( (pow2(x + bNow / 2) + y * y < pow2(rProton))
74  && (pow2(x - bNow / 2) + y * y < pow2(rProton)) ) reject = false;
75  }
76 
77  // Sample x and y according to two-dimensional Gaussian.
78  } else {
79  pair<double,double> xy = rndmPtr->gauss2();
80  x = (rProton / 2.0) * (xy.first + mux);
81  y = (rProton / 2.0) * xy.second;
82  }
83 
84  // Set production vertices.
85  event[iNow].vProd( x, y, 0., 0.);
86  }
87 
88 }
89 
90 //--------------------------------------------------------------------------
91 
92 // Select vertex for an FSR branching.
93 
94 void PartonVertex::vertexFSR( int iNow, Event& event) {
95 
96  // Skip if not implemented option.
97  if (!doVertex || modeVertex < 1 || modeVertex > 2) return;
98 
99  // Mother index.
100  int iMo = event[iNow].mother1();
101  // Start from known vertex, or mother one.
102  Vec4 vStart = event[iNow].hasVertex() ? event[iNow].vProd()
103  : event[iMo].vProd();
104 
105  // Add Gaussian smearing.
106  double pT = max( event[iNow].pT(), pTmin);
107  pair<double, double> xy = rndmPtr->gauss2();
108  Vec4 vSmear = (widthEmission / pT) * Vec4( xy.first, xy.second, 0., 0.);
109  event[iNow].vProd( vStart + vSmear);
110 
111 
112 }
113 
114 //--------------------------------------------------------------------------
115 
116 // Select vertex for an ISR branching.
117 
118 void PartonVertex::vertexISR( int iNow, Event& event) {
119 
120  // Skip if not implemented option.
121  if (!doVertex || modeVertex < 1 || modeVertex > 2) return;
122 
123  // Start from known vertex or mother/daughter one.
124  int iMoDa = event[iNow].mother1();
125  if (iMoDa == 0) iMoDa = event[iNow].daughter1();
126  Vec4 vStart = event[iNow].vProd();
127  if (!event[iNow].hasVertex() && iMoDa != 0) vStart = event[iMoDa].vProd();
128 
129  // Add Gaussian smearing.
130  double pT = max( event[iNow].pT(), pTmin);
131  pair<double, double> xy = rndmPtr->gauss2();
132  Vec4 vSmear = (widthEmission / pT) * Vec4( xy.first, xy.second, 0., 0.);
133  event[iNow].vProd( vStart + vSmear);
134 
135 }
136 
137 //==========================================================================
138 
139 } // end namespace Pythia8
Definition: AgUStep.h:26