go-hep.org/x/hep@v0.38.1/fastjet/utils.go (about) 1 // Copyright ©2017 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package fastjet 6 7 func imin(i, j int) int { 8 if i < j { 9 return i 10 } 11 return j 12 } 13 14 func imax(i, j int) int { 15 if i > j { 16 return i 17 } 18 return j 19 } 20 21 // ByPt sorts jets by descending Pt 22 type ByPt []Jet 23 24 func (p ByPt) Len() int { 25 return len(p) 26 } 27 28 func (p ByPt) Less(i, j int) bool { 29 return p[j].Pt() < p[i].Pt() 30 } 31 32 func (p ByPt) Swap(i, j int) { 33 p[i], p[j] = p[j], p[i] 34 }