Skip to content

Commit 2993d65

Browse files
Merge pull request #481 from SBNSoftware/feature/firstdata
First data reconstructions configurations and fcls
2 parents 6148c3e + a83fe3a commit 2993d65

14 files changed

Lines changed: 345 additions & 20 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "wcsp_data_sbnd.fcl"
2+
#include "reco1_sce_lite.fcl"
3+
4+
physics.producers:
5+
{
6+
@table::physics.producers
7+
sptpc2d : @local::sbnd_wcls_sp_data
8+
}
9+
10+
physics.reco1: [sptpc2d, gaushit]
11+
physics.producers.gaushit.CalDataModuleLabel: "sptpc2d:gauss"
12+
physics.end_paths: ["stream1"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "reco2_sce.fcl"
2+
3+
physics.reco2_sce: [pandora, pandoraTrack, pandoraShower]
4+
physics.end_paths: [stream1]

sbndcode/WireCell/cfg/pgrapher/common/params.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ local wc = import "wirecell.jsonnet";
7373
// as "nticks". For example, NF will typicall differ. Also,
7474
// in general this is not the number used for the Ductor for
7575
// simulation.
76-
nticks: 10000,
76+
nticks: 3415,
7777

7878
// Readout period in units of time
7979
readout_time: self.tick*self.nticks,

sbndcode/WireCell/cfg/pgrapher/experiment/sbnd/magnify-sinks.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ function(tools, outputfile) {
8383
data: {
8484
output_filename: outputfile,
8585
root_file_mode: 'UPDATE',
86-
summaries: ['threshold%d' % n], // note that if tag set, each apa should have a tag set for FrameFanin
87-
summary_operator: { ['threshold%d' % n]: 'set' }, // []: obj comprehension
86+
summaries: ['wiener%d' % n], // note that if tag set, each apa should have a tag set for FrameFanin
87+
summary_operator: { ['wiener%d' % n]: 'set' }, // []: obj comprehension
8888
anode: wc.tn(tools.anodes[n]),
8989
},
9090
}, nin=1, nout=1)

sbndcode/WireCell/cfg/pgrapher/experiment/sbnd/params.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ base {
8686
},
8787

8888
daq: super.daq {
89-
nticks: 3400,
89+
nticks: 3415,
9090
},
9191

9292
adc: super.adc {
@@ -108,7 +108,7 @@ base {
108108
elec: super.elec {
109109
postgain: 1.0, // pulser calibration: 41.649 ADC*tick/1ke
110110
// theoretical elec resp (14mV/fC): 36.6475 ADC*tick/1ke
111-
shaping: 2.0 * wc.us,
111+
shaping: 2.2 * wc.us,
112112
},
113113

114114
sim: super.sim {
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
// This is a main entry point to configure a WC/LS job that applies
2+
// noise filtering and signal processing to existing RawDigits. The
3+
// FHiCL is expected to provide the following parameters as attributes
4+
// in the "params" structure.
5+
//
6+
// epoch: the hardware noise fix expoch: "before", "after", "dynamic" or "perfect"
7+
// reality: whether we are running on "data" or "sim"ulation.
8+
// raw_input_label: the art::Event inputTag for the input RawDigit
9+
//
10+
// see the .fcl of the same name for an example
11+
//
12+
// Manual testing, eg:
13+
//
14+
// jsonnet -V reality=data -V epoch=dynamic -V raw_input_label=daq \\
15+
// -V signal_output_form=sparse \\
16+
// -J cfg cfg/pgrapher/experiment/uboone/wcls-nf-sp.jsonnet
17+
//
18+
// jsonnet -V reality=sim -V epoch=perfect -V raw_input_label=daq \\
19+
// -V signal_output_form=sparse \\
20+
// -J cfg cfg/pgrapher/experiment/uboone/wcls-nf-sp.jsonnet
21+
22+
23+
local epoch = std.extVar('epoch'); // eg "dynamic", "after", "before", "perfect"
24+
local sigoutform = std.extVar('signal_output_form'); // eg "sparse" or "dense"
25+
local raw_input_label = std.extVar('raw_input_label'); // eg "daq"
26+
27+
local g = import 'pgraph.jsonnet';
28+
local f = import 'pgrapher/experiment/sbnd/funcs.jsonnet';
29+
local wc = import 'wirecell.jsonnet';
30+
local tools_maker = import 'pgrapher/common/tools.jsonnet';
31+
32+
local data_params = import 'params.jsonnet';
33+
34+
local params = data_params {
35+
daq: super.daq { // <- super.daq overrides default values
36+
// Set the waveform sample length, eg, 6000, 15000, "auto"
37+
nticks: std.extVar('nticks'),
38+
},
39+
};
40+
41+
42+
local tools = tools_maker(params);
43+
44+
45+
local mega_anode = {
46+
type: 'MegaAnodePlane',
47+
name: 'meganodes',
48+
data: {
49+
anodes_tn: [wc.tn(anode) for anode in tools.anodes],
50+
},
51+
};
52+
53+
local wcls_maker = import 'pgrapher/ui/wcls/nodes.jsonnet';
54+
local wcls = wcls_maker(params, tools);
55+
56+
// Collect the WC/LS input converters for use below. Make sure the
57+
// "name" argument matches what is used in the FHiCL that loads this
58+
// file. In particular if there is no ":" in the inputer then name
59+
// must be the emtpy string.
60+
local wcls_input = {
61+
adc_digits: g.pnode({
62+
type: 'wclsRawFrameSource',
63+
name: '',
64+
data: {
65+
art_tag: raw_input_label,
66+
frame_tags: ['orig'], // this is a WCT designator
67+
// nticks: params.daq.nticks,
68+
},
69+
}, nin=0, nout=1),
70+
71+
};
72+
73+
74+
// Collect all the wc/ls output converters for use below. Note the
75+
// "name" MUST match what is used in theh "outputers" parameter in the
76+
// FHiCL that loads this file.
77+
78+
local wcls_output = {
79+
// The noise filtered "ADC" values. These are truncated for
80+
// art::Event but left as floats for the WCT SP. Note, the tag
81+
// "raw" is somewhat historical as the output is not equivalent to
82+
// "raw data".
83+
nf_digits: g.pnode({
84+
type: 'wclsFrameSaver',
85+
name: 'nfsaver',
86+
data: {
87+
// anode: wc.tn(tools.anode),
88+
anode: wc.tn(mega_anode),
89+
digitize: true, // true means save as RawDigit, else recob::Wire
90+
frame_tags: ['raw'],
91+
// nticks: params.daq.nticks,
92+
chanmaskmaps: ['bad'],
93+
},
94+
}, nin=1, nout=1, uses=[mega_anode]),
95+
96+
97+
// The output of signal processing. Note, there are two signal
98+
// sets each created with its own filter. The "gauss" one is best
99+
// for charge reconstruction, the "wiener" is best for S/N
100+
// separation. Both are used in downstream WC code.
101+
sp_signals: g.pnode({
102+
type: 'wclsFrameSaver',
103+
name: 'spsaver',
104+
data: {
105+
anode: wc.tn(mega_anode),
106+
digitize: false, // true means save as RawDigit, else recob::Wire
107+
frame_tags: ['gauss', 'wiener'],
108+
109+
// this may be needed to convert the decon charge [units:e-] to be consistent with the LArSoft default ?unit? e.g. decon charge * 0.005 --> "charge value" to GaussHitFinder
110+
frame_scale: [0.02, 0.02],
111+
nticks: params.daq.nticks,
112+
chanmaskmaps: [],
113+
},
114+
}, nin=1, nout=1, uses=[mega_anode]),
115+
};
116+
117+
local perfect = import 'pgrapher/experiment/sbnd/chndb-perfect.jsonnet';
118+
//local base = import 'pgrapher/experiment/sbnd/chndb-base_sbnd.jsonnet';
119+
120+
local chndb = [{
121+
type: 'OmniChannelNoiseDB',
122+
name: 'ocndbperfect%d' % n,
123+
data: perfect(params, tools.anodes[n], tools.field, n){dft:wc.tn(tools.dft)},
124+
// data: base(params, tools.anodes[n], tools.field, n){dft:wc.tn(tools.dft)},
125+
uses: [tools.anodes[n], tools.field, tools.dft],
126+
} for n in std.range(0, std.length(tools.anodes) - 1)];
127+
128+
local chsel_pipes = [
129+
g.pnode({
130+
type: 'ChannelSelector',
131+
name: 'chsel%d' % n,
132+
data: {
133+
channels: std.range(5632 * n, 5632 * (n + 1) - 1),
134+
//tags: ['orig%d' % n], // traces tag
135+
},
136+
}, nin=1, nout=1)
137+
for n in std.range(0, std.length(tools.anodes) - 1)
138+
];
139+
140+
local nf_maker = import 'pgrapher/experiment/sbnd/nf.jsonnet';
141+
local nf_pipes = [nf_maker(params, tools.anodes[n], chndb[n], n, name='nf%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)];
142+
143+
local sp_maker = import 'pgrapher/experiment/sbnd/sp.jsonnet';
144+
local sp = sp_maker(params, tools, { sparse: sigoutform == 'sparse' });
145+
local sp_pipes = [sp.make_sigproc(a) for a in tools.anodes];
146+
147+
local magoutput = 'sbnd-data-check.root';
148+
local magnify = import 'pgrapher/experiment/sbnd/magnify-sinks.jsonnet';
149+
local sinks = magnify(tools, magoutput);
150+
151+
local nfsp_pipes = [
152+
g.pipeline([
153+
chsel_pipes[n],
154+
//sinks.orig_pipe[n],
155+
156+
nf_pipes[n],
157+
//sinks.raw_pipe[n],
158+
159+
sp_pipes[n],
160+
//sinks.decon_pipe[n],
161+
//sinks.threshold_pipe[n],
162+
// sinks.debug_pipe[n], // use_roi_debug_mode=true in sp.jsonnet
163+
],
164+
'nfsp_pipe_%d' % n)
165+
for n in std.range(0, std.length(tools.anodes) - 1)
166+
];
167+
168+
local fanpipe = f.fanpipe('FrameFanout', nfsp_pipes, 'FrameFanin', 'sn_mag_nf');
169+
170+
local retagger = g.pnode({
171+
type: 'Retagger',
172+
data: {
173+
// Note: retagger keeps tag_rules an array to be like frame fanin/fanout.
174+
tag_rules: [{
175+
// Retagger also handles "frame" and "trace" like fanin/fanout
176+
// merge separately all traces like gaussN to gauss.
177+
frame: {
178+
'.*': 'retagger',
179+
},
180+
merge: {
181+
'gauss\\d': 'gauss',
182+
'wiener\\d': 'wiener',
183+
},
184+
}],
185+
},
186+
}, nin=1, nout=1);
187+
188+
local sink = g.pnode({ type: 'DumpFrames' }, nin=1, nout=0);
189+
190+
191+
// local graph = g.pipeline([wcls_input.adc_digits, rootfile_creation_frames, fanpipe, retagger, wcls_output.sp_signals, sink]);
192+
local graph = g.pipeline([wcls_input.adc_digits, fanpipe, retagger, wcls_output.sp_signals, sink]);
193+
194+
local app = {
195+
type: 'TbbFlow',
196+
data: {
197+
edges: g.edges(graph),
198+
},
199+
};
200+
201+
// Finally, the configuration sequence
202+
g.uses(graph) + [app]

sbndcode/WireCell/cfg/pgrapher/experiment/sbnd/wcls-nf-sp.jsonnet

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222

2323
local epoch = std.extVar('epoch'); // eg "dynamic", "after", "before", "perfect"
24-
local reality = std.extVar('reality');
2524
local sigoutform = std.extVar('signal_output_form'); // eg "sparse" or "dense"
2625
local raw_input_label = std.extVar('raw_input_label'); // eg "daq"
2726

@@ -30,13 +29,10 @@ local f = import 'pgrapher/experiment/sbnd/funcs.jsonnet';
3029
local wc = import 'wirecell.jsonnet';
3130
local tools_maker = import 'pgrapher/common/tools.jsonnet';
3231

33-
local data_params = import 'params.jsonnet';
3432
local simu_params = import 'simparams.jsonnet';
35-
local params = if reality == 'data' then data_params else simu_params;
33+
local params = simu_params;
3634

3735
local tools = tools_maker(params);
38-
local nanodes = std.length(tools.anodes);
39-
local anode_iota = std.range(0, nanodes - 1);
4036

4137
local mega_anode = {
4238
type: 'MegaAnodePlane',
@@ -66,6 +62,7 @@ local wcls_input = {
6662

6763
};
6864

65+
6966
// Collect all the wc/ls output converters for use below. Note the
7067
// "name" MUST match what is used in theh "outputers" parameter in the
7168
// FHiCL that loads this file.
@@ -118,7 +115,7 @@ local chndb = [{
118115
data: perfect(params, tools.anodes[n], tools.field, n){dft:wc.tn(tools.dft)},
119116
// data: base(params, tools.anodes[n], tools.field, n){dft:wc.tn(tools.dft)},
120117
uses: [tools.anodes[n], tools.field, tools.dft],
121-
} for n in anode_iota];
118+
} for n in std.range(0, std.length(tools.anodes) - 1)];
122119

123120
local chsel_pipes = [
124121
g.pnode({
@@ -148,7 +145,7 @@ local nfsp_pipes = [
148145
chsel_pipes[n],
149146
//sinks.orig_pipe[n],
150147

151-
//nf_pipes[n],
148+
nf_pipes[n],
152149
//sinks.raw_pipe[n],
153150

154151
sp_pipes[n],

sbndcode/WireCell/cfg/pgrapher/ui/wcls/nodes.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ function(params, tools)
6767
},
6868
},nin=1, nout=1, uses=[tools.anode]),
6969

70-
// Save thresholds
71-
thresholds: function(tags=["threshold"], name="thsaver", cmm=[]) g.pnode({
70+
// Save wiener RMS. this used to be saved in threshold trace tag summary.
71+
thresholds: function(tags=["wiener"], name="thsaver", cmm=[]) g.pnode({
7272
type: "wclsFrameSaver",
7373
name: name,
7474
data: {

sbndcode/WireCell/wcsimsp_sbnd.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ sbnd_wcls_sp.wcls_main.params : {
9696
# Save output signal waveforms (recob::Wire) in "sparse" or "dense" form
9797
signal_output_form: "sparse"
9898
}
99-
END_PROLOG
99+
END_PROLOG
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
BEGIN_PROLOG
2+
3+
sbnd_wcls: {
4+
module_type : WireCellToolkit
5+
wcls_main: {
6+
tool_type: "WCLS"
7+
apps: ["TbbFlow"]
8+
9+
## Uncomment the following lines for debugging
10+
# loglevels: ["debug", "pgraph:info"]
11+
# logsinks: ["stdout"]
12+
13+
## This sets the "main" Jsonnet file which provides the
14+
## configuration for the Wire-Cell Toolkit components. It is
15+
## take as relative to entries in WIRECELL_PATH.
16+
configs: []
17+
18+
## Libraries in which to look for WCT components
19+
plugins: ["WireCellGen", "WireCellSigProc", "WireCellRoot", "WireCellPgraph", "WireCellLarsoft", "WireCellTbb"]
20+
inputers: []
21+
outputers: []
22+
23+
## Set the "external variables" required by the Jsonnet.
24+
params: {}
25+
structs: {}
26+
}
27+
}
28+
29+
30+
# ------------------------------------------------------------------------------------ #
31+
32+
## Configuration for **Signal processing ONLY** for data
33+
sbnd_wcls_sp_data: @local::sbnd_wcls
34+
sbnd_wcls_sp_data.wcls_main.configs: ["pgrapher/experiment/sbnd/wcls-nf-sp-data.jsonnet"]
35+
sbnd_wcls_sp_data.wcls_main.inputers: ["wclsRawFrameSource"
36+
# To use wclsMultiChannelNoiseDB you must also put epoch:dynamic below
37+
# and you must have geo::Geometry service in your environment.
38+
# ,"wclsMultiChannelNoiseDB"
39+
]
40+
sbnd_wcls_sp_data.wcls_main.outputers: ["wclsFrameSaver:spsaver"]
41+
sbnd_wcls_sp_data.wcls_main.params : {
42+
# This locates the input raw::RawDigit collection in the art::Event
43+
raw_input_label: "daq"
44+
45+
# if epoch is "dynamic" you MUST add
46+
# "wclsMultiChannelNoiseDB" to "inputers" and must NOT
47+
# add it if not "dynamic"
48+
epoch: "perfect"
49+
50+
# Save output signal waveforms (recob::Wire) in "sparse" or "dense" form
51+
signal_output_form: "sparse"
52+
}
53+
54+
sbnd_wcls_sp_data.wcls_main.structs: {
55+
# Set the waveform sample length, eg, 6000, 15000, "auto"
56+
nticks: 3415
57+
}
58+
59+
END_PROLOG

0 commit comments

Comments
 (0)