//*********************************************************** // Double Side Crystall Ball parameters fit // Author: Mi Ran KIM // Sungkyunkwan University.South Korea // 7th Oct 2022 at CREN //Run this code: root -l DCB_ParFit_reDrawDCB_M300toM300.C //********************************************************** #include #include #include #include #include #include #include "TGraphErrors.h" #include #include #include #include #include #include #include #include "RooRealVar.h" #include "RooDataSet.h" #include "RooGaussian.h" #include "RooPlot.h" #include "RooHist.h" using namespace std; using namespace RooFit; //exp dell root:"exp([0]*x+[1] Double_t fitEXP(Double_t *x, Double_t *par) { Double_t EXP=par[0]*exp(par[1]*x[0]); return EXP; } void DCB_ParFit_reDrawDCB_M300toM3000() { gStyle->SetLegendBorderSize(0);//Without legend board gStyle->SetOptFit(11111111);//1101 fa vedere risultato del fit int nM=13;//number of mass point:750,800,900,1000,1500,2000,2500,3000 //double Mass[nM]; //double Mass_err[nM]; double Mass[13]={450,500,550,600,700,750,800,900,1000,1500,2000,2500,3000};//Mass double Mass_err[13]={0.};//Mass double DCB_M1000[6]={0.}; double DCB_M2000[6]={0.}; cout<<"Defininiton of parameter"<SetTitle("a1_2e2q_ggH"); //a1_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); a1_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //a1_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //a1_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); a1_2e2q_ggH->SetMarkerColor(kBlue);//6 a1_2e2q_ggH->SetMarkerStyle(20);//34 a1_2e2q_ggH->SetMarkerSize(0.8);//34 a1_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); a1_2e2q_ggH->GetYaxis()->SetTitle("a1"); //a1_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //---TGR:a2--- auto a2_2e2q_ggH=new TGraphErrors(nM,Mass,dcbPara_a2_2e2q_ggH,Mass_err,dcbPara_a2_2e2q_ggH_err); a2_2e2q_ggH->SetTitle("a2_2e2q_ggH"); //a1_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); a2_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //a1_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //a1_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); a2_2e2q_ggH->SetMarkerColor(kMagenta);//6 a2_2e2q_ggH->SetMarkerStyle(20);//34 a2_2e2q_ggH->SetMarkerSize(0.8);//34 a2_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); a2_2e2q_ggH->GetYaxis()->SetTitle("a2"); //a1_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //---TGR:mean--- auto mean_2e2q_ggH=new TGraphErrors(nM,Mass,dcbPara_mean_2e2q_ggH,Mass_err,dcbPara_mean_2e2q_ggH_err); mean_2e2q_ggH->SetTitle("mean_2e2q_ggH"); //a1_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); mean_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //a1_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //a1_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); mean_2e2q_ggH->SetMarkerColor(kRed);//6 mean_2e2q_ggH->SetMarkerStyle(20);//34 mean_2e2q_ggH->SetMarkerSize(0.8);//34 mean_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); mean_2e2q_ggH->GetYaxis()->SetTitle("mean"); //a1_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //---TGR:sigma--- auto sigma_2e2q_ggH=new TGraphErrors(nM,Mass,dcbPara_sigma_2e2q_ggH,Mass_err,dcbPara_sigma_2e2q_ggH_err); sigma_2e2q_ggH->SetTitle("sigma_2e2q_ggH"); //a1_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); sigma_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //a1_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //a1_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); sigma_2e2q_ggH->SetMarkerColor(kGreen);//6 sigma_2e2q_ggH->SetMarkerStyle(20);//34 sigma_2e2q_ggH->SetMarkerSize(0.8);//34 sigma_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); sigma_2e2q_ggH->GetYaxis()->SetTitle("sigma"); //a1_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //---TGR:n1--- auto n1_2e2q_ggH=new TGraphErrors(nM,Mass,dcbPara_n1_2e2q_ggH,Mass_err,dcbPara_n1_2e2q_ggH_err); n1_2e2q_ggH->SetTitle("n1_2e2q_ggH"); //n1_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); n1_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //n1_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //n1_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); n1_2e2q_ggH->SetMarkerColor(kCyan);//6 n1_2e2q_ggH->SetMarkerStyle(20);//34 n1_2e2q_ggH->SetMarkerSize(0.8);//34 n1_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); n1_2e2q_ggH->GetYaxis()->SetTitle("n1"); //a1_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //---TGR:n2--- auto n2_2e2q_ggH=new TGraphErrors(nM,Mass,dcbPara_n2_2e2q_ggH,Mass_err,dcbPara_n2_2e2q_ggH_err); n2_2e2q_ggH->SetTitle("n2_2e2q_ggH"); //n2_2e2q_ggH->GetYaxis()->SetLabelSize(0.03); n2_2e2q_ggH->GetYaxis()->SetTitleSize(0.1); //n2_2e2q_ggH->GetXaxis()->SetLabelSize(0.03); //n2_2e2q_ggH->GetXaxis()->SetTitleSize(0.03); n2_2e2q_ggH->SetMarkerColor(kOrange+7);//6 n2_2e2q_ggH->SetMarkerStyle(20);//34 n2_2e2q_ggH->SetMarkerSize(0.8);//34 n2_2e2q_ggH->GetXaxis()->SetTitle("Mass (GeV)"); n2_2e2q_ggH->GetYaxis()->SetTitle("n2"); //n2_2e2q_ggH->GetYaxis()->SetLabelOffset(0.2); //----TGR:DCR_all--- TMultiGraph *DCB_2e2q_ggH = new TMultiGraph(); TLegend *lgd_DCB_2e2q_ggH=new TLegend(0.6,0.5,0.75,0.75); lgd_DCB_2e2q_ggH->SetFillColor(kWhite); DCB_2e2q_ggH->Add(a1_2e2q_ggH); DCB_2e2q_ggH->Add(a2_2e2q_ggH); DCB_2e2q_ggH->Add(mean_2e2q_ggH); DCB_2e2q_ggH->Add(sigma_2e2q_ggH); DCB_2e2q_ggH->Add(n1_2e2q_ggH); DCB_2e2q_ggH->Add(n2_2e2q_ggH); cout<<"Hello"<GetXaxis()->SetTitle("Mass (GeV)");//CRASH // DCB_2e2q_ggH->GetYaxis()->SetTitle("Double Crystall Ball parameters");//CRASH //-----Legend(lgd) for Tmultigraph--------- lgd_DCB_2e2q_ggH->AddEntry(a1_2e2q_ggH,"a1"); lgd_DCB_2e2q_ggH->AddEntry(a2_2e2q_ggH,"a2"); lgd_DCB_2e2q_ggH->AddEntry(mean_2e2q_ggH,"mean"); lgd_DCB_2e2q_ggH->AddEntry(sigma_2e2q_ggH,"sigma"); lgd_DCB_2e2q_ggH->AddEntry(n1_2e2q_ggH,"n1"); lgd_DCB_2e2q_ggH->AddEntry(n2_2e2q_ggH,"n2"); cout<<"Definiton of function"<SetLineColor(kBlue-4); a1_PN->SetLineWidth(1); //a1_PN->SetLineStyle(2); TF1 *a2_PN=new TF1("a2_PN","pol4",300,3100);//background+coda//1900,3100,pol3 double a2_PN_par[20]; a2_PN->SetLineColor(kMagenta-4); a2_PN->SetLineWidth(1); //a2_PN->SetLineStyle(2); TF1 *mean_PN=new TF1("mean_PN","pol3",300,3100);//background+coda//1900,3100 double mean_PN_par[10]; mean_PN->SetLineColor(kRed-4); mean_PN->SetLineWidth(1); //mean_PN->SetLineStyle(2); TF1 *sigma_PN=new TF1("sigma_PN","pol4",300,3100);//background+coda//1900,3100 double sigma_PN_par[10]; sigma_PN->SetLineColor(kGreen-4); sigma_PN->SetLineWidth(1); //sigma_PN->SetLineStyle(2); //exp dell root:"exp([0]*x+[1] //TF1 *n1_PN=new TF1("n1_PN","expo",300,3100);//background+coda//1900,3100 TF1 *n1_PN=new TF1("n1_PN","expo(0)+pol1(2)",300,3100);//background+coda//1900,3100 //TF1 *n1_PN=new TF1("n1_PN",fitEXP,300,3100,2);//background+coda//1900,3100 //TF1 *n1_PN=new TF1("n1_PN","pol2",300,3100);//background+coda//1900,3100 double n1_PN_par[10]; n1_PN->SetLineColor(kCyan-4); n1_PN->SetLineWidth(1); //n1_PN->SetLineStyle(2); TF1 *n2_PN=new TF1("n2_PN","pol4",300,3100);//background+coda//1900,3100 //TF1 *n2_PN=new TF1("n2_PN","expo(0)+pol(2)",300,3100);//background+coda//1900,3100 //TF1 *n2_PN=new TF1("n2_PN","expo",300,3100);//background+coda//1900,3100 //TF1 *n2_PN=new TF1("n2_PN","pol2(0)+sinx(3)",300,3100);//background+coda//1900,3100 double n2_PN_par[10]; n2_PN->SetLineColor(kOrange-4); n2_PN->SetLineWidth(1); //n2_PN->SetLineStyle(2); cout<<"Definition of Spline"<SetFillColor(kWhite); lgd_FN_DCB_2e2q_ggH->AddEntry(a1_PN,"a1:pol4");//a1:pol3 lgd_FN_DCB_2e2q_ggH->AddEntry(a2_PN,"a2:pol4");//a2:pol3 lgd_FN_DCB_2e2q_ggH->AddEntry(mean_PN,"mean:pol3");//mean:pol2 lgd_FN_DCB_2e2q_ggH->AddEntry(sigma_PN,"sigma:pol4");//sigma:pol3 lgd_FN_DCB_2e2q_ggH->AddEntry(n1_PN,"n1:expo+pol1");//n1:pol3 lgd_FN_DCB_2e2q_ggH->AddEntry(n2_PN,"n2:pol4");//n2:p0l3 TLegend *lgd_FN_a1_2e2q_ggH=new TLegend(0.6,0.4,0.75,0.5); lgd_FN_a1_2e2q_ggH->SetFillColor(kWhite); lgd_FN_a1_2e2q_ggH->AddEntry(a1_PN,"a1:pol4");//a1:pol3" TLegend *lgd_FN_a2_2e2q_ggH=new TLegend(0.6,0.6,0.75,0.7);//"a2:pol3 lgd_FN_a2_2e2q_ggH->SetFillColor(kWhite); lgd_FN_a2_2e2q_ggH->AddEntry(a2_PN,"a2:pol4"); TLegend *lgd_FN_mean_2e2q_ggH=new TLegend(0.6,0.6,0.8,0.7); lgd_FN_mean_2e2q_ggH->SetFillColor(kWhite); lgd_FN_mean_2e2q_ggH->AddEntry(mean_PN,"mean:pol3");//mean:pol2 TLegend *lgd_FN_sigma_2e2q_ggH=new TLegend(0.6,0.4,0.8,0.5); lgd_FN_sigma_2e2q_ggH->SetFillColor(kWhite); lgd_FN_sigma_2e2q_ggH->AddEntry(sigma_PN,"sigma:pol4");//signma:pol3 TLegend *lgd_FN_n1_2e2q_ggH=new TLegend(0.55,0.4,0.85,0.5); lgd_FN_n1_2e2q_ggH->SetFillColor(kWhite); lgd_FN_n1_2e2q_ggH->AddEntry(n1_PN,"n1:exp+pol1");//n1:pol3 //lgd_FN_n1_2e2q_ggH->AddEntry(spline3_n1,"n1:Spl3"); TLegend *lgd_FN_n2_2e2q_ggH=new TLegend(0.7,0.6,0.85,0.7); lgd_FN_n2_2e2q_ggH->SetFillColor(kWhite); lgd_FN_n2_2e2q_ggH->AddEntry(n2_PN,"n2:pol4");//n2:pol3 //============Draw TGraph======================= //gPad->SetTickx(1); ///gPad->SetTicky(1); double w1=1200; double hh1=800; auto *C_DCB_2e2q_ggH=new TCanvas("C_DCB_2e2q_ggH","C_DCB_2e2q_ggH",w1,hh1); C_DCB_2e2q_ggH->SetWindowSize(w1+(w1-C_DCB_2e2q_ggH->GetWw()),hh1+(hh1-C_DCB_2e2q_ggH->GetWh())); C_DCB_2e2q_ggH->Divide(3,2); /* double w2=600; double hh2=600; //double w2=1800; double hh2=600; auto *C_DCBall_2e2q_ggH=new TCanvas("C_DCB_2e2qall_ggH","C_DCB_2e2q_ggH",w2,hh2); C_DCBall_2e2q_ggH->SetWindowSize(w2+(w2-C_DCBall_2e2q_ggH->GetWw()),hh2+(hh2-C_DCBall_2e2q_ggH->GetWh())); */ double w3=600; double hh3=600; auto *C_DCB_Test=new TCanvas("C_DCB_Test","C_DCB_Test",w3,hh3); C_DCB_Test->SetWindowSize(w3+(w3-C_DCB_Test->GetWw()),hh3+(hh3-C_DCB_Test->GetWh())); cout<<"TCanvas"<cd(); //n1_2e2q_ggH->Draw("AP"); //C_DCBall_2e2q_ggH->cd(); //n1_PN->SetParameters(0,-1); n1_2e2q_ggH->Draw("AP"); n1_PN->SetParameters(1,-5.80145e-04); //n1_PN->SetParameters(6.89,-9.045-03); n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); n1_PN->GetParameters(n1_PN_par); n1_PN->SetParameters(n1_PN_par); n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); n1_PN->GetParameters(n1_PN_par); n1_PN->SetParameters(n1_PN_par); n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); n1_PN->GetParameters(n1_PN_par); n1_PN->SetParameters(n1_PN_par); n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); n1_PN->GetParameters(n1_PN_par); n1_PN->SetParameters(n1_PN_par); n1_PN->Draw("Same"); lgd_FN_n1_2e2q_ggH->Draw("same"); //spline3_n1->Draw("lcpsame"); DCB_M1000[4]=n1_PN->Eval(2000); /* //----6 prarmeters------ //----a1-----------// //C_DCBall_2e2q_ggH->cd(1); C_DCB_2e2q_ggH->cd(1); //C_DCB_Test->cd(1); a1_2e2q_ggH->Draw("AP"); a1_2e2q_ggH->Fit("a1_PN","QERMVIN"); a1_PN->GetParameters(a1_PN_par); a1_PN->SetParameters(a1_PN_par); a1_2e2q_ggH->Fit("a1_PN","QERMVIN"); a1_PN->GetParameters(a1_PN_par); a1_PN->SetParameters(a1_PN_par); a1_2e2q_ggH->Fit("a1_PN","QERMVIN"); a1_PN->GetParameters(a1_PN_par); a1_PN->SetParameters(a1_PN_par); a1_PN->Draw("Same"); lgd_FN_a1_2e2q_ggH->Draw("same"); //spline3_a1->Draw("same"); //spline3_a1_1->Draw("lcpsame"); //a1_2e2q_ggH->Fit("spline3"); //spline5_a1->Draw("lcpsame"); //lgd_SPL_DCB_a1->Draw("same"); DCB_M1000[0]=a1_PN->Eval(2000); //----a2-----------// //C_DCB_Test->cd(1); C_DCB_2e2q_ggH->cd(2); //C_DCBall_2e2q_ggH->cd(); a2_2e2q_ggH->Draw("AP"); a2_2e2q_ggH->Fit("a2_PN","QERMVIN"); a2_PN->GetParameters(a2_PN_par); a2_PN->SetParameters(a2_PN_par); a2_2e2q_ggH->Fit("a2_PN","QERMVIN"); a2_PN->GetParameters(a2_PN_par); a2_PN->SetParameters(a2_PN_par); a2_2e2q_ggH->Fit("a2_PN","QERMVIN"); a2_PN->GetParameters(a2_PN_par); a2_PN->SetParameters(a2_PN_par); a2_PN->Draw("Same"); lgd_FN_a2_2e2q_ggH->Draw("same"); //spline3_a2->Draw("lcpsame"); DCB_M1000[1]=a2_PN->Eval(2000); //----mean-----------// //C_DCB_Test->cd(1); //C_DCBall_2e2q_ggH->cd(); C_DCB_2e2q_ggH->cd(3); mean_2e2q_ggH->Draw("AP"); mean_2e2q_ggH->Fit("mean_PN","QERMVIN"); mean_PN->GetParameters(mean_PN_par); mean_PN->SetParameters(mean_PN_par); mean_2e2q_ggH->Fit("mean_PN","QERMVIN"); mean_PN->GetParameters(mean_PN_par); mean_PN->SetParameters(mean_PN_par); mean_2e2q_ggH->Fit("mean_PN","QERMVIN"); mean_PN->GetParameters(mean_PN_par); mean_PN->SetParameters(mean_PN_par); mean_PN->Draw("Same"); lgd_FN_mean_2e2q_ggH->Draw("same"); //spline3_mean->Draw("lcpsame"); DCB_M1000[2]=mean_PN->Eval(2000); //----sigma-----------// //C_DCB_Test->cd(1); C_DCB_2e2q_ggH->cd(4); //C_DCBall_2e2q_ggH->cd(); sigma_2e2q_ggH->Draw("AP"); sigma_2e2q_ggH->Fit("sigma_PN","QERMVIN"); sigma_PN->GetParameters(sigma_PN_par); sigma_PN->SetParameters(sigma_PN_par); sigma_2e2q_ggH->Fit("sigma_PN","QERMVIN"); sigma_PN->GetParameters(sigma_PN_par); sigma_PN->SetParameters(sigma_PN_par); sigma_2e2q_ggH->Fit("sigma_PN","QERMVIN"); sigma_PN->GetParameters(sigma_PN_par); sigma_PN->SetParameters(sigma_PN_par); sigma_PN->Draw("Same"); lgd_FN_sigma_2e2q_ggH->Draw("same"); //spline3_sigma->Draw("lcpsame"); DCB_M1000[3]=sigma_PN->Eval(2000); //----n1-----------// //C_DCB_Test->cd(1); C_DCB_2e2q_ggH->cd(5); //C_DCBall_2e2q_ggH->cd(); //n1_PN->SetParameters(0,-1); //n1_PN->SetParameters(1,-5.80145e-04); n1_2e2q_ggH->Draw("AP"); //n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); //n1_PN->GetParameters(n1_PN_par); //n1_PN->SetParameters(n1_PN_par); //n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); //n1_PN->GetParameters(n1_PN_par); //n1_PN->SetParameters(n1_PN_par); //n1_2e2q_ggH->Fit("n1_PN","QERMVIN"); //n1_PN->GetParameters(n1_PN_par); //n1_PN->SetParameters(n1_PN_par); n1_PN->Draw("Same"); lgd_FN_n1_2e2q_ggH->Draw("same"); //spline3_n1->Draw("lcpsame"); DCB_M1000[4]=n1_PN->Eval(2000); //----n2-----------// //C_DCB_Test->cd(1); C_DCB_2e2q_ggH->cd(6); //C_DCBall_2e2q_ggH->cd(); n2_2e2q_ggH->Draw("AP"); n2_PN->SetParameters(1,10); n2_2e2q_ggH->Fit("n2_PN","QERMVIN"); n2_PN->GetParameters(n2_PN_par); n2_PN->SetParameters(n2_PN_par); n2_2e2q_ggH->Fit("n1_PN","QERMVIN"); n2_PN->GetParameters(n2_PN_par); n2_PN->SetParameters(n2_PN_par); n2_2e2q_ggH->Fit("n1_PN","QERMVIN"); n2_PN->GetParameters(n2_PN_par); n2_PN->SetParameters(n2_PN_par); n2_PN->Draw("Same"); lgd_FN_n2_2e2q_ggH->Draw("same"); //spline3_n2->Draw("lcpsame"); DCB_M1000[5]=n2_PN->Eval(2000); */ C_DCB_2e2q_ggH->Update(); //C_DCB_2e2q_ggH->SaveAs("./fig/DCBpars_2e2q_ggH.pdf"); cout<<"GOOD JOB!"<