12 #include "TFFTRealComplex.h" 13 #include "TFFTComplexReal.h" 32 template <
class T>
void DoFFT(std::vector<T> & input,
33 std::vector<TComplex> & output);
35 template <
class T>
void DoInvFFT(std::vector<TComplex> & input,
36 std::vector<T> & output);
38 template <
class T>
void Deconvolute(std::vector<T> & input,
39 std::vector<T> & respFunc);
41 template <
class T>
void Deconvolute(std::vector<T> & input,
42 std::vector<TComplex> & kern);
44 template <
class T>
void Convolute(std::vector<T> & input,
45 std::vector<T> & respFunc);
47 template <
class T>
void Convolute(std::vector<T> & input,
48 std::vector<TComplex> & kern);
50 template <
class T>
void Correlate(std::vector<T> & input,
51 std::vector<T> & respFunc);
53 template <
class T>
void Correlate(std::vector<T> & input,
54 std::vector<TComplex> & kern);
56 template <
class T>
void AlignedSum(std::vector<T> & input,
57 std::vector<T> &output,
60 void ShiftData(std::vector<TComplex> & input,
63 template <
class T>
void ShiftData(std::vector<T> & input,
67 std::vector<T> &shape2);
98 std::vector<TComplex> & output)
101 double imaginary = 0.;
104 for(
size_t p = 0; p < input.size(); ++p)
105 fFFT->SetPoint(p, input[p]);
110 fFFT->GetPointComplex(i, real, imaginary);
111 output[i]=TComplex(real, imaginary);
120 std::vector<T> & output)
126 double factor = 1.0/(double)
fSize;
128 for(
int i = 0; i <
fSize; ++i)
129 output[i] = factor*
fInverseFFT->GetPointReal(i,
false);
138 std::vector<T> & respFunction)
157 std::vector<TComplex> & kern)
173 std::vector<T> & shape2)
192 std::vector<TComplex> & kern)
207 std::vector<T> & shape2)
226 std::vector<TComplex> & kern)
231 fCompTemp[i]*=TComplex::Conjugate(kern[i]);
244 std::vector<T> & shape2,
251 if(add)
for(
int i = 0; i <
fSize; i++) shape1[i]+=shape2[i];
272 std::vector<T> & shape2)
275 std::vector<T> holder = shape1;
278 int maxT = max_element(holder.begin(), holder.end())-holder.begin();
283 if(startT+i < 0) offset=
fSize;
286 fConvHist->Fill(i,holder[i+startT+offset]);
291 return fPeakFit->GetParameter(1)+startT;
Namespace for general, non-LArSoft-specific utilities.
void ShiftData(std::vector< TComplex > &input, double shift)
std::vector< TComplex > fKern
#define DECLARE_ART_SERVICE(svc, scope)
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)
TFFTRealComplex * fFFT
object to do FFT
void Correlate(std::vector< T > &input, std::vector< T > &respFunc)
LArFFT(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
void Convolute(std::vector< T > &input, std::vector< T > &respFunc)
void Deconvolute(std::vector< T > &input, std::vector< T > &respFunc)
void AlignedSum(std::vector< T > &input, std::vector< T > &output, bool add=true)
std::vector< TComplex > fCompTemp
std::string FFTOptions() const
TFFTComplexReal * fInverseFFT
object to do Inverse FF
void ReinitializeFFT(int, std::string, int)