source: HiSusy/trunk/Pythia8/pythia8170/examples/main01.cc @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

File size: 1.2 KB
Line 
1// main01.cc is a part of the PYTHIA event generator.
2// Copyright (C) 2012 Torbjorn Sjostrand.
3// PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4// Please respect the MCnet Guidelines, see GUIDELINES for details.
5
6// This is a simple test program. It fits on one slide in a talk.
7// It studies the charged multiplicity distribution at the LHC.
8
9#include "Pythia.h"
10using namespace Pythia8; 
11int main() {
12  // Generator. Process selection. LHC initialization. Histogram.
13  Pythia pythia;
14  pythia.readString("Beams:eCM = 8000.");   
15  pythia.readString("HardQCD:all = on");   
16  pythia.readString("PhaseSpace:pTHatMin = 20."); 
17  pythia.init();
18  Hist mult("charged multiplicity", 100, -0.5, 799.5);
19  // Begin event loop. Generate event. Skip if error. List first one.
20  for (int iEvent = 0; iEvent < 100; ++iEvent) {
21    if (!pythia.next()) continue;
22    // Find number of all final charged particles and fill histogram.
23    int nCharged = 0;
24    for (int i = 0; i < pythia.event.size(); ++i) 
25      if (pythia.event[i].isFinal() && pythia.event[i].isCharged()) 
26        ++nCharged; 
27    mult.fill( nCharged );
28  // End of event loop. Statistics. Histogram. Done.
29  }
30  pythia.stat();
31  cout << mult; 
32  return 0;
33}
Note: See TracBrowser for help on using the repository browser.