Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14: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/tracking/TracksInJetQA"
0016 copy_to   = "/sphenix/user/danderson/sphenix/analysis/JS-Jet/TrackJetQAMaker"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "README.md",
0021   "Fun4All_MakeTrksInJetQA.C",
0022   "RunTrksInJetQA.rb",
0023   "RunTrksInJetQAOnCondor.sh",
0024   "RunTrksInJetQAOnCondor.job",
0025   "input/pp200py8run11jet30.dst_global.list",
0026   "input/pp200py8run11jet30.dst_tracks.list",
0027   "input/pp200py8run11jet30.dst_trkr_cluster.list",
0028   "input/pp200py8run11jet30.dst_trkr_hit.list",
0029   "scripts/copy-to-analysis.rb",
0030   "scripts/wipe-source.sh",
0031   "src/TrksInJetQAClustManager.cc",
0032   "src/TrksInJetQAClustManager.h",
0033   "src/TrksInJetQAHitManager.cc",
0034   "src/TrksInJetQAHitManager.h",
0035   "src/TrksInJetQAJetManager.cc",
0036   "src/TrksInJetQAJetManager.h",
0037   "src/TrksInJetQATrkManager.cc",
0038   "src/TrksInJetQATrkManager.h",
0039   "src/TrksInJetQABaseFiller.cc",
0040   "src/TrksInJetQABaseFiller.h",
0041   "src/TrksInJetQAInJetFiller.cc",
0042   "src/TrksInJetQAInJetFiller.h",
0043   "src/TrksInJetQAInclusiveFiller.cc",
0044   "src/TrksInJetQAInclusiveFiller.h",
0045   "src/TrksInJetQABaseManager.cc",
0046   "src/TrksInJetQABaseManager.h",
0047   "src/TrksInJetQA.cc",
0048   "src/TrksInJetQA.h",
0049   "src/TrksInJetQAConfig.h",
0050   "src/TrksInJetQATypes.h",
0051   "src/TrksInJetQAHist.h",
0052   "src/autogen.sh",
0053   "src/configure.ac",
0054   "src/Makefile.am",
0055   "src/sphx-build"
0056 ]
0057 
0058 # do copying
0059 to_copy.each do |file|
0060 
0061   # make directory in target if needed
0062   if file.include? "/"
0063 
0064     # grab relative path to file
0065     relative_path = file.clone
0066     relative_path.gsub!(copy_from, "")
0067 
0068     # clean up and isolate path
0069     relative_path.gsub!("//",  "/")
0070     relative_path.gsub!("/./", "/")
0071     relative_path.slice!(relative_path.rindex("/")..-1)
0072 
0073     # make directory
0074     to_make = copy_to + "/" + relative_path
0075     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0076   end
0077 
0078   # make source and target paths
0079   source = copy_from + "/" + file
0080   target = copy_to + "/" + file
0081 
0082   # remove any unwanted patterns
0083   source.gsub!("//",  "/")
0084   target.gsub!("//",  "/")
0085   source.gsub!("/./", "/")
0086   target.gsub!("/./", "/")
0087 
0088   # copy file
0089   FileUtils.cp_r(source, target, :verbose => true)
0090 end
0091 
0092 # end -------------------------------------------------------------------------