Skip to content

fix(E4): guard XGB sidecar file opens by reconstruction method and cut type#355

Merged
GernotMaier merged 2 commits into
v492-17from
fix-E4-xgb-guard
May 31, 2026
Merged

fix(E4): guard XGB sidecar file opens by reconstruction method and cut type#355
GernotMaier merged 2 commits into
v492-17from
fix-E4-xgb-guard

Conversation

@GernotMaier
Copy link
Copy Markdown
Member

Fixes issue #352 item E4: non-XGB jobs were unconditionally opening both XGB sidecar files causing spurious ROOT file-open errors and hidden artifact dependencies.

Changes:

  • CData: store filename; add idempotent loadGHXGBTree()
  • VStereoAnalysis::getDataFromFile(): guard stereo suffix; skip GH at construction
  • VStereoAnalysis::fillHistograms(): defer GH loading until after setCuts()
  • makeEffectiveArea.cpp: guard both suffixes at construction (cut type already known)

…t type

Non-XGB effective-area and stereo-analysis jobs were unconditionally
opening both XGB friend files (stereo + gamma-hadron) whenever their
suffix strings were non-empty, even when the active reconstruction
method and gamma-hadron cut type did not require them.

Changes:
- CData: store data file name in fDataFileName for deferred tree loading
- CData::loadGHXGBTree(): new idempotent method to load the GH XGB
  friend tree on demand, after the analysis type is known
- VStereoAnalysis::getDataFromFile(): pass stereo suffix only when
  fEnergyReconstructionMethod==2 or fDirectionReconstructionMethod==2;
  always pass empty GH suffix (deferred loading)
- VStereoAnalysis::fillHistograms(): call loadGHXGBTree() after
  setCuts() if and only if fCuts->useXGBoostCuts() is true
- makeEffectiveArea.cpp: guard both suffixes at construction time;
  fCuts->readCuts() is already called before CData is built

Fixes: #352 (item E4)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GernotMaier GernotMaier mentioned this pull request May 31, 2026
66 tasks
@GernotMaier GernotMaier requested a review from Copilot May 31, 2026 18:39
@GernotMaier GernotMaier self-assigned this May 31, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #352 item E4 by preventing non-XGB jobs from unconditionally opening XGB sidecar ROOT files. The fix gates the stereo-XGB suffix on the reconstruction method (==2) and the gamma-hadron-XGB suffix on the analysis type (useXGBoostCuts()). Because the analysis type is only known after VGammaHadronCuts::readCuts(), in VStereoAnalysis the GH friend tree is loaded lazily via a new idempotent CData::loadGHXGBTree() after setCuts(). In makeEffectiveArea, both decisions are made at construction time since readCuts() runs first.

Changes:

  • Add CData::fDataFileName and idempotent CData::loadGHXGBTree() for deferred GH friend-tree loading.
  • In VStereoAnalysis::getDataFromFile(), gate stereo-XGB suffix on reconstruction method and pass empty GH suffix; load GH friend tree later in fillHistograms() after setCuts() when useXGBoostCuts() is true.
  • In makeEffectiveArea.cpp, guard both suffixes at CData construction using the reconstruction method and fCuts->useXGBoostCuts().

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/CData.cpp Stores data filename and adds loadGHXGBTree() for deferred GH friend-tree opening.
inc/CData.h Declares fDataFileName member and loadGHXGBTree() method.
src/VStereoAnalysis.cpp Conditionally passes stereo-XGB suffix at construction; defers GH-XGB loading until after setCuts().
src/makeEffectiveArea.cpp Guards both XGB suffixes at CData construction using reconstruction method and cut type.
docs/changes/352.bugfix.md Adds changelog entry describing the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GernotMaier GernotMaier changed the base branch from main to v492-17 May 31, 2026 18:49
@GernotMaier GernotMaier merged commit ef29c8e into v492-17 May 31, 2026
7 checks passed
@GernotMaier GernotMaier deleted the fix-E4-xgb-guard branch May 31, 2026 18:49
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.

2 participants