1 // main25.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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.
6 // Simple illustration how to provide your own cross-section class,
7 // with an instance handed in to Pythia for internal generation.
8 // The class is a lighly modified copy of an existing Pythia class,
9 // and cross sections are compared with the internal implementation.
13 using namespace Pythia8;
15 //==========================================================================
17 // A derived class for b g -> H0 b (Standard Model Higgs).
19 class Sigma2bg2Hb : public Sigma2Process {
26 // Initialize process.
27 virtual void initProc();
29 // Calculate flavour-independent parts of cross section.
30 virtual void sigmaKin();
32 // Evaluate sigmaHat(sHat).
33 virtual double sigmaHat();
35 // Select flavour, colour and anticolour.
36 virtual void setIdColAcol();
38 // Evaluate weight for decay angles.
39 virtual double weightDecay( Event& process, int iResBeg, int iResEnd);
41 // Info on the subprocess.
42 virtual string name() const {return "b g -> H b";}
43 virtual int code() const {return 10001;}
44 virtual string inFlux() const {return "qg";}
45 virtual int id3Mass() const {return 25;}
46 virtual int id4Mass() const {return 5;}
50 // Store flavour-specific process information and standard prefactor.
51 double m2b, m2W, thetaWRat, openFrac, sigma;
55 //--------------------------------------------------------------------------
57 // Initialize process.
59 void Sigma2bg2Hb::initProc() {
61 // Masses and couplings.
62 m2b = pow2( particleDataPtr->m0(5) );
63 m2W = pow2( particleDataPtr->m0(24) );
64 thetaWRat = 1. / (24. * couplingsPtr->sin2thetaW());
66 // Suppression from secondary widths.
67 openFrac = particleDataPtr->resOpenFrac(25);
71 //--------------------------------------------------------------------------
73 // Evaluate sigmaHat(sHat); first step when inflavours unknown.
75 void Sigma2bg2Hb::sigmaKin() {
77 // Initial values. Running mass provides coupling.
78 double mHat = sqrt(sH);
79 double m2bRun = pow2( particleDataPtr->mRun(5, mHat) );
82 sigma = (M_PI / sH2) * alpS * alpEM * thetaWRat * (m2bRun/m2W)
83 * ( sH / (m2b - uH) + 2. * m2b * (s3 - uH) / pow2(m2b - uH)
84 + (m2b - uH) / sH - 2. * m2b / (m2b - uH)
85 + 2. * (s3 - uH) * (s3 - m2b - sH) / ((m2b - uH) * sH) );
90 //--------------------------------------------------------------------------
92 // Evaluate sigmaHat(sHat); second step for given inflavours.
94 double Sigma2bg2Hb::sigmaHat() {
96 // Cross section vanishing except for incoming b(bar) quark.
97 if (abs(id1) != 5 && abs(id2) != 5) return 0.;
99 // Cross section as already calculated.
104 //--------------------------------------------------------------------------
106 // Select identity, colour and anticolour.
108 void Sigma2bg2Hb::setIdColAcol() {
110 // Flavour set up for b g -> H0 q.
111 int idq = (id2 == 21) ? id1 : id2;
112 setId( id1, id2, 25, idq);
114 // tH defined between b_in and b_out: must swap tHat <-> uHat if b g in.
115 swapTU = (id2 == 21);
117 // Colour flow topologies. Swap when antiquarks.
118 if (id2 == 21) setColAcol( 1, 0, 2, 1, 0, 0, 2, 0);
119 else setColAcol( 2, 1, 1, 0, 0, 0, 2, 0);
120 if (idq < 0) swapColAcol();
124 //--------------------------------------------------------------------------
126 // Evaluate weight for Z0 Z0 or W+W- decay angles in Higgs decay.
128 double Sigma2bg2Hb::weightDecay( Event& process, int iResBeg,
131 // For Higgs decay hand over to standard routine, else done.
132 if (process[process[iResBeg].mother1()].idAbs() == 25)
133 return weightHiggsDecay( process, iResBeg, iResEnd);
138 //==========================================================================
142 // Number of events to generate and to list. Max number of errors.
143 // Warning: generation of complete events is much slower than if you use
144 // PartonLevel:all = off to only get cross sections, so adjust nEvent.
152 // A class to generate the b g -> H b process from external matrix element.
153 SigmaProcess* sigma2bg2Hb = new Sigma2bg2Hb();
155 // Hand pointer to Pythia.
156 pythia.setSigmaPtr( sigma2bg2Hb);
158 // Optionally compare with (almost) same process implemented internally.
159 pythia.readString("HiggsSM:qg2Hq = on");
161 // Phase space cut on pThat.
162 pythia.readString("PhaseSpace:pTHatMin = 20.");
164 // Optionally only want to study H0 -> gamma gamma channel.
165 pythia.readString("25:onMode = off");
166 pythia.readString("25:onIfMatch = 22 22");
168 // Optionally only compare cross sections.
169 //pythia.readString("PartonLevel:all = off");
171 // Initialization for LHC.
172 pythia.init( 2212, 2212, 14000.);
175 pythia.settings.listChanged();
176 pythia.particleData.listChanged();
180 for (int iEvent = 0; iEvent < nEvent; ++iEvent) {
181 if (iEvent%(max(1,nEvent/20)) == 0) cout << " Now begin event "
184 // Generate events. Quit if many failures.
185 if (!pythia.next()) {
186 if (++iAbort < nAbort) continue;
187 cout << " Event generation aborted prematurely, owing to error!\n";
191 // List first few events.
192 if (iEvent < nList) {
194 pythia.process.list();
198 // End of event loop.