Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:11

0001 #!/usr/bin/env ruby
0002 # -----------------------------------------------------------------------------
0003 # 'copy-to-analysis.rb'
0004 # Derek Anderson
0005 # 12.21.2023
0006 #
0007 # Script to automate copying files over to
0008 # a fork of the sPHENIX analysis repo.
0009 # -----------------------------------------------------------------------------
0010 
0011 # modules to use
0012 require 'fileutils'
0013 
0014 # top directory to copy from/to
0015 copy_from = "/sphenix/user/danderson/jets/BeamBackgroundFilterAndQA"
0016 copy_to   = "/sphenix/user/danderson/sphenix/analysis/JS-Jet/BeamBackgroundFilterAndQA"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "README.md",
0021   "Fun4All_TestBeamBackgroundFilterAndQA.C",
0022   "scripts/copy-to-analysis.rb",
0023   "src/BaseBeamBackgroundFilter.h",
0024   "src/BeamBackgroundFilterAndQA.cc",
0025   "src/BeamBackgroundFilterAndQA.h",
0026   "src/BeamBackgroundFilterAndQADefs.h",
0027   "src/BeamBackgroundFilterAndQALinkDef.h",
0028   "src/NullFilter.cc",
0029   "src/NullFilter.h",
0030   "src/StreakSidebandFilter.cc",
0031   "src/StreakSidebandFilter.h",
0032   "src/TestPHFlags.cc",
0033   "src/TestPHFlags.h",
0034   "src/autogen.sh",
0035   "src/configure.ac",
0036   "src/Makefile.am",
0037   "src/sphx-build"
0038 ]
0039 
0040 # do copying
0041 to_copy.each do |file|
0042 
0043   # make directory in target if needed
0044   if file.include? "/"
0045 
0046     # grab relative path to file
0047     relative_path = file.clone
0048     relative_path.gsub!(copy_from, "")
0049 
0050     # clean up and isolate path
0051     relative_path.gsub!("//",  "/")
0052     relative_path.gsub!("/./", "/")
0053     relative_path.slice!(relative_path.rindex("/")..-1)
0054 
0055     # make directory
0056     to_make = copy_to + "/" + relative_path
0057     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0058   end
0059 
0060   # make source and target paths
0061   source = copy_from + "/" + file
0062   target = copy_to + "/" + file
0063 
0064   # remove any unwanted patterns
0065   source.gsub!("//",  "/")
0066   target.gsub!("//",  "/")
0067   source.gsub!("/./", "/")
0068   target.gsub!("/./", "/")
0069 
0070   # copy file
0071   FileUtils.cp_r(source, target, :verbose => true)
0072 end
0073 
0074 # end -------------------------------------------------------------------------