File indexing completed on 2024-04-06 11:55:58
0001
0002
0003
0004
0005 condorSubTemplate="""
0006 Executable = {path}/workingArea/skim_{name}.tcsh
0007 Universe = vanilla
0008 Output = {path}/workingArea/skim_out_{name}.txt
0009 Error = {path}/workingArea/skim_err_{name}.txt
0010 Log = {path}/workingArea/skim_condor_{name}.log
0011 request_memory = 2000M
0012 request_disk = 800M
0013 batch_name = skim
0014 +JobFlavour = "workday"
0015 Queue Arguments from (
0016 {name}
0017 )
0018 """
0019
0020
0021 condorSubTemplateCAF="""
0022 Executable = {path}/workingArea/skim_{name}.tcsh
0023 Universe = vanilla
0024 Output = {path}/workingArea/skim_out_{name}.txt
0025 Error = {path}/workingArea/skim_err_{name}.txt
0026 Log = {path}/workingArea/skim_condor_{name}.log
0027 request_memory = 2000M
0028 request_disk = 800M
0029 batch_name = skim
0030 +JobFlavour = "workday"
0031 +AccountingGroup = "group_u_CMS.CAF.ALCA"
0032 Queue Arguments from (
0033 {name}
0034 )
0035 """
0036
0037
0038 skimScript = """#!/bin/tcsh
0039
0040 set curDir=$PWD
0041 echo $curDir
0042 cd {base}/src
0043
0044 eval `scramv1 runtime -csh`
0045 cd $curDir
0046
0047 cmsRun {base}/src/Alignment/APEEstimation/test/SkimProducer/skimProducer_cfg.py isTest=False useTrackList=False sample=$1 > skimLog_$1.txt
0048
0049 cat skimLog_$1.txt
0050
0051 # renaming routine starts here
0052 # cut the last word from the matched lines
0053 set filename=`grep 'Using output name' skimLog_$1.txt | rev | cut -d ' ' -f 1 | rev | cut -d . -f 1`
0054 set filepath=`grep 'Using output path' skimLog_$1.txt | rev | cut -d ' ' -f 1 | rev`
0055
0056 rm -f skimLog_$1.txt
0057
0058 echo "Files to be renamed:"
0059 ls ${{filename}}*.root
0060 # rename files that are filename00X.root to filename_(X+1).root (if there was more than output file created, this happens
0061 foreach fi ( ${{filename}}*.root )
0062 if ( ${{fi}} == "${{filename}}.root" ) then
0063 # this file always exists
0064 mv ${{filename}}.root ${{filename}}_1.root
0065 else
0066 # extract the number part from filename and remove leading zeros
0067 set num=`echo ${{fi}} | cut -d '.' -f1 | grep -o '...$' | sed 's/^0*//'`
0068 set increased=`echo "$num+1" | bc`
0069 mv ${{fi}} ${{filename}}_${{increased}}.root
0070 endif
0071 end
0072
0073 echo "Renaming done:"
0074 ls ${{filename}}*.root
0075
0076 # renaming routine ends here
0077
0078 # move files to remove if path is defined
0079
0080 if ( "${{filepath}}" == "" ) then
0081 echo "No moving is done as no target path is defined"
0082 else
0083 if (! -d ${{filepath}} ) then
0084 mkdir ${{filepath}}
0085 endif
0086 xrdcp ${{filename}}*.root ${{filepath}}
0087 rm ${{filename}}*.root
0088 endif
0089 """
0090