Back to home page

sPhenix code displayed by LXR

 
 

    


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