Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:53

0001 #!/usr/bin/env ruby
0002 # -----------------------------------------------------------------------------
0003 # 'HAddFilesFromPattern.rb'
0004 # Derek Anderson
0005 # 10.11.2023
0006 #
0007 # Runs hadd over set of files matching a certain pattern...
0008 # -----------------------------------------------------------------------------
0009 
0010 # modules to use
0011 require 'fileutils'
0012 
0013 # input parameters
0014 in_path = "./old_eval/num1evt500pt10pim_oneMatchPerParticle"
0015 in_pref = "/sPhenixG4_oneMatchPerParticle*"
0016 in_suff = ".root"
0017 
0018 # output parameters
0019 out_file = "sPhenixG4_oneMatchPerParticle.pt10num1evt500pim.d18m1y2024.root"
0020 
0021 # create input matching pattern
0022 in_pattern = in_path + "/" + in_pref + "*" + in_suff
0023 in_pattern.gsub!("//", "/")
0024 in_pattern.gsub!("..", ".")
0025 
0026 # create input argument
0027 arg_input = ""
0028 num_input = Dir[in_pattern].size
0029 Dir[in_pattern].each_with_index do |file, iFile|
0030   arg_input += file
0031   arg_input += " " if iFile + 1 != num_input
0032 end
0033 
0034 # run hadd
0035 exec("hadd #{out_file} #{arg_input}")
0036 
0037 # end -------------------------------------------------------------------------