Exemplo n.º 1
0
void fitLMdataDD1()
{
//=========Macro generated from canvas: c1/data fits
//=========  (Thu Jun 30 23:01:40 2016) by ROOT version6.06/02
   TCanvas *c1 = new TCanvas("c1", "data fits",0,0,1200,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.14);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.05);
   c1->SetBottomMargin(0.16);
   c1->SetFrameLineWidth(2);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(1075.63,-26.4,1149.704,8.8);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.14);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.5);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   
   TH1D *frame_4616180__1 = new TH1D("frame_4616180__1","",100,1086,1146);
   frame_4616180__1->SetBinContent(1,3.231238);
   frame_4616180__1->SetMinimum(-8.8);
   frame_4616180__1->SetMaximum(8.8);
   frame_4616180__1->SetEntries(1);
   frame_4616180__1->SetDirectory(0);
   frame_4616180__1->SetStats(0);
   frame_4616180__1->SetLineWidth(2);
   frame_4616180__1->SetMarkerStyle(20);
   frame_4616180__1->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_4616180__1->GetXaxis()->SetNdivisions(505);
   frame_4616180__1->GetXaxis()->SetLabelFont(132);
   frame_4616180__1->GetXaxis()->SetLabelOffset(0.01);
   frame_4616180__1->GetXaxis()->SetLabelSize(0.15);
   frame_4616180__1->GetXaxis()->SetTitleSize(0.2);
   frame_4616180__1->GetXaxis()->SetTitleOffset(1.1);
   frame_4616180__1->GetXaxis()->SetTitleFont(132);
   frame_4616180__1->GetYaxis()->SetTitle("Pull");
   frame_4616180__1->GetYaxis()->CenterTitle(true);
   frame_4616180__1->GetYaxis()->SetNdivisions(505);
   frame_4616180__1->GetYaxis()->SetLabelFont(132);
   frame_4616180__1->GetYaxis()->SetLabelOffset(0.01);
   frame_4616180__1->GetYaxis()->SetLabelSize(0.15);
   frame_4616180__1->GetYaxis()->SetTitleSize(0.15);
   frame_4616180__1->GetYaxis()->SetTitleOffset(0.45);
   frame_4616180__1->GetYaxis()->SetTitleFont(132);
   frame_4616180__1->GetZaxis()->SetLabelFont(132);
   frame_4616180__1->GetZaxis()->SetLabelSize(0.06);
   frame_4616180__1->GetZaxis()->SetTitleSize(0.072);
   frame_4616180__1->GetZaxis()->SetTitleOffset(1.2);
   frame_4616180__1->GetZaxis()->SetTitleFont(132);
   frame_4616180__1->Draw("FUNC");
   
   Double_t pull_Hist_curvetot_fx3001[100] = {
   1086.3,
   1086.9,
   1087.5,
   1088.1,
   1088.7,
   1089.3,
   1089.9,
   1090.5,
   1091.1,
   1091.7,
   1092.3,
   1092.9,
   1093.5,
   1094.1,
   1094.7,
   1095.3,
   1095.9,
   1096.5,
   1097.1,
   1097.7,
   1098.3,
   1098.9,
   1099.5,
   1100.1,
   1100.7,
   1101.3,
   1101.9,
   1102.5,
   1103.1,
   1103.7,
   1104.3,
   1104.9,
   1105.5,
   1106.1,
   1106.7,
   1107.3,
   1107.9,
   1108.5,
   1109.1,
   1109.7,
   1110.3,
   1110.9,
   1111.5,
   1112.1,
   1112.7,
   1113.3,
   1113.9,
   1114.5,
   1115.1,
   1115.7,
   1116.3,
   1116.9,
   1117.5,
   1118.1,
   1118.7,
   1119.3,
   1119.9,
   1120.5,
   1121.1,
   1121.7,
   1122.3,
   1122.9,
   1123.5,
   1124.1,
   1124.7,
   1125.3,
   1125.9,
   1126.5,
   1127.1,
   1127.7,
   1128.3,
   1128.9,
   1129.5,
   1130.1,
   1130.7,
   1131.3,
   1131.9,
   1132.5,
   1133.1,
   1133.7,
   1134.3,
   1134.9,
   1135.5,
   1136.1,
   1136.7,
   1137.3,
   1137.9,
   1138.5,
   1139.1,
   1139.7,
   1140.3,
   1140.9,
   1141.5,
   1142.1,
   1142.7,
   1143.3,
   1143.9,
   1144.5,
   1145.1,
   1145.7};
   Double_t pull_Hist_curvetot_fy3001[100] = {
   1.567716,
   -0.01802354,
   1.048819,
   -1.337434,
   0.7673198,
   -1.19002,
   1.657461,
   0.3555638,
   -0.4222204,
   0.08805511,
   -1.111787,
   -0.4985715,
   -1.001333,
   -0.4301789,
   -0.8996244,
   -1.03039,
   -0.4813203,
   -1.690616,
   0.136304,
   0.7381026,
   -1.663937,
   0.3265525,
   -0.8449469,
   -1.283283,
   -0.2146925,
   1.001906,
   1.2668,
   -0.8713828,
   -0.2588558,
   0.4168138,
   -1.05013,
   -0.2365293,
   0.9717923,
   0.177655,
   -0.6809003,
   -2.050549,
   -1.317319,
   -1.744711,
   0.7530113,
   -0.5324956,
   -3.192609,
   -0.702433,
   -0.4992051,
   1.446781,
   0.4511227,
   0.1234012,
   -0.1842181,
   -0.6838522,
   0.6279079,
   1.226488,
   0.8796543,
   -1.375341,
   -1.52658,
   -1.501556,
   0.7034038,
   0.2379835,
   0.5620199,
   1.110507,
   1.312001,
   0.4867169,
   -0.9343264,
   -0.1303707,
   1.184677,
   1.786442,
   0.971916,
   -0.2368873,
   0.8377656,
   1.528783,
   0.1657852,
   -0.1623629,
   -0.03456284,
   1.033279,
   0.910172,
   -0.2947283,
   1.647159,
   -1.386851,
   0.3986765,
   0.2064252,
   0.8516845,
   -0.7986838,
   0.1469755,
   0.3027171,
   -0.07111516,
   -1.561177,
   0.07538211,
   0.05947311,
   -0.1374486,
   0.5432766,
   0.691862,
   -0.3671123,
   0.3407757,
   1.545623,
   -0.5970584,
   -2.22819,
   -1.973752,
   0.6254225,
   1.778508,
   -1.274099,
   -0.07162717,
   -5.109475};
   Double_t pull_Hist_curvetot_felx3001[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fely3001[100] = {
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1};
   Double_t pull_Hist_curvetot_fehx3001[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehy3001[100] = {
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(100,pull_Hist_curvetot_fx3001,pull_Hist_curvetot_fy3001,pull_Hist_curvetot_felx3001,pull_Hist_curvetot_fehx3001,pull_Hist_curvetot_fely3001,pull_Hist_curvetot_fehy3001);
   grae->SetName("pull_Hist_curvetot");
   grae->SetTitle("Pull of Histogram of data_plot__R_M and Projection of totalPdf");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_pull_Hist_curvetot3001 = new TH1F("Graph_pull_Hist_curvetot3001","Pull of Histogram of data_plot__R_M and Projection of totalPdf",100,1080.36,1151.64);
   Graph_pull_Hist_curvetot3001->SetMinimum(-6.999066);
   Graph_pull_Hist_curvetot3001->SetMaximum(3.676033);
   Graph_pull_Hist_curvetot3001->SetDirectory(0);
   Graph_pull_Hist_curvetot3001->SetStats(0);
   Graph_pull_Hist_curvetot3001->SetLineWidth(2);
   Graph_pull_Hist_curvetot3001->SetMarkerStyle(20);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetNdivisions(505);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleOffset(1.2);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_pull_Hist_curvetot3001);
   
   grae->Draw("p");
   
   TH1D *frame_4616180__2 = new TH1D("frame_4616180__2","",100,1086,1146);
   frame_4616180__2->SetBinContent(1,3.231238);
   frame_4616180__2->SetMinimum(-8.8);
   frame_4616180__2->SetMaximum(8.8);
   frame_4616180__2->SetEntries(1);
   frame_4616180__2->SetDirectory(0);
   frame_4616180__2->SetStats(0);
   frame_4616180__2->SetLineWidth(2);
   frame_4616180__2->SetMarkerStyle(20);
   frame_4616180__2->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_4616180__2->GetXaxis()->SetNdivisions(505);
   frame_4616180__2->GetXaxis()->SetLabelFont(132);
   frame_4616180__2->GetXaxis()->SetLabelOffset(0.01);
   frame_4616180__2->GetXaxis()->SetLabelSize(0.15);
   frame_4616180__2->GetXaxis()->SetTitleSize(0.2);
   frame_4616180__2->GetXaxis()->SetTitleOffset(1.1);
   frame_4616180__2->GetXaxis()->SetTitleFont(132);
   frame_4616180__2->GetYaxis()->SetTitle("Pull");
   frame_4616180__2->GetYaxis()->CenterTitle(true);
   frame_4616180__2->GetYaxis()->SetNdivisions(505);
   frame_4616180__2->GetYaxis()->SetLabelFont(132);
   frame_4616180__2->GetYaxis()->SetLabelOffset(0.01);
   frame_4616180__2->GetYaxis()->SetLabelSize(0.15);
   frame_4616180__2->GetYaxis()->SetTitleSize(0.15);
   frame_4616180__2->GetYaxis()->SetTitleOffset(0.45);
   frame_4616180__2->GetYaxis()->SetTitleFont(132);
   frame_4616180__2->GetZaxis()->SetLabelFont(132);
   frame_4616180__2->GetZaxis()->SetLabelSize(0.06);
   frame_4616180__2->GetZaxis()->SetTitleSize(0.072);
   frame_4616180__2->GetZaxis()->SetTitleOffset(1.2);
   frame_4616180__2->GetZaxis()->SetTitleFont(132);
   frame_4616180__2->Draw("AXISSAME");
   pad2->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(1075.63,0,1149.704,4.122406);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.14);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.06);
   pad1->SetBottomMargin(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   
   TH1D *frame_4324fb0__3 = new TH1D("frame_4324fb0__3","A RooPlot of \"#Lambda mass\"",100,1086,1146);
   frame_4324fb0__3->SetBinContent(1,1260.154);
   frame_4324fb0__3->SetMinimum(1);
   frame_4324fb0__3->SetMaximum(7500);
   frame_4324fb0__3->SetEntries(1);
   frame_4324fb0__3->SetDirectory(0);
   frame_4324fb0__3->SetStats(0);
   frame_4324fb0__3->SetLineWidth(2);
   frame_4324fb0__3->SetMarkerStyle(20);
   frame_4324fb0__3->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_4324fb0__3->GetXaxis()->SetNdivisions(505);
   frame_4324fb0__3->GetXaxis()->SetLabelFont(132);
   frame_4324fb0__3->GetXaxis()->SetLabelOffset(0.01);
   frame_4324fb0__3->GetXaxis()->SetLabelSize(0.06);
   frame_4324fb0__3->GetXaxis()->SetTitleSize(0.072);
   frame_4324fb0__3->GetXaxis()->SetTitleOffset(0.95);
   frame_4324fb0__3->GetXaxis()->SetTitleFont(132);
   frame_4324fb0__3->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4324fb0__3->GetYaxis()->SetLabelFont(132);
   frame_4324fb0__3->GetYaxis()->SetLabelOffset(0.01);
   frame_4324fb0__3->GetYaxis()->SetLabelSize(0.06);
   frame_4324fb0__3->GetYaxis()->SetTitleSize(0.072);
   frame_4324fb0__3->GetYaxis()->SetTitleOffset(0.95);
   frame_4324fb0__3->GetYaxis()->SetTitleFont(132);
   frame_4324fb0__3->GetZaxis()->SetLabelFont(132);
   frame_4324fb0__3->GetZaxis()->SetLabelSize(0.06);
   frame_4324fb0__3->GetZaxis()->SetTitleSize(0.072);
   frame_4324fb0__3->GetZaxis()->SetTitleOffset(1.2);
   frame_4324fb0__3->GetZaxis()->SetTitleFont(132);
   frame_4324fb0__3->Draw("FUNC");
   
   Double_t Hist_fx3002[100] = {
   1086.3,
   1086.9,
   1087.5,
   1088.1,
   1088.7,
   1089.3,
   1089.9,
   1090.5,
   1091.1,
   1091.7,
   1092.3,
   1092.9,
   1093.5,
   1094.1,
   1094.7,
   1095.3,
   1095.9,
   1096.5,
   1097.1,
   1097.7,
   1098.3,
   1098.9,
   1099.5,
   1100.1,
   1100.7,
   1101.3,
   1101.9,
   1102.5,
   1103.1,
   1103.7,
   1104.3,
   1104.9,
   1105.5,
   1106.1,
   1106.7,
   1107.3,
   1107.9,
   1108.5,
   1109.1,
   1109.7,
   1110.3,
   1110.9,
   1111.5,
   1112.1,
   1112.7,
   1113.3,
   1113.9,
   1114.5,
   1115.1,
   1115.7,
   1116.3,
   1116.9,
   1117.5,
   1118.1,
   1118.7,
   1119.3,
   1119.9,
   1120.5,
   1121.1,
   1121.7,
   1122.3,
   1122.9,
   1123.5,
   1124.1,
   1124.7,
   1125.3,
   1125.9,
   1126.5,
   1127.1,
   1127.7,
   1128.3,
   1128.9,
   1129.5,
   1130.1,
   1130.7,
   1131.3,
   1131.9,
   1132.5,
   1133.1,
   1133.7,
   1134.3,
   1134.9,
   1135.5,
   1136.1,
   1136.7,
   1137.3,
   1137.9,
   1138.5,
   1139.1,
   1139.7,
   1140.3,
   1140.9,
   1141.5,
   1142.1,
   1142.7,
   1143.3,
   1143.9,
   1144.5,
   1145.1,
   1145.7};
   Double_t Hist_fy3002[100] = {
   12,
   7,
   11,
   5,
   11,
   6,
   16,
   11,
   9,
   11,
   8,
   10,
   9,
   11,
   10,
   10,
   12,
   9,
   15,
   18,
   10,
   17,
   13,
   12,
   16,
   22,
   24,
   15,
   18,
   22,
   17,
   22,
   31,
   30,
   30,
   29,
   40,
   47,
   79,
   84,
   81,
   128,
   168,
   257,
   335,
   467,
   641,
   828,
   1045,
   1166,
   1142,
   951,
   765,
   571,
   449,
   311,
   231,
   184,
   150,
   115,
   82,
   74,
   73,
   68,
   53,
   39,
   42,
   44,
   33,
   30,
   30,
   36,
   35,
   28,
   40,
   23,
   32,
   31,
   35,
   26,
   31,
   32,
   30,
   23,
   31,
   31,
   30,
   34,
   35,
   29,
   33,
   41,
   28,
   21,
   22,
   35,
   43,
   25,
   31,
   13};
   Double_t Hist_felx3002[100] = {
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3};
   Double_t Hist_fely3002[100] = {
   3.464102,
   2.645751,
   3.316625,
   2.236068,
   3.316625,
   2.44949,
   4,
   3.316625,
   3,
   3.316625,
   2.828427,
   3.162278,
   3,
   3.316625,
   3.162278,
   3.162278,
   3.464102,
   3,
   3.872983,
   4.242641,
   3.162278,
   4.123106,
   3.605551,
   3.464102,
   4,
   4.690416,
   4.898979,
   3.872983,
   4.242641,
   4.690416,
   4.123106,
   4.690416,
   5.567764,
   5.477226,
   5.477226,
   5.385165,
   6.324555,
   6.855655,
   8.888194,
   9.165151,
   9,
   11.31371,
   12.96148,
   16.03122,
   18.30301,
   21.61018,
   25.31798,
   28.77499,
   32.32646,
   34.14674,
   33.79349,
   30.83829,
   27.65863,
   23.89561,
   21.18962,
   17.63519,
   15.19868,
   13.56466,
   12.24745,
   10.72381,
   9.055385,
   8.602325,
   8.544004,
   8.246211,
   7.28011,
   6.244998,
   6.480741,
   6.63325,
   5.744563,
   5.477226,
   5.477226,
   6,
   5.91608,
   5.291503,
   6.324555,
   4.795832,
   5.656854,
   5.567764,
   5.91608,
   5.09902,
   5.567764,
   5.656854,
   5.477226,
   4.795832,
   5.567764,
   5.567764,
   5.477226,
   5.830952,
   5.91608,
   5.385165,
   5.744563,
   6.403124,
   5.291503,
   4.582576,
   4.690416,
   5.91608,
   6.557439,
   5,
   5.567764,
   3.605551};
   Double_t Hist_fehx3002[100] = {
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3,
   0.3};
   Double_t Hist_fehy3002[100] = {
   3.464102,
   2.645751,
   3.316625,
   2.236068,
   3.316625,
   2.44949,
   4,
   3.316625,
   3,
   3.316625,
   2.828427,
   3.162278,
   3,
   3.316625,
   3.162278,
   3.162278,
   3.464102,
   3,
   3.872983,
   4.242641,
   3.162278,
   4.123106,
   3.605551,
   3.464102,
   4,
   4.690416,
   4.898979,
   3.872983,
   4.242641,
   4.690416,
   4.123106,
   4.690416,
   5.567764,
   5.477226,
   5.477226,
   5.385165,
   6.324555,
   6.855655,
   8.888194,
   9.165151,
   9,
   11.31371,
   12.96148,
   16.03122,
   18.30301,
   21.61018,
   25.31798,
   28.77499,
   32.32646,
   34.14674,
   33.79349,
   30.83829,
   27.65863,
   23.89561,
   21.18962,
   17.63519,
   15.19868,
   13.56466,
   12.24745,
   10.72381,
   9.055385,
   8.602325,
   8.544004,
   8.246211,
   7.28011,
   6.244998,
   6.480741,
   6.63325,
   5.744563,
   5.477226,
   5.477226,
   6,
   5.91608,
   5.291503,
   6.324555,
   4.795832,
   5.656854,
   5.567764,
   5.91608,
   5.09902,
   5.567764,
   5.656854,
   5.477226,
   4.795832,
   5.567764,
   5.567764,
   5.477226,
   5.830952,
   5.91608,
   5.385165,
   5.744563,
   6.403124,
   5.291503,
   4.582576,
   4.690416,
   5.91608,
   6.557439,
   5,
   5.567764,
   3.605551};
   grae = new TGraphAsymmErrors(100,Hist_fx3002,Hist_fy3002,Hist_felx3002,Hist_fehx3002,Hist_fely3002,Hist_fehy3002);
   grae->SetName("Hist");
   grae->SetTitle("Histogram of data_plot__R_M");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_Hist3002 = new TH1F("Graph_Hist3002","Histogram of data_plot__R_M",100,1080,1152);
   Graph_Hist3002->SetMinimum(2.487539);
   Graph_Hist3002->SetMaximum(1319.885);
   Graph_Hist3002->SetDirectory(0);
   Graph_Hist3002->SetStats(0);
   Graph_Hist3002->SetLineWidth(2);
   Graph_Hist3002->SetMarkerStyle(20);
   Graph_Hist3002->GetXaxis()->SetNdivisions(505);
   Graph_Hist3002->GetXaxis()->SetLabelFont(132);
   Graph_Hist3002->GetXaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetXaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetXaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetXaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetXaxis()->SetTitleFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetYaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetYaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetYaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetYaxis()->SetTitleFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetZaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetZaxis()->SetTitleOffset(1.2);
   Graph_Hist3002->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Hist3002);
   
   grae->Draw("p");
   
   Double_t curvetot_fx1[139] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1110.9,
   1111.2,
   1111.5,
   1111.8,
   1112.1,
   1112.25,
   1112.4,
   1112.55,
   1112.7,
   1112.85,
   1113,
   1113.15,
   1113.3,
   1113.45,
   1113.6,
   1113.9,
   1114.2,
   1114.5,
   1114.65,
   1114.8,
   1114.95,
   1115.1,
   1115.25,
   1115.4,
   1115.55,
   1115.7,
   1115.85,
   1116,
   1116.15,
   1116.3,
   1116.45,
   1116.6,
   1116.75,
   1116.9,
   1117.05,
   1117.2,
   1117.5,
   1117.8,
   1118.1,
   1118.25,
   1118.4,
   1118.55,
   1118.7,
   1118.85,
   1119,
   1119.15,
   1119.3,
   1119.45,
   1119.6,
   1119.9,
   1120.2,
   1120.5,
   1120.8,
   1121.1,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t curvetot_fy1[139] = {
   6.328904,
   6.809639,
   7.285733,
   7.757187,
   8.224001,
   8.686175,
   9.143709,
   9.596602,
   10.04485,
   10.48847,
   10.92744,
   11.36177,
   11.79147,
   12.21653,
   12.63696,
   13.05277,
   13.46399,
   13.87069,
   14.273,
   14.67119,
   15.0658,
   15.45786,
   15.84932,
   16.24368,
   16.64716,
   17.07038,
   17.53091,
   18.05704,
   18.69267,
   19.5038,
   20.58614,
   22.07345,
   24.14539,
   27.03319,
   31.0207,
   36.43819,
   43.6469,
   53.01601,
   64.90626,
   79.70792,
   98.05289,
   121.4141,
   135.9471,
   153.2937,
   174.4704,
   200.786,
   233.8063,
   253.3648,
   275.2424,
   299.6417,
   326.7431,
   356.6932,
   389.5923,
   425.4823,
   464.3333,
   506.0327,
   550.3752,
   645.664,
   746.513,
   847.6778,
   896.3993,
   942.7281,
   985.7829,
   1024.702,
   1058.673,
   1086.963,
   1108.945,
   1124.119,
   1132.139,
   1132.819,
   1126.145,
   1112.273,
   1091.526,
   1064.377,
   1031.433,
   993.4132,
   951.1172,
   905.4008,
   807.2231,
   705.7161,
   606.8806,
   559.9721,
   515.3401,
   473.3072,
   434.0951,
   397.8313,
   364.5585,
   334.2463,
   306.8031,
   282.0892,
   259.929,
   222.458,
   192.6838,
   168.9364,
   149.7481,
   133.9313,
   120.5882,
   98.97284,
   81.94853,
   68.29445,
   57.46178,
   49.07547,
   42.77322,
   38.1855,
   34.95581,
   32.76258,
   31.33269,
   30.44591,
   29.93271,
   29.66794,
   29.56276,
   29.55635,
   29.60855,
   29.69366,
   29.79583,
   29.90552,
   30.01721,
   30.12779,
   30.23556,
   30.33959,
   30.43944,
   30.53485,
   30.62573,
   30.71201,
   30.79367,
   30.87069,
   30.94308,
   31.01084,
   31.07395,
   31.13242,
   31.18625,
   31.23544,
   31.28,
   31.31991,
   31.35518,
   31.38581,
   31.4118,
   31.43315,
   31.43315};
   TGraph *graph = new TGraph(139,curvetot_fx1,curvetot_fy1);
   graph->SetName("curvetot");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_curvetot1 = new TH1F("Graph_curvetot1","Projection of totalPdf",139,1080,1152);
   Graph_curvetot1->SetMinimum(5.696013);
   Graph_curvetot1->SetMaximum(1245.468);
   Graph_curvetot1->SetDirectory(0);
   Graph_curvetot1->SetStats(0);
   Graph_curvetot1->SetLineWidth(2);
   Graph_curvetot1->SetMarkerStyle(20);
   Graph_curvetot1->GetXaxis()->SetNdivisions(505);
   Graph_curvetot1->GetXaxis()->SetLabelFont(132);
   Graph_curvetot1->GetXaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetXaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetXaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetXaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetXaxis()->SetTitleFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetYaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetYaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetYaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetYaxis()->SetTitleFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetZaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetZaxis()->SetTitleOffset(1.2);
   Graph_curvetot1->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_curvetot1);
   
   graph->Draw("l");
   
   Double_t bkg_fx2[102] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1111.2,
   1111.8,
   1112.4,
   1113,
   1113.6,
   1114.2,
   1114.8,
   1115.4,
   1116,
   1116.6,
   1117.2,
   1117.8,
   1118.4,
   1119,
   1119.6,
   1120.2,
   1120.8,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t bkg_fy2[102] = {
   6.328904,
   6.809639,
   7.285733,
   7.757187,
   8.224001,
   8.686175,
   9.143709,
   9.596602,
   10.04485,
   10.48847,
   10.92744,
   11.36177,
   11.79146,
   12.21652,
   12.63693,
   13.0527,
   13.46383,
   13.87032,
   14.27217,
   14.66938,
   15.06195,
   15.44988,
   15.83317,
   16.21182,
   16.58583,
   16.9552,
   17.31993,
   17.68001,
   18.03546,
   18.38627,
   18.73244,
   19.07397,
   19.41085,
   19.7431,
   20.07071,
   20.39367,
   20.712,
   21.02568,
   21.33473,
   21.63913,
   21.9389,
   22.23402,
   22.52451,
   22.81035,
   23.09156,
   23.36812,
   23.64004,
   23.90733,
   24.16997,
   24.42797,
   24.68134,
   24.93006,
   25.17414,
   25.41358,
   25.64838,
   25.87855,
   26.10407,
   26.32495,
   26.54119,
   26.75279,
   26.95975,
   27.16207,
   27.35975,
   27.55279,
   27.74119,
   27.92495,
   28.10406,
   28.27854,
   28.44838,
   28.61358,
   28.77414,
   28.93005,
   29.08133,
   29.22797,
   29.36996,
   29.50732,
   29.64004,
   29.76811,
   29.89155,
   30.01034,
   30.1245,
   30.23401,
   30.33889,
   30.43912,
   30.53472,
   30.62567,
   30.71198,
   30.79366,
   30.87069,
   30.94308,
   31.01084,
   31.07395,
   31.13242,
   31.18625,
   31.23544,
   31.28,
   31.31991,
   31.35518,
   31.38581,
   31.4118,
   31.43315,
   31.43315};
   graph = new TGraph(102,bkg_fx2,bkg_fy2);
   graph->SetName("bkg");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(2);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_bkg2 = new TH1F("Graph_bkg2","Projection of totalPdf",102,1080,1152);
   Graph_bkg2->SetMinimum(3.818479);
   Graph_bkg2->SetMaximum(33.94357);
   Graph_bkg2->SetDirectory(0);
   Graph_bkg2->SetStats(0);
   Graph_bkg2->SetLineWidth(2);
   Graph_bkg2->SetMarkerStyle(20);
   Graph_bkg2->GetXaxis()->SetNdivisions(505);
   Graph_bkg2->GetXaxis()->SetLabelFont(132);
   Graph_bkg2->GetXaxis()->SetLabelOffset(0.01);
   Graph_bkg2->GetXaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetXaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetXaxis()->SetTitleOffset(0.95);
   Graph_bkg2->GetXaxis()->SetTitleFont(132);
   Graph_bkg2->GetYaxis()->SetLabelFont(132);
   Graph_bkg2->GetYaxis()->SetLabelOffset(0.01);
   Graph_bkg2->GetYaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetYaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetYaxis()->SetTitleOffset(0.95);
   Graph_bkg2->GetYaxis()->SetTitleFont(132);
   Graph_bkg2->GetZaxis()->SetLabelFont(132);
   Graph_bkg2->GetZaxis()->SetLabelSize(0.06);
   Graph_bkg2->GetZaxis()->SetTitleSize(0.072);
   Graph_bkg2->GetZaxis()->SetTitleOffset(1.2);
   Graph_bkg2->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_bkg2);
   
   graph->Draw("l");
   
   Double_t sigLM_fx3[139] = {
   1086,
   1086.6,
   1087.2,
   1087.8,
   1088.4,
   1089,
   1089.6,
   1090.2,
   1090.8,
   1091.4,
   1092,
   1092.6,
   1093.2,
   1093.8,
   1094.4,
   1095,
   1095.6,
   1096.2,
   1096.8,
   1097.4,
   1098,
   1098.6,
   1099.2,
   1099.8,
   1100.4,
   1101,
   1101.6,
   1102.2,
   1102.8,
   1103.4,
   1104,
   1104.6,
   1105.2,
   1105.8,
   1106.4,
   1107,
   1107.6,
   1108.2,
   1108.8,
   1109.4,
   1110,
   1110.6,
   1110.9,
   1111.2,
   1111.5,
   1111.8,
   1112.1,
   1112.25,
   1112.4,
   1112.55,
   1112.7,
   1112.85,
   1113,
   1113.15,
   1113.3,
   1113.45,
   1113.6,
   1113.9,
   1114.2,
   1114.5,
   1114.65,
   1114.8,
   1114.95,
   1115.1,
   1115.25,
   1115.4,
   1115.55,
   1115.7,
   1115.85,
   1116,
   1116.15,
   1116.3,
   1116.45,
   1116.6,
   1116.75,
   1116.9,
   1117.05,
   1117.2,
   1117.5,
   1117.8,
   1118.1,
   1118.25,
   1118.4,
   1118.55,
   1118.7,
   1118.85,
   1119,
   1119.15,
   1119.3,
   1119.45,
   1119.6,
   1119.9,
   1120.2,
   1120.5,
   1120.8,
   1121.1,
   1121.4,
   1122,
   1122.6,
   1123.2,
   1123.8,
   1124.4,
   1125,
   1125.6,
   1126.2,
   1126.8,
   1127.4,
   1128,
   1128.6,
   1129.2,
   1129.8,
   1130.4,
   1131,
   1131.6,
   1132.2,
   1132.8,
   1133.4,
   1134,
   1134.6,
   1135.2,
   1135.8,
   1136.4,
   1137,
   1137.6,
   1138.2,
   1138.8,
   1139.4,
   1140,
   1140.6,
   1141.2,
   1141.8,
   1142.4,
   1143,
   1143.6,
   1144.2,
   1144.8,
   1145.4,
   1146,
   1146};
   Double_t sigLM_fy3[139] = {
   9.707338e-12,
   3.306592e-11,
   1.098715e-10,
   3.561345e-10,
   1.126074e-09,
   3.473315e-09,
   1.045071e-08,
   3.067406e-08,
   8.782559e-08,
   2.452986e-07,
   6.683337e-07,
   1.776298e-06,
   4.605348e-06,
   1.164751e-05,
   2.873613e-05,
   6.915881e-05,
   0.0001623645,
   0.0003718421,
   0.0008307119,
   0.001810366,
   0.003848635,
   0.007981255,
   0.01614581,
   0.03186198,
   0.0613352,
   0.1151784,
   0.2109874,
   0.3770216,
   0.6572038,
   1.117527,
   1.853704,
   2.999486,
   4.734538,
   7.290089,
   10.94999,
   16.04452,
   22.9349,
   31.99033,
   43.57153,
   58.06879,
   76.11399,
   99.18006,
   113.5673,
   130.7692,
   151.8024,
   177.9756,
   210.8548,
   230.3431,
   252.1508,
   276.4806,
   303.5127,
   333.3937,
   366.2242,
   402.0458,
   440.8286,
   482.4602,
   526.7351,
   621.8898,
   722.6056,
   823.6386,
   872.2946,
   918.5582,
   961.5479,
   1000.402,
   1034.309,
   1062.535,
   1084.453,
   1099.564,
   1107.521,
   1108.138,
   1101.401,
   1087.467,
   1066.658,
   1039.447,
   1006.442,
   968.3605,
   926.0036,
   880.2266,
   781.9287,
   680.3025,
   581.349,
   534.3819,
   489.6917,
   447.6009,
   408.3311,
   372.0098,
   338.68,
   308.3109,
   280.8112,
   256.0411,
   233.825,
   196.243,
   166.3589,
   142.5027,
   123.2069,
   107.2838,
   93.83545,
   72.01309,
   54.78646,
   40.93471,
   29.90899,
   21.33429,
   14.84827,
   10.08144,
   6.67727,
   4.314204,
   2.71911,
   1.671772,
   1.002655,
   0.5866114,
   0.3347908,
   0.1863892,
   0.101226,
   0.05362751,
   0.02771452,
   0.01397177,
   0.006870993,
   0.003296188,
   0.001542512,
   0.0007041567,
   0.0003135698,
   0.0001362145,
   5.77214e-05,
   2.386022e-05,
   9.621356e-06,
   3.78462e-06,
   1.45222e-06,
   5.435843e-07,
   1.98484e-07,
   7.069819e-08,
   2.456492e-08,
   8.326194e-09,
   2.752973e-09,
   8.879359e-10,
   2.793736e-10,
   8.574592e-11,
   2.567235e-11,
   7.497942e-12,
   7.497942e-12};
   graph = new TGraph(139,sigLM_fx3,sigLM_fy3);
   graph->SetName("sigLM");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(3);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_sigLM3 = new TH1F("Graph_sigLM3","Projection of totalPdf",139,1080,1152);
   Graph_sigLM3->SetMinimum(6.748148e-12);
   Graph_sigLM3->SetMaximum(1218.952);
   Graph_sigLM3->SetDirectory(0);
   Graph_sigLM3->SetStats(0);
   Graph_sigLM3->SetLineWidth(2);
   Graph_sigLM3->SetMarkerStyle(20);
   Graph_sigLM3->GetXaxis()->SetNdivisions(505);
   Graph_sigLM3->GetXaxis()->SetLabelFont(132);
   Graph_sigLM3->GetXaxis()->SetLabelOffset(0.01);
   Graph_sigLM3->GetXaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetXaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetXaxis()->SetTitleOffset(0.95);
   Graph_sigLM3->GetXaxis()->SetTitleFont(132);
   Graph_sigLM3->GetYaxis()->SetLabelFont(132);
   Graph_sigLM3->GetYaxis()->SetLabelOffset(0.01);
   Graph_sigLM3->GetYaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetYaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetYaxis()->SetTitleOffset(0.95);
   Graph_sigLM3->GetYaxis()->SetTitleFont(132);
   Graph_sigLM3->GetZaxis()->SetLabelFont(132);
   Graph_sigLM3->GetZaxis()->SetLabelSize(0.06);
   Graph_sigLM3->GetZaxis()->SetTitleSize(0.072);
   Graph_sigLM3->GetZaxis()->SetTitleOffset(1.2);
   Graph_sigLM3->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_sigLM3);
   
   graph->Draw("l");
   
   TLegend *leg = new TLegend(0.75,0.5,1,0.9,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetTextSize(0.06);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("curvetot","Total PDF","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("bkg","Background","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sigLM","#Lambda M (dbl Gaus)","l");
   entry->SetLineColor(3);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TH1D *frame_4324fb0__4 = new TH1D("frame_4324fb0__4","A RooPlot of \"#Lambda mass\"",100,1086,1146);
   frame_4324fb0__4->SetBinContent(1,1260.154);
   frame_4324fb0__4->SetMinimum(1);
   frame_4324fb0__4->SetMaximum(7500);
   frame_4324fb0__4->SetEntries(1);
   frame_4324fb0__4->SetDirectory(0);
   frame_4324fb0__4->SetStats(0);
   frame_4324fb0__4->SetLineWidth(2);
   frame_4324fb0__4->SetMarkerStyle(20);
   frame_4324fb0__4->GetXaxis()->SetTitle("#Lambda mass (MeV)");
   frame_4324fb0__4->GetXaxis()->SetNdivisions(505);
   frame_4324fb0__4->GetXaxis()->SetLabelFont(132);
   frame_4324fb0__4->GetXaxis()->SetLabelOffset(0.01);
   frame_4324fb0__4->GetXaxis()->SetLabelSize(0.06);
   frame_4324fb0__4->GetXaxis()->SetTitleSize(0.072);
   frame_4324fb0__4->GetXaxis()->SetTitleOffset(0.95);
   frame_4324fb0__4->GetXaxis()->SetTitleFont(132);
   frame_4324fb0__4->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4324fb0__4->GetYaxis()->SetLabelFont(132);
   frame_4324fb0__4->GetYaxis()->SetLabelOffset(0.01);
   frame_4324fb0__4->GetYaxis()->SetLabelSize(0.06);
   frame_4324fb0__4->GetYaxis()->SetTitleSize(0.072);
   frame_4324fb0__4->GetYaxis()->SetTitleOffset(0.95);
   frame_4324fb0__4->GetYaxis()->SetTitleFont(132);
   frame_4324fb0__4->GetZaxis()->SetLabelFont(132);
   frame_4324fb0__4->GetZaxis()->SetLabelSize(0.06);
   frame_4324fb0__4->GetZaxis()->SetTitleSize(0.072);
   frame_4324fb0__4->GetZaxis()->SetTitleOffset(1.2);
   frame_4324fb0__4->GetZaxis()->SetTitleFont(132);
   frame_4324fb0__4->Draw("AXISSAME");
   pad1->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
Exemplo n.º 2
0
void PlotLimit ( string LimitFile , string filePrefix, string LimTitle , bool DoObsLim , bool DoExpLim ) {

    setTDRStyle();

    vector<float> vMass           ;
    vector<float> vObsLimit       ; 
    vector<float> vMeanExpLimit   ; 
    vector<float> vMedianExpLimit ; 
    vector<float> vExpLim68Down   ; 
    vector<float> vExpLim68Up     ; 
    vector<float> vExpLim95Down   ; 
    vector<float> vExpLim95Up     ;

    ifstream indata;
    indata.open(LimitFile.c_str());
    if(!indata) { // file couldn't be opened
        cerr << "Error: file could not be opened" << endl;
        return;
    }
    float Mass           ;
    float ObsLimit       ; 
    float MeanExpLimit   ; 
    float MedianExpLimit ; 
    float ExpLim68Down   ; 
    float ExpLim68Up     ; 
    float ExpLim95Down   ; 
    float ExpLim95Up     ;

    while ( indata >> Mass >> ObsLimit >> MeanExpLimit >> MedianExpLimit >> ExpLim95Down >> ExpLim68Down >> ExpLim68Up >> ExpLim95Up )  {
        cout << Mass << " " << MeanExpLimit  << " " << MedianExpLimit <<" "<< ExpLim68Down <<" "<< ExpLim68Up <<" "<< ExpLim95Down <<" "<< ExpLim95Up << endl;

        vMass           .push_back(Mass           );
        vObsLimit       .push_back(ObsLimit       ); 
        vMeanExpLimit   .push_back(MeanExpLimit   ); 
        vMedianExpLimit .push_back(MedianExpLimit ); 
        vExpLim68Down   .push_back(ExpLim68Down   ); 
        vExpLim68Up     .push_back(ExpLim68Up     ); 
        vExpLim95Down   .push_back(ExpLim95Down   ); 
        vExpLim95Up     .push_back(ExpLim95Up     );
    }

    TCanvas* cLimit = new TCanvas("c1","c1",900,600);
    cLimit->cd();

    float x1 = vMass.at(0) - 5. ;
    float x2 = vMass.at(vMass.size()-1) + 5. ; 

    // Expected Limit
    TGraph* ExpLim = NULL ;
    TGraphAsymmErrors* ExpBand68 = NULL ;
    TGraphAsymmErrors* ExpBand95 = NULL ;
    float min = 999999., max = 0;
    float minZoom = 999999., maxZoom = 0;
    if ( DoExpLim ) {
        float x[100];
        float ex[100];
        float y[100];
        float yu68[100];
        float yd68[100];
        float yu95[100];
        float yd95[100]; 
        for ( int i = 0 ; i < (signed) vMass.size() ; ++i ) {
            x[i] = vMass.at(i) ; ex[i] = 0 ; 
            y[i] = vMedianExpLimit.at(i) ;   
	    if(y[i]    > max) max = y[i]   ; if(y[i]    < min) min = y[i]   ;
	    if(x[i]<=250){ if(y[i]    > maxZoom) maxZoom = y[i]   ; if(y[i]    < minZoom) minZoom = y[i]   ;}
            yu68[i] = vExpLim68Up.at(i)   -y[i];   if(yu68[i] > max) max = yu68[i]; if(yu68[i] < min) min = yu68[i];
            yd68[i] = y[i] - vExpLim68Down.at(i);  if(yd68[i] > max) max = yd68[i]; if(yd68[i] < min) min = yd68[i];
            yu95[i] = vExpLim95Up.at(i)   -y[i];   if(yu95[i] > max) max = yu95[i]; if(yu95[i] < min) min = yu95[i];
            yd95[i] = y[i] - vExpLim95Down.at(i);  if(yd95[i] > max) max = yd95[i]; if(yd95[i] < min) min = yd95[i];
        }
        ExpBand95 = new TGraphAsymmErrors((signed) vMass.size(),x,y,ex,ex,yd95,yu95);
        ExpBand95->SetFillColor(kYellow); 
        ExpBand95->GetYaxis()->SetRangeUser(0.,50);
        ExpBand95->GetXaxis()->SetRangeUser(x1,x2);
        ExpBand95->GetXaxis()->SetTitle("Higgs mass [GeV/c^{2}]");
        ExpBand95->GetYaxis()->SetTitle("95% Limit on #sigma/#sigma_{SM} ");
        ExpBand95->Draw("A3");
        ExpBand95->GetYaxis()->SetRangeUser(0.,50);
        ExpBand95->Draw("A3");
        ExpBand68 = new TGraphAsymmErrors((signed) vMass.size(),x,y,ex,ex,yd68,yu68);
        ExpBand68->SetFillColor(kGreen); 
        ExpBand68->Draw("3");

        ExpLim = new TGraph((signed) vMass.size(),x,y);    
        ExpLim->SetLineWidth(2);
        ExpLim->SetLineStyle(1);
        ExpLim->Draw("l");
    }

    // Observed Limit
    TGraph* ObsLim = NULL ;
    if ( DoObsLim ) {
        float x[100];
        float y[100];    
        for ( int i = 0 ; i < (signed) vMass.size() ; ++i ) { 
            x[i] = vMass.at(i) ; 
            y[i] = vObsLimit.at(i) ; 
	    if(y[i] > max) max = y[i]; if(y[i] < min) min = y[i];
	    if(x[i]<=250){ if(y[i]    > maxZoom) maxZoom = y[i]   ; if(y[i]    < minZoom) minZoom = y[i]   ;}
        }
        ObsLim = new TGraph((signed) vMass.size(),x,y);
        ObsLim->SetMarkerColor(kBlue);
        ObsLim->SetLineWidth(2);
        ObsLim->SetLineColor(kBlue);
        //ObsLim->SetLineStyle(2);
        ObsLim->SetMarkerStyle(kFullCircle);
        if   (DoExpLim) ObsLim->Draw("lp");
        else {
            ObsLim->GetYaxis()->SetRangeUser(0.,10); 
            ObsLim->GetXaxis()->SetRangeUser(x1,x2);
            ObsLim->GetXaxis()->SetTitle("Higgs mass [GeV/c^{2}]");
            ObsLim->GetYaxis()->SetTitle("95% CL Limit on #sigma/#sigma_{SM} ");
            ObsLim->Draw("alp");
        }
    }

    TLine *l = new TLine(x1,1,x2,1);
    l->SetLineWidth(2);
    l->SetLineColor(kBlack);
    l->Draw("same");

    TLatex* title = new TLatex(.19,.82,LimTitle.c_str());
    title->SetTextSize(.04);
    title->SetNDC(1);
    title->Draw("same");

    TText* CMS = new TText(.19,.88,"CMS Preliminary");
    CMS ->SetTextSize(.05);
    CMS ->SetNDC(1);
    CMS ->Draw("same");

    //TLatex* Lumi = new TLatex(.19,.84,"Lumi = 1.5 fb^{-1} ");
    //Lumi ->SetTextSize(.03);
    //Lumi ->SetNDC(1);
    //Lumi ->Draw("same");


    TLegend* leg = NULL ;  
    leg = new TLegend(0.60,0.75,0.9,0.88,"");
    if (DoExpLim) leg->AddEntry(ExpLim,   "95% CL: median","l");
    if (DoExpLim) leg->AddEntry(ExpBand68,"95% CL: 68% band","f");
    if (DoExpLim) leg->AddEntry(ExpBand95,"95% CL: 95% band","f");
    if (DoObsLim) leg->AddEntry(ObsLim,"Observed","lp");
    leg->SetTextSize(.03);
    leg->SetFillStyle(0);
    leg->SetBorderSize(0);
    leg->SetShadowColor(0);
    leg->SetFillColor(0);
    leg->Draw("same");


    vector<string> extensions;
    extensions.push_back(".png");
    extensions.push_back(".pdf");
    extensions.push_back(".eps");

    ExpBand95->GetXaxis()->SetRangeUser(x1,x2);
    ExpBand95->GetYaxis()->SetRangeUser(min-0.2,max+2);
    cLimit->Update();
    for(size_t i=0;i<extensions.size();++i) cLimit->Print( ("plots/"+filePrefix+"_lin"+extensions[i]).c_str() );

    ExpBand95->GetXaxis()->SetRangeUser(x1,250);
    ExpBand95->GetYaxis()->SetRangeUser(minZoom/3.,maxZoom+0.2*maxZoom);
    cLimit->Update();
    for(size_t i=0;i<extensions.size();++i) cLimit->Print( ("plots/"+filePrefix+"_zoom_lin"+extensions[i]).c_str() );

    cLimit->SetLogy();

    ExpBand95->GetXaxis()->SetRangeUser(x1,x2);
    ExpBand95->GetYaxis()->SetRangeUser(min/3.,max*10);
    cLimit->Update();
    for(size_t i=0;i<extensions.size();++i) cLimit->Print( ("plots/"+filePrefix+"_log"+extensions[i]).c_str() );

    ExpBand95->GetXaxis()->SetRangeUser(x1,250);
    ExpBand95->GetYaxis()->SetRangeUser(minZoom/3.,maxZoom*10);
    cLimit->Update();
    for(size_t i=0;i<extensions.size();++i) cLimit->Print( ("plots/"+filePrefix+"_zoom_log"+extensions[i]).c_str() );

    //  ExpBand95->GetXaxis()->SetRangeUser(x1,300.);
    //  gPad->WaitPrimitive();
    //  figName = "LimitPlots/" + LimTitle + "_zoom.gif" ;
    //  cLimit->SaveAs(figName.c_str()) ;


    return;
}
Exemplo n.º 3
0
//Draw an error envelop from a TGraphAsymmErrors
void drawGraphEnv(TGraphAsymmErrors* g, float scale = 1, bool doAxis = false,
                  int linestyle = 1, int linewidth = 2, int linecolor = 4,
                  bool fill = false,
                  TH1** ppGl = 0, TH1** ppGh = 0){
  //                  const char* opth = "", const char* optl = ""){
  char buffer[256];
  int n = g->GetN();
  double* x = new double[n+2];
  double* yh = new double[n+2];
  double* yl = new double[n+2];

  for(int i = 0; i < n; ++i){
    x[i+1]  = g->GetX()[i];
    yh[i+1] = g->GetY()[i] + g->GetEYhigh()[i] * scale;
    yl[i+1] = g->GetY()[i] - g->GetEYlow()[i] * scale;
  }

  x[0] = g->GetX()[0] - g->GetEXlow()[0];
  yl[0] = yl[1] - (yl[2]-yl[1])/(x[2]-x[1])*g->GetEXlow()[0];
  yh[0] = yh[1] - (yh[2]-yh[1])/(x[2]-x[1])*g->GetEXlow()[0];

  x[n+1] = g->GetX()[n-1] + g->GetEXhigh()[n-1];
  yl[n+1] = yl[n] + (yl[n]-yl[n-1])/(x[n]-x[n-1])*g->GetEXhigh()[n-1];
  yh[n+1] = yh[n] + (yh[n]-yh[n-1])/(x[n]-x[n-1])*g->GetEXhigh()[n-1];

  TGraph* gl = new TGraph(n+2, x, yl);
  gl->SetTitle(g->GetTitle());
  TGraph* gh = new TGraph(n+2, x, yh);
  gh->SetTitle(g->GetTitle());
  const char* opt = "l,same";
  
  sprintf(buffer, "%s_eh", g->GetName());
  gh->SetName(buffer);
  
  sprintf(buffer, "%s_el", g->GetName());
  gl->SetName(buffer);

  if(doAxis){
    g->Draw("AP");
    TH1* h = g->GetHistogram();
    gPad->Clear();
    h->Draw();
  }

  if(fill){
    gl->SetFillStyle(linestyle);
    gl->SetFillColor(linecolor);
    gl->SetLineColor(linecolor);
  
    gh->SetFillStyle(linestyle);
    gh->SetFillColor(linecolor);
    gh->SetLineColor(linecolor);
  } else{
    gl->SetLineStyle(linestyle);
    gl->SetLineWidth(linewidth);
    gl->SetLineColor(linecolor);
    
    gh->SetLineStyle(linestyle);
    gh->SetLineWidth(linewidth);
    gh->SetLineColor(linecolor);
  }
  
  gh->Draw(opt);
  gl->Draw(opt);

  if(ppGh) *ppGh = gh;
  if(ppGl) *ppGl = gl;
}
void fitLMC_c070116_LL1_floatlfixmusigma_nobkg()
{
//=========Macro generated from canvas: c1/data fits
//=========  (Tue Jul  5 22:38:18 2016) by ROOT version6.06/02
   TCanvas *c1 = new TCanvas("c1", "data fits",0,0,1200,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.14);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.05);
   c1->SetBottomMargin(0.16);
   c1->SetFrameLineWidth(2);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(3754.321,-26.4,6223.457,8.8);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.14);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.5);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   
   TH1D *frame_44e9780__1 = new TH1D("frame_44e9780__1","",100,4100,6100);
   frame_44e9780__1->SetBinContent(1,15.00557);
   frame_44e9780__1->SetMinimum(-8.8);
   frame_44e9780__1->SetMaximum(8.8);
   frame_44e9780__1->SetEntries(1);
   frame_44e9780__1->SetDirectory(0);
   frame_44e9780__1->SetStats(0);
   frame_44e9780__1->SetLineWidth(2);
   frame_44e9780__1->SetMarkerStyle(20);
   frame_44e9780__1->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_44e9780__1->GetXaxis()->SetNdivisions(505);
   frame_44e9780__1->GetXaxis()->SetLabelFont(132);
   frame_44e9780__1->GetXaxis()->SetLabelOffset(0.01);
   frame_44e9780__1->GetXaxis()->SetLabelSize(0.15);
   frame_44e9780__1->GetXaxis()->SetTitleSize(0.2);
   frame_44e9780__1->GetXaxis()->SetTitleOffset(1.1);
   frame_44e9780__1->GetXaxis()->SetTitleFont(132);
   frame_44e9780__1->GetYaxis()->SetTitle("Pull");
   frame_44e9780__1->GetYaxis()->CenterTitle(true);
   frame_44e9780__1->GetYaxis()->SetNdivisions(505);
   frame_44e9780__1->GetYaxis()->SetLabelFont(132);
   frame_44e9780__1->GetYaxis()->SetLabelOffset(0.01);
   frame_44e9780__1->GetYaxis()->SetLabelSize(0.15);
   frame_44e9780__1->GetYaxis()->SetTitleSize(0.15);
   frame_44e9780__1->GetYaxis()->SetTitleOffset(0.45);
   frame_44e9780__1->GetYaxis()->SetTitleFont(132);
   frame_44e9780__1->GetZaxis()->SetLabelFont(132);
   frame_44e9780__1->GetZaxis()->SetLabelSize(0.06);
   frame_44e9780__1->GetZaxis()->SetTitleSize(0.072);
   frame_44e9780__1->GetZaxis()->SetTitleOffset(1.2);
   frame_44e9780__1->GetZaxis()->SetTitleFont(132);
   frame_44e9780__1->Draw("FUNC");
   
   Double_t pull_Hist_curvetot_fx3001[87] = {
   4310,
   4330,
   4350,
   4370,
   4390,
   4410,
   4430,
   4450,
   4470,
   4490,
   4510,
   4530,
   4550,
   4570,
   4590,
   4610,
   4630,
   4650,
   4670,
   4690,
   4710,
   4730,
   4750,
   4770,
   4790,
   4810,
   4830,
   4850,
   4870,
   4890,
   4910,
   4930,
   4950,
   4970,
   4990,
   5010,
   5030,
   5050,
   5070,
   5090,
   5110,
   5130,
   5150,
   5170,
   5190,
   5210,
   5230,
   5250,
   5270,
   5290,
   5310,
   5330,
   5350,
   5370,
   5390,
   5410,
   5430,
   5450,
   5470,
   5490,
   5510,
   5530,
   5550,
   5570,
   5590,
   5610,
   5630,
   5650,
   5670,
   5690,
   5710,
   5730,
   5750,
   5770,
   5790,
   5810,
   5830,
   5850,
   5870,
   5890,
   5910,
   5930,
   5950,
   5970,
   5990,
   6010,
   6030};
   Double_t pull_Hist_curvetot_fy3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0.8702566,
   1.599844,
   0.3770175,
   13.12767,
   13.02552,
   -2.430346,
   -1.55089,
   -1.397439,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_felx3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fely3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehx3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehy3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(87,pull_Hist_curvetot_fx3001,pull_Hist_curvetot_fy3001,pull_Hist_curvetot_felx3001,pull_Hist_curvetot_fehx3001,pull_Hist_curvetot_fely3001,pull_Hist_curvetot_fehy3001);
   grae->SetName("pull_Hist_curvetot");
   grae->SetTitle("Pull of Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr and Projection of totalPdf");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_pull_Hist_curvetot3001 = new TH1F("Graph_pull_Hist_curvetot3001","Pull of Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr and Projection of totalPdf",100,4138,6202);
   Graph_pull_Hist_curvetot3001->SetMinimum(-5.186148);
   Graph_pull_Hist_curvetot3001->SetMaximum(15.88347);
   Graph_pull_Hist_curvetot3001->SetDirectory(0);
   Graph_pull_Hist_curvetot3001->SetStats(0);
   Graph_pull_Hist_curvetot3001->SetLineWidth(2);
   Graph_pull_Hist_curvetot3001->SetMarkerStyle(20);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetNdivisions(505);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleOffset(1.2);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_pull_Hist_curvetot3001);
   
   grae->Draw("p");
   
   TH1D *frame_44e9780__2 = new TH1D("frame_44e9780__2","",100,4100,6100);
   frame_44e9780__2->SetBinContent(1,15.00557);
   frame_44e9780__2->SetMinimum(-8.8);
   frame_44e9780__2->SetMaximum(8.8);
   frame_44e9780__2->SetEntries(1);
   frame_44e9780__2->SetDirectory(0);
   frame_44e9780__2->SetStats(0);
   frame_44e9780__2->SetLineWidth(2);
   frame_44e9780__2->SetMarkerStyle(20);
   frame_44e9780__2->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_44e9780__2->GetXaxis()->SetNdivisions(505);
   frame_44e9780__2->GetXaxis()->SetLabelFont(132);
   frame_44e9780__2->GetXaxis()->SetLabelOffset(0.01);
   frame_44e9780__2->GetXaxis()->SetLabelSize(0.15);
   frame_44e9780__2->GetXaxis()->SetTitleSize(0.2);
   frame_44e9780__2->GetXaxis()->SetTitleOffset(1.1);
   frame_44e9780__2->GetXaxis()->SetTitleFont(132);
   frame_44e9780__2->GetYaxis()->SetTitle("Pull");
   frame_44e9780__2->GetYaxis()->CenterTitle(true);
   frame_44e9780__2->GetYaxis()->SetNdivisions(505);
   frame_44e9780__2->GetYaxis()->SetLabelFont(132);
   frame_44e9780__2->GetYaxis()->SetLabelOffset(0.01);
   frame_44e9780__2->GetYaxis()->SetLabelSize(0.15);
   frame_44e9780__2->GetYaxis()->SetTitleSize(0.15);
   frame_44e9780__2->GetYaxis()->SetTitleOffset(0.45);
   frame_44e9780__2->GetYaxis()->SetTitleFont(132);
   frame_44e9780__2->GetZaxis()->SetLabelFont(132);
   frame_44e9780__2->GetZaxis()->SetLabelSize(0.06);
   frame_44e9780__2->GetZaxis()->SetTitleSize(0.072);
   frame_44e9780__2->GetZaxis()->SetTitleOffset(1.2);
   frame_44e9780__2->GetZaxis()->SetTitleFont(132);
   frame_44e9780__2->Draw("AXISSAME");
   pad2->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(3754.321,0,6223.457,4.122406);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.14);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.06);
   pad1->SetBottomMargin(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   
   TH1D *frame_4380460__3 = new TH1D("frame_4380460__3","A RooPlot of \"m(J/#psi #Lambda)\"",100,4100,6100);
   frame_4380460__3->SetBinContent(1,3718.624);
   frame_4380460__3->SetMinimum(1);
   frame_4380460__3->SetMaximum(7500);
   frame_4380460__3->SetEntries(2);
   frame_4380460__3->SetDirectory(0);
   frame_4380460__3->SetStats(0);
   frame_4380460__3->SetLineWidth(2);
   frame_4380460__3->SetMarkerStyle(20);
   frame_4380460__3->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_4380460__3->GetXaxis()->SetNdivisions(505);
   frame_4380460__3->GetXaxis()->SetLabelFont(132);
   frame_4380460__3->GetXaxis()->SetLabelOffset(0.01);
   frame_4380460__3->GetXaxis()->SetLabelSize(0.06);
   frame_4380460__3->GetXaxis()->SetTitleSize(0.072);
   frame_4380460__3->GetXaxis()->SetTitleOffset(0.95);
   frame_4380460__3->GetXaxis()->SetTitleFont(132);
   frame_4380460__3->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4380460__3->GetYaxis()->SetLabelFont(132);
   frame_4380460__3->GetYaxis()->SetLabelOffset(0.01);
   frame_4380460__3->GetYaxis()->SetLabelSize(0.06);
   frame_4380460__3->GetYaxis()->SetTitleSize(0.072);
   frame_4380460__3->GetYaxis()->SetTitleOffset(0.95);
   frame_4380460__3->GetYaxis()->SetTitleFont(132);
   frame_4380460__3->GetZaxis()->SetLabelFont(132);
   frame_4380460__3->GetZaxis()->SetLabelSize(0.06);
   frame_4380460__3->GetZaxis()->SetTitleSize(0.072);
   frame_4380460__3->GetZaxis()->SetTitleOffset(1.2);
   frame_4380460__3->GetZaxis()->SetTitleFont(132);
   frame_4380460__3->Draw("FUNC");
   
   Double_t Hist_fx3002[100] = {
   4110,
   4130,
   4150,
   4170,
   4190,
   4210,
   4230,
   4250,
   4270,
   4290,
   4310,
   4330,
   4350,
   4370,
   4390,
   4410,
   4430,
   4450,
   4470,
   4490,
   4510,
   4530,
   4550,
   4570,
   4590,
   4610,
   4630,
   4650,
   4670,
   4690,
   4710,
   4730,
   4750,
   4770,
   4790,
   4810,
   4830,
   4850,
   4870,
   4890,
   4910,
   4930,
   4950,
   4970,
   4990,
   5010,
   5030,
   5050,
   5070,
   5090,
   5110,
   5130,
   5150,
   5170,
   5190,
   5210,
   5230,
   5250,
   5270,
   5290,
   5310,
   5330,
   5350,
   5370,
   5390,
   5410,
   5430,
   5450,
   5470,
   5490,
   5510,
   5530,
   5550,
   5570,
   5590,
   5610,
   5630,
   5650,
   5670,
   5690,
   5710,
   5730,
   5750,
   5770,
   5790,
   5810,
   5830,
   5850,
   5870,
   5890,
   5910,
   5930,
   5950,
   5970,
   5990,
   6010,
   6030,
   6050,
   6070,
   6090};
   Double_t Hist_fy3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   5,
   30,
   1308,
   1283,
   36,
   7,
   2,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Hist_felx3002[100] = {
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10};
   Double_t Hist_fely3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   2.236068,
   5.477226,
   36.16628,
   35.81899,
   6,
   2.645751,
   1.414214,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Hist_fehx3002[100] = {
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10};
   Double_t Hist_fehy3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   2.236068,
   5.477226,
   36.16628,
   35.81899,
   6,
   2.645751,
   1.414214,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   grae = new TGraphAsymmErrors(100,Hist_fx3002,Hist_fy3002,Hist_felx3002,Hist_fehx3002,Hist_fely3002,Hist_fehy3002);
   grae->SetName("Hist");
   grae->SetTitle("Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_Hist3002 = new TH1F("Graph_Hist3002","Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr",100,3900,6300);
   Graph_Hist3002->SetMinimum(1.478583);
   Graph_Hist3002->SetMaximum(1478.583);
   Graph_Hist3002->SetDirectory(0);
   Graph_Hist3002->SetStats(0);
   Graph_Hist3002->SetLineWidth(2);
   Graph_Hist3002->SetMarkerStyle(20);
   Graph_Hist3002->GetXaxis()->SetNdivisions(505);
   Graph_Hist3002->GetXaxis()->SetLabelFont(132);
   Graph_Hist3002->GetXaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetXaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetXaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetXaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetXaxis()->SetTitleFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetYaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetYaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetYaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetYaxis()->SetTitleFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetZaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetZaxis()->SetTitleOffset(1.2);
   Graph_Hist3002->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Hist3002);
   
   grae->Draw("p");
   
   Double_t curvetot_fx1[128] = {
   4300,
   4317.4,
   4334.8,
   4352.2,
   4369.6,
   4387,
   4404.4,
   4421.8,
   4439.2,
   4456.6,
   4474,
   4491.4,
   4508.8,
   4526.2,
   4543.6,
   4561,
   4578.4,
   4595.8,
   4613.2,
   4630.6,
   4648,
   4665.4,
   4682.8,
   4700.2,
   4717.6,
   4735,
   4752.4,
   4769.8,
   4787.2,
   4804.6,
   4822,
   4839.4,
   4856.8,
   4874.2,
   4891.6,
   4909,
   4926.4,
   4943.8,
   4961.2,
   4978.6,
   4996,
   5013.4,
   5030.8,
   5048.2,
   5065.6,
   5083,
   5100.4,
   5117.8,
   5135.2,
   5152.6,
   5170,
   5187.4,
   5204.8,
   5222.2,
   5239.6,
   5257,
   5274.4,
   5291.8,
   5309.2,
   5326.6,
   5344,
   5361.4,
   5378.8,
   5396.2,
   5413.6,
   5431,
   5448.4,
   5465.8,
   5483.2,
   5500.6,
   5518,
   5535.4,
   5552.8,
   5570.2,
   5578.9,
   5587.6,
   5591.95,
   5594.125,
   5596.3,
   5598.475,
   5600.65,
   5602.825,
   5605,
   5607.175,
   5609.35,
   5611.525,
   5613.7,
   5615.875,
   5618.05,
   5620.225,
   5622.4,
   5624.575,
   5626.75,
   5628.925,
   5631.1,
   5633.275,
   5635.45,
   5637.625,
   5639.8,
   5641.975,
   5644.15,
   5648.5,
   5652.85,
   5657.2,
   5665.9,
   5674.6,
   5692,
   5709.4,
   5726.8,
   5744.2,
   5761.6,
   5779,
   5796.4,
   5813.8,
   5831.2,
   5848.6,
   5866,
   5883.4,
   5900.8,
   5918.2,
   5935.6,
   5953,
   5970.4,
   5987.8,
   6005.2,
   6022.6,
   6040,
   6040};
   Double_t curvetot_fy1[128] = {
   1.318037e-20,
   1.697329e-20,
   2.192681e-20,
   2.841782e-20,
   3.695286e-20,
   4.821525e-20,
   6.313046e-20,
   8.29568e-20,
   1.094122e-19,
   1.448517e-19,
   1.925181e-19,
   2.568959e-19,
   3.44215e-19,
   4.631709e-19,
   6.259584e-19,
   8.497653e-19,
   1.158939e-18,
   1.588153e-18,
   2.187048e-18,
   3.027099e-18,
   4.211801e-18,
   5.891915e-18,
   8.288401e-18,
   1.172715e-17,
   1.6692e-17,
   2.390612e-17,
   3.445801e-17,
   4.999802e-17,
   7.304715e-17,
   1.074866e-16,
   1.5934e-16,
   2.38035e-16,
   3.584559e-16,
   5.443165e-16,
   8.337551e-16,
   1.288715e-15,
   2.010839e-15,
   3.168703e-15,
   5.045031e-15,
   8.119553e-15,
   1.321627e-14,
   2.176873e-14,
   3.630456e-14,
   6.134368e-14,
   1.05089e-13,
   1.826608e-13,
   3.223916e-13,
   5.782969e-13,
   1.055259e-12,
   1.960913e-12,
   3.714837e-12,
   7.183609e-12,
   1.419907e-11,
   2.873063e-11,
   5.961044e-11,
   1.27056e-10,
   2.78779e-10,
   6.311323e-10,
   1.478102e-09,
   3.591593e-09,
   9.084823e-09,
   2.4013e-08,
   6.661593e-08,
   1.949445e-07,
   6.053539e-07,
   2.008574e-06,
   7.17998e-06,
   2.792565e-05,
   0.0001195993,
   0.0005723917,
   0.003118011,
   0.01978896,
   0.1508305,
   1.437428,
   4.905535,
   18.10213,
   35.92419,
   51.05403,
   73.00192,
   105.0495,
   152.1629,
   221.9135,
   325.934,
   482.2409,
   720.4907,
   1097.703,
   1678.639,
   2471.271,
   3257.573,
   3541.546,
   3077.86,
   2249.355,
   1504.05,
   981.6712,
   647.364,
   437.5418,
   304.3293,
   217.7367,
   159.8985,
   120.2075,
   92.26923,
   57.33169,
   37.75782,
   26.04724,
   13.78295,
   8.096796,
   3.441144,
   1.753948,
   1.006317,
   0.6274052,
   0.415992,
   0.2891995,
   0.2087556,
   0.1553637,
   0.118593,
   0.0924765,
   0.07343641,
   0.05924083,
   0.04844944,
   0.04010506,
   0.03355513,
   0.02834456,
   0.02414957,
   0.02073562,
   0.01793004,
   0.01560389,
   0.01365953,
   0.01365953};
   TGraph *graph = new TGraph(128,curvetot_fx1,curvetot_fy1);
   graph->SetName("curvetot");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_curvetot1 = new TH1F("Graph_curvetot1","Projection of totalPdf",128,4126,6214);
   Graph_curvetot1->SetMinimum(1.186233e-20);
   Graph_curvetot1->SetMaximum(3895.701);
   Graph_curvetot1->SetDirectory(0);
   Graph_curvetot1->SetStats(0);
   Graph_curvetot1->SetLineWidth(2);
   Graph_curvetot1->SetMarkerStyle(20);
   Graph_curvetot1->GetXaxis()->SetNdivisions(505);
   Graph_curvetot1->GetXaxis()->SetLabelFont(132);
   Graph_curvetot1->GetXaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetXaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetXaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetXaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetXaxis()->SetTitleFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetYaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetYaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetYaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetYaxis()->SetTitleFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetZaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetZaxis()->SetTitleOffset(1.2);
   Graph_curvetot1->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_curvetot1);
   
   graph->Draw("l");
   
   Double_t sigL_fx2[128] = {
   4300,
   4317.4,
   4334.8,
   4352.2,
   4369.6,
   4387,
   4404.4,
   4421.8,
   4439.2,
   4456.6,
   4474,
   4491.4,
   4508.8,
   4526.2,
   4543.6,
   4561,
   4578.4,
   4595.8,
   4613.2,
   4630.6,
   4648,
   4665.4,
   4682.8,
   4700.2,
   4717.6,
   4735,
   4752.4,
   4769.8,
   4787.2,
   4804.6,
   4822,
   4839.4,
   4856.8,
   4874.2,
   4891.6,
   4909,
   4926.4,
   4943.8,
   4961.2,
   4978.6,
   4996,
   5013.4,
   5030.8,
   5048.2,
   5065.6,
   5083,
   5100.4,
   5117.8,
   5135.2,
   5152.6,
   5170,
   5187.4,
   5204.8,
   5222.2,
   5239.6,
   5257,
   5274.4,
   5291.8,
   5309.2,
   5326.6,
   5344,
   5361.4,
   5378.8,
   5396.2,
   5413.6,
   5431,
   5448.4,
   5465.8,
   5483.2,
   5500.6,
   5518,
   5535.4,
   5552.8,
   5570.2,
   5578.9,
   5587.6,
   5591.95,
   5594.125,
   5596.3,
   5598.475,
   5600.65,
   5602.825,
   5605,
   5607.175,
   5609.35,
   5611.525,
   5613.7,
   5615.875,
   5618.05,
   5620.225,
   5622.4,
   5624.575,
   5626.75,
   5628.925,
   5631.1,
   5633.275,
   5635.45,
   5637.625,
   5639.8,
   5641.975,
   5644.15,
   5648.5,
   5652.85,
   5657.2,
   5665.9,
   5674.6,
   5692,
   5709.4,
   5726.8,
   5744.2,
   5761.6,
   5779,
   5796.4,
   5813.8,
   5831.2,
   5848.6,
   5866,
   5883.4,
   5900.8,
   5918.2,
   5935.6,
   5953,
   5970.4,
   5987.8,
   6005.2,
   6022.6,
   6040,
   6040};
   Double_t sigL_fy2[128] = {
   1.318037e-20,
   1.697329e-20,
   2.192681e-20,
   2.841782e-20,
   3.695286e-20,
   4.821525e-20,
   6.313046e-20,
   8.29568e-20,
   1.094122e-19,
   1.448517e-19,
   1.925181e-19,
   2.568959e-19,
   3.44215e-19,
   4.631709e-19,
   6.259584e-19,
   8.497653e-19,
   1.158939e-18,
   1.588153e-18,
   2.187048e-18,
   3.027099e-18,
   4.211801e-18,
   5.891915e-18,
   8.288401e-18,
   1.172715e-17,
   1.6692e-17,
   2.390612e-17,
   3.445801e-17,
   4.999802e-17,
   7.304715e-17,
   1.074866e-16,
   1.5934e-16,
   2.38035e-16,
   3.584559e-16,
   5.443165e-16,
   8.337551e-16,
   1.288715e-15,
   2.010839e-15,
   3.168703e-15,
   5.045031e-15,
   8.119553e-15,
   1.321627e-14,
   2.176873e-14,
   3.630456e-14,
   6.134368e-14,
   1.05089e-13,
   1.826608e-13,
   3.223916e-13,
   5.782969e-13,
   1.055259e-12,
   1.960913e-12,
   3.714837e-12,
   7.183609e-12,
   1.419907e-11,
   2.873063e-11,
   5.961044e-11,
   1.27056e-10,
   2.78779e-10,
   6.311323e-10,
   1.478102e-09,
   3.591593e-09,
   9.084823e-09,
   2.4013e-08,
   6.661593e-08,
   1.949445e-07,
   6.053539e-07,
   2.008574e-06,
   7.17998e-06,
   2.792565e-05,
   0.0001195993,
   0.0005723917,
   0.003118011,
   0.01978896,
   0.1508305,
   1.437428,
   4.905535,
   18.10213,
   35.92419,
   51.05403,
   73.00192,
   105.0495,
   152.1629,
   221.9135,
   325.934,
   482.2409,
   720.4907,
   1097.703,
   1678.639,
   2471.271,
   3257.573,
   3541.546,
   3077.86,
   2249.355,
   1504.05,
   981.6712,
   647.364,
   437.5418,
   304.3293,
   217.7367,
   159.8985,
   120.2075,
   92.26923,
   57.33169,
   37.75782,
   26.04724,
   13.78295,
   8.096796,
   3.441144,
   1.753948,
   1.006317,
   0.6274052,
   0.415992,
   0.2891995,
   0.2087556,
   0.1553637,
   0.118593,
   0.0924765,
   0.07343641,
   0.05924083,
   0.04844944,
   0.04010506,
   0.03355513,
   0.02834456,
   0.02414957,
   0.02073562,
   0.01793004,
   0.01560389,
   0.01365953,
   0.01365953};
   graph = new TGraph(128,sigL_fx2,sigL_fy2);
   graph->SetName("sigL");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(2);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_sigL2 = new TH1F("Graph_sigL2","Projection of totalPdf",128,4126,6214);
   Graph_sigL2->SetMinimum(1.186233e-20);
   Graph_sigL2->SetMaximum(3895.701);
   Graph_sigL2->SetDirectory(0);
   Graph_sigL2->SetStats(0);
   Graph_sigL2->SetLineWidth(2);
   Graph_sigL2->SetMarkerStyle(20);
   Graph_sigL2->GetXaxis()->SetNdivisions(505);
   Graph_sigL2->GetXaxis()->SetLabelFont(132);
   Graph_sigL2->GetXaxis()->SetLabelOffset(0.01);
   Graph_sigL2->GetXaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetXaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetXaxis()->SetTitleOffset(0.95);
   Graph_sigL2->GetXaxis()->SetTitleFont(132);
   Graph_sigL2->GetYaxis()->SetLabelFont(132);
   Graph_sigL2->GetYaxis()->SetLabelOffset(0.01);
   Graph_sigL2->GetYaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetYaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetYaxis()->SetTitleOffset(0.95);
   Graph_sigL2->GetYaxis()->SetTitleFont(132);
   Graph_sigL2->GetZaxis()->SetLabelFont(132);
   Graph_sigL2->GetZaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetZaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetZaxis()->SetTitleOffset(1.2);
   Graph_sigL2->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_sigL2);
   
   graph->Draw("l");
   
   TLegend *leg = new TLegend(0.2,0.02,0.4,0.42,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetTextSize(0.06);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("curvetot","Total PDF","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sigL","#Lambda signal (hypatia)","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TH1D *frame_4380460__4 = new TH1D("frame_4380460__4","A RooPlot of \"m(J/#psi #Lambda)\"",100,4100,6100);
   frame_4380460__4->SetBinContent(1,3718.624);
   frame_4380460__4->SetMinimum(1);
   frame_4380460__4->SetMaximum(7500);
   frame_4380460__4->SetEntries(2);
   frame_4380460__4->SetDirectory(0);
   frame_4380460__4->SetStats(0);
   frame_4380460__4->SetLineWidth(2);
   frame_4380460__4->SetMarkerStyle(20);
   frame_4380460__4->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_4380460__4->GetXaxis()->SetNdivisions(505);
   frame_4380460__4->GetXaxis()->SetLabelFont(132);
   frame_4380460__4->GetXaxis()->SetLabelOffset(0.01);
   frame_4380460__4->GetXaxis()->SetLabelSize(0.06);
   frame_4380460__4->GetXaxis()->SetTitleSize(0.072);
   frame_4380460__4->GetXaxis()->SetTitleOffset(0.95);
   frame_4380460__4->GetXaxis()->SetTitleFont(132);
   frame_4380460__4->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4380460__4->GetYaxis()->SetLabelFont(132);
   frame_4380460__4->GetYaxis()->SetLabelOffset(0.01);
   frame_4380460__4->GetYaxis()->SetLabelSize(0.06);
   frame_4380460__4->GetYaxis()->SetTitleSize(0.072);
   frame_4380460__4->GetYaxis()->SetTitleOffset(0.95);
   frame_4380460__4->GetYaxis()->SetTitleFont(132);
   frame_4380460__4->GetZaxis()->SetLabelFont(132);
   frame_4380460__4->GetZaxis()->SetLabelSize(0.06);
   frame_4380460__4->GetZaxis()->SetTitleSize(0.072);
   frame_4380460__4->GetZaxis()->SetTitleOffset(1.2);
   frame_4380460__4->GetZaxis()->SetTitleFont(132);
   frame_4380460__4->Draw("AXISSAME");
   pad1->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
Exemplo n.º 5
0
void PlotPotential2D( const TString &sim, Int_t time, Int_t zoom=2, Int_t Nbins=2, const TString &options="") {

#ifdef __CINT__
    gSystem->Load("libplasma.so");
#endif

    PlasmaGlob::Initialize();

    // Palettes!
    gROOT->Macro("PlasmaPalettes.C");

    // Init Units table
    PUnits::UnitsTable::Get();

    // Load PData
    PData *pData = PData::Get(sim.Data());
    pData->LoadFileNames(time);
    if(!pData->IsInit()) return;

    TString opt = options;

    // More makeup
    gStyle->SetPadGridY(0);
    if(opt.Contains("gridx")) {
        gStyle->SetPadGridX(1);
    }
    if(opt.Contains("gridy")) {
        gStyle->SetPadGridY(1);
    }


    // Some plasma constants
    Double_t n0 = pData->GetPlasmaDensity();
    Double_t omegap = pData->GetPlasmaFrequency();
    Double_t timedepth = 1.;
    if(omegap!=0.0) timedepth = 1/omegap;
    Double_t kp = pData->GetPlasmaK();
    Double_t skindepth = 1.;
    if(kp!=0.0) skindepth = 1/kp;
    Double_t E0 = pData->GetPlasmaE0();

    // Some beam properties:
    Double_t Ebeam = pData->GetBeamEnergy();
    Double_t gamma = pData->GetBeamGamma();
    Double_t vbeam = pData->GetBeamVelocity();

    cout << Form(" - Bunch gamma      = %8.4f", gamma ) << endl;
    cout << Form(" - Bunch velocity   = %8.4f c", vbeam ) << endl;

    // Other parameters
    Float_t trapPotential = 1.0 - (1.0/gamma);
    cout << Form(" - Trap. potential  = %8.4f mc2/e",trapPotential) << endl;
    cout << endl;

    // Time in OU
    Float_t Time = pData->GetRealTime();
    // z start of the plasma in normalized units.
    Float_t zStartPlasma = pData->GetPlasmaStart()*kp;
    // z start of the beam in normalized units.
    Float_t zStartBeam = pData->GetBeamStart()*kp;
    // z start of the neutral in normalized units.
    Float_t zStartNeutral = pData->GetNeutralStart()*kp;
    // z end of the neutral in normalized units.
    Float_t zEndNeutral = pData->GetNeutralEnd()*kp;

    if(opt.Contains("center")) {
        Time -= zStartPlasma;
        if(opt.Contains("comov"))      // Centers on the head of the beam.
            Time += zStartBeam;
    }
    Float_t shiftz = pData->Shift(opt);
    //  cout << "Shift = " << shiftz << endl;


    // Calculate the "axis range" in number of bins. If Nbins==0 a RMS width is taken.
    Double_t rms0 = pData->GetBeamRmsY() * kp;
    if(pData->IsCyl())  rms0  = pData->GetBeamRmsR() * kp;

    Int_t FirstyBin = 0;
    Int_t LastyBin = 0;
    if(Nbins==0) {
        if(rms0>0.0)
            Nbins =  TMath::Nint(rms0 / pData->GetDX(1));
        else
            Nbins = 1;
    }

    // Slice width limits.
    if(!pData->IsCyl()) {
        FirstyBin = pData->GetNX(1)/2 + 1 - Nbins;
        LastyBin =  pData->GetNX(1)/2 + Nbins;
    } else {
        FirstyBin = 1;
        LastyBin  = Nbins;
    }
    // ----------------------------------------------------------------------------------


    // Get charge density histos
    Int_t Nspecies = pData->NSpecies();
    TH2F **hDen2D = new TH2F*[Nspecies];
    // Get charge density on-axis
    TH1F **hDen1D = new TH1F*[Nspecies];
    // And electric current (integrated)
    TH1F **hCur1D = new TH1F*[Nspecies];
    for(Int_t i=0; i<Nspecies; i++) {

        hDen2D[i] = NULL;

        if(!pData->GetChargeFileName(i))
            continue;

        cout << Form(" Getting charge density of specie: ") << i << endl;


        char hName[24];
        sprintf(hName,"hDen2D_%i",i);
        hDen2D[i] = (TH2F*) gROOT->FindObject(hName);
        if(hDen2D[i]) delete hDen2D[i];

        if(!pData->Is3D())
            hDen2D[i] = pData->GetCharge(i,opt);
        else
            hDen2D[i] = pData->GetCharge2DSliceZY(i,-1,Nbins,opt+"avg");

        hDen2D[i]->SetName(hName);
        hDen2D[i]->GetXaxis()->CenterTitle();
        hDen2D[i]->GetYaxis()->CenterTitle();
        hDen2D[i]->GetZaxis()->CenterTitle();

        if(opt.Contains("comov"))
            hDen2D[i]->GetXaxis()->SetTitle("k_{p} #zeta");
        else
            hDen2D[i]->GetXaxis()->SetTitle("k_{p} z");

        if(pData->IsCyl())
            hDen2D[i]->GetYaxis()->SetTitle("k_{p} r");
        else
            hDen2D[i]->GetYaxis()->SetTitle("k_{p} y");

        hDen2D[i]->GetZaxis()->SetTitle("n [n_{0}]");


        hDen1D[i] = NULL;
        hCur1D[i] = NULL;

        if(!pData->GetEfieldFileName(i))
            continue;

        sprintf(hName,"hDen1D_%i",i);
        hDen1D[i] = (TH1F*) gROOT->FindObject(hName);
        if(hDen1D[i]) delete hDen1D[i];

        // 1D histograms
        if(pData->Is3D()) {
            hDen1D[i] = pData->GetH1SliceZ3D(pData->GetChargeFileName(i)->c_str(),"charge",-1,Nbins,-1,Nbins,opt+"avg");
        } else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0).
            hDen1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",1,Nbins,opt+"avg");
        } else { // 2D cartesian
            hDen1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",-1,Nbins,opt+"avg");
        }
        hDen1D[i]->SetName(hName);

        // if(hDen1D[i]) delete hDen1D[i];
        // hDen1D[i] = (TH1F*) hE2D[i]->ProjectionX(hName,FirstyBin,LastyBin);
        // hDen1D[i]->Scale(1.0/(LastyBin-FirstyBin+1));

        if(opt.Contains("comov"))
            hDen1D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]");
        else
            hDen1D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]");

        if(i==0)
            hDen1D[i]->GetYaxis()->SetTitle("n/n_{0}");
        else if(i==1)
            hDen1D[i]->GetYaxis()->SetTitle("n_{b}/n_{0}");
        else
            hDen1D[i]->GetYaxis()->SetTitle("n_{i}/n_{0}");

        // Get the current:
        if(i==0) continue;

        sprintf(hName,"hCur1D_%i",i);
        hCur1D[i] = (TH1F*) gROOT->FindObject(hName);
        if(hCur1D[i]) delete hCur1D[i];

        if(opt.Contains("curr")) {
            // To get the current is needed to read in a wider transverse range which includes all the charge.
            Int_t NbinsT = 100;
            if(pData->Is3D()) {
                hCur1D[i] = pData->GetH1SliceZ3D(pData->GetChargeFileName(i)->c_str(),"charge",-1,NbinsT,-1,NbinsT,opt+"int");
            } else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0).
                hCur1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",1,NbinsT,opt+"int");
            } else { // 2D cartesian
                hCur1D[i] = pData->GetH1SliceZ(pData->GetChargeFileName(i)->c_str(),"charge",-1,NbinsT,opt+"int");
            }
            hCur1D[i]->SetName(hName);

            if(opt.Contains("comov")) {
                hCur1D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]");
                hCur1D[i]->GetYaxis()->SetTitle("dn/d#zeta [(n_{0}/k_{p}^{3}) (#omega_{p}/c)]");
            } else {
                hCur1D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]");
                hCur1D[i]->GetYaxis()->SetTitle("dn/dz [(n_{0}/k_{p}^{3}) (#omega_{p}/c)]");
            }

            Int_t NB = hCur1D[i]->GetNbinsX();
            Float_t dx = (hCur1D[i]->GetBinLowEdge(1)-hCur1D[i]->GetBinLowEdge(NB+1))/NB;

            // hCur1D[i]->Scale(dx);
            Float_t Charge = hCur1D[i]->Integral() * dx;

            cout << Form(" Integrated charge of specie %3i = %8.4f n0 * kp^-3",i,Charge) << endl;
        }
    }


    // Get electric fields 2D
    const Int_t Nfields = 3;
    TH2F **hE2D = new TH2F*[Nfields];
    TH1F **hE1D = new TH1F*[Nfields];
    TH2F *hV2D = NULL;
    TH1F *hV1D = NULL;
    for(Int_t i=0; i<Nfields; i++) {
        hE2D[i] = NULL;
        hE1D[i] = NULL;

        if(!pData->GetEfieldFileName(i))
            continue;

        cout << Form(" Getting electric field number ") << i+1 << endl;

        char hName[24];
        sprintf(hName,"hE2D_%i",i);
        hE2D[i] = (TH2F*) gROOT->FindObject(hName);
        if(hE2D[i]) delete hE2D[i];

        if(!pData->Is3D())
            hE2D[i] = pData->GetEField(i,opt);
        else
            hE2D[i] = pData->GetEField2DSliceZY(i,-1,Nbins,opt+"avg");

        hE2D[i]->SetName(hName);
        hE2D[i]->GetXaxis()->CenterTitle();
        hE2D[i]->GetYaxis()->CenterTitle();
        hE2D[i]->GetZaxis()->CenterTitle();
        if(opt.Contains("comov"))
            hE2D[i]->GetXaxis()->SetTitle("k_{p} #zeta");
        else
            hE2D[i]->GetXaxis()->SetTitle("k_{p} z");

        if(pData->IsCyl())
            hE2D[i]->GetYaxis()->SetTitle("k_{p} r");
        else
            hE2D[i]->GetYaxis()->SetTitle("k_{p} y");

        if(i==0)
            hE2D[i]->GetZaxis()->SetTitle("E_{z}/E_{0}");
        else if(i==1)
            hE2D[i]->GetZaxis()->SetTitle("E_{y}/E_{0}");
        else if(i==2)
            hE2D[i]->GetZaxis()->SetTitle("E_{x}/E_{0}");

        sprintf(hName,"hE1D_%i",i);
        hE1D[i] = (TH1F*) gROOT->FindObject(hName);
        if(hE1D[i]) delete hE1D[i];

        // 1D histograms
        char nam[3];
        sprintf(nam,"e%i",i+1);
        if(pData->Is3D()) {

            if(i==0)
                hE1D[i] = pData->GetH1SliceZ3D(pData->GetEfieldFileName(i)->c_str(),nam,-1,Nbins,-1,Nbins,opt+"avg");
            else
                hE1D[i] = pData->GetH1SliceZ3D(pData->GetEfieldFileName(i)->c_str(),nam,-Nbins,Nbins,-Nbins,Nbins,opt+"avg");

        } else if(pData->IsCyl()) { // Cylindrical: The first bin with r>0 is actually the number 1 (not the 0).

            hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,1,Nbins,opt+"avg");

        } else { // 2D cartesian

            if(i==0)
                hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,-1,Nbins,opt+"avg");
            else
                hE1D[i] = pData->GetH1SliceZ(pData->GetEfieldFileName(i)->c_str(),nam,-Nbins,Nbins,opt+"avg");
        }

        hE1D[i]->SetName(hName);
        if(opt.Contains("comov"))
            hE1D[i]->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]");
        else
            hE1D[i]->GetXaxis()->SetTitle("z [c/#omega_{p}]");

        if(i==0)
            hE1D[i]->GetYaxis()->SetTitle("E_{z} [E_{0}]");
        else if(i==1)
            hE1D[i]->GetYaxis()->SetTitle("E_{y} [E_{0}]");
        else if(i==2)
            hE1D[i]->GetYaxis()->SetTitle("E_{x} [E_{0}]");

        // Alternative
        // if(hE1D[i]) delete hE1D[i];
        // hE1D[i] = (TH1F*) hE2D[i]->ProjectionX(hName,FirstyBin,LastyBin);
        // hE1D[i]->Scale(1.0/(LastyBin-FirstyBin+1));

        if(i==0) {
            Int_t   NbinsX = hE2D[i]->GetNbinsX();
            Int_t   NbinsY = hE2D[i]->GetNbinsY();

            Float_t dx = pData->GetDX(0);

            sprintf(hName,"hV2D");
            hV2D = (TH2F*) hE2D[i]->Clone(hName);
            hV2D->Reset();

            sprintf(hName,"hV1D");
            hV1D = (TH1F*) hE1D[i]->Clone(hName);
            hV1D->Reset();

            for(Int_t j=NbinsY; j>0; j--) {
                Double_t integral = 0.0;
                for(Int_t k=NbinsX; k>0; k--) {
                    integral += hE2D[i]->GetBinContent(k,j) * dx;
                    hV2D->SetBinContent(k,j,integral);
                }
            }

            Double_t integral = 0.0;
            for(Int_t k=NbinsX; k>0; k--) {
                integral += hE1D[i]->GetBinContent(k) * dx;
                hV1D->SetBinContent(k,integral);
            }

        }

    }

    // Now, combine the electric field components into the total |E|
    // and calculate ionization probability for He:
    // Outter Helium electron
    Double_t Eion0 = 24.59 * PUnits::eV;
    Double_t Z     = 1;

    TH2F *hETotal2D = (TH2F*) hE2D[0]->Clone("hETotal2D");
    hETotal2D->Reset();
    TH2F *hIonProb2D = (TH2F*) hE2D[0]->Clone("hIonProb2D");
    hIonProb2D->Reset();
    TH1F *hETotal1D = (TH1F*) hE1D[0]->Clone("hETotal1D");
    hETotal1D->Reset();
    TH1F *hIonProb1D = (TH1F*) hE1D[0]->Clone("hIonProb1D");
    hIonProb1D->Reset();
    {
        Int_t NbinsX = hE2D[0]->GetNbinsX();
        Int_t NbinsY = hE2D[0]->GetNbinsY();
        for(Int_t j=0; j<NbinsX; j++) {
            for(Int_t k=0; k<NbinsY; k++) {
                Double_t E1 = hE2D[0]->GetBinContent(j,k);
                Double_t E2 = hE2D[1]->GetBinContent(j,k);
                Double_t E3 = hE2D[2]->GetBinContent(j,k);
                Double_t E  = TMath::Sqrt(E1*E1+E2*E2+E3*E3);

                hETotal2D->SetBinContent(j,k,E);

                E *= E0;

                // Double_t IonProb = (PFunc::ADK(E,Eion0,Z,l,m)/PUnits::atomictime)*PUnits::femtosecond;
                Double_t IonProb = PFunc::ADK_ENG(E,Eion0,Z) * PUnits::femtosecond;
                // if(IonProb>1) IonProb = 1.0;
                // cout << "Ion prob = " << IonProb << endl;
                hIonProb2D->SetBinContent(j,k,IonProb);
            }
            Double_t E1 = hE1D[0]->GetBinContent(j);
            Double_t E2 = hE1D[1]->GetBinContent(j);
            Double_t E3 = hE1D[2]->GetBinContent(j);
            Double_t E  = TMath::Sqrt(E1*E1+E2*E2+E3*E3);

            hETotal1D->SetBinContent(j,E);

            E *= E0;

            // Double_t IonProb = (PFunc::ADK(E,Eion0,Z,l,m)/PUnits::atomictime)*PUnits::femtosecond;
            Double_t IonProb = PFunc::ADK_ENG(E,Eion0,Z) * PUnits::femtosecond;
            // cout << "Ion prob = " << IonProb << endl;

            hIonProb1D->SetBinContent(j,IonProb);


        }
    }
    hETotal2D->GetZaxis()->SetTitle("E [E_{0}]");
    hIonProb2D->GetZaxis()->SetTitle("W_{ADK} [fs^{-1}]");
    hETotal1D->GetYaxis()->SetTitle("E [E_{0}]");
    hIonProb1D->GetYaxis()->SetTitle("W_{ADK} [fs^{-1}]");



    // Tunning the Histograms
    // ---------------------

    // Chaning to user units:
    // --------------------------

    if(opt.Contains("units") && n0) {

        for(Int_t i=0; i<Nspecies; i++) {

            if(!hDen2D[i]) continue;

            Int_t NbinsX = hDen2D[i]->GetNbinsX();
            Float_t xMin = skindepth * hDen2D[i]->GetXaxis()->GetXmin() / PUnits::um;
            Float_t xMax = skindepth * hDen2D[i]->GetXaxis()->GetXmax() / PUnits::um;
            Int_t NbinsY = hDen2D[i]->GetNbinsY();
            Float_t ymin = skindepth * hDen2D[i]->GetYaxis()->GetXmin() / PUnits::um;
            Float_t ymax = skindepth * hDen2D[i]->GetYaxis()->GetXmax() / PUnits::um;
            hDen2D[i]->SetBins(NbinsX,xMin,xMax,NbinsY,ymin,ymax);
            // for(Int_t j=0;j<hDen2D[i]->GetNbinsX();j++) {
            // 	for(Int_t k=0;k<hDen2D[i]->GetNbinsY();k++) {
            // 	  hDen2D[i]->SetBinContent(j,k, hDen2D[i]->GetBinContent(j,k) * n0 / (1e17/PUnits::cm3) );
            // 	}
            // }

            if(pData->IsCyl())
                hDen2D[i]->GetYaxis()->SetTitle("r [#mum]");
            else
                hDen2D[i]->GetYaxis()->SetTitle("y [#mum]");

            if(opt.Contains("comov"))
                hDen2D[i]->GetXaxis()->SetTitle("#zeta [#mum]");
            else
                hDen2D[i]->GetXaxis()->SetTitle("z [#mum]");

            // if(i==0)
            // 	hDen2D[i]->GetZaxis()->SetTitle("n_{e} [10^{17}/cm^{3}]");
            // else if(i==1)
            // 	hDen2D[i]->GetZaxis()->SetTitle("n_{b} [10^{17}/cm^{3}]");
            // else
            // 	hDen2D[i]->GetZaxis()->SetTitle("n_{i} [10^{17}/cm^{3}]");

            hDen1D[i]->SetBins(NbinsX,xMin,xMax);
            // for(Int_t j=0;j<hDen1D[i]->GetNbinsX();j++) {
            // 	hDen1D[i]->SetBinContent(j, hDen1D[i]->GetBinContent(j) * n0 / (1e17/PUnits::cm3) );
            // }


            if(opt.Contains("comov"))
                hDen1D[i]->GetXaxis()->SetTitle("#zeta [#mum]");
            else
                hDen1D[i]->GetXaxis()->SetTitle("z [#mum]");

            if(hCur1D[i]) {

                hCur1D[i]->SetBins(NbinsX,xMin,xMax);
                Double_t binSize = (xMax - xMin)/NbinsX;  // bin size in um.

                Double_t dV = skindepth * skindepth * skindepth;
                Double_t lightspeed =  PConst::c_light / (PUnits::um/PUnits::femtosecond);

                hCur1D[i]->Scale(TMath::Abs(n0 * dV * (PConst::ElectronCharge/PUnits::picocoulomb) * (kp * PConst::c_light * PUnits::femtosecond)));

                hCur1D[i]->GetYaxis()->SetTitle("I[kA]");
                hCur1D[i]->GetYaxis()->SetTitle("");
                if(opt.Contains("comov"))
                    hCur1D[i]->GetXaxis()->SetTitle("#zeta [#mum]");
                else
                    hCur1D[i]->GetXaxis()->SetTitle("z [#mum]");


                Float_t Charge = hCur1D[i]->Integral() * (binSize / lightspeed);
                cout << Form(" Integrated charge of specie %3i = %8f pC",i,Charge) << endl;
            }
        }


        for(Int_t i=0; i<Nfields; i++) {
            Int_t NbinsX = hE2D[i]->GetNbinsX();
            Float_t xMin = skindepth * hE2D[i]->GetXaxis()->GetXmin() / PUnits::um;
            Float_t xMax = skindepth * hE2D[i]->GetXaxis()->GetXmax() / PUnits::um;
            Int_t NbinsY = hE2D[i]->GetNbinsY();
            Float_t ymin = skindepth * hE2D[i]->GetYaxis()->GetXmin() / PUnits::um;
            Float_t ymax = skindepth * hE2D[i]->GetYaxis()->GetXmax() / PUnits::um;
            hE2D[i]->SetBins(NbinsX,xMin,xMax,NbinsY,ymin,ymax);
            hE1D[i]->SetBins(NbinsX,xMin,xMax);

            for(Int_t j=0; j<hE2D[i]->GetNbinsX(); j++) {
                for(Int_t k=0; k<hE2D[i]->GetNbinsY(); k++) {
                    hE2D[i]->SetBinContent(j,k, hE2D[i]->GetBinContent(j,k) * ( E0 / (PUnits::GV/PUnits::m) ) );
                }
                hE1D[i]->SetBinContent(j, hE1D[i]->GetBinContent(j) * ( E0 / (PUnits::GV/PUnits::m) ) );
            }

            if(pData->IsCyl())
                hE2D[i]->GetYaxis()->SetTitle("r [#mum]");
            else
                hE2D[i]->GetYaxis()->SetTitle("y [#mum]");

            if(opt.Contains("comov"))
                hE2D[i]->GetXaxis()->SetTitle("#zeta [#mum]");
            else
                hE2D[i]->GetXaxis()->SetTitle("z [#mum]");

            if(i==0)
                hE2D[i]->GetZaxis()->SetTitle("E_{z} [GV/m]");
            else if(i==1)
                hE2D[i]->GetZaxis()->SetTitle("E_{y} [GV/m]");
            else if(i==2)
                hE2D[i]->GetZaxis()->SetTitle("E_{x} [GV/m]");


            if(opt.Contains("comov"))
                hE1D[i]->GetXaxis()->SetTitle("#zeta [mm]");
            else
                hE1D[i]->GetXaxis()->SetTitle("z [mm]");

            if(i==0)
                hE1D[i]->GetYaxis()->SetTitle("E_{z} [GV/m]");
            else if(i==1)
                hE1D[i]->GetYaxis()->SetTitle("E_{y} [GV/m]");
            else if(i==2)
                hE1D[i]->GetYaxis()->SetTitle("E_{x} [GV/m]");


            if(i==0) {
                hV2D->SetBins(NbinsX,xMin,xMax,NbinsY,ymin,ymax);
                hETotal2D->SetBins(NbinsX,xMin,xMax,NbinsY,ymin,ymax);
                hIonProb2D->SetBins(NbinsX,xMin,xMax,NbinsY,ymin,ymax);
                hV1D->SetBins(NbinsX,xMin,xMax);
                hETotal1D->SetBins(NbinsX,xMin,xMax);
                hIonProb1D->SetBins(NbinsX,xMin,xMax);
                for(Int_t j=0; j<NbinsX; j++) {
                    for(Int_t k=0; k<NbinsY; k++) {
                        hV2D->SetBinContent(j,k, hV2D->GetBinContent(j,k) * E0 * skindepth / (PUnits::MV));
                        hETotal2D->SetBinContent(j,k, hETotal2D->GetBinContent(j,k) * ( E0 / (PUnits::GV/PUnits::m) ) );
                    }
                    hV1D->SetBinContent(j, hV1D->GetBinContent(j) * ( E0 * skindepth / (PUnits::MV) ) );
                    hETotal1D->SetBinContent(j, hETotal1D->GetBinContent(j) * ( E0 / (PUnits::GV/PUnits::m) ) );
                }

                if(pData->IsCyl()) {
                    hV2D->GetYaxis()->SetTitle("r [#mum]");
                    hETotal2D->GetYaxis()->SetTitle("r [#mum]");
                } else {
                    hV2D->GetYaxis()->SetTitle("y [#mum]");
                    hETotal2D->GetYaxis()->SetTitle("y [#mum]");

                }

                if(opt.Contains("comov")) {
                    hV2D->GetXaxis()->SetTitle("#zeta [#mum]");
                    hV1D->GetXaxis()->SetTitle("#zeta [#mum]");
                    hETotal2D->GetXaxis()->SetTitle("#zeta [#mum]");
                    hETotal1D->GetXaxis()->SetTitle("#zeta [#mum]");
                } else {
                    hV2D->GetXaxis()->SetTitle("z [#mum]");
                    hV2D->GetXaxis()->SetTitle("z [#mum]");
                    hETotal2D->GetXaxis()->SetTitle("z [#mum]");
                    hETotal1D->GetXaxis()->SetTitle("z [#mum]");
                }

                hV2D->GetZaxis()->SetTitle("#Psi-#Psi_{t} [MV]");
                hV1D->GetYaxis()->SetTitle("#Psi-#Psi_{t} [MV]");
                hETotal2D->GetZaxis()->SetTitle("E [GV/m]");
                hETotal1D->GetYaxis()->SetTitle("E [GV/m]");
            }
        }
    }


    // --------------------------------------------------- Vertical Zoom ------------

    Float_t yRange    = (hDen2D[0]->GetYaxis()->GetXmax() - hDen2D[0]->GetYaxis()->GetXmin())/zoom;
    Float_t midPoint = (hDen2D[0]->GetYaxis()->GetXmax() + hDen2D[0]->GetYaxis()->GetXmin())/2.;
    Float_t yMin = midPoint-yRange/2;
    Float_t yMax = midPoint+yRange/2;
    if(pData->IsCyl()) {
        yMin = pData->GetXMin(1);
        yMax = yRange;
    }

    for(Int_t i=0; i<Nspecies; i++) {
        if(!hDen2D[i]) continue;
        hDen2D[i]->GetYaxis()->SetRangeUser(yMin,yMax);
    }

    for(Int_t i=0; i<Nfields; i++) {
        if(!hE2D[i]) continue;
        hE2D[i]->GetYaxis()->SetRangeUser(yMin,yMax);
    }

    hETotal2D->GetYaxis()->SetRangeUser(yMin,yMax);

    Float_t xMin = hDen2D[0]->GetXaxis()->GetXmin();
    Float_t xMax = hDen2D[0]->GetXaxis()->GetXmax();
    Float_t xRange = xMax - xMin;

    // ------------- z Zoom --------------------------------- Plasma palette -----------
    // Set the range of the plasma charge density histogram for maximum constrast
    // using a dynamic palette wich adjust the nominal value to a certain color.


    Float_t density = 1;
    Float_t Base  = density;

    Float_t *Max = new Float_t[Nspecies];
    Float_t *Min = new Float_t[Nspecies];

    for(Int_t i=0; i<Nspecies; i++) {
        if(!hDen2D[i]) continue;

        Max[i] = hDen2D[i]->GetMaximum();
        Min[i] = 1.01E-1 * Base;
        if(i==1) Min[i] = 1.01E-1 * Base;
        if(i==2) Min[i] = 1.01E-4 * Base;
        hDen2D[i]->GetZaxis()->SetRangeUser(Min[i],Max[i]);
    }

    // Dynamic plasma palette
    const Int_t plasmaDNRGBs = 3;
    const Int_t plasmaDNCont = 64;
    Float_t basePos = 0.5;
    if(Max[0]!=Min[0]) {
        if(opt.Contains("logz")) {
            Float_t a = 1.0/(TMath::Log10(Max[0])-TMath::Log10(Min[0]));
            Float_t b = TMath::Log10(Min[0]);
            basePos = a*(TMath::Log10(Base) - b);

        } else {
            basePos = (1.0/(Max[0]-Min[0]))*(Base - Min[0]);
        }
    }

    Double_t plasmaDStops[plasmaDNRGBs] = { 0.00, basePos, 1.00 };
    Double_t plasmaDRed[plasmaDNRGBs]   = { 0.99, 0.90, 0.00 };
    Double_t plasmaDGreen[plasmaDNRGBs] = { 0.99, 0.90, 0.00 };
    Double_t plasmaDBlue[plasmaDNRGBs]  = { 0.99, 0.90, 0.00 };

    PPalette * plasmaPalette = (PPalette*) gROOT->FindObject("plasma");
    plasmaPalette->CreateGradientColorTable(plasmaDNRGBs, plasmaDStops,
                                            plasmaDRed, plasmaDGreen, plasmaDBlue, plasmaDNCont);
    // Change the range of z axis for the fields to be symmetric.
    Float_t *Emax = new Float_t[Nfields];
    Float_t *Emin = new Float_t[Nfields];
    for(Int_t i=0; i<Nfields; i++) {
        Emax[i] = hE2D[i]->GetMaximum();
        Emin[i] = hE2D[i]->GetMinimum();
        if(Emax[i] > TMath::Abs(Emin[i]))
            Emin[i] = -Emax[i];
        else
            Emax[i] = -Emin[i];
        hE2D[i]->GetZaxis()->SetRangeUser(Emin[i],Emax[i]);
    }


    // Potential
    if(opt.Contains("units")) {
        trapPotential *=  ( E0 * skindepth / (PUnits::MV) );
    }

    Float_t Vmin = hV1D->GetMinimum();
    {   // Shift potential
        Int_t   NbinsX = hV2D->GetNbinsX();
        Int_t   NbinsY = hV2D->GetNbinsY();
        for(Int_t j=0; j<NbinsX; j++) {
            for(Int_t k=0; k<NbinsY; k++) {
                hV2D->SetBinContent(j,k, hV2D->GetBinContent(j,k) - Vmin -trapPotential);
            }
            hV1D->SetBinContent(j, hV1D->GetBinContent(j) - Vmin -trapPotential);
        }
    }

    Vmin = hV1D->GetMinimum();
    Float_t Vmax = hV1D->GetMaximum();

    // Dynamic potential palette
    const Int_t potPNRGBs = 5;
    const Int_t potPNCont = 64;
    Float_t zeroPos = -Vmin/(Vmax-Vmin);

    Double_t potPStops[potPNRGBs] = { 0.00, zeroPos-3.0/potPNCont,zeroPos, zeroPos+3.0/potPNCont, 1.00 };
    Double_t potPRed[potPNRGBs]   = { 0.518, 0.965, 0.90, 0.498, 0.106 };
    Double_t potPGreen[potPNRGBs] = { 0.078, 0.925, 0.90, 0.718, 0.078 };
    Double_t potPBlue[potPNRGBs]  = { 0.106, 0.353, 0.90, 0.780, 0.518 };

    PPalette * potentialPalette = (PPalette*) gROOT->FindObject("rbow2inv");
    potentialPalette->CreateGradientColorTable(potPNRGBs, potPStops,
            potPRed, potPGreen, potPBlue, potPNCont);

    // Extract contours
    TCanvas* c = new TCanvas("c","Contour List",0,0,600,600);
    c->cd();

    // Potential
    TH2F *hV2Dc = (TH2F*) hV2D->Clone("hV2Dc");
    const Int_t Ncontours = 25;
    Double_t contours[Ncontours];
    for(Int_t i=0; i<Ncontours; i++) {
        contours[i] = i*(trapPotential/5.0) - trapPotential;
    }
    hV2Dc->SetContour(Ncontours, contours);
    hV2Dc->Draw("cont list");

    c->Update();
    TObjArray *contsV2D = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
    TClonesArray graphsV2D("TGraph",Ncontours);
    {
        Int_t ncontours = contsV2D->GetSize();
        TList* clist = NULL;
        Int_t nGraphs = 0;
        TGraph *gr = NULL;
        for(Int_t i = 0; i < ncontours; i++) {
            if(i==0) continue;

            clist = (TList*) contsV2D->At(i);

            for(Int_t j = 0 ; j < clist->GetSize(); j++) {
                gr = (TGraph*) clist->At(j);
                if(!gr) continue;

                gr->SetLineWidth(1);
                gr->SetLineColor(kGray+1);

                if( !((i)%5) ) {
                    gr->SetLineWidth(2);
                    gr->SetLineColor(kGray+2);
                }
                new(graphsV2D[nGraphs]) TGraph(*gr) ;
                nGraphs++;
            }
        }
    }

    // Ion probability
    hIonProb2D->GetZaxis()->SetRangeUser(0.00501,80);

    TH2F *hIonProb2Dc = (TH2F*) hIonProb2D->Clone("hIonProb2Dc");
    const Int_t NcontI = 4;
    Double_t contI[NcontI] = {0.01,0.1,1.0,10.0};
    hIonProb2Dc->SetContour(NcontI, contI);
    hIonProb2Dc->Draw("cont list");

    c->Update();
    TObjArray *contsI2D = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
    TClonesArray graphsI2D("TGraph",NcontI);
    {
        Int_t ncontours = contsI2D->GetSize();
        TList* clist = NULL;
        Int_t nGraphs = 0;
        TGraph *gr = NULL;
        for(Int_t i = 0; i < ncontours; i++) {
            clist = (TList*) contsI2D->At(i);

            for(Int_t j = 0 ; j < clist->GetSize(); j++) {
                gr = (TGraph*) clist->At(j);
                if(!gr) continue;

                if( !(i%2) ) {
                    gr->SetLineWidth(1);
                    gr->SetLineStyle(2);
                    gr->SetLineColor(kOrange-3);
                } else {
                    gr->SetLineWidth(1);
                    gr->SetLineStyle(1);
                    gr->SetLineColor(kOrange-3);
                }

                new(graphsI2D[nGraphs]) TGraph(*gr) ;
                nGraphs++;
            }
        }
    }




    // "Axis range" in Osiris units:
    Double_t ylow  = hDen2D[0]->GetYaxis()->GetBinLowEdge(FirstyBin);
    Double_t yup = hDen2D[0]->GetYaxis()->GetBinUpEdge(LastyBin);
    Double_t xmin = hDen2D[0]->GetXaxis()->GetXmin();
    Double_t xmax = hDen2D[0]->GetXaxis()->GetXmax();

    TLine *lineYzero = new TLine(xmin,0.0,xmax,0.0);
    lineYzero->SetLineColor(kGray+2);
    lineYzero->SetLineStyle(2);

    TLine *lineYup = new TLine(xmin,yup,xmax,yup);
    lineYup->SetLineColor(kGray+1);
    lineYup->SetLineStyle(2);

    TLine *lineYdown = new TLine(xmin,ylow,xmax,ylow);
    lineYdown->SetLineColor(kGray+1);
    lineYdown->SetLineStyle(2);

    zStartPlasma -= shiftz;
    zStartNeutral -= shiftz;
    zEndNeutral -= shiftz;

    if(opt.Contains("units")) {
        zStartPlasma *= skindepth / PUnits::um;
        zStartNeutral *= skindepth / PUnits::um;
        zEndNeutral *= skindepth / PUnits::um;
    }

    //  cout << "Start plasma = " << zStartPlasma << endl;
    TLine *lineStartPlasma = new TLine(zStartPlasma,yMin,zStartPlasma,yMax);
    lineStartPlasma->SetLineColor(kGray+2);
    lineStartPlasma->SetLineStyle(2);
    lineStartPlasma->SetLineWidth(3);

    //  cout << "Start plasma = " << zStartNeutral << endl;
    TLine *lineStartNeutral = new TLine(zStartNeutral,yMin,zStartNeutral,yMax);
    lineStartNeutral->SetLineColor(kGray+1);
    lineStartNeutral->SetLineStyle(2);
    lineStartNeutral->SetLineWidth(3);

    //  cout << "End plasma = " << zEndNeutral << endl;
    TLine *lineEndNeutral = new TLine(zEndNeutral,yMin,zEndNeutral,yMax);
    lineEndNeutral->SetLineColor(kGray+1);
    lineEndNeutral->SetLineStyle(2);
    lineEndNeutral->SetLineWidth(3);


    // Plotting
    // -----------------------------------------------

    // Canvas setup
    TCanvas *C = new TCanvas("C","2D Charge density and Electric field",750,666);

    // Palettes setup
    TExec *exPlasma = new TExec("exPlasma","plasmaPalette->cd();");
    TExec *exElec   = new TExec("exElec","redelectronPalette->cd();");
    TExec *exHot    = new TExec("exHot","hotPalette->cd();");
    TExec *exField  = new TExec("exField","rbow2Palette->cd();");
    TExec *exFieldT = new TExec("exFieldT","redPalette->cd();");
    TExec *exIonP   = new TExec("exIonP","redPalette->cd();");
    TExec *exPot    = new TExec("exPot","rbow2invPalette->cd();");

    // Actual Plotting!
    // ------------------------------------------------------------

    // Output file
    TString fOutName = Form("./%s/Plots/Potential2D/Potential2D",pData->GetPath().c_str());
    fOutName += Form("-%s_%i",pData->GetName(),time);

    // Setup Pad layout:
    Float_t lMargin = 0.15;
    Float_t rMargin = 0.18;
    Float_t bMargin = 0.15;
    Float_t tMargin = 0.04;
    Float_t factor = 1.0;
    PlasmaGlob::CanvasAsymPartition(C,2,lMargin,rMargin,bMargin,tMargin,factor);

    TPad *pad[2];
    TString sLabels[] = {"(a)","(b)"};
    // Text objects
    TPaveText **textLabel = new TPaveText*[2];

    C->cd(0);
    char pname[16];
    sprintf(pname,"pad_%i",1);
    pad[0] = (TPad*) gROOT->FindObject(pname);
    pad[0]->Draw();
    pad[0]->cd(); // <---------------------------------------------- Top Plot ---------
    if(opt.Contains("logz")) {
        pad[0]->SetLogz(1);
    } else {
        pad[0]->SetLogz(0);
    }
    pad[0]->SetFrameLineWidth(3);
    pad[0]->SetTickx(1);

    // Re-range:
    for(Int_t i=0; i<Nspecies; i++) {
        if(!hDen2D[i]) continue;
        hDen2D[i]->GetYaxis()->SetRangeUser(yMin -(factor-1)*yRange, yMax);
    }


    TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame1");
    if(hFrame) delete hFrame;
    hFrame = (TH2F*) hDen2D[0]->Clone("hFrame1");
    hFrame->Reset();

    hFrame->SetLabelFont(42,"xyz");
    hFrame->SetTitleFont(42,"xyz");

    hFrame->GetYaxis()->SetNdivisions(505);
    hFrame->GetYaxis()->SetLabelSize(0.085);
    hFrame->GetYaxis()->SetTitleSize(0.09);
    hFrame->GetYaxis()->SetTitleOffset(0.7);
    hFrame->GetYaxis()->SetTickLength(0.02);

    hFrame->GetXaxis()->SetLabelOffset(999.);
    hFrame->GetXaxis()->SetTitleOffset(999.);
    hFrame->GetXaxis()->SetTickLength(0.04);

    // Frame asymmetry:
    hFrame->Draw("col");

    // hDen2D[0]->GetZaxis()->SetNdivisions(505);

    // Injected electrons if any
    if(Nspecies>=3) {
        if(hDen2D[2]) {
            exHot->Draw();
            hDen2D[2]->Draw("colz same");
        }
    }

    // Plasma
    hDen2D[0]->GetZaxis()->SetTitleFont(42);
    exPlasma->Draw();
    hDen2D[0]->Draw("colz same");

    // Beam driver.
    if(hDen2D[1]) {
        //    hDen2D[1]->GetZaxis()->SetNdivisions(505);
        exElec->Draw();
        hDen2D[1]->Draw("colz same");
    }

    {
        TGraph *gr = (TGraph*) graphsV2D.At(4);
        gr->Draw("C");
    }

    {
        TGraph *gr = (TGraph*) graphsI2D.At(1);
        gr->Draw("C");
    }


    if(opt.Contains("1dline")) {
        lineYzero->Draw();
        lineYdown->Draw();
        lineYup->Draw();
    }

    if(opt.Contains("sline")) {
        if(zStartPlasma>xmin && zStartPlasma<xmax)
            lineStartPlasma->Draw();
        if(zStartNeutral>xmin && zStartNeutral<xmax)
            lineStartNeutral->Draw();
        if(zEndNeutral>xmin && zEndNeutral<xmax)
            lineEndNeutral->Draw();
    }

    // lineYdown->Draw();
    // lineYup->Draw();

    // Palettes re-arrangement
    pad[0]->Update();
    Float_t y1 = pad[0]->GetBottomMargin();
    Float_t y2 = 1 - pad[0]->GetTopMargin();
    Float_t x1 = pad[0]->GetLeftMargin();
    Float_t x2 = 1 - pad[0]->GetRightMargin();

    TPaletteAxis *palette = NULL;
    if(Nspecies>=3) {
        if(hDen2D[2]) {
            palette = (TPaletteAxis*)hDen2D[2]->GetListOfFunctions()->FindObject("palette");
        }
    }
    if(palette) {
        palette->SetY2NDC(y2 - 0.00);
        palette->SetY1NDC(0.66*(y1+y2) + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        //  palette->SetTitleFont(42);
        //  palette->SetTitleOffset(0.85);
        palette->SetTitleOffset(999.9);
        palette->SetTitleSize(0.075);
        palette->SetLabelFont(42);
        palette->SetLabelSize(0.075);
        palette->SetLabelOffset(0.001);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }

    palette = (TPaletteAxis*)hDen2D[0]->GetListOfFunctions()->FindObject("palette");
    if(palette) {
        palette->SetY2NDC(0.66*(y1+y2) - 0.00);
        palette->SetY1NDC(0.33*(y1+y2) + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        // palette->SetTitleFont(42);
        palette->SetTitleOffset(0.80);
        palette->SetTitleSize(0.075);
        palette->SetLabelFont(42);
        palette->SetLabelSize(0.075);
        palette->SetLabelOffset(0.001);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }

    palette = (TPaletteAxis*)hDen2D[1]->GetListOfFunctions()->FindObject("palette");
    if(palette) {
        palette->SetY2NDC(0.33*(y1+y2) - 0.00);
        palette->SetY1NDC(y1 + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        //palette->SetTitleFont(42);
        //palette->SetTitleOffset(0.85);
        palette->SetTitleOffset(999.9);
        palette->SetTitleSize(0.075);
        palette->SetLabelFont(42);
        palette->SetLabelSize(0.075);
        palette->SetLabelOffset(0.001);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }


    // 1D charge density plots:
    Float_t yaxismin  =  pad[0]->GetUymin();
    Float_t yaxismax  =  pad[0]->GetUymin() + 0.33*(pad[0]->GetUymax() - pad[0]->GetUymin()) - 0.00;
    Float_t denmin = Min[1];
    Float_t denmax = Max[1];
    if(opt.Contains("logz")) {
        denmin = TMath::Log10(denmin);
        denmax = TMath::Log10(denmax);
    }

    Float_t curmin = 0.0;
    Float_t curmax = 0.0;
    if(opt.Contains("curr")) {
        curmin = 0.0;
        curmax = hCur1D[1]->GetMaximum();

        cout << Form(" Maximum driver  current = %6.2f kA ", curmax) << endl ;
        if(Nspecies>=3)
            if(hCur1D[2])
                cout << Form(" Maximum witness current = %6.2f kA ", hCur1D[2]->GetMaximum()) << endl ;

        // Round for better plotting
        curmax = 0.1*TMath::Nint(curmax*10);
    }

    for(Int_t i=0; i<Nspecies; i++) {
        if(!hDen1D[i]) continue;

        Float_t slope = (yaxismax - yaxismin)/(denmax - denmin);

        for(Int_t j=0; j<hDen1D[i]->GetNbinsX(); j++) {
            Float_t content = hDen1D[i]->GetBinContent(j+1);
            if(opt.Contains("logz")) content = TMath::Log10(content);

            if(content<denmin)
                hDen1D[i]->SetBinContent(j+1,yaxismin);
            else
                hDen1D[i]->SetBinContent(j+1,(content - denmin) * slope + yaxismin);


        }

        if(hCur1D[i]) {
            slope = (yaxismax - yaxismin)/(curmax - curmin);

            for(Int_t j=0; j<hCur1D[i]->GetNbinsX(); j++) {
                Float_t content = hCur1D[i]->GetBinContent(j+1);

                if(content<curmin)
                    hCur1D[i]->SetBinContent(j+1,yaxismin);
                else
                    hCur1D[i]->SetBinContent(j+1,(content - curmin) * slope + yaxismin);
            }

        }

    }

    // Plasma on-axis density:
    // hDen1D[0]->SetLineWidth(2);
    // hDen1D[0]->SetLineColor(kGray+1);
    // // // PlasmaGlob::SetH1Style(hDen1D[0],1);
    // hDen1D[0]->Draw("same C");


    if(opt.Contains("curr")) {
        hCur1D[1]->SetLineWidth(2);
        hCur1D[1]->SetLineColor(PlasmaGlob::elecLine);
        hCur1D[1]->Draw("same C");
    } else {
        hDen1D[1]->SetLineWidth(2);
        hDen1D[1]->SetLineColor(PlasmaGlob::elecLine);
        //    hDen1D[1]->Draw("same C");
    }

    if(Nspecies>=3) {
        if(hDen1D[2]) {
            if(opt.Contains("curr")) {
                hCur1D[2]->SetLineWidth(2);
                hCur1D[2]->SetLineColor(kOrange+8);
                hCur1D[2]->Draw("same C");
            } else {
                hDen1D[2]->SetLineWidth(2);
                hDen1D[2]->SetLineColor(kOrange+8);
                //   hDen1D[2]->Draw("same C");
            }
        }
    }

    // Current axis
    TGaxis *axis = NULL;
    if(opt.Contains("curr")) {
        axis = new TGaxis(xMax-xRange/6.0,yMin - (factor-1)*yRange,
                          xMax-xRange/6.0,yaxismax,
                          0.001,curmax,503,"+LS");

        axis->SetLineWidth(1);
        axis->SetLineColor(kGray+3);//PlasmaGlob::elecLine);
        axis->SetLabelColor(kGray+3);//PlasmaGlob::elecLine);
        axis->SetLabelSize(0.06);
        axis->SetLabelOffset(0.01);
        axis->SetLabelFont(42);
        axis->SetTitleColor(kGray+3);//PlasmaGlob::elecLine);
        axis->SetTitleSize(0.06);
        axis->SetTitleOffset(0.6);
        axis->SetTitleFont(42);
        axis->SetTickSize(0.03);
        axis->SetTitle("I [kA]");
        axis->CenterTitle();
        axis->SetNdivisions(505);

        axis->Draw();
    }


    TPaveText *textTime = new TPaveText(xMax - 0.3*xRange, yMax-0.15*yRange, xMax-0.1, yMax-0.05*yRange);
    //x2-0.17,y2-0.12,x2-0.02,y2-0.02,"NDC");
    PlasmaGlob::SetPaveTextStyle(textTime,32);
    char ctext[128];
    if(opt.Contains("units") && n0)
        sprintf(ctext,"z = %5.1f #mum", Time * skindepth / PUnits::um);
    else
        sprintf(ctext,"t = %5.1f #omega_{p}^{-1}",Time);
    textTime->SetTextFont(42);
    textTime->AddText(ctext);

    textTime->Draw();
    // textDen->Draw();
    // if(opt.Contains("units"))
    //   textWav->Draw();

    textLabel[0] = new TPaveText(xMin + 0.02*xRange, yMax-0.2*yRange, xMin+0.30*xRange, yMax-0.05*yRange);
    PlasmaGlob::SetPaveTextStyle(textLabel[0],12);
    textLabel[0]->SetTextFont(42);
    textLabel[0]->AddText(sLabels[0]);
    textLabel[0]->Draw();


    pad[0]->RedrawAxis();

    C->cd(0);
    sprintf(pname,"pad_%i",0);
    pad[1] = (TPad*) gROOT->FindObject(pname);
    pad[1]->Draw();
    pad[1]->cd(); // <--------------------------------------------------------- Bottom Plot
    pad[1]->SetFrameLineWidth(3);
    pad[1]->SetTickx(1);

    hFrame = (TH2F*) gROOT->FindObject("hFrame2");
    if(hFrame) delete hFrame;
    hFrame = (TH2F*) hDen2D[0]->Clone("hFrame2");
    hFrame->Reset();

    Float_t yFactor = pad[0]->GetAbsHNDC()/pad[1]->GetAbsHNDC();


    hFrame->GetYaxis()->SetLabelSize(yFactor*0.085);
    hFrame->GetYaxis()->SetTitleSize(yFactor*0.09);
    hFrame->GetYaxis()->SetTitleOffset(0.7/yFactor);
    hFrame->GetYaxis()->SetTickLength(0.02/yFactor);

    hFrame->GetXaxis()->SetTitleSize(0.10);
    hFrame->GetXaxis()->SetLabelSize(0.08);
    hFrame->GetXaxis()->SetLabelOffset(0.02);
    hFrame->GetXaxis()->SetTitleOffset(1.0);
    hFrame->GetXaxis()->SetTickLength(0.04*yFactor);

    hFrame->SetLabelFont(42,"xyz");
    hFrame->SetTitleFont(42,"xyz");

    hFrame->Draw("col");

    //  hE2D[0]->GetZaxis()->SetNdivisions(505);
    hV2D->GetZaxis()->SetTitleFont(42);
    hV2D->GetZaxis()->SetTickLength(0.02/yFactor);


    exPot->Draw();

    hV2D->Draw("col z same");

    for(Int_t i=0; i<graphsV2D.GetEntriesFast(); i++) {
        TGraph *gr = (TGraph*) graphsV2D.At(i);
        if(!gr) continue;
        gr->Draw("C");
    }

    for(Int_t i=0; i<graphsI2D.GetEntriesFast(); i++) {
        //if(i!=2) continue;
        TGraph *gr = (TGraph*) graphsI2D.At(i);
        if(!gr) continue;
        gr->Draw("C");
    }


    if(opt.Contains("1dline")) {
        lineYzero->Draw();
        lineYdown->Draw();
        lineYup->Draw();
    }

    if(opt.Contains("sline")) {
        if(zStartPlasma>xmin && zStartPlasma<xmax)
            lineStartPlasma->Draw();
        if(zStartNeutral>xmin && zStartNeutral<xmax)
            lineStartNeutral->Draw();
        if(zEndNeutral>xmin && zEndNeutral<xmax)
            lineEndNeutral->Draw();
    }


    pad[1]->Update();

    y1 = pad[1]->GetBottomMargin();
    y2 = 1 - pad[1]->GetTopMargin();
    x1 = pad[1]->GetLeftMargin();
    x2 = 1 - pad[1]->GetRightMargin();

    palette = (TPaletteAxis*)hV2D->GetListOfFunctions()->FindObject("palette");
    if(palette) {
        palette->SetY2NDC(y2 - 0.00);
        palette->SetY1NDC(y1 + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        // palette->SetTitleFont(42);
        palette->SetTitleSize(yFactor*0.075);
        palette->SetTitleOffset(0.80/yFactor);
        palette->SetLabelSize(yFactor*0.075);
        palette->SetLabelFont(42);
        palette->SetLabelOffset(0.01/yFactor);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }



    pad[1]->RedrawAxis();

    textLabel[1] = new TPaveText(xMin + 0.02*xRange, yMax-0.2*yRange, xMin+0.30*xRange, yMax-0.05*yRange);
    PlasmaGlob::SetPaveTextStyle(textLabel[1],12);
    textLabel[1]->SetTextFont(42);
    textLabel[1]->AddText(sLabels[1]);
    textLabel[1]->Draw();

    C->cd();

    // Print to a file
    PlasmaGlob::imgconv(C,fOutName,opt);
    // ---------------------------------------------------------

    PlasmaGlob::DestroyCanvases();
}
int main(int argc, char* argv[]){
//int analyzer_stackRatio(){
gROOT->ProcessLine(".x /afs/cern.ch/work/n/nchernya/setTDRStyle.C");
 
const int nfiles  = 16;
TString leg_names[nfiles] = {"Data, 13 TeV, bx = 25 ns",/*"powheg, m(H) = 130 GeV","amc@NLO, m(H) = 125 GeV",*/"VBF, m(H) = 125 GeV","t#bar{t}H, H#rightarrow b#bar{b}","t#bar{t}H, non b#bar{b}","QCD","QCD, H_{T}=200-300 GeV","QCD, H_{T}=300-500 GeV","QCD, H_{T}=500-700 GeV","QCD, H_{T}=700-1000 GeV","QCD, H_{T}=1000-1500 GeV","QCD, H_{T}=1500-2000 GeV","QCD, H_{T}=2000-Inf GeV","t#bar{t}","single top (tW)","Z(qq) + jets","Z(ll) + jets"};
//TString file_names[nfiles] = { "data_BTagCSV",/*"Spring15_powheg_M130","Spring15_amcatnlo_M125",*/"VBFHToBB_M-125_13TeV_powheg","QCD_HT100to200","QCD_HT200to300","QCD_HT300to500","QCD_HT500to700","QCD_HT700to1000","QCD_HT1000to1500","QCD_HT1500to2000","QCD_HT2000toInf"}; 		
TString file_names[nfiles] = { "BTagCSV",/*"VBFHToBB_M-130_13TeV_powheg",*/"VBFHToBB_M-125_13TeV_powheg","ttHtobb","ttHtoNbb","DYtoQQ","DYtoLL","ST_tW","TTbar","QCD_HT2000toInf","QCD_HT1500to2000","QCD_HT1000to1500","QCD_HT100to200","QCD_HT700to1000","QCD_HT200to300","QCD_HT500to700","QCD_HT300to500"}; 

//int FILLCOLOR[nfiles+1] = {1,1,kBlue+0,kCyan+2,kGreen+1,kSpring+8,kSpring+5,kOrange-2,kRed+2,kRed+1,kRed+0, kRed-7,kRed-9,kRed-6,kRed-8,kRed-10};
//int LINECOLOR[nfiles+1] = {1,1,kBlue+0,kCyan+2,kGreen+1,kSpring+8,kSpring+5,kOrange-2,kRed+2,kRed+1,kRed+0, kRed-7,kRed-9,kRed-6,kRed-8,kRed-10};
int FILLCOLOR[nfiles+1] = {1,1,kBlue+0,kCyan+2,kGreen+1,kSpring+8,kSpring+5,kOrange-2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2};
int LINECOLOR[nfiles+1] = {1,1,kBlue+0,kCyan+2,kGreen+1,kSpring+8,kSpring+5,kOrange-2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2,kRed+2};
int LINESTYLE[nfiles+1] = {1,1,2,8,1,1,1,1,1,1,1,1,1,1,1,1};
int LINEWIDTH[nfiles+1] = {1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1};
//int FILLSTYLE[nfiles] = {1001,3324,3001,3144,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001};
int FILLSTYLE[nfiles+1] = {1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001,1001};
	
//int order_legend[nfiles] = {0,1,6,8,10,9,7,5,4,3,2};
//int order[nfiles] = {0,1,2,3,14,13,12,11,10,9,4,8,5,7,6};
//int order_legend[nfiles] = {0,1,2,3,10,12,14,13,11,9,8,7,6,5,4};
int order[nfiles+1] = {0,1,2,3,14,15,13,12,11,10,9,4,8,5,7,6};
int order_legend[nfiles+1] = {0,1,2,3,11,13,15,14,12,10,9,8,7,6,4,5};
	

int set_type = atoi(argv[1]); //0 - double, 1 - single
TString btag[2] = {"v14, DoubleBtag","v14, SingleBtagBlike"}; 
int region_type=atoi(argv[2]); // 0 - analysis, 1 - control region , top
TString region[3]={"_analysis","_controlTop","_controlDY"}; // 0 - analysis, 1 - control region , top; 2 - control region DY

for (int i=0;i<nfiles;i++){
	if (set_type==1) file_names[i].Prepend("_single");
	file_names[i].Prepend(region[region_type]);
	file_names[i].Prepend("skimmed_tree");
	file_names[i].Prepend("../../output_hist/v14/");
//	file_names[i].Append("_v14_exclusive_blike_pu");
	file_names[i].Append("_v14_exclusive_pu_triggerWeight_single_vtype23");
	file_names[i].Append(".root");
}
TString trigger[2] = {"RatioDoubleBtag_", "trigWeightRatioSingleBtag_blike_"};
//TString dir_name= "plots_powheg_130/";
TString dir_name= "plots_powheg_125_exclusive";
dir_name.Append(region[region_type]+"/");
//TString dir_name = "plots_amc/";
Float_t lumi = 1280.23;

	


TLegend *leg = new TLegend(0.68,0.6,0.85,0.9);
//TLegend *leg = new TLegend(0.4,0.6,0.62,0.9);
leg->SetFillColor(0);
leg->SetBorderSize(0);
leg->SetTextSize(0.04);
TLegend *leg2 = new TLegend(0.68,0.6,0.85,0.9);
leg2->SetFillColor(0);
leg2->SetBorderSize(0);
leg2->SetTextSize(0.04);

const int nhistos = 71; //40//52
TString hist_names[nhistos]={"hJet1_pt","hJet2_pt","hJet3_pt","hJet4_pt","hJet1_eta","hJet2_eta","hJet3_eta","hJet4_eta","hJet1_phi","hJet2_phi","hJet3_phi","hJet4_phi","hMqq", "hEtaQQ", "hPhiBB","hMbb","hbtag","hbtag2","hcosOqqbb","hEtaQB1", "hEtaQB2", "hPhiQB1", "hPhiQB2","hx1","hx2","hVB1_mass","hVB2_mass","hEtot","hPxtot","hPytot","hPztot","hJet5_pt","hPtqqbb","hEtaqqbb","hPhiqqbb","hJet1_pt_bin","hJet2_pt_bin","hJet3_pt_bin","hJet4_pt_bin", "hMqq_bin","hEtaSoftJets", "hPtSoftJets","hMassSoftJets","hHTsoft","hSoft_n2","hSoft_n5","hSoft_n10","hqgl","hqgl2", "hPtSoftJets2","hPtSoftJets3","hPVs", "hJet1q_pt", "hJet1q_eta", "hJet1q_ptd", "hJet1q_axis2", "hJet1q_mult", "hJet2q_pt", "hJet2q_eta", "hJet2q_ptd", "hJet2q_axis2", "hJet2q_mult","hMbb_regVBF","hMbb_regVBF_fsr","hblike1","hblike2", "hmet",  "hselLeptons_tightId" , "hselLeptons_relIso03" , "hselLeptons_chargedHadRelIso03", "hselLeptons_pfRelIso03"};
TString hist_names_sum[nhistos]={};
TString sum_histos_names[nhistos]={};
std::string hist_names_sort[nhistos];
for (int i=0;i<nhistos;i++){
	hist_names_sort[i] = hist_names[i];
	hist_names_sum[i] = hist_names[i];
	hist_names_sum[i].Append("_sum");
	sum_histos_names[i] = hist_names[i];
	sum_histos_names[i].Append("_sum0");
}
Float_t discriminators[nhistos];
TString stacks_names[nhistos];
for (int i=0;i<nhistos;i++){
	stacks_names[i] = hist_names[i];
	stacks_names[i].Prepend("s");
}
TString output_names[nhistos];
for (int i=0;i<nhistos;i++){
	output_names[i] = hist_names[i];
	output_names[i].Prepend(dir_name);
	output_names[i].Prepend(trigger[set_type]);
	output_names[i].Append(region[region_type]);
	output_names[i].Append(".png");
}

TH1F *data_histos[nhistos];
TH1F *data_histos2[nhistos];
TH1F *signal_histos[nhistos];
TH1F *signal_histos2[nhistos];
TH1F *tthbb_histos[nhistos];
TH1F *tthnbb_histos[nhistos];
TH1F *sum_histos[nhistos];
TH1F *histos_forUnc[nhistos];
TH1F *histos_for_legened[nhistos];
TH1F *discr_histos[nhistos];//Mqq,delta eta, delta phi, qgl, btag //12,13,14,21,22
TH1F *hBkgVis[nhistos];
TH1F *hBkgUncUp[nhistos];
TH1F *hBkgUncLo[nhistos];


int files=0; 
THStack *stacks[nhistos];
for (int i=0;i<nhistos;++i){
	stacks[i] = new THStack(stacks_names[i],"");
}
Double_t totalBG=0.;
Double_t totalQCD=0.;
Double_t totalMC=0.;
Double_t totalData=0.;
Double_t totalDataQCD=0.;
ofstream out_efficiency;
ofstream out_discrimination;
out_efficiency.open(trigger[set_type]+dir_name+"efficiency.txt"); 


Float_t MC_data[2] = {1.,1.};////////////for efficiency 
//Float_t MC_data[2] = {1./0.708,1./.9};////////////TO BE CHANGED
//Float_t MC_data[2] = {1./0.704,1./.899};////////////for trigger logic
//Float_t MC_data[2] = {1./0.703,1./.964};////////////for blike single btag logic
Float_t lumi_qcd=lumi/MC_data[set_type];
do{
	
   TFile *file_initial = new TFile(file_names[files]);
//	file_initial->ls();   
	TH1F *histos[100];
	for (int hist=0;hist<nhistos;++hist){
		if (region_type==2) ((TH1F*)file_initial->Get(hist_names[hist]))->Rebin(2);
		histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone("h");
		if (files==0) data_histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone("data");
		if ((files>0)&&(files<7))histos[hist]->Scale(lumi);
		if (files>=7)histos[hist]->Scale(lumi_qcd);
		
		if (files==1) 	sum_histos[hist] = (TH1F*)histos[hist]->Clone(sum_histos_names[hist]);
		if (files>1)	sum_histos[hist]->Add(histos[hist]); 

		if (files>0) histos[hist]->Sumw2(kFALSE);
		if (hist==4) cout<<files<<"   "<<histos[4]->Integral() <<endl;

		if (files==1) {
			signal_histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone(hist_names_sum[hist]+"newhist");
			signal_histos[hist]->Scale(lumi);
			signal_histos[hist]->Sumw2(kFALSE);
			signal_histos[hist]->SetLineColor(LINECOLOR[files]);
			signal_histos[hist]->SetLineStyle(LINESTYLE[files]);
			signal_histos2[hist]=(TH1F*)signal_histos[hist]->Clone("signalHist2");
		}
		if (files==2) {
			tthbb_histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone(hist_names_sum[hist]+"tthb");
			tthbb_histos[hist]->Scale(lumi);
			tthbb_histos[hist]->Sumw2(kFALSE);
			tthbb_histos[hist]->SetLineColor(LINECOLOR[files]);
			tthbb_histos[hist]->SetLineStyle(LINESTYLE[files]);
		}
		if (files==3) {
			tthnbb_histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone(hist_names_sum[hist]+"tthnb");
			tthnbb_histos[hist]->Scale(lumi);
			tthnbb_histos[hist]->Sumw2(kFALSE);
			tthnbb_histos[hist]->SetLineColor(LINECOLOR[files]);
			tthnbb_histos[hist]->SetLineStyle(LINESTYLE[files]);
		}
		histos[hist]->SetLineColor(LINECOLOR[files]);
		histos[hist]->SetLineStyle(LINESTYLE[files]);
		histos[hist]->SetLineWidth(LINEWIDTH[files]);
		histos[hist]->SetFillStyle(FILLSTYLE[files]);
		if ((files!=0)) histos[hist]->SetFillColor(FILLCOLOR[files]);
		
		if (files==0) {
			histos[hist]->SetMarkerStyle(20);
			data_histos[hist]->SetLineColor(1);
			data_histos[hist]->SetMarkerStyle(20);
			data_histos[hist]->SetMarkerSize(.8);
		}
	 	if (files>=4) stacks[hist]->Add(histos[hist]);
		if (hist==0) histos_for_legened[files] = (TH1F*)histos[0]->Clone("newd");
		if (files==4)	discr_histos[hist] = (TH1F*)file_initial->Get(hist_names[hist])->Clone("discr");
		if (files>4)	discr_histos[hist]->Add(histos[hist]); 
   	}
	if (files>3) totalBG+=histos[4]->Integral();
	if (files>6) totalQCD+=histos[4]->Integral();
	if (files>0) totalMC+=histos[4]->Integral();
	if (files==0) {totalData+=histos[4]->Integral(); totalDataQCD+=histos[4]->Integral();}
	if ((files>0)&&(files<7)) {totalDataQCD-=histos[4]->Integral();}
	if (files==0) out_efficiency<<"Sample & \t\t\t yield(per "<< lumi<<" $pb^{-1}$)"<<endl;
	if (files==0) out_efficiency<<leg_names[order[files]]<<"&\t \t \t"<< std::setprecision(5)<<histos[4]->Integral() <<endl;
	else out_efficiency<<leg_names[order[files]]<<"&\t\t\t  "<<std::setprecision(5)<<histos[4]->Integral()<<endl;
	if (files==nfiles-1) out_efficiency<<"Total BG"<<"&\t \t \t  "<<std::setprecision(5)<<totalBG<<endl;
	if (files==nfiles-1) out_efficiency<<"Total MC"<<"&\t \t \t  "<<std::setprecision(5)<<totalMC<<endl;
	if (files==nfiles-1) out_efficiency<<"Data/MC"<<"&\t \t \t  "<<std::setprecision(3)<<totalData/totalMC<<endl;
	if (files==nfiles-1) out_efficiency<<"DataQCD/QCD"<<"&\t \t \t  "<<std::setprecision(3)<<totalDataQCD/totalQCD<<endl;
files++;
}while (files<nfiles);
out_efficiency.close();

for (int hist=0;hist<nhistos;hist++){
	hBkgUncUp[hist] = (TH1F*)sum_histos[hist]->Clone("hBkgUncUp");
	hBkgUncLo[hist] = (TH1F*)sum_histos[hist]->Clone("hBkgUncLo");
  	hBkgVis[hist]   = (TH1F*)sum_histos[hist]->Clone("hbkgVis");
  	for(int i=0;i<hBkgUncUp[hist]->GetNbinsX();i++) {
  	 float e = 0.0;
    if (sum_histos[hist]->GetBinContent(i+1) != 0) {
      e = sum_histos[hist]->GetBinError(i+1)/sum_histos[hist]->GetBinContent(i+1);
    }
    hBkgUncUp[hist]->SetBinContent(i+1,e);
    hBkgUncLo[hist]->SetBinContent(i+1,-e);
	}
  	 hBkgVis[hist]->SetMarkerSize(0);
 	 hBkgVis[hist]->SetFillColor(kBlack);
 	 hBkgVis[hist]->SetFillStyle(3004);
 	 hBkgUncUp[hist]->SetLineColor(kBlack);
 	 hBkgUncUp[hist]->SetLineWidth(1);
 	 hBkgUncUp[hist]->SetFillColor(kBlack);
 	 hBkgUncUp[hist]->SetFillStyle(3004);
	 hBkgUncLo[hist]->SetLineColor(kBlack);
 	 hBkgUncLo[hist]->SetLineWidth(1);
  	 hBkgUncLo[hist]->SetFillColor(kBlack);
	 hBkgUncLo[hist]->SetFillStyle(3004);
}




//Float_t TSF[2] = {0.452433,0.525697};
Float_t TSF[2] = {1.,1.};
Float_t kfactors[2] = {0.,0.};
kfactors[set_type] = 1./(MC_data[set_type] * TSF[set_type]);
cout<<"kfactor = "<<kfactors[set_type]<<endl;
cout<<"Data/MC = "<< MC_data[set_type]<<endl;
//lumi/=kfactors[set_type];



for (int i=0;i<nfiles;i++){
	if (i==0) leg->AddEntry(histos_for_legened[order_legend[i]],leg_names[i],"P");
	if (i>11) {
//	else if ((i==1)||(i==2)||(i==3))  leg->AddEntry(histos_for_legened[order_legend[i]],leg_names[i],"L");
		leg->AddEntry(histos_for_legened[order_legend[i]],leg_names[i],"F");
	}
}
	leg->AddEntry(histos_for_legened[order_legend[4]],leg_names[4],"F");
	leg->AddEntry(hBkgUncUp[0],"MC stat. unc.","F");
for (int i=0;i<nfiles;i++){
	if ((i>=4) && (i<=11)) {
	leg2->AddEntry(histos_for_legened[order_legend[i]],leg_names[i],"F");
	}
}



for (int d=0;d<nhistos;d++){
	discriminators[d] = Discr(discr_histos[d],signal_histos2[d]);
}

bubblesort(discriminators, hist_names_sort,nhistos);

out_discrimination.open(trigger[set_type]+dir_name+"discrimination.txt");
for (int d=0;d<nhistos;d++){
	if (d==0) out_discrimination<<"Variable &\t d"<<endl;
	out_discrimination<<"$"<<hist_names_sort[d]<<"$"<<" & \t "<< std::setprecision(2)<< discriminators[d]<<endl;
}
out_discrimination.close();
		TLatex* tex = new TLatex(0.95,0.95,"13 TeV, bx = 25 ns, 1280.23 pb^{-1}");
      tex->SetNDC();
		tex->SetTextAlign(35);
      tex->SetTextFont(42);
      tex->SetTextSize(0.05);
      tex->SetLineWidth(2);
      TLatex *tex1 = new TLatex(0.2,0.84,"CMS");
      tex1->SetNDC();
      tex1->SetTextAlign(20);
      tex1->SetTextFont(61);
      tex1->SetTextSize(0.07);
      tex1->SetLineWidth(2);
      TLatex* tex2 = new TLatex(0.27,0.76,"Work in progress");
      tex2->SetNDC();
      tex2->SetTextAlign(20);
      tex2->SetTextFont(52);
      tex2->SetTextSize(0.045);
    	tex2->SetLineWidth(2);
//		TLatex* tex_file = new TLatex(0.3,0.95,"v13, DoubleBtag");
		TLatex* tex_file;
		if (set_type==0) tex_file = new TLatex(0.32,0.95, btag[set_type]);
		if (set_type==1) tex_file = new TLatex(0.38,0.95, btag[set_type]);
      tex_file->SetNDC();
		tex_file->SetTextAlign(35);
      tex_file->SetTextFont(42);
      tex_file->SetTextSize(0.05);
      tex_file->SetLineWidth(2);	
		TString temp_str;
		temp_str.Form("%2.2f",kfactors[set_type]);
//		temp_str.Form("%2.2f",(1./MC_data[set_type]));
		TString k_factor_str = temp_str.Prepend("QCD MC #times  ");
		TLatex* tex_k = new TLatex(0.35,0.68,k_factor_str);
      tex_k->SetNDC();
		tex_k->SetTextAlign(35);
      tex_k->SetTextFont(42);
      tex_k->SetTextSize(0.05);
      tex_k->SetLineWidth(2);
	for (int i=0;i<nhistos;i++){
		temp_str.Form("%2.2f",Discr(discr_histos[i],signal_histos2[i]));
		TString disc_value = temp_str.Prepend(" d = ");
		TLatex *disc_value_text = new TLatex(0.92,0.903,disc_value);
      disc_value_text->SetNDC();
     	disc_value_text->SetTextAlign(35);
      disc_value_text->SetTextFont(42);
      disc_value_text->SetTextSize(0.04);
      disc_value_text->SetLineWidth(2);
		
		TCanvas *c1 = new TCanvas();
		c1->SetBottomMargin(.1);
		c1->cd();
	//	if ((i!=51)&&(i<=65)/*||(i!=15)||(i!=63)||(i!=62)*/) c1->SetLogy();
 		TPad *pad1 = new TPad("pad1","pad1", 0, 0.3, 1, 1.0);
   	pad1->SetBottomMargin(0); // Upper and lower plot are joined
  	//	if ((i!=51)&&(i<=65)/*&&(i!=15)&&(i!=63)&&(i!=62)*/) pad1->SetLogy();
    	pad1->SetBottomMargin(.03);
		pad1->SetTopMargin(0.06);
		pad1->SetTicks(1,1);
    	pad1->Draw();             // Draw the upper pad: pad1
   	pad1->cd();

		Double_t xmin = signal_histos[i]->GetBinCenter(0);
		Double_t xmax = signal_histos[i]->GetBinCenter(signal_histos[i]->GetNbinsX())*1.02;
//		if (i==70) {xmin=-2.;xmax=0.5;}
//		if (i==68) {xmin=0.;xmax=0.6;}
		if (i==66) {xmin=0.;xmax=400;}
		TH1F *frame = new TH1F("frame","",1,xmin,xmax);
		frame->SetMinimum(1e-4);
      frame->SetMaximum(1e18);
	//	if ((i==51)||(i>65)/*||(i==15)||(i==63)||(i==62)*/) {
			frame->SetMinimum(0.);
      	frame->SetMaximum((hBkgVis[i]->GetMaximum())*1.7);
		//	if (set_type==1)  frame->SetMaximum((hBkgVis[i]->GetMaximum())*1.7);
	//	}
		if ((i>67)/*||(i==15)||(i==63)||(i==62)*/) {
      	frame->SetMaximum(data_histos[i]->GetBinContent(9)*5);
			if (set_type==1)  frame->SetMaximum(hBkgVis[i]->GetBinContent(9)*5);
		}
      frame->GetYaxis()->SetTitleOffset(0.9);
      frame->GetXaxis()->SetTitleOffset(0.91);
      frame->SetStats(0);
		frame->GetXaxis()->SetNdivisions(0);
      frame->SetTitleFont(42,"x");
		frame->SetTitleFont(42,"y");
      frame->SetTitleSize(0.06, "XYZ");
	//	frame->SetXTitle(signal_histos[i]->GetXaxis()->GetTitle());

      if ((i<4))frame->SetYTitle("Events  /  20 GeV");else
      if (i==37)frame->SetYTitle("Events  /  20 GeV");else
      if (i==41)frame->SetYTitle("Events  /  20 GeV");else
		if ((i>=4) && (i<8)) frame->SetYTitle("Events  /  0.5");else
		if (i==15) frame->SetYTitle("Events  /  5 GeV");else
		if ((i>=8) && (i<12)) frame->SetYTitle("Events  /  0.2");else
		if (i==40) frame->SetYTitle("Events / 100 GeV");else
		if ((i==10)||(i==12)||(i==16)||(i==17)||(i==18) || (i==20) || (i==25) || (i==26) || (i==27) || (i==35) || (i==36) ||(i==38) || (i==39)) frame->SetYTitle("Events / 10 GeV"); else
		if ((i==13)||(i==14)) frame->SetYTitle("Events / 0.1"); else
		if ((i==21)||(i==22)) frame->SetYTitle("Events / 0.05"); else
		if ((i==23)||(i==24)) frame->SetYTitle("Events / 0.01"); else
		if (i==28) frame->SetYTitle("Events / 0.02"); else
		if ((i==29) || (i==30) || (i==31) || (i==32) )frame->SetYTitle("Events / 0.1");else
		if ((i==33) || (i==33))frame->SetYTitle("Events / 0.01");
		else frame->SetYTitle("Events");
      frame->Draw();
		//tex_k->Draw();
	//	stacks[i]->Scale(TSF[set_type]);
	//	stacks[i]->Scale(kfactors[set_type]);	
	//	leg2->Draw("same");
    	stacks[i]->Draw("same");	
		tex->Draw();
		tex1->Draw();
		tex2->Draw();
		tex_file->Draw();
		leg->Draw("same");
//		signal_histos[i]->Draw("same");
//		tthbb_histos[i]->Draw("same");
	//	tthnbb_histos[i]->Draw("same");
/////////////////cross check of stupid THStack//////
//
//		sum_histos[i]->SetLineColor(kCyan);
//		sum_histos[i]->Scale(lumi);
//		sum_histos[i]->Draw("Lsame");
//
///////////////////////////////////////////////////
	//	data_histos[i]->Scale(1./TSF[set_type]);
	//	data_histos[i]->Scale(1./kfactors[set_type]);	
		data_histos[i]->Draw("Psame");
		hBkgVis[i]->Draw("same E2");
		//disc_value_text->Draw();
	
		c1->cd();          // Go back to the main canvas before defining pad2
   	TPad *pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3);
    	pad2->SetTopMargin(.13);
    	pad2->SetBottomMargin(.4);
    	pad2->Draw();
    	pad2->cd();

		TH1F *frame2 = new TH1F("frame2","",1,xmin,xmax);
		frame2->SetMinimum(-.5);
      frame2->SetMaximum(.5);
      frame2->GetYaxis()->SetTitleOffset(0.4);
      frame2->GetXaxis()->SetTitleOffset(1.3);
      frame2->SetStats(0);
      frame2->SetTitleFont(42,"x");
		frame2->SetTitleFont(42,"y");
      frame2->SetTitleSize(0.13, "XYZ");
		frame2->GetYaxis()->SetNdivisions(505);
  		frame2->GetYaxis()->SetLabelSize(.09);
    	frame2->GetXaxis()->SetLabelSize(.12);	
		frame2->SetXTitle(signal_histos[i]->GetXaxis()->GetTitle());
		frame2->SetYTitle("Data / MC - 1");
		frame2->Draw();	

 		Float_t aa[2] = {xmin,xmax};
   	Float_t bb[2] = {0,0};
   	TGraph *cons = new TGraph(2,aa,bb);
    	cons->SetLineStyle(2);
		cons->Draw("Lsame");

		data_histos2[i] = (TH1F*)data_histos[i]->Clone("new");
	//	sum_histos[i]->Scale(TSF[set_type]);
	//	sum_histos[i]->Scale(kfactors[set_type]);	
		data_histos2[i]->Add(sum_histos[i],-1);
		data_histos2[i]->Divide(sum_histos[i]);
		data_histos2[i]->Draw("PEsame");
		hBkgUncUp[i]->Draw("HIST same");
		hBkgUncLo[i]->Draw("HIST same");
		pad1->RedrawAxis();
		pad2->RedrawAxis();
		c1->Print(output_names[i]);
		c1->Delete();
	}



return 0;
}
void showGraphs(double canvasSizeX, double canvasSizeY,
		const std::vector<std::string>& entriesToPlot,
		std::map<std::string, TGraph*>& graphs,
		std::map<std::string, std::string>& legendEntries,
		int colors[], int lineWidths[], int lineStyles[],
		double legendTextSize, double legendPosX, double legendPosY, double legendSizeX, double legendSizeY, 
		double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
		double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
		const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);
  
  canvas->SetLeftMargin(0.14);
  canvas->SetBottomMargin(0.12);

  TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", 100, xMin, xMax);
  dummyHistogram->SetTitle("");
  dummyHistogram->SetStats(false);
  dummyHistogram->SetMinimum(yMin);
  dummyHistogram->SetMaximum(yMax);

  TAxis* xAxis = dummyHistogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleSize(0.045);
  xAxis->SetTitleOffset(xAxisOffset);

  TAxis* yAxis = dummyHistogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleSize(0.045);
  yAxis->SetTitleOffset(yAxisOffset);

  dummyHistogram->Draw("axis");

  TLegend* legend = new TLegend(legendPosX, legendPosY, legendPosX + legendSizeX, legendPosY + legendSizeY, "", "brNDC"); 
  legend->SetBorderSize(0);
  legend->SetFillColor(0);
  legend->SetTextSize(legendTextSize);

  size_t numEntriesToPlot = entriesToPlot.size();
  for ( size_t iEntryToPlot = 0; iEntryToPlot < numEntriesToPlot; ++iEntryToPlot ) {
    const std::string& entryToPlot = entriesToPlot[iEntryToPlot];
    TGraph* graph = graphs[entryToPlot];
    assert(graph);
    graph->SetLineColor(colors[iEntryToPlot]);
    graph->SetLineWidth(lineWidths[iEntryToPlot]);
    graph->SetLineStyle(lineStyles[iEntryToPlot]);
    graph->SetMarkerColor(colors[iEntryToPlot]);
    graph->Draw("L");

    legend->AddEntry(graph, legendEntries[entryToPlot].data(), "l");
  }

  legend->Draw();

  canvas->Update();
  std::string outputFileName_plot = "plots/";
  size_t idx = outputFileName.find_last_of('.');
  outputFileName_plot.append(std::string(outputFileName, 0, idx));
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  
  delete dummyHistogram;
  delete legend;
  delete canvas;  
}
TCanvas* plotLinearityMAT_ERUpgrade(double eta, double etmin /* GeV */, double etmax /* GeV */, int ptype, 
				 string year, string esmodel,
				 bool debug=false, bool logx=false, bool subtractAverage=false,
				 TGraph* overlay=0 ) {

  double GeV = 1000;

   gROOT->ProcessLine(".L EnergyRescalerUpgrade.cxx");
  
   egRescaler::EnergyRescalerUpgrade ers;

   ers.Init("../share/EnergyRescalerData.root",year,esmodel);

   ers.SetDebugFlag( debug );

   ers.includePresamplerContribution( false );
   ers.includeLeakageContribution( false );

   double eMin = etmin * cosh(eta) * GeV;
   double eMax = etmax * cosh(eta) * GeV;

   int nStep = 100;
   double eStep;
   if( logx )
     eStep = (log(eMax)-log(eMin))/(double)nStep;
   else
     eStep = (eMax-eMin)/(double)nStep;
   double e = eMin;

   TGraphErrors* gZee = new TGraphErrors();  // Z scale
   TGraph* gNom = new TGraph();        // nominal scale correction
   TGraph* gZeeAllUp = new TGraph();   // Zee scale uncertainty, Up
   TGraph* gZeeAllDown = new TGraph(); //                      , Down
   TGraph* gZeeUp = new TGraph();      // Zee scale uncertainty, Up
   TGraph* gZeeDown = new TGraph();    //                      , Down
   TGraph* gZeeGenUp = new TGraph();   // Zee scale uncertainty, Up
   TGraph* gZeeGenDown = new TGraph(); //                      , Down
   TGraph* gMATUp = new TGraph();      //       MAT uncertainty, Up
   TGraph* gMATDown = new TGraph();    //                      , Down
   TGraph* gPSUp = new TGraph();       //        ps uncertainty, Up
   TGraph* gPSDown = new TGraph();     //                      , Down
   TGraph* gLowUp = new TGraph();      //    low-pt uncertainty, Up
   TGraph* gLowDown = new TGraph();    //                      , Down

   int i=0;

   while( e<=eMax ) {

     double alpha          = ers.getAlphaZee(eta, egRescaler::EnergyRescalerUpgrade::Nominal);
     double alphaUp        = ers.getAlphaZee(eta, egRescaler::EnergyRescalerUpgrade::ZeeStatUp);

     double eNominal       = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::Nominal);

     double eVarZeeAllUp   = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeAllUp);
     double eVarZeeAllDown = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeAllDown);

     double eVarZeeUp      = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeMethodUp);
     double eVarZeeDown    = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeMethodDown);

     double eVarGenUp      = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeGenUp);
     double eVarGenDown    = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::ZeeGenDown);

     double eVarMATUp      = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::R12StatUp);
     double eVarMATDown    = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::R12StatDown);

     double eVarPSUp       = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::PSStatUp);
     double eVarPSDown     = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::PSStatDown);

     double eVarLowUp      = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::LowPtUp);
     double eVarLowDown    = ers.applyEnergyCorrection(eta, e, ptype, egRescaler::EnergyRescalerUpgrade::LowPtDown);

     if(i==0) {
       gZee->SetPointError(i,0,alphaUp-alpha);
       if( !subtractAverage )
	 gZee->SetPoint(i,40.*cosh(eta),alpha);
       else
	 gZee->SetPoint(i,40.*cosh(eta),0);
     }
     
     if( !subtractAverage ) {
       
       gNom->SetPoint(i, e/GeV, (e-eNominal)/eNominal); 
       
       gZeeAllUp->SetPoint(i, e/GeV, (e-eVarZeeAllUp)/eVarZeeAllUp); 
       gZeeAllDown->SetPoint(i, e/GeV, (e-eVarZeeAllDown)/eVarZeeAllDown); 
       
       gZeeUp->SetPoint(i, e/GeV, (e-eVarZeeUp)/eVarZeeUp); 
       gZeeDown->SetPoint(i, e/GeV, (e-eVarZeeDown)/eVarZeeDown); 
       
       gZeeGenUp->SetPoint(i, e/GeV, (e-eVarGenUp)/eVarGenUp); 
       gZeeGenDown->SetPoint(i, e/GeV, (e-eVarGenDown)/eVarGenDown); 
       
       gMATUp->SetPoint(i, e/GeV, (e-eVarMATUp)/eVarMATUp); 
       gMATDown->SetPoint(i, e/GeV, (e-eVarMATDown)/eVarMATDown); 
       
       gPSUp->SetPoint(i, e/GeV, (e-eVarPSUp)/eVarPSUp); 
       gPSDown->SetPoint(i, e/GeV, (e-eVarPSDown)/eVarPSDown); 
       
       gLowUp->SetPoint(i, e/GeV, (e-eVarLowUp)/eVarLowUp); 
       gLowDown->SetPoint(i, e/GeV, (e-eVarLowDown)/eVarLowDown); 
       
     } else {
       
       gNom->SetPoint(i, e/GeV, (e-eNominal)/eNominal - alpha); 
     
       gZeeAllUp->SetPoint(i, e/GeV, (e-eVarZeeAllUp)/eVarZeeAllUp - alpha); 
       gZeeAllDown->SetPoint(i, e/GeV, (e-eVarZeeAllDown)/eVarZeeAllDown - alpha); 
       
       gZeeUp->SetPoint(i, e/GeV, (e-eVarZeeUp)/eVarZeeUp - alpha); 
       gZeeDown->SetPoint(i, e/GeV, (e-eVarZeeDown)/eVarZeeDown - alpha); 
       
       gZeeGenUp->SetPoint(i, e/GeV, (e-eVarGenUp)/eVarGenUp - alpha); 
       gZeeGenDown->SetPoint(i, e/GeV, (e-eVarGenDown)/eVarGenDown - alpha); 
       
       gMATUp->SetPoint(i, e/GeV, (e-eVarMATUp)/eVarMATUp - alpha); 
       gMATDown->SetPoint(i, e/GeV, (e-eVarMATDown)/eVarMATDown - alpha); 
       
       gPSUp->SetPoint(i, e/GeV, (e-eVarPSUp)/eVarPSUp - alpha); 
       gPSDown->SetPoint(i, e/GeV, (e-eVarPSDown)/eVarPSDown - alpha); 
       
       gLowUp->SetPoint(i, e/GeV, (e-eVarLowUp)/eVarLowUp - alpha); 
       gLowDown->SetPoint(i, e/GeV, (e-eVarLowDown)/eVarLowDown - alpha); 
       
     }

     i++;

     if( logx )
       e *= exp(eStep);
     else
       e += eStep;

   }
 
   TCanvas* canvas = new TCanvas();
   if( logx )
     canvas->SetLogx();

   if( !subtractAverage ) {
     gMATUp->SetMaximum(alpha+.005);
     gMATUp->SetMinimum(alpha+-.007);
   } else {
     gMATUp->SetMaximum(.005);
     gMATUp->SetMinimum(-.007);
   }

   char grafname[99];
   if( ptype==0 )
     sprintf(grafname,"ES  Linearity (%s), #eta = %4.2f, Electrons", year.c_str(), eta);
   else if( ptype==1 )
     sprintf(grafname,"ES  Linearity (%s), #eta = %4.2f, Unconverted photons", year.c_str(), eta);
   else if( ptype==2 )
     sprintf(grafname,"ES  Linearity (%s), #eta = %4.2f, Converted photons", year.c_str(), eta);
   gMATUp->SetTitle(grafname);
   
   gMATUp->GetXaxis()->SetTitleOffset(1.2*gNom->GetXaxis()->GetTitleOffset());
   gMATUp->GetYaxis()->SetTitleOffset(1.2*gNom->GetYaxis()->GetTitleOffset());
   gMATUp->GetXaxis()->SetTitle("E [GeV]");
   gMATUp->GetYaxis()->SetTitle("#alpha(E)");
   gMATUp->SetLineWidth(2);
   gMATUp->SetLineStyle(2);
   gMATUp->SetLineColor(4);
   gMATUp->Draw("AL");

   gMATDown->SetLineWidth(2);
   gMATDown->SetLineStyle(3);
   gMATDown->SetLineColor(4);
   gMATDown->Draw("L");

   gNom->SetLineWidth(2);
   gNom->SetLineColor(4);
   gNom->Draw("L");

   gZee->SetMarkerStyle(20);
   gZee->Draw("P");

   TLegend* leg1 = new TLegend(.7,.15,.89,.3);
   leg1->SetBorderSize(0);
   leg1->SetFillColor(0);
   leg1->AddEntry(gZee,"#alpha, Z peak", "p");
   leg1->AddEntry(gNom,"PS, central", "l");
   leg1->AddEntry(gMATUp,"PS, up", "l");
   leg1->AddEntry(gMATDown,"PS, down", "l");

   leg1->Draw("same");

   // char plotname[99];
   // sprintf(plotname,"linearity_%d_%2.1f.png",ptype,eta);
   //   canvas->Print("overlay.ps");
  
   return canvas;
}
Exemplo n.º 9
0
void Polarization(){

    TGraph *gObs;
    TGraph *gExp;
    TGraph *gObsL;
    TGraph *gExpL;
    TGraph *gObsR;
    TGraph *gExpR;
    
    TFile *fc = TFile::Open("Limits2DHistograms_T2tt_postfit.root");
    TFile *fl = TFile::Open("Limits2DHistograms_T2tt_lefthanded_postfit.root");
    TFile *fr = TFile::Open("Limits2DHistograms_T2tt_righthanded_postfit.root");
    
    TGraph *g;
    fc->cd();
    g = (TGraph*)fc->Get("gObs");
    gObs = (TGraph*)g->Clone("Obs");
    g = (TGraph*)fc->Get("gExp");
    gExp = (TGraph*)g->Clone("Exp");
    fl->cd();
    g = (TGraph*)fl->Get("gObs_2");
    gObsL = (TGraph*)g->Clone("ObsL");
    g = (TGraph*)fl->Get("gExp_2");
    gExpL = (TGraph*)g->Clone("ExpL");
    fr->cd();
    g = (TGraph*)fr->Get("gObs");
    gObsR = (TGraph*)g->Clone("ObsR");
    g = (TGraph*)fr->Get("gExp");
    gExpR = (TGraph*)g->Clone("ExpR");
    
    gObs->SetLineWidth(4);
    gExp->SetLineWidth(4);
    gObsL->SetLineWidth(2);
    gExpL->SetLineWidth(2);
    gObsR->SetLineWidth(2);
    gExpR->SetLineWidth(2);
    gObs->SetLineStyle(1);
    gExp->SetLineStyle(7);
    gObsL->SetLineStyle(1);
    gExpL->SetLineStyle(7);
    gObsR->SetLineStyle(1);
    gExpR->SetLineStyle(7);
    gObs->SetLineColor(kBlack);
    gExp->SetLineColor(kBlack);
    gObsL->SetLineColor(kBlue);
    gExpL->SetLineColor(kBlue);
    gObsR->SetLineColor(kRed);
    gExpR->SetLineColor(kRed);
    if(killlowdiag){
    for( int i = gObs->GetN()-1; i>=0;--i){
        double x,y;
        gObs->GetPoint(i,x,y);
        if(x-y<172.5) gObs->RemovePoint(i);
    }
    for( int i = gExp->GetN()-1; i>=0;--i){
        double x,y;
        gExp->GetPoint(i,x,y);
        if(x-y<172.5) gExp->RemovePoint(i);
    }
    }
    for( int i = gObsL->GetN()-1; i>=0;--i){
        double x,y;
        gObsL->GetPoint(i,x,y);
        if(x-y<172.5) gObsL->RemovePoint(i);
    }
    for( int i = gObsR->GetN()-1; i>=0;--i){
        double x,y;
        gObsR->GetPoint(i,x,y);
        if(x-y<172.5) gObsR->RemovePoint(i);
    }
    for( int i = gExpL->GetN()-1; i>=0;--i){
        double x,y;
        gExpL->GetPoint(i,x,y);
        if(x-y<172.5) gExpL->RemovePoint(i);
    }
    for( int i = gExpR->GetN()-1; i>=0;--i){
        double x,y;
        gExpR->GetPoint(i,x,y);
        if(x-y<172.5) gExpR->RemovePoint(i);
    }

    
   TCanvas *c1 = new TCanvas("c1", "c1",50,50,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetErrorX(0.5); 
   //c1->Range(-6.311689,-1.891383,28.75325,4.56342);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   //c1->SetLogy();
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.15);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   gStyle->SetHatchesLineWidth(0);

   TH1F *hSum = new TH1F("hSum","",10,150,950);
   hSum->SetMinimum(0.);
   hSum->SetMaximum(550);
   hSum->SetDirectory(0);
   hSum->SetStats(0);
    hSum->Draw();
    hSum->GetYaxis()->SetRangeUser(0,500);
    hSum->GetXaxis()->SetRangeUser(150,950);

   Int_t ci;   // for color index setting
   ci = TColor::GetColor("#000099");
   hSum->SetLineColor(ci);
   hSum->SetLineStyle(0);
   hSum->SetMarkerStyle(20);
   hSum->GetXaxis()->SetTitle("m_{#tilde{t}} [GeV]");
   //hSum->GetXaxis()->SetBit(TAxis::kLabelsVert);
   hSum->GetXaxis()->SetLabelFont(42);
   //hSum->GetXaxis()->SetLabelOffset(0.005);
   hSum->GetXaxis()->SetLabelSize(0.035);
   hSum->GetXaxis()->SetTitleSize(0.06);
   hSum->GetXaxis()->SetTitleOffset(1.2);
   hSum->GetXaxis()->SetTitleFont(42);
   hSum->GetYaxis()->SetTitle("m_{#tilde{#chi}}_{1}^{0} [GeV]");
   hSum->GetYaxis()->SetLabelFont(42);
   //hSum->GetYaxis()->SetLabelOffset(0.007);
   hSum->GetYaxis()->SetLabelSize(0.035);
   hSum->GetYaxis()->SetTitleSize(0.05);
   hSum->GetYaxis()->SetTitleOffset(1.3);
   hSum->GetYaxis()->SetTitleFont(42);
    
    //TLegend *leg = new TLegend(0.4992416,0.4811189,0.898906,0.7503497,NULL,"brNDC");
    //TLegend *leg = new TLegend(0.4992416,0.4811189,0.698906,0.7503497,NULL,"brNDC");
    //TLegend *leg = new TLegend(0.6992416,0.2811189,0.898906,0.4503497,NULL,"brNDC");
    //TLegend *leg = new TLegend(0.6992416,0.3311189,0.898906,0.7903497,NULL,"brNDC");
    //TLegend *leg = new TLegend(0.7582416,0.4211189,0.912,0.8043497,NULL,"brNDC");
    TLegend *legE = new TLegend(0.51,0.675,0.81,0.855,NULL,"brNDC");
    //leg-> SetNColumns(2);
    legE->SetBorderSize(0);
    legE->SetTextSize(0.04);
    legE->SetTextFont(42);
    legE->SetLineColor(1);
    legE->SetLineStyle(1);
    legE->SetLineWidth(2);
    legE->SetFillColor(0);
    legE->SetFillStyle(1001);
    legE->SetHeader("Expected");
    legE->AddEntry(gExp, "unpolarized","l");
    legE->AddEntry(gExpR, "right-handed","l");
    legE->AddEntry(gExpL, "left-handed","l");
    
    TLegend *legO = new TLegend(0.175,0.675,0.50,0.855,NULL,"brNDC");
    //legO-> SetNColumns(2);
    legO->SetBorderSize(0);
    legO->SetTextSize(0.04);
    legO->SetTextFont(42);
    legO->SetLineColor(1);
    legO->SetLineStyle(1);
    legO->SetLineWidth(2);
    legO->SetFillColor(0);
    legO->SetFillStyle(1001);
    legO->SetHeader("Observed");
    legO->AddEntry(gObs, "unpolarized","l");
    legO->AddEntry(gObsR, "right-handed","l");
    legO->AddEntry(gObsL, "left-handed","l");
    
    
    TGraph* graphWhite = new TGraph(5);
    graphWhite->SetName("white");
    graphWhite->SetTitle("white");
    graphWhite->SetFillColor(kWhite);
    graphWhite->SetFillStyle(1001);
    graphWhite->SetLineColor(kBlack);
    graphWhite->SetLineStyle(1);
    graphWhite->SetLineWidth(3);
    graphWhite->SetPoint(0,150, 500);
    graphWhite->SetPoint(1,950, 500);
    graphWhite->SetPoint(2,950, 500*0.6666666667);
    graphWhite->SetPoint(3,150, 500*0.6666666667);
    graphWhite->SetPoint(4,150, 500);
    
    Float_t diagX[4] = {175.+25.,175.+25.+5000,175.-25.+5000,175.-25.};
    Float_t diagY[4] = {0,5000,5000,0};
    TGraph *gdiagonal = new TGraph(4, diagX, diagY);
    gdiagonal->SetName("MtopDiagonal");
    gdiagonal->SetFillColor(kWhite);
    //#gdiagonal->SetFillColor(18);
    TLine* ldiagonal = new TLine(175,0.,650-25.,450);
    //TLine* ldiagonal = new TLine(175.,25,175+500,500);
    ldiagonal->SetLineColor(kGray);
    ldiagonal->SetLineStyle(2);
    TLatex* tdiagonal = new TLatex(400-2.5, 400-172.5,"m_{#tilde{t}} = m_{t} + m_{#tilde{#chi}_{1}^{0}}");
    //tdiagonal->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
    tdiagonal->SetTextAngle(56.31);
    tdiagonal->SetTextColor(kGray+2);
    tdiagonal->SetTextAlign(11);
    tdiagonal->SetTextSize(0.025);

    TLine* l2 = new TLine(150,75,585,500);
    l2->SetLineColor(kGray);
    l2->SetLineStyle(2);
    if(killlowdiag){
        l2->SetX1(200); l2->SetY1(0); l2->SetX2(600); l2->SetY2(400);
    }
    TLatex *t2 = new TLatex(300, 300-72.5,"m_{#tilde{t}} = m_{W} + m_{#tilde{#chi}_{1}^{0}}");
    //t2->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
    t2->SetTextAngle(56.31);
    t2->SetTextColor(kGray+2);
    t2->SetTextAlign(11);
    t2->SetTextSize(0.025);

    hSum->Draw("axis");
    
    gExpR->Draw("c");
    gExpL->Draw("c");
    gExp->Draw("c");
    gObsR->Draw("c");
    gObsL->Draw("c");
    gObs->Draw("c");

    gdiagonal->Draw("FSAME");
    ldiagonal->Draw("LSAME");
    l2->Draw();
    if(!killlowdiag) t2->Draw();
    tdiagonal->Draw("SAME");
    graphWhite->Draw("FSAME");
    graphWhite->Draw("LSAME");

    legE->Draw();
    legO->Draw();
    
    TLatex* textModelLabel= new TLatex(0.175,0.92,"pp #rightarrow #tilde{t} #tilde{t}*, #tilde{t} #rightarrow t #tilde{#chi}^{0}_{1}  NLO+NLL exclusion");
    //TLatex* textModelLabel= new TLatex(0.175,0.92,"pp #rightarrow #tilde{t} #tilde{t}*, #tilde{t} #rightarrow t #tilde{#chi}^{0}_{1}");
    //TLatex* textModelLabel= new TLatex(0.175,0.92,"#tilde{#chi} ");
    textModelLabel->SetNDC();
    textModelLabel->SetTextAlign(13);
    textModelLabel->SetTextFont(42);
    textModelLabel->SetTextSize(0.042);
    textModelLabel->Draw();
    
    //final CMS style
    TLatex *tLumi = new TLatex(0.95,0.944,"2.3 fb^{-1} (13 TeV)");
    tLumi->SetNDC();
    tLumi->SetTextAlign(31);
    tLumi->SetTextFont(42);
    tLumi->SetTextSize(0.042);
    tLumi->SetLineWidth(2);
    tLumi->Draw();
    TLatex *tCMS = new TLatex(0.152,0.944,"CMS");
    tCMS->SetNDC();
    tCMS->SetTextAlign(11);
    tCMS->SetTextFont(61);
    tCMS->SetTextSize(0.0525);
    tCMS->SetLineWidth(2);
    tCMS->Draw();
    TLatex *tPrel = new TLatex(0.265,0.944,"Preliminary");
    tPrel->SetNDC();
    tPrel->SetTextAlign(11);
    tPrel->SetTextFont(52);
    tPrel->SetTextSize(0.042);
    tPrel->SetLineWidth(2);
    tPrel->Draw();
    
   c1->Modified();
   c1->cd();
    c1->Update();
   c1->SetSelected(c1);

}
Exemplo n.º 10
0
void SignfificanceT2tt(bool pval, int exp=0){


    TFile *f = TFile::Open("Significances2DHistograms_T2tt.root");
    TH2F *h;
    if(pval){
        if(exp==0) h = (TH2F*)f->Get("hpObs");
        else if(exp==1) h = (TH2F*)f->Get("hpExpPosteriori");
        else if(exp==2) h = (TH2F*)f->Get("hpExpPriori");
    }
    else {
        if(exp==0) h = (TH2F*)f->Get("hObs");
        else if(exp==1) h = (TH2F*)f->Get("hExpPosteriori");
        else if(exp==2) h = (TH2F*)f->Get("hExpPriori");
    }
    h->GetXaxis()->SetTitle("m_{#tilde{t}} [GeV]");
    h->GetXaxis()->SetLabelFont(42);
    h->GetXaxis()->SetLabelSize(0.035);
    h->GetXaxis()->SetTitleSize(0.05);
    h->GetXaxis()->SetTitleOffset(1.2);
    h->GetXaxis()->SetTitleFont(42);
    h->GetYaxis()->SetTitle("m_{#tilde{#chi}_{1}^{0}} [GeV]");
    h->GetYaxis()->SetLabelFont(42);
    h->GetYaxis()->SetLabelSize(0.035);
    h->GetYaxis()->SetTitleSize(0.05);
    h->GetYaxis()->SetTitleOffset(1.35);
    h->GetYaxis()->SetTitleFont(42);
    double maximum = h->GetMaximum();
    double minimum = h->GetMinimum();
    double sigmin = 99; int sigminx=-1; int sigminy=-1; if(pval) sigmin = -99;
    h->GetZaxis()->SetRangeUser(minimum,maximum);
    for(int x = 1; x<=h->GetNbinsX();++x){
        for(int y = 1; y<=h->GetNbinsX();++y){
            if(!pval&&h->GetBinContent(x,y)<sigmin){ sigmin =h->GetBinContent(x,y); sigminx = x; sigminy = y; }
            if( pval&&h->GetBinContent(x,y)>sigmin){ sigmin =h->GetBinContent(x,y); sigminx = x; sigminy = y; }
            if(!pval&&h->GetXaxis()->GetBinLowEdge(x)<h->GetYaxis()->GetBinLowEdge(y)+75) h->SetBinContent(x,y,-999);
            if(h->GetXaxis()->GetBinLowEdge(x)<374) continue;
            if(h->GetXaxis()->GetBinLowEdge(x)>424) continue;
            if(h->GetYaxis()->GetBinLowEdge(y)<199) continue;
            if(h->GetYaxis()->GetBinLowEdge(y)>249) continue;
            if(!pval&&h->GetBinContent(x,y)>0.3) h->SetBinContent(x,y,0.05);
        }
    }
    h->GetZaxis()->SetRangeUser(minimum,maximum);
    if(!pval) cout << "minimal significance " << sigmin << " at " << h->GetXaxis()->GetBinLowEdge(sigminx) << "-" << h->GetYaxis()->GetBinLowEdge(sigminy) << endl;
    else cout << "maximal p- value " << sigmin << " at " << h->GetXaxis()->GetBinLowEdge(sigminx) << "-" << h->GetYaxis()->GetBinLowEdge(sigminy) << endl;
    
   TCanvas *c1 = new TCanvas("c1", "c1",50,50,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetErrorX(0.5); 
   //c1->Range(-6.311689,-1.891383,28.75325,4.56342);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   //c1->SetLogy();
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
//   c1->SetRightMargin(0.05);
    c1->SetRightMargin(0.15);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.15);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
   gStyle->SetHatchesLineWidth(0);

   TH1F *hSum = new TH1F("hSum","",10,100,900);
   hSum->SetMinimum(0.);
   hSum->SetMaximum(550);
   hSum->SetDirectory(0);
   hSum->SetStats(0);
    hSum->Draw();
    hSum->GetYaxis()->SetRangeUser(0,500);
    hSum->GetXaxis()->SetRangeUser(100,900);

   Int_t ci;   // for color index setting
   ci = TColor::GetColor("#000099");
   hSum->SetLineColor(ci);
   hSum->SetLineStyle(0);
   hSum->SetMarkerStyle(20);
   hSum->GetXaxis()->SetTitle("m_{#tilde{t}} [GeV]");
   //hSum->GetXaxis()->SetBit(TAxis::kLabelsVert);
   hSum->GetXaxis()->SetLabelFont(42);
   //hSum->GetXaxis()->SetLabelOffset(0.005);
   hSum->GetXaxis()->SetLabelSize(0.035);
   hSum->GetXaxis()->SetTitleSize(0.06);
   hSum->GetXaxis()->SetTitleOffset(1.2);
   hSum->GetXaxis()->SetTitleFont(42);
   hSum->GetYaxis()->SetTitle("m_{#tilde{#chi}}_{1}^{0} [GeV]");
   hSum->GetYaxis()->SetLabelFont(42);
   //hSum->GetYaxis()->SetLabelOffset(0.007);
   hSum->GetYaxis()->SetLabelSize(0.035);
   hSum->GetYaxis()->SetTitleSize(0.05);
   hSum->GetYaxis()->SetTitleOffset(1.3);
   hSum->GetYaxis()->SetTitleFont(42);
    
   /*
    TLegend *legO = new TLegend(0.175,0.675,0.50,0.855,NULL,"brNDC");
    //legO-> SetNColumns(2);
    legO->SetBorderSize(0);
    legO->SetTextSize(0.04);
    legO->SetTextFont(42);
    legO->SetLineColor(1);
    legO->SetLineStyle(1);
    legO->SetLineWidth(2);
    legO->SetFillColor(0);
    legO->SetFillStyle(1001);
    legO->SetHeader("Observed");
    legO->AddEntry(gObs, "unpolarized","l");
    legO->AddEntry(gObsR, "right-handed","l");
    legO->AddEntry(gObsL, "left-handed","l");
    */
    
    TGraph* graphWhite = new TGraph(5);
    graphWhite->SetName("white");
    graphWhite->SetTitle("white");
    graphWhite->SetFillColor(kWhite);
    graphWhite->SetFillStyle(1001);
    graphWhite->SetLineColor(kBlack);
    graphWhite->SetLineStyle(1);
    graphWhite->SetLineWidth(3);
    graphWhite->SetPoint(0,100, 500);
    graphWhite->SetPoint(1,900, 500);
    graphWhite->SetPoint(2,900, 500*0.75);
    graphWhite->SetPoint(3,100, 500*0.75);
    graphWhite->SetPoint(4,100, 500);
    
    Float_t diagX[4] = {175.+25.,175.+25.+5000,175.-25.+5000,175.-25.};
    Float_t diagY[4] = {0,5000,5000,0};
    TGraph *gdiagonal = new TGraph(4, diagX, diagY);
    gdiagonal->SetName("MtopDiagonal");
    gdiagonal->SetFillColor(kWhite);
    //#gdiagonal->SetFillColor(18);
    TLine* ldiagonal = new TLine(175,0.,650-25.,450);
    //TLine* ldiagonal = new TLine(175.,25,175+500,500);
    ldiagonal->SetLineColor(kGray);
    ldiagonal->SetLineStyle(2);
    TLatex* tdiagonal = new TLatex(400-2.5, 400-172.5,"m_{#tilde{t}} = m_{t} + m_{#tilde{#chi}_{1}^{0}}");
    //tdiagonal->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
    tdiagonal->SetTextAngle(56.31);
    tdiagonal->SetTextColor(kGray+2);
    tdiagonal->SetTextAlign(11);
    tdiagonal->SetTextSize(0.025);

    TLine* l2 = new TLine(150,75,585,500);
    l2->SetLineColor(kGray);
    l2->SetLineStyle(2);
//    if(killlowdiag){
//        l2->SetX1(200); l2->SetY1(0); l2->SetX2(600); l2->SetY2(400);
//    }
    TLatex *t2 = new TLatex(300, 300-72.5,"m_{#tilde{t}} = m_{W} + m_{#tilde{#chi}_{1}^{0}}");
    //t2->SetTextAngle(TMath::RadToDeg()*TMath::ATan(float(800)/float(500)));
    t2->SetTextAngle(56.31);
    t2->SetTextColor(kGray+2);
    t2->SetTextAlign(11);
    t2->SetTextSize(0.025);
    
    


    hSum->Draw("axis");
    h->Draw("COLZsame");

    gdiagonal->Draw("FSAME");
    ldiagonal->Draw("LSAME");
    l2->Draw();
//    if(!killlowdiag) t2->Draw();
    tdiagonal->Draw("SAME");
    graphWhite->Draw("FSAME");
    graphWhite->Draw("LSAME");

    string textstring = "observed";
    if(exp!=0) textstring = "expected";
    TLatex* textOE= new TLatex(0.175,0.715,textstring.c_str() );
    textOE->SetNDC();
    textOE->SetTextAlign(13);
    textOE->SetTextFont(42);
    textOE->SetTextSize(0.042);
    textOE->Draw();
    

    TLatex* textModelLabel= new TLatex(0.175,0.92,"pp #rightarrow #tilde{t} #tilde{t}*, #tilde{t} #rightarrow t #tilde{#chi}^{0}_{1}");
    //TLatex* textModelLabel= new TLatex(0.175,0.92,"pp #rightarrow #tilde{t} #tilde{t}*, #tilde{t} #rightarrow t #tilde{#chi}^{0}_{1}");
    //TLatex* textModelLabel= new TLatex(0.175,0.92,"#tilde{#chi} ");
    textModelLabel->SetNDC();
    textModelLabel->SetTextAlign(13);
    textModelLabel->SetTextFont(42);
    textModelLabel->SetTextSize(0.042);
    textModelLabel->Draw();
    TLatex* textlLabel= new TLatex(0.175,0.85,"NLO+NLL significance");
    textlLabel->SetNDC();
    textlLabel->SetTextAlign(13);
    textlLabel->SetTextFont(42);
    textlLabel->SetTextSize(0.042);
    textlLabel->Draw();
    
    string psig = "significance [#sigma]";
    if(pval) psig = "p-value";
    TLatex * ztex = new TLatex(0.985,0.92,psig.c_str() );
    ztex->SetNDC();
    ztex->SetTextAlign(31);
    ztex->SetTextFont(42);
    ztex->SetTextSize(0.045);
    ztex->SetTextAngle(90);
    ztex->SetLineWidth(2);
    ztex->Draw();
    
    //final CMS style
    TLatex *tLumi = new TLatex(0.81,0.944,"2.3 fb^{-1} (13 TeV)");
    tLumi->SetNDC();
    tLumi->SetTextAlign(31);
    tLumi->SetTextFont(42);
    tLumi->SetTextSize(0.042);
    tLumi->SetLineWidth(2);
    tLumi->Draw();
    TLatex *tCMS = new TLatex(0.152,0.944,"CMS");
    tCMS->SetNDC();
    tCMS->SetTextAlign(11);
    tCMS->SetTextFont(61);
    tCMS->SetTextSize(0.0525);
    tCMS->SetLineWidth(2);
    tCMS->Draw();
    TLatex *tPrel = new TLatex(0.265,0.944,"Preliminary");
    tPrel->SetNDC();
    tPrel->SetTextAlign(11);
    tPrel->SetTextFont(52);
    tPrel->SetTextSize(0.042);
    tPrel->SetLineWidth(2);
    tPrel->Draw();
    
   c1->Modified();
   c1->cd();
    c1->Update();
   c1->SetSelected(c1);

}
void makePlots()
{
 // **********************************************
 // *            Input parameters                *
 // **********************************************
 // switch to include/exclude sytematics uncertainties 
  bool plot7TeV = false;
  bool plot10TeV = true;

 // array of signal efficiencies
 Double_t S_eff[5] = {0.36, 0.43, 0.54, 0.59, 0.66};
 
 // array of N_background for 100 pb^-1
 Double_t N_bkg_100[5] = {10.35, 6.37, 2.83, 1.27, 1.27};
 Double_t N_bkg_100_7TeV[5] = {4.068, 1.937, 0.816, 0.3841, 0.3841};
 
 // arrays of leptoquark masses
 string mass[5] = {"m250", "m300", "m400", "m500", "m600"};
 Double_t m[5] = {250, 300, 400, 500, 600};
 
 
 // array of theoretical cross-sections for different leptoquark mass
 Double_t xsTh[5] = {9.64045, 3.6081, 0.691125, 0.176217, 0.0538333};
 Double_t xs7Th[10] = {3.48, 1.21, 0.206, 0.0463, 0.0124, 0.00676, 0.00377, 0.00124, 0.000437, 0.00016};
 
 // arrays of beta^2 ranges that contain 95% CL exclusion of different leptoquark mass hypotheses
 Double_t rangeMin[5] = {0.018, 0.03, 0.09, 0.3,  0.9};
 Double_t rangeMax[5] = { 0.03, 0.08,  0.2, 0.55, 1.5};
 Double_t rangeMin_7TeV[5] = {0.03,  0.08,  0.35,  1.0, 3.5};
 Double_t rangeMax_7TeV[5] = {0.08, 0.25,  0.55, 1.5, 5.0};

 // number of points used for interpolation
 Int_t NPts = 5;
  
 // filename for the final plot (NB: changing the name extension changes the file format)
 string fileName = "beta_vs_m_excl.eps";
 if (plot7TeV && !plot10TeV) fileName = "7TeV_beta_vs_m_excl.eps";
 if (!plot7TeV && plot10TeV) fileName = "10TeV_beta_vs_m_excl.eps";
  
 // axes labels for the final plot 
 string title = ";m (GeV/c^{2});#beta";

 TH2F *bg = new TH2F("bg",title.c_str(), 100, 200., 650., 100, 0., 1.);
 bg->SetStats(kFALSE);
 bg->SetTitleOffset(1.,"X");
 bg->SetTitleOffset(1.5,"Y");

 //TF1 *fit1 = new TF1("fit1","[0]*exp([1]*x)",200,600);
 TF1 *fit1 = new TF1("fit1","[0]+[1]*x+[2]*pow(x,2)",200,600);

 //TF1 *fit2 = new TF1("fit2","[0]*exp([1]*x)",200,600);
 TF1 *fit2 = new TF1("fit2","[0]+[1]*x+[2]*pow(x,2)",200,600);
 
 // region excluded by Tevatron limits
 Double_t x_shaded[14] = {200,205,210,215,220,225,230,235,240,245,250,255,256,200};  // 250 pb-1
 Double_t y_shaded[14] = {sqrt(0.0267547),sqrt(0.0380903),sqrt(0.0531225),sqrt(0.0736446),sqrt(0.10221),sqrt(0.142373),sqrt(0.194058),sqrt(0.265091),sqrt(0.385415),sqrt(0.520114),sqrt(0.721552),sqrt(0.945015),1,1};
 Double_t NEW_x_shaded[14] = {216,220,225,231,235,254,268,276,284,289,293,296,297,299};
 Double_t NEW_y_shaded[14] = {0.02,0.04,0.06,0.08,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1};  // 1 fb-1

 // **********************************************
 // *  Don't change anything below this point!   *
 // **********************************************
 
  // turn on/off batch mode
 gROOT->SetBatch(kTRUE);
 // set ROOT style
 style();
 
 TCanvas *c = new TCanvas("c","",800,800);
 c->cd();

 bg->Draw();
 
 TGraph *grexcl = new TGraph(14,x_shaded,y_shaded);
 grexcl->SetFillColor(kGray+1);
 grexcl->Draw("f");
 TGraph *NEWexcl = new TGraph(14,NEW_x_shaded,NEW_y_shaded);
 NEWexcl->SetLineStyle(6);
 NEWexcl->SetLineWidth(3);
 NEWexcl->Draw("C");

 Int_t size = sizeof(S_eff)/sizeof(*S_eff);

 // array of minimum beta^2 values for 95% CL exclusion
//  Double_t beta[size];
 Double_t beta[5] = {0.156865, 0.214541, 0.382863, 0.655572, 1.11471};
 Double_t beta_ln[5] = {log(0.156865), log(0.214541), log(0.382863), log(0.655572), log(1.11471)};
 Double_t beta_7TeV[5] = {0.221188, 0.307225, 0.59993, 1.14052, 2.08235};
 Double_t beta_7TeV_ln[5] = {log(0.221188), log(0.307225), log(0.59993), log(1.14052), log(2.08235)};

//  for(Int_t i = 0; i < size; i++){
  
//   beta_7TeV[i] = beta_for_exclusion(NPts, xs7Th[i], rangeMin_7TeV[i], rangeMax_7TeV[i], 0, S_eff[i], 0, N_bkg_100_7TeV[i], 0, mass[i]);
//   beta_7TeV_ln[i] = log(beta_7TeV[i]);
//  }

 TGraph *beta_vs_m = new TGraph(size, m, beta);
 TGraph *beta_vs_m_fit = new TGraph(size, m, beta_ln);
 beta_vs_m->SetLineWidth(2);
 beta_vs_m->SetLineStyle(7);
 beta_vs_m->SetLineColor(kBlue);
 beta_vs_m->SetMarkerSize(.9);
 beta_vs_m->SetMarkerStyle(22);
 beta_vs_m->SetMarkerColor(kBlue); 
 beta_vs_m_fit->Fit("fit1");
 TF1 *final1 = new TF1("final1","exp(fit1)",200,600);
 final1->SetLineWidth(2);
 final1->SetLineStyle(7);
 final1->SetLineColor(kBlue);
 final1->SetRange(200,600);

 TGraph *beta_vs_m_7TeV = new TGraph(size, m, beta_7TeV);
 TGraph *beta_vs_m_7TeV_fit = new TGraph(size, m, beta_7TeV_ln);
 beta_vs_m_7TeV->SetLineWidth(2);
 beta_vs_m_7TeV->SetLineStyle(7);
 beta_vs_m_7TeV->SetLineColor(kRed);
 beta_vs_m_7TeV->SetMarkerSize(.9);
 beta_vs_m_7TeV->SetMarkerStyle(22);
 beta_vs_m_7TeV->SetMarkerColor(kRed); 
 beta_vs_m_7TeV_fit->Fit("fit2");
 TF1 *final2 = new TF1("final2","exp(fit2)",200,600);
 final2->SetLineWidth(2);
 final2->SetLineStyle(7);
 final2->SetLineColor(kRed);
 final2->SetRange(200,600);

 const Int_t n = 21;
 Double_t x[n], ymin[n], ymin_sys[n], ymax[n];
 for(Int_t i=0;i<n;i++) {
   x[i] = 200+20*i;
   if (plot10TeV) ymin[i] = final1->Eval(x[i]);
   else if (plot7TeV) ymin[i] = final2->Eval(x[i]);
   ymax[i] = 1;
 }
 TGraph *grshade = new TGraph(2*n);
 TGraph *grshade_sys = new TGraph(2*n);
 for(Int_t i=0;i<n;i++) {
    grshade->SetPoint(i,x[i],ymax[i]);
    grshade->SetPoint(n+i,x[n-i-1],ymin[n-i-1]);
    grshade_sys->SetPoint(i,x[i],ymax[i]);
    grshade_sys->SetPoint(n+i,x[n-i-1],ymin_sys[n-i-1]);
 }
 grshade->SetFillStyle(3004);
 if (plot10TeV) grshade->SetFillColor(kBlue);
 if (plot10TeV) grshade->SetLineColor(kBlue);
 if (plot7TeV) grshade->SetFillColor(kRed);
 if (plot7TeV) grshade->SetLineColor(kRed);
 grshade->Draw("F");
 
 gPad->RedrawAxis();
 
 if (plot10TeV) beta_vs_m->Draw("P");
 if (plot10TeV) final1->Draw("same");
 if (plot7TeV) beta_vs_m_7TeV->Draw("Psame");
 if (plot7TeV) final2->Draw("same");
 
 TLegend *legend = new TLegend(.14,.65,.54,.85);
 legend->SetBorderSize(1);
 legend->SetFillColor(0);
 //legend->SetFillStyle(0);
 legend->SetMargin(0.2);
 legend->SetHeader("LQ #rightarrow eq");
 legend->AddEntry(grexcl,"Tevatron exclusion (250 pb^{-1})","f");
 legend->AddEntry(NEWexcl,"Tevatron exclusion (1 fb^{-1})","l");
 if (plot10TeV) legend->AddEntry(beta_vs_m,"95% C.L. (no sys. unc.)","lp");
 if (plot7TeV) legend->AddEntry(beta_vs_m_7TeV,"95% C.L. (no sys. unc.)","lp");
 legend->Draw();

 TLatex l1;
 l1.SetTextAlign(12);
 l1.SetTextSize(0.04);
 l1.SetTextFont(62);
 l1.SetNDC();
 l1.DrawLatex(0.6,0.34,"CMS Preliminary");

 TLatex l2;
 l2.SetTextAlign(12);
 l2.SetTextSize(0.04);
 l2.SetTextFont(62);
 l2.SetNDC();
 l2.DrawLatex(0.6,0.25,"#intLdt=100 pb^{-1}");

 if (plot7TeV){
 TLatex l3;
 l3.SetTextAlign(12);
 l3.SetTextSize(0.035);
 l3.SetTextFont(62);
 l3.SetNDC();
 l3.DrawLatex(0.4,0.16,"EXO-08-010 scaled to #sqrt{s} = 7 TeV");
 }

 c->SetGridx();
 c->SetGridy();
 c->SaveAs(fileName.c_str());

 
 delete fit1;
 delete final1;
 delete fit2;
 delete grexcl;
 delete grshade;
 delete legend;
 delete beta_vs_m;
 delete beta_vs_m_fit;
 delete bg;
 delete c;
}
Exemplo n.º 12
0
void PlotBlowoutScalings(Int_t time, const TString &options="") {

#ifdef __CINT__  
  gSystem->Load("libptools.so");
#endif

  PGlobals::Initialize();

  TString opt = options;

  const Int_t Nsim = 11;
  char sName[Nsim][36] = {"rake-v1.0kA.G.SR2.MC01.3D", 
			  "rake-v2.5kA.G.SR2.MC01.3D",
			  "rake-v04kA.G.SR2.MC01.3D",
			  "rake-v06kA.G.SR2.MC01.3D",
			  "rake-v08kA.G.SR2.MC01.3D",
			  "rake-v10kA.G.SR2.MC01.3D",
			  "rake-v15kA.G.SR2.MC01.3D",
			  "rake-v20kA.G.MC01.3D",
  			  "rake-v30kA.G.SR2.MC01.3D",
  			  "rake-v45kA.G.SR2.MC01.3D",
  			  "rake-v60kA.G.SR2.MC01.3D"};

  // Load first simulation data (for instance)
  PData *pData = PData::Get(sName[0]);
  pData->LoadFileNames(time);
  if(!pData->IsInit()) return;

  // Some plasma constants
  Double_t n0 = pData->GetPlasmaDensity();
  Double_t kp = pData->GetPlasmaK();
  Double_t skindepth = 1.;
  if(kp!=0.0) skindepth = 1/kp;
  Double_t E0 = pData->GetPlasmaE0();
  Double_t  lightspeed =  PConst::c_light;

  // Some beam properties:
  Float_t gamma = pData->GetBeamGamma();

  // Trapping potential
  Float_t trapPotential = 1.0 - (1.0/gamma);

  // Time in OU
  Float_t Time = pData->GetRealTime();
  // z start of the plasma in normalized units.
  Float_t zStartPlasma = pData->GetPlasmaStart()*kp;
  // z start of the beam in normalized units.
  Float_t zStartBeam = pData->GetBeamStart()*kp;
  
  // Compulsory options
  opt += "comovcenter";

  // Centering time and z position:
  Double_t shiftz = pData->Shift(opt);
  if(opt.Contains("center")) {
    Time -= zStartPlasma;
    if(opt.Contains("comov"))      // Centers on the head of the beam.
      Time += zStartBeam;
  } 

  TFile *sFile[Nsim];
  TString *sPath[Nsim];
  Int_t color[Nsim];

  // histos and graphs
  TH2F *hEz2D[Nsim];
  TH2F *hDen2D[Nsim];
  TH1F *hCur1D[Nsim];
  TH1F *hEz1D[Nsim];
  TH1F *hV1D[Nsim];
  TH1F *hFocus1D[Nsim];
  TH1F *hDenx1D[Nsim];

  // Arrays with the quantities
  Float_t Current[Nsim];
  Float_t Zeta0[Nsim];
  Float_t RadiusX[Nsim];
  Float_t RadiusZ[Nsim];
  Float_t RadiusPsi[Nsim];
  Float_t EzMax[Nsim]; 
  Float_t EzMaxUse[Nsim];
  Float_t EzLimit[Nsim];
  Float_t EzMaxFocus[Nsim];
  Float_t EzSlope[Nsim];
  Float_t EzSlopeMaxFocus[Nsim];
  Float_t EzMaxBeam[Nsim];  
  Float_t DeltaPsi[Nsim];
  Float_t DeltaPsiFocus[Nsim];
  Float_t TransRatio[Nsim];
  Float_t TransRatioFocus[Nsim];


  // Theory
  Float_t EzMaxLU[Nsim];  
  Float_t EzMaxLO[Nsim];  
  Float_t EzMaxUseBO[Nsim];  
  Float_t EzMaxBeamLO[Nsim];  
  Float_t EzSlopeLO[Nsim];
  Float_t RadiusLO[Nsim];
  Float_t RadiusLU[Nsim];
  Float_t RadiusPsiBO[Nsim];
  Float_t PsiMaxLO[Nsim];
  Float_t DeltaPsiLO[Nsim];
  Float_t DeltaPsiLU[Nsim];

  // Maximums and minimums for plotting
  Float_t maxCur = -999.;
  Float_t minCur = 999.;
  Float_t maxRadius = -999.;
  Float_t minRadius = 999.;
  Float_t maxEz = -999.;
  Float_t minEz = 999.;
  Float_t maxEzSlope = -999.;
  Float_t minEzSlope = 999.;
  Float_t maxPsi = -999.;
  Float_t minPsi = 999.;
  Float_t maxTR = -999.;
  Float_t minTR = 999.;


  for(Int_t i=0;i<Nsim;i++) {
    
    TString filename = Form("./%s/Plots/Snapshots/Snapshot-%s_%i.root",sName[i],sName[i],time);
    sFile[i] = new TFile(filename,"READ");
    
    // Load histos and graphs
    hEz2D[i]  = (TH2F*) sFile[i]->Get("hE2D_0"); 
    hDen2D[i] = (TH2F*) sFile[i]->Get("hDen2D_0"); 
    hEz1D[i]  = (TH1F*) sFile[i]->Get("hE1D_0"); 
    hCur1D[i] = (TH1F*) sFile[i]->Get("hCur1D_1"); 
    hV1D[i]   = (TH1F*) sFile[i]->Get("hV1D"); 
    hFocus1D[i]   = (TH1F*) sFile[i]->Get("hFocus1D"); 

    hDen2D[i]->ResetStats();
    hEz1D[i]->ResetStats();
    hCur1D[i]->ResetStats();
    hV1D[i]->ResetStats();
    
    cout << Form("\n Analyzing simulation %s : \n",sName[i]) << endl;
   
    // Driver RMS
    Double_t rmslength = hCur1D[i]->GetRMS();
  
    // Find the first point on-axis where Ez changes from positive to negative:
    Int_t MAXCROSS = 2;
    Float_t *EzCross = new Float_t[MAXCROSS];
    Float_t *EzExtr = new Float_t[MAXCROSS];
    memset(EzCross,0,sizeof(Float_t)*MAXCROSS);
    memset(EzExtr,0,sizeof(Float_t)*MAXCROSS);
  
    Int_t auxNcross = PGlobals::HCrossings(hEz1D[i],EzCross,EzExtr,MAXCROSS,0.0,2*rmslength);
  
    // for(Int_t j=0;j<auxNcross;j++) {
    //   if(opt.Contains("units"))
    // 	cout << Form(" %i Ez crossing found at zeta = %.2f um -> Ez maximum = %.2f GV/m",j,EzCross[j],EzExtr[j]) << endl;
    //   else
    // 	cout << Form(" %i Ez crossing found at zeta = %.2f kp^-1 -> Ez maximum = %.2f E0",j,EzCross[j],EzExtr[j]) << endl;      
    // }

    Zeta0[i] = EzCross[0];

    Int_t bin0 = hEz1D[i]->FindBin(Zeta0[i]);
    hDenx1D[i] = (TH1F*) hDen2D[i]->ProjectionY("_py",bin0);

    RadiusX[i] = fabs(hDenx1D[i]->GetBinCenter(hDenx1D[i]->GetMaximumBin()));
    RadiusZ[i] = fabs(hV1D[i]->GetBinCenter(hV1D[i]->GetMinimumBin()) - Zeta0[i]);

    DeltaPsi[i] =  hV1D[i]->GetBinContent(hV1D[i]->GetMaximumBin()) -  hV1D[i]->GetBinContent(hV1D[i]->GetMinimumBin());
    

    Float_t zshift = 0.5; 
    if(opt.Contains("units")) 
      zshift *= PUnits::um * kp;
    
    Int_t bin1 = hEz1D[i]->FindBin(Zeta0[i]-zshift);
    Int_t bin2 = hEz1D[i]->FindBin(Zeta0[i]+zshift);
    EzSlope[i] = (hEz1D[i]->GetBinContent(bin1)-hEz1D[i]->GetBinContent(bin2))/
	(hEz1D[i]->GetBinCenter(bin1)-hEz1D[i]->GetBinCenter(bin2));

    EzMaxUse[i]  = EzSlope[i] * RadiusZ[i];
    EzMaxBeam[i] = EzExtr[0];
    EzMax[i] = fabs(EzExtr[1]);

    Current[i] = hCur1D[i]->GetMaximum();
    if(opt.Contains("units")) {
      Current[i] *= PUnits::kA / PConst::I0;
      rmslength *= PUnits::um * kp;
    }
    RadiusLO[i] = PFunc::RadiusBO(Current[i],rmslength);
    RadiusLU[i] = 2.0 * TMath::Sqrt(Current[i]);
    EzMaxLU[i] = PFunc::EzMaxLu(Current[i]);
    EzMaxBeamLO[i] = PFunc::EzMaxBeamLo(Current[i]);
    EzMaxLO[i] = RadiusLO[i]/2.0;
    Float_t RadiusLO2 = RadiusLO[i]*RadiusLO[i];
    Float_t RadiusLU2 = RadiusLU[i]*RadiusLU[i];
    // EzSlopeLO[i] = RadiusLO2 * (RadiusLO2 + 8.0) / (2.0 * (RadiusLO2 + 4.0) * (RadiusLO2 + 4.0));
    EzSlopeLO[i] = RadiusLU2 * (RadiusLU2 + 8.0) / (2.0 * (RadiusLU2 + 4.0) * (RadiusLU2 + 4.0));
    PsiMaxLO[i] = RadiusLO[i]*RadiusLO[i]/4.0;
    DeltaPsiLO[i] = RadiusLO[i]*RadiusLO[i]/4.0;
    DeltaPsiLU[i] = RadiusLU[i]*RadiusLU[i]/4.0;
    RadiusPsiBO[i] = TMath::Sqrt(2*(DeltaPsiLO[i]-1)); 
    EzMaxUseBO[i]  = RadiusPsiBO[i]/2.0;
    if(opt.Contains("units")) {
      Current[i] /= PUnits::kA / PConst::I0;
      rmslength /= PUnits::um * kp;
      RadiusLO[i] *= skindepth / PUnits::um;
      RadiusLU[i] *= skindepth / PUnits::um;
      RadiusPsiBO[i] *= skindepth / PUnits::um;
      EzMaxLU[i]  *= E0 / (PUnits::GV/PUnits::m);
      EzMaxBeamLO[i] *= E0 / (PUnits::GV/PUnits::m);
      EzMaxUseBO[i] *= E0 / (PUnits::GV/PUnits::m);
      EzSlope[i] *= (E0 / (PUnits::GV/PUnits::m)) * skindepth / PUnits::um;
      cout << Form(" Beam max. current = %.2f kA   RMS = %.2f um",Current[i],rmslength) << endl;
      cout << Form(" Radius of the bubble (Lotov): R = %.2f um",RadiusLO[i]) << endl;
      cout << Form(" Radius of the bubble (Lu)   : R = %.2f um",RadiusLU[i]) << endl;
      cout << Form(" Ez max beam (Lo) = %.2f GV/m",EzMaxBeamLO[i]) << endl;
      cout << Form(" Ez max (Lu) = %.2f GV/m",-EzMaxLU[i]) << endl;
      cout << Form(" Ez slope at crossing = %.2f (GV/m)/um ",EzSlope[i]) << endl;
    } else {
      cout << Form(" Beam max. current = %.2f I0   RMS = %.2f kp^-1",Current[i],rmslength) << endl;
      cout << Form(" Radius of the bubble (Lotov): R = %.2f kp^-1",RadiusLO[i]) << endl;
      cout << Form(" Radius of the bubble (Lu)   : R = %.2f kp^-1",RadiusLU[i]) << endl;
      cout << Form(" Ez max beam (Lo) = %.2f E0",EzMaxBeamLO[i]) << endl;
      cout << Form(" Ez max (Lu) = %.2f E0",-EzMaxLU[i]) << endl;
      cout << Form(" Ez slope at crossing = %.2f ",EzSlope[i]) << endl;
    }

    if(opt.Contains("kA")) {
      Current[i] /= PUnits::kA / PConst::I0;
    }

    // Find the first Focusing crossing after the maximum 
    MAXCROSS = 1;
    Float_t *FocusCross = new Float_t[MAXCROSS];
    Float_t *FocusExtr = new Float_t[MAXCROSS];
    memset(FocusCross,0,sizeof(Float_t)*MAXCROSS);
    memset(FocusExtr,0,sizeof(Float_t)*MAXCROSS);
    auxNcross = PGlobals::HCrossings(hFocus1D[i],FocusCross,FocusExtr,MAXCROSS,0.0,Zeta0[i]);

    if(opt.Contains("units") && n0) {
      trapPotential *=  ( E0 * skindepth / (PUnits::MV) ); 
    }  

    Int_t binFcross = hFocus1D[i]->FindBin(FocusCross[0]);
    Float_t potValueFin = hV1D[i]->GetBinContent(binFcross);
    EzMaxFocus[i] = fabs(hEz1D[i]->GetBinContent(binFcross));


    TransRatio[i] = EzMax[i]/EzMaxBeam[i];
    TransRatioFocus[i] = EzMaxFocus[i]/EzMaxBeam[i];
   
    cout << Form(" Max. R       = %.2f ",TransRatio[i]) << endl;
    cout << Form(" Max. R focus = %.2f ",TransRatioFocus[i]) << endl;


    Int_t binPotValueIni = -99;
    Float_t potValueIni = -99;
    for(Int_t j=binFcross;j<hV1D[i]->GetNbinsX();j++) {
      if(hV1D[i]->GetBinContent(j)>=potValueFin+trapPotential) {
	binPotValueIni = j;
	potValueIni = hV1D[i]->GetBinContent(j);
	//break;
      }
    }

    // Ez slope at max focusing Ez
    zshift = 0.1;
    bin1 = hEz1D[i]->FindBin(FocusCross[0]-zshift);
    bin2 = hEz1D[i]->FindBin(FocusCross[0]+zshift);
    EzSlopeMaxFocus[i] = (hEz1D[i]->GetBinContent(bin1)-hEz1D[i]->GetBinContent(bin2))/
	(hEz1D[i]->GetBinCenter(bin1)-hEz1D[i]->GetBinCenter(bin2));
    cout << Form(" Ez slope at max focus = %.2f ",EzSlopeMaxFocus[i]) << endl;


    // Difference between psi maximum and psi final focus
    DeltaPsiFocus[i] = hV1D[i]->GetBinContent(hV1D[i]->GetMaximumBin()) - potValueFin;

    // Find the first Psi crossing after the maximum 
    MAXCROSS = 1;
    Float_t *PsiCross = new Float_t[MAXCROSS];
    Float_t *PsiExtr = new Float_t[MAXCROSS];
    memset(PsiCross,0,sizeof(Float_t)*MAXCROSS);
    memset(PsiExtr,0,sizeof(Float_t)*MAXCROSS);
    auxNcross = PGlobals::HCrossings(hV1D[i],PsiCross,PsiExtr,MAXCROSS,potValueIni,Zeta0[i]);

    Int_t binVcross = -1;
    EzLimit[i] = 0.0;
    RadiusPsi[i] = 0.0;
    if(auxNcross>0) {
      binVcross = hEz1D[i]->FindBin(PsiCross[0]);
      EzLimit[i] = fabs(hEz1D[i]->GetBinContent(binVcross));
      RadiusPsi[i] = fabs(PsiCross[0]- Zeta0[i]);
    }
        
    cout << Form(" Trapping zone radius = %.2f ",RadiusPsi[i]) << endl;

    if(RadiusX[i]>maxRadius) maxRadius = RadiusX[i];
    if(RadiusZ[i]>maxRadius) maxRadius = RadiusZ[i];
    if(RadiusLO[i]>maxRadius) maxRadius = RadiusLO[i];
    if(RadiusLU[i]>maxRadius) maxRadius = RadiusLU[i];

    if(RadiusX[i]<minRadius) minRadius = RadiusX[i];
    if(RadiusZ[i]<minRadius) minRadius = RadiusZ[i];
    if(RadiusLO[i]<minRadius) minRadius = RadiusLO[i];
    if(RadiusLU[i]<minRadius) minRadius = RadiusLU[i];

    if(EzMax[i]>maxEz) maxEz = EzMax[i];
    if(EzMaxUse[i]>maxEz) maxEz = EzMaxUse[i];
    if(EzLimit[i]>maxEz) maxEz = EzLimit[i];
    if(EzMaxFocus[i]>maxEz) maxEz = EzMaxFocus[i];
    if(EzMaxBeam[i]>maxEz) maxEz = EzMaxBeam[i];
    if(EzMaxLO[i]>maxEz) maxEz = EzMaxLO[i];
    if(EzMaxLU[i]>maxEz) maxEz = EzMaxLU[i];
    if(EzMaxBeamLO[i]>maxEz) maxEz = EzMaxBeamLO[i];

    if(EzMax[i]<minEz) minEz = EzMax[i];
    if(EzMaxUse[i]<minEz) minEz = EzMaxUse[i];
    if(EzLimit[i]<minEz) minEz = EzLimit[i];
    if(EzMaxFocus[i]<minEz) minEz = EzMaxFocus[i];
    if(EzMaxBeam[i]<minEz) minEz = EzMaxBeam[i];
    if(EzMaxLO[i]<minEz) minEz = EzMaxLO[i];
    if(EzMaxLU[i]<minEz) minEz = EzMaxLU[i];
    if(EzMaxBeamLO[i]<minEz) minEz = EzMaxBeamLO[i];
    
    if(EzSlope[i]>maxEzSlope) maxEzSlope = EzSlope[i]; 
    if(EzSlope[i]<minEzSlope) minEzSlope = EzSlope[i]; 
    // if(EzSlopeMaxFocus[i]>maxEzSlope) maxEzSlope = EzSlopeMaxFocus[i]; 
    // if(EzSlopeMaxFocus[i]<minEzSlope) minEzSlope = EzSlopeMaxFocus[i]; 

    if(DeltaPsi[i]>maxPsi) maxPsi = DeltaPsi[i];
    if(DeltaPsiFocus[i]>maxPsi) maxPsi = DeltaPsiFocus[i];
    if(DeltaPsiLO[i]>maxPsi) maxPsi = DeltaPsiLO[i];
    if(DeltaPsiLU[i]>maxPsi) maxPsi = DeltaPsiLU[i];
    if(DeltaPsi[i]<minPsi) minPsi = DeltaPsi[i];
    if(DeltaPsiFocus[i]<minPsi) minPsi = DeltaPsiFocus[i];
    if(DeltaPsiLO[i]<minPsi) minPsi = DeltaPsiLO[i];
    if(DeltaPsiLU[i]<minPsi) minPsi = DeltaPsiLU[i];
    
    if(TransRatio[i]<minTR) minTR = TransRatio[i];
    if(TransRatio[i]>maxTR) maxTR = TransRatio[i];
    if(TransRatioFocus[i]<minTR) minTR = TransRatioFocus[i];
    if(TransRatioFocus[i]>maxTR) maxTR = TransRatioFocus[i];

    if(Current[i]<minCur) minCur = Current[i];
    if(Current[i]>maxCur) maxCur = Current[i];

  }

  Float_t xMin = minCur - (maxCur-minCur)*0.1;
  Float_t xMax = maxCur + (maxCur-minCur)*0.1;


  // Graphs for the max. current dependence
  TGraph *gRadiusX  = new TGraph(Nsim,Current,RadiusX);
  TGraph *gRadiusZ  = new TGraph(Nsim,Current,RadiusZ);
  TGraph *gRadiusPsi  = new TGraph(Nsim,Current,RadiusPsi);
  TGraph *gRadiusLO  = new TGraph(Nsim,Current,RadiusLO);
  TGraph *gRadiusLU  = new TGraph(Nsim,Current,RadiusLU);
  TGraph *gRadiusPsiBO  = new TGraph(Nsim,Current,RadiusPsiBO);

  TGraph *gEzMax    = new TGraph(Nsim,Current,EzMax);
  TGraph *gEzMaxUse = new TGraph(Nsim,Current,EzMaxUse);
  TGraph *gEzMaxBeam = new TGraph(Nsim,Current,EzMaxBeam);
  TGraph *gEzLimit = new TGraph(Nsim,Current,EzLimit);
  TGraph *gEzMaxFocus = new TGraph(Nsim,Current,EzMaxFocus);
  TGraph *gEzMaxLU   = new TGraph(Nsim,Current,EzMaxLU);
  TGraph *gEzMaxLO  = new TGraph(Nsim,Current,EzMaxLO);
  TGraph *gEzMaxUseBO  = new TGraph(Nsim,Current,EzMaxUseBO);
  TGraph *gEzMaxBeamLO = new TGraph(Nsim,Current,EzMaxBeamLO);
 
  TGraph *gDeltaPsi = new TGraph(Nsim,Current,DeltaPsi);
  TGraph *gDeltaPsiFocus = new TGraph(Nsim,Current,DeltaPsiFocus);
  TGraph *gDeltaPsiLO = new TGraph(Nsim,Current,DeltaPsiLO);
  TGraph *gDeltaPsiLU = new TGraph(Nsim,Current,DeltaPsiLU);

  TGraph *gEzSlope = new TGraph(Nsim,Current,EzSlope);
  TGraph *gEzSlopeMaxFocus = new TGraph(Nsim,Current,EzSlopeMaxFocus);
  TGraph *gEzSlopeLO = new TGraph(Nsim,Current,EzSlopeLO);

  TGraph *gTransRatio = new TGraph(Nsim,Current,TransRatio);
  TGraph *gTransRatioFocus = new TGraph(Nsim,Current,TransRatioFocus);

  // Int_t color1 = kMagenta-8;
  // Int_t color2 = kMagenta-2;
  // Int_t color3 = kMagenta-4;
  // Int_t color4 = kAzure+1;
  // Int_t color5 = kGray+2;
  // Int_t markersty = 20;
  // Float_t markersiz = 1.0;
  // Int_t linewit = 2;

  Int_t color1 = kGray+3;
  Int_t color2 = kGray+2;
  Int_t color3 = kAzure+1;
  Int_t color4 = kRed;
  Int_t color5 = kGray+1;
  Int_t markersty = 20;
  Float_t markersiz = 1.0;
  Int_t linewit = 1;

  gRadiusX->SetLineColor(color1);
  gRadiusX->SetLineWidth(linewit);
  gRadiusX->SetMarkerColor(color1);
  gRadiusX->SetMarkerStyle(markersty);
  gRadiusX->SetMarkerSize(markersiz);

  gRadiusLU->SetLineColor(color1);
  gRadiusLU->SetLineWidth(1);
  gRadiusLU->SetLineStyle(4);
  gRadiusLU->SetMarkerColor(color1);
  gRadiusLU->SetMarkerStyle(markersty);
  gRadiusLU->SetMarkerSize(0.0);

  gRadiusZ->SetLineColor(color2);
  gRadiusZ->SetLineWidth(linewit);
  gRadiusZ->SetMarkerColor(color2);
  gRadiusZ->SetMarkerStyle(markersty);
  gRadiusZ->SetMarkerSize(markersiz);

  gRadiusLO->SetLineColor(color2);
  gRadiusLO->SetLineWidth(1);
  gRadiusLO->SetLineStyle(3);
  gRadiusLO->SetMarkerColor(color2);
  gRadiusLO->SetMarkerStyle(markersty);
  gRadiusLO->SetMarkerSize(0.0);

  gRadiusPsi->SetLineColor(color3);
  gRadiusPsi->SetLineWidth(linewit);
  gRadiusPsi->SetMarkerColor(color3);
  gRadiusPsi->SetMarkerStyle(markersty);
  gRadiusPsi->SetMarkerSize(markersiz);

  gEzMax->SetLineColor(color2);
  gEzMax->SetLineWidth(linewit);
  gEzMax->SetMarkerColor(color2);
  gEzMax->SetMarkerStyle(markersty);
  gEzMax->SetMarkerSize(markersiz);

  gEzMaxUse->SetLineColor(color2);
  gEzMaxUse->SetLineWidth(linewit);
  gEzMaxUse->SetMarkerColor(color2);
  gEzMaxUse->SetMarkerStyle(markersty);
  gEzMaxUse->SetMarkerSize(markersiz);

  gEzLimit->SetLineColor(color3);
  gEzLimit->SetLineWidth(linewit);
  gEzLimit->SetMarkerColor(color3);
  gEzLimit->SetMarkerStyle(markersty);
  gEzLimit->SetMarkerSize(markersiz);

  gEzMaxFocus->SetLineColor(color1);
  gEzMaxFocus->SetLineWidth(linewit);
  gEzMaxFocus->SetMarkerColor(color1);
  gEzMaxFocus->SetMarkerStyle(markersty);
  gEzMaxFocus->SetMarkerSize(markersiz);

  gEzSlope->SetLineColor(color2);
  gEzSlope->SetLineWidth(linewit);
  gEzSlope->SetMarkerColor(color2);
  gEzSlope->SetMarkerStyle(markersty);
  gEzSlope->SetMarkerSize(markersiz);

  gEzSlopeMaxFocus->SetLineColor(color1);
  gEzSlopeMaxFocus->SetLineWidth(linewit);
  gEzSlopeMaxFocus->SetMarkerColor(color1);
  gEzSlopeMaxFocus->SetMarkerStyle(markersty);
  gEzSlopeMaxFocus->SetMarkerSize(markersiz);

  gEzSlopeLO->SetLineColor(color2);
  gEzSlopeLO->SetLineWidth(1);
  gEzSlopeLO->SetLineStyle(3);
  gEzSlopeLO->SetMarkerColor(color2);
  gEzSlopeLO->SetMarkerStyle(markersty);
  gEzSlopeLO->SetMarkerSize(0);


  gDeltaPsi->SetLineColor(color2);
  gDeltaPsi->SetLineWidth(linewit);
  gDeltaPsi->SetMarkerColor(color2);
  gDeltaPsi->SetMarkerStyle(markersty);
  gDeltaPsi->SetMarkerSize(markersiz);

  gDeltaPsiFocus->SetLineColor(color1);
  gDeltaPsiFocus->SetLineWidth(linewit);
  gDeltaPsiFocus->SetMarkerColor(color1);
  gDeltaPsiFocus->SetMarkerStyle(markersty);
  gDeltaPsiFocus->SetMarkerSize(markersiz);

  gEzMaxBeam->SetLineColor(color4);
  gEzMaxBeam->SetLineWidth(linewit);
  gEzMaxBeam->SetMarkerColor(color4);
  gEzMaxBeam->SetMarkerStyle(markersty);
  gEzMaxBeam->SetMarkerSize(markersiz);

  gRadiusPsiBO->SetLineColor(color3);
  gRadiusPsiBO->SetLineWidth(1);
  gRadiusPsiBO->SetLineStyle(3);
  gRadiusPsiBO->SetMarkerColor(color3);
  gRadiusPsiBO->SetMarkerStyle(markersty);
  gRadiusPsiBO->SetMarkerSize(0.0);

  gEzMaxLU->SetLineColor(color5);
  gEzMaxLU->SetLineWidth(1);
  gEzMaxLU->SetLineStyle(4);
  gEzMaxLU->SetMarkerColor(color5);
  gEzMaxLU->SetMarkerStyle(markersty);
  gEzMaxLU->SetMarkerSize(0.0);

  gEzMaxLO->SetLineColor(color2);
  gEzMaxLO->SetLineWidth(1);
  gEzMaxLO->SetLineStyle(3);
  gEzMaxLO->SetMarkerColor(color2);
  gEzMaxLO->SetMarkerStyle(markersty);
  gEzMaxLO->SetMarkerSize(0.0);

  gEzMaxUseBO->SetLineColor(color3);
  gEzMaxUseBO->SetLineWidth(1);
  gEzMaxUseBO->SetLineStyle(3);
  gEzMaxUseBO->SetMarkerColor(color3);
  gEzMaxUseBO->SetMarkerStyle(markersty);
  gEzMaxUseBO->SetMarkerSize(0.0);

  gEzMaxBeamLO->SetLineColor(color4);
  gEzMaxBeamLO->SetLineWidth(1);
  gEzMaxBeamLO->SetLineStyle(3);
  gEzMaxBeamLO->SetMarkerColor(color4);
  gEzMaxBeamLO->SetMarkerStyle(markersty);
  gEzMaxBeamLO->SetMarkerSize(0.0);

  gDeltaPsiLO->SetLineColor(color2);
  gDeltaPsiLO->SetLineWidth(1);
  gDeltaPsiLO->SetLineStyle(3);
  gDeltaPsiLO->SetMarkerColor(color2);
  gDeltaPsiLO->SetMarkerStyle(markersty);
  gDeltaPsiLO->SetMarkerSize(0.0);

  gDeltaPsiLU->SetLineColor(color2);
  gDeltaPsiLU->SetLineWidth(1);
  gDeltaPsiLU->SetLineStyle(4);
  gDeltaPsiLU->SetMarkerColor(color2);
  gDeltaPsiLU->SetMarkerStyle(markersty);
  gDeltaPsiLU->SetMarkerSize(0.0);


  gTransRatio->SetLineColor(color2);
  gTransRatio->SetLineWidth(linewit);
  gTransRatio->SetMarkerColor(color2);
  gTransRatio->SetMarkerStyle(markersty);
  gTransRatio->SetMarkerSize(markersiz);

  gTransRatioFocus->SetLineColor(color1);
  gTransRatioFocus->SetLineWidth(linewit);
  gTransRatioFocus->SetMarkerColor(color1);
  gTransRatioFocus->SetMarkerStyle(markersty);
  gTransRatioFocus->SetMarkerSize(markersiz);


  // Canvas setup
  // Create the canvas and the pads before the Frame loop
  // Resolution:
  Int_t sizex = 800;
  Int_t sizey = 1000;
  char cName[32];

  sprintf(cName,"C");     
  TCanvas *C = (TCanvas*) gROOT->FindObject(cName);
  if(C==NULL) C = new TCanvas("C","",sizex,sizey);
  C->cd();

  C->Clear();

  // Setup Pad layout: 
  const Int_t Npads = 5;
 
  // Text objects
  // TPaveText **textLabel = new TPaveText*[Npads];

  TPad **pad = new TPad*[Npads];
  TH1F *hFrame[Npads];
  TGaxis *axis[Npads];
  TLegend *Leg[Npads];

  // Setup Pad layout:
  Double_t lMargin = 0.14;
  Double_t rMargin = 0.05;
  Double_t bMargin = 0.10;
  Double_t tMargin = 0.04;
  Float_t mMargin = 0.01;
  PGlobals::CanvasPartition(C,Npads,lMargin,rMargin,bMargin,tMargin,mMargin);
  //PGlobals::CanvasAsymPartition(C,Npads,lMargin,rMargin,bMargin,tMargin,1.,mMargin);
  
  // Define the frames for plotting
  Int_t fonttype = 43;
  Int_t fontsize = 24;
  Int_t tfontsize = 28;
  Float_t txoffset = 3.8;
  Float_t lxoffset = 0.02;
  Float_t tyoffset = 2.0;
  Float_t lyoffset = 0.01;
  Float_t tylength = 0.02;
  Float_t txlength = 0.04;
  for(Int_t i=0;i<Npads;i++) {
    char name[16];
    sprintf(name,"pad_%i",i);
    pad[i] = (TPad*) gROOT->FindObject(name);
    pad[i]->SetFrameLineWidth(2);  
    // pad[i]->SetTickx(1);
    // pad[i]->SetTicky(1);
    
    sprintf(name,"hFrame_%i",i);  
    hFrame[i] = (TH1F*) gROOT->FindObject(name);
    if(hFrame[i]) delete hFrame[i];

    hFrame[i] = new TH1F(name,"",100,xMin,xMax);
    hFrame[i]->Reset();
    
    Float_t xFactor = pad[0]->GetAbsWNDC()/pad[i]->GetAbsWNDC();
    Float_t yFactor = pad[0]->GetAbsHNDC()/pad[i]->GetAbsHNDC();
    
    // Format for y axis
    hFrame[i]->GetYaxis()->SetTitleFont(fonttype);
    hFrame[i]->GetYaxis()->SetTitleSize(tfontsize);
    hFrame[i]->GetYaxis()->SetTitleOffset(tyoffset);
    hFrame[i]->GetYaxis()->SetLabelFont(fonttype);
    hFrame[i]->GetYaxis()->SetLabelSize(fontsize);
    hFrame[i]->GetYaxis()->SetLabelOffset(lyoffset);
    hFrame[i]->GetYaxis()->SetTickLength(xFactor*tylength/yFactor);
    hFrame[i]->GetYaxis()->CenterTitle();
    
    // Format for x axis
    hFrame[i]->GetXaxis()->SetTitleFont(fonttype);
    hFrame[i]->GetXaxis()->SetTitleSize(tfontsize+2);
    hFrame[i]->GetXaxis()->SetTitleOffset(txoffset);
    hFrame[i]->GetXaxis()->SetLabelFont(fonttype);
    hFrame[i]->GetXaxis()->SetLabelSize(fontsize+2);
    hFrame[i]->GetXaxis()->SetLabelOffset(lxoffset);
    hFrame[i]->GetXaxis()->CenterTitle();
    hFrame[i]->GetXaxis()->SetTickLength(yFactor*txlength/xFactor);      
  }


  C->cd(0);

  pad[0]->Draw();
  pad[0]->cd();

  //  gPad->SetLogx(1);
  Float_t yMin = minTR - (maxTR-minTR)*0.2;
  Float_t yMax = maxTR + (maxTR-minTR)*0.2;
  if(yMin<0.0) yMin = 0.001;
  hFrame[0]->GetYaxis()->SetRangeUser(yMin,yMax);  
  
  hFrame[0]->GetXaxis()->SetTitle("#Lambda_{b}");
  if(opt.Contains("kA"))
    hFrame[0]->GetXaxis()->SetTitle("I_{b}^{ 0} [kA]");

  hFrame[0]->GetYaxis()->SetTitle("R");
  hFrame[0]->Draw("AXIS");

  // if(opt.Contains("theo")) {
  //   gDeltaPsiLO->Draw("PL");
  //   gDeltaPsiLU->Draw("PL");
  // }

  gTransRatio->Draw("PL");
  gTransRatioFocus->Draw("PL");

  Int_t fontsizeleg = 20;
  if(opt.Contains("leg")) { 
    Leg[0]=new TLegend(1 - gPad->GetRightMargin() - 0.26, gPad->GetBottomMargin() + 0.40,
		       1 - gPad->GetRightMargin() - 0.02, gPad->GetBottomMargin() + 0.55); 
    PGlobals::SetPaveStyle(Leg[0]);
    Leg[0]->SetTextAlign(13);
    Leg[0]->SetTextColor(kGray+3);
    Leg[0]->SetTextFont(43);
    Leg[0]->SetTextSizePixels(fontsizeleg);
    Leg[0]->SetLineColor(1);
    Leg[0]->SetBorderSize(0);
    Leg[0]->SetFillColor(0);
    Leg[0]->SetFillStyle(1001);
    Leg[0]->SetFillStyle(0); // Hollow

    Leg[0]->AddEntry(gTransRatio,"Max R","LP");
    Leg[0]->AddEntry(gTransRatioFocus,"Max R in focus","LP");

    Leg[0]->Draw();
  }    

  
  C->cd(0);
  pad[1]->Draw();
  pad[1]->cd();

  //  gPad->SetLogx(1);
  yMin = minPsi - (maxPsi-minPsi)*0.2;
  yMax = maxPsi + (maxPsi-minPsi)*0.2;
  //if(yMin<0.0) yMin = 0.001;
  hFrame[1]->GetYaxis()->SetRangeUser(yMin,yMax);  
  
  hFrame[1]->GetXaxis()->SetTitle("#Lambda_{b}");
  if(opt.Contains("kA"))
    hFrame[1]->GetXaxis()->SetTitle("I_{b} [kA]");

  hFrame[1]->GetYaxis()->SetTitle("#Delta#psi");
  hFrame[1]->Draw("AXIS");

  TLine *line1 = new TLine(xMin,1.0,xMax,1.0);
  line1->SetLineColor(kGray+2);
  line1->SetLineStyle(2);
  line1->Draw();

  if(opt.Contains("theo")) {
    gDeltaPsiLO->Draw("PL");
    gDeltaPsiLU->Draw("PL");
  }
  gDeltaPsi->Draw("PL");
  gDeltaPsiFocus->Draw("PL");

  if(opt.Contains("leg")) { 
    Leg[1]=new TLegend(gPad->GetLeftMargin() + 0.03, 1 - gPad->GetTopMargin() - 0.32,
		       gPad->GetLeftMargin() + 0.24, 1 - gPad->GetTopMargin() - 0.08); 
    PGlobals::SetPaveStyle(Leg[1]);
    Leg[1]->SetTextAlign(13);
    Leg[1]->SetTextColor(kGray+3);
    Leg[1]->SetTextFont(43);
    Leg[1]->SetTextSizePixels(fontsizeleg);
    Leg[1]->SetLineColor(1);
    Leg[1]->SetBorderSize(0);
    Leg[1]->SetFillColor(0);
    Leg[1]->SetFillStyle(1001);
    Leg[1]->SetFillStyle(0); // Hollow

    Leg[1]->AddEntry(gDeltaPsi,"Max #Delta#psi","LP");
    Leg[1]->AddEntry(gDeltaPsiFocus,"Max #Delta#psi in focus","LP");
    // Leg[1]->AddEntry(gDeltaPsiLO,"Max #Psi Lotov","L");
    // Leg[1]->AddEntry(gDeltaPsiLU,"Max #Psi Lu","L");

    Leg[1]->Draw();
  }    

  C->cd(0);
  pad[2]->Draw();
  pad[2]->cd();

  // gPad->SetLogx(1);
  yMin = minEz - (maxEz-minEz)*0.2;
  yMax = maxEz + (maxEz-minEz)*0.2;
  if(yMin<=0.0) yMin = -0.999;
  hFrame[2]->GetYaxis()->SetRangeUser(yMin,yMax);  
  hFrame[2]->GetYaxis()->SetTitle("|E_{z}/E_{0}|");
  hFrame[2]->Draw("AXIS");

  TLine *line0 = new TLine(xMin,0.0,xMax,0.0);
  line0->SetLineColor(kGray+2);
  line0->SetLineStyle(2);
  line0->Draw();

  if(opt.Contains("theo")) {
    gEzMaxLO->Draw("PL");
    //gEzMaxUseBO->Draw("PL");
    gEzMaxBeamLO->Draw("PL");
    //   gEzMaxLU->Draw("PL");
  }

  gEzMax->Draw("PL");
  // gEzMaxUse->Draw("PL");
  gEzMaxBeam->Draw("PL");
  gEzLimit->Draw("PL");
  gEzMaxFocus->Draw("PL");

  if(opt.Contains("leg")) { 
    Leg[2]=new TLegend(gPad->GetLeftMargin() + 0.03, 1 - gPad->GetTopMargin() - 0.4, gPad->GetLeftMargin() + 0.24, 1 - gPad->GetTopMargin() - 0.04); 
    PGlobals::SetPaveStyle(Leg[2]);
    Leg[2]->SetTextAlign(13);
    Leg[2]->SetTextColor(kGray+3);
    Leg[2]->SetTextFont(43);
    Leg[2]->SetTextSizePixels(fontsizeleg-2);
    Leg[2]->SetLineColor(1);
    Leg[2]->SetBorderSize(0);
    Leg[2]->SetFillColor(0);
    Leg[2]->SetFillStyle(1001);
    Leg[2]->SetFillStyle(0); // Hollow

    Leg[2]->AddEntry(gEzMax,"Min E_{z}","LP");
    Leg[2]->AddEntry(gEzMaxFocus,"Min E_{z} in focus","LP");
    Leg[2]->AddEntry(gEzLimit,"Min E_{z} trapping","LP");
    Leg[2]->AddEntry(gEzMaxBeam,"Max E_{z} beam","LP");

    Leg[2]->Draw();
  }

  C->cd(0);
  pad[3]->Draw();
  pad[3]->cd();

  // gPad->SetLogx(1);
  yMin = minEzSlope - (maxEzSlope-minEzSlope)*0.25;
  yMax = maxEzSlope + (maxEzSlope-minEzSlope)*0.25;
  if(yMin<=0.0) yMin = -0.999;
  //  hFrame[3]->GetYaxis()->SetRangeUser(yMin,yMax);
  hFrame[3]->GetYaxis()->SetRangeUser(-0.0499,0.5499);
  hFrame[3]->GetYaxis()->SetNdivisions(510);
  hFrame[3]->GetYaxis()->SetTitle("#partial_{#zeta}E_{z}^{0}/k_{p}E_{0}");
  hFrame[3]->Draw("AXIS");

  TLine *line05 = new TLine(xMin,0.5,xMax,0.5);
  line05->SetLineColor(kGray+2);
  line05->SetLineStyle(2);
  line05->Draw();

  line0->Draw();
  
  if(opt.Contains("theo")) {
    //   gEzSlopeLO->Draw("PL");
  }

  gEzSlope->Draw("PL");
  // gEzSlopeMaxFocus->Draw("PL");

  if(opt.Contains("leg")) { 
    Leg[3]=new TLegend(1 - gPad->GetRightMargin() - 0.26, gPad->GetBottomMargin() + 0.14,1- gPad->GetRightMargin() - 0.02, gPad->GetBottomMargin() + 0.24); 
    PGlobals::SetPaveStyle(Leg[3]);
    Leg[3]->SetTextAlign(12);
    Leg[3]->SetTextColor(kGray+3);
    Leg[3]->SetTextFont(43);
    Leg[3]->SetTextSizePixels(fontsizeleg);
    Leg[3]->SetLineColor(1);
    Leg[3]->SetBorderSize(0);
    Leg[3]->SetFillColor(0);
    Leg[3]->SetFillStyle(1001);
    Leg[3]->SetFillStyle(0); // Hollow

    Leg[3]->AddEntry(gEzSlope,"E_{z} slope at #zeta_{m}","LP");
 
    Leg[3]->Draw();
  }

  C->cd(0);

  pad[4]->Draw();
  pad[4]->cd();

  //  gPad->SetLogx(1);

  yMin = minRadius - (maxRadius-minRadius)*0.2;
  yMax = maxRadius + (maxRadius-minRadius)*0.2;
  if(yMin<=0.0) yMin = -0.999;
  hFrame[4]->GetYaxis()->SetRangeUser(yMin,yMax);  
  hFrame[4]->GetYaxis()->SetTitle("k_{p} x");
  hFrame[4]->Draw("AXIS");
  
  line0->Draw();

  if(opt.Contains("theo")) {
    gRadiusLO->Draw("PL");
    gRadiusLU->Draw("PL");
    //    gRadiusPsiBO->Draw("PL");
  }

  gRadiusPsi->Draw("PL");
  gRadiusX->Draw("PL");
  gRadiusZ->Draw("PL");

  if(opt.Contains("leg")) { 
    Leg[4]=new TLegend(1 - gPad->GetRightMargin() - 0.15, gPad->GetBottomMargin() + 0.15,
		       1 - gPad->GetRightMargin() + 0.09, gPad->GetBottomMargin() + 0.45); 
    PGlobals::SetPaveStyle(Leg[4]);
    Leg[4]->SetTextAlign(12);
    Leg[4]->SetTextColor(kGray+3);
    Leg[4]->SetTextFont(43);
    Leg[4]->SetTextSizePixels(fontsizeleg);
    Leg[4]->SetLineColor(1);
    Leg[4]->SetBorderSize(0);
    Leg[4]->SetFillColor(0);
    Leg[4]->SetFillStyle(1001);
    Leg[4]->SetFillStyle(0); // Hollow

    // Leg[4]->AddEntry(gRadiusZ,"Longitudinal radius","LP");
    // Leg[4]->AddEntry(gRadiusX,"Transverse radius","LP");
    // Leg[4]->AddEntry(gRadiusPsi,"Trapping radius","LP");
    Leg[4]->AddEntry(gRadiusZ,"l_{m}","LP");
    Leg[4]->AddEntry(gRadiusX,"r_{m}","LP");
    Leg[4]->AddEntry(gRadiusPsi,"l_{t}","LP");
 
    Leg[4]->Draw();
  }
  C->cd();
  
  // Output file
  TString fOutName = Form("./Blowout/Blowout-Scalings");
  fOutName += Form("_%i",time);
  
  PGlobals::imgconv(C,fOutName,opt);
  // ---------------------------------------------------------
  
  
}
Exemplo n.º 13
0
void PlotRakeEvolutions(const TString &sim, const TString &options="png") { 
  
#ifdef __CINT__  
  gSystem->Load("libplasma.so");
#endif

  PlasmaGlob::Initialize();
  
  // Palettes!
  gROOT->Macro("PlasmaPalettes.C");

  TString opt = options;
  
  // More makeup            
  Float_t margins[4] = {0.15,0.15,0.20,0.10};
  gStyle->SetPadLeftMargin(margins[0]);  // Margin left axis  
  gStyle->SetPadRightMargin(margins[2]);
  gStyle->SetPadTopMargin(margins[3]);  // Margin left axis  
  gStyle->SetPadBottomMargin(margins[1]);

  gStyle->SetPadTickX(1);
  gStyle->SetPadTickY(1);


  if(opt.Contains("grid")) {
    gStyle->SetPadGridX(1);
    gStyle->SetPadGridY(1);
  }

  const Int_t Nspaces = 4;
  TString phaname[Nspaces] = {"p1x1","p2x2","p3x3","x2x1"};
  TGraph *gXmean[Nspaces]; 
  TGraph *gYmean[Nspaces]; 
  TGraph *gXrms[Nspaces]; 
  TGraph *gYrms[Nspaces]; 
  TGraph *gEmit[Nspaces];
  TGraph *gCharge = NULL;
  // Special graph with an Energy spread band:
  TGraphErrors *gEneRms = NULL;
 
  Float_t maxEmit[Nspaces] = { -999., -999., -999., -999.};
  Float_t minEmit[Nspaces] = { 999., 999.,999., 999.};
  Float_t maxXmean[Nspaces] = { -999., -999., -999., -999.};
  Float_t minXmean[Nspaces] = { 999., 999., 999., 999.};
  Float_t maxXrms[Nspaces] = { -999., -999., -999., -999.};
  Float_t minXrms[Nspaces] = { 999., 999., 999., 999.};
  Float_t maxYmean[Nspaces] = { -999., -999., -999., -999.};
  Float_t minYmean[Nspaces] = { 999., 999., 999.};
  Float_t maxYrms[Nspaces] = { -999., -999., -999., -999.};
  Float_t minYrms[Nspaces] = { 999., 999., 999., 999.};
  Float_t maxCharge =-999.;
  Float_t minCharge = 999.;
  
  // Resolution:
  Int_t sizex = 600;
  Int_t sizey = 800;
  if(opt.Contains("hres")) {
    Int_t sizex = 1024;
    Int_t sizey = 768;    
  }
  

  for(Int_t i=0;i<Nspaces;i++) {
    TString filename;
    filename = Form("./%s/Plots/EmittanceEvolution/Evolutions-%s-%s.root",sim.Data(),sim.Data(),phaname[i].Data());
    
    TFile  *ifile = (TFile*) gROOT->GetListOfFiles()->FindObject(filename.Data());
    if (!ifile) ifile = new TFile(filename,"READ");
    
    
    gEmit[i] = (TGraph*) ifile->Get("gEmitvsTime");  
    gXmean[i] = (TGraph*) ifile->Get("gXmeanvsTime");
    gXrms[i] = (TGraph*) ifile->Get("gXrmsvsTime");
    gYmean[i] = (TGraph*) ifile->Get("gYmeanvsTime");
    gYrms[i] = (TGraph*) ifile->Get("gYrmsvsTime");

    // Energy spread
    if(i==0) {
      gCharge = (TGraph*) ifile->Get("gChargevsTime");  
      Int_t Npoints = gCharge->GetN();
      Double_t *yCharge = gCharge->GetY();
      for(Int_t j=0;j<Npoints;j++) {
	if(yCharge[j]>maxCharge)
	  maxCharge = yCharge[j];
	if(yCharge[j]<minCharge)
	  minCharge = yCharge[j];
      }
      Double_t *xValues = gYmean[i]->GetX();
      Double_t *yMean = gYmean[i]->GetY();
      Double_t *yRms = gYrms[i]->GetY();
      Npoints =  gYmean[i]->GetN();

      gEneRms = new TGraphErrors(Npoints,xValues,yMean,0,yRms);
      // cout << "NPOints = " << gEneRms->GetN() << endl;
      // for(Int_t j=0;j<gEneRms->GetN();j++) {
      // 	gEneRms->SetPointError(j,0.0,yRms[j]);
      // 	cout << "eoooo" << endl;
      // }
    }
    // Calculate the max and min of every set of graphs:
  
    Int_t Npoints = gEmit[i]->GetN();
    Double_t *yEmit = gEmit[i]->GetY();
    for(Int_t j=0;j<Npoints;j++) {
      if(yEmit[j]>maxEmit[i])
	maxEmit[i] = yEmit[j];
      if(yEmit[j]<minEmit[i])
	minEmit[i] = yEmit[j];
    }

    Npoints = gXmean[i]->GetN();
    Double_t *yXmean = gXmean[i]->GetY();
    for(Int_t j=0;j<Npoints;j++) {
      if(yXmean[j]>maxXmean[i])
	maxXmean[i] = yXmean[j];
      if(yXmean[j]<minXmean[i])
	minXmean[i] = yXmean[j];
    }

    Npoints = gXrms[i]->GetN();
    Double_t *yXrms = gXrms[i]->GetY();
    for(Int_t j=0;j<Npoints;j++) {
      if(yXrms[j]>maxXrms[i])
	maxXrms[i] = yXrms[j];
      if(yXrms[j]<minXrms[i])
	minXrms[i] = yXrms[j];
    }

    Npoints = gYmean[i]->GetN();
    Double_t *yYmean = gYmean[i]->GetY();
    for(Int_t j=0;j<Npoints;j++) {
      if(yYmean[j]>maxYmean[i])
	maxYmean[i] = yYmean[j];
      if(yYmean[j]<minYmean[i])
	minYmean[i] = yYmean[j];
    }

    Npoints = gYrms[i]->GetN();
    Double_t *yYrms = gYrms[i]->GetY();
    for(Int_t j=0;j<Npoints;j++) {
      if(yYrms[j]>maxYrms[i])
	maxYrms[i] = yYrms[j];
      if(yYrms[j]<minYrms[i])
	minYrms[i] = yYrms[j];
    }
    
  }

  // --------------------

  // Canvas setup
  TCanvas *C1 = new TCanvas("C1","Evolution of Emittance",sizex,sizey);
  C1->cd();
  
  // C1->Divide(1,Nspaces);
  // PlasmaGlob::CanvasPartition(C1,pad,Nspaces);
  
  const Int_t Npads = 3;

  TH1F *hFrame[Npads];
  TPad **pad = new TPad*[Npads];
  
  // Setup Pad layout:
  Double_t lMargin = 0.15;
  Double_t rMargin = 0.15;
  Double_t bMargin = 0.08;
  Double_t tMargin = 0.08;
  Double_t vSpacing = 0.01; 
  Double_t hStep = (1.-lMargin-rMargin);
  Double_t vStep = (1.- bMargin - tMargin - (Npads-1) * vSpacing) / Npads;
  
  Float_t *vposd = new Float_t[Npads];
  Float_t *vposu = new Float_t[Npads];
  Float_t *vmard = new Float_t[Npads];
  Float_t *vmaru = new Float_t[Npads];
  Float_t *vfactor = new Float_t[Npads];
  Float_t *hposl = new Float_t[Npads];
  Float_t *hposr = new Float_t[Npads];
  Float_t *hmarl = new Float_t[Npads];
  Float_t *hmarr = new Float_t[Npads];
  Float_t *hfactor = new Float_t[Npads];
  
  for(Int_t i=0;i<Npads;i++) {
    
    hposl[i] = 0.0;
    hposr[i] = 1.0;
    hmarl[i] = lMargin;
    hmarr[i] = rMargin;
    
    if(i==0) {
      vposd[i] = 0.0;
      vposu[i] = bMargin + vStep;
      vfactor[i] = vposu[i]-vposd[i];  
      vmard[i] = bMargin / vfactor[i];
      vmaru[i] = 0.0;
    } else if(i == Npads-1) {
      vposd[i] = vposu[i-1] + vSpacing;
      vposu[i] = vposd[i] + vStep + tMargin;
      vfactor[i] = vposu[i]-vposd[i];   
      vmard[i] = 0.0;
      vmaru[i] = tMargin / (vposu[i]-vposd[i]);
    } else {
      vposd[i] = vposu[i-1] + vSpacing;
      vposu[i] = vposd[i] + vStep; 
      vfactor[i] = vposu[i]-vposd[i];
      vmard[i] = 0.0;
      vmaru[i] = 0.0;
    } 
    hfactor[i] = hposl[i]-hposr[i];
    
    C1->cd();
    
    char name[16];
    sprintf(name,"pad_%i",i);
    cout << endl << Form("%s :   %4.2f  %4.2f  %4.2f  %4.2f",name,hposl[i],vposd[i],hposr[i],vposu[i]) << endl;
    pad[i] = new TPad(name,"",hposl[i],vposd[i],hposr[i],vposu[i]);
    
    pad[i]->SetLeftMargin(hmarl[i]);
    pad[i]->SetRightMargin(hmarr[i]);  
    pad[i]->SetBottomMargin(vmard[i]);
    pad[i]->SetTopMargin(vmaru[i]);
    pad[i]->Draw();
    
    pad[i]->cd();
  
    sprintf(name,"hFrame_%i",i);  
    hFrame[i] = new TH1F(name,"",100,0,20);


    hFrame[i]->GetYaxis()->SetLabelSize(0.02/vfactor[i]);
    hFrame[i]->GetYaxis()->SetLabelOffset(0.01/vfactor[i]);

    hFrame[i]->GetYaxis()->SetTitleSize(0.02/vfactor[i]);
    hFrame[i]->GetYaxis()->SetTitleOffset(1.0-vfactor[i]);///vfactor[i]);

    hFrame[i]->GetXaxis()->SetLabelSize(0.07);
    hFrame[i]->GetXaxis()->SetLabelOffset(0.01/vfactor[i]);

    hFrame[i]->GetXaxis()->SetTitleSize(0.07);
    hFrame[i]->GetXaxis()->SetTitleOffset(1.1);///vfactor[i]);
    
    hFrame[i]->Draw("axis");    

    if(i==2) {
      Float_t yMin = 0.0001; // minYmean[0] - (maxYmean[0]-minYmean[0])*0.1;
      Float_t yMax = maxYmean[0] + (maxYmean[0]-minYmean[0])*0.1;
      hFrame[i]->GetYaxis()->SetRangeUser(yMin,yMax);
      hFrame[i]->GetXaxis()->SetTitle("propagation length [mm]");
      hFrame[i]->GetYaxis()->SetTitle("p_{z} [GeV/c]");
      //    PlasmaGlob::SetH1LabelSize(hFrame[i]);
      
      gEneRms->SetFillColor(kGray);
      gEneRms->Draw("3");
      gYmean[0]->Draw("L");  

      // Charge on right axis:
      Float_t yrMin = 0.00001; // minCharge - (maxCharge-minCharge)*0.1;
      Float_t yrMax = maxCharge + (maxCharge-minCharge)*0.1;
      Float_t slope = (yMax-yMin)/(yrMax-yrMin);
      
      Double_t *x = gCharge->GetX();
      Double_t *y = gCharge->GetY();
      for(Int_t j=0;j<gCharge->GetN();j++) {
      	gCharge->SetPoint(j,x[j],slope*(y[j]-yrMin)+yMin);
      }

      //hFrame[i]->GetYaxis()->SetRangeUser(yrMin,yrMax);
      gCharge->SetLineStyle(2);
      gCharge->SetLineWidth(3);
      gCharge->SetLineColor(kAzure-8);      
      gCharge->Draw("L");

      pad[i]->Update();

    } else if(i==1) {
      Float_t yMin,yMax;
      if(minXrms[1]<minXrms[0])
	yMin = minXrms[1];
      else
	yMin = minXrms[0];
      if(maxXrms[1]>maxXrms[0])
	yMax = maxXrms[1];
      else
	yMax = maxXrms[0];

      Float_t yDist = yMax - yMin;
      yMin -= 0.1*yDist; 
      yMax += 0.1*yDist;
      hFrame[i]->GetYaxis()->SetRangeUser(yMin,yMax);
      hFrame[i]->GetXaxis()->SetTitle("propagation length [mm]");
      hFrame[i]->GetYaxis()->SetTitle("rms size [#mum]");
      //    PlasmaGlob::SetH1LabelSize(hFrame[i]);

      gXrms[0]->SetLineStyle(1);
      gXrms[0]->SetLineWidth(3);
      gXrms[0]->SetLineColor(kOrange+10);      
      gXrms[0]->Draw("L");
      gXrms[1]->SetLineStyle(2);
      gXrms[1]->SetLineWidth(3);
      gXrms[1]->SetLineColor(kAzure-8);
      gXrms[1]->Draw("L");
 
      pad[i]->Update();
    } else if(i==0) {
      Float_t yMin,yMax;
      if(minEmit[1]<minEmit[0])
	yMin = minEmit[1];
      else
	yMin = minEmit[0];
      if(maxEmit[1]>maxEmit[0])
	yMax = maxEmit[1];
      else
	yMax = maxEmit[0];

      Float_t yDist = yMax - yMin;
      yMin -= 0.1*yDist; 
      yMax += 0.1*yDist;
      hFrame[i]->GetYaxis()->SetRangeUser(yMin,yMax);
      hFrame[i]->GetXaxis()->SetTitle("propagation length [mm]");
      hFrame[i]->GetYaxis()->SetTitle("trans. emittance [(MeV/c) #mum]");
      // PlasmaGlob::SetH1LabelSize(hFrame[i]);
      
      gEmit[0]->SetLineStyle(1);
      gEmit[0]->SetLineWidth(3);
      gEmit[0]->SetLineColor(kOrange+10);
      gEmit[0]->Draw("L");
      gEmit[1]->SetLineStyle(2);
      gEmit[1]->SetLineWidth(3);
      gEmit[1]->SetLineColor(kAzure-8);
      gEmit[1]->Draw("L");
 
      pad[i]->Update();

    }
  }
    
  C1->cd();
  
  // Print to a file
  // Output file
  TString fOutName = Form("./%s/Plots/RakeEvolution/RakeEvolution-%s",sim.Data(),sim.Data());
  PlasmaGlob::imgconv(C1,fOutName,opt);
  
}
Exemplo n.º 14
0
void plotConvergence(int step = 1){

  int count = 0;
  int tempcount=0;

  ifstream myInput(Form("converge_steps_%i.txt", step));

//    ifstream myInput("lindaMacros/ANITAsymmetric.txt");

  double meanH, rmsH, gradH, meanV, rmsV, gradV;

  double sumMeanH[1000];
  double sumRmsH[1000];
  double sumGradH[1000];
  double sumMeanV[1000];
  double sumRmsV[1000];
  double sumGradV[1000];
  double x[1000];

  if (myInput.is_open()){
    while(myInput.good()){
      
      myInput >> meanH >> rmsH >> gradH >> meanV >> rmsV >> gradV;
      
      if (tempcount%100==0){
	sumMeanH[count] = meanH;
	sumRmsH[count] = rmsH;
	sumGradH[count] = gradH;
	sumMeanV[count] = meanV;
	sumRmsV[count] = rmsV;
	sumGradV[count] = gradV;
	x[count] = tempcount*1.;
	count++;
	cout << meanH << " " << rmsH << " " << gradH << endl;
      }
      
      tempcount++;
    }
  }
  
  
  count--;

  TGraph *gMeanH = new TGraph(count, x, sumMeanH);
  TGraph *gRmsH  = new TGraph(count, x, sumRmsH);
  TGraph *gGradH = new TGraph(count, x, sumGradH);
  TGraph *gMeanV = new TGraph(count, x, sumMeanV);
  TGraph *gRmsV  = new TGraph(count, x, sumRmsV);
  TGraph *gGradV = new TGraph(count, x, sumGradV);

  gMeanH->SetLineColor(kCyan+1);
  gMeanH->SetLineWidth(2);

  gRmsH->SetLineColor(kMagenta+3);
  gRmsH->SetLineStyle(7);
  gRmsH->SetLineWidth(2);

  gGradH->SetLineColor(kGreen+2);
  gGradH->SetLineWidth(2);
  gGradH->SetLineStyle(8);


  gMeanV->SetLineColor(kCyan+1);
  gMeanV->SetLineWidth(2);

  gRmsV->SetLineColor(kMagenta+3);
  gRmsV->SetLineStyle(7);
  gRmsV->SetLineWidth(2);

  gGradV->SetLineColor(kGreen+2);
  gGradV->SetLineWidth(2);
  gGradV->SetLineStyle(8);


  TCanvas *c1 = new TCanvas("c1");
 

  gMeanH->Draw("Al");
  gMeanH->SetTitle("Convergence:horizontal antenna pairs;Iteration;Value");

  gMeanH->GetYaxis()->SetRangeUser(0.01,10000);

  c1->SetLogy();
  gMeanH->Draw("al");

  gRmsH->Draw("l");
  gGradH->Draw("l");

  TLegend *leg = new TLegend(0.89, 0.89, 0.55, 0.7);
  leg->SetFillColor(kWhite);
  leg->AddEntry(gMeanH, "#Sigma MEAN", "l");
  leg->AddEntry(gRmsH,  "#Sigma RMS" , "l");
  leg->AddEntry(gGradH, "#Sigma GRAD", "l");

  leg->Draw();

  c1->Print(Form("Convergence_HorizontalAntennaPairs_steps_%i.png", step));
  c1->Print(Form("Convergence_HorizontalAntennaPairs_steps_%i.pdf", step));


  gMeanV->Draw("Al");
  gMeanV->SetTitle("Convergence: vertical antenna pairs;Iteration;Value");

  gMeanV->GetYaxis()->SetRangeUser(0.01,10000);

  c1->SetLogy();
  gMeanV->Draw("al");

  gRmsV->Draw("l");
  gGradV->Draw("l");

  leg->Draw();

  c1->Print(Form("Convergence_VerticalAntennaPairs_steps_%i.png", step));
  c1->Print(Form("Convergence_VerticalAntennaPairs_steps_%i.pdf", step));


  
}
Exemplo n.º 15
0
void plotLimit(TString outputDir="./", TString inputs="", TString inputXSec="", bool strengthLimit=true, bool blind=false, double energy=7, double luminosity=5.035, TString legendName="ee and #mu#mu channels")
{
  //style options
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetCanvasColor(kWhite);
  gStyle->SetFrameBorderMode(0);
  gStyle->SetFrameBorderSize(1);
  gStyle->SetFrameFillColor(0);
  gStyle->SetFrameFillStyle(0);
  gStyle->SetFrameLineColor(1);
  gStyle->SetFrameLineStyle(1);
  gStyle->SetFrameLineWidth(1);
  gStyle->SetOptFit(1);
  gStyle->SetFitFormat("5.4g");
  gStyle->SetFuncColor(2);
  gStyle->SetOptFile(0);
  //gStyle->SetOptStat(0);
  gStyle->SetOptStat("mr");
  gStyle->SetStatColor(kWhite);
  gStyle->SetStatFont(42);
  gStyle->SetStatFontSize(0.04);
  gStyle->SetStatTextColor(1);
  gStyle->SetStatFormat("6.4g");
  gStyle->SetStatBorderSize(1);
  gStyle->SetStatH(0.1);
  gStyle->SetStatW(0.2);
  gStyle->SetPadTopMargin(0.05);
  gStyle->SetPadBottomMargin(0.13);
  gStyle->SetPadLeftMargin(0.16);
  gStyle->SetPadRightMargin(0.02);
  gStyle->SetOptTitle(0);
  gStyle->SetTitleFont(42);
  gStyle->SetTitleColor(1);
  gStyle->SetTitleTextColor(1);
  gStyle->SetTitleFillColor(10);
  gStyle->SetTitleFontSize(0.05);
  gStyle->SetAxisColor(1, "XYZ");
  gStyle->SetStripDecimals(kTRUE);
  gStyle->SetTickLength(0.03, "XYZ");
  gStyle->SetNdivisions(510, "XYZ");
  gStyle->SetPadTickX(1);  // To get tick marks on the opposite side of the frame
  gStyle->SetPadTickY(1);
  gStyle->SetEndErrorSize(2);
  gStyle->SetErrorX(0.);
  gStyle->SetMarkerStyle(20); 
  gROOT->ForceStyle();
  gStyle->SetPadTopMargin   (0.06);
  gStyle->SetPadBottomMargin(0.12);
  gStyle->SetPadRightMargin (0.06);
  gStyle->SetPadLeftMargin  (0.14);
  gStyle->SetTitleSize(0.04, "XYZ");
  gStyle->SetTitleXOffset(1.1);
  gStyle->SetTitleYOffset(1.45);
  gStyle->SetPalette(1);
  gStyle->SetNdivisions(505);


  string suffix = string(outputDir.Data());
  double cprime=1.0; double  brnew=0.0;
  double XSecScaleFactor = 1.0;
  if(suffix.find("_cp")!=string::npos){
     sscanf(suffix.c_str()+suffix.find("_cp"), "_cp%lf_brn%lf", &cprime, &brnew);
     XSecScaleFactor = pow(cprime,2) * (1-brnew);
  }
 
  //get xsec * br from summary file
  getXSecXBR(inputXSec); 
  //get the limits from the tree
  TFile* file = TFile::Open(inputs);
  printf("Looping on %s\n",inputs.Data());
  if(!file) return;
  if(file->IsZombie()) return;
  TTree* tree = (TTree*)file->Get("limit");
  tree->GetBranch("mh"              )->SetAddress(&Tmh      );
  tree->GetBranch("limit"           )->SetAddress(&Tlimit   );
  tree->GetBranch("limitErr"        )->SetAddress(&TlimitErr);
  tree->GetBranch("quantileExpected")->SetAddress(&TquantExp);
  int N = tree->GetEntriesFast() / 6 ;// 6Limits per mass point (observed, meand , +-1sigma, +-2sigma)
  double* MassAxis   = new double[N];
  double* ObsLimit   = new double[N];  fillLimitArray(tree,-1   ,ObsLimit,MassAxis);  if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ObsLimit);
  double* ExpLimitm2 = new double[N];  fillLimitArray(tree,0.025,ExpLimitm2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm2);
  double* ExpLimitm1 = new double[N];  fillLimitArray(tree,0.160,ExpLimitm1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitm1);
  double* ExpLimit   = new double[N];  fillLimitArray(tree,0.500,ExpLimit  );         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimit);
  double* ExpLimitp1 = new double[N];  fillLimitArray(tree,0.840,ExpLimitp1);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp1);
  double* ExpLimitp2 = new double[N];  fillLimitArray(tree,0.975,ExpLimitp2);         if(!strengthLimit)scaleLimitsByXSecXBR(N, MassAxis, ExpLimitp2);
  file->Close();

  //make TH Cross-sections
  double* ThXSec   = new double[N]; for(unsigned int i=0;i<N;i++){ThXSec[i] = xsecXbr[MassAxis[i]];} 

  //scale TH cross-section and limits according to scale factor 
  //this only apply to NarrowResonnance case
  for(unsigned int i=0;i<N;i++){
    if(strengthLimit){
    ObsLimit[i]  /= XSecScaleFactor;
    ExpLimitm2[i]/= XSecScaleFactor;
    ExpLimitm1[i]/= XSecScaleFactor;
    ExpLimit  [i]/= XSecScaleFactor;
    ExpLimitp1[i]/= XSecScaleFactor;
    ExpLimitp2[i]/= XSecScaleFactor;
    }
    ThXSec[i]    *= XSecScaleFactor;
  }

    
  //limits in terms of signal strength
  TCanvas* c = new TCanvas("c", "c",600,600);
  TH1F* framework = new TH1F("Graph","Graph",1,90,160);
  framework->SetStats(false);
  framework->SetTitle("");
  framework->GetXaxis()->SetTitle("Higgs boson mass [GeV]");
  framework->GetYaxis()->SetTitleOffset(1.70);
  if(strengthLimit){
  framework->GetYaxis()->SetTitle("#mu = #sigma_{95%} / #sigma_{th}");
  framework->GetYaxis()->SetRangeUser(9E-1,1E3);
  c->SetLogy(true);
  }else{
  framework->GetYaxis()->SetTitle("#sigma_{95%} (fb)");
  framework->GetYaxis()->SetRangeUser(1E-1,1E3);
  c->SetLogy(true);
  }
  framework->Draw();

  TGraph* TGObsLimit   = new TGraph(N,MassAxis,ObsLimit);  TGObsLimit->SetLineWidth(2);
  TGraph* TGExpLimit   = new TGraph(N,MassAxis,ExpLimit);  TGExpLimit->SetLineWidth(2); TGExpLimit->SetLineStyle(2);
  TCutG* TGExpLimit1S  = GetErrorBand("1S", N, MassAxis, ExpLimitm1, ExpLimitp1);  
  TCutG* TGExpLimit2S  = GetErrorBand("2S", N, MassAxis, ExpLimitm2, ExpLimitp2);  TGExpLimit2S->SetFillColor(5);
  TGraph* THXSec        = new TGraph(N,MassAxis,ThXSec); THXSec->SetLineWidth(2); THXSec->SetLineStyle(1); THXSec->SetLineColor(4);


  TGExpLimit->SetLineColor(2);  TGExpLimit->SetLineStyle(1);
  TGObsLimit->SetLineWidth(2);  TGObsLimit->SetMarkerStyle(20);
  TGExpLimit2S->Draw("fc same");
  TGExpLimit1S->Draw("fc same");
  if(!blind) TGObsLimit->Draw("same CP");
  TGExpLimit->Draw("same C");

  if(strengthLimit){
     TLine* SMLine = new TLine(framework->GetXaxis()->GetXmin(),1.0,framework->GetXaxis()->GetXmax(),1.0);
     SMLine->SetLineWidth(2); SMLine->SetLineStyle(1); SMLine->SetLineColor(4);      
     SMLine->Draw("same C");
  }else{
     THXSec->Draw("same C");
  }


  TPaveText *pave = new TPaveText(0.1,0.96,0.99,0.99,"NDC");
  char LumiLabel[1024];
  if(energy<9){  sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV, #scale[0.5]{#int} L=%6.1ffb^{-1} - %20s",energy, luminosity,legendName.Data());
  }else{         sprintf(LumiLabel,"CMS preliminary,  #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}, #sqrt{s}=%.0f TeV #scale[0.5]{#int} L=%6.1ffb^{-1}",7.0,5.0,8.0,19.7);
  }
  pave->SetBorderSize(0);
  pave->SetFillStyle(0);
  pave->SetTextFont(42);
  TObjArray* tokens = (TString(LumiLabel)).Tokenize("\\\\");
  int nt = tokens->GetEntries();
  for(int it=0; it<nt; ++it){
    TObjString * t = (TObjString *)tokens->At(it);
    pave->AddText(t->GetString());
  }
  pave->Draw("same");


  TLegend* LEG = new TLegend(0.55,0.75,0.85,0.95);
  LEG->SetHeader("");
  LEG->SetFillColor(0);
  LEG->SetFillStyle(0);
  LEG->SetTextFont(42);
  LEG->SetBorderSize(0);
  LEG->AddEntry(THXSec  , "SM prediction"  ,"L");
  LEG->AddEntry(TGExpLimit  , "median expected"  ,"L");
  LEG->AddEntry(TGExpLimit1S  , "expected #pm 1#sigma"  ,"F");
  LEG->AddEntry(TGExpLimit2S  , "expected #pm 2#sigma"  ,"F");
  if(!blind) LEG->AddEntry(TGObsLimit  , "observed"  ,"LP");
  LEG->Draw();
  c->RedrawAxis();
  c->SaveAs(outputDir+"Limit.png");
  c->SaveAs(outputDir+"Limit.C");
  c->SaveAs(outputDir+"Limit.pdf"); 


  //save a summary of the limits
  FILE* pFileSum = fopen((outputDir+"LimitSummary").Data(),"w");
  for(int i=0;i<N;i++){
    fprintf(pFileSum, "$%8.6E$ & $%8.6E$ & $[%8.6E,%8.6E]$ & $[%8.6E,%8.6E]$ & $%8.6E$ & Th=$%8.6E$\\\\\\hline\n",MassAxis[i], ExpLimit[i], ExpLimitm1[i], ExpLimitp1[i], ExpLimitm2[i],  ExpLimitp2[i], ObsLimit[i], ThXSec[i]);
    if(int(MassAxis[i])%50!=0)continue; printf("%f ",ObsLimit[i]);
  }printf("\n");
  fclose(pFileSum);

  pFileSum = fopen((outputDir+"LimitRange").Data(),"w");
  fprintf(pFileSum, "EXPECTED LIMIT --> ");                   printLimits(pFileSum,TGExpLimit, MassAxis[0], MassAxis[N-1]);
  if(!blind) fprintf(pFileSum, "OBSERVED LIMIT --> ");        printLimits(pFileSum,TGObsLimit, MassAxis[0], MassAxis[N-1]);
  fprintf(pFileSum, "Exp Limits for Model are: ");              for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f+-%f ",ExpLimit[i], (ExpLimitp1[i]-ExpLimitm1[i]))/2.0;}fprintf(pFileSum,"\n");
  if(!blind) { fprintf(pFileSum, "Obs Limits for Model are: "); for(int i=0;i<N;i++){if(int(MassAxis[i])%50!=0)continue; fprintf(pFileSum, "%f ",ObsLimit[i]);}fprintf(pFileSum,"\n"); }
  fclose(pFileSum);
}
void 
mssm_xs_times_acc_scan(char* path, std::string filepath, double tanb, std::string category)
{
  mssm_xs_tools xs;
  xs.SetInput(path);
  
  //TGraph *SM = new TGraph();
  TGraph *ggH = new TGraph();
  TGraph *bbH = new TGraph();
  TGraph *ggA = new TGraph();
  TGraph *gg = new TGraph();
  TGraph *bbA = new TGraph();
  TGraph *ggh = new TGraph();
  TGraph *bbh = new TGraph();
  TGraph *bb = new TGraph();
  TGraph *signi = new TGraph();

  TGraph *ggHacc = new TGraph();
  TGraph *bbHacc = new TGraph();
  TGraph *ggAacc = new TGraph();
  TGraph *ggacc = new TGraph();
  TGraph *bbAacc = new TGraph();
  TGraph *gghacc = new TGraph();
  TGraph *bbhacc = new TGraph();
  TGraph *bbacc = new TGraph();

  double xs_eff_ggH[4];
  double xs_eff_bbH[4];

  double masses[19];
  masses[0]=  90;
  masses[1]= 100;
  masses[2]= 120;
  masses[3]= 130;
  masses[4]= 140;
  masses[5]= 160;
  masses[6]= 180;
  masses[7]= 200;
  masses[8]= 250;
  masses[9]= 300;
  masses[10]= 350;
  masses[11]= 400;
  masses[12]= 450;
  masses[13]= 500;
  masses[14]= 600;
  masses[15]= 700;
  masses[16]= 800;
  masses[17]= 900;
  masses[18]=1000;

  TFile* inputFile = new TFile(std::string(filepath+"/"+"htt_mt.inputs-mssm-8TeV-0.root").c_str()); 
  TH1F* h_background = new TH1F();
  double ggH_value, bbH_value, ggA_value, bbA_value, ggh_value, bbh_value;;
  
  double mA;

  h_background=get<TH1F>(inputFile, std::string("muTau_"+category+"/ZTT").c_str());
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/QCD").c_str()));
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/W").c_str()));
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/ZL").c_str()));
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/ZJ").c_str()));
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/TT").c_str()));
  h_background->Add(get<TH1F>(inputFile, std::string("muTau_"+category+"/VV").c_str()));
   
 TH1F* h_ggH = new TH1F();
 TH1F* h_bbH = new TH1F();
 TH1F* h_ggh = new TH1F();
 TH1F* h_bbh = new TH1F();
 TH1F* h_ggA = new TH1F();
 TH1F* h_bbA = new TH1F();

  for(unsigned int idx=0; idx<19; idx++){
  
    mA=masses[idx];
    std::cout << "mh = " << xs.Give_Mass_h(mA, tanb) << "   mA = " << mA << "   mH = " << xs.Give_Mass_H(mA, tanb) << std::endl;
    std::cout << "mh = " << closest_mass(xs.Give_Mass_h(mA, tanb)) << "   mA = " << mA << "   mH = " << closest_mass(xs.Give_Mass_H(mA, tanb)) << std::endl;

    //SM->SetPoint(tanb-1, tanb, 1.21*1000);

    std::cout << "MSSM Cross Section [ggH]:" << std::endl;
    xs_eff_ggH[0] = xs.Give_Xsec_ggFA(mA, tanb)*xs.Give_BR_A_tautau(mA, tanb);
    std::cout << " -> xsec(ggA):\t" << xs.Give_Xsec_ggFA(mA, tanb) << "\t --- \t" << xs.Give_BR_A_tautau(mA, tanb) << std::endl;
    xs_eff_ggH[1] = xs.Give_Xsec_ggFH(mA, tanb)*xs.Give_BR_H_tautau(mA, tanb);
    std::cout << " -> xsec(ggH):\t" << xs.Give_Xsec_ggFH(mA, tanb) << "\t --- \t" << xs.Give_BR_H_tautau(mA, tanb) << std::endl;
    xs_eff_ggH[2] = xs.Give_Xsec_ggFh(mA, tanb)*xs.Give_BR_h_tautau(mA, tanb);
    std::cout << " -> xsec(ggh):\t" << xs.Give_Xsec_ggFh(mA, tanb) << "\t --- \t" << xs.Give_BR_h_tautau(mA, tanb) << std::endl;
    xs_eff_ggH[3] = (xs_eff_ggH[0]+xs_eff_ggH[1]+xs_eff_ggH[2]);//*1.237; 
    std::cout << "mA: "<< mA << "  tanb: "<<tanb<<" -> ggH_xsec(cmb):\t" << xs_eff_ggH[3] << std::endl;
  
    char mass_help[50];
    sprintf (mass_help, "%0.0f", mA); 
    h_ggA = get<TH1F>(inputFile, std::string("muTau_"+category+"/ggH"+mass_help).c_str());
    ggA_value=h_ggA->Integral();
    std::cout << "acc of ggA " << h_ggA->Integral() << std::endl;
    ggA->SetPoint(idx, mA, xs_eff_ggH[0]);
    ggAacc->SetPoint(idx, mA, ggA_value);

    sprintf (mass_help, "%0.0f", closest_mass(xs.Give_Mass_H(mA, tanb))); 
    h_ggH = get<TH1F>(inputFile, std::string("muTau_"+category+"/ggH"+mass_help).c_str());
    ggH_value=h_ggH->Integral();
    std::cout << "acc of ggH " << h_ggH->Integral() << std::endl;
    ggH->SetPoint(idx, mA, xs_eff_ggH[1]);
    ggHacc->SetPoint(idx, mA, ggH_value);

    sprintf (mass_help, "%0.0f", closest_mass(xs.Give_Mass_h(mA, tanb))); 
    h_ggh = get<TH1F>(inputFile, std::string("muTau_"+category+"/ggH"+mass_help).c_str());
    ggh_value=h_ggh->Integral();
    std::cout << "acc of ggh " << h_ggh->Integral() << std::endl;
    ggh->SetPoint(idx, mA, xs_eff_ggH[2]);
    gghacc->SetPoint(idx, mA, ggh_value);

    //gg->SetPoint(idx, mA, xs_eff_ggH[2]+xs_eff_ggH[1]+xs_eff_ggH[0]);
    if(mA<130) gg->SetPoint(idx, mA, xs_eff_ggH[2]+xs_eff_ggH[0]);
    else if(mA==130) gg->SetPoint(idx, mA, xs_eff_ggH[2]+xs_eff_ggH[1]+xs_eff_ggH[0]);
    else gg->SetPoint(idx, mA, xs_eff_ggH[1]+xs_eff_ggH[0]);
    //ggacc->SetPoint(idx, mA, ggh_value+ggH_value+ggA_value);
    if(mA<130) ggacc->SetPoint(idx, mA, ggh_value+ggA_value);
    else if(mA==130) ggacc->SetPoint(idx, mA, ggh_value+ggH_value+ggA_value);
    else ggacc->SetPoint(idx, mA, ggH_value+ggA_value);
    std::cout << std::endl;



    std::cout << "MSSM Cross Section [bbH]:" << std::endl;
    xs_eff_bbH[0] = xs.GiveXsec_Santander_A(mA, tanb)*xs.Give_BR_A_tautau(mA, tanb);
    std::cout << " -> xsec(ggA):\t" << xs.GiveXsec_Santander_A(mA, tanb) << "\t --- \t" << xs.Give_BR_A_tautau(mA, tanb) << std::endl;
    xs_eff_bbH[1] = xs.GiveXsec_Santander_H(mA, tanb)*xs.Give_BR_H_tautau(mA, tanb);
    std::cout << " -> xsec(bbH):\t" << xs.GiveXsec_Santander_H(mA, tanb) << "\t --- \t" << xs.Give_BR_H_tautau(mA, tanb) << std::endl;
    xs_eff_bbH[2] = xs.GiveXsec_Santander_h(mA, tanb)*xs.Give_BR_h_tautau(mA, tanb);
    std::cout << " -> xsec(ggh):\t" << xs.GiveXsec_Santander_h(mA, tanb) << "\t --- \t" << xs.Give_BR_h_tautau(mA, tanb) << std::endl;
    xs_eff_bbH[3] = (xs_eff_bbH[0]+xs_eff_bbH[1]+xs_eff_bbH[2]);//*1.627;
    std::cout << "mA: "<< mA << "  tanb: "<<tanb<<"  -> bbH_xsec(cmb):\t" << xs_eff_bbH[3] << std::endl;

    sprintf (mass_help, "%0.0f", mA); 
    h_bbA = get<TH1F>(inputFile, std::string("muTau_"+category+"/bbH"+mass_help).c_str());
    bbA_value=h_bbA->Integral();
    std::cout << "acc of bbA " << h_bbA->Integral() << std::endl;
    bbA->SetPoint(idx, mA, xs_eff_bbH[0]);
    bbAacc->SetPoint(idx, mA, bbA_value);

    sprintf (mass_help, "%0.0f", closest_mass(xs.Give_Mass_H(mA, tanb))); 
    h_bbH = get<TH1F>(inputFile, std::string("muTau_"+category+"/bbH"+mass_help).c_str());
    bbH_value=h_bbH->Integral();
    std::cout << "acc of bbH " << h_bbH->Integral() << std::endl;
    bbH->SetPoint(idx, mA, xs_eff_bbH[1]);
    bbHacc->SetPoint(idx, mA, bbH_value);

    sprintf (mass_help, "%0.0f", closest_mass(xs.Give_Mass_h(mA, tanb))); 
    h_bbh = get<TH1F>(inputFile, std::string("muTau_"+category+"/bbH"+mass_help).c_str());
    bbh_value=h_bbh->Integral();
    std::cout << "acc of bbh " << h_bbh->Integral() << std::endl;
    bbh->SetPoint(idx, mA, xs_eff_bbH[2]);
    bbhacc->SetPoint(idx, mA, bbh_value);

    //bb->SetPoint(idx, mA, xs_eff_bbH[2]+xs_eff_bbH[1]+xs_eff_bbH[0]);
    if(mA<130) bb->SetPoint(idx, mA, xs_eff_bbH[2]+xs_eff_bbH[0]);
    else if(mA==130) bb->SetPoint(idx, mA, xs_eff_bbH[2]+xs_eff_bbH[1]+xs_eff_bbH[0]);
    else bb->SetPoint(idx, mA, xs_eff_bbH[1]+xs_eff_bbH[0]); 
    //bbacc->SetPoint(idx, mA, bbh_value+bbH_value+bbA_value);
    if(mA<130) bbacc->SetPoint(idx, mA, bbh_value+bbA_value);
    else if(mA==130) bbacc->SetPoint(idx, mA, bbh_value+bbH_value+bbA_value);
    else bbacc->SetPoint(idx, mA, bbH_value+bbA_value); 		  
    std::cout << std::endl;
    std::cout << std::endl;

    h_ggA->Scale(xs_eff_ggH[0]);
    h_ggH->Scale(xs_eff_ggH[1]); 
    h_ggh->Scale(xs_eff_ggH[2]);
    h_bbA->Scale(xs_eff_bbH[0]);
    h_bbH->Scale(xs_eff_bbH[1]); 
    h_bbh->Scale(xs_eff_bbH[2]);

    h_ggA->Add(h_ggH);
    h_ggA->Add(h_ggh);    
    h_bbA->Add(h_bbH);
    h_bbA->Add(h_bbh);   
    h_bbA->Add(h_ggA);

    double significance=0;
    double significance_help=0;
    for(int nbin=0; nbin<h_bbA->GetNbinsX()+1; nbin++){ 
      if(h_background->GetBinContent(nbin)+h_bbA->GetBinContent(nbin)!=0) significance=h_bbA->GetBinContent(nbin)/sqrt(h_background->GetBinContent(nbin)+h_bbA->GetBinContent(nbin));
      else significance=0;
      //if(significance>significance_help){
      significance_help+=significance;
      //}
    }
    std::cout << "significance " << significance_help << std::endl;
    signi->SetPoint(idx, mA, significance_help);

    //destruct TH1Fs
    h_ggA->~TH1F();
    h_ggH->~TH1F(); 
    h_ggh->~TH1F();
    h_bbA->~TH1F();
    h_bbH->~TH1F(); 
    h_bbh->~TH1F();

    std::cout << std::endl;
    std::cout << std::endl;
  }			    

  /// do the drawing
  TCanvas* canv1 = new TCanvas("canv1", "xs*BR", 600, 600);
  canv1->cd();
  //canv1->SetGridx(1);
  //canv1->SetGridy(1);
  canv1->SetLeftMargin(0.15);
  canv1->SetLogy(1);

  // draw a frame to define the range
  TH1F* hr=canv1->DrawFrame(ggA->GetX()[0]-.01, 0.0001, ggA->GetX()[ggA->GetN()-1]+.01, 10000);
  // format x axis
  hr->SetXTitle("m_{A}");
  hr->GetXaxis()->SetLabelSize(0.045);
  hr->GetXaxis()->SetTitleFont(62);
  hr->GetXaxis()->SetLabelFont(62);
  hr->GetXaxis()->SetTitleColor(1);
  hr->GetXaxis()->SetTitleOffset(1.08);
  // format y axis
  hr->SetYTitle("#sigma*BR and acc*signal_{eff}*lumi");
  hr->GetXaxis()->SetTitleFont(62);
  hr->GetYaxis()->SetLabelFont(62);
  hr->GetYaxis()->SetLabelSize(0.045);
  hr->GetYaxis()->SetTitleOffset(1.6);
  hr->GetXaxis()->SetTitleColor(1);
  hr->SetNdivisions(505, "X");

  //ggA->Draw("PLsame");
  ggA->SetLineStyle(3.);
  ggA->SetLineWidth(2.); 
  ggA->SetLineColor(kBlue);
  ggA->SetMarkerStyle(23);
  ggA->SetMarkerSize(0);
  ggA->SetMarkerColor(kBlue);

  //ggH->Draw("PLsame");
  ggH->SetLineStyle(2.);
  ggH->SetLineWidth(2.); 
  ggH->SetLineColor(kBlue);
  ggH->SetMarkerStyle(22);
  ggH->SetMarkerSize(0);
  ggH->SetMarkerColor(kBlue);

  //ggh->Draw("PLsame");
  ggh->SetLineStyle(1.);
  ggh->SetLineWidth(2.); 
  ggh->SetLineColor(kBlue);
  ggh->SetMarkerStyle(20);
  ggh->SetMarkerSize(0);
  ggh->SetMarkerColor(kBlue);

   //ggAacc->Draw("PLsame");
  ggAacc->SetLineStyle(3.);
  ggAacc->SetLineWidth(2.); 
  ggAacc->SetLineColor(kMagenta);
  ggAacc->SetMarkerStyle(23);
  ggAacc->SetMarkerSize(0);
  ggAacc->SetMarkerColor(kMagenta);

  //ggHacc->Draw("PLsame");
  ggHacc->SetLineStyle(2.);
  ggHacc->SetLineWidth(2.); 
  ggHacc->SetLineColor(kMagenta);
  ggHacc->SetMarkerStyle(22);
  ggHacc->SetMarkerSize(0);
  ggHacc->SetMarkerColor(kMagenta);

  //gghacc->Draw("PLsame");
  gghacc->SetLineStyle(1.);
  gghacc->SetLineWidth(2.); 
  gghacc->SetLineColor(kMagenta);
  gghacc->SetMarkerStyle(20);
  gghacc->SetMarkerSize(0);
  gghacc->SetMarkerColor(kMagenta);

  //bbA->Draw("PLsame");
  bbA->SetLineStyle(3.);
  bbA->SetLineWidth(2.); 
  bbA->SetLineColor(kRed);
  bbA->SetMarkerStyle(23);
  bbA->SetMarkerSize(0);
  bbA->SetMarkerColor(kRed);

  //bbH->Draw("PLsame");
  bbH->SetLineStyle(2.);
  bbH->SetLineWidth(2.); 
  bbH->SetLineColor(kRed);
  bbH->SetMarkerStyle(22);
  bbH->SetMarkerSize(0);
  bbH->SetMarkerColor(kRed);

  //bbh->Draw("PLsame");
  bbh->SetLineStyle(1.);
  bbh->SetLineWidth(2.); 
  bbh->SetLineColor(kRed);
  bbh->SetMarkerStyle(20);
  bbh->SetMarkerSize(0);
  bbh->SetMarkerColor(kRed);

   //bbAacc->Draw("PLsame");
  bbAacc->SetLineStyle(3.);
  bbAacc->SetLineWidth(2.); 
  bbAacc->SetLineColor(kOrange);
  bbAacc->SetMarkerStyle(23);
  bbAacc->SetMarkerSize(0);
  bbAacc->SetMarkerColor(kOrange);

  //bbHacc->Draw("PLsame");
  bbHacc->SetLineStyle(2.);
  bbHacc->SetLineWidth(2.); 
  bbHacc->SetLineColor(kOrange);
  bbHacc->SetMarkerStyle(22);
  bbHacc->SetMarkerSize(0);
  bbHacc->SetMarkerColor(kOrange);

  //bbhacc->Draw("PLsame");
  bbhacc->SetLineStyle(1.);
  bbhacc->SetLineWidth(2.); 
  bbhacc->SetLineColor(kOrange);
  bbhacc->SetMarkerStyle(20);
  bbhacc->SetMarkerSize(0);
  bbhacc->SetMarkerColor(kOrange);
  
  gg->Draw("PLsame");
  gg->SetLineStyle(1.);
  gg->SetLineWidth(3.); 
  gg->SetLineColor(kBlue+2);
  gg->SetMarkerStyle(20);
  gg->SetMarkerSize(0);
  gg->SetMarkerColor(kBlue+2);

  ggacc->Draw("PLsame");
  ggacc->SetLineStyle(1.);
  ggacc->SetLineWidth(3.); 
  ggacc->SetLineColor(kMagenta);
  ggacc->SetMarkerStyle(20);
  ggacc->SetMarkerSize(0);
  ggacc->SetMarkerColor(kMagenta);

  bb->Draw("PLsame");
  bb->SetLineStyle(1.);
  bb->SetLineWidth(3.); 
  bb->SetLineColor(kRed+2);
  bb->SetMarkerStyle(20);
  bb->SetMarkerSize(0);
  bb->SetMarkerColor(kRed+2);

  bbacc->Draw("PLsame");
  bbacc->SetLineStyle(1.);
  bbacc->SetLineWidth(3.); 
  bbacc->SetLineColor(kOrange);
  bbacc->SetMarkerStyle(20);
  bbacc->SetMarkerSize(0);
  bbacc->SetMarkerColor(kOrange);

  /*SM->Draw("PLsame");
  SM->SetLineStyle(8.);
  SM->SetLineWidth(3.); 
  SM->SetLineColor(kGreen+1);
  SM->SetMarkerStyle(20);
  SM->SetMarkerSize(0);
  SM->SetMarkerColor(kGreen+1);*/

  // signi->Draw("PLsame");
  signi->SetLineStyle(1.);
  signi->SetLineWidth(2.); 
  signi->SetLineColor(kBlack);
  signi->SetMarkerStyle(20);
  signi->SetMarkerSize(0);
  signi->SetMarkerColor(kBlack);

  TLegend* leg0;
  /// setup the CMS Preliminary
  //std::ostringstream ss;
  //ss << mA;
  //std::string s(ss.str());
  std::string tanb_string = std::to_string((int)tanb);
  CMSPrelim(std::string("#events,   m^{h}_{max} scenario,  tan#beta = " + tanb_string).c_str(), "", 0.15, 0.835);
  leg0 = new TLegend(0.58, 0.12, 0.90, 0.32); 
  leg0->SetBorderSize( 0 );
  leg0->SetFillStyle ( 1001 );
  leg0->SetFillColor (kWhite);
  //leg0->SetHeader( "#sigma * BR" );
  //leg0->AddEntry( SM,  "ggH_{SM} #rightarrow #tau#tau",  "PL" );

  //leg0->AddEntry( gghacc, "ggh #sigma*BR",  "PL" );
  //leg0->AddEntry( ggAacc, "ggA #sigma*BR",  "PL" );
  //leg0->AddEntry( ggHacc, "ggH #sigma*BR",  "PL" );
  leg0->AddEntry( gg,  "gg #sigma*BR",  "PL" );

  //leg0->AddEntry( ggh, "ggh acc*s_{eff}*lumi",  "PL" );
  //leg0->AddEntry( ggA, "ggA acc*s_{eff}*lumi",  "PL" );
  //leg0->AddEntry( ggH, "ggH acc*sl_{eff}*lumi",  "PL" );
  leg0->AddEntry( ggacc,  "gg acc*s_{eff}*lumi",  "PL" );

  //leg0->AddEntry( bbh, "bbh #sigma*BR",  "PL" );
  //leg0->AddEntry( bbA, "bbA #sigma*BR",  "PL" );
  //leg0->AddEntry( bbH, "bbH #sigma*BR",  "PL" );
  leg0->AddEntry( bb,  "bb #sigma*BR",  "PL" );

  //leg0->AddEntry( bbhacc, "bbh acc*s_{eff}*lumi",  "PL" );
  //leg0->AddEntry( bbAacc, "bbA acc*s_{eff}*lumi",  "PL" );
  //leg0->AddEntry( bbHacc, "bbH acc*s_{eff}*lumi",  "PL" );
  leg0->AddEntry( bbacc,  "bb acc*s_{eff}*lumi",  "PL" );

  //leg0->AddEntry( signi,  "sum of all bins: s/sqrt(s+b)",  "PL" );
  leg0->Draw("same");
  
  canv1->Print("xsBRtimesacc.png");
  canv1->Print("xsBRtimesacc.pdf");
return;
}
Exemplo n.º 17
0
void fitLMC_c070116_LL1_fixed()
{
//=========Macro generated from canvas: c1/data fits
//=========  (Wed Jul  6 01:24:19 2016) by ROOT version6.06/02
   TCanvas *c1 = new TCanvas("c1", "data fits",0,0,1200,800);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   c1->Range(0,0,1,1);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.14);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.05);
   c1->SetBottomMargin(0.16);
   c1->SetFrameLineWidth(2);
   c1->SetFrameBorderMode(0);
  
// ------------>Primitives in pad: pad2
   TPad *pad2 = new TPad("pad2", "pad2",0,0,1,0.3);
   pad2->Draw();
   pad2->cd();
   pad2->Range(3754.321,-26.4,6223.457,8.8);
   pad2->SetFillColor(0);
   pad2->SetBorderMode(0);
   pad2->SetBorderSize(2);
   pad2->SetTickx(1);
   pad2->SetTicky(1);
   pad2->SetLeftMargin(0.14);
   pad2->SetRightMargin(0.05);
   pad2->SetTopMargin(0);
   pad2->SetBottomMargin(0.5);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   pad2->SetFrameLineWidth(2);
   pad2->SetFrameBorderMode(0);
   
   TH1D *frame_49b0a70__1 = new TH1D("frame_49b0a70__1","",100,4100,6100);
   frame_49b0a70__1->SetBinContent(1,15.15556);
   frame_49b0a70__1->SetMinimum(-8.8);
   frame_49b0a70__1->SetMaximum(8.8);
   frame_49b0a70__1->SetEntries(1);
   frame_49b0a70__1->SetDirectory(0);
   frame_49b0a70__1->SetStats(0);
   frame_49b0a70__1->SetLineWidth(2);
   frame_49b0a70__1->SetMarkerStyle(20);
   frame_49b0a70__1->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_49b0a70__1->GetXaxis()->SetNdivisions(505);
   frame_49b0a70__1->GetXaxis()->SetLabelFont(132);
   frame_49b0a70__1->GetXaxis()->SetLabelOffset(0.01);
   frame_49b0a70__1->GetXaxis()->SetLabelSize(0.15);
   frame_49b0a70__1->GetXaxis()->SetTitleSize(0.2);
   frame_49b0a70__1->GetXaxis()->SetTitleOffset(1.1);
   frame_49b0a70__1->GetXaxis()->SetTitleFont(132);
   frame_49b0a70__1->GetYaxis()->SetTitle("Pull");
   frame_49b0a70__1->GetYaxis()->CenterTitle(true);
   frame_49b0a70__1->GetYaxis()->SetNdivisions(505);
   frame_49b0a70__1->GetYaxis()->SetLabelFont(132);
   frame_49b0a70__1->GetYaxis()->SetLabelOffset(0.01);
   frame_49b0a70__1->GetYaxis()->SetLabelSize(0.15);
   frame_49b0a70__1->GetYaxis()->SetTitleSize(0.15);
   frame_49b0a70__1->GetYaxis()->SetTitleOffset(0.45);
   frame_49b0a70__1->GetYaxis()->SetTitleFont(132);
   frame_49b0a70__1->GetZaxis()->SetLabelFont(132);
   frame_49b0a70__1->GetZaxis()->SetLabelSize(0.06);
   frame_49b0a70__1->GetZaxis()->SetTitleSize(0.072);
   frame_49b0a70__1->GetZaxis()->SetTitleOffset(1.2);
   frame_49b0a70__1->GetZaxis()->SetTitleFont(132);
   frame_49b0a70__1->Draw("FUNC");
   
   Double_t pull_Hist_curvetot_fx3001[87] = {
   4310,
   4330,
   4350,
   4370,
   4390,
   4410,
   4430,
   4450,
   4470,
   4490,
   4510,
   4530,
   4550,
   4570,
   4590,
   4610,
   4630,
   4650,
   4670,
   4690,
   4710,
   4730,
   4750,
   4770,
   4790,
   4810,
   4830,
   4850,
   4870,
   4890,
   4910,
   4930,
   4950,
   4970,
   4990,
   5010,
   5030,
   5050,
   5070,
   5090,
   5110,
   5130,
   5150,
   5170,
   5190,
   5210,
   5230,
   5250,
   5270,
   5290,
   5310,
   5330,
   5350,
   5370,
   5390,
   5410,
   5430,
   5450,
   5470,
   5490,
   5510,
   5530,
   5550,
   5570,
   5590,
   5610,
   5630,
   5650,
   5670,
   5690,
   5710,
   5730,
   5750,
   5770,
   5790,
   5810,
   5830,
   5850,
   5870,
   5890,
   5910,
   5930,
   5950,
   5970,
   5990,
   6010,
   6030};
   Double_t pull_Hist_curvetot_fy3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   -1.479619,
   -1.51688,
   -3.563535,
   13.21655,
   13.104,
   -2.777424,
   -1.828045,
   -1.630891,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_felx3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fely3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehx3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t pull_Hist_curvetot_fehy3001[87] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   1,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   TGraphAsymmErrors *grae = new TGraphAsymmErrors(87,pull_Hist_curvetot_fx3001,pull_Hist_curvetot_fy3001,pull_Hist_curvetot_felx3001,pull_Hist_curvetot_fehx3001,pull_Hist_curvetot_fely3001,pull_Hist_curvetot_fehy3001);
   grae->SetName("pull_Hist_curvetot");
   grae->SetTitle("Pull of Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr and Projection of totalPdf");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_pull_Hist_curvetot3001 = new TH1F("Graph_pull_Hist_curvetot3001","Pull of Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr and Projection of totalPdf",100,4138,6202);
   Graph_pull_Hist_curvetot3001->SetMinimum(-6.441544);
   Graph_pull_Hist_curvetot3001->SetMaximum(16.09456);
   Graph_pull_Hist_curvetot3001->SetDirectory(0);
   Graph_pull_Hist_curvetot3001->SetStats(0);
   Graph_pull_Hist_curvetot3001->SetLineWidth(2);
   Graph_pull_Hist_curvetot3001->SetMarkerStyle(20);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetNdivisions(505);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetXaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelOffset(0.01);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleOffset(0.95);
   Graph_pull_Hist_curvetot3001->GetYaxis()->SetTitleFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelFont(132);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetLabelSize(0.06);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleSize(0.072);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleOffset(1.2);
   Graph_pull_Hist_curvetot3001->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_pull_Hist_curvetot3001);
   
   grae->Draw("p");
   
   TH1D *frame_49b0a70__2 = new TH1D("frame_49b0a70__2","",100,4100,6100);
   frame_49b0a70__2->SetBinContent(1,15.15556);
   frame_49b0a70__2->SetMinimum(-8.8);
   frame_49b0a70__2->SetMaximum(8.8);
   frame_49b0a70__2->SetEntries(1);
   frame_49b0a70__2->SetDirectory(0);
   frame_49b0a70__2->SetStats(0);
   frame_49b0a70__2->SetLineWidth(2);
   frame_49b0a70__2->SetMarkerStyle(20);
   frame_49b0a70__2->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_49b0a70__2->GetXaxis()->SetNdivisions(505);
   frame_49b0a70__2->GetXaxis()->SetLabelFont(132);
   frame_49b0a70__2->GetXaxis()->SetLabelOffset(0.01);
   frame_49b0a70__2->GetXaxis()->SetLabelSize(0.15);
   frame_49b0a70__2->GetXaxis()->SetTitleSize(0.2);
   frame_49b0a70__2->GetXaxis()->SetTitleOffset(1.1);
   frame_49b0a70__2->GetXaxis()->SetTitleFont(132);
   frame_49b0a70__2->GetYaxis()->SetTitle("Pull");
   frame_49b0a70__2->GetYaxis()->CenterTitle(true);
   frame_49b0a70__2->GetYaxis()->SetNdivisions(505);
   frame_49b0a70__2->GetYaxis()->SetLabelFont(132);
   frame_49b0a70__2->GetYaxis()->SetLabelOffset(0.01);
   frame_49b0a70__2->GetYaxis()->SetLabelSize(0.15);
   frame_49b0a70__2->GetYaxis()->SetTitleSize(0.15);
   frame_49b0a70__2->GetYaxis()->SetTitleOffset(0.45);
   frame_49b0a70__2->GetYaxis()->SetTitleFont(132);
   frame_49b0a70__2->GetZaxis()->SetLabelFont(132);
   frame_49b0a70__2->GetZaxis()->SetLabelSize(0.06);
   frame_49b0a70__2->GetZaxis()->SetTitleSize(0.072);
   frame_49b0a70__2->GetZaxis()->SetTitleOffset(1.2);
   frame_49b0a70__2->GetZaxis()->SetTitleFont(132);
   frame_49b0a70__2->Draw("AXISSAME");
   pad2->Modified();
   c1->cd();
  
// ------------>Primitives in pad: pad1
   TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1);
   pad1->Draw();
   pad1->cd();
   pad1->Range(3754.321,0,6223.457,4.122406);
   pad1->SetFillColor(0);
   pad1->SetBorderMode(0);
   pad1->SetBorderSize(2);
   pad1->SetLogy();
   pad1->SetTickx(1);
   pad1->SetTicky(1);
   pad1->SetLeftMargin(0.14);
   pad1->SetRightMargin(0.05);
   pad1->SetTopMargin(0.06);
   pad1->SetBottomMargin(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   pad1->SetFrameLineWidth(2);
   pad1->SetFrameBorderMode(0);
   
   TH1D *frame_4ae8890__3 = new TH1D("frame_4ae8890__3","A RooPlot of \"m(J/#psi #Lambda)\"",100,4100,6100);
   frame_4ae8890__3->SetBinContent(1,3622.221);
   frame_4ae8890__3->SetMinimum(1);
   frame_4ae8890__3->SetMaximum(7500);
   frame_4ae8890__3->SetEntries(2);
   frame_4ae8890__3->SetDirectory(0);
   frame_4ae8890__3->SetStats(0);
   frame_4ae8890__3->SetLineWidth(2);
   frame_4ae8890__3->SetMarkerStyle(20);
   frame_4ae8890__3->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_4ae8890__3->GetXaxis()->SetNdivisions(505);
   frame_4ae8890__3->GetXaxis()->SetLabelFont(132);
   frame_4ae8890__3->GetXaxis()->SetLabelOffset(0.01);
   frame_4ae8890__3->GetXaxis()->SetLabelSize(0.06);
   frame_4ae8890__3->GetXaxis()->SetTitleSize(0.072);
   frame_4ae8890__3->GetXaxis()->SetTitleOffset(0.95);
   frame_4ae8890__3->GetXaxis()->SetTitleFont(132);
   frame_4ae8890__3->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4ae8890__3->GetYaxis()->SetLabelFont(132);
   frame_4ae8890__3->GetYaxis()->SetLabelOffset(0.01);
   frame_4ae8890__3->GetYaxis()->SetLabelSize(0.06);
   frame_4ae8890__3->GetYaxis()->SetTitleSize(0.072);
   frame_4ae8890__3->GetYaxis()->SetTitleOffset(0.95);
   frame_4ae8890__3->GetYaxis()->SetTitleFont(132);
   frame_4ae8890__3->GetZaxis()->SetLabelFont(132);
   frame_4ae8890__3->GetZaxis()->SetLabelSize(0.06);
   frame_4ae8890__3->GetZaxis()->SetTitleSize(0.072);
   frame_4ae8890__3->GetZaxis()->SetTitleOffset(1.2);
   frame_4ae8890__3->GetZaxis()->SetTitleFont(132);
   frame_4ae8890__3->Draw("FUNC");
   
   Double_t Hist_fx3002[100] = {
   4110,
   4130,
   4150,
   4170,
   4190,
   4210,
   4230,
   4250,
   4270,
   4290,
   4310,
   4330,
   4350,
   4370,
   4390,
   4410,
   4430,
   4450,
   4470,
   4490,
   4510,
   4530,
   4550,
   4570,
   4590,
   4610,
   4630,
   4650,
   4670,
   4690,
   4710,
   4730,
   4750,
   4770,
   4790,
   4810,
   4830,
   4850,
   4870,
   4890,
   4910,
   4930,
   4950,
   4970,
   4990,
   5010,
   5030,
   5050,
   5070,
   5090,
   5110,
   5130,
   5150,
   5170,
   5190,
   5210,
   5230,
   5250,
   5270,
   5290,
   5310,
   5330,
   5350,
   5370,
   5390,
   5410,
   5430,
   5450,
   5470,
   5490,
   5510,
   5530,
   5550,
   5570,
   5590,
   5610,
   5630,
   5650,
   5670,
   5690,
   5710,
   5730,
   5750,
   5770,
   5790,
   5810,
   5830,
   5850,
   5870,
   5890,
   5910,
   5930,
   5950,
   5970,
   5990,
   6010,
   6030,
   6050,
   6070,
   6090};
   Double_t Hist_fy3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   5,
   30,
   1308,
   1283,
   36,
   7,
   2,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Hist_felx3002[100] = {
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10};
   Double_t Hist_fely3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   2.236068,
   5.477226,
   36.16628,
   35.81899,
   6,
   2.645751,
   1.414214,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   Double_t Hist_fehx3002[100] = {
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10,
   10};
   Double_t Hist_fehy3002[100] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   1,
   2.236068,
   5.477226,
   36.16628,
   35.81899,
   6,
   2.645751,
   1.414214,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   grae = new TGraphAsymmErrors(100,Hist_fx3002,Hist_fy3002,Hist_felx3002,Hist_fehx3002,Hist_fely3002,Hist_fehy3002);
   grae->SetName("Hist");
   grae->SetTitle("Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr");
   grae->SetFillColor(1);
   grae->SetLineWidth(2);
   grae->SetMarkerStyle(8);
   
   TH1F *Graph_Hist3002 = new TH1F("Graph_Hist3002","Histogram of LMC_plot__Bs_LOKI_MASS_JpsiConstr",100,3900,6300);
   Graph_Hist3002->SetMinimum(1.478583);
   Graph_Hist3002->SetMaximum(1478.583);
   Graph_Hist3002->SetDirectory(0);
   Graph_Hist3002->SetStats(0);
   Graph_Hist3002->SetLineWidth(2);
   Graph_Hist3002->SetMarkerStyle(20);
   Graph_Hist3002->GetXaxis()->SetNdivisions(505);
   Graph_Hist3002->GetXaxis()->SetLabelFont(132);
   Graph_Hist3002->GetXaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetXaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetXaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetXaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetXaxis()->SetTitleFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelFont(132);
   Graph_Hist3002->GetYaxis()->SetLabelOffset(0.01);
   Graph_Hist3002->GetYaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetYaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetYaxis()->SetTitleOffset(0.95);
   Graph_Hist3002->GetYaxis()->SetTitleFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelFont(132);
   Graph_Hist3002->GetZaxis()->SetLabelSize(0.06);
   Graph_Hist3002->GetZaxis()->SetTitleSize(0.072);
   Graph_Hist3002->GetZaxis()->SetTitleOffset(1.2);
   Graph_Hist3002->GetZaxis()->SetTitleFont(132);
   grae->SetHistogram(Graph_Hist3002);
   
   grae->Draw("p");
   
   Double_t curvetot_fx1[128] = {
   4300,
   4317.4,
   4334.8,
   4352.2,
   4369.6,
   4387,
   4404.4,
   4421.8,
   4439.2,
   4456.6,
   4474,
   4491.4,
   4508.8,
   4526.2,
   4543.6,
   4561,
   4578.4,
   4595.8,
   4613.2,
   4630.6,
   4648,
   4665.4,
   4682.8,
   4700.2,
   4717.6,
   4735,
   4752.4,
   4769.8,
   4787.2,
   4804.6,
   4822,
   4839.4,
   4856.8,
   4874.2,
   4891.6,
   4909,
   4926.4,
   4943.8,
   4961.2,
   4978.6,
   4996,
   5013.4,
   5030.8,
   5048.2,
   5065.6,
   5083,
   5100.4,
   5117.8,
   5135.2,
   5152.6,
   5170,
   5187.4,
   5204.8,
   5222.2,
   5239.6,
   5257,
   5274.4,
   5291.8,
   5309.2,
   5326.6,
   5344,
   5361.4,
   5378.8,
   5396.2,
   5413.6,
   5431,
   5448.4,
   5465.8,
   5483.2,
   5500.6,
   5518,
   5535.4,
   5552.8,
   5570.2,
   5578.9,
   5587.6,
   5591.95,
   5594.125,
   5596.3,
   5598.475,
   5600.65,
   5602.825,
   5605,
   5607.175,
   5609.35,
   5611.525,
   5613.7,
   5615.875,
   5618.05,
   5620.225,
   5622.4,
   5624.575,
   5626.75,
   5628.925,
   5631.1,
   5633.275,
   5635.45,
   5637.625,
   5639.8,
   5641.975,
   5644.15,
   5648.5,
   5652.85,
   5657.2,
   5665.9,
   5674.6,
   5692,
   5709.4,
   5726.8,
   5744.2,
   5761.6,
   5779,
   5796.4,
   5813.8,
   5831.2,
   5848.6,
   5866,
   5883.4,
   5900.8,
   5918.2,
   5935.6,
   5953,
   5970.4,
   5987.8,
   6005.2,
   6022.6,
   6040,
   6040};
   Double_t curvetot_fy1[128] = {
   5.866957e-06,
   6.237309e-06,
   6.636442e-06,
   7.067024e-06,
   7.532012e-06,
   8.034688e-06,
   8.578697e-06,
   9.168097e-06,
   9.80741e-06,
   1.050168e-05,
   1.125657e-05,
   1.207838e-05,
   1.297421e-05,
   1.395203e-05,
   1.502083e-05,
   1.619071e-05,
   1.747312e-05,
   1.888102e-05,
   2.04291e-05,
   2.213408e-05,
   2.401502e-05,
   2.609366e-05,
   2.839493e-05,
   3.094741e-05,
   3.3784e-05,
   3.694266e-05,
   4.046727e-05,
   4.440878e-05,
   4.882641e-05,
   5.378932e-05,
   5.937845e-05,
   6.568888e-05,
   7.283266e-05,
   8.094235e-05,
   9.017537e-05,
   0.0001007193,
   0.0001127988,
   0.0001266839,
   0.0001427007,
   0.0001612447,
   0.0001827987,
   0.0002079542,
   0.0002374407,
   0.0002721627,
   0.0003132491,
   0.000362118,
   0.0004205632,
   0.0004908709,
   0.0005759783,
   0.0006796908,
   0.0008069837,
   0.0009644255,
   0.00116078,
   0.001407872,
   0.001721855,
   0.002125087,
   0.002648971,
   0.003338309,
   0.004258149,
   0.005504759,
   0.007223673,
   0.009640192,
   0.01311252,
   0.0182276,
   0.02598079,
   0.0381283,
   0.05791482,
   0.09167022,
   0.1525742,
   0.2703418,
   0.5189787,
   1.108041,
   2.742661,
   8.457535,
   16.77478,
   37.44632,
   59.32676,
   76.04852,
   98.85523,
   130.5273,
   175.4113,
   240.4947,
   337.3712,
   485.9433,
   719.5827,
   1089.077,
   1654.354,
   2420.76,
   3177.209,
   3449.734,
   3004.78,
   2206.85,
   1485.016,
   975.7787,
   647.7065,
   440.4788,
   308.1264,
   221.6172,
   163.5403,
   123.4982,
   95.19023,
   59.59094,
   39.50438,
   27.41171,
   14.6509,
   8.678992,
   3.738562,
   1.925852,
   1.114645,
   0.7001293,
   0.4672215,
   0.3266777,
   0.2370212,
   0.1772217,
   0.1358539,
   0.1063516,
   0.08476161,
   0.06860831,
   0.05628833,
   0.04673265,
   0.03921016,
   0.03320952,
   0.02836591,
   0.02441438,
   0.02115941,
   0.01845459,
   0.01618888,
   0.01618888};
   TGraph *graph = new TGraph(128,curvetot_fx1,curvetot_fy1);
   graph->SetName("curvetot");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_curvetot1 = new TH1F("Graph_curvetot1","Projection of totalPdf",128,4126,6214);
   Graph_curvetot1->SetMinimum(5.280262e-06);
   Graph_curvetot1->SetMaximum(3794.708);
   Graph_curvetot1->SetDirectory(0);
   Graph_curvetot1->SetStats(0);
   Graph_curvetot1->SetLineWidth(2);
   Graph_curvetot1->SetMarkerStyle(20);
   Graph_curvetot1->GetXaxis()->SetNdivisions(505);
   Graph_curvetot1->GetXaxis()->SetLabelFont(132);
   Graph_curvetot1->GetXaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetXaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetXaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetXaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetXaxis()->SetTitleFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelFont(132);
   Graph_curvetot1->GetYaxis()->SetLabelOffset(0.01);
   Graph_curvetot1->GetYaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetYaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetYaxis()->SetTitleOffset(0.95);
   Graph_curvetot1->GetYaxis()->SetTitleFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelFont(132);
   Graph_curvetot1->GetZaxis()->SetLabelSize(0.06);
   Graph_curvetot1->GetZaxis()->SetTitleSize(0.072);
   Graph_curvetot1->GetZaxis()->SetTitleOffset(1.2);
   Graph_curvetot1->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_curvetot1);
   
   graph->Draw("l");
   
   Double_t sigL_fx2[128] = {
   4300,
   4317.4,
   4334.8,
   4352.2,
   4369.6,
   4387,
   4404.4,
   4421.8,
   4439.2,
   4456.6,
   4474,
   4491.4,
   4508.8,
   4526.2,
   4543.6,
   4561,
   4578.4,
   4595.8,
   4613.2,
   4630.6,
   4648,
   4665.4,
   4682.8,
   4700.2,
   4717.6,
   4735,
   4752.4,
   4769.8,
   4787.2,
   4804.6,
   4822,
   4839.4,
   4856.8,
   4874.2,
   4891.6,
   4909,
   4926.4,
   4943.8,
   4961.2,
   4978.6,
   4996,
   5013.4,
   5030.8,
   5048.2,
   5065.6,
   5083,
   5100.4,
   5117.8,
   5135.2,
   5152.6,
   5170,
   5187.4,
   5204.8,
   5222.2,
   5239.6,
   5257,
   5274.4,
   5291.8,
   5309.2,
   5326.6,
   5344,
   5361.4,
   5378.8,
   5396.2,
   5413.6,
   5431,
   5448.4,
   5465.8,
   5483.2,
   5500.6,
   5518,
   5535.4,
   5552.8,
   5570.2,
   5578.9,
   5587.6,
   5591.95,
   5594.125,
   5596.3,
   5598.475,
   5600.65,
   5602.825,
   5605,
   5607.175,
   5609.35,
   5611.525,
   5613.7,
   5615.875,
   5618.05,
   5620.225,
   5622.4,
   5624.575,
   5626.75,
   5628.925,
   5631.1,
   5633.275,
   5635.45,
   5637.625,
   5639.8,
   5641.975,
   5644.15,
   5648.5,
   5652.85,
   5657.2,
   5665.9,
   5674.6,
   5692,
   5709.4,
   5726.8,
   5744.2,
   5761.6,
   5779,
   5796.4,
   5813.8,
   5831.2,
   5848.6,
   5866,
   5883.4,
   5900.8,
   5918.2,
   5935.6,
   5953,
   5970.4,
   5987.8,
   6005.2,
   6022.6,
   6040,
   6040};
   Double_t sigL_fy2[128] = {
   5.866957e-06,
   6.237309e-06,
   6.636442e-06,
   7.067024e-06,
   7.532012e-06,
   8.034688e-06,
   8.578697e-06,
   9.168097e-06,
   9.80741e-06,
   1.050168e-05,
   1.125657e-05,
   1.207838e-05,
   1.297421e-05,
   1.395203e-05,
   1.502083e-05,
   1.619071e-05,
   1.747312e-05,
   1.888102e-05,
   2.04291e-05,
   2.213408e-05,
   2.401502e-05,
   2.609366e-05,
   2.839493e-05,
   3.094741e-05,
   3.3784e-05,
   3.694266e-05,
   4.046727e-05,
   4.440878e-05,
   4.882641e-05,
   5.378932e-05,
   5.937845e-05,
   6.568888e-05,
   7.283266e-05,
   8.094235e-05,
   9.017537e-05,
   0.0001007193,
   0.0001127988,
   0.0001266839,
   0.0001427007,
   0.0001612447,
   0.0001827987,
   0.0002079542,
   0.0002374407,
   0.0002721627,
   0.0003132491,
   0.000362118,
   0.0004205632,
   0.0004908709,
   0.0005759783,
   0.0006796908,
   0.0008069837,
   0.0009644255,
   0.00116078,
   0.001407872,
   0.001721855,
   0.002125087,
   0.002648971,
   0.003338309,
   0.004258149,
   0.005504759,
   0.007223673,
   0.009640192,
   0.01311252,
   0.0182276,
   0.02598079,
   0.0381283,
   0.05791482,
   0.09167022,
   0.1525742,
   0.2703418,
   0.5189787,
   1.108041,
   2.742661,
   8.457535,
   16.77478,
   37.44632,
   59.32676,
   76.04852,
   98.85523,
   130.5273,
   175.4113,
   240.4947,
   337.3712,
   485.9433,
   719.5827,
   1089.077,
   1654.354,
   2420.76,
   3177.209,
   3449.734,
   3004.78,
   2206.85,
   1485.016,
   975.7787,
   647.7065,
   440.4788,
   308.1264,
   221.6172,
   163.5403,
   123.4982,
   95.19023,
   59.59094,
   39.50438,
   27.41171,
   14.6509,
   8.678992,
   3.738562,
   1.925852,
   1.114645,
   0.7001293,
   0.4672215,
   0.3266777,
   0.2370212,
   0.1772217,
   0.1358539,
   0.1063516,
   0.08476161,
   0.06860831,
   0.05628833,
   0.04673265,
   0.03921016,
   0.03320952,
   0.02836591,
   0.02441438,
   0.02115941,
   0.01845459,
   0.01618888,
   0.01618888};
   graph = new TGraph(128,sigL_fx2,sigL_fy2);
   graph->SetName("sigL");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(2);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_sigL2 = new TH1F("Graph_sigL2","Projection of totalPdf",128,4126,6214);
   Graph_sigL2->SetMinimum(5.280262e-06);
   Graph_sigL2->SetMaximum(3794.708);
   Graph_sigL2->SetDirectory(0);
   Graph_sigL2->SetStats(0);
   Graph_sigL2->SetLineWidth(2);
   Graph_sigL2->SetMarkerStyle(20);
   Graph_sigL2->GetXaxis()->SetNdivisions(505);
   Graph_sigL2->GetXaxis()->SetLabelFont(132);
   Graph_sigL2->GetXaxis()->SetLabelOffset(0.01);
   Graph_sigL2->GetXaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetXaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetXaxis()->SetTitleOffset(0.95);
   Graph_sigL2->GetXaxis()->SetTitleFont(132);
   Graph_sigL2->GetYaxis()->SetLabelFont(132);
   Graph_sigL2->GetYaxis()->SetLabelOffset(0.01);
   Graph_sigL2->GetYaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetYaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetYaxis()->SetTitleOffset(0.95);
   Graph_sigL2->GetYaxis()->SetTitleFont(132);
   Graph_sigL2->GetZaxis()->SetLabelFont(132);
   Graph_sigL2->GetZaxis()->SetLabelSize(0.06);
   Graph_sigL2->GetZaxis()->SetTitleSize(0.072);
   Graph_sigL2->GetZaxis()->SetTitleOffset(1.2);
   Graph_sigL2->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_sigL2);
   
   graph->Draw("l");
   
   Double_t bkg_fx3[102] = {
   4300,
   4317.4,
   4334.8,
   4352.2,
   4369.6,
   4387,
   4404.4,
   4421.8,
   4439.2,
   4456.6,
   4474,
   4491.4,
   4508.8,
   4526.2,
   4543.6,
   4561,
   4578.4,
   4595.8,
   4613.2,
   4630.6,
   4648,
   4665.4,
   4682.8,
   4700.2,
   4717.6,
   4735,
   4752.4,
   4769.8,
   4787.2,
   4804.6,
   4822,
   4839.4,
   4856.8,
   4874.2,
   4891.6,
   4909,
   4926.4,
   4943.8,
   4961.2,
   4978.6,
   4996,
   5013.4,
   5030.8,
   5048.2,
   5065.6,
   5083,
   5100.4,
   5117.8,
   5135.2,
   5152.6,
   5170,
   5187.4,
   5204.8,
   5222.2,
   5239.6,
   5257,
   5274.4,
   5291.8,
   5309.2,
   5326.6,
   5344,
   5361.4,
   5378.8,
   5396.2,
   5413.6,
   5431,
   5448.4,
   5465.8,
   5483.2,
   5500.6,
   5518,
   5535.4,
   5552.8,
   5570.2,
   5587.6,
   5605,
   5622.4,
   5639.8,
   5657.2,
   5674.6,
   5692,
   5709.4,
   5726.8,
   5744.2,
   5761.6,
   5779,
   5796.4,
   5813.8,
   5831.2,
   5848.6,
   5866,
   5883.4,
   5900.8,
   5918.2,
   5935.6,
   5953,
   5970.4,
   5987.8,
   6005.2,
   6022.6,
   6040,
   6040};
   Double_t bkg_fy3[102] = {
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0,
   0};
   graph = new TGraph(102,bkg_fx3,bkg_fy3);
   graph->SetName("bkg");
   graph->SetTitle("Projection of totalPdf");
   graph->SetFillColor(1);
   graph->SetLineColor(3);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   graph->SetMarkerStyle(20);
   
   TH1F *Graph_bkg3 = new TH1F("Graph_bkg3","Projection of totalPdf",102,4126,6214);
   Graph_bkg3->SetMinimum(0.0011);
   Graph_bkg3->SetMaximum(1.1);
   Graph_bkg3->SetDirectory(0);
   Graph_bkg3->SetStats(0);
   Graph_bkg3->SetLineWidth(2);
   Graph_bkg3->SetMarkerStyle(20);
   Graph_bkg3->GetXaxis()->SetNdivisions(505);
   Graph_bkg3->GetXaxis()->SetLabelFont(132);
   Graph_bkg3->GetXaxis()->SetLabelOffset(0.01);
   Graph_bkg3->GetXaxis()->SetLabelSize(0.06);
   Graph_bkg3->GetXaxis()->SetTitleSize(0.072);
   Graph_bkg3->GetXaxis()->SetTitleOffset(0.95);
   Graph_bkg3->GetXaxis()->SetTitleFont(132);
   Graph_bkg3->GetYaxis()->SetLabelFont(132);
   Graph_bkg3->GetYaxis()->SetLabelOffset(0.01);
   Graph_bkg3->GetYaxis()->SetLabelSize(0.06);
   Graph_bkg3->GetYaxis()->SetTitleSize(0.072);
   Graph_bkg3->GetYaxis()->SetTitleOffset(0.95);
   Graph_bkg3->GetYaxis()->SetTitleFont(132);
   Graph_bkg3->GetZaxis()->SetLabelFont(132);
   Graph_bkg3->GetZaxis()->SetLabelSize(0.06);
   Graph_bkg3->GetZaxis()->SetTitleSize(0.072);
   Graph_bkg3->GetZaxis()->SetTitleOffset(1.2);
   Graph_bkg3->GetZaxis()->SetTitleFont(132);
   graph->SetHistogram(Graph_bkg3);
   
   graph->Draw("l");
   
   TLegend *leg = new TLegend(0.2,0.02,0.4,0.42,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextFont(132);
   leg->SetTextSize(0.06);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(2);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("curvetot","Total PDF","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("sigL","#Lambda signal (hypatia)","l");
   entry->SetLineColor(2);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   entry=leg->AddEntry("bkg","Background","l");
   entry->SetLineColor(3);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(132);
   leg->Draw();
   
   TH1D *frame_4ae8890__4 = new TH1D("frame_4ae8890__4","A RooPlot of \"m(J/#psi #Lambda)\"",100,4100,6100);
   frame_4ae8890__4->SetBinContent(1,3622.221);
   frame_4ae8890__4->SetMinimum(1);
   frame_4ae8890__4->SetMaximum(7500);
   frame_4ae8890__4->SetEntries(2);
   frame_4ae8890__4->SetDirectory(0);
   frame_4ae8890__4->SetStats(0);
   frame_4ae8890__4->SetLineWidth(2);
   frame_4ae8890__4->SetMarkerStyle(20);
   frame_4ae8890__4->GetXaxis()->SetTitle("m(J/#psi #Lambda) (MeV)");
   frame_4ae8890__4->GetXaxis()->SetNdivisions(505);
   frame_4ae8890__4->GetXaxis()->SetLabelFont(132);
   frame_4ae8890__4->GetXaxis()->SetLabelOffset(0.01);
   frame_4ae8890__4->GetXaxis()->SetLabelSize(0.06);
   frame_4ae8890__4->GetXaxis()->SetTitleSize(0.072);
   frame_4ae8890__4->GetXaxis()->SetTitleOffset(0.95);
   frame_4ae8890__4->GetXaxis()->SetTitleFont(132);
   frame_4ae8890__4->GetYaxis()->SetTitle("Events/(5 MeV)");
   frame_4ae8890__4->GetYaxis()->SetLabelFont(132);
   frame_4ae8890__4->GetYaxis()->SetLabelOffset(0.01);
   frame_4ae8890__4->GetYaxis()->SetLabelSize(0.06);
   frame_4ae8890__4->GetYaxis()->SetTitleSize(0.072);
   frame_4ae8890__4->GetYaxis()->SetTitleOffset(0.95);
   frame_4ae8890__4->GetYaxis()->SetTitleFont(132);
   frame_4ae8890__4->GetZaxis()->SetLabelFont(132);
   frame_4ae8890__4->GetZaxis()->SetLabelSize(0.06);
   frame_4ae8890__4->GetZaxis()->SetTitleSize(0.072);
   frame_4ae8890__4->GetZaxis()->SetTitleOffset(1.2);
   frame_4ae8890__4->GetZaxis()->SetTitleFont(132);
   frame_4ae8890__4->Draw("AXISSAME");
   pad1->Modified();
   c1->cd();
   c1->Modified();
   c1->cd();
   c1->SetSelected(c1);
}
Exemplo n.º 18
0
// define the generator's information across different ctau models
void Limit_lambda() {

   gROOT->LoadMacro("CMS_lumi.C");

   string hfolder  = "Limit1/" ;

   string ctau = "2000" ;
   string names[4] = {  "1935", "2060", "1945", "2195"  } ;
   const int sz = 4;

   string ld_Str[4] = { "120", "140", "160", "180" } ;
   float x[4] = { 120, 140, 160, 180, } ;
   float Xsec[4] = { 0.133, 0.0574, 0.0277, 0.0145 }  ;

   /*
   string ctau = "6000" ;
   string names[6] = { "6000", "5985", "6000", "5875", "5980", "6000"  } ;
   const int sz = 6;

   string ld_Str[6] = { "100", "120", "140", "160", "180", "220" } ;
   float x[6] = { 100, 120, 140, 160, 180, 220 } ;
   float Xsec[6] = { 0.368, 0.133, 0.0574, 0.0277, 0.0145, 0.0048}  ;

   string ctau = "1000" ;
   string names[4] = {  "1030", "975", "1100", "1000"  } ;
   const int sz = 4;

   string ld_Str[4] = { "140", "160", "180", "220" } ;
   float x[4] = { 140, 160, 180, 220 } ;
   float Xsec[4] = { 0.0574, 0.0277, 0.0145, 0.0048}  ;

   string ctau = "10000" ;
   string names[6] = { "10000", "10000", "10000", "10000", "10000", "10000" } ;
   const int sz = 6;

   string ld_Str[6] = { "100", "120", "140", "160", "180", "220" } ;
   float x[6] = { 100, 120, 140, 160, 180, 220 } ;
   float Xsec[6] = { 0.368, 0.133, 0.0574, 0.0277, 0.0145, 0.0048}  ;

   string ctau = "500" ;
   string names[4] = { "425", "515", "490", "500" } ;
   const int sz = 4;

   string ld_Str[4] = { "100", "140", "160", "220" } ;
   float x[4] = { 100, 140, 160, 220 } ;
   float Xsec[4] = { 0.368, 0.0574, 0.0277, 0.0048}  ;
   */

   /*
   string Lambda = "160" ;
   float Xsec = 0.0277 ;
   string names[7] = { "490", "975", "1945", "2930", "3910", "5875", "10000"  } ;
   const int sz = 7;

   string Lambda = "180" ;
   float Xsec = 0.0145 ;
   string names[8] = { "185", "365", "730", "1100", "2195", "3950", "5980", "10000"  } ;
   const int sz = 8;

   string Lambda = "220" ;
   float Xsec = 0.0048 ;
   string names[5] = { "500", "1000", "3000", "6000", "10000"  } ;
   const int sz = 5;

   string Lambda = "100" ;
   float Xsec = 0.368 ;
   string names[7] = { "215", "425", "1700", "3400", "5100", "6000", "10000"  } ;
   const int sz = 7;

   string Lambda = "120" ;
   float Xsec = 0.133 ;
   string names[8] = { "325", "645", "1290", "1935", "2955", "3870", "5985", "10000"  } ;
   const int sz = 8;

   string Lambda = "140" ;
   float Xsec = 0.0574 ;
   string names[8] = { "130", "515", "1030", "2060", "2920", "3985", "6000", "10000"  } ;
   const int sz = 8;
   */

   TString legTitle = "#tilde{#chi}^{0}_{1} #rightarrow #gamma #tilde{G}, c#tau ="+ ctau + " mm" ;
   string limitPlotName = "limit_ct"+ ctau + ".png" ;

   float yMax = 30. * Xsec[0] ;
   float yMin = 0.1 * Xsec[sz-1] ; 

   char s1[8],s2[8],s3[8],s4[8],s5[8],s6[8],s7[8] ;
   float f1,f2 ;
   int r1 ;
   float md[sz], u1[sz], u2[sz], d1[sz], d2[sz], ob[sz], x[sz], th[sz] ;
   float ex[sz] = { 0. } ;
   FILE* logf ; 

   // Get signal strength
   for (int i=0; i< sz; i++ ) {
       string fileName = hfolder +  "log_" + ld_Str[i] + "_" + names[i] + ".txt"  ;
       printf(" filename : %s \n", fileName.c_str() ) ;
       logf = fopen( fileName.c_str() ,"r");
       th[i] = Xsec[i] ;

       for (int j=0; j< 6; j++ ) {
           r1 = fscanf( logf, "%s %s %s %f %s %f %s %s %s", s1,s2,s3,&f1,s4,&f2,s5,s6,s7  );
	   printf("[%.0f] %s %s %s %f %s %f %s %s %s \n", x[i], s1,s2,s3, f1, s4, f2, s5,s6,s7 ) ;
           if ( j == 0 ) ob[i] = f1 * Xsec[i] ;
           if ( j == 1 ) u2[i] = f1 * Xsec[i] ;
           if ( j == 2 ) u1[i] = f1 * Xsec[i] ;
           if ( j == 3 ) md[i] = f1 * Xsec[i] ;
           if ( j == 4 ) d1[i] = f1 * Xsec[i] ;
           if ( j == 5 ) d2[i] = f1 * Xsec[i] ;
       } 
       u2[i] = u2[i] - md[i] ;
       u1[i] = u1[i] - md[i] ;
       d1[i] = md[i] - d1[i] ;
       d2[i] = md[i] - d2[i] ;

       printf(" -- \n") ;
       fclose( logf ) ;
   }


   // For the frame:
   gStyle->SetFrameBorderMode(0);
   gStyle->SetFrameBorderSize(1);
   gStyle->SetFrameFillColor(0);
   gStyle->SetFrameFillStyle(0);
   gStyle->SetFrameLineColor(1);
   gStyle->SetFrameLineStyle(1);
   gStyle->SetFrameLineWidth(1);

   gStyle->SetLabelOffset(0.007, "XYZ");
   gStyle->SetLabelSize(0.04, "XYZ");

   TCanvas *c1a = new TCanvas("c1a","c1a" ,800,800);
   //c1a->SetGridy() ;
   c1a->SetTopMargin(0.1);
   c1a->SetBottomMargin(0.13);
   c1a->SetLeftMargin(0.16);
   c1a->SetRightMargin(0.05);

   c1a->SetLogy() ;
   TMultiGraph *mg = new TMultiGraph();
   //gStyle->SetTitleW(0.85);
   //mg->SetTitle( "   CMS 19.1 fb^{-1}                                                   #sqrt{s} = 8 TeV" );

   // SetFillStyle ref: http://root.cern.ch/root/html/TAttFill.html
   TGraphAsymmErrors* gbe = new TGraphAsymmErrors(sz, x, md, ex, ex, d2, u2);
   gbe->SetFillStyle(1001);
   gbe->SetFillColor(kYellow);
   //gbe->GetXaxis()->SetLimits(240.,6100.) ;

   TGraphAsymmErrors* gae = new TGraphAsymmErrors(sz, x, md, ex, ex, d1, u1);
   gae->SetFillStyle(1001);
   //gae->SetFillColor(kSpring);
   gae->SetFillColor(kGreen);
   //gae->GetXaxis()->SetRangeUser(1.,5.) ;
   //gae->GetXaxis()->SetLimits(1.,5.) ;

   mg->Add( gbe ) ;
   mg->Add( gae ) ;
   mg->Draw("a3") ;

   // this modify the x-axis range, must set after Draw() ...stupid ROOT 
   gPad->Modified();
   mg->GetXaxis()->SetLimits( x[0] - 1, x[sz-1]+1 ) ;
   mg->SetMaximum( yMax );
   mg->SetMinimum( yMin );
   mg->GetXaxis()->SetTitleOffset(1.1);
   mg->GetYaxis()->SetTitleOffset(1.3);
   mg->GetXaxis()->SetTitleFont(42);
   mg->GetYaxis()->SetTitleFont(42);
   mg->GetXaxis()->SetTitleSize(0.04);
   mg->GetYaxis()->SetTitleSize(0.04);
   mg->GetXaxis()->SetTitle( "SUSY breaking scale (TeV)"  ) ;
   //mg->GetXaxis()->SetTitle( "MET Cut (GeV)" ) ;
   mg->GetYaxis()->SetTitle(" #sigma_{Upper Limit} (pb) at 95% CL") ;

   // expected
   TGraph*  g1  = new TGraph(sz, x, md ) ;
   g1->SetLineColor(2) ;
   g1->SetLineWidth(2) ;
   g1->SetLineStyle(1) ;
   //g1->GetXaxis()->SetLimits(1.,5.) ;
   g1->Draw("LP") ;
   c1a->Update() ;

   // observation
   TGraph*  g0  = new TGraph(sz, x, ob ) ;
   g0->SetLineColor(1) ;
   g0->SetLineWidth(2) ;
   g0->SetLineStyle(1) ;
   //g0->GetXaxis()->SetLimits(1.,5.) ;
   //g0->SetMarkerStyle(20) ;
   g0->Draw("LP") ;
   c1a->Update() ;


   // theoratical suggestion
   TGraph*  gth = new TGraph(sz, x, th ) ;
   gth->SetLineColor(4) ;
   gth->SetLineWidth(2) ;
   gth->SetLineStyle(1) ;
   gth->GetXaxis()->SetLimits( x[0], x[sz-1] ) ;
   gth->Draw("L") ;
   
   TLegend* leg1  = new TLegend(.4, .6, .90, .88 );
   //TLegend* leg1  = new TLegend(.4, .15, .90, .40 );
   leg1->SetHeader( legTitle ); 
   leg1->SetFillStyle(0); 
   leg1->SetBorderSize(0);
   leg1->SetFillColor(0);
   leg1 ->SetTextFont(22);

   leg1->SetFillColor(10) ;
   leg1->SetTextSize(0.030) ;
   leg1->AddEntry( gbe, "#pm 2#sigma Expected" ,  "F");
   leg1->AddEntry( gae, "#pm 1#sigma Expected" ,  "F");
   leg1->AddEntry( g1,  "Expected 95% CL upper limit" , "L");
   leg1->AddEntry( gth, "Theoretical LO cross-section", "L");
   leg1->AddEntry( g0,  "Observed" , "L");
   leg1->Draw("same") ;

   CMS_lumi( c1a, 2, 11 ) ;
   c1a->Update();

   TString gPlotname = hfolder +  limitPlotName  ;
   c1a->Print( gPlotname ) ;
   delete c1a ;

   /*
    // *************************
    // ***  Drawing setup    ***
    // *************************
    gStyle->SetOptStat("");

    gStyle->SetOptStat(kFALSE);
    //gStyle->SetOptFit(111);
    gStyle->SetOptTitle(0);
    //gStyle->SetTitleFontSize(0.05);
 
    // Plots
    TCanvas* c0 = new TCanvas("c0","", 800, 700);
    c0->SetFillColor(10);
    c0->SetFillColor(10);

    c0->SetTopMargin(0.1);
    c0->SetBottomMargin(0.13);
    c0->SetLeftMargin(0.16);
    c0->SetRightMargin(0.05);
    c0->SetLogy();

    //gPad->SetGridx();
    //gPad->SetGridy();
    c0->cd();

    TGraphAsymmErrors* eff[nModel] ;
    leg1->Clear() ;
    for ( int i=0; i< nModel; i++ ) {

        eff[i]= new TGraphAsymmErrors();

        D_ctbgT[i]->Rebin( rbin ) ;
        N_ctbgT[i]->Rebin( rbin ) ;

        eff[i]->Divide( N_ctbgT[i], D_ctbgT[i] );    

        eff[i]->SetMarkerColor( color[i] );
        eff[i]->SetLineColor( color[i] );
        leg1->AddEntry( eff[i], names[i]+" TeV" ,  "L");

        if ( i ==0 ) {
           c0->cd();
           c0->SetLogy(0);

           eff[i]->SetMaximum( ymax );
           eff[i]->SetMinimum( 0.0 );
           eff[i]->SetMarkerStyle(22);
           eff[i]->SetMarkerSize(1);
           eff[i]->SetLineWidth(2);

           eff[i]->GetXaxis()->SetTitleOffset(0.9);
           eff[i]->GetYaxis()->SetTitleOffset(1.25);
	   eff[i]->GetXaxis()->SetTitleSize(0.06);
	   eff[i]->GetYaxis()->SetTitleSize(0.06);
         
           eff[i]->GetXaxis()->SetTitle("Number of Vertices") ;
           eff[i]->GetYaxis()->SetTitle("Efficiency ") ;
           eff[i]->GetXaxis()->SetRangeUser(0, xmax ) ;
           eff[i]->Draw("AP");
        } else {
           eff[i]->Draw("SAMEPS");
        }
    }
    leg1->Draw("sames") ;
    c0->Update();

    CMS_lumi( c0, 2, 11 ) ;
    c0->Update();

    c0->Print( hfolder + plotname );


    delete c0 ;
    */
}
TCanvas* plotLinearityPS_AllTypes_ERUpgrade(double eta, double etmin /* GeV */, double etmax /* GeV */, 
					    string year, string esmodel,
					    bool debug=false, bool logx=false, bool subtractAverage=false,
					    TGraph* overlay=0 ) {

  double GeV = 1000;

   gROOT->ProcessLine(".L EnergyRescalerUpgrade.cxx");
  
   egRescaler::EnergyRescalerUpgrade ers;

   ers.Init("../share/EnergyRescalerData.root",year,esmodel);

   ers.SetDebugFlag( debug );

   ers.includeMaterialContribution( false );
   ers.includeLeakageContribution( false );

   double eMin = etmin * cosh(eta) * GeV;
   double eMax = etmax * cosh(eta) * GeV;

   int nStep = 100;
   double eStep;
   if( logx )
     eStep = (log(eMax)-log(eMin))/(double)nStep;
   else
     eStep = (eMax-eMin)/(double)nStep;
   double e = eMin;

   TGraphErrors* gZee = new TGraphErrors();  // Z scale

   TGraph* gNom = new TGraph();        // nominal scale correction
   TGraph* gPSUp = new TGraph();       //        ps uncertainty, Up
   TGraph* gPSDown = new TGraph();     //                      , Down

   TGraph* gNom_UC = new TGraph();    
   TGraph* gPSUp_UC = new TGraph();   
   TGraph* gPSDown_UC = new TGraph(); 

   TGraph* gNom_CV = new TGraph();    
   TGraph* gPSUp_CV = new TGraph();   
   TGraph* gPSDown_CV = new TGraph(); 

   int i=0;

   while( e<=eMax ) {
     
     double eT = e/cosh(eta);

     double alpha          = ers.getAlphaZee(eta, egRescaler::EnergyRescalerUpgrade::Nominal);
     double alphaUp        = ers.getAlphaZee(eta, egRescaler::EnergyRescalerUpgrade::ZeeStatUp);

     double eNominal       = ers.applyEnergyCorrection(eta, e, 0, egRescaler::EnergyRescalerUpgrade::Nominal);

     double eVarPSUp       = ers.applyEnergyCorrection(eta, e, 0, egRescaler::EnergyRescalerUpgrade::B12Up);
     double eVarPSDown     = ers.applyEnergyCorrection(eta, e, 0, egRescaler::EnergyRescalerUpgrade::B12Down);

     double eNominal_UC       = ers.applyEnergyCorrection(eta, e, 1, egRescaler::EnergyRescalerUpgrade::Nominal);

     double eVarPSUp_UC       = ers.applyEnergyCorrection(eta, e, 1, egRescaler::EnergyRescalerUpgrade::B12Up);
     double eVarPSDown_UC     = ers.applyEnergyCorrection(eta, e, 1, egRescaler::EnergyRescalerUpgrade::B12Down);

     double eNominal_CV       = ers.applyEnergyCorrection(eta, e, 2, egRescaler::EnergyRescalerUpgrade::Nominal);

     double eVarPSUp_CV       = ers.applyEnergyCorrection(eta, e, 2, egRescaler::EnergyRescalerUpgrade::B12Up);
     double eVarPSDown_CV     = ers.applyEnergyCorrection(eta, e, 2, egRescaler::EnergyRescalerUpgrade::B12Down);

     if(i==0) {
       gZee->SetPointError(i,0,alphaUp-alpha);
       if( !subtractAverage )
	 gZee->SetPoint(i,40.,alpha);
       else
	 gZee->SetPoint(i,40.,0);
     }
     
     if( !subtractAverage ) {
       
       gNom->SetPoint(i, eT/GeV, (e-eNominal)/eNominal); 
       
       gPSUp->SetPoint(i, eT/GeV, (e-eVarPSUp)/eVarPSUp); 
       gPSDown->SetPoint(i, eT/GeV, (e-eVarPSDown)/eVarPSDown); 
       
       gNom_UC->SetPoint(i, eT/GeV, (e-eNominal_UC)/eNominal_UC); 
       
       gPSUp_UC->SetPoint(i, eT/GeV, (e-eVarPSUp_UC)/eVarPSUp_UC); 
       gPSDown_UC->SetPoint(i, eT/GeV, (e-eVarPSDown_UC)/eVarPSDown_UC); 
       
       gNom_CV->SetPoint(i, eT/GeV, (e-eNominal_CV)/eNominal_CV); 
       
       gPSUp_CV->SetPoint(i, eT/GeV, (e-eVarPSUp_CV)/eVarPSUp_CV); 
       gPSDown_CV->SetPoint(i, eT/GeV, (e-eVarPSDown_CV)/eVarPSDown_CV); 
       
     } else {
       
       gNom->SetPoint(i, eT/GeV, (e-eNominal)/eNominal - alpha); 
     
       gPSUp->SetPoint(i, eT/GeV, (e-eVarPSUp)/eVarPSUp - alpha); 
       gPSDown->SetPoint(i, eT/GeV, (e-eVarPSDown)/eVarPSDown - alpha); 
       
       gNom_UC->SetPoint(i, eT/GeV, (e-eNominal_UC)/eNominal_UC - alpha); 
       
       gPSUp_UC->SetPoint(i, eT/GeV, (e-eVarPSUp_UC)/eVarPSUp_UC - alpha); 
       gPSDown_UC->SetPoint(i, eT/GeV, (e-eVarPSDown_UC)/eVarPSDown_UC - alpha); 
       
       gNom_CV->SetPoint(i, eT/GeV, (e-eNominal_CV)/eNominal_CV - alpha); 
       
       gPSUp_CV->SetPoint(i, eT/GeV, (e-eVarPSUp_CV)/eVarPSUp_CV - alpha); 
       gPSDown_CV->SetPoint(i, eT/GeV, (e-eVarPSDown_CV)/eVarPSDown_CV - alpha); 
       
     }

     i++;

     if( logx )
       e *= exp(eStep);
     else
       e += eStep;

   }
 
   TCanvas* canvas = new TCanvas();
   if( logx )
     canvas->SetLogx();

   if( !subtractAverage ) {
     gPSUp->SetMaximum(alpha+.005);
     gPSUp->SetMinimum(alpha+-.007);
   } else {
     gPSUp->SetMaximum(.005);
     gPSUp->SetMinimum(-.007);
   }

   char grafname[99];
   sprintf(grafname,"Linearity (%s), PS contribution, #eta = %4.2f", year.c_str(), eta);
   gPSUp->SetTitle(grafname);

   // Electrons
   
   gPSUp->GetXaxis()->SetTitleOffset(1.2*gNom->GetXaxis()->GetTitleOffset());
   gPSUp->GetYaxis()->SetTitleOffset(1.2*gNom->GetYaxis()->GetTitleOffset());
   gPSUp->GetXaxis()->SetTitle("E_{T} [GeV]");
   gPSUp->GetYaxis()->SetTitle("#alpha(E_{T})");
   gPSUp->SetLineWidth(2);
   gPSUp->SetLineStyle(2);
   gPSUp->SetLineColor(4);
   gPSUp->Draw("AL");

   gPSDown->SetLineWidth(2);
   gPSDown->SetLineStyle(3);
   gPSDown->SetLineColor(4);
   gPSDown->Draw("L");

   gNom->SetLineWidth(2);
   gNom->SetLineColor(4);
   gNom->Draw("L");

   // Unconverted

   gPSUp_UC->SetLineWidth(2);
   gPSUp_UC->SetLineStyle(2);
   gPSUp_UC->SetLineColor(2);
   gPSUp_UC->Draw("L");

   gPSDown_UC->SetLineWidth(2);
   gPSDown_UC->SetLineStyle(3);
   gPSDown_UC->SetLineColor(2);
   gPSDown_UC->Draw("L");

   gNom_UC->SetLineWidth(2);
   gNom_UC->SetLineColor(2);
   gNom_UC->Draw("L");

   // Converted 

   gPSUp_CV->SetLineWidth(2);
   gPSUp_CV->SetLineStyle(2);
   gPSUp_CV->SetLineColor(8);
   gPSUp_CV->Draw("L");

   gPSDown_CV->SetLineWidth(2);
   gPSDown_CV->SetLineStyle(3);
   gPSDown_CV->SetLineColor(8);
   gPSDown_CV->Draw("L");

   gNom_CV->SetLineWidth(2);
   gNom_CV->SetLineColor(8);
   gNom_CV->Draw("L");

   gZee->SetMarkerStyle(20);
   gZee->Draw("P");

   TLegend* leg1 = new TLegend(.65,.15,.9,.3);
   leg1->SetBorderSize(0);
   leg1->SetFillColor(0);
    leg1->AddEntry(gZee,"#alpha, Z peak", "p");
   leg1->AddEntry(gNom,"PS, e, nom.", "l");
   leg1->AddEntry(gPSUp,"PS, e, up", "l");
   leg1->AddEntry(gPSDown,"PS, e, down", "l");

   leg1->Draw("same");

   TLegend* leg2 = new TLegend(.4,.15,.65,.3);
   leg2->SetBorderSize(0);
   leg2->SetFillColor(0);
   leg2->AddEntry(gZee," ", "");
   leg2->AddEntry(gNom_UC,"PS, #gamma (unc.), nom.", "l");
   leg2->AddEntry(gPSUp_UC,"PS, #gamma (unc.), up", "l");
   leg2->AddEntry(gPSDown_UC,"PS, #gamma (unc.), down", "l");

   leg2->Draw("same");

   TLegend* leg3 = new TLegend(.15,.15,.4,.3);
   leg3->SetBorderSize(0);
   leg3->SetFillColor(0);
   leg3->AddEntry(gZee," ", "");
   leg3->AddEntry(gNom_CV,"PS, #gamma (cnv.), nom.", "l");
   leg3->AddEntry(gPSUp_CV,"PS, #gamma (cnv.), up", "l");
   leg3->AddEntry(gPSDown_CV,"PS, #gamma (cnv.), down", "l");

   leg3->Draw("same");

   // char plotname[99];
   // sprintf(plotname,"linearity_%d_%2.1f.png",ptype,eta);
   //   canvas->Print("overlay.ps");
  
   return canvas;
}
void Sens_Matrix_LAr1ND_150m_T600_off_axis_Shape_and_Rate(TCanvas* c)
{
    c->cd();


    TGraph *graph = new TGraph(501);
    graph->SetName("Graph0");
    graph->SetTitle("Graph");
    graph->SetFillColor(1);
    graph->SetLineWidth(2);
    graph->SetPoint(0,1,0.01);
    graph->SetPoint(1,1,0.01018591388);
    graph->SetPoint(2,1,0.01037528416);
    graph->SetPoint(3,1,0.01056817509);
    graph->SetPoint(4,1,0.01076465214);
    graph->SetPoint(5,1,0.01096478196);
    graph->SetPoint(6,1,0.01116863248);
    graph->SetPoint(7,1,0.01137627286);
    graph->SetPoint(8,1,0.01158777356);
    graph->SetPoint(9,1,0.01180320636);
    graph->SetPoint(10,1,0.01202264435);
    graph->SetPoint(11,1,0.01224616199);
    graph->SetPoint(12,1,0.01247383514);
    graph->SetPoint(13,1,0.01270574105);
    graph->SetPoint(14,1,0.01294195841);
    graph->SetPoint(15,1,0.01318256739);
    graph->SetPoint(16,1,0.01342764961);
    graph->SetPoint(17,1,0.01367728826);
    graph->SetPoint(18,1,0.01393156803);
    graph->SetPoint(19,1,0.01419057522);
    graph->SetPoint(20,1,0.01445439771);
    graph->SetPoint(21,1,0.01472312502);
    graph->SetPoint(22,1,0.01499684836);
    graph->SetPoint(23,1,0.01527566058);
    graph->SetPoint(24,1,0.01555965632);
    graph->SetPoint(25,1,0.01584893192);
    graph->SetPoint(26,1,0.01614358557);
    graph->SetPoint(27,1,0.01644371723);
    graph->SetPoint(28,1,0.01674942876);
    graph->SetPoint(29,1,0.01706082389);
    graph->SetPoint(30,1,0.01737800829);
    graph->SetPoint(31,1,0.01770108958);
    graph->SetPoint(32,1,0.01803017741);
    graph->SetPoint(33,1,0.01836538343);
    graph->SetPoint(34,1,0.0187068214);
    graph->SetPoint(35,1,0.01905460718);
    graph->SetPoint(36,1,0.01940885878);
    graph->SetPoint(37,1,0.0197696964);
    graph->SetPoint(38,1,0.0201372425);
    graph->SetPoint(39,1,0.02051162179);
    graph->SetPoint(40,1,0.02089296131);
    graph->SetPoint(41,1,0.02128139046);
    graph->SetPoint(42,1,0.02167704105);
    graph->SetPoint(43,1,0.02208004733);
    graph->SetPoint(44,1,0.02249054606);
    graph->SetPoint(45,1,0.02290867653);
    graph->SetPoint(46,1,0.02333458062);
    graph->SetPoint(47,1,0.02376840287);
    graph->SetPoint(48,1,0.02421029047);
    graph->SetPoint(49,1,0.02466039337);
    graph->SetPoint(50,1,0.02511886432);
    graph->SetPoint(51,1,0.02558585887);
    graph->SetPoint(52,1,0.0260615355);
    graph->SetPoint(53,1,0.02654605562);
    graph->SetPoint(54,1,0.02703958364);
    graph->SetPoint(55,1,0.02754228703);
    graph->SetPoint(56,1,0.02805433638);
    graph->SetPoint(57,1,0.02857590543);
    graph->SetPoint(58,1,0.02910717118);
    graph->SetPoint(59,1,0.0296483139);
    graph->SetPoint(60,1,0.0301995172);
    graph->SetPoint(61,1,0.03076096815);
    graph->SetPoint(62,1,0.03133285724);
    graph->SetPoint(63,1,0.03191537855);
    graph->SetPoint(64,1,0.03250872974);
    graph->SetPoint(65,1,0.03311311215);
    graph->SetPoint(66,1,0.03372873087);
    graph->SetPoint(67,1,0.03435579479);
    graph->SetPoint(68,1,0.0349945167);
    graph->SetPoint(69,1,0.03564511334);
    graph->SetPoint(70,1,0.03630780548);
    graph->SetPoint(71,1,0.03698281798);
    graph->SetPoint(72,1,0.0376703799);
    graph->SetPoint(73,1,0.03837072455);
    graph->SetPoint(74,1,0.03908408958);
    graph->SetPoint(75,1,0.03981071706);
    graph->SetPoint(76,1,0.04055085354);
    graph->SetPoint(77,1,0.0413047502);
    graph->SetPoint(78,1,0.04207266284);
    graph->SetPoint(79,1,0.04285485204);
    graph->SetPoint(80,1,0.04365158322);
    graph->SetPoint(81,1,0.04446312675);
    graph->SetPoint(82,1,0.04528975799);
    graph->SetPoint(83,1,0.04613175746);
    graph->SetPoint(84,1,0.04698941086);
    graph->SetPoint(85,1,0.04786300923);
    graph->SetPoint(86,0.981747943,0.04875284901);
    graph->SetPoint(87,0.9462371614,0.04965923215);
    graph->SetPoint(88,0.9120108394,0.0505824662);
    graph->SetPoint(89,0.8790225168,0.05152286446);
    graph->SetPoint(90,0.8472274141,0.05248074602);
    graph->SetPoint(91,0.8165823714,0.05345643594);
    graph->SetPoint(92,0.7870457897,0.05445026528);
    graph->SetPoint(93,0.758577575,0.0554625713);
    graph->SetPoint(94,0.7311390835,0.05649369748);
    graph->SetPoint(95,0.704693069,0.05754399373);
    graph->SetPoint(96,0.6792036326,0.05861381645);
    graph->SetPoint(97,0.6546361741,0.05970352866);
    graph->SetPoint(98,0.6309573445,0.06081350013);
    graph->SetPoint(99,0.6081350013,0.06194410751);
    graph->SetPoint(100,0.5861381645,0.06309573445);
    graph->SetPoint(101,0.5649369748,0.06426877173);
    graph->SetPoint(102,0.5445026528,0.06546361741);
    graph->SetPoint(103,0.5248074602,0.06668067692);
    graph->SetPoint(104,0.505824662,0.06792036326);
    graph->SetPoint(105,0.4875284901,0.06918309709);
    graph->SetPoint(106,0.4698941086,0.0704693069);
    graph->SetPoint(107,0.4528975799,0.07177942913);
    graph->SetPoint(108,0.4365158322,0.07311390835);
    graph->SetPoint(109,0.4207266284,0.07447319739);
    graph->SetPoint(110,0.4055085354,0.0758577575);
    graph->SetPoint(111,0.3908408958,0.07726805851);
    graph->SetPoint(112,0.376703799,0.07870457897);
    graph->SetPoint(113,0.3630780548,0.08016780634);
    graph->SetPoint(114,0.349945167,0.08165823714);
    graph->SetPoint(115,0.3372873087,0.08317637711);
    graph->SetPoint(116,0.3250872974,0.08472274141);
    graph->SetPoint(117,0.3191537855,0.08629785478);
    graph->SetPoint(118,0.3076096815,0.08790225168);
    graph->SetPoint(119,0.296483139,0.08953647655);
    graph->SetPoint(120,0.2857590543,0.09120108394);
    graph->SetPoint(121,0.2754228703,0.09289663868);
    graph->SetPoint(122,0.2654605562,0.09462371614);
    graph->SetPoint(123,0.2558585887,0.09638290236);
    graph->SetPoint(124,0.2466039337,0.0981747943);
    graph->SetPoint(125,0.2376840287,0.1);
    graph->SetPoint(126,0.2290867653,0.1018591388);
    graph->SetPoint(127,0.2208004733,0.1037528416);
    graph->SetPoint(128,0.2128139046,0.1056817509);
    graph->SetPoint(129,0.2051162179,0.1076465214);
    graph->SetPoint(130,0.197696964,0.1096478196);
    graph->SetPoint(131,0.1905460718,0.1116863248);
    graph->SetPoint(132,0.1836538343,0.1137627286);
    graph->SetPoint(133,0.1770108958,0.1158777356);
    graph->SetPoint(134,0.1706082389,0.1180320636);
    graph->SetPoint(135,0.1644371723,0.1202264435);
    graph->SetPoint(136,0.1584893192,0.1224616199);
    graph->SetPoint(137,0.1527566058,0.1247383514);
    graph->SetPoint(138,0.1472312502,0.1270574105);
    graph->SetPoint(139,0.1419057522,0.1294195841);
    graph->SetPoint(140,0.1367728826,0.1318256739);
    graph->SetPoint(141,0.1318256739,0.1342764961);
    graph->SetPoint(142,0.1270574105,0.1367728826);
    graph->SetPoint(143,0.1224616199,0.1393156803);
    graph->SetPoint(144,0.1180320636,0.1419057522);
    graph->SetPoint(145,0.1137627286,0.1445439771);
    graph->SetPoint(146,0.1116863248,0.1472312502);
    graph->SetPoint(147,0.1076465214,0.1499684836);
    graph->SetPoint(148,0.1037528416,0.1527566058);
    graph->SetPoint(149,0.1,0.1555965632);
    graph->SetPoint(150,0.09638290236,0.1584893192);
    graph->SetPoint(151,0.09289663868,0.1614358557);
    graph->SetPoint(152,0.08953647655,0.1644371723);
    graph->SetPoint(153,0.08629785478,0.1674942876);
    graph->SetPoint(154,0.08317637711,0.1706082389);
    graph->SetPoint(155,0.08016780634,0.1737800829);
    graph->SetPoint(156,0.07726805851,0.1770108958);
    graph->SetPoint(157,0.07447319739,0.1803017741);
    graph->SetPoint(158,0.07177942913,0.1836538343);
    graph->SetPoint(159,0.06918309709,0.187068214);
    graph->SetPoint(160,0.06792036326,0.1905460718);
    graph->SetPoint(161,0.06546361741,0.1940885878);
    graph->SetPoint(162,0.06309573445,0.197696964);
    graph->SetPoint(163,0.06081350013,0.201372425);
    graph->SetPoint(164,0.05861381645,0.2051162179);
    graph->SetPoint(165,0.05649369748,0.2089296131);
    graph->SetPoint(166,0.05445026528,0.2128139046);
    graph->SetPoint(167,0.05248074602,0.2167704105);
    graph->SetPoint(168,0.0505824662,0.2208004733);
    graph->SetPoint(169,0.04965923215,0.2249054606);
    graph->SetPoint(170,0.04786300923,0.2290867653);
    graph->SetPoint(171,0.04613175746,0.2333458062);
    graph->SetPoint(172,0.04446312675,0.2376840287);
    graph->SetPoint(173,0.04285485204,0.2421029047);
    graph->SetPoint(174,0.0413047502,0.2466039337);
    graph->SetPoint(175,0.03981071706,0.2511886432);
    graph->SetPoint(176,0.03908408958,0.2558585887);
    graph->SetPoint(177,0.0376703799,0.260615355);
    graph->SetPoint(178,0.03630780548,0.2654605562);
    graph->SetPoint(179,0.0349945167,0.2703958364);
    graph->SetPoint(180,0.03372873087,0.2754228703);
    graph->SetPoint(181,0.03250872974,0.2805433638);
    graph->SetPoint(182,0.03191537855,0.2857590543);
    graph->SetPoint(183,0.03076096815,0.2910717118);
    graph->SetPoint(184,0.0296483139,0.296483139);
    graph->SetPoint(185,0.02857590543,0.301995172);
    graph->SetPoint(186,0.02754228703,0.3076096815);
    graph->SetPoint(187,0.02703958364,0.3133285724);
    graph->SetPoint(188,0.0260615355,0.3191537855);
    graph->SetPoint(189,0.02511886432,0.3250872974);
    graph->SetPoint(190,0.02421029047,0.3311311215);
    graph->SetPoint(191,0.02376840287,0.3372873087);
    graph->SetPoint(192,0.02290867653,0.3435579479);
    graph->SetPoint(193,0.02208004733,0.349945167);
    graph->SetPoint(194,0.02167704105,0.3564511334);
    graph->SetPoint(195,0.02089296131,0.3630780548);
    graph->SetPoint(196,0.0201372425,0.3698281798);
    graph->SetPoint(197,0.0197696964,0.376703799);
    graph->SetPoint(198,0.01905460718,0.3837072455);
    graph->SetPoint(199,0.01836538343,0.3908408958);
    graph->SetPoint(200,0.01803017741,0.3981071706);
    graph->SetPoint(201,0.01737800829,0.4055085354);
    graph->SetPoint(202,0.01674942876,0.413047502);
    graph->SetPoint(203,0.01644371723,0.4207266284);
    graph->SetPoint(204,0.01584893192,0.4285485204);
    graph->SetPoint(205,0.01555965632,0.4365158322);
    graph->SetPoint(206,0.01499684836,0.4446312675);
    graph->SetPoint(207,0.01472312502,0.4528975799);
    graph->SetPoint(208,0.01419057522,0.4613175746);
    graph->SetPoint(209,0.01393156803,0.4698941086);
    graph->SetPoint(210,0.01342764961,0.4786300923);
    graph->SetPoint(211,0.01318256739,0.4875284901);
    graph->SetPoint(212,0.01270574105,0.4965923215);
    graph->SetPoint(213,0.01247383514,0.505824662);
    graph->SetPoint(214,0.01202264435,0.5152286446);
    graph->SetPoint(215,0.01180320636,0.5248074602);
    graph->SetPoint(216,0.01158777356,0.5345643594);
    graph->SetPoint(217,0.01116863248,0.5445026528);
    graph->SetPoint(218,0.01096478196,0.554625713);
    graph->SetPoint(219,0.01056817509,0.5649369748);
    graph->SetPoint(220,0.01037528416,0.5754399373);
    graph->SetPoint(221,0.01018591388,0.5861381645);
    graph->SetPoint(222,0.01,0.5970352866);
    graph->SetPoint(223,0.009638290236,0.6081350013);
    graph->SetPoint(224,0.009462371614,0.6194410751);
    graph->SetPoint(225,0.009289663868,0.6309573445);
    graph->SetPoint(226,0.009120108394,0.6426877173);
    graph->SetPoint(227,0.008953647655,0.6546361741);
    graph->SetPoint(228,0.008629785478,0.6668067692);
    graph->SetPoint(229,0.008472274141,0.6792036326);
    graph->SetPoint(230,0.008317637711,0.6918309709);
    graph->SetPoint(231,0.008165823714,0.704693069);
    graph->SetPoint(232,0.008016780634,0.7177942913);
    graph->SetPoint(233,0.007870457897,0.7311390835);
    graph->SetPoint(234,0.007726805851,0.7447319739);
    graph->SetPoint(235,0.00758577575,0.758577575);
    graph->SetPoint(236,0.007447319739,0.7726805851);
    graph->SetPoint(237,0.007311390835,0.7870457897);
    graph->SetPoint(238,0.007177942913,0.8016780634);
    graph->SetPoint(239,0.00704693069,0.8165823714);
    graph->SetPoint(240,0.006918309709,0.8317637711);
    graph->SetPoint(241,0.006792036326,0.8472274141);
    graph->SetPoint(242,0.006668067692,0.8629785478);
    graph->SetPoint(243,0.006668067692,0.8790225168);
    graph->SetPoint(244,0.006546361741,0.8953647655);
    graph->SetPoint(245,0.006426877173,0.9120108394);
    graph->SetPoint(246,0.006309573445,0.9289663868);
    graph->SetPoint(247,0.006194410751,0.9462371614);
    graph->SetPoint(248,0.006194410751,0.9638290236);
    graph->SetPoint(249,0.006081350013,0.981747943);
    graph->SetPoint(250,0.005970352866,1);
    graph->SetPoint(251,0.005861381645,1.018591388);
    graph->SetPoint(252,0.005861381645,1.037528416);
    graph->SetPoint(253,0.005754399373,1.056817509);
    graph->SetPoint(254,0.005649369748,1.076465214);
    graph->SetPoint(255,0.005649369748,1.096478196);
    graph->SetPoint(256,0.00554625713,1.116863248);
    graph->SetPoint(257,0.00554625713,1.137627286);
    graph->SetPoint(258,0.005445026528,1.158777356);
    graph->SetPoint(259,0.005345643594,1.180320636);
    graph->SetPoint(260,0.005345643594,1.202264435);
    graph->SetPoint(261,0.005248074602,1.224616199);
    graph->SetPoint(262,0.005248074602,1.247383514);
    graph->SetPoint(263,0.005248074602,1.270574105);
    graph->SetPoint(264,0.005152286446,1.294195841);
    graph->SetPoint(265,0.005152286446,1.318256739);
    graph->SetPoint(266,0.00505824662,1.342764961);
    graph->SetPoint(267,0.00505824662,1.367728826);
    graph->SetPoint(268,0.00505824662,1.393156803);
    graph->SetPoint(269,0.00505824662,1.419057522);
    graph->SetPoint(270,0.004965923215,1.445439771);
    graph->SetPoint(271,0.004965923215,1.472312502);
    graph->SetPoint(272,0.004965923215,1.499684836);
    graph->SetPoint(273,0.004965923215,1.527566058);
    graph->SetPoint(274,0.004965923215,1.555965632);
    graph->SetPoint(275,0.004965923215,1.584893192);
    graph->SetPoint(276,0.004965923215,1.614358557);
    graph->SetPoint(277,0.004965923215,1.644371723);
    graph->SetPoint(278,0.004965923215,1.674942876);
    graph->SetPoint(279,0.004965923215,1.706082389);
    graph->SetPoint(280,0.004965923215,1.737800829);
    graph->SetPoint(281,0.004965923215,1.770108958);
    graph->SetPoint(282,0.004965923215,1.803017741);
    graph->SetPoint(283,0.00505824662,1.836538343);
    graph->SetPoint(284,0.00505824662,1.87068214);
    graph->SetPoint(285,0.00505824662,1.905460718);
    graph->SetPoint(286,0.005152286446,1.940885878);
    graph->SetPoint(287,0.005152286446,1.97696964);
    graph->SetPoint(288,0.005248074602,2.01372425);
    graph->SetPoint(289,0.005248074602,2.051162179);
    graph->SetPoint(290,0.005345643594,2.089296131);
    graph->SetPoint(291,0.005345643594,2.128139046);
    graph->SetPoint(292,0.005445026528,2.167704105);
    graph->SetPoint(293,0.00554625713,2.208004733);
    graph->SetPoint(294,0.00554625713,2.249054606);
    graph->SetPoint(295,0.005649369748,2.290867653);
    graph->SetPoint(296,0.005754399373,2.333458062);
    graph->SetPoint(297,0.005861381645,2.376840287);
    graph->SetPoint(298,0.005970352866,2.421029047);
    graph->SetPoint(299,0.006081350013,2.466039337);
    graph->SetPoint(300,0.006194410751,2.511886432);
    graph->SetPoint(301,0.006309573445,2.558585887);
    graph->SetPoint(302,0.006426877173,2.60615355);
    graph->SetPoint(303,0.006546361741,2.654605562);
    graph->SetPoint(304,0.006792036326,2.703958364);
    graph->SetPoint(305,0.006918309709,2.754228703);
    graph->SetPoint(306,0.00704693069,2.805433638);
    graph->SetPoint(307,0.007311390835,2.857590543);
    graph->SetPoint(308,0.007447319739,2.910717118);
    graph->SetPoint(309,0.00758577575,2.96483139);
    graph->SetPoint(310,0.007870457897,3.01995172);
    graph->SetPoint(311,0.008016780634,3.076096815);
    graph->SetPoint(312,0.008317637711,3.133285724);
    graph->SetPoint(313,0.008472274141,3.191537855);
    graph->SetPoint(314,0.008790225168,3.250872974);
    graph->SetPoint(315,0.008953647655,3.311311215);
    graph->SetPoint(316,0.009120108394,3.372873087);
    graph->SetPoint(317,0.009462371614,3.435579479);
    graph->SetPoint(318,0.009638290236,3.49945167);
    graph->SetPoint(319,0.00981747943,3.564511334);
    graph->SetPoint(320,0.01018591388,3.630780548);
    graph->SetPoint(321,0.01037528416,3.698281798);
    graph->SetPoint(322,0.01056817509,3.76703799);
    graph->SetPoint(323,0.01076465214,3.837072455);
    graph->SetPoint(324,0.01096478196,3.908408958);
    graph->SetPoint(325,0.01116863248,3.981071706);
    graph->SetPoint(326,0.01137627286,4.055085354);
    graph->SetPoint(327,0.01137627286,4.13047502);
    graph->SetPoint(328,0.01158777356,4.207266284);
    graph->SetPoint(329,0.01180320636,4.285485204);
    graph->SetPoint(330,0.01180320636,4.365158322);
    graph->SetPoint(331,0.01202264435,4.446312675);
    graph->SetPoint(332,0.01202264435,4.528975799);
    graph->SetPoint(333,0.01224616199,4.613175746);
    graph->SetPoint(334,0.01224616199,4.698941086);
    graph->SetPoint(335,0.01224616199,4.786300923);
    graph->SetPoint(336,0.01224616199,4.875284901);
    graph->SetPoint(337,0.01224616199,4.965923215);
    graph->SetPoint(338,0.01224616199,5.05824662);
    graph->SetPoint(339,0.01224616199,5.152286446);
    graph->SetPoint(340,0.01224616199,5.248074602);
    graph->SetPoint(341,0.01224616199,5.345643594);
    graph->SetPoint(342,0.01224616199,5.445026528);
    graph->SetPoint(343,0.01224616199,5.54625713);
    graph->SetPoint(344,0.01224616199,5.649369748);
    graph->SetPoint(345,0.01224616199,5.754399373);
    graph->SetPoint(346,0.01224616199,5.861381645);
    graph->SetPoint(347,0.01202264435,5.970352866);
    graph->SetPoint(348,0.01202264435,6.081350013);
    graph->SetPoint(349,0.01202264435,6.194410751);
    graph->SetPoint(350,0.01202264435,6.309573445);
    graph->SetPoint(351,0.01180320636,6.426877173);
    graph->SetPoint(352,0.01180320636,6.546361741);
    graph->SetPoint(353,0.01180320636,6.668067692);
    graph->SetPoint(354,0.01158777356,6.792036326);
    graph->SetPoint(355,0.01158777356,6.918309709);
    graph->SetPoint(356,0.01137627286,7.04693069);
    graph->SetPoint(357,0.01137627286,7.177942913);
    graph->SetPoint(358,0.01137627286,7.311390835);
    graph->SetPoint(359,0.01116863248,7.447319739);
    graph->SetPoint(360,0.01116863248,7.58577575);
    graph->SetPoint(361,0.01096478196,7.726805851);
    graph->SetPoint(362,0.01096478196,7.870457897);
    graph->SetPoint(363,0.01096478196,8.016780634);
    graph->SetPoint(364,0.01076465214,8.165823714);
    graph->SetPoint(365,0.01076465214,8.317637711);
    graph->SetPoint(366,0.01076465214,8.472274141);
    graph->SetPoint(367,0.01056817509,8.629785478);
    graph->SetPoint(368,0.01056817509,8.790225168);
    graph->SetPoint(369,0.01056817509,8.953647655);
    graph->SetPoint(370,0.01056817509,9.120108394);
    graph->SetPoint(371,0.01056817509,9.289663868);
    graph->SetPoint(372,0.01037528416,9.462371614);
    graph->SetPoint(373,0.01037528416,9.638290236);
    graph->SetPoint(374,0.01056817509,9.81747943);
    graph->SetPoint(375,0.01056817509,10);
    graph->SetPoint(376,0.01056817509,10.18591388);
    graph->SetPoint(377,0.01076465214,10.37528416);
    graph->SetPoint(378,0.01096478196,10.56817509);
    graph->SetPoint(379,0.01116863248,10.76465214);
    graph->SetPoint(380,0.01137627286,10.96478196);
    graph->SetPoint(381,0.01158777356,11.16863248);
    graph->SetPoint(382,0.01180320636,11.37627286);
    graph->SetPoint(383,0.01202264435,11.58777356);
    graph->SetPoint(384,0.01224616199,11.80320636);
    graph->SetPoint(385,0.01247383514,12.02264435);
    graph->SetPoint(386,0.01294195841,12.24616199);
    graph->SetPoint(387,0.01318256739,12.47383514);
    graph->SetPoint(388,0.01342764961,12.70574105);
    graph->SetPoint(389,0.01393156803,12.94195841);
    graph->SetPoint(390,0.01419057522,13.18256739);
    graph->SetPoint(391,0.01445439771,13.42764961);
    graph->SetPoint(392,0.01472312502,13.67728826);
    graph->SetPoint(393,0.01472312502,13.93156803);
    graph->SetPoint(394,0.01499684836,14.19057522);
    graph->SetPoint(395,0.01527566058,14.45439771);
    graph->SetPoint(396,0.01584893192,14.72312502);
    graph->SetPoint(397,0.01644371723,14.99684836);
    graph->SetPoint(398,0.01706082389,15.27566058);
    graph->SetPoint(399,0.01770108958,15.55965632);
    graph->SetPoint(400,0.01836538343,15.84893192);
    graph->SetPoint(401,0.01905460718,16.14358557);
    graph->SetPoint(402,0.01940885878,16.44371723);
    graph->SetPoint(403,0.0197696964,16.74942876);
    graph->SetPoint(404,0.0197696964,17.06082389);
    graph->SetPoint(405,0.0197696964,17.37800829);
    graph->SetPoint(406,0.0197696964,17.70108958);
    graph->SetPoint(407,0.01940885878,18.03017741);
    graph->SetPoint(408,0.01940885878,18.36538343);
    graph->SetPoint(409,0.01940885878,18.7068214);
    graph->SetPoint(410,0.0197696964,19.05460718);
    graph->SetPoint(411,0.0197696964,19.40885878);
    graph->SetPoint(412,0.0197696964,19.7696964);
    graph->SetPoint(413,0.0197696964,20.1372425);
    graph->SetPoint(414,0.01940885878,20.51162179);
    graph->SetPoint(415,0.01940885878,20.89296131);
    graph->SetPoint(416,0.01905460718,21.28139046);
    graph->SetPoint(417,0.01905460718,21.67704105);
    graph->SetPoint(418,0.01905460718,22.08004733);
    graph->SetPoint(419,0.01905460718,22.49054606);
    graph->SetPoint(420,0.01940885878,22.90867653);
    graph->SetPoint(421,0.0197696964,23.33458062);
    graph->SetPoint(422,0.02051162179,23.76840287);
    graph->SetPoint(423,0.02128139046,24.21029047);
    graph->SetPoint(424,0.02208004733,24.66039337);
    graph->SetPoint(425,0.02249054606,25.11886432);
    graph->SetPoint(426,0.02333458062,25.58585887);
    graph->SetPoint(427,0.02421029047,26.0615355);
    graph->SetPoint(428,0.02466039337,26.54605562);
    graph->SetPoint(429,0.0260615355,27.03958364);
    graph->SetPoint(430,0.02754228703,27.54228703);
    graph->SetPoint(431,0.02857590543,28.05433638);
    graph->SetPoint(432,0.0301995172,28.57590543);
    graph->SetPoint(433,0.03191537855,29.10717118);
    graph->SetPoint(434,0.03311311215,29.6483139);
    graph->SetPoint(435,0.03372873087,30.1995172);
    graph->SetPoint(436,0.03435579479,30.76096815);
    graph->SetPoint(437,0.03435579479,31.33285724);
    graph->SetPoint(438,0.0349945167,31.91537855);
    graph->SetPoint(439,0.03564511334,32.50872974);
    graph->SetPoint(440,0.03630780548,33.11311215);
    graph->SetPoint(441,0.0376703799,33.72873087);
    graph->SetPoint(442,0.0376703799,34.35579479);
    graph->SetPoint(443,0.0376703799,34.9945167);
    graph->SetPoint(444,0.0376703799,35.64511334);
    graph->SetPoint(445,0.03837072455,36.30780548);
    graph->SetPoint(446,0.03908408958,36.98281798);
    graph->SetPoint(447,0.04055085354,37.6703799);
    graph->SetPoint(448,0.04285485204,38.37072455);
    graph->SetPoint(449,0.04446312675,39.08408958);
    graph->SetPoint(450,0.04613175746,39.81071706);
    graph->SetPoint(451,0.04698941086,40.55085354);
    graph->SetPoint(452,0.04875284901,41.3047502);
    graph->SetPoint(453,0.0505824662,42.07266284);
    graph->SetPoint(454,0.05345643594,42.85485204);
    graph->SetPoint(455,0.05445026528,43.65158322);
    graph->SetPoint(456,0.05649369748,44.46312675);
    graph->SetPoint(457,0.05970352866,45.28975799);
    graph->SetPoint(458,0.06194410751,46.13175746);
    graph->SetPoint(459,0.06309573445,46.98941086);
    graph->SetPoint(460,0.06426877173,47.86300923);
    graph->SetPoint(461,0.06546361741,48.75284901);
    graph->SetPoint(462,0.06668067692,49.65923215);
    graph->SetPoint(463,0.06918309709,50.5824662);
    graph->SetPoint(464,0.0704693069,51.52286446);
    graph->SetPoint(465,0.07311390835,52.48074602);
    graph->SetPoint(466,0.07447319739,53.45643594);
    graph->SetPoint(467,0.07726805851,54.45026528);
    graph->SetPoint(468,0.08165823714,55.4625713);
    graph->SetPoint(469,0.08472274141,56.49369748);
    graph->SetPoint(470,0.08629785478,57.54399373);
    graph->SetPoint(471,0.08472274141,58.61381645);
    graph->SetPoint(472,0.08472274141,59.70352866);
    graph->SetPoint(473,0.08472274141,60.81350013);
    graph->SetPoint(474,0.08472274141,61.94410751);
    graph->SetPoint(475,0.08790225168,63.09573445);
    graph->SetPoint(476,0.09120108394,64.26877173);
    graph->SetPoint(477,0.09462371614,65.46361741);
    graph->SetPoint(478,0.09462371614,66.68067692);
    graph->SetPoint(479,0.0981747943,67.92036326);
    graph->SetPoint(480,0.1,69.18309709);
    graph->SetPoint(481,0.1037528416,70.4693069);
    graph->SetPoint(482,0.1076465214,71.77942913);
    graph->SetPoint(483,0.1096478196,73.11390835);
    graph->SetPoint(484,0.1076465214,74.47319739);
    graph->SetPoint(485,0.1076465214,75.8577575);
    graph->SetPoint(486,0.1037528416,77.26805851);
    graph->SetPoint(487,0.1037528416,78.70457897);
    graph->SetPoint(488,0.1037528416,80.16780634);
    graph->SetPoint(489,0.1037528416,81.65823714);
    graph->SetPoint(490,0.1056817509,83.17637711);
    graph->SetPoint(491,0.1056817509,84.72274141);
    graph->SetPoint(492,0.1076465214,86.29785478);
    graph->SetPoint(493,0.1096478196,87.90225168);
    graph->SetPoint(494,0.1116863248,89.53647655);
    graph->SetPoint(495,0.1096478196,91.20108394);
    graph->SetPoint(496,0.1096478196,92.89663868);
    graph->SetPoint(497,0.1096478196,94.62371614);
    graph->SetPoint(498,0.1116863248,96.38290236);
    graph->SetPoint(499,0.1116863248,98.1747943);
    graph->SetPoint(500,0.1096478196,100);

    graph->SetLineColor(kRed-3);
    graph->SetLineStyle(1);
    graph->SetLineWidth(2);
    graph->Draw("l same");

}
Exemplo n.º 21
0
void Limit_2D_LQ() {
    
    //  setTDRStyle();
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetLineWidth(2);
    gROOT->ForceStyle();
    
    
    TCanvas *c = new TCanvas("c1", "c1",0,45,600,600);
    gStyle->SetOptStat(0);
    c->SetHighLightColor(2);
    c->Range(0,0,1,1);
    c->SetFillColor(0);
    c->SetBorderMode(0);
    c->SetBorderSize(2);
    c->SetLeftMargin(0.12);
    c->SetRightMargin(0.04);
    c->SetTopMargin(0.06);
    c->SetBottomMargin(0.12);
    c->SetFrameFillStyle(0);
    c->SetFrameLineWidth(2);
    c->SetFrameBorderMode(0);
    c->SetTickx(1);
    c->SetTicky(1);
    
    c->cd();
    
    //  const int nMass = 15;
    //  Double_t mData[] = {200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900};
    //  Double_t limit_observed[] = {0.0827284, 0.0981056, 0.0646578, 0.0733808, 0.115078, 0.154828, 0.227671, 0.307448, 0.39362, 0.554267, 0.783352, 1.07813, 1.5539, 2.21602, 3.46142};
    //  Double_t limit_expected[] = {0.088132, 0.100218, 0.0708202, 0.0703361, 0.090391, 0.131143, 0.175555, 0.247355, 0.34838, 0.487021, 0.693413, 0.979308, 1.406, 2.00591, 3.09258};
    ////
    //
    //
    //
    //    //    //    https://twiki.cern.ch/twiki/bin/view/CMS/Exo2015LQ1AndLQ2Analyses
    
    std::map<int, float> XS;
    XS[200]=      60.6;
    XS[250]=      20.3;
    XS[300]=      8.05E+00;
    XS[350]=      3.58E+00;
    XS[400]=      1.74E+00;
    XS[450]=      9.05E-01;
    XS[500]=      4.96E-01;
    XS[550]=      2.84E-01;
    XS[600]=      1.69E-01;
    XS[650]=      1.03E-01;
    XS[700]=      6.48E-02;
    XS[750]=      4.16E-02;
    XS[800]=      2.73E-02;
    XS[850]=      1.82E-02;
    XS[900]=      1.23E-02;
    XS[950]=      8.45E-03;
    XS[1000]=      5.86E-03;
    XS[1050]=      4.11E-03;
    XS[1100]=      2.91E-03;
    XS[1150]=      2.08E-03;
    XS[1200]=      1.50E-03;
    XS[1250]=      1.09E-03;
    XS[1300]=      7.95E-04;
    XS[1350]=      5.85E-04;
    XS[1400]=      4.33E-04;
    XS[1450]=      3.21E-04;
    XS[1500]=      2.40E-04;
    
    
    
    const int nMass = 26;
    int mData[nMass] = {
        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};
    
    
    
    // Observed!!!!!!!
    
    Double_t ObservedLimitValues[27] = {
        
        5.169031,
        2.127156,
        1.119, // new
        0.554736,
        0.279327,
        0.164877,
        0.10318,
        0.0695557,
        0.0507156,
        0.0386856,
        0.031826,
        0.0244583,
        0.0194931,
        0.0175816,
        0.0156609,
        0.0132805,
        0.0108856,
        0.00979614,
        0.0088028,
        0.00763702,
        0.00695305,
        0.00662155,
        0.0061306,
        0.0051651,
        0.0056942,
        0.00519066,
        0.00458145};
    
    
    // Expected !!!!!
    
    Double_t ExpectedLimitValues[27] = {
        5.212884,
        2.624342,
        1.0423, //new
        0.39624,
        0.206909,
        0.113708,
        0.0687866,
        0.0496826,
        0.0375671,
        0.028656,
        0.0247536,
        0.0197548,
        0.0155945,
        0.0136745,
        0.0126492,
        0.0102158,
        0.00997849,
        0.0089798,
        0.00806923,
        0.00694275,
        0.00632095,
        0.00601959,
        0.00557327,
        0.0051651,
        0.00517654,
        0.00471878,
        0.00458145};
    
    
    //Plus One sigma
    Double_t PlusOneSigmaLimitValues[27] = {
        2.541088,
        1.288593,
        0.502809,
        0.1918498,
        0.103455,
        0.051169,
        0.0343934,
        0.0248413,
        0.0187836,
        0.014328,
        0.0106086,
        0.0103477,
        0.0077972,
        0.0058606,
        0.005421,
        0.0061294,
        0.00362851,
        0.0040817,
        0.00366787,
        0.00485995,
        0.00379255,
        0.00361176,
        0.00334397,
        0.00361557,
        0.00258828,
        0.00377502,
        0.00320702};
    
    
    
    
    ////////////////////////////////////////////////////////////////
    //   -1 sigma
    ////////////////////////////////////////////////////////////////
    Double_t MinusOneSigmaLimitValues[27] = {
        1.480962,
        0.7831655,
        0.2920889,
        0.09906,
        0.051727,
        0.0341121,
        0.0171966,
        0.0149048,
        0.0093917,
        0.007164,
        0.0082512,
        0.0056442,
        0.0046784,
        0.0032558,
        0.00421643,
        0.00306477,
        0.00362854,
        0.00326538,
        0.0022007,
        0.00208283,
        0.00126419,
        0.00180588,
        0.00167198,
        0.00154953,
        0.0010353,
        0.00094376,
        0.00091629};

    
    
    
    //
    Double_t limit_expected[26];
    Double_t limit_plusOneSigma[26];
    Double_t limit_MinusOneSigma[26];
    Double_t limit_observed[26];
    
    for (int i=0; i < 26; i++){
        limit_expected[i]=ExpectedLimitValues[i]/XS[mData[i]];
        limit_plusOneSigma[i]=(ExpectedLimitValues[i]+PlusOneSigmaLimitValues[i])/XS[mData[i]];
        limit_MinusOneSigma[i]=(ExpectedLimitValues[i]-MinusOneSigmaLimitValues[i])/XS[mData[i]];
        limit_observed[i]=ObservedLimitValues[i]/XS[mData[i]];
    }
    
    
    
    /* //Asympt CLs
     Double_t limit_observed[] = {0.0594621, 0.0843084, 0.0609738, 0.0718055, 0.110206, 0.147462, 0.217648, 0.294432, 0.367942, 0.525929, 0.739963, 1.01469, 1.45093, 2.07904, 3.25821};
     Double_t limit_expected[] = {0.074707, 0.103027, 0.0668945, 0.0737305, 0.0942383, 0.130371, 0.175293, 0.250977, 0.338867, 0.482422, 0.689453, 0.964844, 1.37109, 1.94531, 2.99219};
     */
    
    std::vector<double> limExp;
    std::vector<double> betaExp;
    
    std::vector<double> limPlusSigma;
    std::vector<double> betaPlusSigma;
    
    std::vector<double> limMinusSigma;
    std::vector<double> betaMinusSigma;
    
    std::vector<double> limObs;
    std::vector<double> betaObs;
    
    
    
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////
    // Expected limit
    ///////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i != 1; ++i) {
        double lim1 = limit_expected[i];
        double lim2 = limit_expected[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            
//            cout << m1 <<" "<< m2 <<" "<< 1<<" "<< 1<<" "<< lim1/beta/beta<<" "<<  lim2/beta/beta <<" "<< "  --->  "<< result<<"\n";
            
            
            if ( result != 0 ) {
                limExp.push_back(result);
                betaExp.push_back(beta);
//                cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 1; i != 2; ++i) {
        double lim1 = limit_expected[i];
        double lim2 = limit_expected[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 1.001; beta >= 0; beta -= 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limExp.push_back(result);
                betaExp.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 2; i != nMass; ++i) {
        double lim1 = limit_expected[i];
        double lim2 = limit_expected[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limExp.push_back(result);
                betaExp.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }

    
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////
    // Expected +1 sigma  limit
    ///////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i != 1; ++i) {
        double lim1 = limit_plusOneSigma[i];
        double lim2 = limit_plusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            
//            cout << m1 <<" "<< m2 <<" "<< 1<<" "<< 1<<" "<< lim1/beta/beta<<" "<<  lim2/beta/beta <<" "<< "  --->  "<< result<<"\n";
            
            
            if ( result != 0 ) {
                limPlusSigma.push_back(result);
                betaPlusSigma.push_back(beta);
//                cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 1; i != 2; ++i) {
        double lim1 = limit_plusOneSigma[i];
        double lim2 = limit_plusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 1.001; beta >= 0; beta -= 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limPlusSigma.push_back(result);
                betaPlusSigma.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 2; i != nMass; ++i) {
        double lim1 = limit_plusOneSigma[i];
        double lim2 = limit_plusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limPlusSigma.push_back(result);
                betaPlusSigma.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
  
    
    ///////////////////////////////////////////////////////////////////////////////////////////
    // Expected -1 sigma  limit
    ///////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i != 1; ++i) {
        double lim1 = limit_MinusOneSigma[i];
        double lim2 = limit_MinusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            
//            cout << m1 <<" "<< m2 <<" "<< 1<<" "<< 1<<" "<< lim1/beta/beta<<" "<<  lim2/beta/beta <<" "<< "  --->  "<< result<<"\n";
            
            
            if ( result != 0 ) {
                limMinusSigma.push_back(result);
                betaMinusSigma.push_back(beta);
//                cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 1; i != 2; ++i) {
        double lim1 = limit_MinusOneSigma[i];
        double lim2 = limit_MinusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 1.001; beta >= 0; beta -= 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limMinusSigma.push_back(result);
                betaMinusSigma.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    for(int i = 2; i != nMass; ++i) {
        double lim1 = limit_MinusOneSigma[i];
        double lim2 = limit_MinusOneSigma[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limMinusSigma.push_back(result);
                betaMinusSigma.push_back(beta);
                //	cout << beta << '\t' << result << endl; //KK
                
            }
        }
    }
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////
    // observed limit
    ///////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i != 1; ++i) {
        double lim1 = limit_observed[i];
        double lim2 = limit_observed[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limObs.push_back(result);
                betaObs.push_back(beta);
            }
        }
    }
    for(int i = 1; i != 2; ++i) {
        double lim1 = limit_observed[i];
        double lim2 = limit_observed[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 1.001; beta >= 0; beta -= 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limObs.push_back(result);
                betaObs.push_back(beta);
            }
        }
    }
    for(int i = 2; i != nMass; ++i) {
        double lim1 = limit_observed[i];
        double lim2 = limit_observed[i+1];
        double m1 = mData[i];
        double m2 = mData[i+1];
        
        for(double beta = 0.001; beta < 1.001; beta += 0.001) {
            double result = intersection(m1, m2, 1, 1, lim1/beta/beta, lim2/beta/beta);
            if ( result != 0 ) {
                limObs.push_back(result);
                betaObs.push_back(beta);
            }
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    //////////////////////////////////////////////////////////////////
    // Expected
    //////////////////////////////////////////////////////////////////
    const int nexp = limExp.size();
    
//    cout <<"-------------------->   "<<nexp <<"\n\n\n\n";
    
    Double_t massExp[nexp+4];
    Double_t bExp[nexp+4];
    for(int i = 0; i != nexp; ++i) {
        massExp[i] = limExp[i];
        bExp[i] = betaExp[i];
//        cout <<"###### exp massExp[i] "<<massExp[i] << "   bExp[i] "<<bExp[i]<<"\n";
    }
    
    massExp[nexp] = massExp[nexp-1];
    bExp[nexp]    = 1;

    massExp[nexp+1] = 200;
    bExp[nexp+1]    = 1;
    
    massExp[nexp+2] = 200;
    bExp[nexp+2] = bExp[0];
    
    massExp[nexp+3] = massExp[0];
    bExp[nexp+3] = bExp[0];
    
    
    //////////////////////////////////////////////////////////////////
    // Plus One Sigma
    //////////////////////////////////////////////////////////////////
    const int nplusSig = limPlusSigma.size();
    
//    cout <<"-------------------->   "<<nplusSig <<"\n\n\n\n";
    
    Double_t massPlusOneSigma[nplusSig+4];
    Double_t bPlusOneSigma[nplusSig+4];
    for(int i = 0; i != nplusSig; ++i) {
        massPlusOneSigma[i] = limPlusSigma[i];
        bPlusOneSigma[i] = betaPlusSigma[i];
//        cout <<"###### exp massPlusOneSigma[i] "<<massPlusOneSigma[i] << "   bPlusOneSigma[i] "<<bPlusOneSigma[i]<<"\n";
    }
    
    massPlusOneSigma[nplusSig] = massPlusOneSigma[nplusSig-1];
    bPlusOneSigma[nplusSig]    = 1;
    
    massPlusOneSigma[nplusSig+1] = 200;
    bPlusOneSigma[nplusSig+1]    = 1;
    
    massPlusOneSigma[nplusSig+2] = 200;
    bPlusOneSigma[nplusSig+2] = bPlusOneSigma[0];
    
    massPlusOneSigma[nplusSig+3] = massPlusOneSigma[0];
    bPlusOneSigma[nplusSig+3] = bPlusOneSigma[0];
    
    Double_t NewbPlusOneSigma[nexp+4];
    for(int i = 0; i != nexp+4; ++i) {
        NewbPlusOneSigma[i]=bPlusOneSigma[i]-bExp[i];
    }
    
    //////////////////////////////////////////////////////////////////
    // Minus One Sigma
    //////////////////////////////////////////////////////////////////
    const int nMinusSig = limMinusSigma.size();
    
//    cout <<"-------------------->   "<<nMinusSig <<"\n\n\n\n";
    
    Double_t massMinusOneSigma[nMinusSig+4];
    Double_t bMinusOneSigma[nMinusSig+4];
    for(int i = 0; i != nMinusSig; ++i) {
        massMinusOneSigma[i] = limMinusSigma[i];
        bMinusOneSigma[i] = betaMinusSigma[i];
//        cout <<"###### exp massMinusOneSigma[i] "<<massMinusOneSigma[i] << "   bMinusOneSigma[i] "<<bMinusOneSigma[i]<<"\n";
    }
    
    massMinusOneSigma[nMinusSig] = massMinusOneSigma[nMinusSig-1];
    bMinusOneSigma[nMinusSig]    = 1;
    
    massMinusOneSigma[nMinusSig+1] = 200;
    bMinusOneSigma[nMinusSig+1]    = 1;
    
    massMinusOneSigma[nMinusSig+2] = 200;
    bMinusOneSigma[nMinusSig+2] = bMinusOneSigma[0];
    
    massMinusOneSigma[nMinusSig+3] = massMinusOneSigma[0];
    bMinusOneSigma[nMinusSig+3] = bMinusOneSigma[0];
    
    
    Double_t NewbMinusOneSigma[nexp+4];
    for(int i = 0; i != nexp+4; ++i) {
        NewbMinusOneSigma[i]=bExp[i]-bMinusOneSigma[i];
        
//        cout<<"  mas comaprison "<<massExp[i]<<"  "<<massMinusOneSigma[i]<<"  "<<massPlusOneSigma[i]<<"\n";
        
    }
    
    //////////////////////////////////////////////////////////////////
    // Observed
    //////////////////////////////////////////////////////////////////
    const int nobs = limObs.size();
    float massObs[nobs+4];
    float bObs[nobs+4];
    for(int i = 0; i != nobs; ++i) {
        massObs[i] = limObs[i];
        bObs[i] = betaObs[i];
//        cout <<"###### obs massObs[i] "<<massObs[i] << "   bObs[i] "<<bObs[i]<<"\n";
    }
    
    massObs[nobs] = massObs[nobs-1];
    bObs[nobs]    = 1;
    
    massObs[nobs+1] = 200;
    bObs[nobs+1]    = 1;

    massObs[nobs+2] = 200;
    bObs[nobs+2] = bObs[0];

    massObs[nobs+3] = massObs[0];
    bObs[nobs+3] = bObs[0];
    
    
    //////////////////////////////////////////////////////////////////
    // TGRAPH
    //////////////////////////////////////////////////////////////////
//    massExp.sort()
    TGraph* grExp = new TGraph(nexp+4, massExp, bExp);
    grExp->Sort(&TGraph::CompareX, 0, 0,-1111);
    
    TGraph* gPlusOneSigma = new TGraph(nplusSig+4, massPlusOneSigma, bPlusOneSigma);
    gPlusOneSigma->Sort(&TGraph::CompareX, 0, 0,-1111);
    
    TGraph* gMinusOneSigma = new TGraph(nMinusSig+4, massMinusOneSigma, bMinusOneSigma);
    gMinusOneSigma->Sort(&TGraph::CompareX, 0, 0,-1111);

    TGraph* grObs = new TGraph(nobs+4, massObs, bObs);
//    grObs->Sort();
    //  for(int i = 0; i < nexp+3; ++i) {
    //    cout << i << "\t" << massExp[i] << "\t" << bExp[i] << endl;
    //  }
    
    
    
    // ------------>Primitives in pad: pad_plot
    TPad *pad_plot = new TPad("pad_plot", "pad_plot",0,0,1,1);
    pad_plot->Draw();
    pad_plot->cd();
    pad_plot->Range(10.71429,-5.02439,1500,3.512195);
    pad_plot->SetFillColor(0);
    pad_plot->SetFillStyle(4000);
    pad_plot->SetBorderMode(0);
    pad_plot->SetBorderSize(2);
    //    pad_plot->SetLogy();
    //    pad_plot->SetGridx();
    //    pad_plot->SetGridy();
    pad_plot->SetLeftMargin(0.12);
    pad_plot->SetRightMargin(0.04);
    pad_plot->SetTopMargin(0.06);
    pad_plot->SetBottomMargin(0.12);
    pad_plot->SetFrameFillStyle(0);
    pad_plot->SetFrameLineWidth(2);
    pad_plot->SetFrameBorderMode(0);
    pad_plot->SetFrameFillStyle(0);
    pad_plot->SetFrameLineWidth(2);
    pad_plot->SetFrameBorderMode(0);
    pad_plot->SetTickx(1);
    pad_plot->SetTicky(1);
    
    
    
    TH2F* frame = new TH2F("frame", "", 100, 200, 1000, 100, 0.001, 1);
    TAxis* ax = frame->GetXaxis();
    TAxis* ay = frame->GetYaxis();
    ax->SetTitle("M_{LQ} [GeV]");
    //  ax->SetLabelOffset(0.01);
    ay->SetTitle("#beta");
    //ay->SetTitle("#Beta(LQ#rightarrow#tau b)");
    //    ax->SetTitleFont(132);
    ax->SetTitleSize(0.05);
    //    ay->SetTitleFont(132);
    ay->SetTitleSize(0.05);
    ay->SetRangeUser(0.,1);
    frame->Draw();
    
//    grExp->SetLineColor(TColor::GetColor(0, 0, 333));
//    grExp->SetFillColorAlpha(TColor::GetColor(200, 222, 285), 0.65);
    
    
//    grObs->SetLineColor(TColor::GetColor(0, 0, 333));
    grObs->SetFillColorAlpha(TColor::GetColor(200, 222, 285), 0.65);
//    grObs->SetLineColor(kBlack);
    grObs->SetLineWidth(3);
    
    grExp->SetLineColor(kBlack);
    grExp->SetLineWidth(2);
    grExp->SetLineStyle(7);
    //    grObs->SetFillStyle(3005);
    //  grExp->SetLineWidth(2);
    //  grObs->SetLineWidth(2);
    //  grObs->SetFillStyle(3005);
//    grObs->Draw("F");
    
    grExp->Draw("L");
    
//    grExp->Draw("Lsame");
    
    
    

//    gMinusOneSigma->SetLineColor(kBlue);
    gMinusOneSigma->SetLineWidth(0);
//    gMinusOneSigma->SetLineStyle(2);
    ci = TColor::GetColor("#fcf10f");
    gMinusOneSigma->SetFillColorAlpha(15, 0.65);
    gMinusOneSigma->Draw("f");
    
    
//    gPlusOneSigma->SetLineColor(kBlue);
    gPlusOneSigma->SetLineWidth(0);
//    gPlusOneSigma->SetLineStyle(2);
//    ci = TColor::GetColor("#fcf10f");
    gPlusOneSigma->SetFillColor(0);
    gPlusOneSigma->Draw("fsame");
    
    

    
//    gMinusOneSigma->Draw("Lsame");
    grObs->Draw("LSame");
    grObs->Draw("fsame");
//    grExp->Draw("same");
//    frame->Draw("same");
    frame->Draw("sameaxis");

//        grExp->Draw("Lsame");
//    grObs->Draw("fsame");
//
//    Double_t x[5] = {200,300,400,500,600};
//    Double_t y[5] = {5,.1,.9,.7,.5};
//    TPolyLine *pline = new TPolyLine(nexp+4,massExp,bExp);
//    pline->SetFillColor(38);
//    pline->SetLineColor(2);
//    pline->SetLineWidth(4);
//    pline->Draw("f");
//    pline->Draw();
//
    
    //    TLatex* tx = new TLatex(250,0.93,"CMS");
    //    tx->SetTextFont(61);
    //    tx->SetTextSize(0.05);
    //    tx->Draw("SAME");
    //    TLatex* tx2 = new TLatex(1000,1.03101,"12.9 fb^{-1} (13 TeV)");
    //    tx2->SetTextSize(0.04);
    //    tx2->SetTextAlign(   12 );
    //    tx2->SetTextColor(    1 );
    //    tx2->SetTextFont (   42 );
    //    tx2->Draw("SAME");
    
    
    
    float lowX=0.65;
    float lowY=0.85;
    TPaveText * lumi  = new TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC");
    lumi->SetBorderSize(   0 );
    lumi->SetFillStyle(    0 );
    lumi->SetTextAlign(   12 );
    lumi->SetTextColor(    1 );
    lumi->SetTextSize(0.04);
    lumi->SetTextFont (   42 );
    lumi->AddText("12.9 fb^{-1} (13 TeV)");
    lumi->Draw();
    
    lowX=0.15;
    lowY=0.75;
    TPaveText * lumi1  = new TPaveText(lowX, lowY+0.06, lowX+0.15, lowY+0.16, "NDC");
    lumi1->SetTextFont(61);
    lumi1->SetTextSize(0.05);
    lumi1->SetBorderSize(   0 );
    lumi1->SetFillStyle(    0 );
    lumi1->SetTextAlign(   12 );
    lumi1->SetTextColor(    1 );
    lumi1->AddText("CMS");
    lumi1->Draw();
    
    
    
    
    
    

    Double_t Graph0_felx3001[1000] = {0};
    
    Double_t Graph0_fehx3001[1000] = {0};
    
    
    
    
//    for (int i=0;i < 100; i++){
//        
//        cout << "check--->>>>>"<<massExp[i]<<" "<<bExp[i]<<" "<<Graph0_felx3001[i]<<" "<<Graph0_fehx3001[i]<<" "<<NewbMinusOneSigma[i]<<" "<<NewbPlusOneSigma[i]<<"\n";
//    }
    
    
//    const Int_t n = 5;
//    Double_t x[n]   = {200, 250, 300, 350, 400};
//    Double_t y[n]   = {.2,.3,.4,.5,.6};
//    Double_t exl[n] = {0};
//    Double_t exh[n] = {0};
//    Double_t eyl[n] = {.1,.2,.3,.4,.5};
//    Double_t eyh[n] = {.3,.4,.5,.6,.7};
//    TGraphAsymmErrors *grae = new TGraphAsymmErrors(n,x,y,exl,exh,eyl,eyh);
    
    
    
    TGraphAsymmErrors *grae = new TGraphAsymmErrors(700,massExp,bExp,Graph0_felx3001,Graph0_fehx3001,NewbMinusOneSigma,NewbPlusOneSigma);
    grae->Sort(&TGraph::CompareX, 0, 0,-1111);
    grae->SetName("");
    grae->SetTitle("");
    
    ci = TColor::GetColor("#fcf10f");
    grae->SetFillColorAlpha(ci, 0.65);

//    grae->SetMarkerStyle(20);
    
    
//    TH1F *Graph_Graph3002 = new TH1F("Graph_Graph3002","",100,70,1630);
//    Graph_Graph3002->SetMinimum(0);
//    Graph_Graph3002->SetMaximum(7.043383);
//    Graph_Graph3002->SetDirectory(0);
//    Graph_Graph3002->SetStats(0);
//    Graph_Graph3002->SetLineStyle(0);
//    Graph_Graph3002->SetMarkerStyle(20);
//    Graph_Graph3002->GetXaxis()->SetNdivisions(506);
//    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()->SetNdivisions(506);
//    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.08);
//    Graph_Graph3002->GetYaxis()->SetTitleFont(42);
//    Graph_Graph3002->GetZaxis()->SetNdivisions(506);
//    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("3LP");
    
    
    
    //  TLegend* leg = new TLegend(0.50, 0.14, 0.90, 0.35,"CMS 19.7 fb^{-1}, #sqrt{s} = 8 TeV", "brNDC");
    //  TLegend* leg = new TLegend(0.50, 0.14, 0.90, 0.35,"19.7 fb^{-1}, #sqrt{s} = 8 TeV", "brNDC");
    TLegend* leg = new TLegend(0.45, 0.20, 0.8, 0.35,"", "brNDC");
    leg->SetTextFont(42);
    leg->SetTextSize(0.04);
    leg->SetMargin(0.15);
    leg->SetFillColor(0);
    leg->SetBorderSize(0);
    leg->AddEntry(grObs, "Observed exclusion","f");
    leg->AddEntry(grExp, "Median expected limit","L");
    leg->AddEntry(gMinusOneSigma, "68% expected limit","f");
    leg->Draw();
    
    //gPad->RedrawAxis();
    //    c->RedrawAxis();
    //    pad_plot->Modified();
    pad_plot->Draw();
    c->cd();
    c->Modified();
    //    c->Print("limit_beta_vs_mass.eps");
    c->Print("limit_2D_LQ.pdf");
    //  c->Print("limit_beta_vs_mass.png");
    
    
}
Exemplo n.º 22
0
///
/// Make a plot out of a 1D histogram holding a 1-CL curve.
/// The strategy is to always convert the 1-CL histogram (hCL) into
/// a TGraph. This way we can add known points (solutions, points
/// at end of scan range) and also have a filled area without line
/// smoothing. This is not possible with histograms due to a Root bug.
///
/// The function draws the TGraphs, and returns a pointer to the
/// TGraph object that can be used in the TLegend.
///
/// Markers are plotted if the method name of the scanner is "Plugin" or "BergerBoos" or "DatasetsPlugin".
/// One can plot a line instead of points even for the Plugin method by
/// using setPluginMarkers().
///
/// For the angle variables, a new axis is painted that is in Deg.
///
/// \param s The scanner to plot.
/// \param first
/// \param last
/// \param filled
///
TGraph* OneMinusClPlot::scan1dPlot(MethodAbsScan* s, bool first, bool last, bool filled, int CLsType)
{
	if ( arg->debug ){
		cout << "OneMinusClPlot::scan1dPlot() : plotting ";
		cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
	}
	if ( m_mainCanvas==0 ){
		m_mainCanvas = newNoWarnTCanvas(name+getUniqueRootName(), title, 800, 600);
	}
	m_mainCanvas->cd();
	bool plotPoints = ( s->getMethodName()=="Plugin" || s->getMethodName()=="BergerBoos" || s->getMethodName()=="DatasetsPlugin" ) && plotPluginMarkers;
	TH1F *hCL = (TH1F*)s->getHCL()->Clone(getUniqueRootName());
	if (CLsType==1) hCL = (TH1F*)s->getHCLs()->Clone(getUniqueRootName());
  else if (CLsType==2) hCL = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
	// fix inf and nan entries
	for ( int i=1; i<=s->getHCL()->GetNbinsX(); i++ ){
		if ( s->getHCL()->GetBinContent(i)!=s->getHCL()->GetBinContent(i)
				|| std::isinf(s->getHCL()->GetBinContent(i)) ) s->getHCL()->SetBinContent(i, 0.0);
	}

	// remove errors the hard way, else root ALWAYS plots them
	if ( !plotPoints ) hCL = histHardCopy(hCL, true, true);

	// disable any statistics box
	hCL->SetStats(0);

	// Convert the histogram into a TGraph so we can add the solution.
	// Also, the lf2 drawing option is broken in latest root versions.
	TGraph *g;
	if ( plotPoints ) g = new TGraphErrors(hCL->GetNbinsX());
	else              g = new TGraph(hCL->GetNbinsX());
	g->SetName(getUniqueRootName());
	for ( int i=0; i<hCL->GetNbinsX(); i++ ){
		g->SetPoint(i, hCL->GetBinCenter(i+1), hCL->GetBinContent(i+1));
		if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(i, 0.0, hCL->GetBinError(i+1));
	}

	// add solution
	if ( ! s->getSolutions().empty() ){
		TGraphTools t;
		TGraph *gNew = t.addPointToGraphAtFirstMatchingX(g, s->getScanVar1Solution(0), 1.0);
		delete g;
		g = gNew;
	}

	// // set last point to the same p-value as first point by hand
	// // some angle plots sometimes don't manage to do it by themselves...
	// if ( arg->isQuickhack(XX) )
	// {
	//   Double_t pointx0, pointy0, err0;
	//   Double_t pointx1, pointy1, err1;
	//   g->GetPoint(0, pointx0, pointy0);
	//   g->GetPoint(g->GetN()-1, pointx1, pointy1);
	//   g->SetPoint(g->GetN()-1, pointx1, pointy0);
	//   if ( plotPoints ) err0 = ((TGraphErrors*)g)->GetErrorY(0);
	//   if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(g->GetN()-1, 0.0, err0);
	// }

	// add end points of scan range
	if ( !plotPoints )
	{
		Double_t pointx0, pointy0;
		TGraph *gNew = new TGraph(g->GetN()+4);
		gNew->SetName(getUniqueRootName());
		for ( int i=0; i<g->GetN(); i++)
		{
			g->GetPoint(i, pointx0, pointy0);
			gNew->SetPoint(i+2, pointx0, pointy0);
		}

		// add origin
		gNew->SetPoint(0, hCL->GetXaxis()->GetXmin(), 0);

		// add a point at first y height but at x=origin.
		g->GetPoint(0, pointx0, pointy0);
		gNew->SetPoint(1, hCL->GetXaxis()->GetXmin(), pointy0);

		// add a point at last y height but at x=xmax.
		g->GetPoint(g->GetN()-1, pointx0, pointy0);
		gNew->SetPoint(gNew->GetN()-2, hCL->GetXaxis()->GetXmax(), pointy0);

		// add a point at xmax, 0
		gNew->SetPoint(gNew->GetN()-1, hCL->GetXaxis()->GetXmax(), 0);
		g = gNew;
	}

	int color = s->getLineColor();
	if(CLsType>0 && s->getMethodName().Contains("Plugin") && !arg->plotpluginonly) {
    if (CLsType==1) color = kBlue-7;
    else if (CLsType==2) color = kBlue+2;
  }
	else if(CLsType>0) {
    if (CLsType==1) color = s->getLineColor() - 5;
    if (CLsType==2) color = s->getLineColor() - 4;
  }
	g->SetLineColor(color);

	if ( filled ){
		g->SetLineWidth(2);
    double alpha = arg->isQuickhack(12) ? 0.4 : 1.;
    if ( arg->isQuickhack(24) ) alpha = 0.;
		g->SetFillColorAlpha(color,alpha);
		g->SetLineStyle(1);
    g->SetFillStyle( s->getFillStyle() );
	}
	else{
		g->SetLineWidth(2);
		g->SetLineStyle(s->getLineStyle());
    if ( last && arg->isQuickhack(25) ) g->SetLineWidth(3);
	}

	if ( plotPoints ){
		g->SetLineWidth(1);
		g->SetMarkerColor(color);
		g->SetMarkerStyle(8);
		g->SetMarkerSize(0.6);
		if(CLsType==1) {
			g->SetMarkerStyle(33);
			g->SetMarkerSize(1);
		}
		if(CLsType==2) {
			g->SetMarkerStyle(21);
		}
	}

	// build a histogram which holds the axes
	float min = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmin() : arg->scanrangeMin;
	float max = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmax() : arg->scanrangeMax;
	TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
	haxes->SetStats(0);
	haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	haxes->GetYaxis()->SetTitle("1-CL");
	haxes->GetXaxis()->SetLabelFont(font);
	haxes->GetYaxis()->SetLabelFont(font);
	haxes->GetXaxis()->SetTitleFont(font);
	haxes->GetYaxis()->SetTitleFont(font);
	haxes->GetXaxis()->SetTitleOffset(0.9);
	haxes->GetYaxis()->SetTitleOffset(0.85);
	haxes->GetXaxis()->SetLabelSize(labelsize);
	haxes->GetYaxis()->SetLabelSize(labelsize);
	haxes->GetXaxis()->SetTitleSize(titlesize);
	haxes->GetYaxis()->SetTitleSize(titlesize);
	int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
	bool optimizeNdiv = arg->ndiv<0 ? true : false;
	haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
	haxes->GetYaxis()->SetNdivisions(407, true);

  // plot y range
  float plotYMax;
  float plotYMin;
  if ( plotLegend && !arg->isQuickhack(22) ) {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 10.; }
    else                { plotYMin = 0.0  ; plotYMax = 1.3; }
  }
  else {
    if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 1.0; }
    else                { plotYMin = 0.0  ; plotYMax = 1.0; }
  }
  // change if passed as option
	plotYMin = arg->plotymin > 0. ? arg->plotymin : plotYMin;
  plotYMax = arg->plotymax > 0. ? arg->plotymax : plotYMax;

  haxes->GetYaxis()->SetRangeUser( plotYMin, plotYMax );
	haxes->Draw("axissame");
	g->SetHistogram(haxes);

	TString drawOption = "";
	if ( plotPoints )   drawOption += " pe";
	else if ( filled )  drawOption += " F";
	else                drawOption += " L";
	if ( first )        drawOption += " A";
	g->Draw(drawOption);
  //if ( drawOption.Contains("F") ) ((TGraph*)g->Clone())->Draw("L");

	gPad->Update();
	float ymin = gPad->GetUymin();
	float ymax = gPad->GetUymax();
	float xmin = gPad->GetUxmin();
	float xmax = gPad->GetUxmax();

	// for the angles, draw a new axis in units of degrees
	if ( isAngle(s->getScanVar1()) ){
		haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle() + TString(" [#circ]"));
		haxes->GetXaxis()->SetNdivisions(0);  // disable old axis
		if ( last ){
			// new top axis
			TString chopt = "-U"; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axist = new TGaxis(xmin, 1, xmax, 1, RadToDeg(xmin), RadToDeg(xmax), xndiv, chopt);
			axist->SetName("axist");
			axist->Draw();

			// new bottom axis
			float axisbMin = RadToDeg(xmin);
			float axisbMax = RadToDeg(xmax);
			if ( arg->isQuickhack(3) ){ ///< see documentation of --qh option in OptParser.cpp
				axisbMin += 180.;
				axisbMax += 180.;
			}
			chopt = ""; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axisb = new TGaxis(xmin, ymin, xmax, ymin, axisbMin, axisbMax, xndiv, chopt);
			axisb->SetName("axisb");
			axisb->SetLabelFont(font);
			axisb->SetLabelSize(labelsize);
			axisb->Draw();
		}
	}
	else
	{
		if ( last ){
			// add top axis
			TString chopt = "-U"; // - = downward ticks, U = unlabeled, http://root.cern.ch/root/html534/TGaxis.html
			if ( !optimizeNdiv ) chopt += "N"; // n = no bin optimization
			TGaxis *axist = new TGaxis(xmin, 1.0, xmax, 1.0, xmin, xmax, xndiv, chopt);
			axist->SetName("axist");
			axist->SetLineWidth(1);
			axist->Draw();
		}
	}

	if ( last )
	{
		// add right axis
		TGaxis *axisr = 0;
		if ( arg->plotlog ){
			float f3min = 1e-3;
			float f3max = (plotLegend && !arg->isQuickhack(22)) ? 10. : 1.;
			TF1 *f3 = new TF1("f3","log10(x)",f3min,f3max);
			axisr = new TGaxis(xmax, f3min, xmax, f3max, "f3", 510, "G+");
		}
		else{
			axisr = new TGaxis(xmax, ymin, xmax, ymax, 0, (plotLegend && !arg->isQuickhack(22)) ? 1.3 : 1.0, 407, "+");
		}
		axisr->SetLabelSize(0);
		axisr->SetLineWidth(1);
		axisr->SetName("axisr");
		axisr->SetLabelColor(kWhite);
		axisr->SetTitleColor(kWhite);
		axisr->Draw();

		// redraw right axis as well because the 1-CL graph can cover the old one
		haxes->Draw("axissame");
	}

	return g;
}
void Final_av_Lambda_VarCoupling_40Percent()
{
//=========Macro generated from canvas: c/c
//=========  (Mon Feb 22 19:41:13 2016) by ROOT version6.04/06
   TCanvas *c = new TCanvas("c", "c",0,0,800,700);
   c->SetHighLightColor(2);
   c->Range(-0.4813593,1.111111,3.148656,8.518519);
   c->SetFillColor(0);
   c->SetBorderMode(0);
   c->SetBorderSize(2);
   c->SetLogx();
   c->SetLogy();
   c->SetTickx(1);
   c->SetTicky(1);
   c->SetLeftMargin(0.12);
   c->SetRightMargin(0.04);
   c->SetTopMargin(0.07);
   c->SetBottomMargin(0.12);
   c->SetFrameBorderMode(0);
   c->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx1[12] = {
   1,
   10,
   100,
   400,
   700,
   1000,
   1000,
   700,
   400,
   100,
   10,
   1};
   Double_t Graph_fy1[12] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777,
   382.832,
   584.437,
   826.374,
   1079.16,
   1110.85,
   1092.23};
   TGraph *graph = new TGraph(12,Graph_fx1,Graph_fy1);
   graph->SetName("Graph");
   graph->SetTitle("");

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#ffcc00");
   graph->SetFillColor(ci);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,0.9,1099.9);
   Graph_Graph1->SetMinimum(228.5697);
   Graph_Graph1->SetMaximum(1191.057);
   Graph_Graph1->SetDirectory(0);
   Graph_Graph1->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph1->SetLineColor(ci);
   Graph_Graph1->GetXaxis()->SetLabelFont(42);
   Graph_Graph1->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetXaxis()->SetTitleFont(42);
   Graph_Graph1->GetYaxis()->SetLabelFont(42);
   Graph_Graph1->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetYaxis()->SetTitleFont(42);
   Graph_Graph1->GetZaxis()->SetLabelFont(42);
   Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph1);
   
   multigraph->Add(graph,"");
   multigraph->Draw("af");
   multigraph->GetXaxis()->SetTitle("M_{#chi} (GeV)");
   multigraph->GetXaxis()->SetRange(0,96);
   multigraph->GetXaxis()->SetLabelFont(42);
   multigraph->GetXaxis()->SetTitleSize(0.05);
   multigraph->GetXaxis()->SetTitleOffset(1.1);
   multigraph->GetXaxis()->SetTitleFont(42);
   multigraph->GetYaxis()->SetTitle("#Lambda (GeV)");
   multigraph->GetYaxis()->SetLabelFont(42);
   multigraph->GetYaxis()->SetTitleSize(0.05);
   multigraph->GetYaxis()->SetTitleOffset(1.05);
   multigraph->GetYaxis()->SetTitleFont(42);
   
   multigraph = new TMultiGraph();
   multigraph->SetName("");
   multigraph->SetTitle("");
   
   Double_t Graph_fx2[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy2[6] = {
   1092.23,
   1110.85,
   1079.16,
   826.374,
   584.437,
   382.832};
   graph = new TGraph(6,Graph_fx2,Graph_fy2);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0.9,1099.9);
   Graph_Graph2->SetMinimum(310.0302);
   Graph_Graph2->SetMaximum(1183.652);
   Graph_Graph2->SetDirectory(0);
   Graph_Graph2->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph2->SetLineColor(ci);
   Graph_Graph2->GetXaxis()->SetLabelFont(42);
   Graph_Graph2->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetXaxis()->SetTitleFont(42);
   Graph_Graph2->GetYaxis()->SetLabelFont(42);
   Graph_Graph2->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetYaxis()->SetTitleFont(42);
   Graph_Graph2->GetZaxis()->SetLabelFont(42);
   Graph_Graph2->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph2->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph2);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx3[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy3[6] = {
   980.038,
   996.742,
   968.943,
   742.067,
   524.44,
   343.371};
   graph = new TGraph(6,Graph_fx3,Graph_fy3);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0.9,1099.9);
   Graph_Graph3->SetMinimum(278.0339);
   Graph_Graph3->SetMaximum(1062.079);
   Graph_Graph3->SetDirectory(0);
   Graph_Graph3->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph3->SetLineColor(ci);
   Graph_Graph3->GetXaxis()->SetLabelFont(42);
   Graph_Graph3->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetXaxis()->SetTitleFont(42);
   Graph_Graph3->GetYaxis()->SetLabelFont(42);
   Graph_Graph3->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetYaxis()->SetTitleFont(42);
   Graph_Graph3->GetZaxis()->SetLabelFont(42);
   Graph_Graph3->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph3->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph3);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx4[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy4[6] = {
   881.525,
   896.549,
   871.907,
   667.806,
   471.744,
   308.777};
   graph = new TGraph(6,Graph_fx4,Graph_fy4);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff6666");
   graph->SetLineColor(ci);
   
   TH1F *Graph_Graph4 = new TH1F("Graph_Graph4","Graph",100,0.9,1099.9);
   Graph_Graph4->SetMinimum(249.9998);
   Graph_Graph4->SetMaximum(955.3262);
   Graph_Graph4->SetDirectory(0);
   Graph_Graph4->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph4->SetLineColor(ci);
   Graph_Graph4->GetXaxis()->SetLabelFont(42);
   Graph_Graph4->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetXaxis()->SetTitleFont(42);
   Graph_Graph4->GetYaxis()->SetLabelFont(42);
   Graph_Graph4->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetYaxis()->SetTitleFont(42);
   Graph_Graph4->GetZaxis()->SetLabelFont(42);
   Graph_Graph4->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph4->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph4);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx5[6] = {
   1,
   10,
   100,
   400,
   700,
   1000};
   Double_t Graph_fy5[6] = {
   1028.6,
   1012.32,
   1016.7,
   751.989,
   524.44,
   360.443};
   graph = new TGraph(6,Graph_fx5,Graph_fy5);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#0000ff");
   graph->SetLineColor(ci);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph5 = new TH1F("Graph_Graph5","Graph",100,0.9,1099.9);
   Graph_Graph5->SetMinimum(293.6273);
   Graph_Graph5->SetMaximum(1095.416);
   Graph_Graph5->SetDirectory(0);
   Graph_Graph5->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph5->SetLineColor(ci);
   Graph_Graph5->GetXaxis()->SetLabelFont(42);
   Graph_Graph5->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetXaxis()->SetTitleFont(42);
   Graph_Graph5->GetYaxis()->SetLabelFont(42);
   Graph_Graph5->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetYaxis()->SetTitleFont(42);
   Graph_Graph5->GetZaxis()->SetLabelFont(42);
   Graph_Graph5->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph5->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph5);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx6[35] = {
   3.981,
   4.365,
   4.786,
   5.248,
   5.754,
   6.31,
   6.918,
   7.586,
   8.318,
   9.12,
   10,
   10.965,
   12.023,
   13.183,
   14.454,
   15.849,
   17.378,
   19.055,
   20.893,
   22.909,
   25.119,
   31.623,
   39.811,
   50.119,
   63.096,
   79.433,
   100,
   125.893,
   158.489,
   199.526,
   251.189,
   316.228,
   1000,
   3162.278,
   10000};
   Double_t Graph_fy6[35] = {
   19.76533,
   32.58338,
   47.96959,
   63.10164,
   79.00995,
   95.55754,
   111.9766,
   129.0118,
   146.2376,
   163.5577,
   179.3658,
   194.9584,
   209.5672,
   223.2999,
   236.0683,
   247.7404,
   258.366,
   268.0662,
   277.1383,
   285.1146,
   292.3901,
   306.3527,
   314.441,
   317.1059,
   314.8684,
   308.9039,
   300.2537,
   289.8022,
   278.2241,
   266.1082,
   253.7422,
   241.4337,
   184.6404,
   139.2985,
   104.656};
   graph = new TGraph(35,Graph_fx6,Graph_fy6);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#6666ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph6 = new TH1F("Graph_Graph6","Graph",100,3.5829,10999.6);
   Graph_Graph6->SetMinimum(17.78879);
   Graph_Graph6->SetMaximum(346.84);
   Graph_Graph6->SetDirectory(0);
   Graph_Graph6->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph6->SetLineColor(ci);
   Graph_Graph6->GetXaxis()->SetLabelFont(42);
   Graph_Graph6->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetXaxis()->SetTitleFont(42);
   Graph_Graph6->GetYaxis()->SetLabelFont(42);
   Graph_Graph6->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetYaxis()->SetTitleFont(42);
   Graph_Graph6->GetZaxis()->SetLabelFont(42);
   Graph_Graph6->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph6->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph6);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx7[33] = {
   5.050109,
   5.570498,
   6.092375,
   6.79836,
   7.629504,
   8.933253,
   10.64203,
   12.05014,
   13.68495,
   14.93901,
   17.1131,
   19.54765,
   22.0792,
   25.65551,
   29.39341,
   34.84152,
   41.41884,
   48.68491,
   59.2071,
   75.34994,
   97.26741,
   131.0246,
   163.9459,
   202.8261,
   243.2248,
   309.5828,
   383.0166,
   473.8718,
   622.2993,
   833.6,
   1028.448,
   1283.339,
   2026.806};
   Double_t Graph_fy7[33] = {
   71.77067,
   88.82209,
   110.1401,
   130.7052,
   154.2557,
   185.7482,
   213.1504,
   232.735,
   248.5277,
   258.1632,
   268.4587,
   280.1818,
   286.5229,
   293.3758,
   296.7995,
   299.6924,
   299.6947,
   297.0875,
   293.2892,
   285.6511,
   275.8293,
   262.4571,
   252.7364,
   243.3346,
   234.001,
   222.0121,
   212.1495,
   202.5032,
   189.9106,
   177.908,
   168.9168,
   159.7122,
   142.9221};
   graph = new TGraph(33,Graph_fx7,Graph_fy7);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#ff9900");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph7 = new TH1F("Graph_Graph7","Graph",100,4.545098,2228.982);
   Graph_Graph7->SetMinimum(48.97827);
   Graph_Graph7->SetMaximum(322.4871);
   Graph_Graph7->SetDirectory(0);
   Graph_Graph7->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph7->SetLineColor(ci);
   Graph_Graph7->GetXaxis()->SetLabelFont(42);
   Graph_Graph7->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetXaxis()->SetTitleFont(42);
   Graph_Graph7->GetYaxis()->SetLabelFont(42);
   Graph_Graph7->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetYaxis()->SetTitleFont(42);
   Graph_Graph7->GetZaxis()->SetLabelFont(42);
   Graph_Graph7->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph7->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph7);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx8[90] = {
   18.74425,
   19.90368,
   20.73627,
   21.82644,
   23.00752,
   24.07546,
   25.0827,
   25.71454,
   26.71212,
   27.99356,
   28.53122,
   29.59491,
   30.69819,
   31.93543,
   33.71249,
   35.53626,
   36.69926,
   39.48566,
   41.74415,
   44.52103,
   47.27444,
   49.54151,
   51.99283,
   54.56543,
   56.59926,
   59.57426,
   61.97591,
   64.94736,
   67.7638,
   72.165,
   77.52983,
   78.67276,
   79.25885,
   79.50015,
   79.8577,
   79.98559,
   80.10781,
   80.93361,
   82.97299,
   85.0636,
   87.3346,
   89.6657,
   93.68976,
   97.60831,
   101.0972,
   103.4923,
   107.3498,
   111.0254,
   114.4909,
   118.2376,
   120.3333,
   131.3772,
   140.9375,
   145.9754,
   148.1289,
   150.9739,
   154.3249,
   158.6761,
   165.3121,
   170.7206,
   172.2259,
   173.4824,
   174.2374,
   175.2489,
   175.7591,
   179.6599,
   186.3538,
   196.4347,
   207.6675,
   217.3037,
   228.0541,
   241.4457,
   256.7473,
   271.0309,
   292.4573,
   319.2919,
   352.6953,
   387.3116,
   421.6106,
   459.6163,
   505.4719,
   563.2603,
   635.9718,
   692.2802,
   745.897,
   789.6904,
   831.1771,
   886.4295,
   950.901,
   983.4362};
   Double_t Graph_fy8[90] = {
   190.042,
   192.3104,
   192.9376,
   195.179,
   197.2136,
   198.0799,
   199.3876,
   199.4802,
   201.01,
   204.4632,
   204.529,
   206.7971,
   208.8441,
   208.9712,
   209.8662,
   210.2649,
   211.3333,
   212.7612,
   214.3898,
   216.0449,
   217.1898,
   218.8107,
   219.1693,
   219.524,
   220.873,
   221.9988,
   223.3628,
   223.7069,
   225.3419,
   225.4478,
   225.5616,
   225.584,
   239.8787,
   256.2561,
   271.2293,
   293.7999,
   304.8973,
   307.0445,
   308.5203,
   309.6434,
   310.7722,
   310.8221,
   310.5429,
   310.2559,
   309.9569,
   309.996,
   311.8566,
   313.3588,
   314.1336,
   315.2763,
   316.7668,
   317.2607,
   317.3559,
   317.4016,
   319.264,
   319.2881,
   319.6855,
   319.7195,
   318.6591,
   318.3273,
   317.9688,
   309.2591,
   300.7849,
   289.5104,
   286.1793,
   286.2011,
   285.5743,
   285.6238,
   285.3433,
   284.0635,
   283.1184,
   281.2031,
   278.656,
   277.7288,
   275.8579,
   273.0541,
   270.9095,
   265.6796,
   261.7535,
   256.9895,
   253.7797,
   247.4406,
   240.1473,
   234.4071,
   229.3303,
   226.7081,
   224.3734,
   220.2731,
   215.7486,
   213.7682};
   graph = new TGraph(90,Graph_fx8,Graph_fy8);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#cc33ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(6);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph8 = new TH1F("Graph_Graph8","Graph",100,16.86982,1079.905);
   Graph_Graph8->SetMinimum(177.0742);
   Graph_Graph8->SetMaximum(332.6873);
   Graph_Graph8->SetDirectory(0);
   Graph_Graph8->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph8->SetLineColor(ci);
   Graph_Graph8->GetXaxis()->SetLabelFont(42);
   Graph_Graph8->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetXaxis()->SetTitleFont(42);
   Graph_Graph8->GetYaxis()->SetLabelFont(42);
   Graph_Graph8->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetYaxis()->SetTitleFont(42);
   Graph_Graph8->GetZaxis()->SetLabelFont(42);
   Graph_Graph8->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph8->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph8);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx9[5] = {
   250,
   500,
   1000,
   3000,
   5000};
   Double_t Graph_fy9[5] = {
   597.2217,
   587.5585,
   450.4588,
   245.3363,
   177.6733};
   graph = new TGraph(5,Graph_fx9,Graph_fy9);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#3399ff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(4);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph9 = new TH1F("Graph_Graph9","Graph",100,225,5475);
   Graph_Graph9->SetMinimum(135.7185);
   Graph_Graph9->SetMaximum(639.1765);
   Graph_Graph9->SetDirectory(0);
   Graph_Graph9->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph9->SetLineColor(ci);
   Graph_Graph9->GetXaxis()->SetLabelFont(42);
   Graph_Graph9->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetXaxis()->SetTitleFont(42);
   Graph_Graph9->GetYaxis()->SetLabelFont(42);
   Graph_Graph9->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetYaxis()->SetTitleFont(42);
   Graph_Graph9->GetZaxis()->SetLabelFont(42);
   Graph_Graph9->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph9->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph9);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx10[518] = {
   6.04,
   6.04,
   6.04,
   6.04,
   6.05,
   6.08,
   6.11,
   6.12,
   6.12,
   6.13,
   6.16,
   6.16,
   6.16,
   6.19,
   6.2,
   6.2,
   6.2,
   6.21,
   6.24,
   6.27,
   6.28,
   6.28,
   6.28,
   6.28,
   6.28,
   6.29,
   6.34,
   6.37,
   6.37,
   6.37,
   6.37,
   6.37,
   6.38,
   6.43,
   6.45,
   6.45,
   6.45,
   6.45,
   6.45,
   6.45,
   6.46,
   6.53,
   6.54,
   6.54,
   6.54,
   6.54,
   6.54,
   6.54,
   6.62,
   6.62,
   6.62,
   6.62,
   6.62,
   6.62,
   6.64,
   6.69,
   6.71,
   6.71,
   6.71,
   6.71,
   6.71,
   6.72,
   6.78,
   6.8,
   6.8,
   6.8,
   6.8,
   6.8,
   6.81,
   6.87,
   6.89,
   6.89,
   6.89,
   6.89,
   6.89,
   6.91,
   6.94,
   6.97,
   6.98,
   6.98,
   7,
   7.05,
   7.08,
   7.09,
   7.15,
   7.17,
   7.19,
   7.24,
   7.27,
   7.28,
   7.34,
   7.37,
   7.37,
   7.45,
   7.46,
   7.47,
   7.55,
   7.56,
   7.57,
   7.65,
   7.66,
   7.67,
   7.76,
   7.77,
   7.77,
   7.86,
   7.88,
   7.95,
   7.99,
   8.05,
   8.1,
   8.15,
   8.19,
   8.24,
   8.27,
   8.31,
   8.38,
   8.43,
   8.48,
   8.52,
   8.58,
   8.61,
   8.65,
   8.71,
   8.75,
   8.81,
   8.84,
   8.88,
   8.93,
   8.97,
   9,
   9.05,
   9.12,
   9.17,
   9.24,
   9.29,
   9.36,
   9.42,
   9.49,
   9.54,
   9.62,
   9.67,
   9.74,
   9.8,
   9.87,
   9.93,
   10,
   10.2,
   10.3,
   10.5,
   10.6,
   10.8,
   10.9,
   10.9,
   11,
   11.2,
   11.2,
   11.3,
   11.5,
   11.6,
   11.8,
   11.9,
   12.1,
   12.2,
   12.4,
   12.6,
   12.7,
   12.9,
   13.1,
   13.3,
   13.5,
   13.5,
   13.6,
   13.8,
   14,
   14.2,
   14.4,
   14.5,
   14.5,
   14.8,
   15,
   15.2,
   15.3,
   15.3,
   15.6,
   15.8,
   15.9,
   16,
   16.2,
   16.5,
   16.6,
   16.9,
   17.2,
   17.3,
   17.6,
   17.9,
   18,
   18.3,
   18.6,
   18.7,
   19,
   19.3,
   19.4,
   19.5,
   19.8,
   20.6,
   21.4,
   21.8,
   22,
   22.2,
   22.6,
   22.9,
   23.2,
   23.5,
   23.8,
   24.1,
   24.5,
   24.8,
   25.1,
   25.5,
   25.8,
   26.1,
   26.5,
   26.8,
   27.2,
   27.6,
   28.1,
   28.7,
   29.1,
   29.4,
   29.8,
   30.8,
   31.7,
   32.4,
   32.9,
   34.2,
   35.3,
   35.8,
   36.4,
   36.9,
   37.4,
   38.3,
   38.9,
   39.4,
   40.4,
   41,
   41.6,
   42.6,
   43.2,
   43.8,
   44.4,
   45,
   45.6,
   46.2,
   46.8,
   47.5,
   48.1,
   48.7,
   49.4,
   50.1,
   50.7,
   51.4,
   52.1,
   53.3,
   54.8,
   55.7,
   56.4,
   57.2,
   57.9,
   58.7,
   59.5,
   60.3,
   61.1,
   61.9,
   62.7,
   63.5,
   64.4,
   65.3,
   66.3,
   67.6,
   68.8,
   69.7,
   70.7,
   71.6,
   72.8,
   74.2,
   75.5,
   76.5,
   77.5,
   78.8,
   80.3,
   81.8,
   82.8,
   84,
   85.1,
   86.4,
   88.2,
   89.7,
   90.9,
   92.1,
   93.6,
   95.5,
   97.1,
   98.4,
   100,
   102,
   104,
   105,
   108,
   110,
   112,
   114,
   115,
   118,
   120,
   122,
   124,
   127,
   130,
   132,
   134,
   137,
   139,
   142,
   145,
   147,
   150,
   152,
   155,
   157,
   161,
   164,
   167,
   170,
   173,
   176,
   179,
   182,
   187,
   190,
   194,
   197,
   200,
   205,
   208,
   213,
   216,
   222,
   225,
   231,
   234,
   240,
   244,
   253,
   262,
   267,
   272,
   278,
   283,
   289,
   295,
   301,
   307,
   312,
   317,
   323,
   329,
   334,
   341,
   347,
   353,
   358,
   367,
   374,
   381,
   387,
   395,
   403,
   411,
   419,
   427,
   436,
   445,
   454,
   463,
   475,
   485,
   494,
   504,
   514,
   528,
   545,
   564,
   583,
   603,
   615,
   628,
   639,
   649,
   662,
   675,
   689,
   701,
   712,
   726,
   741,
   756,
   771,
   786,
   802,
   818,
   833,
   846,
   863,
   878,
   892,
   910,
   935,
   964,
   992,
   1030,
   1050,
   1070,
   1090,
   1110,
   1150,
   1190,
   1210,
   1230,
   1260,
   1280,
   1310,
   1340,
   1370,
   1400,
   1430,
   1460,
   1490,
   1520,
   1550,
   1600,
   1650,
   1690,
   1720,
   1750,
   1790,
   1850,
   1910,
   1950,
   1990,
   2030,
   2070,
   2130,
   2170,
   2210,
   2260,
   2300,
   2370,
   2410,
   2460,
   2540,
   2630,
   2680,
   2730,
   2820,
   2920,
   3020,
   3120,
   3190,
   3240,
   3320,
   3370,
   3490,
   3610,
   3690,
   3750,
   3880,
   4020,
   4100,
   4180,
   4270,
   4350,
   4440,
   4530,
   4620,
   4690,
   4810,
   4880,
   5000,
   5080,
   5200,
   5310,
   5420,
   5520,
   5640,
   5750,
   5860,
   5980,
   6100,
   6220,
   6330,
   6440,
   6560,
   6700,
   6830,
   7050,
   7300,
   7450,
   7590,
   7840,
   8110,
   8380,
   8670,
   8850,
   8990,
   9210,
   9390,
   9610};
   Double_t Graph_fy10[518] = {
   10.38676,
   10.50231,
   10.59957,
   10.7015,
   10.89364,
   11.07546,
   11.20647,
   11.30821,
   11.41342,
   11.62109,
   11.82995,
   11.96215,
   12.07818,
   12.17911,
   12.30743,
   12.414,
   12.52534,
   12.76538,
   12.97118,
   13.12865,
   13.25128,
   13.37442,
   13.49524,
   13.62174,
   13.74534,
   13.99711,
   14.24146,
   14.40622,
   14.54013,
   14.67427,
   14.8083,
   14.94868,
   15.22224,
   15.47959,
   15.6669,
   15.80805,
   15.95581,
   16.10083,
   16.2527,
   16.40114,
   16.65049,
   17.00656,
   17.18103,
   17.34867,
   17.50979,
   17.663,
   17.82315,
   18.09534,
   18.48112,
   18.68225,
   18.85134,
   19.02836,
   19.21403,
   19.38419,
   19.72512,
   20.07365,
   20.32073,
   20.51337,
   20.68111,
   20.89181,
   21.0759,
   21.47197,
   21.82747,
   22.10836,
   22.30316,
   22.50687,
   22.72023,
   22.88709,
   23.32871,
   23.73763,
   24.00677,
   24.23435,
   24.45738,
   24.68282,
   24.91041,
   25.36578,
   25.78503,
   26.09729,
   26.34398,
   26.58842,
   27.06598,
   27.53896,
   27.86668,
   28.37133,
   28.86478,
   29.20029,
   29.71859,
   30.24769,
   30.60227,
   31.15273,
   31.68307,
   32.06927,
   32.5362,
   33.23597,
   33.60661,
   34.0793,
   34.82676,
   35.19988,
   35.69491,
   36.46783,
   36.87798,
   37.44003,
   38.20997,
   38.65276,
   39.20006,
   40.07932,
   40.8414,
   41.55343,
   42.4036,
   43.14178,
   44.02907,
   44.76045,
   45.25133,
   46.05417,
   46.59723,
   47.07559,
   47.84267,
   48.80958,
   49.64402,
   50.16063,
   51.06094,
   51.65136,
   52.17979,
   52.98822,
   53.58735,
   54.51024,
   55.15295,
   55.7454,
   56.61769,
   57.29215,
   57.83828,
   58.59123,
   59.58957,
   60.25911,
   61.2608,
   61.9507,
   63.01658,
   63.72388,
   64.8542,
   65.56339,
   66.64773,
   67.45883,
   68.57788,
   69.38042,
   70.52167,
   71.44279,
   73.10832,
   74.86664,
   76.70132,
   78.48531,
   80.39639,
   82.27539,
   83.96915,
   84.81317,
   86.19446,
   88.02168,
   88.90821,
   90.11315,
   92.12023,
   94.32802,
   96.50886,
   98.84577,
   100.8332,
   102.8086,
   104.7116,
   106.793,
   108.8109,
   110.7898,
   112.9515,
   115.1677,
   117.0762,
   118.1521,
   119.1161,
   120.7506,
   122.937,
   125.5722,
   127.4196,
   128.5312,
   129.6638,
   131.542,
   134.0308,
   136.1693,
   137.3979,
   138.4952,
   140.691,
   142.7079,
   144.0108,
   145.2215,
   146.8251,
   149.5702,
   150.7827,
   152.4733,
   155.2857,
   156.5944,
   158.387,
   161.2726,
   162.6707,
   164.4505,
   167.5191,
   168.8856,
   170.7937,
   172.6887,
   174.1507,
   175.4199,
   177.3078,
   182.9573,
   187.7626,
   189.8365,
   190.4369,
   191.0454,
   193.294,
   195.0114,
   196.8028,
   198.6746,
   200.6337,
   202.4317,
   204.8624,
   205.4538,
   206.0518,
   208.4005,
   210.5569,
   212.4997,
   214.5452,
   216.3183,
   218.547,
   220.4993,
   222.5493,
   224.7033,
   226.9325,
   229.2592,
   231.2259,
   233.3437,
   236.0739,
   236.692,
   237.8515,
   240.2765,
   242.669,
   242.8986,
   243.7,
   244.4396,
   245.1237,
   245.324,
   246.1552,
   246.9239,
   247.738,
   248.6028,
   249.34,
   250.183,
   251.0113,
   251.7779,
   252.4054,
   252.4402,
   252.4741,
   252.5072,
   252.5394,
   252.576,
   252.6065,
   251.8236,
   251.565,
   251.5977,
   251.9175,
   252.7618,
   252.7922,
   253.0667,
   254.0334,
   254.1442,
   254.1704,
   254.1995,
   254.2243,
   254.2519,
   254.2788,
   254.305,
   254.3305,
   254.3554,
   254.3796,
   254.4032,
   254.4291,
   254.4543,
   254.2526,
   253.4561,
   253.3367,
   253.3588,
   252.5675,
   252.295,
   252.1031,
   251.2675,
   251.223,
   250.3929,
   250.0624,
   249.8782,
   249.0786,
   249.0366,
   248.174,
   247.9263,
   247.944,
   247.6981,
   246.9351,
   246.8915,
   246.9084,
   246.0196,
   245.5296,
   244.7362,
   244.6935,
   243.8445,
   243.6187,
   242.4377,
   241.8683,
   241.295,
   240.1783,
   239.0772,
   238.001,
   237.4805,
   236.957,
   236.4553,
   236.9969,
   237.012,
   234.4527,
   232.994,
   232.0529,
   231.124,
   230.6725,
   229.7764,
   228.8918,
   227.5962,
   226.7575,
   226.3463,
   225.53,
   224.7235,
   224.3345,
   223.5489,
   222.4,
   221.6514,
   220.9151,
   220.5568,
   219.4781,
   218.4252,
   218.4349,
   217.4066,
   216.4078,
   215.7535,
   214.7888,
   214.4764,
   213.537,
   212.6227,
   211.7229,
   210.5545,
   209.6973,
   208.5851,
   207.767,
   206.7044,
   205.9222,
   204.9054,
   204.1581,
   202.7048,
   200.6119,
   199.4946,
   198.6241,
   197.7734,
   196.9394,
   195.9209,
   195.126,
   194.1531,
   193.393,
   192.6467,
   192.2811,
   191.5566,
   190.8456,
   190.4965,
   189.8054,
   189.1259,
   188.7928,
   187.9657,
   186.9986,
   186.3681,
   185.748,
   185.29,
   184.688,
   183.8008,
   183.0782,
   182.0883,
   181.3984,
   180.4531,
   179.6626,
   178.8891,
   178.132,
   176.4223,
   175.5989,
   174.7941,
   174.0077,
   173.2387,
   171.644,
   170.3208,
   168.5686,
   167.267,
   165.4898,
   164.7208,
   163.9695,
   163.8889,
   163.1556,
   162.5181,
   161.6606,
   160.976,
   160.9779,
   160.2332,
   159.5059,
   158.7245,
   158.0995,
   157.2843,
   156.6211,
   155.8431,
   155.2095,
   155.1483,
   154.4668,
   153.8004,
   153.7418,
   153.0319,
   152.3957,
   150.9962,
   149.8166,
   148.4291,
   146.8649,
   146.1595,
   145.5618,
   144.8424,
   144.2273,
   143.077,
   141.5716,
   140.9059,
   140.2935,
   139.6204,
   138.999,
   138.3208,
   137.7278,
   136.5779,
   135.9239,
   135.2852,
   134.6612,
   134.0513,
   133.455,
   132.8717,
   131.7421,
   130.3946,
   129.6185,
   129.1138,
   128.6188,
   127.8935,
   126.9576,
   125.6149,
   124.9697,
   124.5488,
   123.9302,
   123.3267,
   122.1621,
   121.6,
   121.0507,
   120.5136,
   119.9882,
   118.9705,
   118.3154,
   117.8359,
   116.905,
   115.7187,
   115.1476,
   114.5904,
   113.7792,
   112.4881,
   111.6267,
   110.4508,
   109.8856,
   109.4437,
   108.7971,
   108.3764,
   107.6595,
   106.4832,
   106.0117,
   105.4593,
   104.657,
   103.6329,
   103.0581,
   102.6571,
   102.1086,
   101.7257,
   101.2013,
   100.7625,
   100.2622,
   99.77413,
   99.29779,
   98.89833,
   98.37802,
   97.9966,
   97.43805,
   97.13459,
   96.65859,
   96.25151,
   95.79658,
   95.35219,
   94.91791,
   94.49337,
   94.02686,
   93.6217,
   93.27425,
   93.07861,
   92.78892,
   92.31587,
   91.94598,
   91.2278,
   90.24254,
   89.78968,
   89.42747,
   88.72436,
   87.79184,
   87.11485,
   86.19591,
   85.77034,
   85.35504,
   84.91885,
   84.61402,
   84.25532};
   graph = new TGraph(518,Graph_fx10,Graph_fy10);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#66ccff");
   graph->SetLineColor(ci);
   graph->SetLineStyle(5);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph10 = new TH1F("Graph_Graph10","Graph",518,5.436,10570.4);
   Graph_Graph10->SetMinimum(9.348083);
   Graph_Graph10->SetMaximum(278.861);
   Graph_Graph10->SetDirectory(0);
   Graph_Graph10->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph10->SetLineColor(ci);
   Graph_Graph10->GetXaxis()->SetLabelFont(42);
   Graph_Graph10->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetXaxis()->SetTitleFont(42);
   Graph_Graph10->GetYaxis()->SetLabelFont(42);
   Graph_Graph10->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetYaxis()->SetTitleFont(42);
   Graph_Graph10->GetZaxis()->SetLabelFont(42);
   Graph_Graph10->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph10->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph10->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph10);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx11[35] = {
   3.98,
   4.37,
   4.79,
   5.25,
   5.75,
   6.31,
   6.92,
   7.59,
   8.32,
   9.12,
   10,
   10.96,
   12.02,
   13.18,
   14.45,
   15.85,
   17.38,
   19.05,
   20.89,
   22.91,
   25.12,
   31.62,
   39.81,
   50.12,
   63.1,
   79.43,
   100,
   125.89,
   158.49,
   199.53,
   251.19,
   316.23,
   1000,
   3162.3,
   10000};
   Double_t Graph_fy11[35] = {
   64.47703,
   92.96188,
   120.9916,
   144.7661,
   171.1873,
   194.8983,
   219.9867,
   244.5213,
   267.5613,
   289.6608,
   311.7509,
   330.2783,
   345.9273,
   362.605,
   376.5173,
   387.5872,
   398.0475,
   406.9399,
   414.3522,
   421.5604,
   426.3119,
   433.1181,
   435.0014,
   429.503,
   421.4079,
   411.5566,
   398.3919,
   383.7713,
   369.2768,
   352.1727,
   335.9504,
   319.8066,
   245.9105,
   185.1913,
   139.1868};
   graph = new TGraph(35,Graph_fx11,Graph_fy11);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#66cc66");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph11 = new TH1F("Graph_Graph11","Graph",100,3.582,10999.6);
   Graph_Graph11->SetMinimum(27.4246);
   Graph_Graph11->SetMaximum(472.0538);
   Graph_Graph11->SetDirectory(0);
   Graph_Graph11->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph11->SetLineColor(ci);
   Graph_Graph11->GetXaxis()->SetLabelFont(42);
   Graph_Graph11->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetXaxis()->SetTitleFont(42);
   Graph_Graph11->GetYaxis()->SetLabelFont(42);
   Graph_Graph11->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetYaxis()->SetTitleFont(42);
   Graph_Graph11->GetZaxis()->SetLabelFont(42);
   Graph_Graph11->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph11->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph11->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph11);
   
   multigraph->Add(graph,"");
   
   Double_t Graph_fx12[35] = {
   4,
   5,
   6,
   7,
   8,
   9,
   10,
   12,
   14,
   16,
   18,
   20,
   24,
   28,
   32,
   36,
   40,
   44,
   48,
   52,
   56,
   60,
   65,
   70,
   75,
   80,
   85,
   90,
   95,
   100,
   150,
   200,
   300,
   400,
   500};
   Double_t Graph_fy12[35] = {
   91.75045,
   115.9467,
   132.4599,
   144.0692,
   152.856,
   159.9043,
   165.4462,
   172.653,
   177.2831,
   179.5654,
   180.8904,
   181.5836,
   181.5776,
   181.2419,
   178.737,
   176.8406,
   175.2212,
   173.4303,
   171.2294,
   169.3498,
   167.5194,
   165.3283,
   163.1921,
   161.2337,
   159.198,
   157.2876,
   155.7156,
   153.813,
   152.3262,
   150.9621,
   138.5165,
   129.9907,
   118.4184,
   110.7202,
   104.9163};
   graph = new TGraph(35,Graph_fx12,Graph_fy12);
   graph->SetName("Graph");
   graph->SetTitle("Graph");
   graph->SetFillColor(1);

   ci = TColor::GetColor("#333399");
   graph->SetLineColor(ci);
   graph->SetLineStyle(2);
   graph->SetLineWidth(3);
   
   TH1F *Graph_Graph12 = new TH1F("Graph_Graph12","Graph",100,3.6,549.6);
   Graph_Graph12->SetMinimum(82.76714);
   Graph_Graph12->SetMaximum(190.5669);
   Graph_Graph12->SetDirectory(0);
   Graph_Graph12->SetStats(0);

   ci = TColor::GetColor("#000099");
   Graph_Graph12->SetLineColor(ci);
   Graph_Graph12->GetXaxis()->SetLabelFont(42);
   Graph_Graph12->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetXaxis()->SetTitleFont(42);
   Graph_Graph12->GetYaxis()->SetLabelFont(42);
   Graph_Graph12->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetYaxis()->SetTitleFont(42);
   Graph_Graph12->GetZaxis()->SetLabelFont(42);
   Graph_Graph12->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph12->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph12->GetZaxis()->SetTitleFont(42);
   graph->SetHistogram(Graph_Graph12);
   
   multigraph->Add(graph,"");
   multigraph->Draw("L");
   
   TLegend *leg = new TLegend(0.185,0.5,0.59,0.79,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   TLegendEntry *entry=leg->AddEntry("NULL","Razor-0#mu 90% CL limit: AV EFT operator","h");
   entry->SetLineColor(1);
   entry->SetLineStyle(1);
   entry->SetLineWidth(1);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Expected limit, with uncertainty","lf");

   ci = TColor::GetColor("#ffcc00");
   entry->SetFillColor(ci);
   entry->SetFillStyle(1001);

   ci = TColor::GetColor("#ff6666");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Observed limit","l");

   ci = TColor::GetColor("#0000ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(1);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   
   leg = new TLegend(0.7,0.5,0.95,0.79,NULL,"brNDC");
   leg->SetBorderSize(0);
   leg->SetTextSize(0.03);
   leg->SetLineColor(1);
   leg->SetLineStyle(1);
   leg->SetLineWidth(1);
   leg->SetFillColor(0);
   leg->SetFillStyle(1001);
   entry=leg->AddEntry("Graph","IceCube W^{+}W^{-}","l");

   ci = TColor::GetColor("#3399ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(4);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","COUPP 2012","l");

   ci = TColor::GetColor("#6666ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","SIMPLE 2012","l");

   ci = TColor::GetColor("#ff9900");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","Super-K W^{+}W^{-}","l");

   ci = TColor::GetColor("#cc33ff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(6);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","XENON 100","l");

   ci = TColor::GetColor("#66ccff");
   entry->SetLineColor(ci);
   entry->SetLineStyle(5);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","PICO","l");

   ci = TColor::GetColor("#66cc66");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   entry=leg->AddEntry("Graph","PICASSO","l");

   ci = TColor::GetColor("#333399");
   entry->SetLineColor(ci);
   entry->SetLineStyle(2);
   entry->SetLineWidth(3);
   entry->SetMarkerColor(1);
   entry->SetMarkerStyle(21);
   entry->SetMarkerSize(1);
   entry->SetTextFont(42);
   leg->Draw();
   TLatex *   tex = new TLatex(0.955,0.945,"18.8 fb^{-1} (8 TeV)");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(42);
   tex->SetTextSize(0.045);
   tex->SetLineWidth(2);
   tex->Draw();
      tex = new TLatex(0.27,0.867,"CMS");
tex->SetNDC();
   tex->SetTextAlign(31);
   tex->SetTextFont(61);
   tex->SetTextSize(0.045);
   tex->SetLineWidth(2);
   tex->Draw();
   
   TH1F *_copy__1 = new TH1F("_copy__1","",100,0.9,1049.95);
   _copy__1->SetMinimum(100);
   _copy__1->SetMaximum(1e+08);
   _copy__1->SetDirectory(0);
   _copy__1->SetStats(0);

   ci = TColor::GetColor("#000099");
   _copy__1->SetLineColor(ci);
   _copy__1->GetXaxis()->SetTitle("M_{#chi} (GeV)");
   _copy__1->GetXaxis()->SetRange(0,96);
   _copy__1->GetXaxis()->SetLabelFont(42);
   _copy__1->GetXaxis()->SetTitleSize(0.05);
   _copy__1->GetXaxis()->SetTitleOffset(1.1);
   _copy__1->GetXaxis()->SetTitleFont(42);
   _copy__1->GetYaxis()->SetTitle("#Lambda (GeV)");
   _copy__1->GetYaxis()->SetLabelFont(42);
   _copy__1->GetYaxis()->SetTitleSize(0.05);
   _copy__1->GetYaxis()->SetTitleOffset(1.05);
   _copy__1->GetYaxis()->SetTitleFont(42);
   _copy__1->GetZaxis()->SetLabelFont(42);
   _copy__1->GetZaxis()->SetLabelSize(0.035);
   _copy__1->GetZaxis()->SetTitleSize(0.035);
   _copy__1->GetZaxis()->SetTitleFont(42);
   _copy__1->Draw("sameaxis");
   c->Modified();
   c->cd();
   c->SetSelected(c);
}