================================================================================ # # # #### ##### ###### ##### # ###### # # ##### #### # ## # # # # # # # # # # ## # # # # # # # # # # ##### # # # ##### # # # # #### # # # # # ### ##### # # # # # # # # # # # # ## # # # # # # # # # # ## # # # # # # #### # # ###### ##### # ###### # # # #### ================================================================================ Here are the ingredients to a well-prepared TDC readout: 1. Wait for CDF_TDC_DONE (aka global Done) on the Tracer 2. Check that a specific TDC is ready for readout (read TDC status register, require "! Empty FIFO" and "LOCAL_DONE" 3. Read out and check header word 4. Read out TDC FIFO 5. Format data into minibank(s) 6. Send data (write to Tracer event FIFO and/or send over ethernet) 7. Set DONE on Tracer 8. Artificial delay ================================================================================ ##### # # ###### #### ##### ##### # #### # # #### # # # # # # # # # # # # ## # # # ###### ##### # # # # # # # # # # # #### # # # # # # ##### # # # # # # # # # # # # # # # # # # # # ## # # # # # ###### #### # # # #### # # #### ================================================================================ A: OLD MORE-THAN-CONSERVATIVE READOUT: -------------------------------------- 1. Loop over TDC's in the crate: 2. 8. (short) 3. 4. 5. 6. 7. This was not used since quite some time, and requires recompilation of the code. ================================================================================ B1: TRADITIONAL LOCAL POLLING: ------------------------------ 8. (optional) Loop over TDC's in the crate: 2. (repeat as often as necessary, at some point timeout) 8. (short, in present code taken out) 3. 4. 5. 6. 7. This was (without the optional delay) the default for a very long time. It was preferred to A since one could just ignore additional TDC's in the crate that were not being read out. Due to "Problem E." on Eric's list (corrupt data in the FIFO when frequently reading the TDC status register while the DSP is processing), there is the optional delay 8. This mode is chosen in run control by setting two parameters: extra4 = 99 extra6 is the optional delay in microseconds (now 2000, which is about as low as possible before getting unacceptable large number of failures) B2: TRADITIONAL LOCAL POLLING WITH EARLY DONE: ---------------------------------------------- Same as B1, but DONE is set (7.) before formatting minibank(s) (5.) One can switch between B1 and B2 by selecting in run control 'synchronous' (B1) or 'asynchronous' (B2) readout. B2 is currently (Nov 10, since the last few days of the commissioning run) the default for crates which contain one or more TDC's that cannot be read out. ================================================================================ C1: TRADITIONAL LOCAL POLLING AND SPY MODE: ------------------------------------------- Similar to B1, but the Tracer "spies" on the data as the crate controller reads them from the TDC's, therefore bank formatting and sending data to the VRB are no separate steps from the readout. 8. (optional) Loop over TDC's in the crate: 2. (repeat as often as necessary, at some point timeout) -- 3. | 5 Loop over TDC's in the crate: | +6 4. -- 7. C1 can be selected in run control by choosing "COT Spy" in the crate settings, in addition to the settings mentioned above under B1. Spy mode has not been tested thoroughly, but it is unlikely that any TDC related problems will occur. C2: TRADITIONAL LOCAL POLLING WITH EARLY EARLY DONE AND SPY MODE: ----------------------------------------------------------------- As a variation to C1, one could set DONE (7.) after the first loop over all TDC's is finished. This is currently not implemented, but could be done, and would then be selected in run control by choosing 'asynchronous' readout, as opposed to 'synchronous' readout (C1). ================================================================================ D1: OPTIMIZED LOCAL POLLING: ---------------------------- 8. (optional) While not all TDC's have been read out: 2. If 2. successful: 3. 4. 5. 6. 7. This was invented to optimize the readout performance for cases where there is a large spread in the amount of hits in the various TDC's. During the time that the DSP is still processing in TDC's with many hits, the TDC's with fewer hits can already be read out. Due to "Problem E." on Eric's list (corrupt data in the FIFO when frequently reading the TDC status register while the DSP is processing), this readout mode is basically unusable for stable running (unless the delay in the beginning is made so long that C1 gives identical results). To select this readout mode in run control: extra4 = 999 extra6 is the optional delay in microseconds (now 2000, which is about as low as possible before getting unacceptable large number of failures). Using this readout mode with a delay makes for obvious reasons little sense. D2: OPTIMIZED LOCAL POLLING WITH EARLY DONE: -------------------------------------------- Same as D1, but DONE is set (7.) before formatting minibank(s) (5.) One can switch between D1 and D2 by selecting in run control 'synchronous' (D1) or 'asynchronous' (D2) readout. There are no varieties of D1 and D2 with Spy mode, since for spy mode the header words (containing the data size) from ALL TDC's in a crate must be known before reading out hits, so that the bank header can be assembled correctly. ================================================================================ E1: GLOBAL TDC DONE MODE: ------------------------- 1. Loop over TDC's in the crate: 3. 4. 5. 6. 7. This mode can be chosen from run control by setting a parameter: extra4 = 0 E2: GLOBAL TDC DONE MODE WITH EARLY DONE: ----------------------------------------- Same as E1, but DONE is set (7.) before formatting minibank(s) (5.) One can switch between E1 and E2 by selecting in run control 'synchronous' (E1) or 'asynchronous' (E2) readout. E2 is currently (Nov 10, since the last few days of the commissioning run) the default on crates where all TDC's are fully operational. E3: GLOBAL TDC DONE MODE WITH EARLY EARLY DONE: ----------------------------------------------- Same as E1, but DONE is set (7.) immediately after CDF_TDC_DONE (1.) is detected. At high rates (i.e. when there is a high probability of a L2A before the TDC FIFO has been read out), this mode fails due to bad data in the FIFO (no valid header word found). To run in E3 currently requires recompilation of the code. ================================================================================ F1: GLOBAL TDC DONE AND SPY MODE: --------------------------------- Similar to E1, but the Tracer "spies" on the data as the crate controller reads them from the TDC's, therefore bank formatting and sending data to the VRB are no separate steps from the readout. 1. Loop over TDC's in the crate: ---- 3. | 5 Loop over TDC's in the crate: | +6 4. ---- 7. F1 can be selected in run control by choosing "COT Spy" in the crate settings, in addition to the settings mentioned above under E1. F2: GLOBAL TDC DONE WITH EARLY DONE AND SPY MODE: ------------------------------------------------- F3: GLOBAL TDC DONE WITH EARLY EARLY DONE AND SPY MODE: ------------------------------------------------------- One could set DONE (7.) immediately after CDF_TDC_DONE (1.), or after the first loop over all TDC's, i.e. after the header words have been read out. These two options are currently not configurable, and require recompilation of the code. ================================================================================ ================================================================================ #### #### # # # # ###### # # ##### #### # # # # ## ## ## ## # ## # # # # # # # ## # # ## # ##### # # # # #### # # # # # # # # # # # # # # # # # # # # # # # ## # # # #### #### # # # # ###### # # # #### ================================================================================ Local vs. global Done: ---------------------- If a TDC cannot be read out, but is still responsive otherwise, it can be marked "offline" in the hardware database. The readout code will then manually set Done for this TDC on each L2A, thus making the use of global TDC Done in this crate possible. One of D2 and F3 is likely to be the fastest option, and at this point we do not know which one will be preferable, reliable, and fastest. A few others may not be far behind in speed, but probably more robust. Performance depends on various factors: - DSP processing time - Variations in occupancy/data volume across a given crate - time needed to write data into the Tracer event FIFO - ...