13 #include "Pythia8/Pythia.h"
15 using namespace Pythia8;
32 void analyze(
Event& event);
41 Hist brH, yH, etaChg, mult;
49 void MyAnalysis::init() {
55 brH.book(
"Higgs branching ratios by flavour", 30, -0.5, 29.5);
56 yH.book(
"Higgs rapidity", 100, -10., 10.);
57 etaChg.book(
"charged pseudorapidity", 100, -10., 10.);
58 mult.book(
"charged multiplicity", 100, -0.5, 799.5);
66 void MyAnalysis::analyze(
Event& event) {
73 for (
int i = 0; i <
event.size(); ++i)
74 if (event[i].
id() == 25) iH = i;
75 yH.fill( event[iH].y() );
78 int idDau1 =
event[
event[iH].daughter1() ].idAbs();
79 int idDau2 =
event[
event[iH].daughter2() ].idAbs();
81 if (idDau2 == idDau1 && idDau1 < 25) iChan = idDau1;
82 if (min( idDau1, idDau2) == 22 && max( idDau1, idDau2) == 23) iChan = 26;
87 for (
int i = 0; i <
event.size(); ++i)
88 if (event[i].isFinal() &&
event[i].isCharged()) {
89 etaChg.fill( event[i].eta() );
100 void MyAnalysis::finish() {
103 double binFactor = 5. / nEvt;
108 cout << brH << yH << etaChg << mult;
117 int main(
int argc,
char* argv[]) {
121 cerr <<
" Unexpected number of command-line arguments. \n"
122 <<
" You are expected to provide a file name and nothing else. \n"
123 <<
" Program stopped! " << endl;
128 ifstream is(argv[1]);
130 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
131 <<
" Program stopped! " << endl;
136 cout <<
" PYTHIA settings will be read from file " << argv[1] << endl;
140 pythia.readFile(argv[1]);
150 int nEvent = pythia.mode(
"Main:numberOfEvents");
151 int nAbort = pythia.mode(
"Main:timesAllowErrors");
152 bool hasPL = pythia.flag(
"PartonLevel:all");
156 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
159 if (!pythia.next()) {
160 if (++iAbort < nAbort)
continue;
161 cout <<
" Event generation aborted prematurely, owing to error!\n";
166 myAnalysis.analyze( (hasPL ? pythia.event : pythia.process) );