Hi,
Actually I don’t know how we call this in each your fields, but just call it ‘model’.
I would like to calculated all values and parameters, that is, dx, dy, a0, a1, a2, b0, b1 and b2.
dx = a0 + a1x + a2y
dy = b0 + b1y + b2x
by simultaneous fit.
Can we do it inside ROOT frame using MINUIT or something by minimizing chi-square?
Could you let me have hints to do it from the scratch?
As figure shown below , data points need to be matched to reference by following above model equations.
I attach data points for example. Hope to be clear about my questions.
Thanks in advance,
H. H
void fit() {
TCanvas *c = new TCanvas(“c”,“”,800,400);
c->Divide(2,1);
// Referene to be fitted
c->cd(1);
gPad->SetGrid();
const Int_t n = 9;
Float_t x_ref[n] = {-10,-10,-10,0,0,0,10,10,10};
Float_t y_ref[n] = {-10,0,10,-10,0,10,-10,0,10};
TGraph *gr_ref = new TGraph(n,x_ref,y_ref);
gr_ref->SetTitle(“Reference”);
gr_ref->SetMarkerColor(4);
gr_ref->SetMarkerStyle(21);
gr_ref->Draw(“AP”);
// Data
c->cd(2);
gPad->SetGrid();
Float_t x[n] = {-11,-10,-12,1,1,0,11,12,11};
Float_t y[n] = {-12,1,11,-10,1,12,-10,0,11};
TGraph *gr = new TGraph(n,x,y);
gr->SetTitle(“Data”);
gr->SetMarkerColor(2);
gr->SetMarkerStyle(22);
gr->Draw(“AP”);
/*
// Chisq : Assume no covariance between x and y
Float_t chi;
for (Int_t i = 0; i<12; i++) {
dx = x_ref[i] - x[i]; dy = y_ref[i] - y[i]; chi +=dx*dy;
}
*/
}