-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenevts.cc
53 lines (41 loc) · 1.49 KB
/
genevts.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2021 Torbjorn Sjostrand.
// Copyright (C) 2021 Ph. Gras.
// PYTHIA is licenced under the GNU GPL v2 or later, see COPYING for details.
// Please respect the MCnet Guidelines, see GUIDELINES for details.
// Authors: Mikhail Kirsanov <[email protected]>.
#include "Pythia8/Pythia.h"
#ifndef HEPMC2
#include "Pythia8Plugins/HepMC3.h"
#else
#include "Pythia8Plugins/HepMC2.h"
#endif
using namespace Pythia8;
int main() {
// Interface for conversion from Pythia8::Event to HepMC
// event. Specify file where HepMC events will be stored.
Pythia8::Pythia8ToHepMC topHepMC("events.hepmc3");
// Generator. Process selection. LHC initialization. Histogram.
Pythia pythia;
pythia.readString("Beams:eCM = 13000.");
pythia.readString("HardQCD:all = on");
pythia.readString("PhaseSpace:pTHatMin = 20.");
pythia.init();
Hist mult("charged multiplicity", 100, -0.5, 799.5);
// Begin event loop. Generate event. Skip if error.
for (int iEvent = 0; iEvent < 100; ++iEvent) {
if (!pythia.next()) continue;
// Find number of all final charged particles and fill histogram.
int nCharged = 0;
for (int i = 0; i < pythia.event.size(); ++i)
if (pythia.event[i].isFinal() && pythia.event[i].isCharged())
++nCharged;
mult.fill( nCharged );
// Construct new empty HepMC event, fill it and write it out.
topHepMC.writeNextEvent( pythia );
// End of event loop. Statistics. Histogram.
}
pythia.stat();
cout << mult;
// Done.
return 0;
}