Skip to content

Commit

Permalink
Draw lumi and year in compre plotting; distinguish data with errorbar…
Browse files Browse the repository at this point in the history
… style option
  • Loading branch information
andreypz committed Oct 2, 2023
1 parent d9d37af commit 56e8fb3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
36 changes: 28 additions & 8 deletions plotting/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
## load coffea files
output = load_coffea(config, config["scaleToLumi"])


## build up merge map
mergemap = {}
if not any(".coffea" in o for o in output.keys()):
Expand Down Expand Up @@ -70,12 +69,16 @@
collated = additional_scale(collated, config["rescale_yields"])

### style settings
if "Run" in list(config["reference"].keys())[0]:
hist_type = "errorbar"
label = "Preliminary"
#if "Run" in list(config["reference"].keys())[0]:
if config["scaleToLumi"]:
lumi=config["lumi"] / 1000.0,
else:
lumi = None
hist_type = "step"
if config["label"]:
label = config["label"]
else:
hist_type = "step"
label = "Simulation Preliminary"
label = "Preliminary"

## collect variable lists
if "all" in list(config["variable"].keys())[0]:
Expand Down Expand Up @@ -109,8 +112,16 @@
2, 1, figsize=(10, 10), gridspec_kw={"height_ratios": (3, 1)}, sharex=True
)
fig.subplots_adjust(hspace=0.06, top=0.92, bottom=0.1, right=0.97)
hep.cms.label(label, com=config["com"], data=True, loc=0, ax=ax)
if config["year"]: year=config["year"]
else: year = None
hep.cms.label(label, lumi=lumi, year=year, com=config["com"], data=True, loc=0, ax=ax)
## plot reference

if refname=="DATA":
hist_type = "errorbar"
else:
hist_type = "step"

hep.histplot(
collated[refname][var],
label=config["reference"][refname]["label"] + " (Ref)",
Expand All @@ -122,6 +133,12 @@
## plot compare list
for c, s in config["compare"].items():
# print(collated[c][var][{var:sum}])
#print (c, s)
if c=="DATA":
hist_type = "errorbar"
else:
hist_type = "step"

hep.histplot(
collated[c][var],
label=config["compare"][c]["label"],
Expand Down Expand Up @@ -151,7 +168,10 @@

ax.get_yaxis().get_offset_text().set_position((-0.065, 1.05))
ax.legend()
rax.set_ylim(0.0, 2.0)
if 'ratio_ylim' in config.keys():
rax.set_ylim(config["ratio_ylim"]["min"], config["ratio_ylim"]["max"])
else:
rax.set_ylim(0,2)
xmin, xmax = autoranger(collated[refname][var])
rax.set_xlim(xmin, xmax)
at = AnchoredText(
Expand Down
11 changes: 6 additions & 5 deletions runner_wconfig.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os, sys, json, argparse, time, pickle


import os, sys, json, argparse, time, pickle, getpass
import numpy as np

import uproot
Expand Down Expand Up @@ -109,6 +107,8 @@ def retry_handler(exception, task_record):
os.system(f"rm {fi}")
sys.exit(0)


USERNAME = getpass.getuser()
if config.run_options["executor"] not in [
"futures",
"iterative",
Expand Down Expand Up @@ -240,17 +240,17 @@ def retry_handler(exception, task_record):
retry_handler=retry_handler,
)
elif "condor" in config.run_options["executor"]:
## code source: https://github.com/cms-rwth/CoffeaRunner/commit/d5ef86f76723e75b67bb212c3644c4012cae05be (Annika Stein)
if "naf_lite" in config.run_options["executor"]:
config.run_options["mem_per_worker"] = 2
config.run_options["walltime"] = "03:00:00"

htex_config = Config(
executors=[
HighThroughputExecutor(
label="coffea_parsl_condor",
address=address_by_query(),
max_workers=1,
worker_debug=True,
worker_debug=False,
provider=CondorProvider(
nodes_per_block=1,
cores_per_slot=config.run_options["workers"],
Expand All @@ -265,6 +265,7 @@ def retry_handler(exception, task_record):
],
retries=config.run_options["retries"],
retry_handler=retry_handler,
run_dir="/tmp/"+USERNAME+"/parsl_runinfo",
)
if config.run_options["splitjobs"]:
htex_config = Config(
Expand Down
14 changes: 14 additions & 0 deletions src/BTVNanoCommissioning/helpers/xsection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,20 @@
"energy": "13",
"comment": "Z->MuMu ZptWeighted",
},
{
"process_name": "DYJetsToEE_M-50_TuneCP5_ZptWeighted_13TeV-powhegMiNNLO-pythia8-photos",
"cross_section": "1976",
"DAS": "DYJetsToEE_M-50_TuneCP5_ZptWeighted_13TeV-powhegMiNNLO-pythia8-photos/*/NANOAODSIM",
"energy": "13",
"comment": "Z->EE ZptWeighted",
},
{
"process_name": "DYjetstomumu_01234jets_Pt-0ToInf_13TeV-sherpa",
"cross_section": "1976",
"DAS": "DYjetstomumu_01234jets_Pt-0ToInf_13TeV-sherpa/*/NANOAODSIM",
"energy": "13",
"comment": "Z->MuMu Sherpa sample in 2016 pre-UL campaign",
},
{
"process_name": "DYToLL_NLO_5FS_TuneCH3_13TeV_matchbox_herwig7",
"cross_section": "1976",
Expand Down

0 comments on commit 56e8fb3

Please sign in to comment.