Closed brettviren closed 6 years ago
LArG4 makes depositions with times near 0.0. Besides an offset we need an IDrifter
which applies some time offset.
Meeting with MB provides guidance that the absolute time of simulation waveforms are not meaningful and need not be simulated. This reduces the difficulty for this bug. Only a fixed relative time offset is needed. Because of this simplicity I'll just add it as configurable optional part of the nominal Drifter
and not make a new IDrifter
.
Fixed.
Plots for "after" and "before" adding 1.6ms offset for MB.
Reproduce and plot with:
$ rm -f wct-sim-ideal-sig.npz
$ wire-cell -c cfg/pgrapher/experiment/uboone/wct-sim-ideal-sig.jsonnet
$ wirecell-gen plot-sim wct-sim-ideal-sig.npz -n 0 -c 6,17 foo.pdf
Time offset needs to be absolute, not based on initial depo because beam+cosmics puts the first cosmic at negative time.
Edit: see next comment.
Turns out previous requirements were bogus. LArSoft depo generators are responsible for setting their absolute time given any assumptions about triggering. It's still true that their times are all near 0.0.
A new requirement is that the resulting frame must start at an fixed time (for all events). ~For MB this is -4050 us measured in the same clock as the depo times are~ (edit: this number is for "electronics" time which I think WCT does not need to care about, see next comment). This is described in MB DocDB 12290.
The above comment reflected my misunderstanding. Confirmed by Herb, here is what MB LS expectations
it is up to generators to produce depositions at G4 time. There is no time offset at this level. WCT doesn't care but it means BNB neutrino interactions must occur in a G4 time window of witdh 1600 ns starting at G4 time 3125 ns.
the output frame is expected to be truncated/padded such that the earliest tick samples the G4 time of (-1600 us + "trigger time"). The "trigger time" for BNB is -31.25ns and for NUMI is -54.87ns.
So, new game plan:
Ductor
and MultiDuctor
in addition to "continuous" and "discontinuous" which is like the latter but uses a start time of 0.0 + a fixed time offset for the first frame, produces frames with a fixed duration and resets back to this start time at EOSFrameSlicer
which takes in a stream of frames and outputs a stream of frames that are of a fixed time duration, where the slicer does any needed padding or truncation.This is basically done now except doc/val. The new component is named Reframer
.
Note, #25 is related.
An additional timing related fix was found and made as part of this. The ductor's gate must be enlarged by a time estimated by the nominal travel time between response plane and collection plane so that early activity can influence at least the first tick. For MB this is an extra 171 ticks. These ticks are then truncated by the new Reframer
component.
The sim runs in two modes as described here:
https://wirecell.github.io/news/posts/simulation-updates/
Continuous mode is effectively free running and frames are just to break up that infinite stream of data.
In discontinuous mode the time of the energy depositions determines the frame time. This currently causes waveforms to typically begin near the start of the frame. For a triggered detector the time range of a frame would be defined w.r.t. some trigger, typically causing the frame to be centered on the associated activity in the waveforms.
Some new mechanism is needed to align frames in some way to emulate trigger conditions. For beam triggers this can be done by having a simple configurable time offset applied to the earliest energy deposition.
For self triggering such as in DUNE, discontinuous mode is really not correct and continuous mode is required.
The two modes are currently implemented in
Ductor
andMultiDuctor
so both must gain this configurable time offset.WriteIDrifter
that shifts depo times to some absolute time. It needs to operate in "discontinuous" mode so it is aware of each "event"