Two types of functional GUI's can be made
This commit is contained in:
parent
4f617e27e3
commit
b3c257fff2
BIN
.Chi_error.h.swp
BIN
.Chi_error.h.swp
Binary file not shown.
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
ADEX
|
ADEX
|
||||||
|
ADT
|
||||||
|
.gitignore
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
angle,Y,Yerr
|
|
||||||
45,1.29,.10
|
|
||||||
90,1.10,.10
|
|
||||||
135,1.29,.10
|
|
|
93
AD.cxx
93
AD.cxx
|
@ -1,6 +1,6 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
//#include "GUI.h"
|
#include "GUI_AD.h"
|
||||||
#include "GUI_Base.h"
|
#include "GUI_Base.h"
|
||||||
#include "Functlib.h"
|
#include "Functlib.h"
|
||||||
#include "QDK.h"
|
#include "QDK.h"
|
||||||
|
@ -15,7 +15,6 @@ using namespace std;
|
||||||
|
|
||||||
int main(int argc,char **argv){
|
int main(int argc,char **argv){
|
||||||
|
|
||||||
HistoGUI gui;
|
|
||||||
|
|
||||||
double j1, j2;
|
double j1, j2;
|
||||||
|
|
||||||
|
@ -200,6 +199,8 @@ if( test == 0 ) {
|
||||||
dangler.push_back(aa*3.14159/180.);
|
dangler.push_back(aa*3.14159/180.);
|
||||||
printf("dangle = %lf\n",dangler[i]);
|
printf("dangle = %lf\n",dangler[i]);
|
||||||
}
|
}
|
||||||
|
// if you need to scale the y data by sin(theta)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for(int i=0; i<content.size(); i++){
|
for(int i=0; i<content.size(); i++){
|
||||||
|
@ -210,7 +211,7 @@ if( test == 0 ) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//legendre fitting
|
//legendre fitting
|
||||||
// F[xi] = A0 + A2(P2(xi)) + A4(P4(xi))
|
// F[xi] = A0(1) + A2(P2(cos(xi))) + A4(P4(cos(xi)))
|
||||||
//xi data is angle data in radians.
|
//xi data is angle data in radians.
|
||||||
//yi data is y-intensity data.
|
//yi data is y-intensity data.
|
||||||
|
|
||||||
|
@ -222,8 +223,10 @@ if( test == 0 ) {
|
||||||
//[a5 a6 a7] [A2] = [a8]
|
//[a5 a6 a7] [A2] = [a8]
|
||||||
//[a9 a10 a11] [A4] = [a12]
|
//[a9 a10 a11] [A4] = [a12]
|
||||||
|
|
||||||
double a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12 = 0.;
|
// Note, the y data must be scaled by sin(theta) of the given angle.
|
||||||
|
|
||||||
|
double a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12 = 0.;
|
||||||
|
/*
|
||||||
for(int i = 0; i< dangler.size(); i++){
|
for(int i = 0; i< dangler.size(); i++){
|
||||||
|
|
||||||
//eq1
|
//eq1
|
||||||
|
@ -243,6 +246,29 @@ if( test == 0 ) {
|
||||||
a12 += (35./8. * pow(dangler[i],4) - 30./8. * pow(dangler[i],2) + 3./8. )*dydata[i];
|
a12 += (35./8. * pow(dangler[i],4) - 30./8. * pow(dangler[i],2) + 3./8. )*dydata[i];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
for(int i = 0; i< dangler.size(); i++){
|
||||||
|
|
||||||
|
//eq1
|
||||||
|
a1 += 1; //how many data points, not intensional but convientient.
|
||||||
|
a2 += (1.5 * pow(cos(dangler[i]),2) - .5);
|
||||||
|
a3 += (35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. );
|
||||||
|
a4 += dydata[i];
|
||||||
|
//eq2
|
||||||
|
a5 += (1.5 * pow(cos(dangler[i]),2) - .5);
|
||||||
|
a6 += (1.5 * pow(cos(dangler[i]),2) - .5)*(1.5 * pow(cos(dangler[i]),2) - .5);
|
||||||
|
a7 += (1.5 * pow(cos(dangler[i]),2) - .5)*(35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. );
|
||||||
|
a8 += (1.5 * pow(cos(dangler[i]),2) - .5)*dydata[i];
|
||||||
|
//eq4
|
||||||
|
a9 += (35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. );
|
||||||
|
a10 += (1.5 * pow(cos(dangler[i]),2) - .5)*(35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. );
|
||||||
|
a11 +=(35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. )* (35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. );
|
||||||
|
a12 += (35./8. * pow(cos(dangler[i]),4) - 30./8. * pow(cos(dangler[i]),2) + 3./8. )*dydata[i];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
printf("a1 = %lf\n",a1);
|
printf("a1 = %lf\n",a1);
|
||||||
|
@ -598,7 +624,7 @@ if(test == 0){
|
||||||
double step = 0.001;
|
double step = 0.001;
|
||||||
|
|
||||||
double delta = 0.;
|
double delta = 0.;
|
||||||
double tan_delta =0.;
|
double atan_delta =0.;
|
||||||
double A0E = residual[0];//NEED FrOM AF FIT
|
double A0E = residual[0];//NEED FrOM AF FIT
|
||||||
double A2E = residual[1];
|
double A2E = residual[1];
|
||||||
double A4E = residual[2];
|
double A4E = residual[2];
|
||||||
|
@ -619,8 +645,8 @@ if(test == 0){
|
||||||
vector<double> tdelta;
|
vector<double> tdelta;
|
||||||
|
|
||||||
for(int i = 0; i< points; i++){
|
for(int i = 0; i< points; i++){
|
||||||
tan_delta = i*step + delta_min;
|
atan_delta = i*step + delta_min;
|
||||||
delta = tan(tan_delta);
|
delta = tan(atan_delta);
|
||||||
rd2T = (rk01 + 2*delta*rk11 + pow(delta,2)*rk21)/(1+pow(delta,2));
|
rd2T = (rk01 + 2*delta*rk11 + pow(delta,2)*rk21)/(1+pow(delta,2));
|
||||||
A2T = QD2*Bk11*rd2T;
|
A2T = QD2*Bk11*rd2T;
|
||||||
a2T = A2T/A0E;
|
a2T = A2T/A0E;
|
||||||
|
@ -635,33 +661,43 @@ if(test == 0){
|
||||||
X2_total = (X22 + X24)/2;
|
X2_total = (X22 + X24)/2;
|
||||||
|
|
||||||
chisqr.push_back(-log(X2_total));
|
chisqr.push_back(-log(X2_total));
|
||||||
tdelta.push_back(tan_delta);
|
tdelta.push_back(atan_delta);
|
||||||
|
|
||||||
}
|
}
|
||||||
//NEEDS FIX
|
|
||||||
|
|
||||||
//If gui does this how does the vector pushback here make sense.
|
|
||||||
vector<double> Theta;
|
vector<double> Theta;
|
||||||
vector<double> AD_I;
|
vector<double> AD_I;
|
||||||
double ad_start = -3.1415/2;
|
double ad_start = 0.;
|
||||||
int adpoints = (3.1415)/(step);
|
int adpoints = (3.1415)/(step);
|
||||||
double theta,Iad = 0.;
|
double theta,Iad = 0.;
|
||||||
double aaa,aab,aac = 0.;
|
double aaa,aab,aac = 0.;
|
||||||
for(int i = 0; i < adpoints; i++){
|
for(int i = 0; i < adpoints; i++){
|
||||||
|
|
||||||
theta = i*step + ad_start;
|
theta = i*step + ad_start;
|
||||||
aaa = A0E;
|
aaa = 1.;
|
||||||
aab = A2E*(1.5 * pow(theta,2) - .5);
|
aab = (A2E/A0E)*(1.5 * pow(cos(theta),2) - .5);
|
||||||
aac = A4E*(35./8. * pow(theta,4) - 30./8. * pow(theta,2) + 3./8. );
|
aac = (A4E/A0E)*(35./8. * pow(cos(theta),4) - 30./8. * pow(cos(theta),2) + 3./8. );
|
||||||
|
|
||||||
Iad = aaa + aab + aac;
|
Iad = aaa + aab + aac;
|
||||||
|
|
||||||
AD_I.push_back(Iad);
|
AD_I.push_back(Iad);
|
||||||
Theta.push_back(theta);
|
Theta.push_back(theta);
|
||||||
|
//these arrays arent used, but they are the function (if one just wanted to the legendre fit function that goes over the data.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vector<double> dydatas;
|
||||||
|
|
||||||
|
for(int i = 0; i < dydata.size(); i++){
|
||||||
|
double bbb = dydata[i];
|
||||||
|
|
||||||
|
dydatas.push_back(bbb/A0E);
|
||||||
|
printf("Normalized y-intensity %i = %lf\n",i+1,dydatas[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
//This is to temporarily fix the issue with the AD distribution, it takes off the last point in the arrays when plotting or doesnt see them. NEED FIX
|
||||||
|
dydatas.push_back(A0E);
|
||||||
|
dangler.push_back(3.1415/2.);
|
||||||
|
|
||||||
int param;
|
int param;
|
||||||
|
|
||||||
|
@ -675,6 +711,15 @@ if(test == 0){
|
||||||
|
|
||||||
cout << param << "\n";
|
cout << param << "\n";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//Initialize Graphics Here.
|
||||||
|
|
||||||
|
|
||||||
|
HistoGUI gui;
|
||||||
|
|
||||||
|
HistoGUIad gui_ad;
|
||||||
|
|
||||||
|
|
||||||
int optnum = -1;
|
int optnum = -1;
|
||||||
menu();
|
menu();
|
||||||
|
|
||||||
|
@ -704,6 +749,7 @@ if(test == 0){
|
||||||
//y will be log(X^2);
|
//y will be log(X^2);
|
||||||
|
|
||||||
gui.SetData(tdelta,chisqr);
|
gui.SetData(tdelta,chisqr);
|
||||||
|
//gui.SetData(Theta,AD_I);
|
||||||
gui.Init();
|
gui.Init();
|
||||||
gui.Loop();
|
gui.Loop();
|
||||||
gui.Close();
|
gui.Close();
|
||||||
|
@ -715,20 +761,25 @@ if(test == 0){
|
||||||
// scanf("%d", &optnum);
|
// scanf("%d", &optnum);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Plot Angular distribution fit, with points and error bars.
|
//Plot Angular distribution fit, with points and error bars.
|
||||||
if(param == 1 and optnum == 2){
|
if(param == 1 and optnum == 2){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
gui.SetData(dangler,dydata);
|
gui.SetData(Theta,AD_I);
|
||||||
gui.SetErrors(deydata);
|
|
||||||
gui.SetFit(residual[0],residual[1],residual[2]);
|
|
||||||
|
|
||||||
gui.Init();
|
gui.Init();
|
||||||
gui.Loop();
|
gui.Loop();
|
||||||
gui.Close();
|
gui.Close();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
gui_ad.SetData(dangler,dydatas);
|
||||||
|
gui_ad.SetErrors(deydata);
|
||||||
|
gui_ad.SetFit(residual[0],residual[1],residual[2]);
|
||||||
|
|
||||||
|
gui_ad.Init();
|
||||||
|
gui_ad.Loop();
|
||||||
|
gui_ad.Close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//exit
|
//exit
|
||||||
|
|
9
GUI_AD.h
9
GUI_AD.h
|
@ -55,6 +55,7 @@ class HistoGUIad{
|
||||||
double A0;
|
double A0;
|
||||||
double A2E;
|
double A2E;
|
||||||
double A4E;
|
double A4E;
|
||||||
|
double Ierr;
|
||||||
int SetFit(double a, double b, double c){
|
int SetFit(double a, double b, double c){
|
||||||
A0 = a;
|
A0 = a;
|
||||||
A2E = b;
|
A2E = b;
|
||||||
|
@ -385,7 +386,7 @@ int HistoGUIad::DrawData(double x_low_win, double y_low_win, double x_hi_win, do
|
||||||
for(int i=0; i < x.size() - 1; i++){
|
for(int i=0; i < x.size() - 1; i++){
|
||||||
x_wid = (x[i] + x_offset) / width_scale;
|
x_wid = (x[i] + x_offset) / width_scale;
|
||||||
y_wid = (y[i] + y_offset) / height_scale;
|
y_wid = (y[i] + y_offset) / height_scale;
|
||||||
y_errors_wid = (y_errors[i] / height_scale);
|
y_errors_wid = ((y_errors[i]/A0) / height_scale);
|
||||||
// x_wid2 = (x[i + 1] + x_offset) / width_scale;
|
// x_wid2 = (x[i + 1] + x_offset) / width_scale;
|
||||||
// y_wid2 = (y[i + 1] + y_offset) / height_scale;
|
// y_wid2 = (y[i + 1] + y_offset) / height_scale;
|
||||||
//printf("(%f, %f), (%f,%f)\n", x_wid,y_wid,x_wid2,y_wid2);
|
//printf("(%f, %f), (%f,%f)\n", x_wid,y_wid,x_wid2,y_wid2);
|
||||||
|
@ -424,14 +425,14 @@ int HistoGUIad::DrawData(double x_low_win, double y_low_win, double x_hi_win, do
|
||||||
for(int i=0; i < (int) width; i += w_step){
|
for(int i=0; i < (int) width; i += w_step){
|
||||||
double x_val = i * width_scale - x_offset;
|
double x_val = i * width_scale - x_offset;
|
||||||
sprintf(axis_val, "%.1f", x_val);
|
sprintf(axis_val, "%.1f", x_val);
|
||||||
XDrawString(disp, wind, DefaultGC(disp, screen), i, axis_y + 10, axis_val, strlen(axis_val));
|
XDrawString(disp, wind, DefaultGC(disp, screen), i, axis_y + 10/A0, axis_val, strlen(axis_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
int h_step = height / 10;
|
int h_step = height / 10;
|
||||||
for(int i=0; i < (int) height; i += h_step){
|
for(int i=0; i < (int) height; i += h_step){
|
||||||
double y_val = i * height_scale - y_offset;
|
double y_val = i * height_scale - y_offset;
|
||||||
sprintf(axis_val, "%.1f", y_val);
|
sprintf(axis_val, "%.1f", y_val);
|
||||||
XDrawString(disp, wind, DefaultGC(disp, screen), axis_x + 10, i, axis_val, strlen(axis_val));
|
XDrawString(disp, wind, DefaultGC(disp, screen), axis_x + 10/A0, i, axis_val, strlen(axis_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -447,7 +448,7 @@ int HistoGUIad::DrawData(double x_low_win, double y_low_win, double x_hi_win, do
|
||||||
x_wid = (x[i] + x_offset) / width_scale;
|
x_wid = (x[i] + x_offset) / width_scale;
|
||||||
y_wid = (y[i] + y_offset) / height_scale;
|
y_wid = (y[i] + y_offset) / height_scale;
|
||||||
|
|
||||||
y_errors_wid = (y_errors[i] / height_scale);
|
y_errors_wid = ((y_errors[i]/A0) / height_scale);
|
||||||
|
|
||||||
// x_wid2 = (x[i + 1] + x_offset) / width_scale;
|
// x_wid2 = (x[i + 1] + x_offset) / width_scale;
|
||||||
// y_wid2 = (y[i + 1] + y_offset) / height_scale;
|
// y_wid2 = (y[i + 1] + y_offset) / height_scale;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -210,9 +210,9 @@ double HistoGUI::legval(double theta){
|
||||||
|
|
||||||
double lg;
|
double lg;
|
||||||
|
|
||||||
double aaa = A0;
|
double aaa = A0/A0;
|
||||||
double aab = A2E*(1.5 * pow(theta,2) - .5);
|
double aab = (A2E/A0)*(1.5 * pow(cos(theta),2) - .5);
|
||||||
double aac = A4E*(35./8. * pow(theta,4) - 30./8. * pow(theta,2) + 3./8. );
|
double aac = (A4E/A0)*(35./8. * pow(cos(theta),4) - 30./8. * pow(cos(theta),2) + 3./8. );
|
||||||
|
|
||||||
lg = aaa + aab + aac;
|
lg = aaa + aab + aac;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,13 @@ int main ( int argc, char** argv){
|
||||||
|
|
||||||
HistoGUI gui;
|
HistoGUI gui;
|
||||||
|
|
||||||
double A0E = 134.327;
|
double A0E = 111.514;
|
||||||
double A2E = -11.7874;
|
double A2E = -54.3312;
|
||||||
double A4E = 0.760896;
|
double A4E = -76.4778;
|
||||||
|
|
||||||
|
//double A0E = 134.327;
|
||||||
|
//double A2E = -11.7874;
|
||||||
|
//double A4E = 0.760896;
|
||||||
double step = 0.0001;
|
double step = 0.0001;
|
||||||
|
|
||||||
vector<double> Theta;
|
vector<double> Theta;
|
||||||
|
@ -27,7 +30,7 @@ int main ( int argc, char** argv){
|
||||||
|
|
||||||
Iad = aaa + aab + aac;
|
Iad = aaa + aab + aac;
|
||||||
|
|
||||||
cout << theta << "\n";
|
// cout << theta << "\n";
|
||||||
|
|
||||||
AD_I.push_back(Iad);
|
AD_I.push_back(Iad);
|
||||||
Theta.push_back(theta);
|
Theta.push_back(theta);
|
||||||
|
@ -43,16 +46,16 @@ int main ( int argc, char** argv){
|
||||||
dangle.push_back(1.5619);
|
dangle.push_back(1.5619);
|
||||||
vector<double> dydata;
|
vector<double> dydata;
|
||||||
//= {129.,110.,129.};
|
//= {129.,110.,129.};
|
||||||
dydata.push_back(129.);
|
dydata.push_back(129./A0E);
|
||||||
dydata.push_back(110.);
|
dydata.push_back(110./A0E);
|
||||||
dydata.push_back(129.);
|
dydata.push_back(129./A0E);
|
||||||
dydata.push_back(115.);
|
dydata.push_back(115./A0E);
|
||||||
vector<double> deydata;
|
vector<double> deydata;
|
||||||
//= {10.,10.,10.};
|
//= {10.,10.,10.};
|
||||||
deydata.push_back(10.);
|
deydata.push_back(5.);
|
||||||
deydata.push_back(10.);
|
deydata.push_back(5.);
|
||||||
deydata.push_back(10.);
|
deydata.push_back(5.);
|
||||||
deydata.push_back(10.);
|
deydata.push_back(5.);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
Racah.h
2
Racah.h
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
//this program doesnt work and it is not used, I spent so much time transcribing it that maybe, one day some poor soul will come and try to fix it to match rose and brinks.
|
||||||
|
|
||||||
double RACAH(double A[6]){
|
double RACAH(double A[6]){
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user