Warning, /epic-lfhcal-tbana/NewStructure/ADAPTIVE_LANGAU.md is written in an unsupported language. File is not indexed.
0001 # Reviewable adaptive Landau–Gaussian integration
0002
0003 This change adds opt-in adaptive Landau–Gaussian integration for HGCROC HG MIP
0004 fits only. It is an isolated numerical revision and ports the existing
0005 `AdaptiveLangau.h` unchanged from
0006 `paulnord/epic-lfhcal-tbana` commit
0007 `c986e5a5f2e010ad4e778f307216d4dad9e3e0a0` and wires it into current upstream
0008 `eic/epic-lfhcal-tbana` base `8c9de5ee5b85c30c3a266dd22dd12443284054ef`.
0009 The earlier helper was extracted from `LangauNumerics.h` at `3a643646`.
0010
0011 ## Switch and intended adoption
0012
0013 The review patch defaults to **legacy**. Build two independent directories to
0014 compare identical inputs without rebuilding or overwriting a running campaign:
0015
0016 ```sh
0017 git submodule update --init --recursive
0018 cmake -S NewStructure -B build-legacy -DCMAKE_BUILD_TYPE=Release \
0019 -DLFHCAL_USE_ADAPTIVE_LANGAU=OFF
0020 cmake --build build-legacy --target DataPrep Convert -j 4
0021 cmake -S NewStructure -B build-adaptive -DCMAKE_BUILD_TYPE=Release \
0022 -DLFHCAL_USE_ADAPTIVE_LANGAU=ON
0023 cmake --build build-adaptive --target DataPrep Convert -j 4
0024 ```
0025
0026 Run the same DataPrep command with the respective executable and separate output
0027 paths. There is no new command-line argument. CMake reports the chosen mode;
0028 adaptive HGCROC TF1s retain their names and get an explicit evaluator title.
0029 The definition is PRIVATE to the LFHCAL library, so all three Analyses.cc callers
0030 of FitMipHG use the same selection without mutable global state or extra API.
0031
0032 The intended endpoint is adoption as the default after review and real-data
0033 comparison. That needs only `OFF` → `ON` in the CMake option declaration. Keep
0034 an explicit `-DLFHCAL_USE_ADAPTIVE_LANGAU=OFF` for reproducibility. CMake caches
0035 existing values, so changing the source default affects fresh build directories,
0036 not an existing cache explicitly or implicitly set to OFF.
0037
0038 ## Deliberately narrow scope
0039
0040 - HGCROC HG MIP fits alone select adaptive quadrature when enabled.
0041 - Peak and FWHM use the same continuous adaptive curve as the fit, not the
0042 undersampled legacy callback. This extraction is part of the correction.
0043 - CAEN HG and LG fits are outside this change and continue to use legacy integration.
0044 - Four parameters, MPV shift, normalization, and ±5 Gaussian-sigma span stay the
0045 same. The kernel uses dimensionless Landau coordinates, explicit peak/tail
0046 subdivisions, a 16-point Gauss-Legendre rule, and relative tolerance `1e-10`.
0047 - Fit windows, seeds, parameter limits, bins/errors, likelihood flags, optimizer,
0048 fit-status acceptance, bad-channel handling, and iteration count are unchanged.
0049 - No FFT, extra Gaussian floor, rebinning, or fit-range correction is
0050 bundled here. Campaigns, plotting revisions, and unrelated bug fixes are excluded.
0051 - No data schema or ROOT class version change, TileSpectra.h change, or new library
0052 dependency.
0053 - An adaptive numerical failure rejects that fit, clears its saved-fit flag, and
0054 leaves previous calibration and caller outputs untouched. It does not silently
0055 fall back to legacy. Unrelated CAEN exceptions keep their previous behavior.
0056
0057 `AdaptiveLangau.h` is the only new production header; the only existing production
0058 files changed are TileSpectra.cc and CMakeLists.txt. A compiled TF1 callback copied
0059 in the same process remains live; a streamed/reloaded TF1 is not promised to be a
0060 live refittable callback. Separate faithful-plotting work is not included here.
0061
0062 Before adopting the adaptive default, compare frozen beam spectra and real calibration
0063 chains with identical fit windows and iteration counts. Keep per-build commits,
0064 CMake caches, toolchain versions, and separate output paths for reproducibility.