12 #include "cetlib_except/exception.h" 20 : fResponseLocked(false)
21 , fFilterLocked (false)
67 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
95 std::vector<TComplex> kern(nticks/2 + 1);
101 throw cet::exception(
"SignalShaping") << __func__ <<
": inconsistent kernel size, " 104 for(
unsigned int i=0; i<kern.size(); ++i)
122 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
145 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
153 std::vector<double> delta(fft->
FFTSize(), 0.);
173 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
188 for(
unsigned int i=0; i<
n; ++i)
190 for(
unsigned int i=n; i<
fFilter.size(); ++i)
200 if ( (pol != 1) and (pol != -1) ) {
202 <<
": DeconvKernelPolarity should be +1 or -1 (got " << pol <<
"). Setting to +1\n";
228 <<
"Response has not been configured.\n";
235 throw cet::exception(
"SignalShaping") << __func__ <<
": inconsistent kernel size, " 236 <<
fResponse.size() <<
" vs. " << n <<
"\n";
238 throw cet::exception(
"SignalShaping") << __func__ <<
": unexpected FFT size, " 239 << n <<
" vs. expected " << (2 * (
fConvKernel.size() - 1)) <<
"\n";
256 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
270 <<
"Filter function has not been configured.\n";
276 if (2 * (
fFilter.size() - 1) != n)
278 throw cet::exception(
"SignalShaping") << __func__ <<
": inconsistent size, " 300 std::vector<double> deconv(n, 0.);
307 double peak_response = 0;
309 peak_response = 4096;
310 for(
unsigned int i = 0; i <
fResponse.size(); ++i) {
320 if (peak_response <= 0.) {
322 <<
": peak should always be positive (got " << peak_response <<
")\n";
328 double peak_deconv = 0.;
329 for(
unsigned int i = 0; i < deconv.size(); ++i) {
330 if(deconv[i] > peak_deconv)
331 peak_deconv = deconv[i];
333 if (peak_deconv <= 0.) {
335 <<
": deconvolution peak should always be positive (got " << peak_deconv <<
")\n";
341 double ratio = peak_response / peak_deconv;
void ShiftData(std::vector< TComplex > &input, double shift)
std::vector< TComplex > fConvKernel
void AddResponseFunction(const std::vector< double > &resp, bool ResetResponse=false)
void LockResponse() const
std::vector< TComplex > fFilter
void DoFFT(std::vector< T > &input, std::vector< TComplex > &output)
T PeakCorrelation(std::vector< T > &shape1, std::vector< T > &shape2)
void DoInvFFT(std::vector< TComplex > &input, std::vector< T > &output)
Generic class for shaping signals on wires.
void CalculateDeconvKernel() const
int fDeconvKernelPolarity
void SetDeconvKernelPolarity(int pol)
void ShiftResponseTime(double ticks)
std::vector< TComplex > fDeconvKernel
void SetPeakResponseTime(double tick)
std::vector< double > fResponse
void AddFilterFunction(const std::vector< TComplex > &filt)
cet::coded_exception< error, detail::translate > exception