Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:55

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/tracking/DeltaPtCutStudy"
0016 copy_to   = "/sphenix/user/danderson/sphenix/analysis/AndersonAnalysisModules/TrackStudies/SDeltaPtCutStudy"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "README.md",
0021   "DoDeltaPtCutStudy.C",
0022   "scripts/wipe-source.sh",
0023   "scripts/copy-to-analysis.rb",
0024   "macros/CheckDeltaPtWithBoundaryMasks.cxx",
0025   "src/SDeltaPtCutStudy.cc",
0026   "src/SDeltaPtCutStudy.h",
0027   "src/SDeltaPtCutStudy.io.h",
0028   "src/SDeltaPtCutStudy.sys.h",
0029   "src/SDeltaPtCutStudy.ana.h",
0030   "src/SDeltaPtCutStudy.plot.h",
0031   "src/SDeltaPtCutStudyLinkDef.h",
0032   "src/autogen.sh",
0033   "src/configure.ac",
0034   "src/Makefile.am",
0035   "src/sphx-build"
0036 ]
0037 
0038 # do copying
0039 to_copy.each do |file|
0040 
0041   # make directory in target if needed
0042   if file.include? "/"
0043 
0044     # grab relative path to file
0045     relative_path = file.clone
0046     relative_path.gsub!(copy_from, "")
0047 
0048     # clean up and isolate path
0049     relative_path.gsub!("//",  "/")
0050     relative_path.gsub!("/./", "/")
0051     relative_path.slice!(relative_path.rindex("/")..-1)
0052 
0053     # make directory
0054     to_make = copy_to + "/" + relative_path
0055     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0056   end
0057 
0058   # make source and target paths
0059   source = copy_from + "/" + file
0060   target = copy_to + "/" + file
0061 
0062   # remove any unwanted patterns
0063   source.gsub!("//",  "/")
0064   target.gsub!("//",  "/")
0065   source.gsub!("/./", "/")
0066   target.gsub!("/./", "/")
0067 
0068   # copy file
0069   FileUtils.cp_r(source, target, :verbose => true)
0070 end
0071 
0072 # end -------------------------------------------------------------------------