Skip to content

Commit

Permalink
nonres ftest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Nov 8, 2023
1 parent cf4266c commit 0396da5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/HHbbVV/combine/binder/FTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"source": [
"MAIN_DIR = \"../../../../\"\n",
"\n",
"plot_dir = f\"{MAIN_DIR}/plots/FTests/23Jul6WP06\"\n",
"plot_dir = f\"{MAIN_DIR}/plots/FTests/23Nov7\"\n",
"_ = os.system(f\"mkdir -p {plot_dir}\")"
]
},
Expand Down Expand Up @@ -72,7 +72,7 @@
"outputs": [],
"source": [
"local_cards_dir = \"/uscms/home/rkansal/hhcombine/cards/f_tests/23May14/\"\n",
"test_orders = [0]\n",
"test_orders = [0, 1]\n",
"test_statistics = {}\n",
"\n",
"for o1 in test_orders:\n",
Expand Down Expand Up @@ -243,13 +243,13 @@
"metadata": {},
"outputs": [],
"source": [
"o1 = 0 # order being tested\n",
"o1 = 1 # order being tested\n",
"tlabel = f\"{o1}\"\n",
"\n",
"data_ts, toy_ts = test_statistics[tlabel][\"data\"][tlabel], test_statistics[tlabel][\"toys\"][tlabel]\n",
"plot_tests(data_ts, toy_ts, \"gof\" + tlabel, fit=\"chi2\", bins=20)\n",
"\n",
"ord1 = 1\n",
"ord1 = o1 + 1\n",
"tflabel = f\"{ord1}\"\n",
"data_ts, toy_ts = pval = (\n",
" test_statistics[tlabel][\"fdata\"][tflabel],\n",
Expand Down Expand Up @@ -328,7 +328,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.10.4"
},
"orig_nbformat": 4
},
Expand Down
6 changes: 4 additions & 2 deletions src/HHbbVV/combine/run_blinded.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ cards_dir="./"
ws=${cards_dir}/combined
wsm=${ws}_withmasks
wsm_snapshot=higgsCombineSnapshot.MultiDimFit.mH125
CMS_PARAMS_LABEL="CMS_bbWW_hadronic"

outsdir=${cards_dir}/outs
mkdir -p $outsdir
Expand All @@ -142,6 +141,8 @@ if [ $resonant = 0 ]; then
echo -e "\nWARNING: This is doing nonresonant fits - did you mean to pass -r|--resonant?\n"
fi

CMS_PARAMS_LABEL="CMS_bbWW_hadronic"

# nonresonant args
ccargs="fail=${cards_dir}/fail.txt failBlinded=${cards_dir}/failBlinded.txt pass=${cards_dir}/pass.txt passBlinded=${cards_dir}/passBlinded.txt"
maskunblindedargs="mask_pass=1,mask_fail=1,mask_passBlinded=0,mask_failBlinded=0"
Expand All @@ -158,7 +159,7 @@ if [ $resonant = 0 ]; then

# remove last comma
setparamsblinded=${setparamsblinded%,}
freezeparamsblinded="${freezeparamsblinded},var{.*lp_sf.*},CMS_XHYbbWW_boosted_PNetHbbScaleFactors_correlated"
freezeparamsblinded=${setparamsblinded%,}


# floating parameters using var{} floats a bunch of parameters which shouldn't be floated,
Expand All @@ -170,6 +171,7 @@ if [ $resonant = 0 ]; then
excludeimpactparams='rgx{.*tf_dataResidual_Bin.*}'
else
# resonant args
CMS_PARAMS_LABEL="CMS_XHYbbWW_boosted"
ccargs=""
maskunblindedargs=""
maskblindedargs=""
Expand Down
22 changes: 12 additions & 10 deletions src/HHbbVV/combine/run_ftest_nonres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
# Author: Raghav Kansal
####################################################################################################


goftoys=0
ffits=0
dfit=0
limits=0
seed=42
numtoys=100
order=0
Expand Down Expand Up @@ -42,7 +44,7 @@ while true; do
shift
templates_tag=$1
;;
--o,order)
-o|--order)
shift
order=$1
;;
Expand All @@ -69,8 +71,8 @@ while true; do
shift
done

echo "Arguments: cardstag=$cards_tag templatestag=$templates_tag sigsample=$sig_sample dfit=$dfit \
goftoys=$goftoys ffits=$ffits seed=$seed numtoys=$numtoys"
echo "Arguments: cardstag=$cards_tag templatestag=$templates_tag dfit=$dfit \
goftoys=$goftoys ffits=$ffits order=$order seed=$seed numtoys=$numtoys"


####################################################################################################
Expand Down Expand Up @@ -113,15 +115,15 @@ freezeparamsblinded=${freezeparamsblinded%,}
# Making cards and workspaces for each order polynomial
####################################################################################################

for ord1 in {0..3}
for ord in {0..3}
do
model_name="nTF_${ord1}"
model_name="nTF_${ord}"

# create datacards if they don't already exist
if [ ! -f "${cards_dir}/${model_name}/pass.txt" ]; then
echo "Making Datacard for $model_name"
python3 -u postprocessing/CreateDatacard.py --templates-dir ${templates_dir} \
--model-name ${model_name} --nTF ${ord2} ${ord1} --cards-dir ${cards_dir}
--model-name ${model_name} --nTF ${ord} --cards-dir ${cards_dir}
fi

cd ${cards_dir}/${model_name}/
Expand All @@ -146,7 +148,7 @@ done


####################################################################################################
# Generate toys for (0, 0) order
# Generate toys for lower order
####################################################################################################

model_name="nTF_$order"
Expand All @@ -172,13 +174,13 @@ fi


####################################################################################################
# GoFs on generated toys for next order polynomials
# GoFs on generated toys for low and next high order polynomials
####################################################################################################

if [ $ffits = 1 ]; then
for ord1 in 0 1
for ord in $order $((order+1))
do
model_name="nTF_${ord1}"
model_name="nTF_${ord}"
echo "Fits for $model_name"

cd ${cards_dir}/${model_name}/
Expand Down

0 comments on commit 0396da5

Please sign in to comment.