File indexing completed on 2025-08-06 08:21:02
0001
0002
0003 currDir=$PWD
0004
0005 cosmicsFile=$1
0006 tsFile=$2
0007 mergeNum=$3
0008 run_ohcal=$4
0009 run_ihcal=$5
0010
0011
0012 dummyFile="dummy.txt"
0013 tag="cosmics"
0014
0015 mkdir -p merged
0016
0017 while IFS= read -r line
0018 do
0019
0020 echo "looking at run "
0021 echo "${IFS}"
0022 x=0
0023 incr=$line
0024
0025
0026
0027 cd /sphenix/user/anjsmenon/work/macros/calibrations/calo/hcal_calib_year2/condor_histmaker/out_run/
0028
0029 touch $dummyFile
0030
0031 while [ $x -lt $mergeNum ]
0032 do
0033
0034 incr=$(($incr+1))
0035
0036 if [ $incr -gt 70000 ]; then
0037 echo "Incr has exceeded 60000, exiting loop."
0038 break
0039 fi
0040
0041
0042 FILE=`find ~+ -name "*$incr*" -not -name "*$tag*" -print -quit`
0043
0044 if [[ -a $FILE ]]
0045 then
0046 echo $FILE >> $dummyFile
0047 x=$((x+1))
0048 fi
0049
0050 done
0051
0052 if [ ! -s $dummyFile ]; then
0053 echo "No valid files found for run $line, skipping..."
0054 continue
0055 fi
0056
0057 echo "Merging these files..."
0058 cat $dummyFile
0059
0060
0061 string="$currDir/merged/mergedTS_cosmics_$line.root"
0062
0063 rm $string
0064 bash -c "hadd -f $string @$dummyFile"
0065
0066 echo "$string" >> $tsFile
0067
0068 rm $dummyFile
0069
0070 done < $cosmicsFile
0071
0072 mv $tsFile $currDir
0073
0074
0075 cd $currDir
0076
0077 mkdir -p "$currDir/fitResults"
0078
0079
0080 root.exe -b -q run_cosmicsTS.C\(\"$cosmicsFile\",\"$tsFile\",$run_ohcal,$run_ihcal\)
0081
0082 echo "Finished running get_ts_files.sh."
0083 echo "All done!"