////////-----------//////// #ifndef __CINT__ #include "RooGlobalFunc.h" #endif #include #include #include #include #include #include #include //#include #include "RooFit.h"// #include "RooRealVar.h" #include "RooAbsPdf.h" #include "RooAddPdf.h" #include "RooDataSet.h" #include "RooDataHist.h" #include "RooGaussian.h" #include "RooGlobalFunc.h" #include "RooBifurGauss.h" #include "RooLandau.h" #include "RooChebychev.h" #include "RooFitResult.h" #include "RooNLLVar.h" #include "RooMinuit.h" #include "RooPlot.h" #include "RooArgList.h" #include "RooHist.h" //#include "RooDstarBG.h" // for the threshold function #include "TLine.h" #include "TFile.h" #include "TCanvas.h" #include "TTree.h" #include "TH1.h" #include "TH1F.h" #include "TRandom.h" #include "TString.h" #include "TApplication.h" #include "TROOT.h" #include "TPad.h" //#include "RooFitModels.h" #include "RooDstD0BG.h" // will be used for fitting deltam of combinatoric background using namespace RooFit ; using namespace std ; int t_error() { //----------------new block-----------------// gROOT->LoadMacro("/Users/amansangal/Desktop/Desk_top/re_reconstruct/style_file/style.C"); // gStyle->SetLegendBorderSize(0); RooRealVar dt("dt","M_{D_{s}^{+}}(GeV/c^{2})",0,0.0009); RooDataSet* data1 = (RooDataSet*)RooDataSet::read("signal_new.txt",RooArgSet(dt),"Q"); data1->Print("V"); RooPlot* frame = dt.frame(Title("Mass D_{s}^{+}"));// making a frame linking to variable mdz(Bins()) data1->plotOn(frame,Binning(60));// plotting all the data on the frame*/ //----------------------BLOCK 4------------------------// //--------here start constructing the models to be used for fitting -----------// RooRealVar mean("mean","mean",0.0001,0,0.0006); RooRealVar sigma("sigma","sigma",0.00004,0,0.0008); RooGaussian gauss1("gauss1","gauss1",dt,mean,sigma); RooRealVar tau("tau","tau",0.0004,0.000002,0.0009); RooRealVar fr_g("fr_g","fr_g",0.5,0,1); //--------------Johnson Su function -----------------// RooRealVar xi("xi","xi",0.00002,0,0.00006); RooRealVar lambda("lambda","lambda",0.00003,0,0.0003); RooRealVar delta("delta","delta",1,0,5); RooRealVar gamma("gamma","gamma",-2,-20,2); RooJohnson jsu("jsu","jsu",dt,xi,lambda,gamma,delta); RooAddPdf gjsu("gjsu","gjsu",RooArgList(gauss1,jsu),RooArgList(fr_g)); gjsu.fitTo(*data1,Minos(0),Save(),Timer(kTRUE),Hesse(0)); RooFitResult* fitres = gjsu.fitTo(*data1,Minos(1),Save(),Timer(kTRUE),Hesse(0)); gjsu.plotOn(frame,Name("Total pdf"),LineColor(kBlue)); gjsu.paramOn(frame); RooArgSet* params = gjsu.getParameters(dt) ; //--------------getting # of parameters-------------// RooArgSet observables(dt); RooArgSet *flparams = gjsu.getParameters(observables); int nparam = (flparams->selectByAttrib("Constant",kFALSE))->getSize(); cout<<" ndf are "<chiSquare(nparam);// cout<<"chi square = "<SetFillColor(10); box->SetBorderSize(1); box->SetTextAlign(12); box->SetTextSize(0.04F); box->SetFillStyle(1001); box->SetFillColor(10); TText *text = 0; Char_t buf[30]; sprintf( buf, "#chi^{2}/ndf = %f", chi2_ndf ); text = box->AddText( buf ); frame->addObject(box) ; /////////////pull distribution//////////////// //****************************** RooPlot* z1frame = dt.frame(Title("Pull Distribution")); RooHist* hpull1 = frame->pullHist(); hpull1->SetLineColor(0); hpull1->SetFillColor(kBlue); z1frame->addPlotable(hpull1,"B");// p is drawing option. TCanvas* c1 = new TCanvas("c1","c1",550,400) ; c1->Divide(1,2) ; // column, row double xmin = 0; double xmax = 0.0009; TLine *line = new TLine(xmin,0.0,xmax,0.0); TLine *line1 = new TLine(xmin,-3.0,xmax,-3.0); TLine *line2 = new TLine(xmin,3.0,xmax,3.0); c1->cd(2)->SetPad(0.005,0.005,0.995,0.2525); line->SetLineColor(kRed); line->SetLineWidth(2); //gPad->SetLeftMargin(0.15); //z1frame->GetYaxis()->SetTitleOffset(1.45); z1frame->GetYaxis()->SetTitle("Pull(#sigma)"); z1frame->GetYaxis()->SetTitleSize(0.10); z1frame->GetYaxis()->SetTitleOffset(0.37); z1frame->GetYaxis()->SetLabelSize(0.13); z1frame->GetXaxis()->CenterTitle(); z1frame->Draw(); line1->SetLineColor(kRed); line1->SetLineWidth(3); line1->SetLineStyle(2); line2->SetLineColor(kRed); line2->SetLineWidth(3); line2->SetLineStyle(2); line->Draw("SAME"); //z1frame->GetYaxis()->SetRangeUser(-3.5, 3.5); line1->Draw("SAME"); line2->Draw("SAME"); c1->cd(1)->SetPad(0.005,0.2525,0.995,0.995); //gPad->SetLeftMargin(0.15); //frame->GetYaxis()->SetTitleOffset(1.45); frame->GetXaxis()->CenterTitle(); gjsu.plotOn(frame); frame->Draw(); c1->Draw(); fitres->Print(); params->printLatex() ; // cout<<"the total no. of events are "<