Difference between revisions of "CDC algo status"
Line 59: | Line 59: | ||
#Finds the local pedestal as mean of 4 and 5 samples before the threshold crossing | #Finds the local pedestal as mean of 4 and 5 samples before the threshold crossing | ||
#Starts a search at the hit threshold xing and searches back through earlier data until adc value falls below low threshold in sample x | #Starts a search at the hit threshold xing and searches back through earlier data until adc value falls below low threshold in sample x | ||
− | #Calculates upsampled data from 1.6ns before sample x to 9.6ns after sample x. This is to cover the | + | #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 |
− | #Finds the threshold crossing again using upsampled data | + | #Finds the threshold crossing again using upsampled data |
#Interpolates to find the threshold crossing in units of sample/10 | #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. | |
− | + | ||
− | Could be extended to include high threshold crossing, interpolation and extrapolation to pedestal. Estimate this would take less than 3us to run. Code could be rewritten to find high and low threshold crossings simultaneously but would take up more resources. | + |
Revision as of 10:55, 13 January 2014
Contents
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
- Event pedestal is mean of 100 samples ending at trigger time
- Find hit threshold crossing
- Upsample 20 samples starting 10 before hit threshold crossing
- Find hit threshold crossing again in upsampled data
- Step back <pedlead> points to find new local pedestal
- Search forward to find high threshold crossing
- Search backward to find low threshold crossing
- Project through both thresholds to find pedestal crossing time
After simplification
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...
- moves the stream of adc samples into a buffer array.
- Finds the local pedestal as mean of 4 and 5 samples before the threshold crossing
- Starts a search at the hit threshold xing and searches back through earlier data until adc value falls below low threshold in sample x
- 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
- Finds the threshold crossing again using upsampled data
- 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.