Skip to content

Commit 1a88cde

Browse files
committed
changed unfolding file output
1 parent b7b0550 commit 1a88cde

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/cross_section_measurement/02_unfold_and_measure.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,22 +580,35 @@ def calculate_normalised_xsections( normalisation, category, channel, normalise_
580580
# if met_type == 'PFMET':
581581
# met_type = 'patMETsPFlow'
582582

583+
file_template = '{path_to_JSON}/{category}/unfolded_normalisation_{channel}_{method}.txt'
583584
filename = ''
584585

585586
# # get unfolded normalisation
586587
unfolded_normalisation_electron = {}
587588
unfolded_normalisation_muon = {}
588589

589590
unfolded_normalisation_electron = get_unfolded_normalisation( TTJet_fit_results_electron, category, 'electron', tau_value_electron, visiblePS = visiblePS )
590-
filename = path_to_JSON + '/xsection_measurement_results/electron/%s/normalisation_%s.txt' % ( category, met_type )
591+
# filename = path_to_JSON + '/xsection_measurement_results/electron/%s/normalisation_%s.txt' % ( category, met_type )
592+
filename = file_template.format(
593+
path_to_JSON = path_to_JSON,
594+
category = category,
595+
channel = 'electron',
596+
method = method,
597+
)
591598
write_data_to_JSON( unfolded_normalisation_electron, filename )
592599
# measure xsection
593600
calculate_xsections( unfolded_normalisation_electron, category, 'electron' )
594601
calculate_normalised_xsections( unfolded_normalisation_electron, category, 'electron' )
595602
calculate_normalised_xsections( unfolded_normalisation_electron, category, 'electron' , True )
596603

597604
unfolded_normalisation_muon = get_unfolded_normalisation( TTJet_fit_results_muon, category, 'muon', tau_value_muon, visiblePS = visiblePS )
598-
filename = path_to_JSON + '/xsection_measurement_results/muon/%s/normalisation_%s.txt' % ( category, met_type )
605+
# filename = path_to_JSON + '/xsection_measurement_results/muon/%s/normalisation_%s.txt' % ( category, met_type )
606+
filename = file_template.format(
607+
path_to_JSON = path_to_JSON,
608+
category = category,
609+
channel = 'muon',
610+
method = method,
611+
)
599612
write_data_to_JSON( unfolded_normalisation_muon, filename )
600613
# measure xsection
601614
calculate_xsections( unfolded_normalisation_muon, category, 'muon' )
@@ -611,7 +624,13 @@ def calculate_normalised_xsections( normalisation, category, channel, normalise_
611624
else:
612625
unfolded_normalisation_combined = combine_complex_results( unfolded_normalisation_electron, unfolded_normalisation_muon )
613626

614-
filename = path_to_JSON + '/xsection_measurement_results/combined/%s/normalisation_%s.txt' % ( category, met_type )
627+
# filename = path_to_JSON + '/xsection_measurement_results/combined/%s/normalisation_%s.txt' % ( category, met_type )
628+
filename = file_template.format(
629+
path_to_JSON = path_to_JSON,
630+
category = category,
631+
channel = 'combined',
632+
method = method,
633+
)
615634
write_data_to_JSON( unfolded_normalisation_combined, filename )
616635
calculate_xsections( unfolded_normalisation_combined, category, 'combined' )
617636
calculate_normalised_xsections( unfolded_normalisation_combined, category, 'combined' )

0 commit comments

Comments
 (0)