---
# System prepended metadata

title: Morse sim/analysis

---

# Morse sim/analysis

## simulation
BV: https://indico.bnl.gov/event/21684/contributions/85251/attachments/51799/88575/splat.pdf

Prerequisite:
 - numpy 1.24+
 - jsonnet 0.18+ (std.get)

Update 3 wire-cell repos:



```bash!
./wcb --tests
```


## DepoSplat -> DepoFluxSplat

```bash!
setup sbndcode v09_83_01 -q e26:prof
```

```jsonnet
// The approximated sim+sigproc
local splat = function(params, tools, anode, name=null) {
    local apaid = anode.data.ident,
    local sufix = if std.type(name) == "null" then apaid else name,
    local bg = g.pnode({
        type:'DepoBagger',
        name: sufix,
        data: {
            gate: [params.sim.ductor.start_time,
                   params.sim.ductor.start_time+params.sim.ductor.readout_time],
        },
    }, nin=1, nout=1),
    local sp = g.pnode({
        type: 'DepoFluxSplat',
        name: sufix,
        data: {
            anode: wc.tn(anode),
            field_response: wc.tn(tools.field), // for speed and origin
            sparse: true,
            tick: params.daq.tick,
            window_start: params.sim.ductor.start_time,
            window_duration: params.sim.ductor.readout_time,
            reference_time: 0.0,
            // Run wirecell-gen morse-* to find these numbers that match the extra
            // spread the sigproc induces.
            "smear_long": [
                2.691862363980221,
                2.6750200122535057,
                2.7137567141154055
            ],
            "smear_tran": [
                0.7377218875719689,
                0.7157764520393882,
                0.13980698710556544
            ]
        },
    }, nin=1, nout=1, uses=[anode, tools.field]),
    local rt = g.pnode({
        type: 'Retagger',
        name: sufix,
        data: {
            // Note: retagger keeps tag_rules an array to be like frame fanin/fanout.
            tag_rules: [{
                // Retagger also handles "frame" and "trace" like fanin/fanout
                // merge separately all traces like gaussN to gauss.
                frame: {
                ".*": "deposplat%d" % apaid
                },
                merge: {
                ".*": "deposplat%d" % apaid
                },
            }],
        },
    }, nin=1, nout=1),
    ret: g.pipeline([bg, sp, rt],"%s-%s" % [bg.name, sp.name]),
}.ret;
    
local deposplats = [splat(params, tools, tools.anodes[n]) for n in anode_iota] ;
```

## PD-HD
```bash=!
# environment setup
source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh;
setup dunesw v09_83_01d00 -q e26:prof
source /dune/data/users/wgu/DnnRoi/opt/localProducts_larsoft_v09_83_01_e26_prof/setup;
mrbslp

# commands
lar -n1 -c prod_cosmics_1GeV_protodunehd.fcl -o gen.root
lar -n1 -c standard_g4_protodunehd_stage1.fcl gen.root -o g4a.root
lar -n1 -c standard_g4_protodunehd_stage2.fcl g4a.root -o g4b.root

cp -r /dune/data/users/wgu/dune10kt_1x2x6/wire-cell-cfg/ts-model .
lar -n1 -c pdhd_wirecell_sim_deposplat.fcl g4b.root

# One should see hdf5 output files such as: g4-tru-0.h5 (truth label) & g4-rec-0.h5 (sigproc products)
```