HCAL geometry optimization with DD4hep/DDsim and a LightGBM surrogate.
source setup/setup.sh (installs both the spack environment and the associated python venv)
./build.shCreate 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 150Set that path in run_settings.yaml:
specs:
- geos/batches/sweep.yamlThen run the conductor pipeline:
python3 conductor.py run_settings.yamlconductor.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.
Each iteration:
- Simulates every geometry and seed.
- Applies thickness-scaled MIP thresholds to cell energies integrated from 0--100 ns.
- Rebuilds one geometry-level training row from repeated runs.
- Trains and validates separate LightGBM regressors for efficiency, fired tiles, and fired layers.
- Scores a scrambled Sobol candidate pool with baseline-anchored normalized metrics.
- Applies configured constraints and normalized geometry-space separation.
- 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.
python3 model/run_model.py model/config.yamlmodel/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/.