Skip to content

Commit

Permalink
add removed scalings post selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyi Wan committed Dec 20, 2024
1 parent 3a9ea09 commit b0840e5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion analysis/topeft_run2/datacards_post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ def main():
channelname = lep_ch_name + "_" + jet + "j_ptz"
elif args.tau_flag and ("1tau_onZ" in lep_ch_name):
channelname = lep_ch_name + "_" + jet + "j_ptz_wtau"
elif args.fwd_flag and ("fwd" in lep_ch_name):
elif args.fwd_flag and ("2lss" in lep_ch_name):
channelname = lep_ch_name + "_" + jet + "j_lt"

Check warning on line 135 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L126-L135

Added lines #L126 - L135 were not covered by tests
else:
channelname = lep_ch_name + "_" + jet + "j_lj0pt"
CATSELECTED.append(channelname)

Check warning on line 138 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L137-L138

Added lines #L137 - L138 were not covered by tests

CATSELECTED = sorted(CATSELECTED)

Check warning on line 140 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L140

Added line #L140 was not covered by tests
# Grab the ptz-lj0pt cards we want for TOP-22-006, copy into a dir
n_txt = 0
n_root = 0
Expand All @@ -157,6 +158,17 @@ def main():
#also copy the selectedWCs.txt file
shutil.copyfile(os.path.join(args.datacards_path,"selectedWCs.txt"),os.path.join(ptzlj0pt_path,"selectedWCs.txt"))

Check warning on line 159 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L159

Added line #L159 was not covered by tests

for item in scalings_content:
channel_name = item.get("channel")
if channel_name in CATSELECTED:
ch_index = CATSELECTED.index(channel_name) + 1
item["channel"] = "ch" + str(ch_index)

Check warning on line 165 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L161-L165

Added lines #L161 - L165 were not covered by tests
else:
scalings_content = [d for d in scalings_content if d != item]

Check warning on line 167 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L167

Added line #L167 was not covered by tests

with open(os.path.join(ptzlj0pt_path, 'scalings.json'), 'w') as file:
json.dump(scalings_content, file, indent=4)

Check warning on line 170 in analysis/topeft_run2/datacards_post_processing.py

View check run for this annotation

Codecov / codecov/patch

analysis/topeft_run2/datacards_post_processing.py#L169-L170

Added lines #L169 - L170 were not covered by tests

# Check that we got the expected number and print what we learn
print(f"\tNumber of text templates copied: {n_txt}")
print(f"\tNumber of root templates copied: {n_txt}")
Expand Down

0 comments on commit b0840e5

Please sign in to comment.