Hello,
I am very very new to C in general and even more out of my depth with Roofit. For the project that I am working on there is a C script that does the Chi2FitTo for a given model. Now when I run the code in terminal, I see the 5 parameters and their errors well and good. But I was interested in extracting them to do further operations.
As seen below the GetParameter(i) works well, but when I run GetParError(i), I get 0 for all of them. I looked at the documentation and it is supposed to return 0 when either i <0 or i > NPar (number of parameters), which is decidedly not happening. I am not sure why I am getting 0s, and would appreciate any help in this regard. Thank you.
// This sets the starting parameters for the fit
RooRealVar FF_ga("FF_ga", "FF_ga", .146, 0, 10);
RooRealVar FF_tau_a("FF_tau_a", "FF_tau_a", 45 ,0, 2000);
//RooRealVar FF_tau_a("FF_tau_a", "FF_tau_a", 52.8 ,52.8, 52.8);
RooRealVar FF_gY("FF_gY", "FF_gY", .096, 0, 200);
RooRealVar FF_tau_Y("FF_tau_Y", "FF_tau_Y", 1000, 0, 20000);
// RooRealVar FF_tau_Y("FF_tau_Y", "FF_tau_Y", 2296, 2296, 2296);
RooRealVar FF_gC("FF_gC", "FF_gC", .2,0, 100);
// This defines the function to be fitted
// Neff is a function defined earlier
//
TF1 *Neff_CCE = new TF1("Neff_CCE",Neff,0.,+200000, 5);
// This binds the RootFit variable f to function Neff_CCE from TF1 above
// Create an observable
// Create binding of above TF1 to observable
RooArgSet pars(FF_ga,FF_tau_a,FF_gY,FF_tau_Y,FF_gC); //
RooAbsReal *CCE = bindFunction(Neff_CCE, xt, pars);
// Print CCE definition
CCE->Print();
// try approach from fitgen3 exampl
// RooDataHist* db = new RooDataHist("db", "db", RooArgSet(xt,yt) ) ;
// RooChi2Var chi2("chi2", "chi2", CCE, db);
//
RooPlot *frame3 = xt.frame(Title("Leena Data 2e15 at 40 degree ;Annealing Time in min; Collected Charge in ke"));
// P e r f o r m c h i 2 f i t t o X + / - d x a n d Y + / - d Y v a l u e s
// --------------------------------------------------------------------------------------
// Plot dataset in X-Y interpretation
RooPlot *frame4 = xt.frame(Title("Chi^2 fit of function set of (X#pmdX,Y#pmdY) values"));
dxy.plotOnXY(frame4, YVar(yt));
cout << " After dxy.Plot " << endl;
// Fit chi^2 using X and Y errors
CCE->chi2FitTo(dxy, YVar(yt), "Q", Save(1));
cout << "After Chi2 fit" << endl;
// Overlay fitted function
CCE->plotOn(frame3, LineColor(kGreen));
Double_t ga = Neff_CCE->GetParameter(0);
Double_t tau_a = Neff_CCE->GetParameter(1);
Double_t gY = Neff_CCE->GetParameter(2);
Double_t tau_Y = Neff_CCE->GetParameter(3);
Double_t gC = Neff_CCE->GetParameter(4);
Double_t covMatrix = Neff_CCE->GetParError(0);
cout << "#### ERROR 1 ### " << Neff_CCE -> GetParameter(0) << endl;
cout << "#### ERROR 2 ### " << Neff_CCE -> GetParError(1) << endl;
cout << "#### ERROR 3 ### " << Neff_CCE -> GetParError(2) << endl;
cout << "#### ERROR 4 ### " << Neff_CCE -> GetParError(3) << endl;
cout << "#### ERROR 5 ### " << Neff_CCE -> GetParError(5) << endl;