Skip to content

Commit ff40793

Browse files
committed
finalise btagging SF and rename base module
1 parent 0730f2a commit ff40793

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

python/basePlotter.py renamed to python/baseAnalysis.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from itertools import chain
66

77
import utils
8+
import definitions as defs
89

910
from bamboo import treefunctions as op
1011
from bamboo import treedecorators as td
@@ -116,9 +117,11 @@ def prepare_ondemand(self, tree, sample=None, sampleCfg=None, backend=None):
116117
"v12", year=era[:4], isMC=isMC, systVariations=systVars),
117118
backend=self.args.backend or backend)
118119

120+
# MC weight
119121
if isMC:
120122
noSel = noSel.refine('genWeight', weight=tree.genWeight)
121123

124+
# Triggers
122125
self.triggersPerPrimaryDataset = {}
123126

124127
def addHLTPath(PD, HLT):
@@ -130,8 +133,6 @@ def addHLTPath(PD, HLT):
130133
except AttributeError:
131134
print("Couldn't find branch tree.HLT.%s, cross check!" % HLT)
132135

133-
# Triggers
134-
135136
# Muon
136137
addHLTPath('Muon', 'IsoMu24')
137138
addHLTPath('Muon', 'IsoMu27')
@@ -181,12 +182,16 @@ def addHLTPath(PD, HLT):
181182
cmJMEArgs.update({"jsonFileSubjet": JSONFiles[era]["AK4"], })
182183
configureJets(tree._FatJet, jetType="AK8PFPuppi", **cmJMEArgs)
183184

185+
# define objects
186+
defs.defineObjects(self, tree)
187+
184188
# btagging SF
185-
from bamboo.scalefactors import get_bTagSF_itFit, makeBtagWeightItFit
186-
def btvSF(flav): return get_bTagSF_itFit(
187-
BTV_SF_JSONFiles[era], "particleNet", "btagDeepFlavB", flav, noSel)
188-
btvWeight = makeBtagWeightItFit(tree._Jet, btvSF)
189-
noSel = noSel.refine("btag", weight=btvWeight)
189+
if isMC:
190+
from bamboo.scalefactors import get_bTagSF_itFit, makeBtagWeightItFit
191+
def btvSF(flav): return get_bTagSF_itFit(
192+
BTV_SF_JSONFiles[era], "particleNet", "btagDeepFlavB", flav, noSel)
193+
btvWeight = makeBtagWeightItFit(self.ak4Jets, btvSF)
194+
noSel = noSel.refine("btag", weight=btvWeight)
190195

191196
return tree, noSel, be, lumiArgs
192197

python/controlPlotter.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
from bamboo.plots import EquidistantBinning as EqBin
44
from bamboo import treefunctions as op
55

6-
from basePlotter import NanoBaseHHWWbb
6+
from baseAnalysis import NanoBaseHHWWbb
77
from selections import makeDLSelection, makeSLSelection
88
import definitions as defs
99

1010

1111
class controlPlotter(NanoBaseHHWWbb):
12-
""" Class to create control plots and skims"""
12+
""" Class to create control plots, cutflow reports and skims"""
1313

1414
def __init__(self, args):
1515
super(controlPlotter, self).__init__(args)
@@ -19,9 +19,6 @@ def __init__(self, args):
1919
def definePlots(self, tree, noSel, sample=None, sampleCfg=None):
2020
plots = []
2121

22-
# call object definitions
23-
defs.defineObjects(self, tree)
24-
2522
# cutflow report
2623
yields = CutFlowReport("yields", recursive=True)
2724
plots.append(yields)

python/selections.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from bamboo import treefunctions as op
2-
import definitions as defs
32

43
# common variables for DL and SL channels
54

0 commit comments

Comments
 (0)