Skip to content

Update to optional NanoAOD version - #106

Open
sofiagiappichini wants to merge 4 commits into
mainfrom
nanoaod_fix
Open

Update to optional NanoAOD version#106
sofiagiappichini wants to merge 4 commits into
mainfrom
nanoaod_fix

Conversation

@sofiagiappichini

Copy link
Copy Markdown
Contributor

Every law/luigi command required --nanoAOD_version to be passed explicitly, even though the sample's nick is enough to determine unambiguously which version/directory a sample lives in. This work is related to the [sample database PR #62] (KIT-CMS/KingMaker_sample_database#62). This allows for multiple versions to be run from a single call.

What this PR does:

  • processor/framework.py: Task.nanoAOD_version now defaults to "" instead of nanoAOD_v15. Adds two resolution helpers:
    • resolve_nanoAOD_version(relative_path, requested_version) — single-sample lookup by era/sample_type/nick.json, used by ConfigureDatasets.
    • resolve_sample_data(nick, requested_version) — per-sample lookup against each version's datasets.json, returns (version, sample_data), used by ProduceBase.
      Both return the passed-in version unchanged if one is given (--nanoAOD_version still works exactly as before — no directory searching happens in that case, and the old single-version error-if-not-found behavior is preserved). Otherwise they scan sample_database/nanoAOD_v*/ and auto-pick the version if exactly one contains the sample; if none or more than one do, they raise a clear error telling you to either fix the sample_database naming collision or pass --nanoAOD-version explicitly.
  • processor/tasks/CROWNMain.py`: ConfigureDatasets.init resolves its own nanoAOD_version from era/sample_type/nick.
  • processor/tasks/CROWNBase.py: ProduceBase no longer forces one shared nanoAOD_version for an entire sample_list. dataset_database is only pinned to a single version's datasets.json when --nanoAOD_version (or --dataset-database) is passed explicitly — matching the old behavior exactly. Otherwise, set_sample_data() resolves each requested sample's version individually, so a single sample_list can freely mix samples from different NanoAOD versions as long as each one is unambiguous on its own. The printed sample table also gained a "NanoAOD" column showing each sample's resolved version.
  • processor/tasks/ProduceNtuples.py: requires() now passes each sample's own resolved nanoAOD_version explicitly into its CROWNFriend.req()/CROWNRun.req() call, so every downstream task in that sample's chain uses the correct version (and any further tasks it itself requires inherit that same concrete value automatically via law's .req() propagation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant