10 #include "Pythia8/Pythia.h"
19 #include "Pythia8/FastJet3.h"
21 using namespace Pythia8;
39 Event&
event = pythia.event;
42 pythia.readString(
"HardQCD:all = on");
43 pythia.readString(
"PhaseSpace:pTHatMin = 200.");
46 pythia.readString(
"Next:numberShowInfo = 0");
47 pythia.readString(
"Next:numberShowProcess = 0");
48 pythia.readString(
"Next:numberShowEvent = 0");
51 pythia.readString(
"Beams:eCM = 14000.");
55 SlowJet slowJet( power, R, pTMin, etaMax, select, massSet, 0,
false);
59 SlowJet fjCore( power, R, pTMin, etaMax, select, massSet, 0,
true);
70 fastjet::JetDefinition jetDef(fastjet::genkt_algorithm, R, power);
71 std::vector <fastjet::PseudoJet> fjInputs;
74 Hist nJetsS(
"number of jets (SlowJet)", 100, -0.5, 99.5);
75 Hist nJetsC(
"number of jets, FJcore - SlowJet ", 99, -49.5, 49.5);
76 Hist nJetsF(
"number of jets, FastJet - SlowJet", 99, -49.5, 49.5);
77 Hist pTjetsS(
"pT for jets (SlowJet)", 100, 0., 500.);
78 Hist pTjetsC(
"pT for jets, FJcore - SlowJet ", 100, -10., 10.);
79 Hist pTjetsF(
"pT for jets, FastJet - SlowJet", 100, -10., 10.);
80 Hist etaJetsS(
"eta for jets (SlowJet)", 100, -5., 5.);
81 Hist phiJetsS(
"phi for jets (SlowJet)", 100, -M_PI, M_PI);
82 Hist RdistC(
"R distance FJcore to SlowJet ", 100, 0., 1.);
83 Hist RdistF(
"R distance FastJet to SlowJet", 100, 0., 1.);
84 Hist distJets(
"R distance between jets", 100, 0., 10.);
85 Hist pTdiff(
"pT difference between consecutive jets", 100, -100., 400.);
86 Hist nAna(
"multiplicity of analyzed event", 100, -0.5, 999.5);
87 Hist tGen(
"generation time as fn of multiplicity", 100, -0.5, 999.5);
88 Hist tSlow(
"SlowJet time as fn of multiplicity", 100, -0.5, 999.5);
89 Hist tCore(
"FJcore time as fn of multiplicity ", 100, -0.5, 999.5);
90 Hist tFast(
"FastJet time as fn of multiplicity", 100, -0.5, 999.5);
91 Hist tSlowGen(
"SlowJet/generation time as fn of multiplicity",
93 Hist tCoreGen(
"FJcore/generation time as fn of multiplicity",
95 Hist tFastGen(
"FastJet/generation time as fn of multiplicity",
97 Hist tFastCore(
"FastJet/FJcore time as fn of multiplicity",
101 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
102 clock_t befGen = clock();
103 if (!pythia.next())
continue;
104 clock_t aftGen = clock();
107 clock_t befSlow = clock();
108 slowJet.analyze( pythia.event );
109 clock_t aftSlow = clock();
110 if (iEvent < nListJets) slowJet.list();
113 int nSlow = slowJet.sizeJet();
114 nJetsS.fill( nSlow );
115 for (
int i = 0; i < nSlow; ++i) {
116 pTjetsS.fill( slowJet.pT(i) );
117 etaJetsS.fill( slowJet.y(i) );
118 phiJetsS.fill( slowJet.phi(i) );
122 for (
int i = 0; i < nSlow - 1; ++i)
123 for (
int j = i + 1; j < nSlow; ++j) {
124 double dY = slowJet.y(i) - slowJet.y(j);
125 double dPhi = abs( slowJet.phi(i) - slowJet.phi(j) );
126 if (dPhi > M_PI) dPhi = 2. * M_PI - dPhi;
127 double dR = sqrt( pow2(dY) + pow2(dPhi) );
132 for (
int i = 1; i < nSlow; ++i)
133 pTdiff.fill( slowJet.pT(i-1)- slowJet.pT(i) );
136 clock_t befCore = clock();
137 fjCore.analyze( pythia.event );
138 clock_t aftCore = clock();
139 if (iEvent < nListJets) fjCore.list();
142 int nCore = fjCore.sizeJet();
143 nJetsC.fill( nCore - nSlow);
144 if (nCore == nSlow) {
145 for (
int i = 0; i < nCore; ++i) {
146 pTjetsC.fill( fjCore.pT(i) - slowJet.pT(i) );
147 double dist2 = pow2( fjCore.y(i) - slowJet.y(i))
148 + pow2( fjCore.phi(i) - slowJet.phi(i) );
149 RdistC.fill( sqrt(dist2) );
154 clock_t befFast = clock();
159 for (
int i = 0; i <
event.size(); ++i)
if (event[i].isFinal()) {
162 if (select > 2 && event[i].isNeutral() )
continue;
163 else if (select == 2 && !event[i].isVisible() )
continue;
164 if (etaMax < 20. && abs(event[i].eta()) > etaMax)
continue;
167 fastjet::PseudoJet particleTemp =
event[i];
170 pTemp =
event[i].p();
171 mTemp =
event[i].m();
173 mTemp = (massSet == 0 ||
event[i].id() == 22) ? 0. : 0.13957;
174 pTemp.e( sqrt(pTemp.pAbs2() + mTemp*mTemp) );
175 particleTemp.reset_momentum( pTemp.px(), pTemp.py(),
176 pTemp.pz(), pTemp.e() );
182 fjInputs.push_back( particleTemp);
187 vector <fastjet::PseudoJet> inclusiveJets, sortedJets;
188 fastjet::ClusterSequence clustSeq(fjInputs, jetDef);
189 inclusiveJets = clustSeq.inclusive_jets(pTMin);
190 sortedJets = sorted_by_pt(inclusiveJets);
191 clock_t aftFast = clock();
196 if (iEvent < nListJets) {
197 cout <<
"\n -------- FastJet jets, p = " << setw(2) << power
198 <<
" --------------------------------------------------\n\n "
199 <<
" i pT y phi mult chgmult photons"
200 <<
" hardest pT in neutral " << endl
202 <<
" constituent hadrons " << endl;
203 for (
int i = 0; i < int(sortedJets.size()); ++i) {
204 vector<fastjet::PseudoJet> constituents
205 = sortedJets[i].constituents();
206 fastjet::PseudoJet hardest
207 = fastjet::SelectorNHardest(1)(constituents)[0];
208 vector<fastjet::PseudoJet> neutral_hadrons
209 = ( fastjet::SelectorIsHadron()
210 && fastjet::SelectorIsNeutral())(constituents);
211 double neutral_hadrons_pt = join(neutral_hadrons).perp();
212 cout << setw(4) << i << fixed << setprecision(3) << setw(11)
213 << sortedJets[i].perp() << setw(9) << sortedJets[i].rap()
214 << setw(9) << sortedJets[i].phi_std()
215 << setw(6) << constituents.size()
216 << setw(8) << fastjet::SelectorIsCharged().count(constituents)
217 << setw(8) << fastjet::SelectorId(22).count(constituents)
218 << setw(13) << hardest.user_info<
Particle>().name()
219 <<
" " << setw(10) << neutral_hadrons_pt << endl;
221 cout <<
"\n -------- End FastJet Listing ------------------"
222 <<
"---------------------------------" << endl;
226 int nFast = sortedJets.size();
227 nJetsF.fill( nFast - nSlow);
228 if (nFast == nSlow) {
229 for (
int i = 0; i < nFast; ++i) {
230 pTjetsF.fill( sortedJets[i].perp() - slowJet.pT(i) );
231 double dist2 = pow2( sortedJets[i].rap() - slowJet.y(i))
232 + pow2( sortedJets[i].phi_std() - slowJet.phi(i));
233 RdistF.fill( sqrt(dist2) );
238 nAna.fill( nAnalyze);
239 tGen.fill( nAnalyze, aftGen - befGen);
240 tSlow.fill( nAnalyze, aftSlow - befSlow);
241 tCore.fill( nAnalyze, aftCore - befCore);
242 tFast.fill( nAnalyze, aftFast - befFast);
249 tSlowGen = tSlow / tGen;
250 tCoreGen = tCore / tGen;
251 tFastGen = tFast / tGen;
252 tFastCore = tFast / tCore;
257 cout << nJetsS << nJetsC << nJetsF << pTjetsS << pTjetsC << pTjetsF
258 << etaJetsS << phiJetsS << RdistC << RdistF << distJets << pTdiff
259 << nAna << tGen << tSlow << tCore << tFast << tSlowGen << tCoreGen
260 << tFastGen << tFastCore;