diff --git a/dune/DUNEWireCell/dune-vd/nf.jsonnet b/dune/DUNEWireCell/dune-vd/nf.jsonnet new file mode 100644 index 000000000..bfec5cb2d --- /dev/null +++ b/dune/DUNEWireCell/dune-vd/nf.jsonnet @@ -0,0 +1,63 @@ +// This provides some noise filtering related pnodes, + +local g = import 'pgraph.jsonnet'; +local wc = import 'wirecell.jsonnet'; + +function(params, anode, chndbobj, n, name='') + { + local status = { + type: 'mbOneChannelStatus', + name: name, + data: { + Threshold: 3.5, + Window: 5, + Nbins: 250, + Cut: 14, + anode: wc.tn(anode), + }, + }, + local single = { + type: 'mbOneChannelNoise', + name: name, + data: { + noisedb: wc.tn(chndbobj), + anode: wc.tn(anode), + }, + }, + local grouped = { + type: 'mbCoherentNoiseSub', + name: name, + data: { + noisedb: wc.tn(chndbobj), + anode: wc.tn(anode), + }, + }, + + local obnf = g.pnode({ + type: 'OmnibusNoiseFilter', + name: name, + data: { + + // This is the number of bins in various filters + nsamples: params.nf.nsamples, + + //maskmap: { chirp: "bad", noisy: "bad" }, + channel_filters: [ + // wc.tn(single) + ], + grouped_filters: [ + // wc.tn(grouped), + ], + channel_status_filters: [ + // wc.tn(status), + ], + noisedb: wc.tn(chndbobj), + intraces: 'orig%d' % n, // frame tag get all traces + outtraces: 'raw%d' % n, + }, + // }, uses=[chndbobj, anode, single, grouped, status], nin=1, nout=1), + }, uses=[chndbobj, anode, single], nin=1, nout=1), + + + pipe: g.pipeline([obnf], name=name), + }.pipe diff --git a/dune/DUNEWireCell/dune-vd/params.jsonnet b/dune/DUNEWireCell/dune-vd/params.jsonnet index b441e5be0..581bee22e 100644 --- a/dune/DUNEWireCell/dune-vd/params.jsonnet +++ b/dune/DUNEWireCell/dune-vd/params.jsonnet @@ -4,7 +4,7 @@ local wc = import "wirecell.jsonnet"; local base = import "pgrapher/common/params.jsonnet"; -function(response_plane) base { +function(params) base { // This section will be overwritten in simparams.jsonnet det : { @@ -14,7 +14,7 @@ function(response_plane) base { // Only one CRP is defined in this geometry // CRMs are oneside anodes - response_plane: response_plane, + response_plane: params.response_plane, local upper_crp_x = 325.00*wc.cm, //300.507*wc.cm, local upper_resp_x = upper_crp_x-self.response_plane, @@ -36,17 +36,12 @@ function(response_plane) base { daq: super.daq { tick: 0.5*wc.us, // check this in the TDR, LArSoft - - nticks: 9375, // 1.6 mm/us per 0.5 us assuming 6000 mm drift leght. + nticks: params.nticks, //9375, // 1.6 mm/us per 0.5 us assuming 6000 mm drift leght. //readout_time: self.tick*self.nticks, - //nreadouts: 1, - //start_time: 0.0*wc.s, - //stop_time: self.start_time + self.nreadouts*self.readout_time, - //first_frame_number: 0, }, @@ -54,11 +49,13 @@ function(response_plane) base { // Set 0 for now //baselines: [0*wc.millivolt, 0*wc.millivolt, 0*wc.millivolt], - //resolution: 12, - //fullscale: [0.2*wc.volt, 1.6*wc.volt], + // Copied from pdsp. induction plane: 2350 ADC, collection plane: 900 ADC + // baselines: [1003.4*wc.millivolt,1003.4*wc.millivolt,507.7*wc.millivolt], + // fullscale: [0.2*wc.volt, 1.6*wc.volt], + }, // Take BNL cold electronics on ProtoDUNE as reference here @@ -66,19 +63,13 @@ function(response_plane) base { type: "ColdElecResponse", - gain: 12*wc.mV/wc.fC, - - shaping: 1.2*wc.us, - - postgain: 1.0, - + // copied from pdsp + gain: 14*wc.mV/wc.fC, + shaping: 2.2 * wc.us, + postgain: 1.1365, start: 0, }, - - - - sim: super.sim { // For running in LArSoft, the simulation must be in fixed time mode. @@ -86,6 +77,7 @@ function(response_plane) base { }, + overall_short_padding: 0.2*wc.ms, sys_status: false, sys_resp: { start: 0.0 * wc.us, @@ -100,7 +92,7 @@ function(response_plane) base { // Based on the simulations made for the 50L prototype fields: [ - "dunevd-resp-isoc3views.json.bz2", + "dunevd-resp-isoc3views-18d92.json.bz2", ], // fixme: this is for microboone and probably bogus for diff --git a/dune/DUNEWireCell/dune-vd/wcls-nf-sp.fcl b/dune/DUNEWireCell/dune-vd/wcls-nf-sp.fcl index f9eea70d1..bbb826856 100644 --- a/dune/DUNEWireCell/dune-vd/wcls-nf-sp.fcl +++ b/dune/DUNEWireCell/dune-vd/wcls-nf-sp.fcl @@ -6,29 +6,30 @@ process_name: wclsdatanfsp services: { #message: @local::dune_message_services_prod_debug - TimeTracker: {} - RandomNumberGenerator: {} + # TimeTracker: {} + # RandomNumberGenerator: {} # @table::dunefdvd_simulation_services - @table::protodune_services + # @table::protodune_services + # @table::dunefdvd_1x6x6_3view_simulation_services # @table::protodune_rawdecoding_services # @table::protodune_simulation_services # @table::protodune_data_services - TFileService: { - closeFileFast: true # default - fileName: "%ifb_raw_anal.root" - tmpDir: "" # default - } - IFBeam: {} + # TFileService: { + # closeFileFast: true # default + # fileName: "%ifb_raw_anal.root" + # tmpDir: "" # default + # } + # IFBeam: {} } -source: { - module_type: RootInput - saveMemoryObjectThreshold: 10485760 +# source: { +# module_type: RootInput +# saveMemoryObjectThreshold: 10485760 - #inputCommands: ["drop *", "keep raw::RawDigits_*_*_*"] - #inputCommands: ["drop *", "keep *_*_*_Swizzler"] -} +# #inputCommands: ["drop *", "keep raw::RawDigits_*_*_*"] +# #inputCommands: ["drop *", "keep *_*_*_Swizzler"] +# } physics :{ producers: { @@ -36,13 +37,14 @@ physics :{ module_type : WireCellToolkit wcls_main: { tool_type: WCLS + # Pgrapher, TbbFlow apps: ["Pgrapher"] logsinks: ["stdout"] loglevels: ["debug", "pgraph:info"] # Libraries in which to look for WCT components - plugins: ["WireCellGen", "WireCellSigProc", "WireCellRoot", "WireCellPgraph", "WireCellLarsoft"] + plugins: ["WireCellGen", "WireCellSigProc", "WireCellRoot", "WireCellPgraph", "WireCellTbb", "WireCellLarsoft"] # The tool marshals the art::Event to these visitors before. # See notes below in params. @@ -101,6 +103,9 @@ physics :{ } # ext-code, code structs : { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # for nticks calculation in common/params.jsonnet: elec driftSpeed: 1.565 diff --git a/dune/DUNEWireCell/dune-vd/wcls-nf-sp.jsonnet b/dune/DUNEWireCell/dune-vd/wcls-nf-sp.jsonnet index 95f1b7242..9acd171f3 100644 --- a/dune/DUNEWireCell/dune-vd/wcls-nf-sp.jsonnet +++ b/dune/DUNEWireCell/dune-vd/wcls-nf-sp.jsonnet @@ -21,19 +21,22 @@ local epoch = std.extVar('epoch'); // eg "dynamic", "after", "before", "perfect" +local raw_input_label = std.extVar('raw_input_label'); // eg "daq" local reality = std.extVar('reality'); local sigoutform = std.extVar('signal_output_form'); // eg "sparse" or "dense" - local wc = import 'wirecell.jsonnet'; local g = import 'pgraph.jsonnet'; -local raw_input_label = std.extVar('raw_input_label'); // eg "daq" - -local base = import 'pgrapher/experiment/dune-vd/params.jsonnet'; local response_plane = std.extVar('response_plane')*wc.cm; local channel_per_crm = std.extVar('channel_per_crm'); -local params = base(response_plane) { + +local params_maker = import 'pgrapher/experiment/dune-vd/params.jsonnet'; +local fcl_params = { + response_plane: std.extVar('response_plane')*wc.cm, + nticks: std.extVar('nticks') +}; +local params = params_maker(fcl_params) { lar: super.lar { drift_speed: std.extVar('driftSpeed') * wc.mm / wc.us, }, @@ -54,8 +57,6 @@ local wcls = wcls_maker(params, tools); //local nf_maker = import "pgrapher/experiment/pdsp/nf.jsonnet"; //local chndb_maker = import "pgrapher/experiment/pdsp/chndb.jsonnet"; -local sp_maker = import 'pgrapher/experiment/dune-vd/sp.jsonnet'; - //local planemaps = { // dunevd_3view: {"1":0, "2":3, "4":2}, // default: {"1":0, "2":1, "4":2} @@ -146,6 +147,7 @@ local chndb = [{ // local nf_maker = import 'pgrapher/experiment/dune10kt-1x2x6/nf.jsonnet'; // 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)]; +local sp_maker = import 'pgrapher/experiment/dune-vd/sp.jsonnet'; local sp = sp_maker(params, tools, { sparse: sigoutform == 'sparse' }); local sp_pipes = [sp.make_sigproc(a) for a in tools.anodes]; @@ -177,11 +179,16 @@ local spmagnify = [ local spmagnify_pipe = [g.pipeline([spmagnify[n]], name='spmagnifypipes%d' % n) for n in anode_iota]; +local magoutput = 'dune-vd-sp-check.root'; +local magnify = import 'pgrapher/experiment/pdsp/magnify-sinks.jsonnet'; +local sinks = magnify(tools, magoutput); + local nfsp_pipes = [ g.pipeline([ chsel_pipes[n], sp_pipes[n], - spmagnify_pipe[n], + // spmagnify_pipe[n], + // sinks.decon_pipe[n], ], 'nfsp_pipe_%d' % n) for n in anode_iota @@ -217,7 +224,7 @@ local sink = g.pnode({ type: 'DumpFrames' }, nin=1, nout=0); local graph = g.pipeline([wcls_input.adc_digits, fanpipe, retagger, wcls_output.sp_signals, sink]); local app = { - type: 'Pgrapher', + type: 'Pgrapher', //Pgrapher, TbbFlow data: { edges: g.edges(graph), }, diff --git a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.fcl b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.fcl new file mode 100644 index 000000000..5f49e0da8 --- /dev/null +++ b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.fcl @@ -0,0 +1,89 @@ +#include "services_dune.fcl" + +process_name: wclssim +physics :{ + producers: { + plopper : { + module_type : BlipMaker + } + tpcrawdecoder : { + module_type : WireCellToolkit + wcls_main: { + tool_type: WCLS + apps: ["Pgrapher"] + # apps: ["TbbFlow"] + + logsinks: ["stdout:info", "wcls-sim-drift-simchannel.log:debug"] + loglevels: ["debug"] + + plugins: ["WireCellPgraph", "WireCellGen","WireCellSio","WireCellRoot","WireCellLarsoft","WireCellTbb"] + + // needs to be found via your WIRECELL_PATH + configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-nf-sp.jsonnet"] + + + // Contract note: these exact "type:name" must be used to identify + // the configuration data structures for these components in the Jsonnet. + + inputers: ["wclsSimDepoSource:"] + outputers: [ + "wclsSimChannelSink:postdrift", + "wclsFrameSaver:spsignals" + ] + + // Make available parameters via Jsonnet's std.extVar() + params: { + # file: wires + # dunevd10kt-1x6x6-3view-wires-v1.json.bz2 + # dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2 + # dunevd10kt-1x6x6-2view-wires-v1.json.bz2 + files_wires: "dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2" + # file: fields + # dunevd-resp-isoc3views-18d92.json.bz2 30,-30,90 + # pcbro-response-avg-12d50.json.bz2 2view prototype + files_fields: "dunevd-resp-isoc3views-18d92.json.bz2" + # file: noise + # dunevd10kt-1x6x6-3view-noise-spectra-v1.json.bz2 + # dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2 + # dunevd10kt-1x6x6-2view-noise-spectra-v1.json.bz2 + files_noise: "dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2" + } + structs: { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime + # Electron drift speed, assumes a certain applied E-field [mm/us] + driftSpeed: 1.565 + # G4RefTime [us] + G4RefTime: @local::dunefd_detectorclocks.G4RefTime + # response plane [cm] + response_plane: 18.92 + } + + } + } + } + p1 : [ plopper, tpcrawdecoder ] + outputFiles : [ out ] + + trigger_paths : [ p1 ] + end_paths: [ outputFiles ] +} +outputs: { + out: { + module_type: RootOutput + // fileName: "%ifb_wcsim.root" + fileName: "wcsim.root" + + outputCommands : [ + // "drop *", "keep recob::Wires_*_*_*" + "keep *_*_*_*" + ] + + } +} diff --git a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.jsonnet b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.jsonnet new file mode 100644 index 000000000..357032d7d --- /dev/null +++ b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel-nf-sp.jsonnet @@ -0,0 +1,276 @@ +// This is a main entry point for configuring a wire-cell CLI job to +// simulate protoDUNE-SP. It is simplest signal-only simulation with +// one set of nominal field response function. It excludes noise. +// The kinematics are a mixture of Ar39 "blips" and some ideal, +// straight-line MIP tracks. +// +// Output is a Python numpy .npz file. + +local g = import 'pgraph.jsonnet'; +local f = import 'pgrapher/experiment/dune-vd/funcs.jsonnet'; +local wc = import 'wirecell.jsonnet'; + +local io = import 'pgrapher/common/fileio.jsonnet'; +local tools_maker = import 'pgrapher/common/tools.jsonnet'; +local params_maker = import 'pgrapher/experiment/dune-vd/params.jsonnet'; +local response_plane = std.extVar('response_plane')*wc.cm; +local fcl_params = { + G4RefTime: std.extVar('G4RefTime') * wc.us, + response_plane: std.extVar('response_plane')*wc.cm, + nticks: std.extVar('nticks') +}; +local params = params_maker(fcl_params) { + lar: super.lar { + // Longitudinal diffusion constant + DL: std.extVar('DL') * wc.cm2 / wc.ns, + // Transverse diffusion constant + DT: std.extVar('DT') * wc.cm2 / wc.ns, + // Electron lifetime + lifetime: std.extVar('lifetime') * wc.us, + // Electron drift speed, assumes a certain applied E-field + drift_speed: std.extVar('driftSpeed') * wc.mm / wc.us, + }, + files: super.files { + wires: std.extVar('files_wires'), + fields: [ std.extVar('files_fields'), ], + noise: std.extVar('files_noise'), + }, +}; + +local tools = tools_maker(params); + +local sim_maker = import 'pgrapher/experiment/dune-vd/sim.jsonnet'; +local sim = sim_maker(params, tools); + +local nanodes = std.length(tools.anodes); +local anode_iota = std.range(0, nanodes - 1); + + +local output = 'wct-sim-ideal-sig.npz'; + + +//local depos = g.join_sources(g.pnode({type:"DepoMerger", name:"BlipTrackJoiner"}, nin=2, nout=1), +// [sim.ar39(), sim.tracks(tracklist)]); +// local depos = sim.tracks(tracklist, step=1.0 * wc.mm); + +local wcls_maker = import 'pgrapher/ui/wcls/nodes.jsonnet'; +local wcls = wcls_maker(params, tools); +local wcls_input = { + depos: wcls.input.depos(name='', art_tag='IonAndScint'), + // depos: wcls.input.depos(name='electron'), // default art_tag="blopper" +}; + +// Collect all the wc/ls output converters for use below. Note the +// "name" MUST match what is used in theh "outputers" parameter in the +// FHiCL that loads this file. +local mega_anode = { + type: 'MegaAnodePlane', + name: 'meganodes', + data: { + anodes_tn: [wc.tn(anode) for anode in tools.anodes], + }, +}; +local wcls_output = { + // ADC output from simulation + // sim_digits: wcls.output.digits(name="simdigits", tags=["orig"]), + sim_digits: g.pnode({ + type: 'wclsFrameSaver', + name: 'simdigits', + data: { + // anode: wc.tn(tools.anode), + anode: wc.tn(mega_anode), + digitize: true, // true means save as RawDigit, else recob::Wire + frame_tags: ['daq'], + // nticks: params.daq.nticks, + // chanmaskmaps: ['bad'], + pedestal_mean: 'native', + }, + }, nin=1, nout=1, uses=[mega_anode]), + + // The noise filtered "ADC" values. These are truncated for + // art::Event but left as floats for the WCT SP. Note, the tag + // "raw" is somewhat historical as the output is not equivalent to + // "raw data". + nf_digits: wcls.output.digits(name='nfdigits', tags=['raw']), + + // The output of signal processing. Note, there are two signal + // sets each created with its own filter. The "gauss" one is best + // for charge reconstruction, the "wiener" is best for S/N + // separation. Both are used in downstream WC code. + sp_signals: wcls.output.signals(name='spsignals', tags=['gauss', 'wiener']), + + // save "threshold" from normal decon for each channel noise + // used in imaging + sp_thresholds: wcls.output.thresholds(name='spthresholds', tags=['threshold']), +}; + +//local deposio = io.numpy.depos(output); +local drifter = sim.drifter; +local bagger = sim.make_bagger(); +// local bagger = g.pnode({ +// type: 'DepoBagger', +// name: 'bagger', +// data: { +// gate: [-250 * wc.us, 2750 * wc.us], // fixed +// }, +// }, nin=1, nout=1); + +// signal plus noise pipelines +// local sn_pipes = sim.signal_pipelines; +local sn_pipes = sim.splusn_pipelines; + +local perfect = import 'pgrapher/experiment/dune10kt-1x2x6/chndb-perfect.jsonnet'; +local chndb = [{ + type: 'OmniChannelNoiseDB', + name: 'ocndbperfect%d' % n, + data: perfect(params, tools.anodes[n], tools.field, n), + uses: [tools.anodes[n], tools.field], // pnode extension +} for n in anode_iota]; + +//local chndb_maker = import 'pgrapher/experiment/pdsp/chndb.jsonnet'; +//local noise_epoch = "perfect"; +//local noise_epoch = "after"; +//local chndb_pipes = [chndb_maker(params, tools.anodes[n], tools.fields[n]).wct(noise_epoch) +// for n in std.range(0, std.length(tools.anodes)-1)]; +local nf_maker = import 'pgrapher/experiment/dune-vd/nf.jsonnet'; +// local nf_pipes = [nf_maker(params, tools.anodes[n], chndb_pipes[n]) for n in std.range(0, std.length(tools.anodes)-1)]; +local nf_pipes = [nf_maker(params, tools.anodes[n], chndb[n], n, name='nf%d' % n) for n in anode_iota]; + +local sp_maker = import 'pgrapher/experiment/dune-vd/sp.jsonnet'; +local sp = sp_maker(params, tools, { sparse: true }); +local sp_pipes = [sp.make_sigproc(a) for a in tools.anodes]; + +local rng = tools.random; +local wcls_simchannel_sink = g.pnode({ + type: 'wclsSimChannelSink', + name: 'postdrift', + data: { + artlabel: 'simpleSC', // where to save in art::Event + anodes_tn: [wc.tn(anode) for anode in tools.anodes], + rng: wc.tn(rng), + tick: params.daq.tick, + start_time: -0.25 * wc.ms, + readout_time: params.daq.readout_time, + nsigma: 3.0, + drift_speed: params.lar.drift_speed, + u_to_rp: response_plane, // 90.58 * wc.mm, + v_to_rp: response_plane, // 95.29 * wc.mm, + y_to_rp: response_plane, + u_time_offset: 0.0 * wc.us, + v_time_offset: 0.0 * wc.us, + y_time_offset: 0.0 * wc.us, + g4_ref_time: fcl_params.G4RefTime, + use_energy: true, + response_plane: response_plane, + }, +}, nin=1, nout=1, uses=tools.anodes); + +// local magoutput = 'protodune-data-check.root'; +// local magnify = import 'pgrapher/experiment/pdsp/magnify-sinks.jsonnet'; +// local sinks = magnify(tools, magoutput); + +local origmagnify = [ + g.pnode({ + type: 'MagnifySink', + name: 'origmag%d' % n, + data: { + output_filename: 'dune-vd-sim-check.root', + root_file_mode: 'UPDATE', + frames: ['orig%d' % n ], + trace_has_tag: false, + anode: wc.tn(tools.anodes[n]), + }, + }, nin=1, nout=1) for n in std.range(0, std.length(tools.anodes) - 1)]; + + +local origmagnify_pipe = [g.pipeline([origmagnify[n]], name='origmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; + +local nfmagnify = [ + g.pnode({ + type: 'MagnifySink', + name: 'nfmag%d' % n, + data: { + output_filename: 'dune-vd-sim-check.root', + root_file_mode: 'UPDATE', + frames: ['raw%d' % n ], + trace_has_tag: false, + anode: wc.tn(tools.anodes[n]), + }, + }, nin=1, nout=1) for n in std.range(0, std.length(tools.anodes) - 1)]; + + +local nfmagnify_pipe = [g.pipeline([nfmagnify[n]], name='spmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; + +local spmagnify = [ + g.pnode({ + type: 'MagnifySink', + name: 'spmag%d' % n, + data: { + output_filename: 'dune-vd-sim-check.root', + root_file_mode: 'UPDATE', + frames: ['gauss%d' % n ], + trace_has_tag: false, + anode: wc.tn(tools.anodes[n]), + }, + }, nin=1, nout=1) for n in std.range(0, std.length(tools.anodes) - 1)]; + + +local spmagnify_pipe = [g.pipeline([spmagnify[n]], name='spmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; + + +local magoutput = 'dune-vd-sim-check.root'; +local magnify = import 'pgrapher/experiment/pdsp/magnify-sinks.jsonnet'; +local sinks = magnify(tools, magoutput); + +local multipass = [ + g.pipeline([ + // wcls_simchannel_sink[n], + sn_pipes[n], + // origmagnify_pipe[n], + // sinks.orig_pipe[n], + // nf_pipes[n], + // nfmagnify_pipe[n], + sp_pipes[n], + // spmagnify_pipe[n], + sinks.decon_pipe[n], + // sinks.debug_pipe[n], // use_roi_debug_mode=true in sp.jsonnet + ], + 'multipass%d' % n) + for n in anode_iota +]; +local outtags = ['orig%d' % n for n in anode_iota]; +local bi_manifold = f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', 6, 'sn_mag', outtags); + +local retagger = g.pnode({ + type: 'Retagger', + 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: { + '.*': 'orig', + }, + merge: { + 'orig\\d+': 'daq', + }, + }], + }, +}, nin=1, nout=1); + +//local frameio = io.numpy.frames(output); +local sink = sim.frame_sink; + +local graph = g.pipeline([wcls_input.depos, drifter, wcls_simchannel_sink, bagger, bi_manifold, retagger, wcls_output.sp_signals, sink]); + +local app = { + type: 'Pgrapher', //Pgrapher, TbbFlow + data: { + edges: g.edges(graph), + }, +}; + + +// Finally, the configuration sequence which is emitted. + +g.uses(graph) + [app] diff --git a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.fcl b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.fcl index 8c02008d2..4eb5197fc 100644 --- a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.fcl +++ b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.fcl @@ -36,26 +36,36 @@ physics :{ // Make available parameters via Jsonnet's std.extVar() params: { + # file: wires + # dunevd10kt-1x6x6-3view-wires-v1.json.bz2 + # dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2 + # dunevd10kt-1x6x6-2view-wires-v1.json.bz2 + files_wires: "dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2" + # file: fields + # dunevd-resp-isoc3views-18d92.json.bz2 30,-30,90 + # pcbro-response-avg-12d50.json.bz2 2view prototype + files_fields: "dunevd-resp-isoc3views-18d92.json.bz2" + # file: noise + # dunevd10kt-1x6x6-3view-noise-spectra-v1.json.bz2 + # dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2 + # dunevd10kt-1x6x6-2view-noise-spectra-v1.json.bz2 + files_noise: "dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2" } structs: { - # Longitudinal diffusion constant [cm2/s] - DL: 4.0 - # Transverse diffusion constant [cm2/s] - DT: 8.8 - # Electron lifetime [ms] - lifetime: 10.4 + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime # Electron drift speed, assumes a certain applied E-field [mm/us] driftSpeed: 1.565 - # G4RefTime + # G4RefTime [us] G4RefTime: @local::dunefd_detectorclocks.G4RefTime # response plane [cm] - response_plane: 10.0 - # file: wires - files_wires: "\"dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2\"" - # file: fields - files_fields: "\"pcbro-response-avg.json.bz2\"" - # file: noise - files_noise: "\"dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2\"" + response_plane: 18.92 } } diff --git a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.jsonnet b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.jsonnet index 06aba27b3..b2cb79bfd 100644 --- a/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.jsonnet +++ b/dune/DUNEWireCell/dune-vd/wcls-sim-drift-simchannel.jsonnet @@ -12,16 +12,21 @@ local wc = import 'wirecell.jsonnet'; local io = import 'pgrapher/common/fileio.jsonnet'; local tools_maker = import 'pgrapher/common/tools.jsonnet'; -local base = import 'pgrapher/experiment/dune-vd/params.jsonnet'; +local params_maker = import 'pgrapher/experiment/dune-vd/params.jsonnet'; local response_plane = std.extVar('response_plane')*wc.cm; -local params = base(response_plane) { +local fcl_params = { + G4RefTime: std.extVar('G4RefTime') * wc.us, + response_plane: std.extVar('response_plane')*wc.cm, + nticks: std.extVar('nticks') +}; +local params = params_maker(fcl_params) { lar: super.lar { // Longitudinal diffusion constant - DL: std.extVar('DL') * wc.cm2 / wc.s, + DL: std.extVar('DL') * wc.cm2 / wc.ns, // Transverse diffusion constant - DT: std.extVar('DT') * wc.cm2 / wc.s, + DT: std.extVar('DT') * wc.cm2 / wc.ns, // Electron lifetime - lifetime: std.extVar('lifetime') * wc.ms, + lifetime: std.extVar('lifetime') * wc.us, // Electron drift speed, assumes a certain applied E-field drift_speed: std.extVar('driftSpeed') * wc.mm / wc.us, }, @@ -32,8 +37,6 @@ local params = base(response_plane) { }, }; -local G4RefTime = std.extVar('G4RefTime') * wc.us; - local tools = tools_maker(params); local sim_maker = import 'pgrapher/experiment/dune-vd/sim.jsonnet'; @@ -129,12 +132,12 @@ local chndb = [{ //local noise_epoch = "after"; //local chndb_pipes = [chndb_maker(params, tools.anodes[n], tools.fields[n]).wct(noise_epoch) // for n in std.range(0, std.length(tools.anodes)-1)]; -local nf_maker = import 'pgrapher/experiment/dune10kt-1x2x6/nf.jsonnet'; +local nf_maker = import 'pgrapher/experiment/dune-vd/nf.jsonnet'; // local nf_pipes = [nf_maker(params, tools.anodes[n], chndb_pipes[n]) for n in std.range(0, std.length(tools.anodes)-1)]; local nf_pipes = [nf_maker(params, tools.anodes[n], chndb[n], n, name='nf%d' % n) for n in anode_iota]; local sp_maker = import 'pgrapher/experiment/dune-vd/sp.jsonnet'; -local sp = sp_maker(params, tools); +local sp = sp_maker(params, tools, { sparse: true }); local sp_pipes = [sp.make_sigproc(a) for a in tools.anodes]; local rng = tools.random; @@ -156,7 +159,7 @@ local wcls_simchannel_sink = g.pnode({ u_time_offset: 0.0 * wc.us, v_time_offset: 0.0 * wc.us, y_time_offset: 0.0 * wc.us, - g4_ref_time: G4RefTime, + g4_ref_time: fcl_params.G4RefTime, use_energy: true, response_plane: response_plane, }, @@ -182,6 +185,22 @@ local origmagnify = [ local origmagnify_pipe = [g.pipeline([origmagnify[n]], name='origmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; +local nfmagnify = [ + g.pnode({ + type: 'MagnifySink', + name: 'nfmag%d' % n, + data: { + output_filename: 'dune-vd-sim-check.root', + root_file_mode: 'UPDATE', + frames: ['raw%d' % n ], + trace_has_tag: false, + anode: wc.tn(tools.anodes[n]), + }, + }, nin=1, nout=1) for n in std.range(0, std.length(tools.anodes) - 1)]; + + +local nfmagnify_pipe = [g.pipeline([nfmagnify[n]], name='spmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; + local spmagnify = [ g.pnode({ type: 'MagnifySink', @@ -198,14 +217,23 @@ local spmagnify = [ local spmagnify_pipe = [g.pipeline([spmagnify[n]], name='spmagnifypipes%d' % n) for n in std.range(0, std.length(tools.anodes) - 1)]; + +local magoutput = 'dune-vd-sim-check.root'; +local magnify = import 'pgrapher/experiment/pdsp/magnify-sinks.jsonnet'; +local sinks = magnify(tools, magoutput); + local multipass = [ g.pipeline([ // wcls_simchannel_sink[n], sn_pipes[n], // origmagnify_pipe[n], + // sinks.orig_pipe[n], // nf_pipes[n], + // nfmagnify_pipe[n], // sp_pipes[n], // spmagnify_pipe[n], + // sinks.decon_pipe[n], + // sinks.debug_pipe[n], // use_roi_debug_mode=true in sp.jsonnet ], 'multipass%d' % n) for n in anode_iota @@ -236,8 +264,7 @@ local sink = sim.frame_sink; local graph = g.pipeline([wcls_input.depos, drifter, wcls_simchannel_sink, bagger, bi_manifold, retagger, wcls_output.sim_digits, sink]); local app = { - type: 'Pgrapher', - // type: 'TbbFlow', + type: 'Pgrapher', //Pgrapher, TbbFlow data: { edges: g.edges(graph), }, diff --git a/dune/DUNEWireCell/wirecell_dune.fcl b/dune/DUNEWireCell/wirecell_dune.fcl index 9ef154e04..86dcab702 100644 --- a/dune/DUNEWireCell/wirecell_dune.fcl +++ b/dune/DUNEWireCell/wirecell_dune.fcl @@ -289,26 +289,44 @@ tpcrawdecoder_dunefd_vertdrift_2view : { plugins: ["WireCellPgraph", "WireCellGen","WireCellSio","WireCellRoot","WireCellLarsoft","WireCellTbb"] - // needs to be found via your WIRECELL_PATH - # configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-3view.json"] - #configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-3view30deg.json"] - configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-2view.json"] - - - // Contract note: these exact "type:name" must be used to identify - // the configuration data structures for these components in the Jsonnet. - - inputers: ["wclsSimDepoSource:"] - outputers: [ - "wclsSimChannelSink:postdrift", - "wclsFrameSaver:simdigits" - ] - - // Make available parameters via Jsonnet's std.extVar() - params: { - } - structs: { - } + // needs to be found via your WIRECELL_PATH + configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel.jsonnet"] + + + // Contract note: these exact "type:name" must be used to identify + // the configuration data structures for these components in the Jsonnet. + + inputers: ["wclsSimDepoSource:"] + outputers: [ + "wclsSimChannelSink:postdrift", + "wclsFrameSaver:simdigits" + ] + + // Make available parameters via Jsonnet's std.extVar() + params: { + # file: wires + files_wires: "dunevd10kt-1x6x6-2view-wires-v1.json.bz2" + # file: fields + files_fields: "pcbro-response-avg-12d50.json.bz2" + # file: noise + files_noise: "dunevd10kt-1x6x6-2view-noise-spectra-v1.json.bz2" + } + structs: { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime + # Electron drift speed, assumes a certain applied E-field [mm/us] + driftSpeed: 1.60563 + # G4RefTime [us] + G4RefTime: @local::dunefd_detectorclocks.G4RefTime + # response plane [cm] + response_plane: 12.50 + } } } @@ -318,7 +336,30 @@ tpcrawdecoder_dunefd_vertdrift_3view: { @table::tpcrawdecoder_dunefd_vertdrift_2view wcls_main: { @table::tpcrawdecoder_dunefd_vertdrift_2view.wcls_main - configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-3view.json"] + params: { + # file: wires + files_wires: "dunevd10kt-1x6x6-3view-wires-v1.json.bz2" + # file: fields + files_fields: "dunevd-resp-isoc3views-18d92.json.bz2" + # file: noise + files_noise: "dunevd10kt-1x6x6-3view-noise-spectra-v1.json.bz2" + } + structs: { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime + # Electron drift speed, assumes a certain applied E-field [mm/us] + driftSpeed: 1.60563 + # G4RefTime [us] + G4RefTime: @local::dunefd_detectorclocks.G4RefTime + # response plane [cm] + response_plane: 18.92 + } } } @@ -326,7 +367,30 @@ tpcrawdecoder_dunefd_vertdrift_3view_30deg: { @table::tpcrawdecoder_dunefd_vertdrift_2view wcls_main: { @table::tpcrawdecoder_dunefd_vertdrift_2view.wcls_main - configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-3view30deg.json"] + params: { + # file: wires + files_wires: "dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2" + # file: fields + files_fields: "dunevd-resp-isoc3views-18d92.json.bz2" + # file: noise + files_noise: "dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2" + } + structs: { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime + # Electron drift speed, assumes a certain applied E-field [mm/us] + driftSpeed: 1.60563 + # G4RefTime [us] + G4RefTime: @local::dunefd_detectorclocks.G4RefTime + # response plane [cm] + response_plane: 18.92 + } } } @@ -410,6 +474,9 @@ dune10kt_dunefd_vertdrift_1x6x6_3view_data_nfsp : { } # ext-code, code structs : { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # for nticks calculation in common/params.jsonnet: elec driftSpeed: 1.60563 @@ -494,6 +561,9 @@ dune10kt_dunefd_vertdrift_1x6x6_3view_30deg_data_nfsp : { } # ext-code, code structs : { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # for nticks calculation in common/params.jsonnet: elec driftSpeed: 1.60563 @@ -509,4 +579,61 @@ dune10kt_dunefd_vertdrift_1x6x6_3view_30deg_data_nfsp : { } } + +dune10kt_dunefd_vertdrift_1x6x6_3view_30deg_sim_nfsp : { + module_type : WireCellToolkit + wcls_main: { + tool_type: WCLS + apps: ["Pgrapher"] + # apps: ["TbbFlow"] + + logsinks: ["stdout:info", "wcls-sim-drift-simchannel.log:debug"] + loglevels: ["debug"] + + plugins: ["WireCellPgraph", "WireCellGen","WireCellSio","WireCellRoot","WireCellLarsoft","WireCellTbb"] + + // needs to be found via your WIRECELL_PATH + configs: ["pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-nf-sp.jsonnet"] + + + // Contract note: these exact "type:name" must be used to identify + // the configuration data structures for these components in the Jsonnet. + + inputers: ["wclsSimDepoSource:"] + outputers: [ + "wclsSimChannelSink:postdrift", + "wclsFrameSaver:spsignals" + ] + + // Make available parameters via Jsonnet's std.extVar() + params: { + # file: wires + files_wires: "dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2" + # file: fields + files_fields: "dunevd-resp-isoc3views-18d92.json.bz2" + # file: noise + files_noise: "dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2" + # set mapping between internal wct plane ids and larsoft + # default is to assume WireCell::kU->geo::kU, kV->kV, kW->kW + # geo_planeid_labels: "default" + } + structs: { + # number of time samples + nticks: @local::dunefdvd_detproperties.NumberTimeSamples + # Longitudinal diffusion constant [cm2/ns] 4.0e-9 + DL: @local::dunefd_largeantparameters.LongitudinalDiffusion + # Transverse diffusion constant [cm2/ns] 8.8e-9 + DT: @local::dunefd_largeantparameters.TransverseDiffusion + # Electron lifetime [us] #10.4e3 + lifetime: 10.4e3 #@local::dunefdvd_detproperties.Electronlifetime + # Electron drift speed, assumes a certain applied E-field [mm/us] + driftSpeed: 1.60563 + # G4RefTime [us] + G4RefTime: @local::dunefd_detectorclocks.G4RefTime + # response plane [cm] + response_plane: 18.92 + } + } +} + END_PROLOG