Add Audio Anomaly Detection Service for Real-time Detector Monitoring #2049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a comprehensive audio anomaly detection service for EICrecon that provides real-time auditory feedback for anomaly detection in subatomic physics data analysis. The system addresses the need for immediate awareness of detector anomalies during data processing by converting anomaly levels into audio signals.
Key Features
Multi-Detector Audio Mapping: Each of the 17 detector subsystems (BEMC, BHCAL, EEMC, EHCAL, FEMC, FHCAL, BTRK, ECTRK, BVTX, DRICH, PFRICH, DIRC, BTOF, ECTOF, ZDC, B0TRK, B0ECAL) is mapped to a unique frequency band between 200-2000 Hz for optimal audibility and distinction.
Anomaly Quantification: The service compares Monte Carlo truth information with reconstructed particle data to compute energy-based and momentum-based anomalies, providing a robust measure of reconstruction quality.
Real-time Audio Output: Uses ALSA (Advanced Linux Sound Architecture) for low-latency audio generation, with sine wave synthesis where loudness directly correlates to anomaly severity levels.
Graceful Degradation: Handles environments without audio hardware by operating in "silent mode" while maintaining full anomaly detection functionality.
Implementation Details
The implementation consists of three main components:
src/services/audio_anomaly/
): Core service managing audio output, frequency mapping, and thread-safe anomaly reportingsrc/algorithms/anomaly/
): Computes anomalies by comparing truth and reconstructed data with configurable thresholdssrc/global/audio_anomaly/
,src/factories/anomaly/
): Seamless integration with the JANA2 framework including service registration and event processingUsage Examples
Configuration Parameters
audio_anomaly:device
- Audio device name (default: "default")audio_anomaly:sample_rate
- Sample rate in Hz (default: 44100)audio_anomaly:buffer_size
- Buffer size in samples (default: 1024)energy_threshold
- Energy threshold for particle consideration in GeV (default: 0.1)momentum_threshold
- Momentum threshold in GeV/c (default: 0.1)max_anomaly_value
- Maximum anomaly value for normalization (default: 10.0)update_frequency
- Events between audio updates (default: 10)Technical Specifications
libasound2-dev
)The service provides immediate auditory feedback for detector anomalies, enabling researchers to quickly identify issues during data processing without constantly monitoring numerical outputs or plots. This is particularly valuable for long-running analysis jobs where early detection of systematic issues can save significant computational time.
Complete documentation is available in
docs/audio_anomaly_detection.md
with detailed usage examples, configuration options, and technical specifications.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com
/usr/lib/apt/methods/https
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.