Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #!/usr/bin/bash
0002 
0003 export TargetDir="$PWD"/condorout
0004 
0005 
0006 if [ -d ${TargetDir} ]; then
0007   if [ -n "$(ls -A ${TargetDir}/OutDir*)" ]; then
0008     rm -rf ${TargetDir}/OutDir*
0009   fi
0010 else
0011   mkdir ${TargetDir}
0012 fi
0013 
0014   
0015   export listfile="dst_calo_cluster.list"
0016   export listfile2="g4hits.list"
0017   rm $listfile
0018   rm $listfile2
0019 
0020   CreateFileList.pl -type 14  -run 13 -particle pi0 -pmin 200 -pmax 10000 DST_CALO_CLUSTER G4Hits
0021   
0022   #number of jobs
0023   j=500
0024 
0025   tot_files=$( cat ${listfile} | wc -l )
0026   echo "total files: $tot_files"
0027   rem=$(( $tot_files%$j ))
0028   files_per_job=$(( $tot_files/$j ))
0029   njob=$j
0030   if [ $rem -ne 0 ]; then
0031     files_per_job=$(( $files_per_job+1 ))
0032   fi
0033   rem2=$(( $tot_files%$files_per_job ))
0034   njob=$(( $tot_files/$files_per_job ))
0035   if [ $rem2 -ne 0 ]; then
0036     njob=$(( ($tot_files/$files_per_job)+1 ))
0037   fi
0038   echo "files per job: $files_per_job"
0039   echo "njob: $njob"
0040 
0041 
0042   for((q=0;q<$njob;q++));
0043   do
0044 
0045     mkdir ${TargetDir}/OutDir$q
0046     export WorkDir="${TargetDir}/OutDir$q"
0047     echo "WorkDir:" ${WorkDir}
0048 
0049     start_file=$(( $q*$files_per_job+1 ))
0050     end_file=$(( $start_file+$files_per_job-1 ))
0051     echo "start file: $start_file   end file: $end_file"
0052 
0053     sed -n $start_file\,${end_file}p ${listfile} > tmp.txt
0054     sed -n $start_file\,${end_file}p ${listfile2} > tmp2.txt
0055     mv tmp.txt ${WorkDir}/inputdata.txt
0056     mv tmp2.txt ${WorkDir}/inputdatahits.txt
0057     
0058     pushd ${WorkDir}
0059 
0060     
0061     cp -v "$PWD"/../../CondorRun.sh CondorRunJob$li.sh
0062     cp "$PWD"/../../../Fun4All_EMCal_sp.C .
0063 
0064     chmod +x CondorRunJob$li.sh
0065         
0066     
0067     cat >>ff.sub<< EOF
0068 +JobFlavour                   = "workday"
0069 transfer_input_files          = ${WorkDir}/CondorRunJob$li.sh, ${WorkDir}/inputdata.txt,${WorkDir}/Fun4All_EMCal_sp.C,${WorkDir}/inputdatahits.txt
0070 Executable                    = CondorRunJob$li.sh
0071 request_memory                = 10GB
0072 Universe                      = vanilla
0073 Notification                  = Never
0074 GetEnv                        = True
0075 Priority                      = +12
0076 Output                        = condor.out
0077 Error                         = condor.err
0078 Log                           = /tmp/condor$li.log
0079 Notify_user                   = bs3402@columbia.edu
0080 
0081 Queue
0082 EOF
0083 
0084     condor_submit ff.sub
0085     popd
0086   
0087 done
0088