void DrawGrid() { Int_t ncol = 100; Int_t nrow = 200; TPad *grid = new TPad("grid","",0,0,1,1); grid->Draw(); grid->cd(); grid->SetGrid(); grid->SetFillStyle(4000); grid->SetFrameFillStyle(0); TH2 *hgrid = new TH2C("hgrid","", ncol+1, -5, ncol+5, nrow, -5, nrow-1+5); hgrid->Draw(); hgrid->GetXaxis()->SetNdivisions(6,100); hgrid->GetYaxis()->SetNdivisions(200); hgrid->GetYaxis()->SetLabelOffset(999.); hgrid->GetXaxis()->SetLabelOffset(999.); }
void limit() { //=========Macro generated from canvas: limit/limit //========= (Thu Apr 27 14:38:33 2017) by ROOT version6.02/05 TCanvas *limit = new TCanvas("limit", "limit",0,0,600,600); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); limit->SetHighLightColor(2); limit->Range(0,0,1,1); limit->SetFillColor(0); limit->SetBorderMode(0); limit->SetBorderSize(2); limit->SetLeftMargin(0.16); limit->SetRightMargin(0.04); limit->SetTopMargin(0.06); limit->SetBottomMargin(0.12); limit->SetFrameFillStyle(0); limit->SetFrameBorderMode(0); // ------------>Primitives in pad: pad TPad *pad = new TPad("pad", "pad",0,0,1,1); pad->Draw(); pad->cd(); pad->Range(-59.99999,-2.046818,1565,15.01); pad->SetFillColor(0); pad->SetBorderMode(0); pad->SetLogy(); pad->SetBorderSize(2); pad->SetTickx(1); pad->SetTicky(1); pad->SetLeftMargin(0.16); pad->SetRightMargin(0.04); pad->SetTopMargin(0.06); pad->SetBottomMargin(0.12); pad->SetFrameFillStyle(0); pad->SetFrameBorderMode(0); pad->SetFrameFillStyle(0); pad->SetFrameBorderMode(0); TH1F *tmp01 = new TH1F("tmp01","Graph",100,200,1500); tmp01->SetMinimum(0.); tmp01->SetMaximum(13.98659); tmp01->SetStats(0); tmp01->SetLineStyle(0); tmp01->SetMarkerStyle(20); tmp01->GetXaxis()->SetTitle("m_{H} (GeV)"); tmp01->GetXaxis()->SetLabelFont(42); tmp01->GetXaxis()->SetLabelOffset(0.01); tmp01->GetXaxis()->SetTitleSize(0.05); tmp01->GetXaxis()->SetTickLength(0.02); tmp01->GetXaxis()->SetTitleOffset(1.08); tmp01->GetXaxis()->SetTitleFont(42); tmp01->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}"); tmp01->GetYaxis()->SetLabelFont(42); tmp01->GetYaxis()->SetLabelOffset(0.007); tmp01->GetYaxis()->SetTitleSize(0.05); tmp01->GetYaxis()->SetTickLength(0.02); tmp01->GetYaxis()->SetTitleOffset(1.56); tmp01->GetYaxis()->SetTitleFont(42); tmp01->GetZaxis()->SetLabelFont(42); tmp01->GetZaxis()->SetLabelOffset(0.007); tmp01->GetZaxis()->SetTitleSize(0.05); tmp01->GetZaxis()->SetTickLength(0.02); tmp01->GetZaxis()->SetTitleFont(42); tmp01->Draw("AXIS"); TH1F *tmp02 = new TH1F("tmp02","Graph",100,200,1500); tmp02->SetMinimum(0); tmp02->SetMaximum(13.98659); tmp02->SetStats(0); tmp02->SetLineStyle(0); tmp02->SetMarkerStyle(20); tmp02->GetXaxis()->SetTitle("m_{H} (GeV)"); tmp02->GetXaxis()->SetLabelFont(42); tmp02->GetXaxis()->SetLabelOffset(0.01); tmp02->GetXaxis()->SetTitleSize(0.05); tmp02->GetXaxis()->SetTickLength(0.02); tmp02->GetXaxis()->SetTitleOffset(1.08); tmp02->GetXaxis()->SetTitleFont(42); tmp02->GetYaxis()->SetTitle("95% CL limit on #sigma/#sigma_{SM}"); tmp02->GetYaxis()->SetLabelFont(42); tmp02->GetYaxis()->SetLabelOffset(0.007); tmp02->GetYaxis()->SetTitleSize(0.05); tmp02->GetYaxis()->SetTickLength(0.02); tmp02->GetYaxis()->SetTitleOffset(1.56); tmp02->GetYaxis()->SetTitleFont(42); tmp02->GetZaxis()->SetLabelFont(42); tmp02->GetZaxis()->SetLabelOffset(0.007); tmp02->GetZaxis()->SetTitleSize(0.05); tmp02->GetZaxis()->SetTickLength(0.02); tmp02->GetZaxis()->SetTitleFont(42); tmp02->Draw("AXIGSAME"); Double_t Graph0_fx3001[27] = { 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500}; Double_t Graph0_fy3001[27] = { 4.796875, 2.148438, 0.8398438, 0.3857422, 0.2001953, 0.1088867, 0.06591797, 0.04736328, 0.03564453, 0.02783203, 0.02294922, 0.01806641, 0.01513672, 0.01220703, 0.01123047, 0.009277344, 0.008300781, 0.007324219, 0.007324219, 0.006347656, 0.006347656, 0.005371094, 0.005371094, 0.004394531, 0.004394531, 0.004394531, 0.004394531}; Double_t Graph0_felx3001[27] = { 4.032346e-316, 0, 0, 0, 6.906313e-310, 4.032343e-316, 2.121996e-314, 4.032582e-316, 0, 4.032588e-316, 4.032343e-316, 0, 4.032584e-316, 1.508018e-316, 1.508219e-316, 4.032589e-316, 2.124327e-314, 4.032593e-316, 5.582942e-322, 6.906313e-310, 0, 4.032344e-316, 4.032583e-316, 4.032588e-316, 1.58101e-322, 4.032293e-316, 5.582942e-322}; Double_t Graph0_fely3001[27] = { 2.370331, 1.057434, 0.405159, 0.1845837, 0.09618759, 0.05231667, 0.03192902, 0.02331161, 0.01754379, 0.01435089, 0.01183319, 0.009315491, 0.008041382, 0.006484985, 0.005966187, 0.004928589, 0.00440979, 0.004119873, 0.004119873, 0.003570557, 0.003570557, 0.00302124, 0.00302124, 0.002471924, 0.002471924, 0.002471924, 0.002471924}; Double_t Graph0_fehx3001[27] = { 4.031643e-316, 0, 0, 0, 6.906313e-310, 4.032106e-316, 2.121996e-314, 4.032349e-316, 0, 4.032354e-316, 4.032106e-316, 0, 4.032351e-316, 1.508018e-316, 1.508219e-316, 4.032356e-316, 2.124327e-314, 4.03236e-316, 5.582942e-322, 6.906313e-310, 0, 4.032107e-316, 4.03235e-316, 4.032354e-316, 1.58101e-322, 4.032222e-316, 5.582942e-322}; Double_t Graph0_fehy3001[27] = { 5.693069, 2.47175, 0.8989364, 0.4081147, 0.2108151, 0.1170805, 0.07362081, 0.05438244, 0.04146756, 0.03243252, 0.02825768, 0.02361592, 0.01990321, 0.01752287, 0.01712826, 0.0153559, 0.01456667, 0.01341494, 0.01192601, 0.0124739, 0.01149977, 0.01055484, 0.01051202, 0.008670811, 0.008670811, 0.008635777, 0.008635777}; TGraphAsymmErrors *grae = new TGraphAsymmErrors(27,Graph0_fx3001,Graph0_fy3001,Graph0_felx3001,Graph0_fehx3001,Graph0_fely3001,Graph0_fehy3001); grae->SetName("Graph0"); grae->SetTitle("Graph"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ffff00"); grae->SetFillColor(ci); grae->SetMarkerStyle(20); TH1F *Graph_Graph3001 = new TH1F("Graph_Graph3001","Graph",100,70,1630); Graph_Graph3001->SetMinimum(0); Graph_Graph3001->SetMaximum(11.53875); Graph_Graph3001->SetDirectory(0); Graph_Graph3001->SetStats(0); Graph_Graph3001->SetLineStyle(0); Graph_Graph3001->SetMarkerStyle(20); Graph_Graph3001->GetXaxis()->SetLabelFont(42); Graph_Graph3001->GetXaxis()->SetTitleSize(0.05); Graph_Graph3001->GetXaxis()->SetTickLength(0.02); Graph_Graph3001->GetXaxis()->SetTitleOffset(1.08); Graph_Graph3001->GetXaxis()->SetTitleFont(42); Graph_Graph3001->GetYaxis()->SetLabelFont(42); Graph_Graph3001->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3001->GetYaxis()->SetTitleSize(0.05); Graph_Graph3001->GetYaxis()->SetTickLength(0.02); Graph_Graph3001->GetYaxis()->SetTitleOffset(1.56); Graph_Graph3001->GetYaxis()->SetTitleFont(42); Graph_Graph3001->GetZaxis()->SetLabelFont(42); Graph_Graph3001->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3001->GetZaxis()->SetTitleSize(0.05); Graph_Graph3001->GetZaxis()->SetTickLength(0.02); Graph_Graph3001->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3001); grae->Draw("3"); Double_t Graph1_fx3002[27] = { 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500}; Double_t Graph1_fy3002[27] = { 4.796875, 2.148438, 0.8398438, 0.3857422, 0.2001953, 0.1088867, 0.06591797, 0.04736328, 0.03564453, 0.02783203, 0.02294922, 0.01806641, 0.01513672, 0.01220703, 0.01123047, 0.009277344, 0.008300781, 0.007324219, 0.007324219, 0.006347656, 0.006347656, 0.005371094, 0.005371094, 0.004394531, 0.004394531, 0.004394531, 0.004394531}; Double_t Graph1_felx3002[27] = { 4.028644e-316, 2.608667e-321, 4.022558e-316, 0, 2.420922e-322, 4.028601e-316, 0, 2.11372e-314, 0, 4.940656e-323, 8.744962e-322, 0, 0, 4.940656e-323, 0, 6.906314e-310, 5.33769e+160, 0, 4.021573e-316, 6.906314e-310, 0, 1.188318e-312, 4.027998e-316, 0, 1.58101e-322, 4.027629e-316, 1.630417e-322}; Double_t Graph1_fely3002[27] = { 1.490716, 0.6650269, 0.2516418, 0.1146438, 0.05974151, 0.03228919, 0.01945674, 0.01420552, 0.01069075, 0.009417772, 0.007765532, 0.006113291, 0.005277157, 0.003647804, 0.00335598, 0.002772331, 0.002480507, 0.002317429, 0.002832413, 0.002231598, 0.002231598, 0.001888275, 0.001888275, 0.001544952, 0.001544952, 0.001544952, 0.002162933}; Double_t Graph1_fehx3002[27] = { 1.179415e-312, 2.608667e-321, 4.022558e-316, 0, 2.420922e-322, 4.028634e-316, 0, 2.113722e-314, 0, 4.940656e-323, 8.744962e-322, 0, 0, 4.940656e-323, 0, 6.906314e-310, 2.139459e+161, 0, 4.021573e-316, 6.906314e-310, 0, 1.188318e-312, 4.027998e-316, 0, 1.58101e-322, 4.027675e-316, 1.630417e-322}; Double_t Graph1_fehy3002[27] = { 2.351828, 1.053343, 0.3849801, 0.1768222, 0.09017253, 0.05078118, 0.03126747, 0.02303264, 0.01790216, 0.012869, 0.0113431, 0.009505779, 0.008205643, 0.007395977, 0.0068043, 0.006212621, 0.006088058, 0.005138258, 0.004204029, 0.005262822, 0.003643492, 0.004453157, 0.003768056, 0.004204029, 0.004204029, 0.003643492, 0.003643492}; grae = new TGraphAsymmErrors(27,Graph1_fx3002,Graph1_fy3002,Graph1_felx3002,Graph1_fehx3002,Graph1_fely3002,Graph1_fehy3002); grae->SetName("Graph1"); grae->SetTitle("Graph"); ci = TColor::GetColor("#00ff00"); grae->SetFillColor(ci); grae->SetMarkerStyle(20); TH1F *Graph_Graph3002 = new TH1F("Graph_Graph3002","Graph",100,-8.010917e+160,2.406781e+161); Graph_Graph3002->SetMinimum(0); Graph_Graph3002->SetMaximum(7.86335); Graph_Graph3002->SetDirectory(0); Graph_Graph3002->SetStats(0); Graph_Graph3002->SetLineStyle(0); Graph_Graph3002->SetMarkerStyle(20); Graph_Graph3002->GetXaxis()->SetLabelFont(42); Graph_Graph3002->GetXaxis()->SetTitleSize(0.05); Graph_Graph3002->GetXaxis()->SetTickLength(0.02); Graph_Graph3002->GetXaxis()->SetTitleOffset(1.08); Graph_Graph3002->GetXaxis()->SetTitleFont(42); Graph_Graph3002->GetYaxis()->SetLabelFont(42); Graph_Graph3002->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3002->GetYaxis()->SetTitleSize(0.05); Graph_Graph3002->GetYaxis()->SetTickLength(0.02); Graph_Graph3002->GetYaxis()->SetTitleOffset(1.56); Graph_Graph3002->GetYaxis()->SetTitleFont(42); Graph_Graph3002->GetZaxis()->SetLabelFont(42); Graph_Graph3002->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3002->GetZaxis()->SetTitleSize(0.05); Graph_Graph3002->GetZaxis()->SetTickLength(0.02); Graph_Graph3002->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3002); grae->Draw("3"); Double_t Graph2_fx1[27] = { 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500}; Double_t Graph2_fy1[27] = { 4.796875, 2.148438, 0.8398438, 0.3857422, 0.2001953, 0.1088867, 0.06591797, 0.04736328, 0.03564453, 0.02783203, 0.02294922, 0.01806641, 0.01513672, 0.01220703, 0.01123047, 0.009277344, 0.008300781, 0.007324219, 0.007324219, 0.006347656, 0.006347656, 0.005371094, 0.005371094, 0.004394531, 0.004394531, 0.004394531, 0.004394531}; TGraph *graph = new TGraph(27,Graph2_fx1,Graph2_fy1); graph->SetName("Graph2"); graph->SetTitle("Graph"); graph->SetFillColor(1); ci = TColor::GetColor("#ff0000"); graph->SetLineColor(ci); graph->SetLineWidth(2); graph->SetMarkerStyle(20); TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","Graph",100,70,1630); Graph_Graph1->SetMinimum(0); Graph_Graph1->SetMaximum(5.276123); Graph_Graph1->SetDirectory(0); Graph_Graph1->SetStats(0); Graph_Graph1->SetLineStyle(0); Graph_Graph1->SetMarkerStyle(20); Graph_Graph1->GetXaxis()->SetLabelFont(42); Graph_Graph1->GetXaxis()->SetTitleSize(0.05); Graph_Graph1->GetXaxis()->SetTickLength(0.02); Graph_Graph1->GetXaxis()->SetTitleOffset(1.08); Graph_Graph1->GetXaxis()->SetTitleFont(42); Graph_Graph1->GetYaxis()->SetLabelFont(42); Graph_Graph1->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1->GetYaxis()->SetTitleSize(0.05); Graph_Graph1->GetYaxis()->SetTickLength(0.02); Graph_Graph1->GetYaxis()->SetTitleOffset(1.56); Graph_Graph1->GetYaxis()->SetTitleFont(42); Graph_Graph1->GetZaxis()->SetLabelFont(42); Graph_Graph1->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1->GetZaxis()->SetTitleSize(0.05); Graph_Graph1->GetZaxis()->SetTickLength(0.02); Graph_Graph1->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_Graph1); graph->Draw("l"); Double_t Graph3_fx2[27] = { 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500}; Double_t Graph3_fy2[27] = { 4.79203, 2.152691, 0.8377939, 0.3861777, 0.1995838, 0.1090425, 0.0660598, 0.04759021, 0.03596779, 0.02751563, 0.02238263, 0.01815241, 0.01512282, 0.01228406, 0.01162986, 0.009836298, 0.008643669, 0.007866618, 0.007089044, 0.006702567, 0.005960677, 0.005744891, 0.005145786, 0.004956617, 0.004917011, 0.004476165, 0.004343825}; graph = new TGraph(27,Graph3_fx2,Graph3_fy2); graph->SetName("Graph3"); graph->SetTitle("Graph"); graph->SetFillColor(1); graph->SetLineWidth(2); graph->SetMarkerStyle(20); TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,70,1630); Graph_Graph2->SetMinimum(0); Graph_Graph2->SetMaximum(5.270799); Graph_Graph2->SetDirectory(0); Graph_Graph2->SetStats(0); Graph_Graph2->SetLineStyle(0); Graph_Graph2->SetMarkerStyle(20); Graph_Graph2->GetXaxis()->SetLabelFont(42); Graph_Graph2->GetXaxis()->SetTitleSize(0.05); Graph_Graph2->GetXaxis()->SetTickLength(0.02); Graph_Graph2->GetXaxis()->SetTitleOffset(1.08); Graph_Graph2->GetXaxis()->SetTitleFont(42); Graph_Graph2->GetYaxis()->SetLabelFont(42); Graph_Graph2->GetYaxis()->SetLabelOffset(0.007); Graph_Graph2->GetYaxis()->SetTitleSize(0.05); Graph_Graph2->GetYaxis()->SetTickLength(0.02); Graph_Graph2->GetYaxis()->SetTitleOffset(1.56); Graph_Graph2->GetYaxis()->SetTitleFont(42); Graph_Graph2->GetZaxis()->SetLabelFont(42); Graph_Graph2->GetZaxis()->SetLabelOffset(0.007); Graph_Graph2->GetZaxis()->SetTitleSize(0.05); Graph_Graph2->GetZaxis()->SetTickLength(0.02); Graph_Graph2->GetZaxis()->SetTitleFont(42); graph->SetHistogram(Graph_Graph2); graph->Draw("pl"); TH1F *tmp0_copy3 = new TH1F("tmp0_copy3","Graph",100,200,1500); tmp0_copy3->SetMinimum(0); tmp0_copy3->SetMaximum(11.53875); tmp0_copy3->SetDirectory(0); tmp0_copy3->SetStats(0); tmp0_copy3->SetLineStyle(0); tmp0_copy3->SetMarkerStyle(20); tmp0_copy3->GetXaxis()->SetLabelFont(42); tmp0_copy3->GetXaxis()->SetTitleSize(0.05); tmp0_copy3->GetXaxis()->SetTickLength(0.02); tmp0_copy3->GetXaxis()->SetTitleOffset(1.08); tmp0_copy3->GetXaxis()->SetTitleFont(42); tmp0_copy3->GetYaxis()->SetLabelFont(42); tmp0_copy3->GetYaxis()->SetLabelOffset(0.007); tmp0_copy3->GetYaxis()->SetTitleSize(0.05); tmp0_copy3->GetYaxis()->SetTickLength(0.02); tmp0_copy3->GetYaxis()->SetTitleOffset(1.56); tmp0_copy3->GetYaxis()->SetTitleFont(42); tmp0_copy3->GetZaxis()->SetLabelFont(42); tmp0_copy3->GetZaxis()->SetLabelOffset(0.007); tmp0_copy3->GetZaxis()->SetTitleSize(0.05); tmp0_copy3->GetZaxis()->SetTickLength(0.02); tmp0_copy3->GetZaxis()->SetTitleFont(42); tmp0_copy3->Draw("sameaxis"); TH1F *tmp0_copy4 = new TH1F("tmp0_copy4","Graph",100,200,1500); tmp0_copy4->SetMinimum(0); tmp0_copy4->SetMaximum(11.53875); tmp0_copy4->SetDirectory(0); tmp0_copy4->SetStats(0); tmp0_copy4->SetLineStyle(0); tmp0_copy4->SetMarkerStyle(20); tmp0_copy4->GetXaxis()->SetLabelFont(42); tmp0_copy4->GetXaxis()->SetTitleSize(0.05); tmp0_copy4->GetXaxis()->SetTickLength(0.02); tmp0_copy4->GetXaxis()->SetTitleOffset(1.08); tmp0_copy4->GetXaxis()->SetTitleFont(42); tmp0_copy4->GetYaxis()->SetLabelFont(42); tmp0_copy4->GetYaxis()->SetLabelOffset(0.007); tmp0_copy4->GetYaxis()->SetTitleSize(0.05); tmp0_copy4->GetYaxis()->SetTickLength(0.02); tmp0_copy4->GetYaxis()->SetTitleOffset(1.56); tmp0_copy4->GetYaxis()->SetTitleFont(42); tmp0_copy4->GetZaxis()->SetLabelFont(42); tmp0_copy4->GetZaxis()->SetLabelOffset(0.007); tmp0_copy4->GetZaxis()->SetTitleSize(0.05); tmp0_copy4->GetZaxis()->SetTickLength(0.02); tmp0_copy4->GetZaxis()->SetTitleFont(42); tmp0_copy4->Draw("sameaxig"); TLegend *leg = new TLegend(0.495,0.825,0.945,0.925,NULL,"NBNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph3","Observed","LP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","Expected","L"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph1","#pm1#sigma Expected","F"); ci = TColor::GetColor("#00ff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F"); ci = TColor::GetColor("#ffff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TPave *pave = new TPave(0.16,0.81,0.96,0.94,1,"brNDC"); pave->SetFillColor(0); pave->Draw(); leg = new TLegend(0.495,0.825,0.945,0.925,NULL,"NBNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("Graph3","Observed","LP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","Expected","L"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(2); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph1","#pm1#sigma Expected","F"); ci = TColor::GetColor("#00ff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F"); ci = TColor::GetColor("#ffff00"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.196,0.9113,"CMS"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextSize(0.048); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.196,0.8537,"Internal"); tex->SetNDC(); tex->SetTextAlign(13); tex->SetTextFont(52); tex->SetTextSize(0.03648); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.96,0.952,""); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.036); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.16,0.952,""); tex->SetNDC(); tex->SetTextFont(42); tex->SetTextSize(0.036); tex->SetLineWidth(2); tex->Draw(); pad->Modified(); limit->cd(); limit->Modified(); limit->cd(); limit->SetSelected(limit); }
// ----------------------------------------------------------------------------- // void test() { time_t start = TTimeStamp().GetSec(); set_plot_style(); bool draw = true; //bool debug = true; // Define analysis configuration PSet ps; defaultPSet(ps); // Response plots if (false) { //xSectDistr(ps); responseProfile(); return; } // Print configuration std::stringstream ss; printPSet(ps,ss); std::cout << ss.str() << std::endl; // Params to store DoubleVV ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err; IntV length; clear( ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length ); init( ps, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length ); // Loop through Meff bins int loop = 0; int nloops = ps.nmeff; for ( int imeff = 0; imeff < ps.nmeff; ++imeff ) { // Generate numbers in (x1,x2) plane DoubleVV dalitz; generateTruth( ps, imeff, dalitz, true ); // Integrate across dalitz plane integrate( ps, imeff, dalitz, ratio, ratio_errh, ratio_errl, pass, pass_err, fail, fail_err, length ); // Labeling std::stringstream ss; ss << "Meff" << int( ps.meff_bins[imeff] ); // New canvas for plots TCanvas* c1 = 0; if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" ); // Pad for cross-section plot TPad* pad = 0; if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.); if (pad) { pad->SetGrid(); pad->Draw(); pad->cd(); pad->SetLogz(); } TH1F* hr = 0; if (draw) hr = pad->DrawFrame(ps.min,ps.min,ps.max,ps.max); // Histo title if (hr) { std::stringstream sss; sss << "M_{eff}=" << ps.meff_bins[imeff] << " GeV" << ", p_{T1}=" << dr(ps.pt1_bins[imeff],1) << " GeV" << ", p_{T2}=" << dr(ps.pt2_bins[imeff],1) << " GeV" << ", p_{T3}=" << dr(ps.pt3_bins[imeff],1) << " GeV"; hr->SetTitle( sss.str().c_str() ); hr->GetXaxis()->SetTitle( "x_{2}" ); hr->GetYaxis()->SetTitle( "x_{1}" ); } // Create 2D cross-section plot TH2D* his = 0; if (draw) his = new TH2D(TString("Histo"+ss.str()),"", ps.nbins,ps.min,ps.max, ps.nbins,ps.min,ps.max); //double x3 = ( 2. * ps.pt3_bins[imeff] ) / ( ps.meff_bins[imeff] + ps.pt3_bins[imeff] ); // Fill 2D cross-section plot for ( int x2_bin = 0; x2_bin < ps.nbins; ++x2_bin ) { for ( int x1_bin = 0; x1_bin < ps.nbins; ++x1_bin ) { // std::cout << " Fill:" // << " x2_bin: " << x2_bin // << " x2: " << val(x2_bin,nbins) // << " x1_bin: " << x1_bin // << " x1: " << val(x1_bin,nbins) // << " val: " << dalitz[x2_bin][x1_bin] // << std::endl; if (his) his->Fill( val(x2_bin,ps)+ps.width/2., val(x1_bin,ps)+ps.width/2., dalitz[x2_bin][x1_bin] ); } } // Draw 2D cross-section plot gStyle->SetPalette(1); if (his) { //his->SetMaximum( his->GetMaximum()*10. ); //his->SetMinimum( his->GetMinimum(1.e-12)*0.1 ); // his->SetMaximum( 1.e9 ); // his->SetMinimum( 1.e0 ); his->Draw("COLZsame"); } // Pad for AlphaT contours if (c1) c1->cd(); TPad* overlay = 0; if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.); if (overlay) { overlay->SetFillStyle(4000); overlay->SetFillColor(0); overlay->SetFrameFillStyle(4000); overlay->Draw(); overlay->cd(); } //TH1F* hframe = 0; if (draw) overlay->DrawFrame(pad->GetUxmin(), pad->GetUymin(), pad->GetUxmax(), pad->GetUymax()); // Graphs of AlphaT contours TMultiGraph* mg = 0; if (draw) { mg = new TMultiGraph(); for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) { Double_t alpha_t = ps.cutValues[icut]; const Int_t n = ps.nbins; DoubleV x1(n,0.); DoubleV x2(n,0.); for ( Int_t x2_bin = 0; x2_bin < ps.nbins; x2_bin++ ) { x2[x2_bin] = x2_bin * ps.width; x1[x2_bin] = cutAlgoInverse(ps.cutValues[icut],x2[x2_bin],ALGO_TYPE); } TGraph* gr = new TGraph(n,&x2.front(),&x1.front()); mg->Add(gr,"l"); } mg->Draw(); } if (c1) c1->cd(); if (c1) c1->SaveAs(TString(ss.str()+".png")); if (c1) c1->SaveAs(TString(ss.str()+".pdf")); if (c1) c1->SaveAs(TString(ss.str()+".C")); } // Canvas for ratio vs Meff if (false) { TCanvas* c2 = new TCanvas( "c2", "" ); c2->SetRightMargin(0.2); c2->SetLogy(); c2->cd(); TMultiGraph* mg2 = new TMultiGraph(); DoubleV err( ps.nmeff, 0. ); for ( Int_t icut = 0; icut < (int)ps.cutValues.size(); icut++ ) { if ( length[icut] == 0 ) { continue; } // TGraphAsymmErrors* gr = new TGraphAsymmErrors( length[icut], // &ps.meff_bins.front(), // &err.front(), // &err.front(), // &ratio[icut].front(), // &ratio_errl[icut].front(), // &ratio_errh[icut].front() ); TGraph* gr = new TGraphAsymmErrors( length[icut], &ps.meff_bins.front(), &ratio[icut].front() ); std::stringstream ss; ss << "a_{T}=" << ps.cutValues[icut]; // << " Meff=" << meff_bins[imeff] // << ", p_{T3}=" << pt3_bins[imeff]; mg2->Add(gr,"lp"); gr->SetTitle(TString(ss.str())); gr->SetLineColor(2+icut); gr->SetLineWidth(2); gr->SetMarkerStyle(20+icut); gr->SetMarkerColor(2+icut); gr->SetMarkerSize(1.5); } mg2->Draw("a"); mg2->GetYaxis()->SetRangeUser(1.e-6,1.e0); c2->Update(); c2->BuildLegend(0.81,0.1,0.99,0.9); // Save canvases c2->cd(); c2->SaveAs("RatioVsMeff.png"); c2->SaveAs("RatioVsMeff.pdf"); c2->SaveAs("RatioVsMeff.C"); } time_t stop = TTimeStamp().GetSec(); std::cout << " Time taken: " << stop - start << " seconds" << std::endl; }
// ----------------------------------------------------------------------------- // void talk() { time_t start = TTimeStamp().GetSec(); bool draw = true; bool debug = true; // Binning int xbins = 100; int ybins = 100; double xmin = 0.0; double xmax = 1.0; double ymin = 0.0; double ymax = 1.0; double xbin_centre = ( ( xmax - xmin ) / xbins ) / 2.; double ybin_centre = ( ( ymax - ymin ) / ybins ) / 2.; // AlphaT values const int nat = 1; double at[nat]; for ( int ii = 0; ii < nat; ++ii ) { at[ii] = 0.55 + ii * 0.001; } // HT regions const int nht = 3; double ht_min[nht] = { 250., 300., 350. }; // Jet pT thresholds double pt1_min[nht] = { 71.4, 85.7, 100. }; double pt2_min[nht] = { 71.4, 85.7, 100. }; double pt3_min[nht] = { 35.7, 42.9., 50. }; // x fractions double x1_min[nht]; double x2_min[nht]; double x3_max[nht]; for ( int ii = 0; ii < nht; ++ii ) { x1_min[ii] = ( 2. * pt1_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } for ( int ii = 0; ii < nht; ++ii ) { x2_min[ii] = ( 2. * pt2_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } for ( int ii = 0; ii < nht; ++ii ) { x3_max[ii] = ( 2. * pt3_min[ii]) / ( ht_min[ii] + pt3_min[ii] ); } // Loop through bins int loop = 0; int nloops = nht; for ( int iht = 0; iht < nht; ++iht ) { std::cout << "Completed " << 100.*float(loop)/float(nloops) << "%..." << std::endl; loop++; // Labeling std::stringstream ss; ss << "HT" << int(ht_min[iht]); // New canvas for plots TCanvas* c1 = 0; if (draw) c1 = new TCanvas( TString("Canvas"+ss.str()), "" ); // Pad for cross-section plot TPad* pad = 0; if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.); if (pad) { pad->SetGrid(); pad->Draw(); pad->cd(); pad->SetLogz(); } TH1F* hr = 0; if (draw) hr = pad->DrawFrame(0.,0.,1.,1.); // Histo title if (hr) { std::stringstream sss; sss << "H_{T}=" << ht_min[iht] << "(p_{T1},p_{T2},p_{T3})=" << pt1_min[iht] << "," << pt2_min[iht] << "," << pt3_min[iht] << ")" << ", (x_{1},x_{2},x_{3})=" << x1_min[iht] << "," << x2_min[iht] << "," << x3_max[iht] << ")"; hr->SetTitle( sss.str().c_str() ); hr->GetXaxis()->SetTitle( "x_{2}" ); hr->GetYaxis()->SetTitle( "x_{1}" ); } // Create 2D cross-section plot TH2D* his = 0; if (draw) his = new TH2D(TString("Histo"+ss.str()),"", xbins,xmin,xmax, ybins,ymin,ymax); // Fill 2D cross-section plot for ( int xbin = 0; xbin < xbins; ++xbin ) { for ( int ybin = 0; ybin < ybins; ++ybin ) { double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin; double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin; double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) ); if ( !constrain( x1, x2, x3 ) ) { continue; } if ( x1 < x1_cut[ix1] ) { continue; } double alpha_t = x2 / ( 2 * sqrt(x1+x2-1) ); if (his) his->Fill( x2+xbin_centre, x1+ybin_centre, val ); } } // Draw 2D cross-section plot gStyle->SetPalette(1); if (his) { his->SetMaximum( his->GetMaximum() ); his->SetMinimum( his->GetMinimum(1.e-12) ); his->Draw("COLZsame"); } // Pad for AlphaT contours if (c1) c1->cd(); TPad* overlay = 0; if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.); if (overlay) { overlay->SetFillStyle(4000); overlay->SetFillColor(0); overlay->SetFrameFillStyle(4000); overlay->Draw(); overlay->cd(); } TH1F* hframe = 0; if (draw) overlay->DrawFrame(pad->GetUxmin(), pad->GetUymin(), pad->GetUxmax(), pad->GetUymax()); // Graphs of AlphaT contours TMultiGraph* mg = 0; if (draw) { mg = new TMultiGraph(); for ( Int_t iat = 0; iat < nat; iat++ ) { Double_t alpha_t = at[iat]; const Int_t n_ = 100; Double_t x1_[n_]; Double_t x2_[n_]; for ( Int_t j = 0; j < 100; j++ ) { x2_[j] = j*0.01; Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t ); x1_[j] = temp * temp + 1 - alpha_t * alpha_t; } TGraph* gr = new TGraph(n_,x2_,x1_); mg->Add(gr,"l"); } mg->Draw(); } if (c1) c1->cd(); if (c1) c1->SaveAs(TString(ss.str()+".png")); } }
void GE11sEfficiencyScan(int RunNumber, string RunName, string path) { ifstream InGE11_IV_GIF, InGE11_IV, InGE11_V; //string path = "/home/ramkrishna/TEMP/LogFiles_TB/LogFiles306To407"; string gif = path+"/Efficiency_LC1_"+std::to_string(RunNumber)+".log"; string IV = path+"/Efficiency_LC2_"+std::to_string(RunNumber)+".log"; string V = path+"/Efficiency_LC3_"+std::to_string(RunNumber)+".log"; cout<<"gif = "<<gif<<endl; InGE11_IV_GIF.open(gif); InGE11_IV.open(IV); InGE11_V.open(V); string rootFile = "Efficiency_Run"+std::to_string(RunNumber)+".root"; const char *CharrootFile = rootFile.c_str(); TFile *f = new TFile(CharrootFile,"RECREATE"); //TTree *tree = new TTree("Run306", "Detector info for Run 306"); TNtuple *GE11_IV_GIF = new TNtuple("GE11_IV_GIF","data from text file LC1","MeanPosOfSector:Efficiency:EfficiencyError:Nevents"); TNtuple *GE11_IV = new TNtuple("GE11_IV","data from text file LC2","MeanPosOfSector:Efficiency:EfficiencyError:Nevents"); TNtuple *GE11_V = new TNtuple("GE11_V","data from text file LC3","MeanPosOfSector:Efficiency:EfficiencyError:Nevents"); Int_t nlines = 0; vector<double> GIF_MeanPosOfSector, GIF_Efficiency, GIF_EfficiencyError; vector<unsigned int> GIF_Nevents; unsigned int temp_Nevents; double temp_MeanPosOfSector, temp_Efficiency, temp_EfficiencyError; vector<double> IV_MeanPosOfSector, IV_Efficiency, IV_EfficiencyError; vector<unsigned int> IV_Nevents; vector<double> V_MeanPosOfSector, V_Efficiency, V_EfficiencyError; vector<unsigned int> V_Nevents; string NameOfDet, xRange; while (1) { InGE11_IV_GIF >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents; if (!InGE11_IV_GIF.good()) break; GIF_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5)); GIF_Efficiency.push_back(temp_Efficiency); GIF_EfficiencyError.push_back(temp_EfficiencyError); GIF_Nevents.push_back(temp_Nevents); GE11_IV_GIF->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents); nlines++; if (nlines > 20) { cout<<"Check the input text file for run number "<< RunNumber << endl; exit(EXIT_SUCCESS); } } InGE11_IV_GIF.close(); nlines=0; while (1) { InGE11_IV >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents; if (!InGE11_IV.good()) break; IV_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5)); IV_Efficiency.push_back(temp_Efficiency); IV_EfficiencyError.push_back(temp_EfficiencyError); IV_Nevents.push_back(temp_Nevents); GE11_IV->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents); nlines++; } InGE11_IV.close(); nlines=0; while (1) { InGE11_V >> NameOfDet >> xRange >> temp_MeanPosOfSector >> temp_Efficiency >> temp_EfficiencyError >> temp_Nevents; if (!InGE11_V.good()) break; V_MeanPosOfSector.push_back(temp_MeanPosOfSector+(nlines*5)); V_Efficiency.push_back(temp_Efficiency); V_EfficiencyError.push_back(temp_EfficiencyError); V_Nevents.push_back(temp_Nevents); GE11_V->Fill(temp_MeanPosOfSector+(nlines*5),temp_Efficiency,temp_EfficiencyError,temp_Nevents); nlines++; } InGE11_V.close(); string CanvasName = "RunNumber"+std::to_string(RunNumber); const char * CharCanvasName = CanvasName.c_str(); TCanvas* c1 = new TCanvas(CharCanvasName,"Efficiency Scan Plot",200,10,700,500); TPad *pad = new TPad("pad","",0,0,1,1); //pad->SetFillColor(42); pad->SetGrid(); pad->Draw(); pad->cd(); // draw a frame to define the range TH1F *hr = pad->DrawFrame(0,-0.5,100,1.1); hr->SetXTitle("Detector Position (mm)"); hr->SetYTitle("Efficiency"); //pad->GetFrame()->SetFillColor(21); pad->GetFrame()->SetBorderSize(12); // create first graph TGraphErrors *gr_GIF = new TGraphErrors(V_Efficiency.size()); TGraphErrors *gr_IV = new TGraphErrors(V_Efficiency.size()); TGraphErrors *gr_V = new TGraphErrors(V_Efficiency.size()); for(unsigned int i=0;i<V_Efficiency.size();i++) { gr_GIF->SetPoint(i, GIF_MeanPosOfSector[i], GIF_Efficiency[i]); gr_GIF->SetPointError(i,0, GIF_EfficiencyError[i]); gr_IV->SetPoint(i, IV_MeanPosOfSector[i], IV_Efficiency[i]); gr_IV->SetPointError(i,0, IV_EfficiencyError[i]); gr_V->SetPoint(i, V_MeanPosOfSector[i], V_Efficiency[i]); gr_V->SetPointError(i,0, V_EfficiencyError[i]); } gr_GIF->SetMarkerColor(kBlue); gr_GIF->SetLineColor(kBlue); gr_GIF->SetMarkerStyle(21); gr_GIF->GetXaxis()->SetTitle("dist (mm)"); gr_GIF->GetYaxis()->SetTitle("Efficiency"); gr_GIF->GetYaxis()->SetRangeUser(0,1.2); gr_GIF->SetTitle("Efficiency Scan"); gr_GIF->Draw("ACP"); gr_IV->SetMarkerColor(kGreen-6); gr_IV->SetLineColor(kGreen); gr_IV->SetMarkerStyle(21); gr_IV->Draw("sameCP"); gr_V->SetMarkerColor(kBlack); gr_V->SetLineColor(kBlack); gr_V->SetMarkerStyle(21); gr_V->Draw("sameCP"); //create a transparent pad drawn on top of the main pad c1->cd(); TPad *overlay = new TPad("overlay","",0,0,1,1); overlay->SetFillStyle(4000); overlay->SetFillColor(0); overlay->SetFrameFillStyle(4000); overlay->Draw(); overlay->cd(); // create second graph //TGraphErrors* gr_GIF_Num = new TGraphErrors("data_noerror.dat","%lg %lg"); TGraphErrors *gr_GIF_Num = new TGraphErrors(GIF_Nevents.size()); TGraphErrors *gr_IV_Num = new TGraphErrors(IV_Nevents.size()); TGraphErrors *gr_V_Num = new TGraphErrors(V_Nevents.size()); for(unsigned int i=0;i<V_MeanPosOfSector.size();i++) { gr_GIF_Num->SetPoint(i,GIF_MeanPosOfSector[i],GIF_Nevents[i]); gr_IV_Num->SetPoint(i,IV_MeanPosOfSector[i],IV_Nevents[i]); gr_V_Num->SetPoint(i,V_MeanPosOfSector[i],V_Nevents[i]); } gr_GIF_Num->SetMarkerColor(kBlue); gr_GIF_Num->SetLineColor(kBlue); gr_GIF_Num->SetLineStyle(2); gr_GIF_Num->SetLineWidth(3); gr_GIF_Num->SetMarkerStyle(22); gr_GIF_Num->SetName("gr_GIF_Num"); gr_IV_Num->SetMarkerColor(kGreen-6); gr_IV_Num->SetLineColor(kGreen); gr_IV_Num->SetMarkerStyle(22); gr_IV_Num->SetLineStyle(2); gr_IV_Num->SetLineWidth(3); gr_IV_Num->SetName("gr_IV_Num"); gr_V_Num->SetMarkerColor(kBlack); gr_V_Num->SetLineColor(kBlack); gr_V_Num->SetMarkerStyle(22); gr_V_Num->SetLineStyle(2); gr_V_Num->SetLineWidth(3); gr_V_Num->SetName("gr_V_Num"); Double_t xmin = pad->GetUxmin(); Double_t ymin = 0; Double_t xmax = pad->GetUxmax(); Double_t ymax = 1550; TH1F *hframe = overlay->DrawFrame(xmin,ymin,xmax,ymax); hframe->GetXaxis()->SetLabelOffset(99); hframe->GetYaxis()->SetLabelOffset(99); hframe->Draw("Y+"); gr_GIF_Num->Draw("CPY+"); gr_IV_Num->Draw("CPY+"); gr_V_Num->Draw("CPY+"); //Draw the Legend TLegend *leg = new TLegend(0.10,0.732,0.40,0.90); leg->AddEntry(gr_GIF,"GE11_IV_GIF eff","LPE"); leg->AddEntry(gr_IV,"GE11_IV eff","LPE"); leg->AddEntry(gr_V,"GE11_V eff","LPE"); leg->AddEntry(gr_GIF_Num,"No of events_GE11_IV_GIF","LPE"); leg->AddEntry(gr_IV_Num,"No of events_GE11_IV","LPE"); leg->AddEntry(gr_V_Num,"No of events_GE11_V","LPE"); leg->Draw("same"); const char *runnum = RunName.c_str(); TLatex *t2a = new TLatex(0.00,0.94, runnum ); t2a->SetNDC(); t2a->SetTextFont(42); t2a->SetTextSize(0.033); t2a->SetTextAlign(13); t2a->Draw("same"); //Draw an axis on the right side TGaxis *axis = new TGaxis(xmax,ymin,xmax, ymax,ymin,ymax,510,"+L"); axis->SetLineColor(kRed); axis->SetLabelColor(kRed); axis->SetTitle("Approx. No. of Events"); axis->Draw(); string OutputFileName = "GE11_Efficiency_Scan_"+std::to_string(RunNumber)+".pdf"; const char *CharOutputFileName = OutputFileName.c_str(); c1->SaveAs(CharOutputFileName); c1->Write(); //tree->Write(); //tree->Write("", TObject::kOverwrite); f->Write(); }
void plot(int mass) { double myQCDRelUncert = 0.038; double myEWKRelUncert = 0.131; double myFakesRelUncert = 0.238; double delta = 1.4; double br = 0.05; bool debug = false; bool log = false; double ymin = 0.001; double ymax = 48; static bool bMessage = false; if (!bMessage) { cout << "Values used as relative uncertainty (please check):" << endl; cout << " QCD: " << myQCDRelUncert << endl; cout << " EWK genuine tau: " << myEWKRelUncert << endl; cout << " EWK fake tau: " << myFakesRelUncert << endl << endl; bMessage = true; } cout << "Processing mass point: " << mass << " GeV/c2" << endl; gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetTitleFont(43, "xyz"); gStyle->SetTitleSize(33, "xyz"); gStyle->SetLabelFont(43, "xyz"); gStyle->SetLabelSize(27, "xyz"); //std::string infile = "EPS_data_nodeltaphi/hplus_100.root"; //std::string infile = "EPS_data_deltaphi160/hplus_100.root"; std::stringstream s; s << "lands_histograms_hplushadronic_m" << mass << ".root"; std::string infile = s.str(); // Canvas TCanvas *myCanvas = new TCanvas("myCanvas", "",0,0,600,600); myCanvas->SetHighLightColor(2); myCanvas->Range(0,0,1,1); myCanvas->SetFillColor(0); myCanvas->SetBorderMode(0); myCanvas->SetBorderSize(2); if (log) myCanvas->SetLogy(); myCanvas->SetTickx(1); myCanvas->SetTicky(1); myCanvas->SetLeftMargin(0.16); myCanvas->SetRightMargin(0.05); myCanvas->SetTopMargin(0.05); myCanvas->SetBottomMargin(0.08); myCanvas->SetFrameFillStyle(0); myCanvas->SetFrameBorderMode(0); myCanvas->SetFrameFillStyle(0); myCanvas->SetFrameBorderMode(0); myCanvas->cd(); Int_t ci; TFile* f = TFile::Open(infile.c_str()); s.str(""); s << "HW" << mass << "_1"; TH1* hw = (TH1*)f->Get(s.str().c_str()); s.str(""); s << "HH" << mass << "_1"; TH1* hh = (TH1*)f->Get(s.str().c_str()); TH1* data = (TH1*)f->Get("data_obs"); data->SetLineWidth(2); data->SetMarkerStyle(20); data->SetMarkerSize(1.2); TH1* ewktau = (TH1*)f->Get("EWK_Tau"); ci = TColor::GetColor("#993399"); ewktau->SetFillColor(ci); ewktau->SetLineWidth(0); TH1* ewkDY = (TH1*)f->Get("EWK_DYx"); TH1* ewkVV = (TH1*)f->Get("EWK_VVx"); ewktau->Add(ewkDY); ewktau->Add(ewkVV); //TH1* qcd = (TH1*)f->Get("QCDInv"); TH1* qcd = (TH1*)f->Get("QCD"); ci = TColor::GetColor("#ffcc33"); qcd->SetFillColor(ci); qcd->SetLineWidth(0); TH1* fakett = (TH1*)f->Get("fake_tt"); ci = TColor::GetColor("#669900"); fakett->SetFillColor(ci); fakett->SetLineWidth(0); TH1* fakeW = (TH1*)f->Get("fake_W"); ci = TColor::GetColor("#cc3300"); fakeW->SetFillColor(ci); fakeW->SetLineWidth(0); TH1* faket = (TH1*)f->Get("fake_t"); TH1F *hFrame = new TH1F("hFrame","",20,0,400); hFrame->SetMinimum(ymin); if (log) hFrame->SetMaximum(ymax*1.5); else hFrame->SetMaximum(ymax); hFrame->SetDirectory(0); hFrame->SetStats(0); hFrame->SetLineStyle(0); hFrame->SetMarkerStyle(20); hFrame->SetXTitle("Transverse mass (#tau jet, E_{T}^{miss}), (GeV/c^{2})"); if (paperStatus) hFrame->SetXTitle("Transverse mass (#tau_{h}, E_{T}^{miss}), (GeV/c^{2})"); hFrame->SetYTitle("Events / 20 GeV/c^{2}"); hFrame->GetXaxis()->SetTitleSize(0); hFrame->GetXaxis()->SetLabelSize(0); hFrame->GetYaxis()->SetTitleFont(43); hFrame->GetYaxis()->SetTitleSize(27); hFrame->GetYaxis()->SetTitleOffset(1.3); // signal hh->Scale(br*br); hw->Scale(2*br*(1.0-br)); TH1* signal = (TH1*)hh->Clone(); signal->Add(hw); ci = TColor::GetColor("#ff3399"); signal->SetLineColor(ci); signal->SetLineStyle(2); signal->SetLineWidth(2); // Fakes TH1* fakes = (TH1*)(fakett->Clone()); fakes->Add(fakeW); fakes->Add(faket); // stacked backgrounds THStack *exp = new THStack(); exp->SetName("exp"); exp->SetTitle("exp"); exp->Add(fakes); exp->Add(ewktau); exp->Add(qcd); exp->Add(signal); TH1* hExpBkg = (TH1*)fakes->Clone(); hExpBkg->Add(ewktau); hExpBkg->Add(qcd); // uncertainty TH1* uncert = (TH1*)fakeW->Clone(); uncert->Add(fakett); uncert->Add(ewktau); uncert->Add(qcd); uncert->SetFillColor(1); uncert->SetFillStyle(3344); uncert->SetLineColor(0); uncert->SetLineStyle(0); uncert->SetLineWidth(0); TH1* hExpBkgTotalUncert = (TH1*)uncert->Clone(); hExpBkgTotalUncert->SetFillStyle(3354); TH1* hAgreement = (TH1*)data->Clone(); hAgreement->Divide(hExpBkg); TGraphErrors* hAgreementRelUncert = new TGraphErrors(hAgreement->GetNbinsX()); hAgreementRelUncert->SetLineWidth(2); hAgreementRelUncert->SetLineColor(kBlack); for (int i = 1; i <= hFrame->GetNbinsX(); ++i) { double myQCDTotalUncert = TMath::Power(qcd->GetBinError(i), 2) + TMath::Power(qcd->GetBinContent(i)*myQCDRelUncert, 2); double myEWKTotalUncert = TMath::Power(ewktau->GetBinError(i), 2) + TMath::Power(ewktau->GetBinContent(i)*myEWKRelUncert, 2); double myFakesTotalUncert = TMath::Power(fakes->GetBinError(i), 2) + TMath::Power(fakes->GetBinContent(i)*myFakesRelUncert, 2); hExpBkgTotalUncert->SetBinError(i, TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert)); if (hExpBkg->GetBinContent(i) > 0) { hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), data->GetBinContent(i) / hExpBkg->GetBinContent(i)); double myUncertData = 0; if (data->GetBinContent(i) > 0) myUncertData = TMath::Power(data->GetBinError(i) / data->GetBinContent(i), 2); double myUncertBkg = (myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / TMath::Power(hExpBkg->GetBinContent(i), 2); hAgreementRelUncert->SetPointError(i-1, 0, data->GetBinContent(i) / hExpBkg->GetBinContent(i) * TMath::Sqrt(myUncertData + myUncertBkg)); } else { hAgreementRelUncert->SetPoint(i-1, hExpBkg->GetBinCenter(i), 0); hAgreementRelUncert->SetPointError(i-1, 0, 0); } if (debug) { cout << "Point: " << hAgreementRelUncert->GetX()[i-1]-10 << "-" << hAgreementRelUncert->GetX()[i-1]+10 << " GeV/c2, agreement: " << hAgreementRelUncert->GetY()[i-1] << ", uncert: " << hAgreement->GetBinError(i) << ", " << hAgreementRelUncert->GetErrorY(i-1) << endl; cout << " bkg. stat. uncert. " << hExpBkg->GetBinError(i) << " (i.e. " << hExpBkg->GetBinError(i) / hExpBkg->GetBinContent(i) * 100.0 << " %)" << ", stat+syst uncert. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) << " (i.e. " << TMath::Sqrt(myQCDTotalUncert + myEWKTotalUncert + myFakesTotalUncert) / hExpBkg->GetBinContent(i) * 100.0 << " %)" << endl; } } // Agreement pad TPad* pad = new TPad("ratiopad","ratiopad",0.,0.,1.,.3); pad->Draw(); pad->cd(); pad->Range(0,0,1,1); pad->SetFillColor(0); pad->SetFillStyle(4000); pad->SetBorderMode(0); pad->SetBorderSize(2); pad->SetTickx(1); pad->SetTicky(1); pad->SetLeftMargin(0.16); pad->SetRightMargin(0.05); pad->SetTopMargin(0); pad->SetBottomMargin(0.34); pad->SetFrameFillStyle(0); pad->SetFrameBorderMode(0); // Plot here ratio if (1.0-delta > 0) hAgreement->SetMinimum(1.0-delta); else hAgreement->SetMinimum(0.); hAgreement->SetMaximum(1.0+delta); hAgreement->GetXaxis()->SetLabelOffset(0.007); hAgreement->GetXaxis()->SetLabelFont(43); hAgreement->GetXaxis()->SetLabelSize(27); hAgreement->GetYaxis()->SetLabelFont(43); hAgreement->GetYaxis()->SetLabelSize(27); hAgreement->GetYaxis()->SetLabelOffset(0.007); hAgreement->GetYaxis()->SetNdivisions(505); hAgreement->GetXaxis()->SetTitleFont(43); hAgreement->GetYaxis()->SetTitleFont(43); hAgreement->GetXaxis()->SetTitleSize(33); hAgreement->GetYaxis()->SetTitleSize(33); hAgreement->SetTitleSize(27, "xyz"); hAgreement->GetXaxis()->SetTitleOffset(3.2); hAgreement->GetYaxis()->SetTitleOffset(1.3); hAgreement->SetXTitle(hFrame->GetXaxis()->GetTitle()); hAgreement->SetYTitle("Data/#Sigmabkg"); hAgreement->Draw("e2"); // Plot line at zero TH1* hAgreementLine = dynamic_cast<TH1*>(hAgreement->Clone()); for (int i = 1; i <= hAgreementLine->GetNbinsX(); ++i) { hAgreementLine->SetBinContent(i,1.0); hAgreementLine->SetBinError(i,0.0); } hAgreementLine->SetLineColor(kRed); hAgreementLine->SetLineWidth(2); hAgreementLine->SetLineStyle(3); hAgreementLine->Draw("hist same"); hAgreement->Draw("same"); hAgreementRelUncert->Draw("[]"); pad->RedrawAxis(); myCanvas->cd(); TPad* plotpad = new TPad("plotpad", "plotpad",0,0.3,1.,1.); plotpad->Draw(); plotpad->cd(); plotpad->Range(0,0,1,1); plotpad->SetFillColor(0); plotpad->SetFillStyle(4000); plotpad->SetBorderMode(0); plotpad->SetBorderSize(2); //if (logy) // plotpad->SetLogy(); plotpad->SetTickx(1); plotpad->SetTicky(1); plotpad->SetLeftMargin(0.16); plotpad->SetRightMargin(0.05); plotpad->SetTopMargin(0.065); plotpad->SetBottomMargin(0.0); plotpad->SetFrameFillStyle(0); plotpad->SetFrameBorderMode(0); hFrame->GetXaxis()->SetTitleSize(0); hFrame->GetXaxis()->SetLabelSize(0); hFrame->GetYaxis()->SetTitleFont(43); hFrame->GetYaxis()->SetTitleSize(33); hFrame->GetYaxis()->SetTitleOffset(1.3); // Draw objects hFrame->Draw(); exp->Draw("hist same"); uncert->Draw("E2 same"); hExpBkgTotalUncert->Draw("E2 same"); // Data data->Draw("same"); //signal->Draw("same"); TLegend *leg = new TLegend(0.53,0.6,0.87,0.91,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(63); leg->SetTextSize(18); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(kWhite); //leg->SetFillStyle(4000); // enabling this will cause the plot to be erased from the pad TLegendEntry* entry = leg->AddEntry(data, "Data", "P"); s.str(""); s << "with H^{#pm}#rightarrow#tau^{#pm}#nu"; entry = leg->AddEntry(signal, s.str().c_str(), "L"); entry = leg->AddEntry(qcd, "QCD (meas.)", "F"); entry = leg->AddEntry(ewktau, "EWK genuine #tau (meas.)", "F"); entry = leg->AddEntry(fakes, "EWK fake #tau (MC)", "F"); entry = leg->AddEntry(uncert, "stat. uncert.", "F"); entry = leg->AddEntry(hExpBkgTotalUncert, "stat. #oplus syst. uncert.", "F"); leg->Draw(); string myTitle = "CMS Preliminary"; if (paperStatus) myTitle = "CMS"; TLatex *tex = new TLatex(0.62,0.945,myTitle.c_str()); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(27); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.2,0.945,"#sqrt{s} = 7 TeV"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(27); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.43,0.945,"2.2 fb^{-1}"); tex->SetNDC(); tex->SetTextFont(43); tex->SetTextSize(27); tex->SetLineWidth(2); tex->Draw(); s.str(""); s << "m_{H^{#pm}} = " << mass << " GeV/c^{2}"; tex = new TLatex(0.28,0.865,s.str().c_str()); tex->SetNDC(); tex->SetTextFont(63); tex->SetTextSize(20); tex->SetLineWidth(2); tex->Draw(); s.str(""); s << "BR(t#rightarrowbH^{#pm})=" << setprecision(2) << br; tex = new TLatex(0.28,0.805,s.str().c_str()); tex->SetNDC(); tex->SetTextFont(63); tex->SetTextSize(20); tex->SetLineWidth(2); tex->Draw(); plotpad->RedrawAxis(); plotpad->Modified(); s.str(""); s << "mT_datadriven_m" << mass << ".png"; myCanvas->Print(s.str().c_str()); s.str(""); s << "mT_datadriven_m" << mass << ".C"; myCanvas->Print(s.str().c_str()); s.str(""); s << "mT_datadriven_m" << mass << ".eps"; myCanvas->Print(s.str().c_str()); }