LPC-DM / METXFit

0 stars 9 forks source link

MonoXFit

Installation

cmsrel CMSSW_8_1_0
cd CMSSW_8_1_0/src
cmsenv
git clone https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit.git HiggsAnalysis/CombinedLimit
git clone https://github.com/LPC-DM/DMSFit.git -b SuperMonojetFit
scram b -j16

Produce fitting trees

  1. Modify config/category.py to point to the correct input root file, where category = [boosted, resolved, monojet]. The input root file is the output of makeFittingForest from PandaAnalysis.
  2. Call source buildModel.sh category to create category.root
  3. Call python runModel_category.py to create combined-model_category.root

Running a single fit

The datacards directory contains the datacards for each individual category and the combined cards. Within a category, the datacard including all the mass bins can be generated by calling MegaScripts.sh. The output is in MASS/combined_all.txt. The one thing you might have to change is making sure the datacards correctly point to the combined-model_category.root files produced above. Any changes to the datacard must be made here and in the datacard used for scans (see below)

To run the fit:

cd datacards/
combine -M AsymptoticLimits -t -1 datacard_name.txt --rAbsAcc 0 --rMax 30

And the signal masked-fit:

cd datacards/
text2workspace.py combined_2cat.txt --channel-masks
combine combined_2cat.root -M MaxLikelihoodFit --saveShapes --saveWithUncertainties --setPhysicsModelParameters mask_tight_sig=1,mask_loose_sig=1

Running the limit scan

Use datacards/combined_datacards/scan_monoZp.sh as an example for how to run the limits over several signal points. The output will be dumped in limits_*.txt.

Any changes to the scan datacard must be made here and in the datacard used for fits (see above)

To run the scan:

cd datacards/combined_datacards/
source scan_monoZp.py

Making postfit plots

All plotting tools are in plotting/. They must be run after running the fit (or limit scan, depending on what plots you want to make). These scripts automatically point to the ROOT files generated by the above combine calls, so there is nothing you need to do.

python plot_ratio.py                                             # plots the xfer factors - no need to rerun now that the inputs are finalized
python plotStackedPostFit.py                                     # makes the stack plots with prefit and postfit comparisons to data
python diffNuisances.py -g pulls.root ../datacards/mlfit.root    # draws the pulls plot
python plotLimits.py                                             # makes the limit plots (both sigma and sigma/sigma_theory)

The output directories are specified inside the above scripts and will need to be changed to fit the user's preferences. This should probably be changed to an environment variable.