24 #include "Pythia8/Pythia.h"
25 using namespace Pythia8;
30 bool redoBDecays =
false;
31 bool redoHadrons =
true;
32 if (redoHadrons) redoBDecays =
false;
40 if (!redoBDecays && !redoHadrons) nRepeat = 1;
44 Event&
event = pythia.event;
49 pythia.readString(
"HardQCD:gg2bbbar = on");
50 pythia.readString(
"HardQCD:qqbar2bbbar = on");
51 pythia.readString(
"PhaseSpace:pTHatMin = 50.");
55 int bCodes[28] = {511, 521, 531, 541, 5122, 5132, 5142, 5232, 5242,
56 5332, 5342, 5412, 5414, 5422, 5424, 5432, 5434, 5442, 5444, 5512,
57 5514, 5522, 5524, 5532, 5534, 5542, 5544, 5544 };
68 if (redoHadrons) pythia.readString(
"HadronLevel:all = off");
74 Hist nBperEvent(
"number of b quarks in an event", 10, -0.5, 9.5);
75 Hist nSameEvent(
"number of times same event is used", 10, -0.5, 9.5);
76 Hist oppSignMass(
"mass of opposite-sign muon pair", 100, 0.0, 100.0);
77 Hist sameSignMass(
"mass of same-sign muon pair", 100, 0.0, 100.0);
80 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
84 if (redoBDecays)
for (
int iC = 0; iC < nCodes; ++iC)
85 pythia.particleData.mayDecay( bCodes[iC],
false);
88 if (!pythia.next())
continue;
93 for (
int i = 0; i <
event.size(); ++i) {
94 stat =
event[i].statusAbs();
95 if (event[i].idAbs() == 5 && (stat == 62 || stat == 63)) ++nBquark;
97 nBperEvent.fill( nBquark );
102 for (
int i = 0; i <
event.size(); ++i) {
103 int idAbs =
event[i].idAbs();
104 for (
int iC = 0; iC < 28; ++iC)
105 if (idAbs == bCodes[iC]) {
112 nBHad = iBHad.size();
113 if (nBquark != nBHad) cout <<
" Warning: " << nBquark
114 <<
" b quarks but " << nBHad <<
" B hadrons" << endl;
120 for (
int iC = 0; iC < nCodes; ++iC)
121 pythia.particleData.mayDecay( bCodes[iC],
true);
124 }
else if (redoHadrons) {
130 for (
int iRepeat = 0; iRepeat < nRepeat; ++iRepeat) {
138 for (
int iB = 0; iB < nBHad; ++iB) event[ iBHad[iB] ].statusPos();
145 if (!pythia.moreDecays())
continue;
149 }
else if (redoHadrons) {
150 if (iRepeat > 0)
event = savedEvent;
154 if (!pythia.forceHadronLevel(
false))
continue;
158 if ( (redoBDecays || redoHadrons) && iEvent < nListRedo
159 && iRepeat == nRepeat - 1) event.list();
162 vector<int> iMuNeg, iMuPos;
163 for (
int i = 0; i <
event.size(); ++i) {
164 int id =
event[i].id();
165 if (
id == 13) iMuNeg.push_back(i);
166 if (
id == -13) iMuPos.push_back(i);
170 int nMuNeg = iMuNeg.size();
171 int nMuPos = iMuPos.size();
172 if (nMuNeg + nMuPos > 1) {
176 for (
int iN = 0; iN < nMuNeg; ++iN)
177 for (
int iP = 0; iP < nMuPos; ++iP)
179 (event[iMuNeg[iN]].p() +
event[iMuPos[iP]].p()).mCalc() );
182 for (
int i1 = 0; i1 < nMuNeg - 1; ++i1)
183 for (
int i2 = i1 + 1; i2 < nMuNeg; ++i2)
185 (event[iMuNeg[i1]].p() +
event[iMuNeg[i2]].p()).mCalc() );
186 for (
int i1 = 0; i1 < nMuPos - 1; ++i1)
187 for (
int i2 = i1 + 1; i2 < nMuPos; ++i2)
189 (event[iMuPos[i1]].p() +
event[iMuPos[i2]].p()).mCalc() );
196 nSameEvent.fill( nWithPair );
203 cout << nBperEvent << nSameEvent << oppSignMass << sameSignMass << endl;