#include #include #include #include #include #include using namespace std; #include #include #include #include #include #include #include #include #include "TGraphErrors.h" #include "Fit/Fitter.h" #include "Fit/BinData.h" #include "Fit/Chi2FCN.h" #include "TList.h" #include "Math/WrappedMultiTF1.h" #include "HFitInterface.h" #include "TCanvas.h" #include "TStyle.h" #include "TSpline.h" Double_t spline_4nodes(Double_t *x, Double_t *par) { //Fit parameters: //par[0-3]=X of nodes (to be fixed in the fit!) //par[4-7]=Y of nodes //par[8-9]=first derivative at begin and end (to be fixed in the fit!) Double_t xx = x[0]; Double_t xn[3] = { par[0], par[1], par[2] }; Double_t yn[3] = { par[3], par[4], par[5] }; TSpline3 sp3("sp3", xn, yn, 3,"b1e1_eval"); return sp3.Eval(xx); } void pauli_EATM(){ const int pts = 3; Double_t x_C6[pts] = {-1.4343,-0.172143, -0.999988}; Double_t y_C6[pts] = { 178804, 205230, 191276}; TSpline3 sp_eval_see6("sp_eval_see6", x_C6, y_C6, pts,"b1e1", 0, 0); int fit_pts_x_y_dy_dx = 6; float xmin = -1.1, xmax = 1.1; TCanvas* danny1 = new TCanvas ("danny1", "Interpolation", 600, 400); TF1 *f_splineC6 = new TF1("f_splineC6", spline_4nodes, xmin, xmax, fit_pts_x_y_dy_dx); // npars = 2*nodes+2 f_splineC6->SetParameter(0, x_C6[0]); f_splineC6->FixParameter(0, x_C6[0]); f_splineC6->SetParameter(1, x_C6[1]); f_splineC6->FixParameter(1, x_C6[1]); f_splineC6->SetParameter(2, x_C6[2]); f_splineC6->FixParameter(2, x_C6[2]); f_splineC6->SetParameter(3, y_C6[0]); f_splineC6->FixParameter(3, y_C6[0]); f_splineC6->SetParameter(4, y_C6[1]); f_splineC6->FixParameter(4, y_C6[1]); f_splineC6->SetParameter(5, y_C6[2]); f_splineC6->FixParameter(5, y_C6[2]); f_splineC6->GetXaxis()->SetRangeUser(-1.1, 1.1); f_splineC6->GetXaxis()->SetTitle("cos(#theta)"); f_splineC6->GetYaxis()->SetTitle("C6 (meV #AA^{6})"); f_splineC6->GetYaxis()->SetRangeUser(184000,210000); f_splineC6->SetLineColor(14); f_splineC6->SetLineWidth(3); f_splineC6->SetMarkerStyle(22); f_splineC6->SetTitle ("Fit C6 vs cos(#theta)"); f_splineC6->Draw ("L"); double angles[20] = {cos(0*TMath::Pi()/180.), cos(15*TMath::Pi()/180.), cos(30*TMath::Pi()/180.), cos(45*TMath::Pi()/180.), cos(60*TMath::Pi()/180.), cos(65*TMath::Pi()/180.), cos(70*TMath::Pi()/180.), cos(75*TMath::Pi()/180.), cos(80*TMath::Pi()/180.), cos(85*TMath::Pi()/180.), 0*cos(90*TMath::Pi()/180.), cos(95*TMath::Pi()/180.), cos(100*TMath::Pi()/180.), cos(105*TMath::Pi()/180.), cos(112.5*TMath::Pi()/180.), cos(120*TMath::Pi()/180.), cos(135*TMath::Pi()/180.), cos(150*TMath::Pi()/180.), cos(165*TMath::Pi()/180.), cos(179.6*TMath::Pi()/180.) }; double Csix[20] = {sp_eval_see6.Eval(cos(0*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(15*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(30*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(45*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(60*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(65*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(70*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(75*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(80*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(85*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(90*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(95*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(100*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(105*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(112.6*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(120*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(135*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(150*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(165*TMath::Pi()/180.)) , sp_eval_see6.Eval(cos(179.6*TMath::Pi()/180.)) }; TGraph * graph1 = new TGraph(20, angles, Csix); graph1->SetMarkerSize(1); graph1->SetMarkerColor(kRed); graph1->SetMarkerStyle(20); graph1->SetLineColor(0); graph1->SetLineWidth(0); graph1->Draw("SAME LP"); double why ; cout << f_splineC6->Eval(cos(179.6*TMath::Pi()/180.)) >> endl; }