#include <iostream>
#include "Pythia8/Pythia.h"
using namespace std;
using namespace Pythia8;

int main(){

  Pythia8::Pythia pythia;

  pythia.readString("Beams:idA = 2212");   // proton
  pythia.readString("Beams:idB = 2212");   // proton
  pythia.readString("Beams:eCM = 14.0e3"); // center of mass energy
  pythia.readString("SoftQCD:all = on");   // soft QCD physics
  pythia.readString("HardQCD:all = on");   // hard QCD physics
  pythia.init();

  int nevents = 10;

  for(int i=0; i<nevents; i++)
  {
    if (!pythia.next()) continue;

    int entries = pythia.event.size();
    cout << "Event # = " << i << " " << " size = " << entries << endl;

    for(int j=0; j<entries; j++)
    {
       int    id = pythia.event[j].id();
       double m  = pythia.event[j].m();
       double px = pythia.event[j].px();
       double py = pythia.event[j].py();
       double pz = pythia.event[j].pz();
       double p  = sqrt(px*px+py*py+pz*pz);
       cout << id << " " << m <<" "<< p << endl;
    }
  }

  return 0;
}
