]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8145/examples/main02.cc
Use Output directive instead of the old OutputFile and OUtputArchive. Save fileinfo...
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / examples / main02.cc
1 // main02.cc is a part of the PYTHIA event generator.
2 // Copyright (C) 2010 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("WeakSingleBoson:ffbar2gmZ = on");    
15   pythia.readString("PhaseSpace:mHatMin = 80.");    
16   pythia.readString("PhaseSpace:mHatMax = 120.");    
17   pythia.init( 2212, -2212, 1960.);
18   Hist pTZ("dN/dpTZ", 100, 0., 100.);
19   // Begin event loop. Generate event. Skip if error. List first one.
20   for (int iEvent = 0; iEvent < 1000; ++iEvent) {
21     if (!pythia.next()) continue;
22     if (iEvent < 1) {pythia.info.list(); pythia.event.list();}
23     // Loop over particles in event. Find last Z0 copy. Fill its pT. 
24     int iZ = 0;
25     for (int i = 0; i < pythia.event.size(); ++i) 
26       if (pythia.event[i].id() == 23) iZ = i;
27     pTZ.fill( pythia.event[iZ].pT() );
28   // End of event loop. Statistics. Histogram. Done.
29   }
30   pythia.statistics();
31   cout << pTZ; 
32   return 0;
33 }