Skip to content

Commit

Permalink
Merge pull request #201 from HaiwangYu/2face
Browse files Browse the repository at this point in the history
Bridged geom and FD-VD 10kt
  • Loading branch information
HaiwangYu authored Jun 27, 2023
2 parents d20f374 + 8e83cba commit 1768755
Show file tree
Hide file tree
Showing 6 changed files with 480 additions and 116 deletions.
117 changes: 117 additions & 0 deletions cfg/pgrapher/experiment/dune-vd/params-10kt.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// DUNE-VD specific parameters. This file inerets from the
// generic set of parameters and overrides things specific to PDSP.

local wc = import "wirecell.jsonnet";
local base = import "pgrapher/common/params.jsonnet";

function(params) base {
// This section will be overwritten in simparams.jsonnet
det : {

// The current DUNE-VD goemetry has only one CRP composed by 36
// independent CRM with side
// CRP is on y-z while drift is on x
// Only one CRP is defined in this geometry
// CRMs are oneside anodes

local ncrm = if std.objectHas(params, 'ncrm') then params.ncrm else 36,

response_plane: params.response_plane,

local bot_crp_x = -3.97*wc.cm,
local bot_resp_x = bot_crp_x+self.response_plane,
local bot_cathode_x = bot_crp_x+650.06*wc.cm,
local bot_face = {
anode: bot_crp_x,
response: bot_resp_x,
cathode: bot_cathode_x},

local top_crp_x = 1300.13*wc.cm,
local top_resp_x = top_crp_x-self.response_plane,
local top_cathode_x = top_crp_x - 650.06*wc.cm,
local top_face = {
anode: top_crp_x,
response: top_resp_x,
cathode: top_cathode_x},

volumes: [
{
wires: n, // anode number
name: "crm%d"%n,
faces: if n < ncrm/2 then [ bot_face, bot_face ]
else [ top_face, top_face ],
} for n in std.range(0, ncrm-1)], // std.range is inclusive, i.e. [0, crm-1],
},

daq: super.daq {

tick: 0.5*wc.us, // check this in the TDR, LArSoft
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,
},

adc: super.adc {

// 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
elec: super.elec {

type: "ColdElecResponse",

// 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.
fixed: true,

},

overall_short_padding: 0.2*wc.ms,
sys_status: false,
sys_resp: {
start: 0.0 * wc.us,
magnitude: 1.0,
time_smear: 1.0 * wc.us,
},

files: {

// Standard wire geometry with 2 wire planes and third dummy induction
wires: "dunevd10kt-1x6x6-3view30deg-wires-v1.json.bz2",

// Based on the simulations made for the 50L prototype
fields: [
"dunevd-resp-isoc3views-18d92.json.bz2",
],

// fixme: this is for microboone and probably bogus for
// protodune because (at least) the span of MB wire lengths do
// not cover pdsp's.
noise: "dunevd10kt-1x6x6-3view30deg-noise-spectra-v1.json.bz2",

chresp: null,

},

}
12 changes: 6 additions & 6 deletions cfg/pgrapher/experiment/dune-vd/params.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ function(params) base {
local upper_resp_x = upper_crp_x-self.response_plane,
local cathode_x = -325.00*wc.cm,
local ncrm = if std.objectHas(params, 'ncrm') then params.ncrm else 36,

local upper_face = {
anode: upper_crp_x,
response: upper_resp_x,
cathode: cathode_x},

volumes: [
{
wires: n, // anode number
name: "crm%d"%n,
faces: [
{
anode: upper_crp_x,
response: upper_resp_x,
cathode: cathode_x
}, null ],
faces: [ upper_face, upper_face ],
} for n in std.range(0, ncrm-1)], // std.range is inclusive, i.e. [0, crm-1],
},

Expand Down
29 changes: 13 additions & 16 deletions cfg/pgrapher/experiment/dune-vd/wcls-sim-drift-simchannel-nf-sp.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ physics :{
module_type : WireCellToolkit
wcls_main: {
tool_type: WCLS
apps: ["Pgrapher"]
# apps: ["TbbFlow"]
apps: ["TbbFlow"] # Pgrapher, TbbFlow

logsinks: ["stdout:info", "wcls-sim-drift-simchannel-nf-sp.log:debug"]
# logsinks: ["stdout:info", "wcls-sim-drift-simchannel-nf-sp.log:debug"]
logsinks: ["stdout:debug"]
loglevels: ["debug"]

plugins: ["WireCellPgraph", "WireCellGen","WireCellSio","WireCellRoot","WireCellLarsoft"
# ,"WireCellTbb"
,"WireCellTbb"
# , "WireCellPytorch"
]

Expand All @@ -37,12 +37,9 @@ 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
# dunevd10kt-1x8x14-3view-wires-v1.json.bz2
# dunevd10kt_3view_v2_refactored_1x8x6ref.json.bz2
files_wires: "dunevd10kt-1x8x14-3view-wires-v1.json.bz2"
# dunevd10kt_3view_30deg_v6_refactored.json.bz2
# dunevd10kt_3view_30deg_v5_refactored_1x8x6ref.json.bz2
files_wires: "dunevd10kt_3view_30deg_v5_refactored_1x8x6ref.json.bz2"
# file: fields
# dunevd-resp-isoc3views-18d92.json.bz2 30,-30,90
# pcbro-response-avg-12d50.json.bz2 2view prototype
Expand All @@ -55,9 +52,9 @@ physics :{
# set mapping between internal wct plane ids and larsoft
# default is to assume WireCell::kU->geo::kU, kV->kV, kW->kW
# 3view-30deg: default, 3view: dunevd_3view
geo_planeid_labels: "dunevd_3view"
# process pratial or all CRMs: all or partial
process_crm: "partial"
geo_planeid_labels: "default"
# process pratial or all CRMs: all or test2
process_crm: "all"
}
structs: {
# number of time samples
Expand All @@ -74,8 +71,8 @@ physics :{
G4RefTime: @local::dunefd_detectorclocks.G4RefTime
# response plane [cm]
response_plane: 18.92
# number of CRMs, 36 for 1x6x6, 112 for 1x8x14
ncrm: 112
# number of CRMs, 24 for 1x8x6, 320 for 2x8x40
ncrm: 24
# use dnn_roi or not
use_dnnroi: false
}
Expand All @@ -96,7 +93,7 @@ outputs: {
fileName: "wcsim.root"

outputCommands : [
// "drop *", "keep recob::Wires_*_*_*"
# "keep *_*_*_*", "drop *", "keep recob::Wires_*_*_*"
"keep *_*_*_*"
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local dnnroi = import 'dnnroi.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,
Expand All @@ -24,6 +23,9 @@ local fcl_params = {
use_dnnroi: std.extVar('use_dnnroi'),
process_crm: std.extVar('process_crm'),
};
local params_maker =
if fcl_params.ncrm == 320 then import 'pgrapher/experiment/dune-vd/params-10kt.jsonnet'
else import 'pgrapher/experiment/dune-vd/params.jsonnet';
local params = params_maker(fcl_params) {
lar: super.lar {
// Longitudinal diffusion constant
Expand All @@ -47,9 +49,9 @@ local tools =
if fcl_params.process_crm == "partial"
then tools_all {anodes: [tools_all.anodes[n] for n in std.range(32, 79)]}
else if fcl_params.process_crm == "test1"
then tools_all {anodes: [tools_all.anodes[n] for n in [36]]}
then tools_all {anodes: [tools_all.anodes[n] for n in [5]]}
else if fcl_params.process_crm == "test2"
then tools_all {anodes: [tools_all.anodes[n] for n in [36, 44]]}
then tools_all {anodes: [tools_all.anodes[n] for n in [4,5,8,9]]}
else tools_all;

local sim_maker = import 'pgrapher/experiment/dune-vd/sim.jsonnet';
Expand All @@ -69,8 +71,17 @@ local output = 'wct-sim-ideal-sig.npz';
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"
depos: wcls.input.depos(name='', art_tag='IonAndScint'),
deposet: g.pnode({
type: 'wclsSimDepoSetSource',
name: "",
data: {
model: "",
scale: -1, //scale is -1 to correct a sign error in the SimDepoSource converter.
art_tag: "IonAndScint", //name of upstream art producer of depos "label:instance:processName"
assn_art_tag: "",
},
}, nin=0, nout=1),
};

// Collect all the wc/ls output converters for use below. Note the
Expand Down Expand Up @@ -131,14 +142,14 @@ local wcls_output = {

//local deposio = io.numpy.depos(output);
local drifter = sim.drifter;
local setdrifter = g.pnode({
type: 'DepoSetDrifter',
data: {
drifter: "Drifter"
}
}, nin=1, nout=1,
uses=[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;
Expand Down Expand Up @@ -243,16 +254,20 @@ local tag_rules = {
+ {['dnnsp%d' % anode.data.ident]: ['dnnsp%d' % anode.data.ident] for anode in tools.anodes},
};
local bi_manifold =
if fcl_params.ncrm == 36
if fcl_params.process_crm == "test1"
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,1], [1,1], [1,1], [1,1], 'sn_mag', outtags, tag_rules)
else if fcl_params.process_crm == "test2"
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,4], [4,1], [1,4], [4,1], 'sn_mag', outtags, tag_rules)
else if fcl_params.ncrm == 36
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,6], [6,6], [1,6], [6,6], 'sn_mag', outtags, tag_rules)
else if fcl_params.ncrm == 24
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,4], [4,6], [1,4], [4,6], 'sn_mag', outtags, tag_rules)
else if fcl_params.ncrm == 48 || fcl_params.process_crm == "partial"
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,8], [8,6], [1,8], [8,6], 'sn_mag', outtags, tag_rules)
else if fcl_params.process_crm == "test1"
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,1], [1,1], [1,1], [1,1], 'sn_mag', outtags, tag_rules)
else if fcl_params.process_crm == "test2"
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,2], [2,1], [1,2], [2,1], 'sn_mag', outtags, tag_rules)
else if fcl_params.ncrm == 112
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,8,16], [8,2,7], [1,8,16], [8,2,7], 'sn_mag', outtags, tag_rules);
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,8,16], [8,2,7], [1,8,16], [8,2,7], 'sn_mag', outtags, tag_rules)
else if fcl_params.ncrm == 320
then f.multifanpipe('DepoSetFanout', multipass, 'FrameFanin', [1,2,8,32], [2,4,4,10], [1,2,8,32], [2,4,4,10], 'sn_mag', outtags, tag_rules);

local retagger = g.pnode({
type: 'Retagger',
Expand All @@ -277,10 +292,10 @@ local retagger = g.pnode({
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 graph = g.pipeline([wcls_input.depos, drifter, wcls_simchannel_sink, bagger, multipass[36], retagger, wcls_output.sp_signals, sink]);
// local graph = g.pipeline([wcls_input.deposet, setdrifter, wcls_simchannel_sink, bi_manifold, retagger, wcls_output.sp_signals, sink]);

local app = {
type: 'Pgrapher', //Pgrapher, TbbFlow
type: 'TbbFlow', //Pgrapher, TbbFlow
data: {
edges: g.edges(graph),
},
Expand Down
Loading

0 comments on commit 1768755

Please sign in to comment.