Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tag & probe workflow for NTuples created using NanoAOD #90

Merged
merged 11 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/run_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ def main():
scheduler_options={"dashboard_address": args.dashboard_address},
)
scheduler = "distributed"
elif args.executor.startswith("tls:://") or args.executor.startswith("tcp://") or args.executor.startswith("ucx://"):
elif args.executor is not None and (args.executor.startswith("tls:://") or args.executor.startswith("tcp://") or args.executor.startswith("ucx://")):
logger.info(f"Will use dask scheduler at {args.executor}")
elif args.executor is None:
logger.info("Running with default dask scheduler")
else:
logger.error(f"Unknown executor `{args.executor}`")
raise ValueError(f"Unknown executor `{args.executor}`")
Expand All @@ -179,7 +181,7 @@ def main():
logger.info(f"Set up cluster {cluster}")
client = Client(cluster)
logger.info(f"Set up client {client}")
if args.executor.startswith("tls://") or args.executor.startswith("tcp://") or args.executor.startswith("ucx://"):
if args.executor is not None and (args.executor.startswith("tls://") or args.executor.startswith("tcp://") or args.executor.startswith("ucx://")):
client = Client(args.executor)
logger.info(f"Set up client {client}")

Expand Down
17 changes: 15 additions & 2 deletions src/egamma_tnp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@

from egamma_tnp.config import binning
from egamma_tnp.nanoaod_efficiency import ElectronTagNProbeFromNanoAOD, PhotonTagNProbeFromNanoAOD
from egamma_tnp.ntuple_efficiency import ElectronTagNProbeFromNTuples, PhotonTagNProbeFromNTuples
from egamma_tnp.ntuple_efficiency import (
ElectronTagNProbeFromMiniNTuples,
ElectronTagNProbeFromNanoNTuples,
PhotonTagNProbeFromMiniNTuples,
PhotonTagNProbeFromNanoNTuples,
)

from . import _version

warnings.filterwarnings("ignore", category=FutureWarning, module="coffea.*")
__version__ = _version.__version__
__all__ = ("binning", "ElectronTagNProbeFromNTuples", "ElectronTagNProbeFromNanoAOD", "PhotonTagNProbeFromNTuples", "PhotonTagNProbeFromNanoAOD")
__all__ = (
"binning",
"ElectronTagNProbeFromMiniNTuples",
"ElectronTagNProbeFromNanoAOD",
"PhotonTagNProbeFromMiniNTuples",
"PhotonTagNProbeFromNanoAOD",
"ElectronTagNProbeFromNanoNTuples",
"PhotonTagNProbeFromNanoNTuples",
)


def dir():
Expand Down
3 changes: 2 additions & 1 deletion src/egamma_tnp/nanoaod_efficiency.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def find_probes(self, events, cut_and_count, mass_range, vars):
if "superclusterEta" in events.Electron.fields:
events["Electron", "eta_to_use"] = events.Electron.superclusterEta
else:
events["Electron", "eta_to_use"] = events.Electron.eta + events.Electron.deltaEtaSC
events["Electron", "superclusterEta"] = events.Electron.eta + events.Electron.deltaEtaSC
events["Electron", "eta_to_use"] = events.Electron.superclusterEta
else:
events["Electron", "eta_to_use"] = events.Electron.eta
if self.use_sc_phi:
Expand Down
369 changes: 363 additions & 6 deletions src/egamma_tnp/ntuple_efficiency.py

Large diffs are not rendered by default.

Loading
Loading