a class to hold info about the stream format (QIEStream),
a dummy, 50 bar channel map to test assigning a bar to a readout (electronics) ID
an encoder which writes the event stream (including header) as a vector<int> to LDMX_Events
a decoder capable of reading this event stream and converting it to TS digis (adc and tdc, cid info isn't included in the data format though)
All of this is written with the test beam in mind, but tested with standard ldmx-sw (v12 geometry) simulation.
Notably:
no zero suppression is foreseen --> no IDs are sent with the packet --> electronics ID is assumed from position of the word. An elecID column just showing the row number is included for good measure/easy debugging. This makes for a rather naive mapping implementation (I went for simplest possible).
no module number or similar is included (one module for test beam)
we have only leading-edge (2-bit) TDC information, while the range of values corresponds to 6 bits (0-63). . In encoding, I truncate the 4 least significant bits. In decoding back, I account for this by a 4-bit shift; in practice, we lose a lot of info (in particular, all error codes and the last few time samples all have LETDC=3, or after decoding, TDC=48)
To run it, try this python config using an input file (arg 1, and set some outputname.root as arg2) with QIEDigis in them:
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process('pack')
import sys
nEv=20
# ------------------- all set; setup in detail, and run with these settings ---------------
from LDMX.TrigScint.qieFormat import QIEEncoder
# specify map file here, for now. set as necessary argument
enc=QIEEncoder.tagger("../TrigScint/util/channelMapFrontBack.txt")
enc.input_collection="trigScintQIEDigisTag"
enc.input_pass_name="sim"
enc.verbose=True #to see what's going on
p.sequence = [
# assume these first two steps are done elsewhere:
# mySim,
# tsDigisUp, tsDigisTag, tsDigisDown,
enc
]
p.inputFiles=[sys.argv[1]]
p.outputFiles = [sys.argv[2]]
p.maxEvents = nEv
p.termLogLevel = 0. #to see what's going on
If you run in verbose mode you'll see stuff like
Then similarly run the decoder. The decoder uses identical options but the input/output is naturally different:
from LDMX.TrigScint.qieFormat import QIEDecoder
dec=QIEDecoder.tagger("../TrigScint/util/channelMapFrontBack.txt")
dec.input_collection="QIEstreamTag"
dec.input_pass_name="pack"
Comparing ADCs, channel IDs, and TDCs from running both encoding and then decoding back again, this looks right (red and black overlap except for the expected effect of truncation of the TDC values):
This includes
QIEStream
),vector<int>
toLDMX_Events
All of this is written with the test beam in mind, but tested with standard
ldmx-sw
(v12
geometry) simulation.Notably:
To run it, try this python config using an input file (arg 1, and set some
outputname.root
as arg2) withQIEDigis
in them:If you run in verbose mode you'll see stuff like
Then similarly run the decoder. The decoder uses identical options but the input/output is naturally different:
Comparing ADCs, channel IDs, and TDCs from running both encoding and then decoding back again, this looks right (red and black overlap except for the expected effect of truncation of the TDC values):
This closes issue #31