CDC algo status

From GlueXWiki
Jump to: navigation, search

Add simplifications to offline code to show impact

Using prototype data from CDC_50_50 (run 31942) with offline analysis

50/50 Ar/CO2 and cosmics, 2100V, prototype horizontal

Offline code
  1. Event pedestal is mean of 100 samples ending at trigger time
  2. Find hit threshold crossing
  3. Upsample 20 samples starting 10 before hit threshold crossing
  4. Find hit threshold crossing again in upsampled data
  5. Step back <pedlead> points to find new local pedestal
  6. Search forward to find high threshold crossing
  7. Search backward to find low threshold crossing
  8. Project through both thresholds to find pedestal crossing time


Resolution straw 20, counts vs resolution (#mum)
Thresholds 5-4-1 pedlead 16 tz 7 tfix 1000


After simplification

more details here

Simplifications (one at a time): Resolution straw 20, counts vs resolution (#mum)
Event pedestal is mean of 4 samples
Local ped mean of 4 and 5 samples before hit threshold


Combined simplifications
(a) Event ped is mean of 4 samples, local ped is mean of 4 and 5 samples before hit_thr
(b) As left, but no interpolation when finding high and low thresholds
(c) As top left, hit time is interpolated low threshold crossing time
(d) As top left, hit time is low threshold crossing time without interpolation

Lower line (c and d) are from single threshold crossings

Implemented in VHDL using ISE, ISIM and XST...

Trigger rate 1/(5us)

(d) single (low) threshold crossing without interpolation - takes ~1.4us (includes time for feeding in adc samples), outputs crossing time as integer in units of sample/10. (=0.8ns)
(c) single (low) threshold crossing with interpolation - takes ~1.4us (80 ns more than option d), outputs crossing time as integer in units of sample/10. (=0.8ns)

Code synthesizes (~compiles) with min clock period of ~ 7.6ns :-)

How it works... Anticipate an external process which would find the pedestal value just before the earliest drift time and then scan the following data (for 1us) looking for a threshold crossing. If it finds this hit threshold xing, it sends 20 samples surrounding the threshold xing sample to my time-finding module, with the hit threshold xing sample in a set position.

Time-finding module...

  1. moves the stream of adc samples into a buffer array.
  2. Finds the local pedestal as mean of 4 and 5 samples before the threshold crossing
  3. Starts a search at the hit threshold xing and searches back through earlier data until adc value falls below low threshold in sample x
  4. Calculates upsampled data (5 points per sample) from 1.6ns before sample x to 9.6ns after sample x. This is to cover the duration between samples x and x+1, with an extra upsampled point on either side just in case the upsampled data do not exactly match the adc values at x and x+1
  5. Finds the threshold crossing again using upsampled data
  6. Interpolates to find the threshold crossing in units of sample/10

Could be extended to include high threshold crossing, interpolation and extrapolation to pedestal. Estimate this would take less than 3us to run. Code could (probably!) be rewritten to find high and low threshold crossings simultaneously but would take up more resources.


resolution obtained using drift time = time to half-maximum (with interpolation, no upsampling)
Resolution straw 20
Thresholds 5-4-1
Radius 5mm+