RooFitResult extraction

Dear experts,

I am new to RooFit.
I am using combine tool to do fittings which by default interface with RooFit and it created a diagnostics file that includes all fit results,

[nbarakat@m5 2018_10_19_REV_1]$ root -l fitDiagnostics_ChHadIso_2-5_Pt_200.root
root [0]
Attaching file fitDiagnostics_ChHadIso_2-5_Pt_200.root as _file0…
(TFile ) 0x2a566e0
root [1] .ls
TFile
* fitDiagnostics_ChHadIso_2-5_Pt_200.root
TFile* fitDiagnostics_ChHadIso_2-5_Pt_200.root
KEY: RooArgSet norm_prefit;1 Set of RooAbsArg objects
KEY: TProcessID ProcessID0;1 de1ce992-d398-11e8-9717-23ac3ac1beef
KEY: RooFitResult nuisances_prefit_res;1
KEY: RooArgSet nuisances_prefit;1 Set of RooAbsArg objects
KEY: RooPlot signal_CMS_th1x_prefit;1 signal
KEY: RooFitResult fit_b;1
KEY: RooPlot signal_CMS_th1x_fit_b;1 signal
KEY: RooArgSet norm_fit_b;1 Set of RooAbsArg objects
KEY: TH2D covariance_fit_b;1 Correlation matrix of fit parameters
KEY: RooFitResult fit_s;1
KEY: RooPlot signal_CMS_th1x_fit_s;1 signal
KEY: RooArgSet norm_fit_s;1 Set of RooAbsArg objects
KEY: TH2D covariance_fit_s;1 Correlation matrix of fit parameters
KEY: TTree tree_fit_sb;1 tree_fit_sb
KEY: TTree tree_fit_b;1 tree_fit_b
KEY: TTree tree_prefit;1 tree_prefit
root [2] fit_s->Print()

RooFitResult: minimized FCN value: -1212.86, estimated distance to minimum: 2.24756e-06
covariance matrix quality: Full, accurate covariance matrix
Status : MINIMIZE=0 HESSE=0

Floating Parameter    FinalValue +/-  Error   

          CMS_lumi    2.0067e-03 +/-  1.02e+00
                fs    9.1074e-01 +/-  5.39e-03
                 r    1.0241e+00 +/-  2.66e-02

root [3]

I want to extract the value fs appended in fit_s to calculate the bias of our templates.
How to do that?

Thanks alot for your help.

May be @StephanH can help.

I know the answer now. For whom it may interest :

  RooFitResult* res= (RooFitResult*) f->Get("fit_s"); 
  RooArgSet fitargs = res->floatParsFinal();

  TIterator* iter(fitargs.createIterator());

  for (TObject *a = iter->Next(); a != 0; a = iter->Next()) {
    RooRealVar *rrv = dynamic_cast<RooRealVar *>(a);      
    std::string name = rrv->GetName();
    cout<< rrv->getVal() <<"  +/-  "<<rrv->getError();
	}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.