Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:24

0001 #! /bin/bash
0002 
0003 ###########
0004 ## Input ##
0005 ###########
0006 
0007 suite=${1:-"forPR"} # which set of benchmarks to run: full, forPR, forConf, val, valMT1
0008 style=${2:-"--mtv-like-val"} # option --mtv-like-val
0009 inputBin=${3:-"112X_TTbar_PU50_MULTI"}
0010 
0011 ###################
0012 ## Configuration ##
0013 ###################
0014 
0015 source xeon_scripts/common-variables.sh ${suite}
0016 source xeon_scripts/init-env.sh
0017 
0018 nevents=500
0019 
0020 ## Common file setup
0021 case ${inputBin} in 
0022 "91XPU70CCC")
0023         echo "Inputs from 2017 initialStep PU 70 with CCC -- DO NOT WORK ANYMORE"
0024         exit 1
0025         dir=/data2/slava77/samples/2017/pass-c93773a/initialStep
0026         subdir=PU70HS/10224.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2017PU_GenSimFullINPUT+DigiFullPU_2017PU+RecoFullPU_2017PU+HARVESTFullPU_2017PU
0027         file=memoryFile.fv3.clean.writeAll.CCC1620.recT.082418-25daeda.bin
0028         ;;
0029 "104XPU50CCC")
0030         echo "Inputs from 2018 initialStep/default PU 50 with CCC"
0031         dir=/data2
0032         subdir=
0033         file=pu50-ccc-hs.bin
0034         ;;
0035 "112X_TTbar_PU50_MULTI")
0036         echo "Inputs from 2021 TTbar (PU50) sample with multiple iterations and hit binary mask"
0037         dir=/data2/slava77/samples/
0038         subdir=2021/11834.0_TTbar_14TeV+2021/AVE_50_BX01_25ns/
0039         file=memoryFile.fv6.default.211008-c6b7c67.bin
0040         ;;
0041 "104X10muCCC")
0042         echo "Inputs from 2018 10mu large pt range using the offline initialStep seeds with CCC (phi3)"
0043         dir=/data2/slava77/samples/2018/pass-925bb57
0044         subdir=initialStep/default/10muPt0p2to1000HS
0045         file=memoryFile.fv4.clean.writeAll.CCC1620.recT.191108-c41a0f2.bin
0046         nevents=10000
0047         sample=CMSSW_10mu
0048         ;;
0049 "112X_10mu_MULTI")
0050         echo "Inputs from 2021 10mu sample with multiple iterations and hit binary mask"
0051         dir=/data2/slava77/samples
0052         subdir=2021/10muPt0p2to1000HS
0053         file=memoryFile.fv6.default.211008-c6b7c67.bin
0054         nevents=20000
0055         sample=10mu
0056         ;;
0057 "104X10muHLT3CCC")
0058         echo "Inputs from 2018 10mu large pt range using HLT iter0 seeds as triplets with CCC (phi3)"
0059         dir=/data2/slava77/samples/2018/pass-2eaa1f7
0060         subdir=hltIter0/default/triplet/10muPt0p2to1000HS
0061         file=memoryFile.fv4.clean.writeAll.CCC1620.recT.200122-fcff8a8.bin
0062         nevents=10000
0063         sample=CMSSW_10mu_HLT3
0064         ;;
0065 "104X10muHLT4CCC")
0066         echo "Inputs from 2018 10mu large pt range using HLT iter0 seeds as quadruplets with CCC (phi3)"
0067         dir=/data2/slava77/samples/2018/pass-2eaa1f7
0068         subdir=hltIter0/default/quadruplet/10muPt0p2to1000HS
0069         file=memoryFile.fv4.clean.writeAll.CCC1620.recT.200122-fcff8a8.bin
0070         nevents=10000
0071         sample=CMSSW_10mu_HLT4
0072         ;;
0073 "104XPU50HLT3CCC")
0074         echo "Inputs from 2018 ttbar PU50 using HLT iter0 seeds as triplets with CCC (phi3)"
0075         dir=/data2/slava77/samples/2018/pass-2eaa1f7
0076         subdir=hltIter0/default/triplet/11024.0_TTbar_13/AVE_50_BX01_25ns
0077         file=memoryFile.fv4.clean.writeAll.CCC1620.recT.200122-fcff8a8.bin
0078         sample=CMSSW_TTbar_PU50_HLT3
0079         ;;
0080 "104XPU50HLT4CCC")
0081         echo "Inputs from 2018 ttbar PU50 using HLT iter0 seeds as quadruplets with CCC (phi3)"
0082         dir=/data2/slava77/samples/2018/pass-2eaa1f7
0083         subdir=hltIter0/default/quadruplet/11024.0_TTbar_13/AVE_50_BX01_25ns
0084         file=memoryFile.fv4.clean.writeAll.CCC1620.recT.200122-fcff8a8.bin
0085         sample=CMSSW_TTbar_PU50_HLT4
0086         ;;
0087 *)
0088         echo "INPUT BIN IS UNKNOWN"
0089         exit 12
0090         ;;
0091 esac
0092 
0093 ## Common executable setup
0094 maxth=64
0095 maxvu=16
0096 maxev=32
0097 if [[  "${suite}" == "valMT1" ]]
0098 then
0099     maxth=1
0100     maxev=1
0101 fi
0102 seeds="--cmssw-n2seeds"
0103 exe="./mkFit/mkFit --silent ${seeds} --num-thr ${maxth} --num-thr-ev ${maxev} --input-file ${dir}/${subdir}/${file} --num-events ${nevents} --remove-dup --use-dead-modules"
0104 
0105 ## Common output setup
0106 tmpdir="tmp"
0107 base=${val_arch}_${sample}
0108 
0109 ## flag to save sim info for matched tracks since track states not read in
0110 siminfo="--try-to-save-sim-info"
0111 
0112 ## backward fit flag
0113 bkfit="--backward-fit"
0114 
0115 ## validation options: SIMVAL == sim tracks as reference, CMSSWVAL == cmssw tracks as reference
0116 SIMVAL="SIMVAL --sim-val ${siminfo} ${bkfit} ${style}"
0117 SIMVAL_SEED="SIMVALSEED --sim-val ${siminfo} ${bkfit} --mtv-require-seeds"
0118 declare -a vals=(SIMVAL SIMVAL_SEED)
0119 
0120 ## plotting options
0121 SIMPLOT="SIMVAL 0"
0122 SIMPLOTSEED="SIMVALSEED 0"
0123 declare -a plots=(SIMPLOT SIMPLOTSEED)
0124 
0125 ## special cmssw dummy build
0126 CMSSW="CMSSW cmssw SIMVAL --sim-val-for-cmssw ${siminfo} --read-cmssw-tracks ${style} --num-iters-cmssw 1"
0127 CMSSW2="CMSSW cmssw SIMVALSEED --sim-val-for-cmssw ${siminfo} --read-cmssw-tracks --mtv-require-seeds --num-iters-cmssw 1"
0128 
0129 ###############
0130 ## Functions ##
0131 ###############
0132 
0133 ## validation function
0134 function doVal()
0135 {
0136     local bN=${1}
0137     local bO=${2}
0138     local vN=${3}
0139     local vO=${4}
0140 
0141     local oBase=${val_arch}_${sample}_${bN}
0142     local bExe="${exe} ${vO} --build-${bO}"
0143     
0144     echo "${oBase}: ${vN} [nTH:${maxth}, nVU:${maxvu}int, nEV:${maxev}]"
0145     ${bExe} >& log_${oBase}_NVU${maxvu}int_NTH${maxth}_NEV${maxev}_${vN}.txt || (echo "Crashed on CMD: "${bExe}; exit 2)
0146     
0147     if (( ${maxev} > 1 ))
0148     then
0149         # hadd output files from different threads for this test, then move to temporary directory
0150         hadd -O valtree.root valtree_*.root
0151         rm valtree_*.root
0152     fi
0153     mv valtree.root ${tmpdir}/valtree_${oBase}_${vN}.root
0154 }               
0155 
0156 ## plotting function
0157 function plotVal()
0158 {
0159     local base=${1}
0160     local bN=${2}
0161     local pN=${3}
0162     local pO=${4}
0163     local iter=${5} # only initialStep
0164     local cancel=${6}
0165 
0166     echo "Computing observables for: ${base} ${bN} ${pN}"
0167     bExe="root -b -q -l plotting/runValidation.C(\"_${base}_${bN}_${pN}\",${pO},${iter},${cancel})"
0168     ${bExe} || (echo "Crashed on CMD: "${bExe}; exit 3)
0169 }
0170 
0171 ########################
0172 ## Run the validation ##
0173 ########################
0174 
0175 ## Compile once
0176 make clean
0177 mVal="-j 32 WITH_ROOT:=1 AVX_512:=1"
0178 make ${mVal}
0179 mkdir -p ${tmpdir}
0180 
0181 ## Special simtrack validation vs cmssw tracks
0182 echo ${CMSSW} | while read -r bN bO vN vO
0183 do
0184     doVal "${bN}" "${bO}" "${vN}" "${vO}"
0185 done
0186 ## Special simtrack validation vs cmssw tracks
0187 echo ${CMSSW2} | while read -r bN bO vN vO
0188 do
0189     doVal "${bN}" "${bO}" "${vN}" "${vO}"
0190 done
0191 
0192 ## Run validation for standard build options
0193 for val in "${vals[@]}"
0194 do echo ${!val} | while read -r vN vO
0195     do
0196         for build in "${val_builds[@]}"
0197         do echo ${!build} | while read -r bN bO
0198             do
0199                 doVal "${bN}" "${bO}" "${vN}" "${vO}"
0200             done
0201         done
0202     done
0203 done
0204 
0205 ## clean up
0206 make clean ${mVal}
0207 mv tmp/valtree_*.root .
0208 rm -rf ${tmpdir}
0209 
0210 ## Compute observables and make images
0211 for plot in "${plots[@]}"
0212 do echo ${!plot} | while read -r pN pO
0213     do
0214         ## Compute observables for special dummy CMSSW
0215         if [[ "${pN}" == "SIMVAL" ]]
0216         then
0217             echo ${CMSSW} | while read -r bN bO val_extras
0218             do
0219                 iter=4 # only initialStep
0220                 cancel=1
0221                 plotVal "${base}" "${bN}" "${pN}" "${pO}" "${iter}" "${cancel}"
0222             done
0223         fi
0224         if [[ "${pN}" == "SIMVALSEED" ]]
0225         then
0226             echo ${CMSSW2} | while read -r bN bO val_extras
0227             do
0228                 iter=4 # only initialStep
0229                 cancel=1
0230                 plotVal "${base}" "${bN}" "${pN}" "${pO}" "${iter}" "${cancel}"
0231             done
0232         fi
0233 
0234         ## Compute observables for builds chosen 
0235         for build in "${val_builds[@]}"
0236         do echo ${!build} | while read -r bN bO
0237             do
0238                 iter=0
0239                 cancel=1
0240                 plotVal "${base}" "${bN}" "${pN}" "${pO}" "${iter}" "${cancel}"
0241                 #plotVal "${base}" "${bN}" "${pN}" "${pO}"
0242             done
0243         done
0244         
0245         ## overlay histograms
0246         echo "Overlaying histograms for: ${base} ${vN}"
0247         root -b -q -l plotting/makeValidation.C\(\"${base}\",\"_${pN}\",${pO},\"${suite}\"\)
0248     done
0249 done
0250 
0251 ## Final cleanup
0252 make distclean ${mVal}
0253 
0254 ## Final message
0255 echo "Finished physics validation!"