void pedestal_width_amplitude(void) { char string[256]; Int_t layer=4; // data from layer 4 //=========Macro generated from canvas: c3/c3 //========= (Mon Apr 20 17:47:56 2015) by ROOT version5.34/09 TCanvas *c3 = new TCanvas("c3", "c3",200,32,700,700); gStyle->SetOptFit(1); c3->Range(0,0,1,1); c3->SetFillColor(0); c3->SetBorderMode(0); c3->SetBorderSize(2); c3->SetGridx(); c3->SetGridy(); c3->SetLeftMargin(0.15); c3->SetRightMargin(0.15); c3->SetBottomMargin(0.15); c3->SetFrameBorderMode(0); gStyle->SetOptStat(kFALSE); gStyle->SetOptFit(kFALSE); // gStyle->SetOptFit(1111); // ------------>Primitives in pad: c3_3 TH1D *h2_samples_4_10 = new TH1D("h2_samples_4_10","",11,0,2.2); h2_samples_4_10->SetBinContent(1,1.199894); h2_samples_4_10->SetBinContent(2,1.207158); h2_samples_4_10->SetBinContent(3,1.217556); h2_samples_4_10->SetBinContent(4,1.226875); h2_samples_4_10->SetBinContent(5,1.277582); h2_samples_4_10->SetBinContent(6,1.338804); h2_samples_4_10->SetBinContent(7,1.381932); h2_samples_4_10->SetBinContent(8,1.464386); h2_samples_4_10->SetBinContent(9,1.580163); h2_samples_4_10->SetBinContent(10,1.770427); h2_samples_4_10->SetBinContent(11,1.909945); h2_samples_4_10->SetBinError(1,0.008603802); h2_samples_4_10->SetBinError(2,0.008334468); h2_samples_4_10->SetBinError(3,0.008691162); h2_samples_4_10->SetBinError(4,0.008653266); h2_samples_4_10->SetBinError(5,0.008867018); h2_samples_4_10->SetBinError(6,0.009636698); h2_samples_4_10->SetBinError(7,0.0100516); h2_samples_4_10->SetBinError(8,0.009991336); h2_samples_4_10->SetBinError(9,0.01093789); h2_samples_4_10->SetBinError(10,0.01292918); h2_samples_4_10->SetBinError(11,0.01315615); h2_samples_4_10->SetMinimum(1); h2_samples_4_10->SetMaximum(3); h2_samples_4_10->SetEntries(11); TF1 *fit = new TF1("fit","[0]+[1]*x*x",0,2.4); fit->SetFillColor(19); fit->SetFillStyle(0); fit->SetLineColor(2); fit->SetLineWidth(2); fit->SetChisquare(122.9222); fit->SetNDF(9); fit->GetXaxis()->SetLabelFont(42); fit->GetXaxis()->SetLabelSize(0.035); fit->GetXaxis()->SetTitleSize(0.035); fit->GetXaxis()->SetTitleFont(42); fit->GetYaxis()->SetLabelFont(42); fit->GetYaxis()->SetLabelSize(0.035); fit->GetYaxis()->SetTitleSize(0.035); fit->GetYaxis()->SetTitleFont(42); fit->SetParameter(0,1.16697); fit->SetParError(0,0.004058886); fit->SetParLimits(0,0,0); fit->SetParameter(1,0.1530768); fit->SetParError(1,0.002300519); fit->SetParLimits(1,0,0); h2_samples_4_10->GetListOfFunctions()->Add(fit); ci = TColor::GetColor("#000099"); h2_samples_4_10->SetLineColor(ci); h2_samples_4_10->SetMarkerColor(2); h2_samples_4_10->SetMarkerStyle(20); h2_samples_4_10->GetXaxis()->SetTitle("Vover (V)"); h2_samples_4_10->GetXaxis()->SetRange(1,12); h2_samples_4_10->GetXaxis()->SetNdivisions(505); h2_samples_4_10->GetXaxis()->SetLabelFont(42); h2_samples_4_10->GetXaxis()->SetLabelSize(0.05); h2_samples_4_10->GetXaxis()->SetTitleSize(0.05); h2_samples_4_10->GetXaxis()->SetTitleFont(42); h2_samples_4_10->GetYaxis()->SetTitle("Width (counts)"); h2_samples_4_10->GetYaxis()->SetLabelFont(42); h2_samples_4_10->GetYaxis()->SetLabelSize(0.05); h2_samples_4_10->GetYaxis()->SetTitleSize(0.05); h2_samples_4_10->GetYaxis()->SetTitleOffset(1.5); h2_samples_4_10->GetYaxis()->SetTitleFont(42); h2_samples_4_10->GetZaxis()->SetLabelFont(42); h2_samples_4_10->GetZaxis()->SetLabelSize(0.035); h2_samples_4_10->GetZaxis()->SetTitleSize(0.035); h2_samples_4_10->GetZaxis()->SetTitleFont(42); h2_samples_4_10->Draw(""); TH1D *h2_samples_4_20 = new TH1D("h2_samples_4_20","",11,0,2.2); h2_samples_4_20->SetBinContent(1,1.19675); h2_samples_4_20->SetBinContent(2,1.220366); h2_samples_4_20->SetBinContent(3,1.252845); h2_samples_4_20->SetBinContent(4,1.311393); h2_samples_4_20->SetBinContent(5,1.447083); h2_samples_4_20->SetBinContent(6,1.665245); h2_samples_4_20->SetBinContent(7,1.82228); h2_samples_4_20->SetBinContent(8,2.03347); h2_samples_4_20->SetBinContent(9,2.365167); h2_samples_4_20->SetBinContent(10,2.83616); h2_samples_4_20->SetBinContent(11,3.170636); h2_samples_4_20->SetBinError(1,0.008404909); h2_samples_4_20->SetBinError(2,0.008623235); h2_samples_4_20->SetBinError(3,0.00874654); h2_samples_4_20->SetBinError(4,0.009153502); h2_samples_4_20->SetBinError(5,0.01018942); h2_samples_4_20->SetBinError(6,0.01248719); h2_samples_4_20->SetBinError(7,0.01285668); h2_samples_4_20->SetBinError(8,0.014661); h2_samples_4_20->SetBinError(9,0.01777352); h2_samples_4_20->SetBinError(10,0.02127159); h2_samples_4_20->SetBinError(11,0.0244498); h2_samples_4_20->SetMinimum(1); h2_samples_4_20->SetMaximum(3); h2_samples_4_20->SetEntries(11); TF1 *fit = new TF1("fit","[0]+[1]*x*x",0,2.4); fit->SetFillColor(19); fit->SetFillStyle(0); fit->SetLineColor(2); fit->SetLineWidth(2); fit->SetChisquare(209.9795); fit->SetNDF(9); fit->GetXaxis()->SetLabelFont(42); fit->GetXaxis()->SetLabelSize(0.035); fit->GetXaxis()->SetTitleSize(0.035); fit->GetXaxis()->SetTitleFont(42); fit->GetYaxis()->SetLabelFont(42); fit->GetYaxis()->SetLabelSize(0.035); fit->GetYaxis()->SetTitleSize(0.035); fit->GetYaxis()->SetTitleFont(42); fit->SetParameter(0,1.145032); fit->SetParError(0,0.004378842); fit->SetParLimits(0,0,0); fit->SetParameter(1,0.4296834); fit->SetParError(1,0.003344592); fit->SetParLimits(1,0,0); h2_samples_4_20->GetListOfFunctions()->Add(fit); h2_samples_4_20->SetMarkerColor(4); h2_samples_4_20->SetMarkerStyle(21); h2_samples_4_20->Draw("same"); TH1D *h2_samples_4_05 = new TH1D("h2_samples_4_05","",11,0,2.2); h2_samples_4_05->SetBinContent(1,1.200593); h2_samples_4_05->SetBinContent(2,1.200635); h2_samples_4_05->SetBinContent(3,1.206912); h2_samples_4_05->SetBinContent(4,1.203156); h2_samples_4_05->SetBinContent(5,1.233281); h2_samples_4_05->SetBinContent(6,1.238301); h2_samples_4_05->SetBinContent(7,1.235116); h2_samples_4_05->SetBinContent(8,1.270343); h2_samples_4_05->SetBinContent(9,1.31556); h2_samples_4_05->SetBinContent(10,1.369107); h2_samples_4_05->SetBinContent(11,1.407935); h2_samples_4_05->SetBinError(1,0.008676325); h2_samples_4_05->SetBinError(2,0.008204418); h2_samples_4_05->SetBinError(3,0.008481807); h2_samples_4_05->SetBinError(4,0.008581952); h2_samples_4_05->SetBinError(5,0.008652181); h2_samples_4_05->SetBinError(6,0.008921214); h2_samples_4_05->SetBinError(7,0.008865895); h2_samples_4_05->SetBinError(8,0.008768538); h2_samples_4_05->SetBinError(9,0.009211602); h2_samples_4_05->SetBinError(10,0.009995362); h2_samples_4_05->SetBinError(11,0.009547176); h2_samples_4_05->SetMinimum(1); h2_samples_4_05->SetMaximum(3); h2_samples_4_05->SetEntries(11); TF1 *fit = new TF1("fit","[0]+[1]*x*x",0,2.4); fit->SetFillColor(19); fit->SetFillStyle(0); fit->SetLineColor(2); fit->SetLineWidth(2); fit->SetChisquare(29.28425); fit->SetNDF(9); fit->GetXaxis()->SetLabelFont(42); fit->GetXaxis()->SetLabelSize(0.035); fit->GetXaxis()->SetTitleSize(0.035); fit->GetXaxis()->SetTitleFont(42); fit->GetYaxis()->SetLabelFont(42); fit->GetYaxis()->SetLabelSize(0.035); fit->GetYaxis()->SetTitleSize(0.035); fit->GetYaxis()->SetTitleFont(42); fit->SetParameter(0,1.187608); fit->SetParError(0,0.003902848); fit->SetParLimits(0,0,0); fit->SetParameter(1,0.04597433); fit->SetParError(1,0.001924654); fit->SetParLimits(1,0,0); h2_samples_4_05->GetListOfFunctions()->Add(fit); h2_samples_4_05->SetMarkerColor(1); h2_samples_4_05->SetMarkerStyle(22); h2_samples_4_05->Draw("same"); TH1D *h2_samples_4_25 = new TH1D("h2_samples_4_25","",11,0,2.2); h2_samples_4_25->SetBinContent(1,1.200243); h2_samples_4_25->SetBinContent(2,1.202409); h2_samples_4_25->SetBinContent(3,1.20928); h2_samples_4_25->SetBinContent(4,1.20306); h2_samples_4_25->SetBinContent(5,1.217005); h2_samples_4_25->SetBinContent(6,1.205173); h2_samples_4_25->SetBinContent(7,1.193015); h2_samples_4_25->SetBinContent(8,1.21517); h2_samples_4_25->SetBinContent(9,1.239836); h2_samples_4_25->SetBinContent(10,1.24549); h2_samples_4_25->SetBinContent(11,1.26268); h2_samples_4_25->SetBinError(1,0.008681049); h2_samples_4_25->SetBinError(2,0.008210151); h2_samples_4_25->SetBinError(3,0.008639821); h2_samples_4_25->SetBinError(4,0.008616372); h2_samples_4_25->SetBinError(5,0.008394628); h2_samples_4_25->SetBinError(6,0.008609493); h2_samples_4_25->SetBinError(7,0.008372868); h2_samples_4_25->SetBinError(8,0.008429712); h2_samples_4_25->SetBinError(9,0.008765894); h2_samples_4_25->SetBinError(10,0.009086254); h2_samples_4_25->SetBinError(11,0.008874492); h2_samples_4_25->SetMinimum(1); h2_samples_4_25->SetMaximum(3); h2_samples_4_25->SetEntries(11); TF1 *fit = new TF1("fit","[0]+[1]*x*x",0,2.4); fit->SetFillColor(19); fit->SetFillStyle(0); fit->SetLineColor(2); fit->SetLineWidth(2); fit->SetChisquare(16.07031); fit->SetNDF(9); fit->GetXaxis()->SetLabelFont(42); fit->GetXaxis()->SetLabelSize(0.035); fit->GetXaxis()->SetTitleSize(0.035); fit->GetXaxis()->SetTitleFont(42); fit->GetYaxis()->SetLabelFont(42); fit->GetYaxis()->SetLabelSize(0.035); fit->GetYaxis()->SetTitleSize(0.035); fit->GetYaxis()->SetTitleFont(42); fit->SetParameter(0,1.196991); fit->SetParError(0,0.003867216); fit->SetParLimits(0,0,0); fit->SetParameter(1,0.01266473); fit->SetParError(1,0.001838095); fit->SetParLimits(1,0,0); h2_samples_4_25->GetListOfFunctions()->Add(fit); h2_samples_4_25->SetMarkerColor(3); h2_samples_4_25->SetMarkerStyle(23); h2_samples_4_25->Draw("same"); // add Legend sprintf (string,"Layer = %d\n",layer); printf("string=%s",string); TLegend *leg = new TLegend(0.2,0.65,0.5,0.9,string); leg->AddEntry(h2_samples_4_20,"Amplitude x 2","p"); leg->AddEntry(h2_samples_4_10,"Amplitude x 1","p"); leg->AddEntry(h2_samples_4_05,"Amplitude x 0.5","p"); leg->AddEntry(h2_samples_4_25,"Amplitude x 0.25","p"); leg->Draw(); sprintf (string,"pedestal_width_amplitude.pdf"); c3->SaveAs(string); }