-
Notifications
You must be signed in to change notification settings - Fork 9
/
BtagReweightingRatio.py
46 lines (33 loc) · 1.89 KB
/
BtagReweightingRatio.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import sys
from copy import copy
from itertools import chain
import logging
logger = logging.getLogger(__name__)
import bamboo
from bamboo.analysismodules import HistogramsModule, DataDrivenBackgroundHistogramsModule
from bamboo import treefunctions as op
from bamboo.plots import CutFlowReport, Plot, EquidistantBinning, SummedPlot
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)))) # Add scripts in this directory
from BaseHHtobbWW import BaseNanoHHtobbWW
from plotDef import *
#===============================================================================================#
# BtagReweightingRatioNano #
#===============================================================================================#
class BtagReweightingRatioNano(BaseNanoHHtobbWW,DataDrivenBackgroundHistogramsModule):
def __init__(self, args):
super(BtagReweightingRatioNano, self).__init__(args)
def initialize(self):
super(BtagReweightingRatioNano, self).initialize(forSkimmer=True)
def definePlots(self, t, noSel, sample=None, sampleCfg=None):
noSel = super(BtagReweightingRatioNano,self).prepareObjects(t, noSel, sample, sampleCfg, 'DL')
plots = []
era = sampleCfg['era']
#----- Ratio reweighting variables (before lepton and jet selection) -----#
if self.args.BtagReweightingOff or self.args.BtagReweightingOn:
noSel = self.beforeJetselection(noSel)
plots.append(objectsNumberPlot(channel="NoChannel",suffix='NoSelection',sel=noSel,objCont=self.ak4Jets,objName='Ak4Jets',Nmax=15,xTitle='N(Ak4 jets)'))
plots.append(CutFlowReport("BtagReweightingCutFlowReport",noSel,printInLog=True,recursive=True))
else:
raise RuntimeError("Either --BtagReweightingOff or --BtagReweightingOn must be used")
return plots