10 #include "Pythia8/Pythia.h"
12 using namespace Pythia8;
18 pythia.readFile(
"main80.cmnd");
21 int nEvent = pythia.mode(
"Main:numberOfEvents");
22 int nMerge = pythia.mode(
"Merging:nJetMax");
25 Hist pTWsum(
"pT of W, summed over all subruns", 100, 0., 200.);
28 double sigmaTotal = 0.;
31 for (
int iMerge = 0; iMerge <= nMerge; ++iMerge) {
32 double sigmaSample = 0.;
35 pythia.readFile(
"main80.cmnd", iMerge);
39 Hist weightNow(
"event weights, current subrun", 100, 0., 2.5);
40 Hist pTWnow(
"pT of W, current subrun", 100, 0., 200.);
43 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
46 if ( !pythia.next() ) {
47 if ( pythia.info.atEndOfFile() )
break;
52 double weight = pythia.info.mergingWeight();
53 weightNow.fill( weight);
54 sigmaSample += weight;
58 for (
int i = 1; i < pythia.event.size(); ++i)
59 if (pythia.event[i].id() == 24) iW = i;
62 double pTW = pythia.event[iW].pT();
63 pTWnow.fill( pTW, weight);
69 pTWnow *= 1e9 * pythia.info.sigmaGen() / (2. * pythia.info.nAccepted());
73 cout << weightNow << pTWnow;
76 sigmaSample *= pythia.info.sigmaGen() / double(pythia.info.nAccepted());
77 sigmaTotal += sigmaSample;
85 cout <<
"\n\n The inclusive cross section after merging is: "
86 << scientific << setprecision(4) << sigmaTotal <<
" mb " << endl;