Running the Kt jet algorithm for high energy particle collisions
Source code name: "hep_jets_kt.py"
Programming language: Python
Topic: Physics/HEP
https://datamelt.org/code/cache/hep_jets_kt_5739.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.

``````

from java.awt import Color
from java.util import ArrayList
from jhplot  import *
from hephysics.jet import *
from hephysics.particle import *
from jhplot.shapes import *

plist=ArrayList()
p=ParticleF(10.0, -2.3211,-15.0785, 18.250); plist.add(p)
p=ParticleF(-58.56, 13.672,-60.729, 85.479); plist.add(p)
p=ParticleF(249.62, 59.98,-252.05,  359.78); plist.add(p)
p=ParticleF(8.31, -1.26, -13.692,   16.072); plist.add(p)
p=ParticleF(-132.34, 31.19,-133.81, 190.7);  plist.add(p)
p=ParticleF(31.629, -7.989, 7.4822, 33.47);  plist.add(p)

R=0.6 # jet radius. use kT jets
ktjet = KTjet(R, 1, 1, 200.0);
ktjet.setDebug(True);
ktjet.buildJets(plist);
ktjet.printJets()
jets=ktjet.getJetsSorted()

c1 = HPlot("Canvas",600,600)
c1.setGTitle("kT jets")
c1.visible(1)
c1.setRange(-4,4,-7,7)
c1.setNameX("η")

pp=P1D("particles")

for i in range(plist.size()):
p=plist.get(i)
eta=p.getEta()
phi=p.getPhi()
# psize=int(p.getEt()/10.)
# pp.setSymbolSize(2)

# show jets
for k in range(jets.size()):
jet=P1D("jet Nr "+str(k))
jet.setColor(Color.red)
jet.setSymbolSize(7)
jj=jets.get(k)
etaJ=jj.getEta()
phiJ=jj.getPhi()