lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
ConstFracDiscrim.hh File Reference

Declares psalgos constant-fraction discrimination functions: getcfd() and its polynomial helpers. More...

#include <cstddef>
#include <cstdint>
#include <vector>

Namespaces

namespace  psalgos
 Waveform and peak-finding algorithms of psana (constant-fraction discrimination, PeakFinderAlgos, ...).
 

Typedefs

typedef std::vector< double > psalgos::Waveform
 std::vector<double> of waveform samples, the input of getcfd().
 

Functions

std::vector< double > psalgos::diff_table (int deg, const std::vector< double > &x, const std::vector< double > &y)
 Return y[0] followed by difference quotients taken column by column, each computed as (next - current) / (x[row] - x[row+1]) with adjacent x spacing at every order; the first entry of each column is appended.
 
double psalgos::eval_poly (double x, const std::vector< double > &coeffs)
 Evaluate the polynomial with coefficients coeffs, highest power first, at x.
 
double psalgos::find_root (const std::vector< double > &f, const std::vector< double > &df, double error, double x0, int max_its=1000)
 Newton iteration from x0 on the polynomial f with derivative polynomial df (both evaluated with eval_poly()).
 
double psalgos::getcfd (const double sampleInterval, const double horpos, const double gain, const double offset, const Waveform &waveform, const int32_t delay, const double walk, const double threshold, const double fraction)
 Scan waveform for the first sample i (from delay+1) where the constant-fraction signal s(k) = -(w[k]-off)*fraction + (w[k-delay]-off) crosses walk/gain between i and i+1, |w[i]-off| > threshold/gain and the polarity matches, with off = (int)(offset/gain).
 

Detailed Description

Declares psalgos constant-fraction discrimination functions: getcfd() and its polynomial helpers.