~ubuntu-branches/ubuntu/trusty/pythia8/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/main02.cc

  • Committer: Package Import Robot
  • Author(s): Lifeng Sun
  • Date: 2012-05-22 11:43:00 UTC
  • Revision ID: package-import@ubuntu.com-20120522114300-0jvsv2vl4o2bo435
Tags: upstream-8.1.65
ImportĀ upstreamĀ versionĀ 8.1.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// main02.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 pT_Z spectrum at the Tevatron.
 
8
 
 
9
#include "Pythia.h"
 
10
using namespace Pythia8; 
 
11
int main() {
 
12
  // Generator. Process selection. Tevatron initialization. Histogram.
 
13
  Pythia pythia;
 
14
  pythia.readString("Beams:idB = -2212");    
 
15
  pythia.readString("Beams:eCM = 1960.");    
 
16
  pythia.readString("WeakSingleBoson:ffbar2gmZ = on");    
 
17
  pythia.readString("PhaseSpace:mHatMin = 80.");    
 
18
  pythia.readString("PhaseSpace:mHatMax = 120.");    
 
19
  pythia.init();
 
20
  Hist pTZ("dN/dpTZ", 100, 0., 100.);
 
21
  // Begin event loop. Generate event. Skip if error. List first one.
 
22
  for (int iEvent = 0; iEvent < 1000; ++iEvent) {
 
23
    if (!pythia.next()) continue;
 
24
    // Loop over particles in event. Find last Z0 copy. Fill its pT. 
 
25
    int iZ = 0;
 
26
    for (int i = 0; i < pythia.event.size(); ++i) 
 
27
      if (pythia.event[i].id() == 23) iZ = i;
 
28
    pTZ.fill( pythia.event[iZ].pT() );
 
29
  // End of event loop. Statistics. Histogram. Done.
 
30
  }
 
31
  pythia.stat();
 
32
  cout << pTZ; 
 
33
  return 0;
 
34
}