feat: expose PlotTool configs in .py, add per-layer particleId to tree#5530
feat: expose PlotTool configs in .py, add per-layer particleId to tree#5530altsybee wants to merge 2 commits into
Conversation
|
| /// The particle id of the truth particle that left each measurement. | ||
| /// Outer: one entry per track. Inner: one entry per measurement on | ||
| /// that track, ordered identically to m_measurementVolume / | ||
| /// m_measurementLayer (reverse state order). Sentinel value 0 means | ||
| /// no truth link or no truth inputs configured. | ||
| std::vector<std::vector<std::uint64_t>> m_measurementParticleId; |
There was a problem hiding this comment.
I fear this gets a bit into the direction of the RootTrackStatesWriter which I would rather not duplicate in this writer
| namespace { | ||
| /// Tiebreaker for assigning a single particleId to a measurement. | ||
| /// 1) Prefer the track's majority particle if any contributing sim hit | ||
| /// matches it. | ||
| /// 2) Otherwise fall back to the sim hit with the largest deposited | ||
| /// energy. Ties broken by first occurrence. | ||
| /// Returns 0 if the range is empty. | ||
| template <typename Range> | ||
| std::uint64_t pickParticleId(const Range& simHitIndices, | ||
| const ActsExamples::SimHitContainer& simHits, | ||
| const ActsExamples::SimBarcode& majorityParticleId, | ||
| bool haveMajorityParticleId) { | ||
| // Rule 1: prefer the majority particle if any contributor matches. | ||
| if (haveMajorityParticleId) { | ||
| for (const auto& [measIdx, simHitIdx] : simHitIndices) { | ||
| const auto& simHit = *simHits.nth(simHitIdx); | ||
| if (simHit.particleId() == majorityParticleId) { | ||
| return static_cast<std::uint64_t>(majorityParticleId.hash()); | ||
| } | ||
| } | ||
| } | ||
| // Rule 2: fall back to the highest-deposit hit. | ||
| std::uint64_t bestId = 0; | ||
| double bestDeposit = -std::numeric_limits<double>::infinity(); | ||
| for (const auto& [measIdx, simHitIdx] : simHitIndices) { | ||
| const auto& simHit = *simHits.nth(simHitIdx); | ||
| const double dep = simHit.depositedEnergy(); | ||
| if (dep > bestDeposit) { | ||
| bestDeposit = dep; | ||
| bestId = static_cast<std::uint64_t>(simHit.particleId().hash()); | ||
| } | ||
| } | ||
| return bestId; | ||
| } | ||
| } // namespace |
There was a problem hiding this comment.
this seems like an alternative approach to truth matching which was extracted into TrackTruthMatcher some time ago to be consistent across all writers. I would discourage us to split this logic again. So I would rather upstream this there but also check against what #5515 is doing
| # Resolution Plots | ||
| ResPlotToolConfig = acts.examples.root.ResPlotToolConfig() | ||
| # Duplication Plots | ||
| DuplicationPlotToolConfig = acts.examples.root.DuplicationPlotToolConfig() | ||
| # Efficiency Plots | ||
| EffPlotToolConfig = acts.examples.root.EffPlotToolConfig() | ||
| # Fake rate Plots | ||
| FakePlotToolConfig = acts.examples.root.FakePlotToolConfig() | ||
| # TrackQuality Plots | ||
| TrackQualityPlotToolConfig = acts.examples.root.TrackQualityPlotToolConfig() | ||
| # Track Summary Plots | ||
| TrackSummaryPlotToolConfig = acts.examples.root.TrackSummaryPlotToolConfig() |
There was a problem hiding this comment.
the python scrips are already messy, I fear adding global variables will hurt this even further. I would either use custom addAlgorithm functions on the caller side with the correct params or pass them through names arguments on the high-level add* functions



This PR makes two (largely independent) improvements to the ActsExamples I/O and performance QA code:
EffPlotToolConfig,ResPlotToolConfigetc.) in thereconstruction.py, so binning, pT/eta ranges and other plotting parameters can be configured from .py steering scripts ("full_chain.py") instead of being hard-coded in C++. A small example is added tofull_chain_odd.py.Also,
truthPtRangesForEtaandtruthAbsEtaRangesForPtfromEffPlotToolConfigare now exposed to the python level and can be changed in .py scripts; a log-pT variant of the efficiency-vs-pT plots is added.