-
Notifications
You must be signed in to change notification settings - Fork 26
2 Read Data from TDC
If there is an event ready for read-out, a read request to the EVENT-FIFO (0xbase8888) will return a 32bit word which contains the event number (highest 16 bits) and the event size (lowest 13 bits). Otherwise, it will return 0.
To obtain the actual event data, read as many 32bit words from the DATA-FIFO (0xbase4444) as indicated by the event size. Each of these 32bit words contains two 16bit words of TDC data. The possible types of 16bit words are as follows:
An event always starts with a HEADER1 word followed by a HEADER2 word and ends with a TRAILER word. If the TRAILER word is not 32bit aligned, a FILLER word is inserted before the TRAILER.
The header words are followed by the hits of the event. The HIT word contains the channel number and the high resolution sampling information - the offset between the 200MHz sampling clock and the signal - but not the number of clock cycles since trigger. This information is send with the CLOCK word after the HIT word. If hits of different channels are within the same clock cycle, the clock information is send only once after the last hit of this group.
For each hit the jTDC provides a 13bit clock counter (coarse sampling at 200MHz) and a 8bit high resolution sampling information. These two information can be combined to get the full 21bit tdc time information:
As described in the previous chapter, the coarse sampling was actually done at 400MHz, so bit #7 of the high resolution sampling information is simply the clock state of the 400MHz sampling clock and the true high resolution sampling information is only 7bit wide:
Filling these reduced 7bit high resolution bin numbers of a larger set of tdc events into a histogram, produces a differential nonliniarity plot:
If we assume that the input data is white noise and that we have enough statistics, the above bin distribution can be used to calculate the individual width of each bin by normalizing the integral of the histogram to 2.5ns:
From this data one can obtain the time for each tdc bin. This offline calibration needs to be done for each tdc channel. For a detailed howto look at the source of jAnalyzer, which is doing just that.
During an event, the following errors could be encoded into the error flags of the TRAILER word:
bit | error | description |
0 | trigger during read-out | There was at least one trigger while the TDC was still busy pushing the data from the BRAM into the DATA-FIFO. Such triggers are ignored. |
1 | data fifo overflow | The event was too large, some of the older hits of this event could not be pushed into the DATA-FIFO. These hits are lost. |
2 | too old tdc data ignored | While pushing the data from the BRAM into the DATA-FIFO, the TDC encountered hits older than specified by the maximum trigger window limit. All hits older than this limit were ignored. (The first "to old" hit still makes it into the data.) |