From: Alexander Schmidt Date: Thu, 11 Dec 2014 10:50:02 +0000 (+0100) Subject: Seperated correlator observables. X-Git-Url: http://git.treefish.org/~alex/phys/u1casc.git/commitdiff_plain/3941a52da94bf52ab3feaccc5ea376895ac30f3e Seperated correlator observables. --- diff --git a/u1casc-ordinary/obs_corr.hpp b/u1casc-ordinary/obs_corr.hpp deleted file mode 100644 index 548d4ef..0000000 --- a/u1casc-ordinary/obs_corr.hpp +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef OBS_CORR_HPP -#define OBS_CORR_HPP - -#include "latlib/o815/o815.h" - -#include "latlib/writeout.h" - -#include "latlib/obstat.hpp" - -#include -#include - -#include - -#define U1 0 -#define U2 1 -#define F1 2 -#define F2 3 - -using namespace std; - -class obs_corr : public o815::obs { - -public: - obs_corr(o815 *_O815); - -private: - void _start(); - void _meas(bool loadedobs, const int& nthmeas); - void _finish(); - - void corrCompute(); - static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); - static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); - - sim *Sim; - obstat< complex, complex > oC[4]; - obstat< complex, complex > oD[4]; - - int spatialV; - - complex *OM[4]; -}; - -obs_corr::obs_corr(o815 *_O815) : o815::obs("corr", - _O815->paraQ->getParaNames() + - "tsep" - ":u1_real:u1_imag:u1_abs:u1_effmass:u1_effmass_err" - ":u2_real:u2_imag:u2_abs:u2_effmass:u2_effmass_err" - ":f1_real:f1_imag:f1_abs:f1_effmass:f1_effmass_err" - ":f2_real:f2_imag:f2_abs:f2_effmass:f2_effmass_err", - _O815, 4*sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { - for (int ivar = 0; ivar<4; ivar++) - OM[ivar] = (complex*)( obsMem + ivar*sizeof(complex)*( _O815->comargs.lsize[1]/2 + 1 ) ); - - Sim = (sim*)O815->Sim; - spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; -} - -void obs_corr::_start() { - //*out << "OBS_test: start" << endl; -}; - -void obs_corr::_meas(bool loadedobs, const int& nthmeas) { - if (!loadedobs) - corrCompute(); - - oC[U1].addMeas( OM[U1], O815->comargs.lsize[1]/2+1 ); - oC[U2].addMeas( OM[U2], O815->comargs.lsize[1]/2+1 ); - oC[F1].addMeas( OM[F1], O815->comargs.lsize[1]/2+1 ); - oC[F2].addMeas( OM[F2], O815->comargs.lsize[1]/2+1 ); -}; - -void obs_corr::_finish() { - int compid_corr[O815->comargs.lsize[1]/2][4]; - int compid_effmass[O815->comargs.lsize[1]/2-1][4]; - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) - for (int icorr = 0; icorr < 4; icorr++) - compid_corr[itsep][icorr] = oC[icorr].computeEasy(itsep); - - - for (int icorr = 0; icorr < 4; icorr++) { - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { - pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); - compid_effmass[itsep][icorr] = oC[icorr].computeJack(obs_corr::preEffMass, obs_corr::effMass, &effmasspass); - } - } - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { - *out << O815->paraQ->getParaVals(); - *out << "\t" << itsep; - for (int icorr = 0; icorr < 4; icorr++) { - *out << "\t" << real( oC[icorr].getMean(compid_corr[itsep][icorr]) ) - << "\t" << imag( oC[icorr].getMean(compid_corr[itsep][icorr]) ) - << "\t" << abs ( oC[icorr].getMean(compid_corr[itsep][icorr]) ); - - - if ( itsep < O815->comargs.lsize[1]/2-1 ) - *out << "\t" << real( oC[icorr].getMean(compid_effmass[itsep][icorr]) ) - << "\t" << real( oC[icorr].getErr (compid_effmass[itsep][icorr]) ); - else - *out << "\t" << NAN << "\t" << NAN; - } - *out << endl; - } - - for (int icorr = 0; icorr < 4; icorr++) { - oC[icorr].reset(); - oD[icorr].reset(); - } -}; - -void obs_corr::corrCompute() -{ - complex phislice[4][O815->comargs.lsize[1]]; - - OM[U1][O815->comargs.lsize[1]/2] = 0; - OM[U2][O815->comargs.lsize[1]/2] = 0; - OM[F1][O815->comargs.lsize[1]/2] = 0; - OM[F2][O815->comargs.lsize[1]/2] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) { - phislice[U1][it] = 0; - phislice[U2][it] = 0; - phislice[F1][it] = 0; - phislice[F2][it] = 0; - - for (int ix = 0; ix < spatialV; ix++) { - phislice[U1][it] += conj(Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]; - phislice[U2][it] += conj(Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - phislice[F1][it] += Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]; - phislice[F2][it] += Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - } - phislice[U1][it] /= spatialV; - phislice[U2][it] /= spatialV; - phislice[F1][it] /= spatialV; - phislice[F2][it] /= spatialV; - - OM[U1][O815->comargs.lsize[1]/2] += phislice[U1][it]; - OM[U2][O815->comargs.lsize[1]/2] += phislice[U2][it]; - OM[F1][O815->comargs.lsize[1]/2] += phislice[F1][it]; - OM[F2][O815->comargs.lsize[1]/2] += phislice[F2][it]; - } - - for (int icorr = 0; icorr < 4; icorr++) { - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { - OM[icorr][itsep] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) - OM[icorr][itsep] += phislice[icorr][ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[icorr][it] ); - - OM[icorr][itsep] /= O815->comargs.lsize[1]; - } - - OM[icorr][O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; - } -} - -void obs_corr::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { - pair *myparas = (pair*)para; - - preCalculated->push_back(0); - preCalculated->push_back(0); - preCalculated->push_back(0); - - for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { - (*preCalculated)[0] += (*valIt)[myparas->first]; - (*preCalculated)[1] += (*valIt)[myparas->first+1]; - (*preCalculated)[2] += (*valIt)[myparas->second]; - } -} - -complex obs_corr::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { - pair *myparas = (pair*)para; - - double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); - - return std::log( abs( - ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / - ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) - ) ); -} - -#endif diff --git a/u1casc-ordinary/obs_corrchichi.hpp b/u1casc-ordinary/obs_corrchichi.hpp new file mode 100644 index 0000000..ffecb61 --- /dev/null +++ b/u1casc-ordinary/obs_corrchichi.hpp @@ -0,0 +1,149 @@ +#ifndef OBS_CORRCHICHI_HPP +#define OBS_CORRCHICHI_HPP + +#include "latlib/o815/o815.h" + +#include "latlib/writeout.h" + +#include "latlib/obstat.hpp" + +#include +#include + +#include + +using namespace std; + +class obs_corrchichi : public o815::obs { + +public: + obs_corrchichi(o815 *_O815); + +private: + void _start(); + void _meas(bool loadedobs, const int& nthmeas); + void _finish(); + + void corrCompute(); + static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); + static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); + + sim *Sim; + obstat< complex, complex > oC; + + int spatialV; + + complex *OM; +}; + +obs_corrchichi::obs_corrchichi(o815 *_O815) : o815::obs("corrchichi", + _O815->paraQ->getParaNames() + + "tsep" + ":chichi_real:chichi_imag:chichi_abs:chichi_mass:chichi_mass_err", + _O815, sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { + + OM = (complex*)(obsMem); + + Sim = (sim*)O815->Sim; + spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; +} + +void obs_corrchichi::_start() { + //*out << "OBS_test: start" << endl; +}; + +void obs_corrchichi::_meas(bool loadedobs, const int& nthmeas) { + if (!loadedobs) + corrCompute(); + + oC.addMeas( OM, O815->comargs.lsize[1]/2+1 ); +}; + +void obs_corrchichi::_finish() { + int compid_corr[O815->comargs.lsize[1]/2]; + int compid_effmass[O815->comargs.lsize[1]/2-1]; + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) + compid_corr[itsep] = oC.computeEasy(itsep); + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { + pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); + compid_effmass[itsep] = oC.computeJack(obs_corrchichi::preEffMass, obs_corrchichi::effMass, &effmasspass); + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + *out << O815->paraQ->getParaVals(); + *out << "\t" << itsep; + + *out << "\t" << real( oC.getMean(compid_corr[itsep]) ) + << "\t" << imag( oC.getMean(compid_corr[itsep]) ) + << "\t" << abs ( oC.getMean(compid_corr[itsep]) ); + + if ( itsep < O815->comargs.lsize[1]/2-1 ) + *out << "\t" << real( oC.getMean(compid_effmass[itsep]) ) + << "\t" << real( oC.getErr (compid_effmass[itsep]) ); + else + *out << "\t" << NAN << "\t" << NAN; + + *out << endl; + } + + oC.reset(); +} + + +void obs_corrchichi::corrCompute() +{ + complex phislice[O815->comargs.lsize[1]]; + + OM[O815->comargs.lsize[1]/2] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) { + phislice[it] = 0; + + for (int ix = 0; ix < spatialV; ix++) + phislice[it] += conj(Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; + + phislice[it] /= spatialV; + + OM[O815->comargs.lsize[1]/2] += phislice[it]; + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + OM[itsep] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) + OM[itsep] += phislice[ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[it] ); + + OM[itsep] /= O815->comargs.lsize[1]; + } + + OM[O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; +} + +void obs_corrchichi::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { + pair *myparas = (pair*)para; + + preCalculated->push_back(0); + preCalculated->push_back(0); + preCalculated->push_back(0); + + for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { + (*preCalculated)[0] += (*valIt)[myparas->first]; + (*preCalculated)[1] += (*valIt)[myparas->first+1]; + (*preCalculated)[2] += (*valIt)[myparas->second]; + } +} + +complex obs_corrchichi::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { + pair *myparas = (pair*)para; + + double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); + + return std::log( abs( + ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / + ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) + ) ); +} + +#endif diff --git a/u1casc-ordinary/obs_corrphichi.hpp b/u1casc-ordinary/obs_corrphichi.hpp new file mode 100644 index 0000000..5074585 --- /dev/null +++ b/u1casc-ordinary/obs_corrphichi.hpp @@ -0,0 +1,149 @@ +#ifndef OBS_CORRPHICHI_HPP +#define OBS_CORRPHICHI_HPP + +#include "latlib/o815/o815.h" + +#include "latlib/writeout.h" + +#include "latlib/obstat.hpp" + +#include +#include + +#include + +using namespace std; + +class obs_corrphichi : public o815::obs { + +public: + obs_corrphichi(o815 *_O815); + +private: + void _start(); + void _meas(bool loadedobs, const int& nthmeas); + void _finish(); + + void corrCompute(); + static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); + static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); + + sim *Sim; + obstat< complex, complex > oC; + + int spatialV; + + complex *OM; +}; + +obs_corrphichi::obs_corrphichi(o815 *_O815) : o815::obs("corrphichi", + _O815->paraQ->getParaNames() + + "tsep" + ":phichi_real:phichi_imag:phichi_abs:phichi_mass:phichi_mass_err", + _O815, sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { + + OM = (complex*)(obsMem); + + Sim = (sim*)O815->Sim; + spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; +} + +void obs_corrphichi::_start() { + //*out << "OBS_test: start" << endl; +}; + +void obs_corrphichi::_meas(bool loadedobs, const int& nthmeas) { + if (!loadedobs) + corrCompute(); + + oC.addMeas( OM, O815->comargs.lsize[1]/2+1 ); +}; + +void obs_corrphichi::_finish() { + int compid_corr[O815->comargs.lsize[1]/2]; + int compid_effmass[O815->comargs.lsize[1]/2-1]; + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) + compid_corr[itsep] = oC.computeEasy(itsep); + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { + pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); + compid_effmass[itsep] = oC.computeJack(obs_corrphichi::preEffMass, obs_corrphichi::effMass, &effmasspass); + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + *out << O815->paraQ->getParaVals(); + *out << "\t" << itsep; + + *out << "\t" << real( oC.getMean(compid_corr[itsep]) ) + << "\t" << imag( oC.getMean(compid_corr[itsep]) ) + << "\t" << abs ( oC.getMean(compid_corr[itsep]) ); + + if ( itsep < O815->comargs.lsize[1]/2-1 ) + *out << "\t" << real( oC.getMean(compid_effmass[itsep]) ) + << "\t" << real( oC.getErr (compid_effmass[itsep]) ); + else + *out << "\t" << NAN << "\t" << NAN; + + *out << endl; + } + + oC.reset(); +} + + +void obs_corrphichi::corrCompute() +{ + complex phislice[O815->comargs.lsize[1]]; + + OM[O815->comargs.lsize[1]/2] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) { + phislice[it] = 0; + + for (int ix = 0; ix < spatialV; ix++) + phislice[it] += Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ] * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; + + phislice[it] /= spatialV; + + OM[O815->comargs.lsize[1]/2] += phislice[it]; + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + OM[itsep] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) + OM[itsep] += phislice[ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[it] ); + + OM[itsep] /= O815->comargs.lsize[1]; + } + + OM[O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; +} + +void obs_corrphichi::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { + pair *myparas = (pair*)para; + + preCalculated->push_back(0); + preCalculated->push_back(0); + preCalculated->push_back(0); + + for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { + (*preCalculated)[0] += (*valIt)[myparas->first]; + (*preCalculated)[1] += (*valIt)[myparas->first+1]; + (*preCalculated)[2] += (*valIt)[myparas->second]; + } +} + +complex obs_corrphichi::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { + pair *myparas = (pair*)para; + + double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); + + return std::log( abs( + ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / + ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) + ) ); +} + +#endif diff --git a/u1casc-ordinary/obs_corrphichimass.hpp b/u1casc-ordinary/obs_corrphichimass.hpp deleted file mode 100644 index 45880c1..0000000 --- a/u1casc-ordinary/obs_corrphichimass.hpp +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef OBS_CORRPHICHIMASS_HPP -#define OBS_CORRPHICHIMASS_HPP - -#include "latlib/o815/o815.h" - -#include "latlib/writeout.h" - -#include "latlib/obstat.hpp" - -#include -#include - -#include - -#define U1 0 -#define U2 1 -#define F1 2 -#define F2 3 - -using namespace std; - -class obs_corrphichimass : public o815::obs { - -public: - obs_corrphichimass(o815 *_O815); - -private: - void _start(); - void _meas(bool loadedobs, const int& nthmeas); - void _finish(); - - void corrCompute(); - static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); - static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); - - sim *Sim; - obstat< complex, complex > oC; - - int spatialV; - - complex *OM; -}; - -obs_corrphichimass::obs_corrphichimass(o815 *_O815) : o815::obs("corrphichimass", - _O815->paraQ->getParaNames() + - "tsep" - ":phichi_effmass:phichi_effmass_err", - _O815, sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { - - OM = (complex*)(obsMem); - - Sim = (sim*)O815->Sim; - spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; -} - -void obs_corrphichimass::_start() { - //*out << "OBS_test: start" << endl; -}; - -void obs_corrphichimass::_meas(bool loadedobs, const int& nthmeas) { - if (!loadedobs) - corrCompute(); - - oC.addMeas( OM, O815->comargs.lsize[1]/2+1 ); -}; - -void obs_corrphichimass::_finish() { - int compid_corr[O815->comargs.lsize[1]/2][4]; - int compid_effmass[O815->comargs.lsize[1]/2-1][4]; - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) - compid_corr[itsep][U1] = oC.computeEasy(itsep); - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { - pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); - compid_effmass[itsep][U1] = oC.computeJack(obs_corrphichimass::preEffMass, obs_corrphichimass::effMass, &effmasspass); - } - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { - *out << O815->paraQ->getParaVals(); - *out << "\t" << itsep; - - *out << "\t" << real( oC.getMean(compid_effmass[itsep][U1]) ) - << "\t" << real( oC.getErr (compid_effmass[itsep][U1]) ); - - *out << endl; - } - - oC.reset(); -}; - -void obs_corrphichimass::corrCompute() -{ - complex phislice[O815->comargs.lsize[1]]; - - OM[O815->comargs.lsize[1]/2] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) { - phislice[it] = 0; - - for (int ix = 0; ix < spatialV; ix++) - phislice[it] += Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ] * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - //phislice[it] += conj(Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - - phislice[it] /= spatialV; - - OM[O815->comargs.lsize[1]/2] += phislice[it]; - } - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { - OM[itsep] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) - OM[itsep] += phislice[ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[it] ); - - OM[itsep] /= O815->comargs.lsize[1]; - } - - OM[O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; -} - -void obs_corrphichimass::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { - pair *myparas = (pair*)para; - - preCalculated->push_back(0); - preCalculated->push_back(0); - preCalculated->push_back(0); - - for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { - (*preCalculated)[0] += (*valIt)[myparas->first]; - (*preCalculated)[1] += (*valIt)[myparas->first+1]; - (*preCalculated)[2] += (*valIt)[myparas->second]; - } -} - -complex obs_corrphichimass::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { - pair *myparas = (pair*)para; - - double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); - - return std::log( abs( - ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / - ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) - ) ); -} - -#endif diff --git a/u1casc-ordinary/obs_corrphiphi.hpp b/u1casc-ordinary/obs_corrphiphi.hpp new file mode 100644 index 0000000..232cf0e --- /dev/null +++ b/u1casc-ordinary/obs_corrphiphi.hpp @@ -0,0 +1,149 @@ +#ifndef OBS_CORRPHIPHI_HPP +#define OBS_CORRPHIPHI_HPP + +#include "latlib/o815/o815.h" + +#include "latlib/writeout.h" + +#include "latlib/obstat.hpp" + +#include +#include + +#include + +using namespace std; + +class obs_corrphiphi : public o815::obs { + +public: + obs_corrphiphi(o815 *_O815); + +private: + void _start(); + void _meas(bool loadedobs, const int& nthmeas); + void _finish(); + + void corrCompute(); + static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); + static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); + + sim *Sim; + obstat< complex, complex > oC; + + int spatialV; + + complex *OM; +}; + +obs_corrphiphi::obs_corrphiphi(o815 *_O815) : o815::obs("corrphiphi", + _O815->paraQ->getParaNames() + + "tsep" + ":phiphi_real:phiphi_imag:phiphi_abs:phiphi_mass:phiphi_mass_err", + _O815, sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { + + OM = (complex*)(obsMem); + + Sim = (sim*)O815->Sim; + spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; +} + +void obs_corrphiphi::_start() { + //*out << "OBS_test: start" << endl; +}; + +void obs_corrphiphi::_meas(bool loadedobs, const int& nthmeas) { + if (!loadedobs) + corrCompute(); + + oC.addMeas( OM, O815->comargs.lsize[1]/2+1 ); +}; + +void obs_corrphiphi::_finish() { + int compid_corr[O815->comargs.lsize[1]/2]; + int compid_effmass[O815->comargs.lsize[1]/2-1]; + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) + compid_corr[itsep] = oC.computeEasy(itsep); + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { + pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); + compid_effmass[itsep] = oC.computeJack(obs_corrphiphi::preEffMass, obs_corrphiphi::effMass, &effmasspass); + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + *out << O815->paraQ->getParaVals(); + *out << "\t" << itsep; + + *out << "\t" << real( oC.getMean(compid_corr[itsep]) ) + << "\t" << imag( oC.getMean(compid_corr[itsep]) ) + << "\t" << abs ( oC.getMean(compid_corr[itsep]) ); + + if ( itsep < O815->comargs.lsize[1]/2-1 ) + *out << "\t" << real( oC.getMean(compid_effmass[itsep]) ) + << "\t" << real( oC.getErr (compid_effmass[itsep]) ); + else + *out << "\t" << NAN << "\t" << NAN; + + *out << endl; + } + + oC.reset(); +} + + +void obs_corrphiphi::corrCompute() +{ + complex phislice[O815->comargs.lsize[1]]; + + OM[O815->comargs.lsize[1]/2] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) { + phislice[it] = 0; + + for (int ix = 0; ix < spatialV; ix++) + phislice[it] += conj(Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]; + + phislice[it] /= spatialV; + + OM[O815->comargs.lsize[1]/2] += phislice[it]; + } + + for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { + OM[itsep] = 0; + + for (int it = 0; it < O815->comargs.lsize[1]; it++) + OM[itsep] += phislice[ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[it] ); + + OM[itsep] /= O815->comargs.lsize[1]; + } + + OM[O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; +} + +void obs_corrphiphi::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { + pair *myparas = (pair*)para; + + preCalculated->push_back(0); + preCalculated->push_back(0); + preCalculated->push_back(0); + + for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { + (*preCalculated)[0] += (*valIt)[myparas->first]; + (*preCalculated)[1] += (*valIt)[myparas->first+1]; + (*preCalculated)[2] += (*valIt)[myparas->second]; + } +} + +complex obs_corrphiphi::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { + pair *myparas = (pair*)para; + + double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); + + return std::log( abs( + ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / + ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) + ) ); +} + +#endif diff --git a/u1casc-ordinary/obs_corrphiphimass.hpp b/u1casc-ordinary/obs_corrphiphimass.hpp deleted file mode 100644 index 1a70e95..0000000 --- a/u1casc-ordinary/obs_corrphiphimass.hpp +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef OBS_CORRPHIPHIMASS_HPP -#define OBS_CORRPHIPHIMASS_HPP - -#include "latlib/o815/o815.h" - -#include "latlib/writeout.h" - -#include "latlib/obstat.hpp" - -#include -#include - -#include - -#define U1 0 -#define U2 1 -#define F1 2 -#define F2 3 - -using namespace std; - -class obs_corrphiphimass : public o815::obs { - -public: - obs_corrphiphimass(o815 *_O815); - -private: - void _start(); - void _meas(bool loadedobs, const int& nthmeas); - void _finish(); - - void corrCompute(); - static complex effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para); - static void preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para); - - sim *Sim; - obstat< complex, complex > oC; - - int spatialV; - - complex *OM[4]; -}; - -obs_corrphiphimass::obs_corrphiphimass(o815 *_O815) : o815::obs("corr", - _O815->paraQ->getParaNames() + - "tsep" - ":u1_effmass:u1_effmass_err", - _O815, 4*sizeof(complex)*(_O815->comargs.lsize[1]/2+1) ) { - - for (int ivar = 0; ivar<4; ivar++) - OM[ivar] = (complex*)( obsMem + ivar*sizeof(complex)*( _O815->comargs.lsize[1]/2 + 1 ) ); - - Sim = (sim*)O815->Sim; - spatialV = O815->comargs.lsize[0] * O815->comargs.lsize[0] * O815->comargs.lsize[0]; -} - -void obs_corrphiphimass::_start() { - //*out << "OBS_test: start" << endl; -}; - -void obs_corrphiphimass::_meas(bool loadedobs, const int& nthmeas) { - if (!loadedobs) - corrCompute(); - - oC.addMeas( OM[U1], O815->comargs.lsize[1]/2+1 ); -}; - -void obs_corrphiphimass::_finish() { - int compid_corr[O815->comargs.lsize[1]/2][4]; - int compid_effmass[O815->comargs.lsize[1]/2-1][4]; - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) - compid_corr[itsep][U1] = oC.computeEasy(itsep); - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { - pair effmasspass( itsep, O815->comargs.lsize[1]/2 ); - compid_effmass[itsep][U1] = oC.computeJack(obs_corrphiphimass::preEffMass, obs_corrphiphimass::effMass, &effmasspass); - } - - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2-1; itsep++) { - *out << O815->paraQ->getParaVals(); - *out << "\t" << itsep; - - *out << "\t" << real( oC.getMean(compid_effmass[itsep][U1]) ) - << "\t" << real( oC.getErr (compid_effmass[itsep][U1]) ); - - *out << endl; - } - - oC.reset(); -}; - -void obs_corrphiphimass::corrCompute() -{ - complex phislice[4][O815->comargs.lsize[1]]; - - OM[U1][O815->comargs.lsize[1]/2] = 0; - OM[U2][O815->comargs.lsize[1]/2] = 0; - OM[F1][O815->comargs.lsize[1]/2] = 0; - OM[F2][O815->comargs.lsize[1]/2] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) { - phislice[U1][it] = 0; - phislice[U2][it] = 0; - phislice[F1][it] = 0; - phislice[F2][it] = 0; - - for (int ix = 0; ix < spatialV; ix++) { - phislice[U1][it] += conj(Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]; - phislice[U2][it] += conj(Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]) * Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - phislice[F1][it] += Sim->phi[ 0*Sim->lsize4 + it*spatialV + ix ]; - phislice[F2][it] += Sim->phi[ 1*Sim->lsize4 + it*spatialV + ix ]; - } - phislice[U1][it] /= spatialV; - phislice[U2][it] /= spatialV; - phislice[F1][it] /= spatialV; - phislice[F2][it] /= spatialV; - - OM[U1][O815->comargs.lsize[1]/2] += phislice[U1][it]; - OM[U2][O815->comargs.lsize[1]/2] += phislice[U2][it]; - OM[F1][O815->comargs.lsize[1]/2] += phislice[F1][it]; - OM[F2][O815->comargs.lsize[1]/2] += phislice[F2][it]; - } - - for (int icorr = 0; icorr < 4; icorr++) { - for (int itsep = 0; itsep < O815->comargs.lsize[1]/2; itsep++) { - OM[icorr][itsep] = 0; - - for (int it = 0; it < O815->comargs.lsize[1]; it++) - OM[icorr][itsep] += phislice[icorr][ (it+itsep)%O815->comargs.lsize[1] ] * conj( phislice[icorr][it] ); - - OM[icorr][itsep] /= O815->comargs.lsize[1]; - } - - OM[icorr][O815->comargs.lsize[1]/2] /= O815->comargs.lsize[1]; - } -} - -void obs_corrphiphimass::preEffMass(vector< vector < complex > > *allVals, vector < complex > *preCalculated, void *para) { - pair *myparas = (pair*)para; - - preCalculated->push_back(0); - preCalculated->push_back(0); - preCalculated->push_back(0); - - for(vector< vector< complex > >::iterator valIt = allVals->begin(); valIt != allVals->end(); ++valIt) { - (*preCalculated)[0] += (*valIt)[myparas->first]; - (*preCalculated)[1] += (*valIt)[myparas->first+1]; - (*preCalculated)[2] += (*valIt)[myparas->second]; - } -} - -complex obs_corrphiphimass::effMass(vector < complex > *preCalculated, vector< complex > *excludedMeas, int nmeas, void *para) { - pair *myparas = (pair*)para; - - double disconnected = norm( ( (*preCalculated)[2] - (*excludedMeas)[myparas->second] ) / (complex)(nmeas-1) ); - - return std::log( abs( - ( ( (*preCalculated)[0] - (*excludedMeas)[myparas->first] ) / (complex)(nmeas-1) - disconnected ) / - ( ( (*preCalculated)[1] - (*excludedMeas)[myparas->first+1] ) / (complex)(nmeas-1) - disconnected ) - ) ); -} - -#endif diff --git a/u1casc-ordinary/u1casc-ordinary.cpp b/u1casc-ordinary/u1casc-ordinary.cpp index 7aed52d..f362654 100644 --- a/u1casc-ordinary/u1casc-ordinary.cpp +++ b/u1casc-ordinary/u1casc-ordinary.cpp @@ -12,9 +12,9 @@ sim *Sim; #include "obs_phi2.hpp" #include "obs_plaq.hpp" -#include "obs_corr.hpp" -#include "obs_corrphiphimass.hpp" -#include "obs_corrphichimass.hpp" +#include "obs_corrphiphi.hpp" +#include "obs_corrchichi.hpp" +#include "obs_corrphichi.hpp" o815::comoption specOps[] = { { "kappaone", required_argument, NULL, 'r', "set inverse mass kappa_1", "min:max:inc" }, @@ -73,17 +73,17 @@ void parseLonelyArgs() *O815->out->log << "MASTER: registered observable: plaq" << endl << flush; O815->observables.push_back(new obs_plaq(O815)); } - else if ( strcmp(*lonit, "corr") == 0 ) { - *O815->out->log << "MASTER: registered observable: corr" << endl << flush; - O815->observables.push_back(new obs_corr(O815)); + else if ( strcmp(*lonit, "corrphiphi") == 0 ) { + *O815->out->log << "MASTER: registered observable: corr_phiphi" << endl << flush; + O815->observables.push_back(new obs_corrphiphi(O815)); } - else if ( strcmp(*lonit, "corrphiphimass") == 0 ) { - *O815->out->log << "MASTER: registered observable: corr_phiphimass" << endl << flush; - O815->observables.push_back(new obs_corrphiphimass(O815)); + else if ( strcmp(*lonit, "corrchichi") == 0 ) { + *O815->out->log << "MASTER: registered observable: corr_chichi" << endl << flush; + O815->observables.push_back(new obs_corrchichi(O815)); } - else if ( strcmp(*lonit, "corrphichimass") == 0 ) { - *O815->out->log << "MASTER: registered observable: corr_phichimass" << endl << flush; - O815->observables.push_back(new obs_corrphichimass(O815)); + else if ( strcmp(*lonit, "corrphichi") == 0 ) { + *O815->out->log << "MASTER: registered observable: corr_phichi" << endl << flush; + O815->observables.push_back(new obs_corrphichi(O815)); } } }