void pedestal_width_data(void) { char string[256]; //=========Macro generated from canvas: c3/c3g gROOT->Reset(); gStyle->SetPalette(1,0); //TTree *Bfield = (TTree *) gROOT->FindObject("Bfield"); gStyle->SetPalette(1,0); gStyle->SetOptStat(kFALSE); gStyle->SetOptFit(kFALSE); // gStyle->SetOptFit(1111); gStyle->SetPadRightMargin(0.15); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); // gStyle->SetFillColor(0); // input simulation data from pedestal_width_vover.C TH1D *h2_vover_4 = new TH1D("h2_vover_4","",11,0,2.2); h2_vover_4->SetBinContent(1,1.199894); h2_vover_4->SetBinContent(2,1.207158); h2_vover_4->SetBinContent(3,1.217556); h2_vover_4->SetBinContent(4,1.226875); h2_vover_4->SetBinContent(5,1.277582); h2_vover_4->SetBinContent(6,1.338804); h2_vover_4->SetBinContent(7,1.381932); h2_vover_4->SetBinContent(8,1.464386); h2_vover_4->SetBinContent(9,1.580163); h2_vover_4->SetBinContent(10,1.770427); h2_vover_4->SetBinContent(11,1.909945); h2_vover_4->SetBinError(1,0.008603802); h2_vover_4->SetBinError(2,0.008334468); h2_vover_4->SetBinError(3,0.008691162); h2_vover_4->SetBinError(4,0.008653266); h2_vover_4->SetBinError(5,0.008867018); h2_vover_4->SetBinError(6,0.009636698); h2_vover_4->SetBinError(7,0.0100516); h2_vover_4->SetBinError(8,0.009991336); h2_vover_4->SetBinError(9,0.01093789); h2_vover_4->SetBinError(10,0.01292918); h2_vover_4->SetBinError(11,0.01315615); TH1D *h2_vover_3 = new TH1D("h2_vover_3","",11,0,2.2); h2_vover_3->SetBinContent(1,1.199601); h2_vover_3->SetBinContent(2,1.193964); h2_vover_3->SetBinContent(3,1.230911); h2_vover_3->SetBinContent(4,1.222279); h2_vover_3->SetBinContent(5,1.249017); h2_vover_3->SetBinContent(6,1.299691); h2_vover_3->SetBinContent(7,1.322204); h2_vover_3->SetBinContent(8,1.416378); h2_vover_3->SetBinContent(9,1.510113); h2_vover_3->SetBinContent(10,1.611048); h2_vover_3->SetBinContent(11,1.766366); h2_vover_3->SetBinError(1,0.008656201); h2_vover_3->SetBinError(2,0.008259725); h2_vover_3->SetBinError(3,0.008766172); h2_vover_3->SetBinError(4,0.008551053); h2_vover_3->SetBinError(5,0.008388716); h2_vover_3->SetBinError(6,0.009317507); h2_vover_3->SetBinError(7,0.009165232); h2_vover_3->SetBinError(8,0.01029839); h2_vover_3->SetBinError(9,0.01107577); h2_vover_3->SetBinError(10,0.01137324); h2_vover_3->SetBinError(11,0.01249682); h2_vover_3->SetEntries(11); TH1D *h2_vover_2 = new TH1D("h2_vover_2","",11,0,2.2); h2_vover_2->SetBinContent(1,1.197222); h2_vover_2->SetBinContent(2,1.20483); h2_vover_2->SetBinContent(3,1.216955); h2_vover_2->SetBinContent(4,1.207026); h2_vover_2->SetBinContent(5,1.226344); h2_vover_2->SetBinContent(6,1.270921); h2_vover_2->SetBinContent(7,1.296149); h2_vover_2->SetBinContent(8,1.34314); h2_vover_2->SetBinContent(9,1.427705); h2_vover_2->SetBinContent(10,1.468157); h2_vover_2->SetBinContent(11,1.57678); h2_vover_2->SetBinError(1,0.00860915); h2_vover_2->SetBinError(2,0.008361243); h2_vover_2->SetBinError(3,0.008656993); h2_vover_2->SetBinError(4,0.008472891); h2_vover_2->SetBinError(5,0.008334845); h2_vover_2->SetBinError(6,0.009113714); h2_vover_2->SetBinError(7,0.00890298); h2_vover_2->SetBinError(8,0.009387918); h2_vover_2->SetBinError(9,0.01037952); h2_vover_2->SetBinError(10,0.01055875); h2_vover_2->SetBinError(11,0.01151018); h2_vover_2->SetEntries(11); TH1D *h2_vover_1 = new TH1D("h2_vover_1","",11,0,2.2); h2_vover_1->SetBinContent(1,1.199494); h2_vover_1->SetBinContent(2,1.203572); h2_vover_1->SetBinContent(3,1.219583); h2_vover_1->SetBinContent(4,1.196043); h2_vover_1->SetBinContent(5,1.217882); h2_vover_1->SetBinContent(6,1.246047); h2_vover_1->SetBinContent(7,1.243562); h2_vover_1->SetBinContent(8,1.260265); h2_vover_1->SetBinContent(9,1.299442); h2_vover_1->SetBinContent(10,1.345636); h2_vover_1->SetBinContent(11,1.408961); h2_vover_1->SetBinError(1,0.008660609); h2_vover_1->SetBinError(2,0.008342119); h2_vover_1->SetBinError(3,0.00836968); h2_vover_1->SetBinError(4,0.008444712); h2_vover_1->SetBinError(5,0.008433455); h2_vover_1->SetBinError(6,0.008860058); h2_vover_1->SetBinError(7,0.008927867); h2_vover_1->SetBinError(8,0.008896927); h2_vover_1->SetBinError(9,0.008985637); h2_vover_1->SetBinError(10,0.009854486); h2_vover_1->SetBinError(11,0.01010533); h2_vover_1->SetEntries(11); // input pedestal data. See Log Entry 3333598, or https://logbooks.jlab.org/entry/3333598 const Int_t npts=11; Double_t vover[npts]; Double_t data18_1[npts]={1.197600,1.192458,1.196844,1.202551,1.208938,1.213045,1.218550,1.239892,1.274607,1.345781,1.470383}; Double_t data18_2[npts]={1.204519,1.205610,1.204831,1.213589,1.225688,1.238219,1.258752,1.296558,1.364615,1.499798,1.737140}; Double_t data18_3[npts]={1.205838,1.208299,1.213065,1.220873,1.233453,1.255267,1.287350,1.346850,1.450760,1.634256,1.948465}; Double_t data18_4[npts]={1.221769,1.224926,1.229694,1.240102,1.255919,1.283498,1.323768,1.395381,1.518889,1.734118,2.093691}; for (Int_t jj=0;jjSetParameters(1.2,0.153); TF1 *sqroot = new TF1("sqroot_func",sqroot_func,xmin,xmax,2); Double_t parA=1.2; Double_t parB=1.2e-2; sqroot->SetParameters(parA,parB); sqroot->SetParNames("parA","parB"); // draw data and simulation TCanvas *c1 = new TCanvas("c1","c1 pedestal_width_data",200,10,700,700); c1->SetBorderMode(0); c1->SetFillColor(0); // c1->SetGridx(); // c1->SetGridy(); // c1->SetLogy(); c1->Divide(2,2); c1->cd(1); c1_1->SetBorderMode(0); c1_1->SetFillColor(0); g18_4->SetTitle(""); g18_4->GetXaxis()->SetLabelSize(0.05); g18_4->GetXaxis()->SetTitleSize(0.05); g18_4->GetYaxis()->SetLabelSize(0.05); g18_4->GetYaxis()->SetTitleSize(0.05); g18_4->GetYaxis()->SetTitleOffset(1.5); g18_4->GetYaxis()->SetTitle("Pedestal Width (counts)"); g18_4->GetXaxis()->SetTitle("Over Bias (V)"); g18_4->GetXaxis()->SetNdivisions(505); g18_4->SetMinimum(1); g18_4->SetMaximum(2.2); g18_4->SetMarkerStyle(20); g18_4->SetMarkerColor(2); g18_4->SetMarkerSize(1); g18_4->Fit(sqroot); // g18_4->Fit("pol3"); g18_4->Draw("Ap"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Data: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.65,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Data: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.61,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); h2_vover_4->SetMarkerStyle(24); h2_vover_4->SetMarkerColor(4); h2_vover_4->SetMarkerSize(1); h2_vover_4->Fit(sqroot,"0"); sqroot->SetLineColor(4); sqroot->DrawCopy("same"); h2_vover_4->Draw("psame"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Sim: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.53,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Sim: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.49,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); // add Legend TLegend *leg = new TLegend(0.2,0.70,0.5,0.9,"Layer 4"); leg->AddEntry(g18_4,"Data","p"); leg->AddEntry(h2_vover_4,"Simulation","p"); leg->Draw(); c1->cd(2); c1_2->SetBorderMode(0); c1_2->SetFillColor(0); g18_3->SetTitle(""); g18_3->GetXaxis()->SetLabelSize(0.05); g18_3->GetXaxis()->SetTitleSize(0.05); g18_3->GetYaxis()->SetLabelSize(0.05); g18_3->GetYaxis()->SetTitleSize(0.05); g18_3->GetYaxis()->SetTitleOffset(1.5); g18_3->GetYaxis()->SetTitle("Pedestal Width (counts)"); g18_3->GetXaxis()->SetTitle("Over Bias (V)"); g18_3->GetXaxis()->SetNdivisions(505); g18_3->SetMinimum(1); g18_3->SetMaximum(2.2); g18_3->SetMarkerStyle(20); g18_3->SetMarkerColor(2); g18_3->SetMarkerSize(1); sqroot->SetLineColor(2); g18_3->Fit(sqroot); // g18_3->Fit("pol2"); g18_3->Draw("Ap"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Data: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.65,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Data: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.61,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); h2_vover_3->SetMarkerStyle(24); h2_vover_3->SetMarkerColor(4); h2_vover_3->SetMarkerSize(1); h2_vover_3->Fit(sqroot,"0"); sqroot->SetLineColor(4); sqroot->DrawCopy("same"); h2_vover_3->Draw("psame"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Sim: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.53,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Sim: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.49,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); // add Legend TLegend *leg = new TLegend(0.2,0.70,0.5,0.9,"Layer 3"); leg->AddEntry(g18_3,"Data","p"); leg->AddEntry(h2_vover_3,"Simulation","p"); leg->Draw(); c1->cd(3); c1_3->SetBorderMode(0); c1_3->SetFillColor(0); g18_2->SetTitle(""); g18_2->GetXaxis()->SetLabelSize(0.05); g18_2->GetXaxis()->SetTitleSize(0.05); g18_2->GetYaxis()->SetLabelSize(0.05); g18_2->GetYaxis()->SetTitleSize(0.05); g18_2->GetYaxis()->SetTitleOffset(1.5); g18_2->GetYaxis()->SetTitle("Pedestal Width (counts)"); g18_2->GetXaxis()->SetTitle("Over Bias (V)"); g18_2->GetXaxis()->SetNdivisions(505); g18_2->SetMinimum(1); g18_2->SetMaximum(2.2); g18_2->SetMarkerStyle(20); g18_2->SetMarkerColor(2); g18_2->SetMarkerSize(1); sqroot->SetLineColor(2); g18_2->Fit(sqroot); // g18_2->Fit("pol2"); g18_2->Draw("Ap"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Data: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.65,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Data: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.61,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); h2_vover_2->SetMarkerStyle(24); h2_vover_2->SetMarkerColor(4); h2_vover_2->SetMarkerSize(1); h2_vover_2->Fit(sqroot,"0"); sqroot->SetLineColor(4); sqroot->DrawCopy("same"); h2_vover_2->Draw("psame"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Sim: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.53,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Sim: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.49,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); // add Legend TLegend *leg = new TLegend(0.2,0.70,0.5,0.9,"Layer 2"); leg->AddEntry(g18_2,"Data","p"); leg->AddEntry(h2_vover_2,"Simulation","p"); leg->Draw(); c1->cd(4); c1_4->SetBorderMode(0); c1_4->SetFillColor(0); g18_1->SetTitle(""); g18_1->GetXaxis()->SetLabelSize(0.05); g18_1->GetXaxis()->SetTitleSize(0.05); g18_1->GetYaxis()->SetLabelSize(0.05); g18_1->GetYaxis()->SetTitleSize(0.05); g18_1->GetYaxis()->SetTitleOffset(1.5); g18_1->GetYaxis()->SetTitle("Pedestal Width (counts)"); g18_1->GetXaxis()->SetTitle("Over Bias (V)"); g18_1->GetXaxis()->SetNdivisions(505); g18_1->SetMinimum(1); g18_1->SetMaximum(2.2); g18_1->SetMarkerStyle(20); g18_1->SetMarkerColor(2); g18_1->SetMarkerSize(1); sqroot->SetLineColor(2); g18_1->Fit(sqroot); // g18_1->Fit("pol2"); g18_1->Draw("Ap"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Data: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.65,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Data: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.61,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); h2_vover_1->SetMarkerStyle(24); h2_vover_1->SetMarkerColor(4); h2_vover_1->SetMarkerSize(1); h2_vover_1->Fit(sqroot,"0"); sqroot->SetLineColor(4); sqroot->DrawCopy("same"); h2_vover_1->Draw("psame"); Double_t parA = sqroot->GetParameter(0); Double_t parAerr = sqroot->GetParError(0); Double_t parB = sqroot->GetParameter(1); Double_t parBerr = sqroot->GetParError(1); sprintf (string,"Sim: A= %.3f #pm%.3f\n",parA,parAerr); printf("string=%s",string); t1 = new TLatex(0.2,0.53,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); sprintf (string,"Sim: B= %.3f #pm%.3f\n",parB,parBerr); printf("string=%s",string); t1 = new TLatex(0.2,0.49,string); t1->SetNDC(); t1->SetTextSize(0.04); t1->Draw(); // add Legend TLegend *leg = new TLegend(0.2,0.70,0.5,0.9,"Layer 1"); leg->AddEntry(g18_1,"Data","p"); leg->AddEntry(h2_vover_1,"Simulation","p"); leg->Draw(); sprintf (string,"pedestal_width_data.pdf"); c1->SaveAs(string); } Double_t sqroot_func (Double_t *x, Double_t *par) { Double_t parA=par[0]; Double_t parB=par[1]; Double_t x1=x[0]; char string[256]; Double_t func; func = sqrt(parA*parA + parB*parB*x1*x1*x1*x1); /*sprintf (string,"sqroot_func: x1=%f amplitude=%f mu=%f sigma=%f t0=%f pedestal=%f, func=%f\n",x1,amplitude,mu,sigma,pedestal,func); printf ("string=%s",string);*/ return func; }