Running Combine fits for deltaNLL, Impact, and Pre Postfit - chosila/ana_SS GitHub Wiki
Notes about CMSSW version: I am using CMSSW 14 with combine 10. This is the recommended version from the combine documentation, so that's what I'm using. I have not tested this on older versions of combine.
About python environment: I am pretty sure any python environment >= 3.6 with the packages uproot, numpy, matplotlib, and mlphep should work.
This is an example card : https://github.com/chosila/AK8TaggerCalib/blob/nanoaodv2/cards/v2/X4b/X4b_WP60_rebin.txt
- The "signal" is Sum4B .
- Lines 19-35 is normalization nuisance factor for all combinations of bin and processes, except for r_4M4T_4B, which is the signal normalization in the most signal-like category. We don't need that line explicitly in the card.
- Lines 37-43 is a special case since we wanted 3M2T+3M3T to vary together, and 4M3T+4M4T to vary together. You might not need this step if you have more statistics.
- lines 45-57 are the shape uncertainties for each process
- line 60 is the autoMC stat. We chose 500 as that is high enough to allow each proccess in the highest category to have their own automc stat variable. You can try 500 and see if it works for you.
combine -M MultiDimFit <link to card> --setParameterRanges <POI>=<range> --setParameters <POI>=0 --algo grid --parameters <POI> --points 1001 --floatOtherPOIs yes --redefineSignalPOIs <POI> --preFitValue 0 -n <Name>
-
<POI>
is the shape of signal in the 4th bin. In the example card, it is s4B_4bin . -
<range>
is the range you wawnt to vary your by. Most of my plots with within -2,2 -
<Name>
is just the name you want to give the output root file. It will take the format ofhiggsCombine<Name>.MultiDimFit.mH120.root
- I wrote this script: https://github.com/chosila/AK8TaggerCalib/blob/nanoaodv2/plot_nll.py
- Usage is python
plot_nll.py <link to higgsCombine MultiDim root file> <plotname>
- it will save the deltaNLL plot as
<plotname>_deltanll.png
- You will need to change line 23 and 30 to be your POI instead of s4B_4bin.
- https://github.com/chosila/AK8TaggerCalib/blob/nanoaodv2/runimpact.sh
- you'll need to modify so that it the POI are your POI and not s4B_4bin
- to run this:
source runimpact.sh <link to combine card> <name>
- It will create an impact plots called
<name>_impact.pdf
combine -M FitDiagnostics <linkto card> --setParameterRanges <POI>=<range> --setParameters <POI>n=0 --redefineSignalPOIs <POI> --preFitValue 0 --robustFit 1 --stepSize 0.01 --setRobustFitTolerance 0.02 --profilingMode all --saveShapes --saveWithUncertainties --cminDefaultMinimizerStrategy 0 -n <name>
- it will create 2 files. The file named
fitDiagnostics<name>.root
is what we need. - To create the pre/post fit plots: https://github.com/chosila/AK8TaggerCalib/blob/nanoaodv2/MakePostfitFigures.py
- You need to change line 89 to be a dictionary that's
{<link to your fit diagnostics root file> : <list of bins from the combine card> }
- You need to also change line 71 to be your correct x label name.
- Line 113 can be changed if you want the plots to be saved in a different location than tmp. I just have it like that so it doesn't over write my old plots when i'm testing.
- Usage is
python MakePostfitFigures.py