Skip to content

feat: muon buckets sector frame + bucket splitting#5229

Open
davidedicroce wants to merge 11 commits intoacts-project:mainfrom
davidedicroce:MuonBuckets
Open

feat: muon buckets sector frame + bucket splitting#5229
davidedicroce wants to merge 11 commits intoacts-project:mainfrom
davidedicroce:MuonBuckets

Conversation

@davidedicroce
Copy link
Copy Markdown
Contributor

@davidedicroce davidedicroce commented Mar 10, 2026

This MR introduces sector-based muon bucketization for the GeoModel mockup workflow and aligns the mockup geometry IDs so digitization can consistently resolve a common sector frame.

1. MuonSpacePointDigitizer:

  • Replaced chamber-frame helper with toSectorFrame() using a representative tracking volume.
  • Grouping changed from chamber-like IDs to sector IDs (volume-level key).
  • Added configurable bucket controls:
    • bucketMaxWindow (max longitudinal extent)
    • bucketNeighborWindow (max inter-point gap before split)
    • bucketOverlapWindow (tail overlap copied to next bucket)
    • minBucketSize (small buckets removed)
  • Implemented bucket split logic in sorted-z order per sector.
  • Added representative-volume resolution and caching per sector.

2. GeoModelMuonMockupBuilder:

  • Introduced sector parsing utilities from chamber names:
    • integer extraction by underscore tokenization
    • sector number extraction
    • eta-side sign extraction
  • Added a SectorKey = (station, sector, etaSide) grouping.
  • Assigned tracking volume IDs per sector key with explicit counter and capacity checks.
  • Assigned layer blocks per chamber/child volume to avoid collisions and preserve sector-consistent IDs.
  • Updated processStation() API to pass station index and shared nextVolumeId.

3. Examples/Scripts/Python/geomodel_G4.py:

  • Added useful CLI knobs: dumpGeoModelDb, nSectors, nEtaStations, disableEndcaps

4. Examples/Detectors/MuonSpectrometerMockupDetector/src/GeoMuonMockupExperiment.cpp:

  • Switched from std::any_cast to std::get and updated exception handling to std::bad_variant_access to match current key type usage.

5. Python/Examples/src/Digitization.cpp:

  • Extended Python digitization binding to pass new bucketization window parameters.
Screenshot 2026-03-10 at 17 06 26

@dimitra97 @junggjo9

@github-actions github-actions bot added the Component - Examples Affects the Examples module label Mar 10, 2026
@github-actions github-actions bot added this to the next milestone Mar 10, 2026
@davidedicroce davidedicroce marked this pull request as draft March 10, 2026 15:45
@davidedicroce davidedicroce changed the title Muon buckets: sector frame + bucket splitting feat: muon buckets sector frame + bucket splitting Mar 10, 2026
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

📊: Physics performance monitoring for 27ca050

Full contents

physmon summary

@davidedicroce davidedicroce marked this pull request as ready for review March 10, 2026 20:29
@andiwand andiwand requested a review from dimitra97 March 16, 2026 19:57
double rpcDeadTime{50. * Acts::UnitConstants::ns};

/// @brief Maximum longitudinal extent of a bucket in the common sector frame
double bucketMaxWindow{800. * Acts::UnitConstants::mm};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
double bucketMaxWindow{800. * Acts::UnitConstants::mm};
double bucketMaxWindow{80. * Acts::UnitConstants::cm};

Comment on lines +73 to +75
double bucketNeighborWindow{200. * Acts::UnitConstants::mm};
/// @brief Tail overlap copied from the previous bucket into the next one
double bucketOverlapWindow{100. * Acts::UnitConstants::mm};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
double bucketNeighborWindow{200. * Acts::UnitConstants::mm};
/// @brief Tail overlap copied from the previous bucket into the next one
double bucketOverlapWindow{100. * Acts::UnitConstants::mm};
double bucketNeighborWindow{20. * Acts::UnitConstants::cm};
/// @brief Tail overlap copied from the previous bucket into the next one
double bucketOverlapWindow{10. * Acts::UnitConstants::cm};

#include <algorithm>
#include <cmath>
#include <format>
#include <iterator>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <iterator>


inline double bucketSigmaZ(const MuonSpacePoint& sp,
const double sigmaScale = 1.) {
const auto cov = sp.covariance();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const auto cov = sp.covariance();
const& auto cov = sp.covariance();

const double var0 = cov[0];
const double var1 = cov[1];
const double maxVar = std::max({0., var0, var1});
return sigmaScale * std::sqrt(maxVar);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wait that's a bit edgy. The variances describe the measurement's uncertainty in x and y. How does this relate?

Comment on lines +132 to +133
if (trackingGeometry.findVolume(volId) != nullptr) {
return volId;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How is it possible that an invalid volume identifier is in the list?

MuonSpacePointCalibrator::Config calibCfg{};
m_cfg.calibrator =
std::make_unique<MuonSpacePointCalibrator>(calibCfg, logger().clone());
std::make_shared<MuonSpacePointCalibrator>(calibCfg, logger().clone());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::make_shared<MuonSpacePointCalibrator>(calibCfg, logger().clone());
std::make_unique<MuonSpacePointCalibrator>(calibCfg, logger().clone());

Comment on lines +85 to +90
if (a.geometryId().layer() != b.geometryId().layer()) {
return a.geometryId().layer() < b.geometryId().layer();
}
if (a.localPosition().z() != b.localPosition().z()) {
return a.localPosition().z() < b.localPosition().z();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (a.geometryId().layer() != b.geometryId().layer()) {
return a.geometryId().layer() < b.geometryId().layer();
}
if (a.localPosition().z() != b.localPosition().z()) {
return a.localPosition().z() < b.localPosition().z();
}
if (a.localPosition().z() != b.localPosition().z()) {
return a.localPosition().z() < b.localPosition().z();
}

}
return a.value() < b.value();
});
sortedIds.erase(std::unique(sortedIds.begin(), sortedIds.end()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
sortedIds.erase(std::unique(sortedIds.begin(), sortedIds.end()),
sortedIds.erase(std::ranges::unique(sortedIds),

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

Labels

Component - Examples Affects the Examples module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants