---
title: BARS3
sub_title: Status and next steps
author: A Avrorin
---

BARS current status
---

bars3: 

* rebased on master commit for Sept 11.
* outputs replicated for MC (reco-muon), per-run and per-file processing (1 exception, will go into it later)
<!-- pause -->

bars v2.7: 

* Next v2 production candidate
* Outputs will differ from v2.6 (master) by design
* Only used for offline productions
* Will be backported to bars3 after we switch

<!-- pause -->
master:

* Cleanup changes (mostly replicate B3 or apply to removed classes)
* MCL improvements
* Galactic plane code
* CI/macOS
* IMPORTANT: a lot of changes & fixes backported from B3 (see next slides)

<!-- pause -->

Bottom line: any new feature or bugfix requires support in *all* 3 branches.

Example: reading full positioning data from influx, BExportMC fixes.

<!-- end_slide -->

Backported fixes:
---
1. **PRNG seed.**

Added an explicit random seed for stochastic processing. This makes repeated runs reproducible and allows
meaningful comparisons between bars3 and master.

<!-- pause -->
2. **Pedestal estimation.**

Fixed out-of-bounds reads when a waveform is shorter than the pedestal-estimation window.

<!-- pause -->
3. **BRaw: incomplete input.**

Rejects malformed samples and truncated records instead of writing partially initialized data.

<!-- pause -->
4. **Stage1 error handling.**

Replaced abrupt termination with exception-based handling of raw master-time errors.

<!-- pause -->
5. **Logging verbosity.**

Added `--verbose <level>` so diagnostic output can be enabled without recompiling.

<!-- pause -->

6. **TChain offsets.**

Explicitly populates file offsets, fixing `getjointtable` crashes with ROOT 6.36.06 and later.

<!-- pause -->

7. **DQM solution reading.**

Uses static configuration to read all 324 channels in nine-string clusters instead of only 288.
Backported to master, then reverted in September.

<!-- pause -->

8. **Channel-mask sizing.**

Sizes channel and section masks from the selected cluster instead of assuming 288 channels.
Applied to both branches, then reverted on master in September.

<!-- pause -->

<!-- end_slide -->

Breaking changes in B3
---

1. **Native configuration format.**

reco-muon, reco-cascade and dqm-cli use native BSettings RC files.
`--v2-compat` translates legacy resource settings instead.

<!-- pause -->
2. **MC hit ordering.**

Hits with identical channel IDs and times retain their original order through stable sorting.
`--v2-compat` restores ROOT's legacy non-stable ordering for output parity with master.

<!-- pause -->
3. **Reconstruction mask composition.**

Native processing intersects the available reference, calibration, section and DQM masks.
`--v2-compat` preserves master's mask routing instead of combining all exclusions.

<!-- pause -->
4. **Masking during hit extraction.**

Native joint-data processing applies the final reconstruction mask while extracting hits.
Compatibility mode leaves single-cluster extraction unmasked and uses only calibration exclusions
for multicluster extraction.

<!-- pause -->

5. **Calibration and configuration-filter ordering.**

Native run-level processing performs calibration before configuration filtering.
`--v2-compat` preserves the legacy filter-before-calibration order used by cascade reconstruction.



<!-- end_slide -->

Validatior
---

I moved the validation into a separate repository.

https://git.jinr.ru/Baikal/bars-validation

<!-- pause -->

* It's a python uv project, can be installed via 

```
uv tool install 'git+ssh://git@git.jinr.ru/Baikal/bars-validation.git'
```

* Builds 2 docker images for bars commits
* Runs DP pipeline in both
* Compares outputs (using DP putput enumeration)

<!-- end_slide -->

Invocation example
---


```bash
bars-validation --config configs/config.toml --pipeline per_run \
  --ref-commit REF --test-commit TEST \
  --season 2026 --cluster 13 --run 30
```

<!-- pause -->

```
{
  "reco/exp/2026/cluster13/0030/p0030.reco.muon.root": {
    "Events/BRecoMuon.fDistanceCS": 3,
    "Events/BEvent.fPulses.fAmplitude": 12
  },
  "reco/exp/2026/cluster13/0030/p0030.reco.cascade.root": {
    "@structure/Events/missing_field": 1
  },
  "services/exp/2026/cluster13/0030/p0030.alert_cascade_zha.json": {
    "@file": 1
  }
}
```
<!-- end_slide -->
Comparator
---
* Standalone CLI; also used by the validator
* ROOT: compares decoded data and structure, not file bytes
* Trees, histograms, graphs and fit functions
* Other files: byte-for-byte comparison
* Validator distributes file pairs across processes
<!-- pause -->
```bash
bars-compare reference.root candidate.root \
  --policy config/comparison-policy.toml
```
Reports difference counts per field. `{}` means no differences under the policy.
<!-- end_slide -->
Comparison policy
---
TOML configuration. No BARS-specific exceptions in comparator code.
<!-- pause -->
Defaults:
* Integers: exact
* Floats: relative machine epsilon, no absolute tolerance
* Paired NaNs: equal
* Missing fields or objects: differences
<!-- pause -->
Exceptions:
* Selected by file glob and field regex
* Explicit numeric tolerances
* Ignore known metadata differences
* Require candidate fields to be zero where reference values are undefined
* Each rule has an ID and a reason
Example: allow **1 mm** absolute difference in central-string distance.
All other fields keep their default tolerances.
<!-- end_slide -->
Validation results
---

* MC pipeline: 2019 passed
* Per run: passed on run 30 cluster 1 2026
* Per file: same


<!-- end_slide -->

Next steps
---

1. I think that we've reached the point of output convergence.
2. One effort left - backport chganges after Sept 11th
3. Try B3 in a real per-run/per-file processing. If it works - *we switch*. At this point B3 is better tested for convergence than any other version change in BARS history.
4. After migration is complete - we convert configuration TOML files. 



<!-- end_slide -->
