1 // main05.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.
6 // This is a simple test program.
7 // It studies jet production at the LHC, using CellJet.
10 using namespace Pythia8;
14 // Number of events, generated and listed ones.
19 // Generator. Process selection. LHC initialization.
21 pythia.readString("HardQCD:all = on");
22 pythia.readString("PhaseSpace:pTHatMin = 200.");
23 pythia.init( 2212, 2212, 14000.);
25 // Range and granularity of jet finder.
29 // Exclude neutrinos (and other invisible) from study
31 // Character and amount of energy smearing, cell by cell.
33 double resolution = 0.3;
35 double threshold = 0.1;
36 Rndm* rndmPtr = &pythia.rndm;
37 // The jet finder itself.
38 CellJet cellJet( etaMax, nEta, nPhi, nSel, smear, resolution,
39 upperCut, threshold, rndmPtr);
42 Hist nJets("number of jets", 20, -0.5, 19.5);
43 Hist eTjets("eT for jets", 100, 0., 500.);
44 Hist etaJets("eta for jets", 100, -5., 5.);
45 Hist phiJets("phi for jets", 100, -M_PI, M_PI);
46 Hist distJets("R distance between jets", 100, 0., 10.);
47 Hist eTdiff("eT difference", 100, -100., 400.);
49 // Begin event loop. Generate event. Skip if error. list first few.
50 for (int iEvent = 0; iEvent < nEvent; ++iEvent) {
51 if (!pythia.next()) continue;
53 // List first few events.
56 pythia.process.list();
60 // Analyze jet properties. List first few.
61 cellJet. analyze( pythia.event );
62 if (iEvent < nListJets) cellJet.list();
64 // Fill inclusive jet distributions.
65 nJets.fill( cellJet.size() );
66 for (int i = 0; i < cellJet.size(); ++i) {
67 eTjets.fill( cellJet.eT(i) );
68 etaJets.fill( cellJet.etaWeighted(i) );
69 phiJets.fill( cellJet.phiWeighted(i) );
72 // Fill distance between jets.
73 for (int i = 0; i < cellJet.size() - 1; ++i)
74 for (int j = i +1; j < cellJet.size(); ++j) {
75 double dEta = cellJet.etaWeighted(i)
76 - cellJet.etaWeighted(j);
77 double dPhi = abs( cellJet.phiWeighted(i)
78 - cellJet.phiWeighted(j) );
79 if (dPhi > M_PI) dPhi = 2. * M_PI - dPhi;
80 double dR = sqrt( pow2(dEta) + pow2(dPhi) );
84 // Fill ET-difference between jets (to check ordering of list).
85 for (int i = 1; i < cellJet.size(); ++i)
86 eTdiff.fill( cellJet.eT(i-1)- cellJet.eT(i) );
88 // End of event loop. Statistics. Histograms.
91 cout << nJets << eTjets << etaJets << phiJets
92 << distJets << eTdiff;