1 #ifndef OBS_PHIP2_HIST_HPP
2 #define OBS_PHIP2_HIST_HPP
4 #include "latlib/o815/o815.h"
6 #include "latlib/writeout.h"
8 #include "latlib/obstat.hpp"
14 class obs_phip2_hist : public o815::obs {
20 obs_phip2_hist(o815 *_O815);
24 void _meas(bool loadedobs, const int& nthmeas);
30 obs_phip2_hist::obs_phip2_hist(o815 *_O815) : o815::obs("phip2",
31 _O815->paraQ->getParaNames() + "nthstep:imode:kt:kx:phip2absdiffequi", _O815,
35 Sim = (sim*)O815->Sim;
38 void obs_phip2_hist::_meas(bool loadedobs, const int& nthmeas) {
39 for (int kpimode=0; kpimode<4; kpimode++) {
40 const double ppt = 2.*M_PI/O815->comargs.lsize[0] * ( 0 + int( kpimode/4. * O815->comargs.lsize[0] ) ) ;
41 const double ppx = 2.*M_PI/O815->comargs.lsize[1] * ( 0 + int( kpimode/4. * O815->comargs.lsize[1] ) );
44 complex<double> phitildepp = 0;
46 for (int ixpt = 0; ixpt < O815->comargs.lsize[0]; ixpt++)
47 for (int ixpx = 0; ixpx < O815->comargs.lsize[1]; ixpx++)
48 phitildepp += Sim->conf[ ixpt*O815->comargs.lsize[1] + ixpx ].phi
49 * exp ( - _i_*(double)ppx*(double)ixpx - _i_*(double)ppt*(double)ixpt );
51 OM->phip2[ kpimode ] = norm( phitildepp) / Sim->LSIZE2;
54 *out << O815->paraQ->getParaVals();
55 *out << "\t" << ( Sim->nequi + (nthmeas+1)*Sim->nskip );
56 *out << "\t" << kpimode;
57 *out << "\t" << 0 + int( kpimode/4. * O815->comargs.lsize[0] );
58 *out << "\t" << 0 + int( kpimode/4. * O815->comargs.lsize[1] );
59 *out << "\t" << abs( OM->phip2[ kpimode ] - 1./(ppt*ppt + ppx*ppx + Sim->m*Sim->m) ) << endl;