# Issue 12 — second 2000 Gen2 data events with FrameShift, for Xin's development

A second, **disjoint** batch of Gen2 real-data reco1 events carrying the
FrameShift product, for pattern-recognition development. Deliberately shares no
event with the existing
`round2-patrec/data_MCP2025C_reco1_frameshift_first1000ev.root`, so that sample
stays clean as a held-out set.

Work/output: `/exp/sbnd/data/users/yuhw/production-prep/add-frameshift-data-2nd-2k-2026-08-15/`

## Deliverables

| file | events | size |
|---|---|---|
| `data_MCP2025C_reco1_frameshift_2nd1k_part1.root` | 1000 | 3.88 GB |
| `data_MCP2025C_reco1_frameshift_2nd1k_part2.root` | 1000 | 3.90 GB |

Both carry `sbnd::timing::FrameShiftInfo_frameshift__FRAMESHIFT` (and
`TimingInfo`) on top of the full reco1 content, process name `FRAMESHIFT` —
the same product set as the existing 1000-event sample.

## How the existing sample was made (reconstructed from provenance)

`round2-patrec/README.md` and `frameshift_1000.log` give it exactly:

```
lar -c run_frameshift.fcl -S data_paths-v10_14_02-100files.lst -n 1000 \
    -o data_MCP2025C_reco1_frameshift_first1000ev.root
```

- List: `data_paths-v10_14_02-full.lst` — 1,820 files from SAM definition
  `data_MCP2025C_Fall25-Run1_BNB_FixedDev_bnblight_v10_14_02_reco1_sbnd`,
  generated by `gen_sample_list.sh`.
- `-n 1000` stopped after 1000 events, which took **exactly the first 20 files**
  of that list (verified: the 20 `/pnfs` paths in `frameshift_1000.log` are
  precisely list entries 1–20).
- Cost: 16 s CPU / 30 s wall for 1000 events.

## This run

Every data file in this sample holds **exactly 50 events** (verified across 100
files, zero variation), so the split lands on file boundaries with no straddling
and no `--nskip` arithmetic:

| output | list entries | files | events |
|---|---|---|---|
| part1 | **21–40** | 20 | 1000 |
| part2 | **41–60** | 20 | 1000 |

Starting at entry 21 guarantees no file-level overlap with the reference run,
which stopped at entry 20.

```
lar -c run_frameshift.fcl -S lists/part1.lst -n 1000 -o ..._2nd1k_part1.root
lar -c run_frameshift.fcl -S lists/part2.lst -n 1000 -o ..._2nd1k_part2.root
```

`run_frameshift.fcl` from
`sbndcode/sbndcode/Timing/FrameShift/`, unmodified. Env: `setup-local-opt.sh`
inside the SL7 apptainer. The two jobs ran concurrently, each in **its own cwd**
— concurrent `lar` jobs otherwise collide on art's MemoryTracker/TFileService
sqlite files (`SQLExecutionError: disk I/O error`).

## Truth-contamination check — by RSE, not by file path

File-path disjointness was the *construction*; the *verification* is at event
level. Run/subrun/event read from `EventAuxiliary` via PyROOT (not
`lar -c eventdump.fcl`):

| set | rows | unique |
|---|---|---|
| reference (first 1000) | 1000 | 1000 |
| part1 | 1000 | 1000 |
| part2 | 1000 | 1000 |

| intersection | count |
|---|---|
| part1 ∩ reference | **0** |
| part2 ∩ reference | **0** |
| part1 ∩ part2 | **0** |

All 3000 events across the three files are distinct. All three draw from the
same two runs (18255, 18259), so the separation is genuinely per-event, not an
artefact of landing in different runs.

## Note on the core budget

20 cores were allowed; **the job does not need them**. FrameShift is 16 s of
CPU per 1000 events — the cost is writing ~3.9 GB per output and reading the
inputs from dCache, so it is write/IO-bound. Two concurrent jobs (one per
output file, 2 cores each) finished in about a minute. The only step where
parallelism helped at all was counting events across 100 dCache files, which
ran 10 opens at a time.

## Reusing this for a third batch

Continue from list entry 61. Every file is 50 events, so *N* thousand events =
20 *N* files, and the lists are pure `sed -n 'A,Bp'` slices of
`data_paths-v10_14_02-full.lst`. The list has 1,820 files ≈ 91,000 events, of
which 60 files / 3,000 events are now consumed.

## Files in this folder

```
12-frameshift-data-2nd-2k.md   this document
scripts/count-events.sh        per-file event count, 10 dCache opens at a time
scripts/run-frameshift.sh      one group -> one output (own cwd)
scripts/rse-list.py            EventAuxiliary -> run/subrun/event list
```

Data (gitignored) under
`/exp/sbnd/data/users/yuhw/production-prep/add-frameshift-data-2nd-2k-2026-08-15/`:
the two `.root` outputs, `lists/` (candidates, part1, part2, counts, rse-*),
`logs/`.
