Skip to content

DY Stitching Weights

Davide Zuolo edited this page Mar 24, 2022 · 5 revisions

In our analysis we use inclusive, n-jet binned and HT binned DY samples. We need stitching weights to properly use these samples all together.

First of all run /test/computDYsplitting_HT.cpp (https://github.com/LLRCMS/KLUBAnalysis/blob/VBF_UL/test/computDYsplitting_HT.cpp) for each sample (./bin/computDYsplitting_HT.exe inputFiles/folder/fileList.txt weights/DYstitchMap/DYmap_sample_year_date.root). This script makes use of the branches lheNOutPartons,lheNOutB and lheHt to create a 3D histogram containing in each bin the number of events with specific (nJets,nBJets,HT). The binning is defined in https://github.com/LLRCMS/KLUBAnalysis/blob/3aa88f23ccb17fa287cf8bf22be1b10c0c79e1e6/test/computDYsplitting_HT.cpp#L95: 225 bins in total (5 x 5 x 9).

Then we need the number of events in each sample. This is computed by /test/getNumberEvents.cpp (https://github.com/LLRCMS/KLUBAnalysis/blob/VBF_UL/test/getNumberEvents.cpp). Example: ./bin/getNumberEvents.exe inputFiles/folder/fileList.txt.

The weights are computed by /scripts/stitchWeightsDY_HT_2016.py (https://github.com/LLRCMS/KLUBAnalysis/blob/VBF_UL/scripts/stitchWeightsDY_HT_2016.py).

In the first iteration use only in inclusive sample, i.e. comment all the if - elif statement and just print the content of each bin (https://github.com/LLRCMS/KLUBAnalysis/blob/3aa88f23ccb17fa287cf8bf22be1b10c0c79e1e6/scripts/stitchWeightsDY_HT_2018.py#L266). This is the largest sample so we want to make the best use of it. Take note of empty bins and add them to badInclusiveBins (https://github.com/LLRCMS/KLUBAnalysis/blob/3aa88f23ccb17fa287cf8bf22be1b10c0c79e1e6/scripts/stitchWeightsDY_HT_2018.py#L11)

In the subsequent iterations you should add other samples, according to the list of empty bins in the inclusive samples.

Some code suggestions:

  • First iteration:

if (fractionHistos['inclusive'].GetBinContent(njet+1, nb+1, ht+1) < 1E-6): print ("bad inclusive bin [%i,%i,%i]," % (njet,nb,ht))

  • Second iteration:

if nJnBnHT not in badInclusiveBins: fractionXS[njet][nb][ht] = fractionHistos['inclusive'].GetBinContent(njet+1, nb+1, ht+1)

else:

print ("checking bin [%i,%i,%i]," % (njet,nb,ht))

for MCname in fractionHistos:

if (MCname != 'inclusive' and fractionHistos[MCname].GetBinContent(njet+1, nb+1, ht+1) > 0):

print (MCname + '- %f' % (fractionHistos[MCname].GetBinContent(njet+1, nb+1, ht+1)))

for each bin choose the sample with the largest fraction

  • Third iteration: define goodMCnameBins grouping bins with largest fraction in the same sample. Add the elif statements in the sequence.

The same is done for 2016APV,2017 and 2018.

To check the correctness of the weights produce skimmed ntuples for inclusive (without using the -g True option that is used to apply stitch weights) and merged DY samples and compare distributions.

Clone this wiki locally