File indexing completed on 2025-01-30 09:14:57
0001
0002
0003
0004
0005
0006
0007
0008 help()
0009 {
0010 echo ""
0011 echo "Usage: $0 -d <detector> -b <bFieldMap> -t <numTracksPerEvent> -n <numEvents>"
0012 echo -e "\t-d The detector type, either 'Generic' or 'DD4hep'. Optional. In default 'Generic'"
0013 echo -e "\t-x The '.xml' for DD4hep detector input. Required if the detector is 'DD4hep'. In default empty"
0014 echo -e "\t-b The '.txt' or '.root' file for B Field map. Optional. In default using constant BField: (0, 0, 2)"
0015 echo -e "\t-n The number of events. Optional. In default: 1"
0016 exit 1
0017 }
0018
0019 if [ ! -f "ActsExampleFatrasGeneric" ]; then
0020 echo Please run this script under the directory where the executables are located
0021 exit 1
0022 fi
0023
0024
0025 detector=Generic
0026 numEvents=1
0027
0028 while getopts "d:x:b:n:" opt
0029 do
0030 case "$opt" in
0031 d ) detector="$OPTARG" ;;
0032 x ) dd4hepInput="$OPTARG" ;;
0033 b ) bFieldMap="$OPTARG" ;;
0034 n ) numEvents="$OPTARG" ;;
0035 ? ) help ;;
0036 esac
0037 done
0038
0039
0040 if [ "${detector}" == DD4hep ]; then
0041 if [ -z "${dd4hepInput}" ]; then
0042 echo "Empty input for --dd4hep-input. A file like $<source>/thirdparty/OpenDataDetector/xml/OpenDataDetector.xml must be provided. Have to exit."
0043 exit 1
0044 fi
0045 if [ ! -f "${dd4hepInput}" ]; then
0046 echo "The ${dd4hepInput} does not exist! Have to exit."
0047 exit 1
0048 fi
0049 dd4hep_input="--dd4hep-input=${dd4hepInput}"
0050 fi
0051
0052
0053 bField='--bf-value 0 0 2'
0054 if [ -z "${bFieldMap}" ]; then
0055 echo "bFieldMap is empty. Will use constant B Field (0, 0, 2) then."
0056 elif [ -f "$bFieldMap" ] ; then
0057 echo "Input bField map: $bFieldMap "
0058 bField='--bf-map ${bFieldMap}'
0059 else
0060 echo "Input file for bField map file does not exist!"
0061 exit 1
0062 fi
0063
0064 time_stamp=`date +%F%T`
0065 exe_dir=$PWD
0066 run_dir=CKF_timing_${time_stamp}
0067
0068 mkdir ${run_dir}
0069 cd ${run_dir}
0070
0071 output_file='output.log'
0072 echo "*****CombinatorialKalmanFilter timing test vs. <mu>*****" > ${output_file}
0073 echo "Test Detector: ${detector}" >> ${output_file}
0074 echo "BField: ${bField}" >> ${output_file}
0075 echo "Events: ${numEvents}" >> ${output_file}
0076 echo "****************************************" >> ${output_file}
0077 echo "*"
0078 echo "* job | mode | mu " >> ${output_file}
0079
0080 jobID=0
0081
0082
0083 for mu in 0 50 100 150 200 250 300 ; do
0084
0085 gen="${exe_dir}/ActsExamplePythia8 --events=${numEvents} --output-dir=data/gen/ttbar_e${numEvents}_mu${mu} --output-csv=1 --rnd-seed=42 --gen-cms-energy-gev=14000 --gen-hard-process=Top:qqbar2ttbar=on --gen-npileup=${mu}"
0086 echo ${gen}
0087 eval ${gen}
0088
0089
0090 sim="${exe_dir}/ActsExampleFatras${detector} ${dd4hep_input} ${bField} --select-pt-gev '0.1:' --select-eta '-3:3' --fatras-pmin-gev 0.1 --remove-neutral 1 --input-dir=data/gen/ttbar_e${numEvents}_mu${mu} --output-csv=1 --output-dir=data/sim_${detector}/ttbar_e${numEvents}_mu${mu}"
0091 echo ${sim}
0092 eval ${sim}
0093
0094
0095 for mode in {0..1} ; do
0096
0097 if [[ $mode -eq 0 ]]; then
0098 reco="${exe_dir}/ActsExampleCKFTracks${detector} ${dd4hep_input} ${bField} -j 1 --input-dir=data/sim_${detector}/ttbar_e${numEvents}_mu${mu} --output-dir=data/reco_${detector}/ttbar_e${numEvents}_mu${mu}_m${mode}"
0099 else
0100 reco="${exe_dir}/ActsExampleCKFTracks${detector} ${dd4hep_input} ${bField} -j 1 --input-dir=data/sim_${detector}/ttbar_e${numEvents}_mu${mu} --ckf-slselection-chi2max 10 --ckf-slselection-nmax 1 --output-dir=data/reco_${detector}/ttbar_e${numEvents}_mu${mu}_m${mode}"
0101 fi
0102 echo $reco
0103 eval ${reco}
0104
0105
0106 mv data/reco_${detector}/ttbar_e${numEvents}_mu${mu}_m${mode}/timing.tsv timing_${jobID}.tsv
0107
0108 ckf_time_str=`grep "Algorithm:TrackFindingAlgorithm" timing_${jobID}.tsv | awk '{print $3}'`
0109
0110 ckf_time_per_event=$(echo ${ckf_time_str} | awk '{printf("%.10f\n", $1)}')
0111 echo "${jobID}, ${mode}, ${mu}, ${ckf_time_per_event}" >> ${output_file}
0112
0113
0114 let "jobID++"
0115 done
0116 done