Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:18

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/SCorrelatorQAMaker"
0016 copy_to   = "/sphenix/user/danderson/sphenix/analysis/EnergyCorrelatorsJets/ColdQCDENC/SCorrelatorQAMaker"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "README.md",
0021   "Fun4All_RunCorrelatorQAModules.C",
0022   "RunStandaloneCorrelatorQAModules.cxx",
0023   "CorrelatorQAMakerOptions.h",
0024   "RunFun4AllCorrelatorQAModules.rb",
0025   "RunStandaloneCorrelatorQAModules.rb",
0026   "RunStandaloneCorrelatorQAModulesOnCondor.sh",
0027   "RunStandaloneCorrelatorQAModulesOnCondor.job",
0028   "scripts/copy-to-analysis.rb",
0029   "scripts/wipe-source.sh",
0030   "scripts/RunSigmaDcaCalculation.sh",
0031   "macros/CalculateSigmaDca.cxx",
0032   "macros/QuickWeirdTuplePlotter.cxx",
0033   "src/SCorrelatorQAMaker.cc",
0034   "src/SCorrelatorQAMaker.h",
0035   "src/SCorrelatorQAMakerLinkDef.h",
0036   "src/SBaseQAPlugin.h",
0037   "src/SCheckCstPairs.h",
0038   "src/SCheckCstPairs.cc",
0039   "src/SCheckCstPairsConfig.h",
0040   "src/SCheckTrackPairs.h",
0041   "src/SCheckTrackPairs.cc",
0042   "src/SCheckTrackPairsConfig.h",
0043   "src/SMakeClustQATree.h",
0044   "src/SMakeClustQATree.cc",
0045   "src/SMakeClustQATreeConfig.h",
0046   "src/SMakeClustQATreeOutput.h",
0047   "src/SMakeTrackQATuple.h",
0048   "src/SMakeTrackQATuple.cc",
0049   "src/SMakeTrackQATupleConfig.h",
0050   "src/SReadLambdaJetTree.h",
0051   "src/SReadLambdaJetTree.cc",
0052   "src/SReadLambdaJetTreeConfig.h",
0053   "src/SReadLambdaJetTreeHistDef.h",
0054   "src/autogen.sh",
0055   "src/configure.ac",
0056   "src/Makefile.am",
0057   "src/sphx-build"
0058 ]
0059 
0060 # do copying
0061 to_copy.each do |file|
0062 
0063   # make directory in target if needed
0064   if file.include? "/"
0065 
0066     # grab relative path to file
0067     relative_path = file.clone
0068     relative_path.gsub!(copy_from, "")
0069 
0070     # clean up and isolate path
0071     relative_path.gsub!("//",  "/")
0072     relative_path.gsub!("/./", "/")
0073     relative_path.slice!(relative_path.rindex("/")..-1)
0074 
0075     # make directory
0076     to_make = copy_to + "/" + relative_path
0077     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0078   end
0079 
0080   # make source and target paths
0081   source = copy_from + "/" + file
0082   target = copy_to + "/" + file
0083 
0084   # remove any unwanted patterns
0085   source.gsub!("//",  "/")
0086   target.gsub!("//",  "/")
0087   source.gsub!("/./", "/")
0088   target.gsub!("/./", "/")
0089 
0090   # copy file
0091   FileUtils.cp_r(source, target, :verbose => true)
0092 end
0093 
0094 # end -------------------------------------------------------------------------