Skip to content
Snippets Groups Projects
Commit 173bf614 authored by Christopher Dilks's avatar Christopher Dilks
Browse files

feat: define analysis benchmark command

parent 90017161
Branches
No related tags found
2 merge requests!309Irt algo,!293feat: dRICH benchmarks
......@@ -84,10 +84,19 @@ OptionParser.new do |o|
exit 2
end
end.parse!(ARGV.length>0 ? ARGV : ['--help'])
# print options
puts 'settings: {'.upcase
opt.each_pair { |k,v| puts "#{k.to_s.rjust(20)} => #{v}" }
puts '}'
# check for required options
if opt.evgen=='' and opt.ana_only==false
$stderr.puts "ERROR: required options have not been set"
$stderr.puts "run '#{$0} --help' for guidance"
exit 1
end
# get compact file
if ENV['DETECTOR_PATH'].nil? or ENV['DETECTOR_CONFIG'].nil?
$stderr.puts "ERROR: unknown DETECTOR_PATH or DETECTOR_CONFIG"
......@@ -106,16 +115,16 @@ end
# fixed angle particle gun
evgen_fixed_angle = Proc.new do |theta, energy, particle|
[
'npsim',
'--runType', 'batch',
'--compactFile', compact_file,
'--outputFile', opt.sim_file,
'--part.userParticleHandler=""',
'--enableGun',
'--numberOfEvents', opt.num_events,
'--gun.particle', particle,
'--gun.energy', "#{energy}*GeV",
'--gun.direction', "(#{theta2xyz(theta).join ', '})",
"npsim",
"--runType batch",
"--compactFile #{compact_file}",
"--outputFile #{opt.sim_file}",
"--part.userParticleHandler=''",
"--enableGun",
"--numberOfEvents #{opt.num_events}",
"--gun.particle #{particle}",
"--gun.energy #{energy}*GeV",
"--gun.direction (#{theta2xyz(theta).join ", "})",
]
end
......@@ -154,14 +163,32 @@ recon_cmd = [
opt.sim_file,
]
# define analysis benchmark command
# ---------------------------------------------------
analysis_cmd = [
opt.benchmark_exe,
"-i #{opt.rec_file}",
"-o #{opt.ana_file}",
]
analysis_cmd.append "-a #{opt.algos.join ' '}" if opt.algos.size > 0
analysis_cmd.append '-' + 'v'*opt.verbosity if opt.verbosity > 0
# execute commands
# ---------------------------------------------------
exe = Proc.new do |cmd_args, name|
cmd = cmd_args.join ' '
puts "#{name} command:".upcase
puts cmd
cmd_args.each_with_index do |arg,i|
line = i==0 ? '' : ' '
line += arg
line += ' \\' unless i+1==cmd_args.size
puts line
end
unless opt.dry_run
puts '-'*50
puts "#{name} execution:".upcase
system cmd or raise "#{name} failed!"
end
puts '-'*50
......@@ -172,3 +199,6 @@ unless opt.ana_only
exe.call evgen_cmd, 'event generator' if opt.run_sim
exe.call recon_cmd, 'reconstruction' if opt.run_rec
end
if opt.ana_only or opt.run_ana
exe.call analysis_cmd, 'benchmark analysis'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment