Skip to content

Variable singelt fraction#310

Open
jvmead wants to merge 4 commits intodevelopfrom
variable_singelt_fraction
Open

Variable singelt fraction#310
jvmead wants to merge 4 commits intodevelopfrom
variable_singelt_fraction

Conversation

@jvmead
Copy link
Member

@jvmead jvmead commented Dec 16, 2025


Per-Segment LAr Scintillation with Particle-Dependent Parameters and PDE Corrections

Summary

Three enhancements to light simulation enabling particle-type-dependent pulse shapes and measured detector efficiency corrections:

  1. Per-segment LAr scintillation with particle-dependent singlet fraction
  2. Optional triple exponential model for improved scintillation physics
  3. PDE correction system for applying in-situ efficiency measurements

  1. Per-Segment LAr Scintillation

Change: LAr convolution now applied per segment before summing (previously: sum then convolve).

Particle dependence (PDG-based):

  • Heavy particles (neutrons, alphas, nuclei): singlet_fraction = 0.7
  • Light particles (electrons, muons, etc.): singlet_fraction = 0.3

Order: LUT → LAr convolution (per-segment, particle-dependent) → Sum → Poisson → SPE

Note: Slower than previous approach but enables particle-by-particle pulse shape variation.


  1. Triple Exponential Model

Adds intermediate component: f(t) = f₁·exp(-t/τ₁) + f₂·exp(-t/τ₂) + (1-f₁-f₂)·exp(-t/τ₃)

Configuration (optional, disabled by default):
use_triple_exponential: True
fast_fraction: 0.3
intermediate_fraction: 0.15 # Needs tuning
tau_intermediate: 0.05 # Needs tuning


  1. PDE Correction System

Applies data/MC efficiency ratios to LUT visibility before convolutions. Supports mixed detector types (2-ch LCMs, 6-ch ACLs).

Structure: 2D array (n_tpc, n_detectors_per_tpc), auto-expanded to per-channel array.

Configuration:
enable_pde_correction: True
pde_correction_file: "pde_corrections.npy"

Optional: explicit mapping for mixed detector types

detector_channel_map:
- {tpc: 0, detector: 0, channels: [0,1,2,3,4,5]} # ACL (6-ch)
- {tpc: 0, detector: 1, channels: [6,7]} # LCM (2-ch)

Creating corrections:
import numpy as np

Shape: (n_tpc, n_detectors_per_tpc), values ~0.95-1.05

pde_corrections = np.array([[0.97, 1.02, ...], [0.99, 0.97, ...]])
np.save('pde_corrections.npy', pde_corrections)


Technical Details

Modified files: light_sim.py, consts/light.py, simulate_pixels.py
Backward compatible: All features disabled by default
Truth backtracking: Should be consistent with existing implementation (sanity checking on that front needed)
Syntax validated: Python 3

jvmead and others added 4 commits December 16, 2025 06:22
…eters

- Modified light simulation to apply LAr pulse shape convolution per segment
  before summing, allowing for particle-by-particle variation in pulse shape
- Added variable singlet fraction based on PDG code:
  * Neutrons and nuclei (including alphas): singlet_fraction = 0.7
  * All other particles: singlet_fraction = 0.3
- Implemented optional triple exponential scintillation model:
  * New constants: USE_TRIPLE_EXPONENTIAL, FAST_FRACTION, INTERMEDIATE_FRACTION,
    TAU_FAST, TAU_INTERMEDIATE, TAU_SLOW
  * Default remains double exponential for compatibility
  * Can be enabled via detector properties YAML
- Order of operations: LAr convolution (per-segment) → Sum → Poisson → SPE
- Updated sum_light_signals to sum_light_signals_with_scintillation kernel
- Truth backtracking logic verified and maintained correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Implemented optional PDE correction to apply data/MC efficiency ratios
  to LUT visibility before convolutions and Poisson fluctuations
- Added constants ENABLE_PDE_CORRECTION and OP_CHANNEL_PDE_CORRECTION
- Supports loading corrections from:
  * Numpy file (pde_correction_file in YAML)
  * Direct YAML specification (single value or array)
  * Default of 1.0 (no correction) when disabled
- Modified sum_light_signals_with_scintillation kernel to apply corrections
  immediately after LUT lookup, before scintillation convolution
- Corrections apply uniformly across all channels in each detector unit
  (2 channels for LCMs, 6 channels for ACLs)
- Order: LUT → PDE correction → LAr convolution → Sum → Poisson → SPE
- Validated: syntax checks pass, shape validation included

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Changed from uniform channel-per-detector assumption to flexible mapping
- Added DETECTOR_CHANNEL_MAP to explicitly track (TPC, detector, channels)
- Supports explicit mapping via YAML config for mixed detector types:
  * 2-channel LCMs
  * 6-channel ACLs
- Falls back to inferred uniform mapping if not specified
- PDE_CORRECTION_2D remains (n_tpc, n_detectors_per_tpc) structure
- Expansion to per-channel array now uses detector mapping for correctness
- Enables realistic in-situ measurements with varying detector geometries

Example config:
  detector_channel_map:
    - {tpc: 0, detector: 0, channels: [0,1,2,3,4,5]}  # ACL
    - {tpc: 0, detector: 1, channels: [6,7]}          # LCM

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

1 participant