25 : m_LogLevel(ps.
get<
int>(
"LogLevel")),
26 m_FirstTick(ps.
get<
Index>(
"FirstTick")),
29 m_ReturnOpt(ps.
get<
Index>(
"ReturnOpt")),
30 m_DataView(ps.
get<
Name>(
"DataView")) {
31 const string myname =
"AdcChannelFFT::ctor: ";
33 cout << myname <<
"Configuration: " <<
endl;
46 const string myname =
"AdcChannelFFT::view: ";
51 cout << myname <<
"View " <<
m_DataView <<
" not found for event " << acd.
event()
59 for (
AdcIndex ivie=0; ivie<nvie; ++ivie ) {
65 retTop.
setInt(
"fftNproc", nproc);
66 retTop.
setInt(
"fftNfail", nproc);
74 const string myname =
"AdcChannelFFT::update: ";
79 cout << myname <<
"View " <<
m_DataView <<
" not found for event " << acd.
event()
87 for (
AdcIndex ient=0; ient<nent; ++ient ) {
90 if ( pacd ==
nullptr ) {
91 cout << myname <<
"Channel " << acd.
channel() <<
" view entry " 100 retTop.
setInt(
"fftNproc", nproc);
101 retTop.
setInt(
"fftNfail", nproc);
104 cout << myname <<
"Channel " << acd.
channel() <<
" entry counts: " 105 << nproc <<
" processed, " << nfail <<
" failed." <<
endl;
113 const string myname =
"AdcChannelFFT::view: ";
125 const string myname =
"AdcChannelFFT::update: ";
131 if ( ret )
return ret;
141 if (
m_LogLevel >= 2 ) cout << myname <<
"Saving samples." <<
endl;
152 const string myname =
"AdcChannelFFT::internalView: ";
153 bool doForward =
false;
154 bool doInverse =
false;
158 doForward = acd.
dftmags.size() == 0;
166 doInverse = acd.
samples.size() == 0;
172 cout << myname <<
"ERROR: Invalid action: " <<
m_Action <<
endl;
183 if ( isam0 >= acd.
samples.size() ) {
184 cout << myname <<
"WARNING: No data in range." <<
endl;
188 nsam = acd.
samples.size() - isam0;
189 if (
m_LogLevel >= 3 ) cout << myname <<
"Forward FFT with " << nsam <<
" samples." <<
endl;
194 cout << myname <<
"WARNING: Forward FFT failed." <<
endl;
197 }
else if ( doInverse ) {
201 cout <<
"ERROR: Unable to find DFT in AdcChannelData." <<
endl;
207 if (
m_LogLevel >= 3 ) cout << myname <<
"Inverse FFT for " << dft.
size() <<
" samples." <<
endl;
210 cout << myname <<
"WARNING: Inverse FFT failed." <<
endl;
219 for (
Index ifrq=0; ifrq<nsam; ++ifrq ) {
220 fftres[ifrq] = dft.
real(ifrq);
221 fftims[ifrq] = dft.
imag(ifrq);
227 if ( doForward ) dft.
moveOut(xams, xphs);
230 ret.
setInt(
"fftTick0", isam0);
231 ret.
setInt(
"fftNTick", nsam);
234 ret.
setInt(
"fftNMag", xams.size());
235 ret.
setInt(
"fftNPhase", xphs.size());
std::vector< float > FloatVector
DataMap & setStatus(int stat)
static AdcIndex dftNormalization()
CompactRealDftData< float > DFT
virtual bool isValid() const
F imag(Index ifrq) const override
AdcChannelFFT(fhicl::ParameterSet const &ps)
static int fftForward(Index ntick, const float *psam, DFT &dft, Index logLevel=0)
void setInt(Name name, int val)
AdcSignalVector dftphases
static constexpr double ps
DataMap updateTop(AdcChannelData &acd) const
Q_EXPORT QTSManip setw(int w)
AdcChannelData * mutableViewEntry(Name vpnam, AdcIndex ient)
static int fftInverse(const DFT &dft, FloatVector &sams, Index logLevel=0)
F real(Index ifrq) const override
DataMap viewTop(const AdcChannelData &acd) const
const AdcChannelData * viewEntry(Name vpnam, AdcIndex ient) const
AdcSignalVector FloatVector
auto const & get(AssnsNode< L, R, D > const &r)
int moveOut(FloatVector &s, FloatVector &phas)
int copyIn(const FloatVector &s, const FloatVector &phas)
bool hasView(Name vnam) const
void setFloatVector(Name name, const FloatVector &val)
DataMap view(const AdcChannelData &acd) const override
DataMap update(AdcChannelData &acd) const override
QTextStream & endl(QTextStream &s)
void internalView(const AdcChannelData &acd, FloatVector &sams, FloatVector &s, FloatVector &phas, DataMap &ret) const