Skip to content

Commit 401e749

Browse files
committed
sbnd: add sbnd_abhat SCE validation (WCT 0.36 migration)
Per-user subdir documenting and reproducing the SBND SCE-correction migration from patched 0.33 to a clean WCT-native IPCTransform on 0.36. Validated against the per-TPC TH3 displacement maps over 50 crossing-muon events: per-point residual rms 1.8 / 2.2 µm (East/West), max 8.4 µm, and pooled W/E = 1.327 (map vol-avg 1.276; 0.33-era reco 1.271). Includes the new SCECorrection.h, patches for PCTransforms.cxx and clus/wscript_build, the patched clus.jsonnet with diff, the BEE-pairing analysis script, and the three validation figures.
1 parent 781d357 commit 401e749

11 files changed

Lines changed: 679 additions & 0 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/clus/src/PCTransforms.cxx b/clus/src/PCTransforms.cxx
2+
index 7af8e237..1b0bf8ef 100644
3+
--- a/clus/src/PCTransforms.cxx
4+
+++ b/clus/src/PCTransforms.cxx
5+
@@ -6,6 +6,7 @@
6+
//
7+
8+
#include "WireCellClus/IPCTransform.h"
9+
+#include "WireCellClus/SCECorrection.h"
10+
#include "WireCellIface/IDetectorVolumes.h"
11+
12+
#include "WireCellIface/IConfigurable.h"
13+
@@ -178,6 +179,9 @@ public:
14+
std::string dvtn = get<std::string>(cfg, "detector_volumes", "DetectorVolumes");
15+
auto dv = Factory::find_tn<WireCell::IDetectorVolumes>(dvtn);
16+
m_pcts["T0Correction"] = std::make_shared<T0Correction>(dv);
17+
+ // SBND SCE (Space Charge Effect) -- dualmap TH3 correction.
18+
+ // No-op if sce_map_file not in DetectorVolumes metadata.
19+
+ m_pcts["SCECorrection"] = std::make_shared<SCECorrection>(dv);
20+
// ...
21+
}
22+

sbnd/sbnd_abhat/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SBND SCE Correction — WCT 0.36 migration & validation
2+
3+
Migration of the SBND Space-Charge-Effect (SCE) correction from the patched WCT 0.33
4+
pipeline (which used a `PCTransforms` reflection trick) into a clean, WCT-native
5+
`IPCTransform` for 0.36, validated against the per-TPC SCE TH3 displacement maps.
6+
7+
## What
8+
9+
- New class `WireCell::Clus::SCECorrection` — an `IPCTransform` that applies T0
10+
and the per-TPC SCE displacement maps in one step:
11+
`x_sce = x_t0 + sign * dx_map(x_t0, y, z)`, apa0 → East TH3, apa1 → West TH3.
12+
- Reads the SBND dualmap
13+
(`SCEoffsets_SBND_E500_dualmap_CV_voxelTH3.root`, `TrueBkwd_Displacement_X_{E,W}`)
14+
via DV metadata `sce_map_file` (axes in cm, sign default −1).
15+
- Wired through the existing `PCTransformSet` and `ClusteringSwitchScope`
16+
(`correction_name="SCECorrection"`); merged-APA clustering uses
17+
`common_sce_coords = ["x_sce","y","z"]`.
18+
- Toolkit code lives on branch `sbnd-sce-correction-036` off Haiwang's `match`.
19+
Upstream PR to `WireCell/wire-cell-toolkit` is pending the `clus → root`
20+
cleanup (the `TFile`/`TH3F` machinery belongs in the `root/` subpackage so
21+
`clus` stays ROOT-free).
22+
23+
## Result
24+
25+
50 crossing-muon events (apacross 3 GeV detsim), 228 404 paired 3D points,
26+
per-point comparison of reco displacement against the TH3 map prediction:
27+
28+
| Quantity | Value |
29+
|---------------------------------------|----------------------|
30+
| residual (reco − map) rms | E 1.8 µm, W 2.2 µm |
31+
| residual max | 8.4 µm |
32+
| East mean&#124;Δx&#124; | 0.4021 cm |
33+
| West mean&#124;Δx&#124; | 0.5338 cm |
34+
| **pooled W/E** | **1.327** |
35+
| reference (map volume-avg) | 1.276 |
36+
| reference (0.33-era reco) | 1.271 |
37+
38+
The map application is exact to interpolation precision (sub-µm rms vs the
39+
~5000 µm signal). The track-sampled aggregate ratio is consistent with the
40+
volume-averaged map reference; the small offset (~4 %) is the crossing-muon
41+
trajectories preferentially sampling the high-displacement mid-drift region.
42+
43+
Plots: `pics/01_residual.png` (headline, residual histogram),
44+
`pics/02_dx_vs_drift.png` (slide-style 2D Δx vs drift, per TPC),
45+
`pics/03_profile_ratio.png` (drift profile + W/E ratio panel).
46+
47+
## Reproduce
48+
49+
```bash
50+
# Env (FNAL SBND gpvm, SL7 container, our 0.36 + SCECorrection install)
51+
export SCE_TOP=/exp/sbnd/data/users/abhat/wct_sce
52+
source $SCE_TOP/restore_sce_env_036_sce.sh
53+
54+
cd $SCE_TOP/sce_test
55+
export WIRECELL_PATH="$SCE_TOP/sce_test:$WIRECELL_PATH"
56+
export FHICL_FILE_PATH="$SCE_TOP/sce_test:$FHICL_FILE_PATH"
57+
lar -n 50 -c wcls-img-clus.fcl \
58+
-s $SCE_TOP/validation_crossing_muons/chain_v3/apacross_3gev_detsim_50.root \
59+
--no-output
60+
61+
python3 make_validation_plots.py
62+
cat validation_plots/SUMMARY.txt
63+
```
64+
65+
## Files
66+
67+
- `SCECorrection.h` — the new `IPCTransform` (header-only v1).
68+
Destination in WCT toolkit: `clus/inc/WireCellClus/SCECorrection.h`.
69+
- `PCTransforms.cxx.patch` — 4-line registration in `clus/src/PCTransforms.cxx`.
70+
- `wscript_build.patch` — adds `ROOTSYS` to clus link list (will move to `root/`
71+
subpackage in the upstream PR).
72+
- `clus.jsonnet` — patched copy of canonical `../clus.jsonnet`; the SCE wiring
73+
is: `common_sce_coords` local, `sce_map_file` in DV metadata, all-APA coords
74+
set to `common_sce_coords`, `switch_scope(correction_name="SCECorrection")`,
75+
an extra `bee_points_set` named `sce` (dumps `x_sce` for validation), and
76+
`use_config_rse: false` so per-event folders survive multi-event runs.
77+
- `clus.jsonnet.patch` — diff against canonical `../clus.jsonnet`.
78+
- `wcls-img-clus.fcl` — symlink to canonical `../wcls-img-clus.fcl`.
79+
- `make_validation_plots.py` — pairs `img`/`sce` BEE points by `(y,z,q)`,
80+
re-evaluates the TH3 maps per point, produces the three figures.
81+
- `pics/` — validation PNGs.
82+
- `SUMMARY.txt` — headline numbers.

sbnd/sbnd_abhat/SUMMARY.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SBND WCT 0.36 SCECorrection validation -- 50 crossing-muon events
2+
points: 228404 (East 70503, West 157901)
3+
per-point residual reco-map: rms E=1.83e-04 W=2.23e-04 cm, max 8.42e-04 cm
4+
pooled mean|Dx|: East=0.4021 West=0.5338 W/E=1.327
5+
references: map vol-avg 1.276, 0.33-era reco 1.271

0 commit comments

Comments
 (0)