This document goes through some basic programs to exercise parts of PCBro.
The basic unpacking is done by code in BinFile.h. It can be tested like:
$ ./build/test_BinFile <test> <file.bin>
With <test>
being one of: read, package, link, trigger and file.
The WCT component that can inject .bin
files into a WCT graph is
PcbroRawSource
and can be tested directly like:
$ ./build/test_RawSource <file.bin>
Install WCT with PDSP’s data files (at least) doing something like:
$ cd /path/to/wire-cell-toolkit $ ./wcb configure --prefix=$PREFIX --with-jsonnet=$HOME/opt/jsonnet $ ./wcb --notests install --install-config=all
Make sure WIRECELL_PATH
includes WCT’s installed config and data
directory and pcbro’s cfg/
, eg:
$ export WIRECELL_PATH=$PREFIX/share/wirecell:$HOME/dev/pcbro/cfg
PCB anode of course has strips but for sigproc we don’t care about actual geometry and just need to gives conductor ordering. PCBro has a WCT-like Python package which generates a “wire” file.
$ wirecell-pcbro gen-wires pcbro-wires.txt $ wirecell-util convert-oneside-wires pcbro-wires.txt pcbro-wires.json.bz2
The resulting .json.bz2
file should go in a directory listed in your
WIRECELL_PATH
. A copy is committed in this repo at cfg/pcbro-wires.json.bz2.
A PCB anode .bin
file can be read by WCT, decoded and written to a Numpy .npz
array file. You can then plot the result with matplotlib
. For example:
$ wire-cell -l stdout -L debug -l junk.log:debug \ -A infile=<file.bin> -A outfile=<file.npz> \ -c cfg/cli-bin-npz.jsonnet $ ipython --pylab In [1]: f = numpy.load("<file.npz>") In [2]: plt.imshow(f['frame_bin2npz_31']) In [3]: plt.savefig("raw-31.png")
or from the CLI
$ wirecell-pcbro plot-one -t 31 -a 0.2 -T bin2npz -o raw-31.png raw.npz
N.B.: by default the induction plane data is duplicated in order to match WCT’s expectation of 3 planes and to allow simultaneous testing of different induction response functions.
PCB anode fields are calculated by GARFIELD by Yichen and the 2D geometry used is shown in this figure also from Yichen:
The two planes are conceptually semi-infinite but only the indicated ranges are considered. In order to use GARFIELD’s analytic 2D calculation these planes are composed of 400 coplanar 1D “micro-wires” of diameter 150um. GARFIELD has a limit on the number of “sensitive” conductors and so four calculations are required to span the choice of R (right, positive) and L and the choice of a (nearest hole) and b regions. These four are needed for each choice of drift path which is characterized by its (positive, on R side) radius. The results are in the form of files with these values encoded in their names:
<radius>_[ind|col]_[L|R]_[a|b].dat
PCBro provides scripts to map these data to the real geometry. This
mapping is illustrated in the following diagram. CAVEAT the impact
positions must be taken on the negative side of the strip centerline
rather than as drawn as WCT sim (impact transform) bakes in this
convention. The wirecell-pcbro convert-garfield
command uses the
correct convention.
For each strip, numbered -5, …, 0, …, 5, one of its six strip-impact positions (SIP) is considered. Along the strip two “slices” are considered which are defined as lines bisecting a full hole on the strip. For each of these objects the real geometry is examined to identify which hole is nearest to the SIP along the slice (ie, the hole into which the electron path should fall) and the radial location of the path starting point.
The matching GARFIELD data set is then located and mapped to the real geometry so that the subset of micro-wires that overlap with (non-hole) electrode region of strip0 may be selected. Their responses are summed to provide the response on strip0 to a path at that strip’s SIP and for that slice.
The final response set can be calculated as an average over the two slices. Final responses keeping the slices separate may also be produced.
A number of GARFIELD runs were performed as the process was debugged
and only a certain subset of files should be considered. The “good”
files from them may be collected with this tar
command:
$ tar -cvf garfield-pcb.tar \ pcb_try/{0.0,0.5,1.0,1.5,2.0,2.5}_ind_R_{a,b}.dat \ pcb_try/{0.5,1.0,1.5}_col_R_{a,b}.dat \ pcb_try_add/{0.0,0.2,0.3,0.7,0.8,1.2,1.3,1.7}_col_R_{a,b}.dat \ pcb_try_Lcorr/{0.0,0.2,0.3,0.5,0.7,0.8,1.0,1.2,1.3,1.5,1.7,2.0,2.5}_{col,ind}_L_{a,b}.dat $ tar -tvf garfield-pcb.tar |wc -l 86
Summary of the directories:
pcb_try
- initial set containing radii needed for induction strips.
Good for
ind_R
and somecol_R
. pcb_try_add
- extended set containing radii needed for collection
strips but with a geometry bug found which effects only L data sets.
Good for
col_R
. pcb_try_Lcorr
- rerun of above fixing a bug in geometry that only
affects L collection. Good for
col_L
andind_L
A WCT .json.bz2
response file may be produced with:
$ wirecell-pcbro convert-garfield garfield-pcb.tar
This should run with no errors about “No response for plane …”. It produces a number of JSON files
pcbro-response-avg.json.bz2
pcbro-response-slc0.json.bz2
pcbro-response-slc1.json.bz2
The trailing file name indicates which slices are left distinct or averaged.
- avg
- U and V are identical and both average over two inductions slices.
- slc0
- U is average over both slices V is induction slice 0, W is collection slice 0.
- slc1
- U is average over both slices V is induction slice 1, W is collection slice 1.
$ ./scripts/gen-response.sh $ ls pcbro-response-* $ feh –keep-zoom-vp –force-aliasing pcbro-response-slc[01]-zoom.png
See next section for downloading the results of this script. The PNGs produced are committed:
The raw .bin
data can be read in, decoded, run through WCT signal processing and the result written to an Numpy .npz
array file
Caveat: while the fields are being validated these results do not represent the ultimate efficacy. See Roadmap for relevant details. Until these are finalized, there will not be any officially, versioned field files but the latest can be retrieved:
$ wget https://www.phy.bnl.gov/~bviren/tmp/pcbro/pcbro-response-latest.tar $ tar -C pcbro/cfg -xf pcbro-response-latest.tar
It includes several different response files and their corresponding display as PNG files. A particular response file may be given as an option to the wire-cell
CLI:
$ wire-cell -l stdout -L debug -l junk.log:debug \ -A infile=<file.bin> -A outfile=<file.npz> \ -A resp=pcbro-response-avg.json.bz2 \ -c cfg/cli-bin-sp-npz.jsonnet $ ipython --pylab In [1]: f = numpy.load("<file.npz>") In [2]: plt.imshow(f['frame_gauss0_31']) In [3]: plt.savefig("trig31-gauss.png")
or from the CLI:
$ wirecell-pcbro plot-one -t 31 -a 0.2 -T gauss0 -o sig-31.png sig.npz
N.B. again, this does not represent ultimate capabilities as the fields are still being understood. The two copies of the induction plane are deconvolved with a different field slice.
The PcbroRawSource
may be configured with one or a sequence of input .bin
files and likewise so does the top-level “cli” Jsonnet. With a little help from the shell you can pass multiple files via:
$ rm -f sig.npz $ time wire-cell \ --tla-str outfile="sig.npz" \ --tla-code infile="[ $(printf '"%s",' /home/bv/work/pcbro/Rawdata_05_26_2020/run01tri/WIB00step18_FEMB_B8_1590484*.bin ) ]" \ -c cfg/cli-bin-sp-npz.jsonnet ... [15:14:29.460] D [ pcbro ] RawSource: end of 29 files [15:14:29.460] I [ timer ] Timer: WireCell::SigProc::OmnibusSigProc : 45.555553 sec [15:14:29.460] I [ timer ] Timer: WireCell::Sio::NumpyFrameSaver : 4.5346904 sec [15:14:29.460] I [ timer ] Timer: pcbro::RawSource : 2.6408951 sec [15:14:29.460] I [ timer ] Timer: WireCell::Aux::TaggedTensorSetFrame : 0.27116203 sec [15:14:29.460] I [ timer ] Timer: WireCell::Gen::DumpFrames : 0.061627306 sec [15:14:29.460] I [ timer ] Timer: Total node execution : 53.06392828375101 sec real 0m55.183s user 0m52.199s sys 0m1.873s $ ls /home/bv/work/pcbro/Rawdata_05_26_2020/run01tri/WIB00step18_FEMB_B8_1590484*.bin|wc -l 29
Process many .bin
into a .npz
file and then make a reduced .npz
file by applying a threshold on activity. The activity is calculated by subtracting a per-channel median and then summing all values above a minimum (def=5) and if the sum is larger than the threshold (default=5000) then save the array to the output .npz
. You can then make a multi-page PDF.
$ rm -f raw-muons.npz; wirecell-pcbro activity raw.npz raw-muons.npz $ rm -f raw-muons.pdf; wirecell-pcbro plot-many -a 0.2 -o raw-muons.pdf raw-muons.npz
A standard WCT validation and debugging tool it Magnify. One can produce a Magnify file from a select trigger which will hold the original raw and signal processed output.
$ wire-cell -A resp=pcbro-response-avg.json.bz2 \ -A start=32 -A triggers=1 \ -A infile=<file.bin> -A outfile=<file.root> \ -c cfg/cli-bin-sp-mag.jsonnet
In development. Something like:
$ wire-cell -A outfile=out.npz -c cfg/cli-sim-npz.jsonnet $ wire-cell -A resp=pcbro-response-slc0.json.bz2 -A outfile=out-slc0.npz -c cfg/cli-sim-npz.jsonnet $ wire-cell -A resp=pcbro-response-slc1.json.bz2 -A outfile=out-slc1.npz -c cfg/cli-sim-npz.jsonnet $ wirecell-pcbro plot-one --baseline-subtract=median -t 0 -a 0.2 -T orig0 -o sim.png out.npz $ wirecell-pcbro plot-one --baseline-subtract=median -t 0 -a 0.2 -T orig0 -o sim-slc0.png out-slc0.npz $ wirecell-pcbro plot-one --baseline-subtract=median -t 0 -a 0.2 -T orig0 -o sim-slc1.png out-slc1.npz
Add -l stdout -L debug
to make wire-cell
a bit more talkative.