1 | // main41.cc is a part of the PYTHIA event generator.
|
---|
2 | // Copyright (C) 2015 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 | // Author: Mikhail Kirsanov, Mikhail.Kirsanov@cern.ch, based on main01.cc.
|
---|
7 | // This program illustrates how HepMC can be interfaced to Pythia8.
|
---|
8 | // It studies the charged multiplicity distribution at the LHC.
|
---|
9 | // HepMC events are output to the hepmcout41.dat file.
|
---|
10 |
|
---|
11 | // WARNING: typically one needs 25 MB/100 events at the LHC.
|
---|
12 | // Therefore large event samples may be impractical.
|
---|
13 |
|
---|
14 | // Modified for automated sample generation by Alex Andriatis
|
---|
15 | // 17 June 2016
|
---|
16 |
|
---|
17 | #include "Pythia8/Pythia.h"
|
---|
18 | #include "Pythia8Plugins/HepMC2.h"
|
---|
19 |
|
---|
20 | using namespace Pythia8;
|
---|
21 |
|
---|
22 | int main() {
|
---|
23 |
|
---|
24 | // Interface for conversion from Pythia8::Event to HepMC event.
|
---|
25 | HepMC::Pythia8ToHepMC ToHepMC;
|
---|
26 |
|
---|
27 | // Specify file where HepMC events will be stored.
|
---|
28 | HepMC::IO_GenEvent ascii_io("/afs/cern.ch/work/a/aaitahme/public/generation/ILD_reference/pythia/mumutest.dat", std::ios::out);
|
---|
29 |
|
---|
30 | // Generator. Process selection. LHC initialization. Histogram.
|
---|
31 |
|
---|
32 | Pythia pythia;
|
---|
33 | //pythia.readString("Beams:frameType = 1");
|
---|
34 | //pythia.readString("Beams:eCM = 240.");
|
---|
35 | //pythia.readString("Beams:idA = 11");
|
---|
36 | //pythia.readString("Beams:idB = -11");
|
---|
37 | //pythia.readString("PartonLevel:ISR = on");
|
---|
38 | //pythia.readString("WeakSingleBoson:All = on");
|
---|
39 | //pythia.readString("22:onIfMatch = -13 13");
|
---|
40 | //pythia.readString("23:onIfMatch = -13 13");
|
---|
41 | //pythia.readString("24:onIfMatch = -13 13");
|
---|
42 | //pythia.readString("Main:timesAllowErrors = 1000000");
|
---|
43 | pythia.readFile("main03.cmnd");
|
---|
44 | pythia.init();
|
---|
45 |
|
---|
46 | // Begin event loop. Generate event. Skip if error.
|
---|
47 | for (int iEvent = 0; iEvent < 500000; ++iEvent) {
|
---|
48 | if (!pythia.next()) continue;
|
---|
49 |
|
---|
50 | HepMC::GenEvent* hepmcevt = new HepMC::GenEvent();
|
---|
51 | ToHepMC.fill_next_event( pythia, hepmcevt );
|
---|
52 |
|
---|
53 | // Write the HepMC event to file. Done with it.
|
---|
54 | ascii_io << hepmcevt;
|
---|
55 | delete hepmcevt;
|
---|
56 |
|
---|
57 | // End of event loop. Statistics. Histogram.
|
---|
58 | }
|
---|
59 | pythia.stat();
|
---|
60 |
|
---|
61 | // Done.
|
---|
62 | return 0;
|
---|
63 | }
|
---|