Table of contents
Setup working area
Create datasets
Fit to signal MC
Make sure to be in an area with ROOT v6.12 (or later) available. The code could work with previous versions, but it is not guaranteed. If you are on CERN lxplus machines, you can achieve it by running:
export SCRAM_ARCH=slc7_amd64_gcc820
cmsrel CMSSW_10_4_0
cd CMSSW_10_4_0/src/ && cmsenv && cd ../..Clone this branch in the working directory:
git clone -b master git@github.com:CMSKStarMuMu/UML-fit.git
cd UML-fitIf needed, change the location of the ntuples, which need to be produced with the code in the B0KstMuMuNtuple repository.
Then, you can produce the files which will contain the needed datasets, that is, correctly and wrongly tagged reco'ed events from the MC. The datasets will include the following variables: ctK, ctL, phi, mass, rand.
rand is a random variable uniformly generated between 0 and 1, to be used to select a given statistics from the MC sample.
Example on how to run for 2017 ntuples:
root -q -b 'createDataset.cc(7)'Compile and run with:
source simfit_recoMC_singleComponent.shwhere you have to set the datasets to be considered (set year = 0 to not include the dataset). The variable "datalike" sets the statistics to be considered:
- datalike = 0 means consider the full MC stat (half of it actually)
- datalike = 1 means consider a data-like statistics.
The code will produce a root file simFitResults/simfitResult_recoMC_singleComponentXXXX.root containing the RooFitResult objects, where XXXX describes the considered datasets.
Corresponding fit projection plots are created in plotSimFit_d/simfitResult_recoMC_singleComponent_*.pdf.
root -b -q 'plotSimFitResults.cc(1)' # for fit with odd efficiency on even dataset and full MC statwhile use
root -b -q 'plotSimFitResults.cc(1,-1,true, false, false,true)'
to plot the results for the data-like stat fits.
The fit is performed by the simfit4d_recoMC_singleComponent code. It requires in input:
- a root file containing the workspace with the roodatasets to be fitted (produced in the step above)
- the files containing the KDE modeling of the efficiency and, if possible, the corresponding partial integrals. These are produced by the workflow described in the eff-KDE repository.
- a root file containing the workspace with the RooFitResults to the MC mass distributions (as produced by this code)
Compile and run with:
source simfit4d_recoMC_singleComponent.shwhere you have to set the datasets to be considered (set year = 0 to not include the dataset). The variable "datalike" sets the statistics to be considered (datalike = 0 -> full MC stat, datalike = 1 -> data-like statistics).
The code will produce a root file simFit4dResults/simfit4dResult_recoMC_singleComponentXXXX.root containing the RooFitResult objects, where XXXX describes the considered datasets.
Corresponding fit projection plots are created in plotSimFit4d_d/simfitResult_recoMC_singleComponent_*.pdf.