From c37b40c186ae85d943ab0377606b3616119869bb Mon Sep 17 00:00:00 2001 From: tylern4 Date: Wed, 1 Aug 2018 18:46:28 -0400 Subject: [PATCH] Add percentage to output --- .../src/main/java/org/jlab/c12val/ParticleCounter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/release-validation-1/src/main/java/org/jlab/c12val/ParticleCounter.java b/release-validation-1/src/main/java/org/jlab/c12val/ParticleCounter.java index 656769c..90f5a89 100644 --- a/release-validation-1/src/main/java/org/jlab/c12val/ParticleCounter.java +++ b/release-validation-1/src/main/java/org/jlab/c12val/ParticleCounter.java @@ -71,9 +71,11 @@ public void processRecBank(DataBank recBank, int gpid, Integer gq, double gpx, d public void printResults() { - System.out.printf("%-7s %-7s %-7s %n", "pid", "#gen", "#rec"); + System.out.printf("%-7s %-7s %-7s %-7s %n", "pid", "#gen", "#rec", "#percent"); for(int i = 0; i < pids.size(); i++) { - System.out.printf("%-7d %-7d %-7d %n", pids.get(i), genCounts.get(i), recCounts.get(i)); + if(genCounts.get(i) >0) { + System.out.printf("%-7d %-7d %-7d %-2f %n", pids.get(i), genCounts.get(i), recCounts.get(i), 100.0*recCounts.get(i)/genCounts.get(i)); + } } }