-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-depos-splat.jsonnet
78 lines (61 loc) · 2.36 KB
/
main-depos-splat.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// This is a main wire-cell configuration file.
//
// It implements the chain:
// (depos)->splat->(signals)
//
// It takes a number of top-level-arguments (TLA) which can control
// input configuration and input data and a number of output data
// "taps". You may also control if it runs in single or multi thread
// mode
//
// Run like
//
// wire-cell \
// -A depos=depos.npz \
// -A taps={...see below...} \
// -A wires=wires-geometry.json.bz2 \
// -A thread=[single|multi] \
// -c main-depos-splat.jsonnet
//
// If "taps" is given it specifies a mapping from a data tier key word
// to a file name. The key is one of the conventional tags:
//
// - splat :: the output of DepoSplat.
//
// The file name must have a "%d" formatter which will be interpolated
// against the APA ID number. Tap files likely one of .tar, .tar.gz
// or .tar.bz2.
local wc = import "wirecell.jsonnet";
local pg = import "pgraph.jsonnet";
local tz = import "toyzero.jsonnet";
local io = import "ioutils.jsonnet";
local params = import "pgrapher/experiment/pdsp/simparams.jsonnet";
local spfilt = import "pgrapher/experiment/pdsp/sp-filters.jsonnet";
local chndb = import "pdsp_chndb.jsonnet";
function(input, taps, wires, thread='single')
local app = if thread == 'single'
then 'Pgrapher'
else 'TbbFlow';
local seeds = [0,1,2,3,4]; // maybe let CLI set?
local depos = io.npz_source_depo("depos", input);
local wireobj = tz.wire_file(wires);
local anodes = tz.anodes(wireobj, params.det.volumes);
local apaids = std.range(0, std.length(anodes)-1);
local random = tz.random(seeds);
local drifter = tz.drifter(params.det.volumes, params.lar, random);
local tap_out(tap, apaid, cap=true) = {
local name = "%s%d"%[tap,apaid],
local digi = tap == "raw" || tap == "orig",
res: if std.objectHas(taps, tap)
then [io.frame_tap(name, io.frame_sink(name, taps[tap]%apaid, tags=[name], digitize=digi), name, cap)]
else []
}.res;
local splat(n) = [
local anode = anodes[n];
tz.splat(anode, params.daq, params.lar, random)
] + tap_out("splat", n);
local oneapa(n) = pg.pipeline(splat(n));
local pipes = [oneapa(n) for n in apaids];
local body = pg.fan.fanout('DepoFanout', pipes);
local full = pg.pipeline([depos, drifter, body]);
tz.main(full, app)