diff --git a/release-validation-1/sim.py b/release-validation-1/sim.py index ea4e29e..e06716d 100755 --- a/release-validation-1/sim.py +++ b/release-validation-1/sim.py @@ -33,11 +33,12 @@ def cleanup(): yield dirpath -def make_names(output_dir, num): +def make_names(output_dir, input_file, num): time = datetime.now().strftime('%m_%d_%Y-%H%M_') + input_file = input_file[:-4] l = [] for i in range(0, num): - l.append(output_dir + "sim_" + time + str(i)) + l.append(output_dir + input_file + "_" + time + str(i)) return l @@ -80,14 +81,15 @@ def do_gemc(base): with open(dir_temp + "/do_sim.sh", "w") as text_file: text_file.write(r"""#!/bin/bash source /jlab/2.2/ce/jlab.sh 2> /dev/null + /jlab/clas12Tags/4a.2.4/source/gemc /jlab/workdir/clas12.gcard -USE_GUI=0 -OUTPUT="evio, /jlab/workdir/shared/out.evio" -INPUT_GEN_FILE="LUND, /jlab/workdir/shared/input.dat" """) - command = "docker run -v`pwd`:/jlab/workdir/shared --rm -it jeffersonlab/clas12software:0.1 bash /jlab/workdir/shared/do_sim.sh " + command = "docker run -v`pwd`:/jlab/workdir/shared --rm -it jeffersonlab/clas12tags:4a.2.4 bash /jlab/workdir/shared/do_sim.sh " out = " 1>" + base + ".out" err = " 2>" + base + ".err" command = command + err + out - exit_code = os.system(command) + exit_code = os.system(command + " && exit 0") shutil.copy(dir_temp + "/out.evio", base + ".evio") @@ -108,7 +110,7 @@ def main(): if args.cores == 0 or args.cores > cpu_count(): args.cores = cpu_count() - files = make_names(args.output_dir, args.cores) + files = make_names(args.output_dir, args.events, args.cores) split_lund(args.events, files) pool = Pool(processes=args.cores) pool.imap_unordered(do_gemc, files) 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)); + } } } diff --git a/release-validation-1/validate.sh b/release-validation-1/validate.sh new file mode 100755 index 0000000..73bb30f --- /dev/null +++ b/release-validation-1/validate.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +mkdir -p validate +python sim.py -o $PWD/validate 2> /dev/null 1> /dev/null + +evio2hipo out.hipo validate/*.evio + +echo "out.hipo" validate/files.list + +echo "set inputDir $PWD/validate" > cook.clara +echo "set outputDir $PWD" >> cook.clara +echo "set threads $(nproc)" >> cook.clara +echo "set javaMemory 4" >> cook.clara +echo "set fileList $PWD/validate/files.list" >> cook.clara +echo "run local" >> cook.clara +echo "exit" >> cook.clara +#clara-shell cook.clara + + +#mvn install && mvn exec:java -Dexec.mainClass="org.jlab.c12val.ParticleCounter"