Skip to content

Commit 7a45dbe

Browse files
committed
added JER and JES trees to create measurement & pile up systematic
1 parent d19a636 commit 7a45dbe

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/cross_section_measurement/create_measurement.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Example:
1010
python src/cross_section_measurement/create_measurement.py -c
1111
'''
12-
12+
from __future__ import print_function
1313
from optparse import OptionParser
1414
import tools.measurement
1515
from config import XSectionConfig, variable_binning
@@ -41,7 +41,7 @@ def main():
4141
categories.extend(measurement_config.categories_and_prefixes.keys())
4242
categories.extend(measurement_config.rate_changing_systematics_names)
4343
categories.extend([measurement_config.vjets_theory_systematic_prefix +
44-
systematic for systematic in measurement_config.generator_systematics if not ('mass' in systematic or 'hadronisation' in systematic)])
44+
systematic for systematic in measurement_config.generator_systematics if not ('mass' in systematic or 'hadronisation' in systematic or 'NLO' in systematic)])
4545

4646
for variable in variable_binning.bin_edges.keys():
4747
for category in categories:
@@ -406,15 +406,26 @@ def create_input(config, sample, variable, category, channel, template,
406406

407407
if sample != 'data':
408408
if category in config.met_systematics_suffixes and not variable in config.variables_no_met:
409-
# print variable, category
410409
branch = template.split('/')[-1]
411410
branch += '_METUncertainties[%s]' % config.met_systematics[
412411
category]
413412

414413
if 'JES_down' in category or 'JES_up' in category or 'JER_down' in category or 'JER_up' in category:
415414
tree += config.categories_and_prefixes[category]
416415

416+
if not sample == 'data':
417+
if 'JES_down' in category:
418+
input_file = input_file.replace('tree','minusJES_tree')
419+
elif 'JES_up' in category:
420+
input_file = input_file.replace('tree','plusJES_tree')
421+
elif 'JER_up' in category:
422+
input_file = input_file.replace('tree','plusJER_tree')
423+
elif 'JER_down' in category:
424+
input_file = input_file.replace('tree','minusJER_tree')
425+
417426
selection = '{0} >= 0'.format(branch)
427+
if variable == 'abs_lepton_eta':
428+
selection += ' && {0} <= 3'.format(branch)
418429
else:
419430
hist = template
420431

@@ -441,7 +452,8 @@ def create_input(config, sample, variable, category, channel, template,
441452
weight_branches.append('1')
442453
else:
443454
weight_branches.append('EventWeight')
444-
weight_branches.append('PUWeight')
455+
if category != 'PileUpSystematic':
456+
weight_branches.append('PUWeight')
445457
if category == 'BJet_down':
446458
weight_branches.append('BJetDownWeight')
447459
elif category == 'BJet_up':

0 commit comments

Comments
 (0)