15 using namespace Pythia8;
32 void analyze(
Event& event);
41 Hist yH, etaChg, mult;
49 void MyAnalysis::init() {
55 yH.book(
"Higgs rapidity", 100, -10., 10.);
56 etaChg.book(
"charged pseudorapidity", 100, -10., 10.);
57 mult.book(
"charged multiplicity", 100, -0.5, 799.5);
65 void MyAnalysis::analyze(
Event& event) {
72 for (
int i = 0; i <
event.size(); ++i)
73 if (event[i].
id() == 25) iH = i;
74 yH.fill( event[iH].y() );
78 for (
int i = 0; i <
event.size(); ++i)
79 if (event[i].isFinal() &&
event[i].isCharged()) {
80 etaChg.fill( event[i].eta() );
91 void MyAnalysis::finish() {
94 double binFactor = 5. / nEvt;
99 cout << yH << etaChg << mult;
108 int main(
int argc,
char* argv[]) {
112 cerr <<
" Unexpected number of command-line arguments. \n"
113 <<
" You are expected to provide a file name and nothing else. \n"
114 <<
" Program stopped! " << endl;
119 ifstream is(argv[1]);
121 cerr <<
" Command-line file " << argv[1] <<
" was not found. \n"
122 <<
" Program stopped! " << endl;
127 cout <<
" PYTHIA settings will be read from file " << argv[1] << endl;
131 pythia.readFile(argv[1]);
141 int nEvent = pythia.mode(
"Main:numberOfEvents");
142 int nAbort = pythia.mode(
"Main:timesAllowErrors");
146 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
149 if (!pythia.next()) {
150 if (++iAbort < nAbort)
continue;
151 cout <<
" Event generation aborted prematurely, owing to error!\n";
156 myAnalysis.analyze( pythia.event);