24 using tr1::placeholders::_1;
25 using tr1::placeholders::_2;
49 const int dim(
_hist->result().dim());
55 vector<double> fft_tmp;
57 double* tmpdata(&(fft_tmp.front()));
58 _fftw_plan = fftw_plan_dft_r2c_1d(
_Nx, tmpdata, reinterpret_cast<fftw_complex*>(tmpdata), FFTW_MEASURE);
63 _Ny =
_hist->result().shape().second;
66 vector<double> fft_tmp;
68 double* tmpdata(&(fft_tmp.front()));
69 _fftw_plan = fftw_plan_dft_r2c_2d(
_Ny,
_Nx, tmpdata, reinterpret_cast<fftw_complex*>(tmpdata), FFTW_MEASURE);
72 throw invalid_argument(
"pp312::loadSettings(): Input Histogram '" +
_hist->name() +
73 "' has unsupported dimenstion '" +
toString(dim) +
"'");
78 "' will calculate the fft of '" +
_hist->name() +
79 "'. Condition is '" +
_condition->name() +
"'");
89 std::vector<double> fft_tmp;
91 copy(in, in+
_Nx, fft_tmp.begin());
92 double* tmpdata(&(fft_tmp.front()));
94 fftw_execute_dft_r2c(
_fftw_plan, tmpdata, reinterpret_cast<fftw_complex*>(tmpdata));
100 for (
size_t xx=0;xx<
_Nx/2;++xx)
104 out[xx+
_Nx/2] = v_real*v_real + v_imag*v_imag;
107 for (
size_t xx=
_Nx/2;xx<
_Nx;++xx)
111 out[xx-_Nx/2] = v_real*v_real + v_imag*v_imag;
124 vector<double> fft_tmp;
126 double* tmpdata(&(fft_tmp.front()));
128 for (
size_t yy=0;yy<
_Ny;++yy)
129 for (
size_t xx=0;xx<
_Nx;++xx)
140 fftw_execute_dft_r2c(
_fftw_plan, tmpdata, reinterpret_cast<fftw_complex*>(tmpdata));
144 for (
size_t xx=0;xx<_Nx/2;++xx)
145 for (
size_t yy=0;yy<_Ny/2;++yy)
147 for (
size_t ii=0;ii<_Nx/2*_Ny/2;++ii)
148 out[ii]=tmpdata[ii*2];
151 for (
size_t xx=_Nx/2;xx<
_Nx;++xx)
153 for (
size_t yy=_Ny/2;yy<
_Ny;++yy)
157 out[_Nx*(yy)+xx] = v_real*v_real + v_imag*v_imag;
161 for (
size_t xx=_Nx/2;xx<
_Nx;++xx)
163 for (
size_t yy=0;yy<_Ny/2;++yy)
167 out[_Nx*(yy)+xx] = v_real*v_real + v_imag*v_imag;
171 for (
size_t xx=0;xx<_Nx/2;++xx)
173 for (
size_t yy=0;yy<
_Ny;++yy)
175 out[_Nx*(yy)+xx] = out[ _Nx*(_Ny-yy) + _Nx-xx ];
179 out[_Nx/2*_Ny+_Ny/2] = tmpdata[0]*tmpdata[0] + tmpdata[1]*tmpdata[1];
storage_t::const_iterator const_iterator
a const iterator on the storage
Event to store all LCLS Data.
virtual void createHistList(result_t::shared_pointer result)
create result list.
fftw_plan _fftw_plan
fftw plan - stores fftw optimization data for given data type+size
const name_t name() const
retrieve the name of this processor
file contains declaration of the CASSEvent
float value_t
the values of this container
virtual void process(const CASSEvent &evt, result_t &result)
process the event
int _fft_tmp_padding
info about temporary memory for the fftw calculation
static void add(Level level, const std::string &line)
add a string to the log
const_iterator begin() const
retrieve a iterator for read access to beginning
fromStdString(const std::string &str)
shared_pointer _hist
pp containing histogram to calculate the autocorrelation for
base class for processors.
void fft2d(result_t::const_iterator in, result_t::iterator out)
calculate the absolute square fft for 2d data
pp312(const name_t &name)
constructor
shared_pointer setupDependency(const std::string &depVarName, const name_t &name="")
setup the dependecy.
std::tr1::function< void(result_t::const_iterator, result_t::iterator)> _func
function to call for processing
QReadWriteLock lock
lock for locking operations on the data of the container
virtual void loadSettings(size_t)
load the settings of this pp
std::string toString(const Type &t)
convert any type to a string
file contains processors baseclass declaration
storage_t::iterator iterator
a iterator on the storage
void setupGeneral()
general setup of the processor
file contains specialized class that do the settings for cass
void fft1d(result_t::const_iterator in, result_t::iterator out)
calculate the absolute square fft for 1d data
shared_pointer _condition
pointer to the processor that will contain the condition
containing the class to calculate the fast fourier transform
bool setupCondition(bool defaultConditionType=true)
setup the condition.
std::string name_t
define the name type
contains a logger for cass
beginGroup(const QString &prefix)
size_t _Nx
the shape of the incomming histogram