Skip to content

Commit 56938e7

Browse files
Merge branch 'develop' into feature/lynnt_pmt_decoder
2 parents 089b3b2 + 5aa7ff7 commit 56938e7

8 files changed

Lines changed: 236 additions & 12 deletions

File tree

sbndcode/WireCell/cfg/pgrapher/experiment/sbnd/chndb-base.jsonnet

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ function(params, anode, field, n, rms_cuts=[])
2020
// For MicroBooNE, channel groups is a 2D list. Each element is
2121
// one group of channels which should be considered together for
2222
// coherent noise filtering.
23-
groups: [std.range( 0 + n * 5638 + g*32, 0 + n * 5638 + (g+1)*32 - 1) for g in std.range(0,149)] +
24-
[std.range(4806 + n * 5638 + g*32, 4806 + n * 5638 + (g+1)*32 - 1) for g in std.range(0,25)] ,
23+
// 5638 is the number of channels in a single APA, (1984*2 + 1670), including the 6 channel gap.
24+
// 4806 is the number of channels for both induction + half of real collection wires + 6 channel gap
25+
groups: [std.range( 0 + n * 5638 + g*32, 0 + n * 5638 + (g+1)*32 - 1) for g in std.range(0,150)] +
26+
[std.range(4806 + n * 5638 + g*32, 4806 + n * 5638 + (g+1)*32 - 1) for g in std.range(0,26)] ,
2527

2628

2729
// Externally determined "bad" channels.
2830
//
2931
// Dead channels: 3232:3263 (inclusive) (East V). 4160:4191 (East Y)
32+
// Jumpered region: 4800:4805 (inclusive, East Y), 10438:10443 (inclusive, West Y)
33+
// No response: 546, 607, 8574
3034
// Shorted channels: 7169 (West U), 8378 (West V).
3135
// There are four physically missing wires ( = bad channels) due to combs, in the center of each 1/2 APA.
3236
// They are 4374 and 5231 (East Y), 10012 and 10869 (West Y).
33-
// So in total, there are 76 bad channels.
37+
// So in total, there are 88 bad channels.
3438
//
3539
//bad: [],
3640
bad: [546, 607] + std.range(3232, 3263) + std.range(4160, 4191) + [4374, 4800, 4801, 4802, 4803, 4804, 4805, 5060, 5231, 5636, 5637, 7169, 8378, 8574, 10012, 10869, 10438, 10439, 10440, 10441, 10442, 10443],
@@ -53,15 +57,15 @@ function(params, anode, field, n, rms_cuts=[])
5357
response_offset: 0.0, // ticks?
5458
pad_window_front: 10, // ticks?
5559
pad_window_back: 10, // ticks?
56-
decon_limit: 0.02,
60+
decon_limit: 0.02, // (SignalProtection, same as upper_decon_limit (default 0.02))
5761
decon_limit1: 0.09,
58-
adc_limit: 15,
62+
adc_limit: 10,
5963
roi_min_max_ratio: 0.8, // default 0.8
6064
min_rms_cut: 1.0, // units???
6165
max_rms_cut: 30.0, // units???
6266

6367
// parameter used to make "rcrc" spectrum
64-
rcrc: 1.1 * wc.millisecond, // 1.1 for collection, 3.3 for induction
68+
rcrc: 0.5 * wc.millisecond, // 1.1 for collection, 3.3 for induction
6569
rc_layers: 1, // default 2
6670

6771
// parameters used to make "config" spectrum

sbndcode/WireCell/cfg/pgrapher/experiment/sbnd/chndb-perfect.jsonnet

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ function(params, anode, field, n, rms_cuts=[])
2727
// Externally determined "bad" channels.
2828
//
2929
// Dead channels: 3232:3263 (inclusive) (East V). 4160:4191 (East Y)
30+
// Jumpered region: 4800:4805 (inclusive, East Y), 10438:10443 (inclusive, West Y)
31+
// No response: 546, 607, 8574
3032
// Shorted channels: 7169 (West U), 8378 (West V).
3133
// There are four physically missing wires ( = bad channels) due to combs, in the center of each 1/2 APA.
3234
// They are 4374 and 5231 (East Y), 10012 and 10869 (West Y).
33-
// So in total, there are 76 bad channels.
35+
// So in total, there are 88 bad channels.
3436
//
3537
//bad: [],
3638
bad: [546, 607] + std.range(3232, 3263) + std.range(4160, 4191) + [4374, 4800, 4801, 4802, 4803, 4804, 4805, 5060, 5231, 5636, 5637, 7169, 8378, 8574, 10012, 10869, 10438, 10439, 10440, 10441, 10442, 10443],
@@ -61,7 +63,7 @@ function(params, anode, field, n, rms_cuts=[])
6163
max_rms_cut: 30.0, // units???
6264

6365
// parameter used to make "rcrc" spectrum
64-
rcrc: 1.1 * wc.millisecond, // 1.1 for collection, 3.3 for induction
66+
rcrc: 0.5 * wc.millisecond, // 1.1 for collection, 3.3 for induction
6567
rc_layers: 1, // default 2
6668

6769
// parameters used to make "config" spectrum

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ local g = import 'pgraph.jsonnet';
5050
trace: {
5151
//gauss: 'gauss%d' % n,
5252
//wiener: 'wiener%d' % n,
53+
['raw%d' % n]: ['raw%d' % n],
5354
['gauss%d' % n]: ['gauss%d' % n],
5455
['wiener%d' % n]: ['wiener%d' % n],
5556
['threshold%d' % n]: ['threshold%d' % n],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function(params, anode, chndbobj, n, name='', dft=default_dft)
6161
wc.tn(single),
6262
],
6363
grouped_filters: [
64-
//wc.tn(grouped),
64+
// wc.tn(grouped),
6565
],
6666
channel_status_filters: [
6767
],

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ base {
8686
},
8787

8888
daq: super.daq {
89-
nticks: 3415,
89+
nticks: 3427,
90+
},
91+
92+
nf: super.nf {
93+
nsamples: $.daq.nticks,
9094
},
9195

9296
adc: super.adc {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ base {
159159
},
160160

161161
rc_resp: {
162-
width: 1.1*wc.ms,
162+
width: 0.5*wc.ms,
163163
rc_layers: 1, // 1
164164
}
165165
}
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
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+
local use_paramresp = std.extVar('use_paramresp'); // eg "true" or "false"
27+
28+
local g = import 'pgraph.jsonnet';
29+
local f = import 'pgrapher/experiment/sbnd/funcs.jsonnet';
30+
local wc = import 'wirecell.jsonnet';
31+
local tools_maker = import 'pgrapher/common/tools.jsonnet';
32+
33+
local data_params = import 'params.jsonnet';
34+
35+
local params = data_params {
36+
daq: super.daq { // <- super.daq overrides default values
37+
// Set the waveform sample length, eg, 6000, 15000, "auto"
38+
nticks: std.extVar('nticks'),
39+
},
40+
# provides filename for parametrized per channel electronics response correction
41+
# default is: use_parmresp = false
42+
files: super.files {
43+
chresp: if (use_paramresp == 'true') then "sbnd-params-chresp-ideal-v1.json.bz2" else null,
44+
},
45+
};
46+
47+
48+
local tools = tools_maker(params);
49+
50+
51+
local mega_anode = {
52+
type: 'MegaAnodePlane',
53+
name: 'meganodes',
54+
data: {
55+
anodes_tn: [wc.tn(anode) for anode in tools.anodes],
56+
},
57+
};
58+
59+
local wcls_maker = import 'pgrapher/ui/wcls/nodes.jsonnet';
60+
local wcls = wcls_maker(params, tools);
61+
62+
// Collect the WC/LS input converters for use below. Make sure the
63+
// "name" argument matches what is used in the FHiCL that loads this
64+
// file. In particular if there is no ":" in the inputer then name
65+
// must be the emtpy string.
66+
local wcls_input = {
67+
adc_digits: g.pnode({
68+
type: 'wclsRawFrameSource',
69+
name: '',
70+
data: {
71+
art_tag: raw_input_label,
72+
frame_tags: ['orig'], // this is a WCT designator
73+
// nticks: params.daq.nticks,
74+
},
75+
}, nin=0, nout=1),
76+
77+
};
78+
79+
80+
// Collect all the wc/ls output converters for use below. Note the
81+
// "name" MUST match what is used in theh "outputers" parameter in the
82+
// FHiCL that loads this file.
83+
84+
local wcls_output = {
85+
// The noise filtered "ADC" values. These are truncated for
86+
// art::Event but left as floats for the WCT SP. Note, the tag
87+
// "raw" is somewhat historical as the output is not equivalent to
88+
// "raw data".
89+
nf_digits: g.pnode({
90+
type: 'wclsFrameSaver',
91+
name: 'nfsaver',
92+
data: {
93+
// anode: wc.tn(tools.anode),
94+
anode: wc.tn(mega_anode),
95+
digitize: true, // true means save as RawDigit, else recob::Wire
96+
frame_tags: ['raw'],
97+
nticks: params.daq.nticks,
98+
chanmaskmaps: ['bad'],
99+
},
100+
}, nin=1, nout=1, uses=[mega_anode]),
101+
102+
103+
// The output of signal processing. Note, there are two signal
104+
// sets each created with its own filter. The "gauss" one is best
105+
// for charge reconstruction, the "wiener" is best for S/N
106+
// separation. Both are used in downstream WC code.
107+
sp_signals: g.pnode({
108+
type: 'wclsFrameSaver',
109+
name: 'spsaver',
110+
data: {
111+
anode: wc.tn(mega_anode),
112+
digitize: false, // true means save as RawDigit, else recob::Wire
113+
frame_tags: ['gauss', 'wiener'],
114+
115+
// 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
116+
frame_scale: [0.02, 0.02],
117+
nticks: params.daq.nticks,
118+
119+
120+
// uncomment the below configs to save summaries and cmm
121+
summary_tags: ['wiener'],
122+
summary_operator: {wiener: 'set'},
123+
summary_scale: [0.02], # summary scale should be the same as frame_scale
124+
chanmaskmaps: ['bad'],
125+
},
126+
}, nin=1, nout=1, uses=[mega_anode]),
127+
};
128+
129+
local base = import 'pgrapher/experiment/sbnd/chndb-base.jsonnet';
130+
131+
local chndb = [{
132+
type: 'OmniChannelNoiseDB',
133+
name: 'ocndbperfect%d' % n,
134+
data: base(params, tools.anodes[n], tools.field, n){dft:wc.tn(tools.dft)},
135+
uses: [tools.anodes[n], tools.field, tools.dft],
136+
} for n in std.range(0, std.length(tools.anodes) - 1)];
137+
138+
local chsel_pipes = [
139+
g.pnode({
140+
type: 'ChannelSelector',
141+
name: 'chsel%d' % n,
142+
data: {
143+
channels: std.range(5638 * n, 5638 * (n + 1) - 1),
144+
//tags: ['orig%d' % n], // traces tag
145+
},
146+
}, nin=1, nout=1)
147+
for n in std.range(0, std.length(tools.anodes) - 1)
148+
];
149+
150+
local nf_maker = import 'pgrapher/experiment/sbnd/nf-data.jsonnet'; //added Ewerton 2024-08
151+
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)];
152+
153+
local sp_maker = import 'pgrapher/experiment/sbnd/sp.jsonnet';
154+
local sp = sp_maker(params, tools, { sparse: sigoutform == 'sparse' });
155+
local sp_pipes = [sp.make_sigproc(a) for a in tools.anodes];
156+
157+
local magoutput = 'sbnd-data-check.root';
158+
local magnify = import 'pgrapher/experiment/sbnd/magnify-sinks.jsonnet';
159+
local sinks = magnify(tools, magoutput);
160+
161+
local nfsp_pipes = [
162+
g.pipeline([
163+
chsel_pipes[n],
164+
// sinks.orig_pipe[n],
165+
166+
nf_pipes[n],
167+
// sinks.raw_pipe[n],
168+
169+
// sp_pipes[n],
170+
// sinks.decon_pipe[n],
171+
// sinks.threshold_pipe[n],
172+
// sinks.debug_pipe[n], // use_roi_debug_mode=true in sp.jsonnet
173+
],
174+
'nfsp_pipe_%d' % n)
175+
for n in std.range(0, std.length(tools.anodes) - 1)
176+
];
177+
178+
local fanpipe = f.fanpipe('FrameFanout', nfsp_pipes, 'FrameFanin', 'sn_mag_nf');
179+
180+
local retagger = g.pnode({
181+
type: 'Retagger',
182+
data: {
183+
// Note: retagger keeps tag_rules an array to be like frame fanin/fanout.
184+
tag_rules: [{
185+
// Retagger also handles "frame" and "trace" like fanin/fanout
186+
// merge separately all traces like gaussN to gauss.
187+
frame: {
188+
'.*': 'retagger',
189+
},
190+
merge: {
191+
'raw\\d': 'raw',
192+
// 'gauss\\d': 'gauss',
193+
// 'wiener\\d': 'wiener',
194+
},
195+
}],
196+
},
197+
}, nin=1, nout=1);
198+
199+
local sink = g.pnode({ type: 'DumpFrames' }, nin=1, nout=0);
200+
201+
202+
// local graph = g.pipeline([wcls_input.adc_digits, rootfile_creation_frames, fanpipe, retagger, wcls_output.sp_signals, sink]);
203+
local graph = g.pipeline([wcls_input.adc_digits, fanpipe, retagger, wcls_output.nf_digits, sink]);
204+
205+
local app = {
206+
type: 'TbbFlow',
207+
data: {
208+
edges: g.edges(graph),
209+
},
210+
};
211+
212+
// Finally, the configuration sequence
213+
g.uses(graph) + [app]

sbndcode/WireCell/wcsp_data_sbnd.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ sbnd_wcls_sp_data.wcls_main.params : {
5757

5858
sbnd_wcls_sp_data.wcls_main.structs: {
5959
# Set the waveform sample length, eg, 6000, 15000, "auto"
60-
nticks: 3415
60+
nticks: 3427
6161
}
6262

6363
END_PROLOG

0 commit comments

Comments
 (0)