Skip to content

Commit a52777f

Browse files
epic-capybararahmans1Sakib Rahmanpre-commit-ci[bot]Copilot
authored
[Backport v1.30] Add generator status filter to UndoAfterBurner for memory efficiency (#2176)
# Description Backport of #2175 to `v1.30`. Co-authored-by: Sakib Rahman <[email protected]> Co-authored-by: Sakib Rahman <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
1 parent ff806be commit a52777f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/algorithms/reco/UndoAfterBurner.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,18 @@ void eicrecon::UndoAfterBurner::process(const UndoAfterBurner::Input& input,
116116
head_on_frame_boost.Pz() / head_on_frame_boost.E());
117117

118118
// Now, loop through events and apply operations to the MCparticles
119+
const int maxGenStatus = m_cfg.m_max_gen_status;
120+
119121
for (const auto& p : *mcparts) {
120122
if (p.isCreatedInSimulation()) {
121123
continue;
122124
}
123125

126+
// Filter by generator status to exclude background particles and conserve memory
127+
if (maxGenStatus >= 0 && p.getGeneratorStatus() > maxGenStatus) {
128+
continue;
129+
}
130+
124131
ROOT::Math::PxPyPzEVector mc(p.getMomentum().x, p.getMomentum().y, p.getMomentum().z,
125132
p.getEnergy());
126133

src/algorithms/reco/UndoAfterBurnerConfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct UndoAfterBurnerConfig {
1313
double m_pid_purity = 0.51;
1414
bool m_correct_beam_FX = true;
1515
bool m_pid_use_MC_truth = true;
16+
int m_max_gen_status = 1000; // Upper limit on generator status to process (-1 = no limit)
1617
};
1718

1819
} // namespace eicrecon

src/factories/reco/UndoAfterBurnerMCParticles_factory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class UndoAfterBurnerMCParticles_factory
3434
ParameterRef<double> m_pid_purity{this, "m_pid_purity", config().m_pid_purity};
3535
ParameterRef<bool> m_correct_beam_FX{this, "m_correct_beam_FX", config().m_correct_beam_FX};
3636
ParameterRef<bool> m_pid_use_MC_truth{this, "m_pid_use_MC_truth", config().m_pid_use_MC_truth};
37+
ParameterRef<int> m_max_gen_status{this, "m_max_gen_status", config().m_max_gen_status,
38+
"Upper limit on generator status to process (-1 = no limit). "
39+
"Use to filter out background particles and conserve memory."};
3740

3841
public:
3942
void Configure() {

0 commit comments

Comments
 (0)