Page History
...
|
PseudoCode
This is a proposed algorithm to handle the data produced by the TES detectors for LCLS-II.
The data is assumed to consist of several time streams per FPGA (250) sampled at 1 MHz. The beam repetition rate is 10 kHz, for a total of 100 samples minimum between valid (photon generated) events. The samples are assumed to be 16 bits.
Parfor : Parallel For
NumberOfChannels : number of channels to be handles by the FPGA
Samples per Window : Number of samples in a single pulse window
TotalNumberOfWindows : Maximum number of windows to be kept in memory for the configured filters. Currently only 3 for a total of four cases. The active window, the preceding one and the following one. Possibly more windows to be added before/after for more precision in the energy measurement.
Active Window : Window on which we are performing the filter calculation
Current Window : Window that is currently loading in buffers.
EventMatrix : Matrix containgin information about the presence of events in each window of each channel.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
CreateCircularBuffers (NumberOfChannels,
SamplesPerWindow, TotalNumberOfWindows)
LoadFilters()
ConfigureDataChannel()
While IncomingData:
LoadDatainBuffers()
ApplyCrosstalkCorrection(All_Channels,CurrentWindow)
EventMatrix = TagEvents(All_Channels)
For each ActiveWindow :
WindowIncrement=+1
Parfor each Channel:
Switch (CheckEvents(EventMatrix)):
Case No Event Before And After
Energy = ApplyFilter(Filter00)
Case Event Before And After
Energy = ApplyFilter(Filter11)
Case Event Before Only
Energy = ApplyFilter(Filter10)
Case Event After Only
Energy = ApplyFilter(Filter00)
SaveEnergyAndTimestamp(xtcFile)
If WindowIncrement == SaveIncrement
SaveWaveformtoXTC(xtcFile, TotalTimeWindow, AllChannels)
Def TagEvents:
Parfor each channel :
If Slope > MinimumSlope:
CurrentWindowEvent=True
Else:
CurrentWindowEvent=False
EventMatrix(channel, currentWindowIndex) = CurrentWindowEvent
Return EventMatrix
Def ApplyFilter(Filter):
For each i, sample :
Temp = linearFunction(sample) * sample
sum1 = temp* Filter(i)
sum2 = sample*Filter2(i) %More filters added if necessary
Energy = sum1+sum2 |
Benchmarks
This table lists the latest benchmarks.
...
Task | Status | Comment | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Create fake data vectors |
| Using random number vectors | ||||||||||||
Implement event detection algorithm |
| |||||||||||||
Program arguments for benchmarking |
| Arguments for the size of the vectors and the number of array products used Preprocessor arguments | ||||||||||||
Decision tree for event cases |
| Switch case tree for given number of filters - reusable for different cases | ||||||||||||
Input data from simulation |
| |||||||||||||
Create circular buffer |
| |||||||||||||
Optimize loop behavior |
| |