|
| 1 | +using BenchmarkTools |
| 2 | +using JetReconstruction |
| 3 | + |
| 4 | +const events_file_pp = joinpath(@__DIR__, "..", "test", "data", "events.pp13TeV.hepmc3.gz") |
| 5 | +const events_file_ee = joinpath(@__DIR__, "..", "test", "data", "events.eeH.hepmc3.gz") |
| 6 | + |
| 7 | +const pp_events = JetReconstruction.read_final_state_particles(events_file_pp, |
| 8 | + T = PseudoJet) |
| 9 | +const ee_events = JetReconstruction.read_final_state_particles(events_file_ee, T = EEJet) |
| 10 | + |
| 11 | +function jet_reconstruct_harness(events; algorithm, strategy, power, distance, |
| 12 | + recombine = RecombinationMethods[RecombinationScheme.EScheme], |
| 13 | + ptmin::Real = 5.0, dcut = nothing, njets = nothing,) |
| 14 | + for event in events |
| 15 | + cs = jet_reconstruct(event; R = distance, p = power, algorithm = algorithm, |
| 16 | + strategy = strategy, recombine...) |
| 17 | + if !isnothing(njets) |
| 18 | + finaljets = exclusive_jets(cs; njets = njets) |
| 19 | + elseif !isnothing(dcut) |
| 20 | + finaljets = exclusive_jets(cs; dcut = dcut) |
| 21 | + else |
| 22 | + finaljets = inclusive_jets(cs; ptmin = ptmin) |
| 23 | + end |
| 24 | + end |
| 25 | +end |
| 26 | + |
| 27 | +const SUITE = BenchmarkGroup() |
| 28 | +SUITE["jet_reconstruction"] = BenchmarkGroup(["reconstruction"]) |
| 29 | + |
| 30 | +## pp events |
| 31 | +for stg in [RecoStrategy.N2Plain, RecoStrategy.N2Tiled] |
| 32 | + strategy_name = "$(stg)" |
| 33 | + SUITE["jet_reconstruction"][strategy_name] = BenchmarkGroup(["pp", strategy_name]) |
| 34 | + for alg in [JetAlgorithm.AntiKt, JetAlgorithm.CA, JetAlgorithm.Kt] |
| 35 | + for distance in [0.4] |
| 36 | + power = JetReconstruction.algorithm2power[alg] |
| 37 | + SUITE["jet_reconstruction"][strategy_name]["Alg=$alg, R=$distance"] = @benchmarkable jet_reconstruct_harness($pp_events; |
| 38 | + algorithm = $alg, |
| 39 | + strategy = $stg, |
| 40 | + power = $power, |
| 41 | + distance = $distance, |
| 42 | + ptmin = 5.0) evals=1 samples=32 |
| 43 | + end |
| 44 | + end |
| 45 | +end |
| 46 | + |
| 47 | +## ee events |
| 48 | +SUITE["jet_reconstruction"]["ee"] = BenchmarkGroup(["ee"]) |
| 49 | +for alg in [JetAlgorithm.Durham] |
| 50 | + for distance in [0.4] |
| 51 | + power = -1 |
| 52 | + SUITE["jet_reconstruction"]["ee"]["Alg=$alg, R=$distance"] = @benchmarkable jet_reconstruct_harness($ee_events; |
| 53 | + algorithm = $alg, |
| 54 | + strategy = $RecoStrategy.Best, |
| 55 | + power = $power, |
| 56 | + distance = $distance, |
| 57 | + ptmin = 5.0) evals=1 samples=32 |
| 58 | + end |
| 59 | +end |
| 60 | + |
| 61 | +if abspath(PROGRAM_FILE) == @__FILE__ |
| 62 | + @info "Running benchmark suite" |
| 63 | + results = run(SUITE, verbose = true) |
| 64 | + @info results |
| 65 | +end |
0 commit comments