#include <SignalShaping.h>
Definition at line 69 of file SignalShaping.h.
util::SignalShaping::SignalShaping |
( |
| ) |
|
util::SignalShaping::~SignalShaping |
( |
| ) |
|
|
virtual |
void util::SignalShaping::AddFilterFunction |
( |
const std::vector< TComplex > & |
filt | ) |
|
Definition at line 168 of file SignalShaping.cxx.
173 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
177 art::ServiceHandle<util::LArFFT const> fft;
184 fFilter.resize(fft->FFTSize() / 2 + 1);
187 unsigned int n = std::min(
fFilter.size(), filt.size());
188 for(
unsigned int i=0; i<
n; ++i)
190 for(
unsigned int i=n; i<
fFilter.size(); ++i)
std::vector< TComplex > fFilter
void util::SignalShaping::AddResponseFunction |
( |
const std::vector< double > & |
resp, |
|
|
bool |
ResetResponse = false |
|
) |
| |
Definition at line 62 of file SignalShaping.cxx.
67 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
71 art::ServiceHandle<util::LArFFT> fft;
72 int nticks = fft->FFTSize();
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)
std::vector< TComplex > fConvKernel
std::vector< double > fResponse
void util::SignalShaping::CalculateDeconvKernel |
( |
| ) |
const |
Definition at line 251 of file SignalShaping.cxx.
256 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
264 art::ServiceHandle<util::LArFFT> fft;
269 throw cet::exception(
"SignalShaping")
270 <<
"Filter function has not been configured.\n";
275 unsigned int n = fft->FFTSize();
276 if (2 * (
fFilter.size() - 1) != n)
278 throw cet::exception(
"SignalShaping") << __func__ <<
": inconsistent size, "
300 std::vector<double> deconv(n, 0.);
301 fft->DoInvFFT(
const_cast<std::vector<TComplex>&
>(
fFilter), deconv);
307 double peak_response = 0;
309 peak_response = 4096;
310 for(
unsigned int i = 0; i <
fResponse.size(); ++i) {
320 if (peak_response <= 0.) {
321 throw cet::exception(
"SignalShaping") << __func__
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.) {
334 throw cet::exception(
"SignalShaping") << __func__
335 <<
": deconvolution peak should always be positive (got " << peak_deconv <<
")\n";
341 double ratio = peak_response / peak_deconv;
std::vector< TComplex > fConvKernel
void LockResponse() const
std::vector< TComplex > fFilter
int fDeconvKernelPolarity
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
std::vector< TComplex > fDeconvKernel
std::vector< double > fResponse
const std::vector<TComplex>& util::SignalShaping::ConvKernel |
( |
| ) |
const |
|
inline |
template<class T >
void util::SignalShaping::Convolute |
( |
std::vector< T > & |
func | ) |
const |
|
inline |
Definition at line 167 of file SignalShaping.h.
173 art::ServiceHandle<util::LArFFT> fft;
176 if(
int const n = func.size();
n != fft->FFTSize())
177 throw cet::exception(
"SignalShaping") <<
"Bad time series size = " <<
n <<
"\n";
179 fft->Convolute(func,
const_cast<std::vector<TComplex>&
>(
fConvKernel));
std::vector< TComplex > fConvKernel
void LockResponse() const
const std::vector<TComplex>& util::SignalShaping::DeconvKernel |
( |
| ) |
const |
|
inline |
template<class T >
void util::SignalShaping::Deconvolute |
( |
std::vector< T > & |
func | ) |
const |
|
inline |
Definition at line 184 of file SignalShaping.h.
190 art::ServiceHandle<util::LArFFT> fft;
193 if(
int const n = func.size();
n != fft->FFTSize())
194 throw cet::exception(
"SignalShaping") <<
"Bad time series size = " <<
n <<
"\n";
void CalculateDeconvKernel() const
std::vector< TComplex > fDeconvKernel
const std::vector<TComplex>& util::SignalShaping::Filter |
( |
| ) |
const |
|
inline |
void util::SignalShaping::LockResponse |
( |
| ) |
const |
Definition at line 214 of file SignalShaping.cxx.
222 art::ServiceHandle<util::LArFFT const> fft;
227 throw cet::exception(
"SignalShaping")
228 <<
"Response has not been configured.\n";
233 unsigned int n = fft->FFTSize();
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";
std::vector< TComplex > fConvKernel
std::vector< double > fResponse
void util::SignalShaping::Reset |
( |
| ) |
|
Definition at line 47 of file SignalShaping.cxx.
std::vector< TComplex > fConvKernel
std::vector< TComplex > fFilter
int fDeconvKernelPolarity
std::vector< TComplex > fDeconvKernel
std::vector< double > fResponse
const std::vector<double>& util::SignalShaping::Response |
( |
| ) |
const |
|
inline |
const std::vector<double>& util::SignalShaping::Response_save |
( |
| ) |
const |
|
inline |
void util::SignalShaping::save_response |
( |
| ) |
|
|
inline |
Definition at line 100 of file SignalShaping.h.
std::vector< double > fResponse
std::vector< double > fResponse_save
void util::SignalShaping::set_normflag |
( |
bool |
flag | ) |
|
|
inline |
void util::SignalShaping::SetDeconvKernelPolarity |
( |
int |
pol | ) |
|
Definition at line 197 of file SignalShaping.cxx.
200 if ( (pol != 1)
and (pol != -1) ) {
201 throw cet::exception(
"SignalShaping") << __func__
202 <<
": DeconvKernelPolarity should be +1 or -1 (got " << pol <<
"). Setting to +1\n";
int fDeconvKernelPolarity
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
void util::SignalShaping::SetPeakResponseTime |
( |
double |
tick | ) |
|
Definition at line 140 of file SignalShaping.cxx.
145 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
149 art::ServiceHandle<util::LArFFT> fft;
153 std::vector<double> delta(fft->FFTSize(), 0.);
158 double peak = fft->PeakCorrelation(delta,
fResponse);
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
void ShiftResponseTime(double ticks)
std::vector< double > fResponse
void util::SignalShaping::ShiftResponseTime |
( |
double |
ticks | ) |
|
Definition at line 117 of file SignalShaping.cxx.
122 throw cet::exception(
"SignalShaping") <<
"Configuration locked.\n";
126 art::ServiceHandle<util::LArFFT> fft;
std::vector< TComplex > fConvKernel
tick ticks
Alias for common language habits.
std::vector< double > fResponse
std::vector<TComplex> util::SignalShaping::fConvKernel |
|
private |
std::vector<TComplex> util::SignalShaping::fDeconvKernel |
|
mutableprivate |
int util::SignalShaping::fDeconvKernelPolarity |
|
private |
std::vector<TComplex> util::SignalShaping::fFilter |
|
private |
bool util::SignalShaping::fFilterLocked |
|
mutableprivate |
bool util::SignalShaping::fNorm |
|
private |
std::vector<double> util::SignalShaping::fResponse |
|
private |
std::vector<double> util::SignalShaping::fResponse_save |
|
private |
bool util::SignalShaping::fResponseLocked |
|
mutableprivate |
The documentation for this class was generated from the following files: