Skip to content

Repository files navigation

HCAL Optimizer 2

HCAL geometry optimization with DD4hep/DDsim and a LightGBM surrogate.

Setup

source setup/setup.sh (installs both the spack environment and the associated python venv)
./build.sh

Geometry generation

Create an example geometry spec with 150 points within bounds.:

python3 geos/generate_spec.py --template geos/batches/nhcal.yaml --out geos/batches/sweep.yaml --n 150

Set that path in run_settings.yaml:

specs:
  - geos/batches/sweep.yaml

Then run the conductor pipeline:

python3 conductor.py run_settings.yaml

conductor.py generates the geometry XML/JSON files automatically, runs simulation and analysis, trains the model, and creates later proposal batches. Running geos/generate_geos.py separately is unnecessary for this workflow.

The geometry space contains absorber and scintillator thicknesses for three longitudinal segments with a 3/3/4 layer layout. Initial batches use Latin-hypercube sampling.

run_settings.yaml selects the initial geometry batch, iteration count, seeds, threshold, and overwrite behavior. simulation/config/config.yaml stores DDsim defaults, while simulation/config/gps.mac defines the neutron source and event count.

Optimization loop

Each iteration:

  1. Simulates every geometry and seed.
  2. Applies thickness-scaled MIP thresholds to cell energies integrated from 0--100 ns.
  3. Rebuilds one geometry-level training row from repeated runs.
  4. Trains and validates separate LightGBM regressors for efficiency, fired tiles, and fired layers.
  5. Scores a scrambled Sobol candidate pool with baseline-anchored normalized metrics.
  6. Applies configured constraints and normalized geometry-space separation.
  7. Writes the next proposal batch and current best observed geometry.

Each run writes one performance.json under simulation/outputs/<geometry_id>/<run_id>/; it contains run metadata, calibration values, and performance metrics. Campaign manifests live directly under simulation/outputs/, and the full iteration summary lives under run_summaries/.

Set delete_intermediates: false in simulation/config/config.yaml to retain EDM4hep files for later reprocessing.

Model stage

python3 model/run_model.py model/config.yaml

model/config.yaml contains metric weights, fixed normalization anchors, constraints, diversity separation, validation fraction, and proposal settings. Model validation and the best observed geometry are written under model/outputs/.

About

Nonuniform longitudinal thickness optimization for sampling calorimeters.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages