Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-07 08:13:22

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/eec/SCorrelatorUtilities"
0016 copy_to   = "/sphenix/user/danderson/sphenix/analysis/EnergyCorrelatorsJets/ColdQCDENC/SCorrelatorUtilities"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "README.md",
0021   "src/ClustInfo.cc",
0022   "src/ClustInfo.h",
0023   "src/ClustInterfaces.cc",
0024   "src/ClustInterfaces.h",
0025   "src/ClustTools.cc",
0026   "src/ClustTools.h",
0027   "src/Constants.h",
0028   "src/CstInfo.cc",
0029   "src/CstInfo.h",
0030   "src/CstInterfaces.cc",
0031   "src/CstInterfaces.h",
0032   "src/FlowInfo.cc",
0033   "src/FlowInfo.h",
0034   "src/FlowInterfaces.cc",
0035   "src/FlowInterfaces.h",
0036   "src/GEvtInfo.cc",
0037   "src/GEvtInfo.h",
0038   "src/GEvtTools.cc",
0039   "src/GEvtTools.h",
0040   "src/Interfaces.h",
0041   "src/JetInfo.cc",
0042   "src/JetInfo.h",
0043   "src/NodeInterfaces.cc",
0044   "src/NodeInterfaces.h",
0045   "src/ParInfo.cc",
0046   "src/ParInfo.h",
0047   "src/ParInterfaces.cc",
0048   "src/ParInterfaces.h",
0049   "src/ParTools.cc",
0050   "src/ParTools.h",
0051   "src/REvtInfo.cc",
0052   "src/REvtInfo.h",
0053   "src/REvtTools.cc",
0054   "src/REvtTools.h",
0055   "src/TreeInterfaces.cc",
0056   "src/TreeInterfaces.h",
0057   "src/TrkInfo.cc",
0058   "src/TrkInfo.h",
0059   "src/TrkInterfaces.cc",
0060   "src/TrkInterfaces.h",
0061   "src/TrkTools.cc",
0062   "src/TrkTools.h",
0063   "src/TwrInfo.cc",
0064   "src/TwrInfo.h",
0065   "src/TwrInterfaces.cc",
0066   "src/TwrInterfaces.h",
0067   "src/TwrTools.cc",
0068   "src/TwrTools.h",
0069   "src/Tools.h",
0070   "src/Types.h",
0071   "src/TypesLinkDef.h",
0072   "src/TupleInterfaces.cc",
0073   "src/TupleInterfaces.h",
0074   "src/VtxInterfaces.cc",
0075   "src/VtxInterfaces.h",
0076   "scripts/copy-to-analysis.rb",
0077   "scripts/wipe-source.sh"
0078 ]
0079 
0080 # do copying
0081 to_copy.each do |file|
0082 
0083   # make directory in target if needed
0084   if file.include? "/"
0085 
0086     # grab relative path to file
0087     relative_path = file.clone
0088     relative_path.gsub!(copy_from, "")
0089 
0090     # clean up and isolate path
0091     relative_path.gsub!("//",  "/")
0092     relative_path.gsub!("/./", "/")
0093     relative_path.slice!(relative_path.rindex("/")..-1)
0094 
0095     # make directory
0096     to_make = copy_to + "/" + relative_path
0097     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0098   end
0099 
0100   # make source and target paths
0101   source = copy_from + "/" + file
0102   target = copy_to + "/" + file
0103 
0104   # remove any unwanted patterns
0105   source.gsub!("//",  "/")
0106   target.gsub!("//",  "/")
0107   source.gsub!("/./", "/")
0108   target.gsub!("/./", "/")
0109 
0110   # copy file
0111   FileUtils.cp_r(source, target, :verbose => true)
0112 end
0113 
0114 # end -------------------------------------------------------------------------