Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:41

0001 #!/bin/bash
0002 
0003 declare -a numbers=("28530" "28534" "28535" "28536" "28537" "28549")
0004 
0005 # Directory to look in
0006 #directory="/sphenix/lustre01/sphnxpro/commissioning/aligned_cosmic"
0007 directory="/sphenix/tg/tg01/commissioning/CaloCalibWG/hanpuj"
0008 export macropath="/sphenix/user/hanpuj/HCalCosmicCalib/macro"
0009 export TargetDir="/sphenix/user/hanpuj/HCalCosmicCalib/condor_file"
0010 
0011 # Counter
0012 i=0
0013 
0014 # Loop through all .prdf files
0015 for file in $directory/cosmics-*.prdf
0016 do
0017     # Extract the run number from the filename
0018     num=$(basename $file | cut -d'-' -f 2 | cut -d'-' -f 1)
0019     num=$((10#$num)) # Remove leading zeros
0020 
0021     # Check if the number is in the list
0022     if [[ " ${numbers[@]} " =~ " ${num} " ]]; then
0023         echo "$file contains the number $num."
0024         li=$i
0025         [ $i -lt 1000 ] && li="0$li"
0026         [ $i -lt 100 ] && li="0$li"
0027         [ $i -lt 10 ] && li="0$li"
0028 
0029         # Create a directory for each run number, then create OutDir within that
0030         mkdir -p ${TargetDir}/Run$num/OutDir$li
0031         export WorkDir="${TargetDir}/Run$num/OutDir$li"
0032         echo "WorkDir:" ${WorkDir}
0033 
0034         pushd ${WorkDir}
0035 
0036         cp -v "$macropath"/CondorRun.sh CondorRunTC$li.sh
0037         cp "$macropath"/Fun4All_HCalCalib.C
0038         echo $file >> prdf_file.txt
0039 
0040         chmod +x CondorRunTC$li.sh
0041         cat >>ff.sub<< EOF
0042 +JobFlavour                   = "workday"
0043 transfer_input_files          = ${WorkDir}/CondorRunTC$li.sh,${WorkDir}/Fun4All_HCalCalib.C
0044 Executable                    = CondorRunTC$li.sh
0045 Universe                      = vanilla
0046 Notification                  = Never
0047 GetEnv                        = True
0048 Priority                      = +40
0049 Output                        = test.out
0050 Error                         = test.err
0051 Log                           = test.log
0052 Notify_user                   = hj2552@columbia.edu
0053 
0054 Queue
0055 EOF
0056 
0057         condor_submit ff.sub
0058         popd
0059         ((i++))
0060     fi  
0061 done