// int roomodel(){ // RooRealVar x ("x","observable",-10,15); // RooRealVar mean("mean","mean of the dist",5.4,"GeV"); // RooRealVar sigma("sigma","std deviaton",2); // RooGaussian model("model","our pdf",x,mean,sigma); // // creating a empty plot frame // RooPlot* xframe = x.frame(); // model.plotOn(xframe); // xframe->Draw(); // } // #include"TF1.h" using namespace RooFit; // double ROOT::Math::chisquared_cdf_c ( double x, // double r, // double x0 = 0 // ) ; void roomodel(){ TFile *myfile =new TFile("sel_BsToPhiMuMu_OfficialMC_signal_2016Mini_Presel_v2_mc.lite_cut_bdt_s86000000.root","READ"); TTree *mytree =(TTree*)myfile->Get("tree"); //we want to read out the tree,so we have to make a reeference double Bmassi; mytree->SetBranchAddress("Bmass",&Bmassi); int entries = mytree->GetEntries(); cout<GetEntry(i); // cout<Fill(Bmassi); } RooRealVar x("x", "x", 4.6,5.7); RooDataHist dh("dh", "dh", x, Import(*hist)); RooPlot *frame = x.frame(); dh.plotOn(frame); RooRealVar mean("mean", "mean", 0, 0, 10); RooRealVar sigma("sigma", "sigma", 3, 0.001, 10); RooGaussian gauss("gauss", "gauss", x, mean, sigma); gauss.fitTo(dh,"R"); gauss.plotOn(frame); frame->Draw(); }