// main02.cc is a part of the PYTHIA event generator. // Copyright (C) 2009 Torbjorn Sjostrand. // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details. // Please respect the MCnet Guidelines, see GUIDELINES for details. // This is a simple test program. It fits on one slide in a talk. // It studies the pT_Z spectrum at the Tevatron. // add CBook (S.Chekanov) #include "CBook/src/HRecord/HEvent.pb.h" #include "CBook/inc/CBook/EPBook.h" #include "Pythia.h" using namespace Pythia8; int main() { // Generator. Process selection. Tevatron initialization. Histogram. Pythia pythia; pythia.readString("WeakSingleBoson:ffbar2gmZ = on"); pythia.readString("PhaseSpace:mHatMin = 80."); pythia.readString("PhaseSpace:mHatMax = 120."); pythia.init( 2212, -2212, 1960.); GOOGLE_PROTOBUF_VERIFY_VERSION; EPBook* epbook = EPBook::open("main02.nbu"); // Begin event loop. Generate event. Skip if error. List first one. for (int iEvent = 0; iEvent < 100; ++iEvent) { if (!pythia.next()) continue; if (iEvent < 1) {pythia.info.list(); pythia.event.list();} // Loop over particles in event. Find last Z0 copy. Fill its pT. jhplot::io::HEvent eve; eve.set_id(iEvent); // create group with all particles jhplot::io::HEvent_Group* g = eve.add_group(); for (int i = 0; i < pythia.event.size(); ++i) { jhplot::io::HEvent_Entry* entry = g->add_entry(); entry->set_name(pythia.event[i].name()); entry->add_ida(pythia.event[i].id()); entry->add_ida(pythia.event[i].status()); entry->add_ida( (int)(3*pythia.event[i].charge())); entry->add_ida(pythia.event[i].mother1()); entry->add_ida(pythia.event[i].mother2()); entry->add_ida(pythia.event[i].daughter1()); entry->add_ida(pythia.event[i].daughter2()); entry->add_da(pythia.event[i].px()); entry->add_da(pythia.event[i].py()); entry->add_da(pythia.event[i].pz()); entry->add_da(pythia.event[i].e()); entry->add_da(pythia.event[i].m()); entry->add_da(pythia.event[i].xProd()); entry->add_da(pythia.event[i].yProd()); entry->add_da(pythia.event[i].zProd()); entry->add_da(pythia.event[i].tProd()); } epbook->write(eve); // write event // End of event loop. Statistics. Histogram. Done. } pythia.statistics(); epbook->close(); // close return 0; }