4 #include "latlib/o815/o815.h"
6 #include "latlib/writeout.h"
8 #include "latlib/obstat.hpp"
14 class obs_phi2 : public o815::obs {
20 obs_phi2(o815 *_O815);
24 void _meas(bool loadedobs);
30 static double phi2Sus(vector< vector<double> > *vals, void *para);
33 obstat<double,double> oPhi2;
36 obs_phi2::obs_phi2(o815 *_O815) : o815::obs("phi2",
37 _O815->paraQ->getParaNames() + "phi2:phi2_err:phi2sus:phi2sus_err",
38 _O815, sizeof(obsmem) ) {
40 Sim = (sim*)O815->Sim;
43 void obs_phi2::_start() {
44 //*out << "OBS_test: start" << endl;
47 void obs_phi2::_meas(bool loadedobs) {
51 oPhi2.addMeas(OM->phi2);
54 void obs_phi2::_finish() {
55 *out << O815->paraQ->getParaVals();
57 int compid_phi2, compid_phi2sus;
59 compid_phi2 = oPhi2.computeEasy();
60 compid_phi2sus = oPhi2.computeJack(obs_phi2::phi2Sus, &(Sim->LSIZE4));
62 *out << "\t" << oPhi2.getMean(compid_phi2) << "\t" << oPhi2.getErr(compid_phi2);
63 *out << "\t" << oPhi2.getMean(compid_phi2sus) << "\t" << oPhi2.getErr(compid_phi2sus);
70 void obs_phi2::phi2Compute()
74 for (int ix = 0; ix < Sim->LSIZE4; ix++)
75 OM->phi2 += norm( Sim->conf[ix].phi );
77 OM->phi2 /= Sim->LSIZE4;
80 double obs_phi2::phi2Sus(vector< vector<double> > *vals, void *para) {
81 double mean=0, mean2=0;
82 for(vector< vector<double> >::iterator valIt = vals->begin(); valIt != vals->end(); ++valIt)
85 mean2 += pow((*valIt)[0],2);
88 mean2 /= vals->size();
90 return ( mean2 - pow(mean,2) ) * *(int*)para;