void SegtoLCTXY_2016B_June22all_sameYrange_fullIntegral_10k9k_lin() { //=========Macro generated from canvas: SegtoLCTXY/SegtoLCTXY //========= (Sat Aug 6 07:01:23 2016) by ROOT version6.06/01 TCanvas *SegtoLCTXY = new TCanvas("SegtoLCTXY", "SegtoLCTXY",0,0,500,500); gStyle->SetOptStat(0); SegtoLCTXY->SetHighLightColor(2); SegtoLCTXY->Range(-6.125,-6.2275,45.125,56.2475); SegtoLCTXY->SetFillColor(0); SegtoLCTXY->SetBorderMode(0); SegtoLCTXY->SetBorderSize(2); SegtoLCTXY->SetFrameBorderMode(0); SegtoLCTXY->SetFrameBorderMode(0); TH1D *SegtoLCTXY_1__85 = new TH1D("SegtoLCTXY_1__85","SegtoLCTXY",100,-1,40); SegtoLCTXY_1__85->SetBinContent(3,84.80773); SegtoLCTXY_1__85->SetBinContent(4,4.770728); SegtoLCTXY_1__85->SetBinContent(5,3.083512); SegtoLCTXY_1__85->SetBinContent(6,2.259136); SegtoLCTXY_1__85->SetBinContent(7,2.086507); SegtoLCTXY_1__85->SetBinContent(8,0.5551299); SegtoLCTXY_1__85->SetBinContent(9,0.2552041); SegtoLCTXY_1__85->SetBinContent(10,0.1825503); SegtoLCTXY_1__85->SetBinContent(11,0.171408); SegtoLCTXY_1__85->SetBinContent(12,0.1286705); SegtoLCTXY_1__85->SetBinContent(13,0.09341201); SegtoLCTXY_1__85->SetBinContent(14,0.08776455); SegtoLCTXY_1__85->SetBinContent(15,0.1098965); SegtoLCTXY_1__85->SetBinContent(16,0.08196446); SegtoLCTXY_1__85->SetBinContent(17,0.06944847); SegtoLCTXY_1__85->SetBinContent(18,0.06517472); SegtoLCTXY_1__85->SetBinContent(19,0.06883794); SegtoLCTXY_1__85->SetBinContent(20,0.05067449); SegtoLCTXY_1__85->SetBinContent(21,0.04685864); SegtoLCTXY_1__85->SetBinContent(22,0.04853761); SegtoLCTXY_1__85->SetBinContent(23,0.03953221); SegtoLCTXY_1__85->SetBinContent(24,0.03663216); SegtoLCTXY_1__85->SetBinContent(25,0.04319542); SegtoLCTXY_1__85->SetBinContent(26,0.03876904); SegtoLCTXY_1__85->SetBinContent(27,0.03312158); SegtoLCTXY_1__85->SetBinContent(28,0.03144261); SegtoLCTXY_1__85->SetBinContent(29,0.02991626); SegtoLCTXY_1__85->SetBinContent(30,0.03602163); SegtoLCTXY_1__85->SetBinContent(31,0.02671095); SegtoLCTXY_1__85->SetBinContent(32,0.02045296); SegtoLCTXY_1__85->SetBinContent(33,0.03037417); SegtoLCTXY_1__85->SetBinContent(34,0.02579515); SegtoLCTXY_1__85->SetBinContent(35,0.02503198); SegtoLCTXY_1__85->SetBinContent(36,0.02640568); SegtoLCTXY_1__85->SetBinContent(37,0.02167403); SegtoLCTXY_1__85->SetBinContent(38,0.02075822); SegtoLCTXY_1__85->SetBinContent(39,0.01831608); SegtoLCTXY_1__85->SetBinContent(40,0.01831608); SegtoLCTXY_1__85->SetBinContent(41,0.02045296); SegtoLCTXY_1__85->SetBinContent(42,0.01831608); SegtoLCTXY_1__85->SetBinContent(43,0.02030032); SegtoLCTXY_1__85->SetBinContent(44,0.01846871); SegtoLCTXY_1__85->SetBinContent(45,0.01587394); SegtoLCTXY_1__85->SetBinContent(46,0.0157213); SegtoLCTXY_1__85->SetBinContent(47,0.0148055); SegtoLCTXY_1__85->SetBinContent(48,0.01678974); SegtoLCTXY_1__85->SetBinContent(49,0.0148055); SegtoLCTXY_1__85->SetBinContent(50,0.01419496); SegtoLCTXY_1__85->SetBinContent(51,0.009768576); SegtoLCTXY_1__85->SetBinContent(52,0.01327916); SegtoLCTXY_1__85->SetBinContent(53,0.01083701); SegtoLCTXY_1__85->SetBinContent(54,0.009768576); SegtoLCTXY_1__85->SetBinContent(55,0.01175282); SegtoLCTXY_1__85->SetBinContent(56,0.009005406); SegtoLCTXY_1__85->SetBinContent(57,0.009615942); SegtoLCTXY_1__85->SetBinContent(58,0.01098965); SegtoLCTXY_1__85->SetBinContent(59,0.00839487); SegtoLCTXY_1__85->SetBinContent(60,0.0076317); SegtoLCTXY_1__85->SetBinContent(61,0.007173798); SegtoLCTXY_1__85->SetBinContent(62,0.007326432); SegtoLCTXY_1__85->SetBinContent(63,0.008547504); SegtoLCTXY_1__85->SetBinContent(64,0.0076317); SegtoLCTXY_1__85->SetBinContent(65,0.005800092); SegtoLCTXY_1__85->SetBinContent(66,0.006715896); SegtoLCTXY_1__85->SetBinContent(67,0.006410628); SegtoLCTXY_1__85->SetBinContent(68,0.006257994); SegtoLCTXY_1__85->SetBinContent(69,0.004884288); SegtoLCTXY_1__85->SetBinContent(70,0.005647458); SegtoLCTXY_1__85->SetBinContent(71,0.00610536); SegtoLCTXY_1__85->SetBinContent(72,0.005952726); SegtoLCTXY_1__85->SetBinContent(73,0.006257994); SegtoLCTXY_1__85->SetBinContent(74,0.005647458); SegtoLCTXY_1__85->SetBinContent(75,0.005647458); SegtoLCTXY_1__85->SetBinContent(76,0.004121118); SegtoLCTXY_1__85->SetBinContent(77,0.005800092); SegtoLCTXY_1__85->SetBinContent(78,0.004731654); SegtoLCTXY_1__85->SetBinContent(79,0.005189556); SegtoLCTXY_1__85->SetBinContent(80,0.00381585); SegtoLCTXY_1__85->SetBinContent(81,0.00381585); SegtoLCTXY_1__85->SetBinContent(82,0.004731654); SegtoLCTXY_1__85->SetBinContent(83,0.003510582); SegtoLCTXY_1__85->SetBinContent(84,0.00228951); SegtoLCTXY_1__85->SetBinContent(85,0.003663216); SegtoLCTXY_1__85->SetBinContent(86,0.00305268); SegtoLCTXY_1__85->SetBinContent(87,0.00305268); SegtoLCTXY_1__85->SetBinContent(88,0.003968484); SegtoLCTXY_1__85->SetBinContent(89,0.002594778); SegtoLCTXY_1__85->SetBinContent(90,0.002747412); SegtoLCTXY_1__85->SetBinContent(91,0.003510582); SegtoLCTXY_1__85->SetBinContent(92,0.00457902); SegtoLCTXY_1__85->SetBinContent(93,0.003968484); SegtoLCTXY_1__85->SetBinContent(94,0.003205314); SegtoLCTXY_1__85->SetBinContent(95,0.002442144); SegtoLCTXY_1__85->SetBinContent(96,0.00152634); SegtoLCTXY_1__85->SetBinContent(97,0.003510582); SegtoLCTXY_1__85->SetBinContent(98,0.00228951); SegtoLCTXY_1__85->SetBinContent(99,0.002900046); SegtoLCTXY_1__85->SetBinContent(100,0.002594778); SegtoLCTXY_1__85->SetBinContent(101,3.150366); SegtoLCTXY_1__85->SetMinimum(0.02); SegtoLCTXY_1__85->SetMaximum(50); SegtoLCTXY_1__85->SetEntries(675802); SegtoLCTXY_1__85->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ff00ff"); SegtoLCTXY_1__85->SetLineColor(ci); ci = TColor::GetColor("#ff00ff"); SegtoLCTXY_1__85->SetMarkerColor(ci); SegtoLCTXY_1__85->GetXaxis()->SetTitle("cm"); SegtoLCTXY_1__85->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_1__85->Draw("H"); TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTXY_2__86 = new TH1D("SegtoLCTXY_2__86","SegtoLCTXY",100,-1,40); SegtoLCTXY_2__86->SetBinContent(3,76.44607); SegtoLCTXY_2__86->SetBinContent(4,5.271144); SegtoLCTXY_2__86->SetBinContent(5,5.67833); SegtoLCTXY_2__86->SetBinContent(6,4.51483); SegtoLCTXY_2__86->SetBinContent(7,4.60394); SegtoLCTXY_2__86->SetBinContent(8,1.003945); SegtoLCTXY_2__86->SetBinContent(9,0.3444826); SegtoLCTXY_2__86->SetBinContent(10,0.2705113); SegtoLCTXY_2__86->SetBinContent(11,0.2361921); SegtoLCTXY_2__86->SetBinContent(12,0.1676396); SegtoLCTXY_2__86->SetBinContent(13,0.1201604); SegtoLCTXY_2__86->SetBinContent(14,0.09788296); SegtoLCTXY_2__86->SetBinContent(15,0.07551954); SegtoLCTXY_2__86->SetBinContent(16,0.07018673); SegtoLCTXY_2__86->SetBinContent(17,0.06425182); SegtoLCTXY_2__86->SetBinContent(18,0.06003717); SegtoLCTXY_2__86->SetBinContent(19,0.04833939); SegtoLCTXY_2__86->SetBinContent(20,0.04395272); SegtoLCTXY_2__86->SetBinContent(21,0.03896395); SegtoLCTXY_2__86->SetBinContent(22,0.03681363); SegtoLCTXY_2__86->SetBinContent(23,0.03715768); SegtoLCTXY_2__86->SetBinContent(24,0.02950251); SegtoLCTXY_2__86->SetBinContent(25,0.03044865); SegtoLCTXY_2__86->SetBinContent(26,0.02915846); SegtoLCTXY_2__86->SetBinContent(27,0.02718015); SegtoLCTXY_2__86->SetBinContent(28,0.02391165); SegtoLCTXY_2__86->SetBinContent(29,0.02262146); SegtoLCTXY_2__86->SetBinContent(30,0.02305152); SegtoLCTXY_2__86->SetBinContent(31,0.02236342); SegtoLCTXY_2__86->SetBinContent(32,0.02012708); SegtoLCTXY_2__86->SetBinContent(33,0.02064315); SegtoLCTXY_2__86->SetBinContent(34,0.01866485); SegtoLCTXY_2__86->SetBinContent(35,0.01754668); SegtoLCTXY_2__86->SetBinContent(36,0.01711662); SegtoLCTXY_2__86->SetBinContent(37,0.0202991); SegtoLCTXY_2__86->SetBinContent(38,0.01668655); SegtoLCTXY_2__86->SetBinContent(39,0.0150523); SegtoLCTXY_2__86->SetBinContent(40,0.01599844); SegtoLCTXY_2__86->SetBinContent(41,0.01539635); SegtoLCTXY_2__86->SetBinContent(42,0.01488027); SegtoLCTXY_2__86->SetBinContent(43,0.01496629); SegtoLCTXY_2__86->SetBinContent(44,0.01582642); SegtoLCTXY_2__86->SetBinContent(45,0.01522433); SegtoLCTXY_2__86->SetBinContent(46,0.01316001); SegtoLCTXY_2__86->SetBinContent(47,0.009891512); SegtoLCTXY_2__86->SetBinContent(48,0.0110957); SegtoLCTXY_2__86->SetBinContent(49,0.01281596); SegtoLCTXY_2__86->SetBinContent(50,0.01221387); SegtoLCTXY_2__86->SetBinContent(51,0.00903138); SegtoLCTXY_2__86->SetBinContent(52,0.009805498); SegtoLCTXY_2__86->SetBinContent(53,0.00928942); SegtoLCTXY_2__86->SetBinContent(54,0.009117393); SegtoLCTXY_2__86->SetBinContent(55,0.009891512); SegtoLCTXY_2__86->SetBinContent(56,0.009719485); SegtoLCTXY_2__86->SetBinContent(57,0.0104936); SegtoLCTXY_2__86->SetBinContent(58,0.007741183); SegtoLCTXY_2__86->SetBinContent(59,0.006967065); SegtoLCTXY_2__86->SetBinContent(60,0.007225104); SegtoLCTXY_2__86->SetBinContent(61,0.008343275); SegtoLCTXY_2__86->SetBinContent(62,0.007139091); SegtoLCTXY_2__86->SetBinContent(63,0.008429288); SegtoLCTXY_2__86->SetBinContent(64,0.007569157); SegtoLCTXY_2__86->SetBinContent(65,0.006709025); SegtoLCTXY_2__86->SetBinContent(66,0.005332815); SegtoLCTXY_2__86->SetBinContent(67,0.006709025); SegtoLCTXY_2__86->SetBinContent(68,0.005418828); SegtoLCTXY_2__86->SetBinContent(69,0.005246802); SegtoLCTXY_2__86->SetBinContent(70,0.005762881); SegtoLCTXY_2__86->SetBinContent(71,0.006106933); SegtoLCTXY_2__86->SetBinContent(72,0.003096473); SegtoLCTXY_2__86->SetBinContent(73,0.00438667); SegtoLCTXY_2__86->SetBinContent(74,0.005848894); SegtoLCTXY_2__86->SetBinContent(75,0.004558697); SegtoLCTXY_2__86->SetBinContent(76,0.004042618); SegtoLCTXY_2__86->SetBinContent(77,0.003698565); SegtoLCTXY_2__86->SetBinContent(78,0.003698565); SegtoLCTXY_2__86->SetBinContent(79,0.003698565); SegtoLCTXY_2__86->SetBinContent(80,0.003698565); SegtoLCTXY_2__86->SetBinContent(81,0.00464471); SegtoLCTXY_2__86->SetBinContent(82,0.003182486); SegtoLCTXY_2__86->SetBinContent(83,0.004988762); SegtoLCTXY_2__86->SetBinContent(84,0.004816736); SegtoLCTXY_2__86->SetBinContent(85,0.003698565); SegtoLCTXY_2__86->SetBinContent(86,0.003354513); SegtoLCTXY_2__86->SetBinContent(87,0.004042618); SegtoLCTXY_2__86->SetBinContent(88,0.003956605); SegtoLCTXY_2__86->SetBinContent(89,0.003784578); SegtoLCTXY_2__86->SetBinContent(90,0.003440526); SegtoLCTXY_2__86->SetBinContent(91,0.002838434); SegtoLCTXY_2__86->SetBinContent(92,0.002838434); SegtoLCTXY_2__86->SetBinContent(93,0.002150329); SegtoLCTXY_2__86->SetBinContent(94,0.002924447); SegtoLCTXY_2__86->SetBinContent(95,0.001548237); SegtoLCTXY_2__86->SetBinContent(96,0.002236342); SegtoLCTXY_2__86->SetBinContent(97,0.003268499); SegtoLCTXY_2__86->SetBinContent(98,0.002150329); SegtoLCTXY_2__86->SetBinContent(99,0.00301046); SegtoLCTXY_2__86->SetBinContent(100,0.002150329); SegtoLCTXY_2__86->SetBinContent(101,1.954907); SegtoLCTXY_2__86->SetEntries(1185341); SegtoLCTXY_2__86->SetStats(0); ci = TColor::GetColor("#ff9999"); SegtoLCTXY_2__86->SetLineColor(ci); ci = TColor::GetColor("#ff9999"); SegtoLCTXY_2__86->SetMarkerColor(ci); SegtoLCTXY_2__86->GetXaxis()->SetTitle("cm"); SegtoLCTXY_2__86->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_2__86->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTXY_3__87 = new TH1D("SegtoLCTXY_3__87","SegtoLCTXY",100,-1,40); SegtoLCTXY_3__87->SetBinContent(3,50.56854); SegtoLCTXY_3__87->SetBinContent(4,13.86303); SegtoLCTXY_3__87->SetBinContent(5,6.472335); SegtoLCTXY_3__87->SetBinContent(6,10.78688); SegtoLCTXY_3__87->SetBinContent(7,6.78122); SegtoLCTXY_3__87->SetBinContent(8,3.510199); SegtoLCTXY_3__87->SetBinContent(9,2.522907); SegtoLCTXY_3__87->SetBinContent(10,1.416674); SegtoLCTXY_3__87->SetBinContent(11,1.218179); SegtoLCTXY_3__87->SetBinContent(12,1.073842); SegtoLCTXY_3__87->SetBinContent(13,0.418757); SegtoLCTXY_3__87->SetBinContent(14,0.2168933); SegtoLCTXY_3__87->SetBinContent(15,0.1326755); SegtoLCTXY_3__87->SetBinContent(16,0.1005431); SegtoLCTXY_3__87->SetBinContent(17,0.07307517); SegtoLCTXY_3__87->SetBinContent(18,0.05286289); SegtoLCTXY_3__87->SetBinContent(19,0.05234462); SegtoLCTXY_3__87->SetBinContent(20,0.04301588); SegtoLCTXY_3__87->SetBinContent(21,0.03187321); SegtoLCTXY_3__87->SetBinContent(22,0.03290974); SegtoLCTXY_3__87->SetBinContent(23,0.02746797); SegtoLCTXY_3__87->SetBinContent(24,0.02461752); SegtoLCTXY_3__87->SetBinContent(25,0.02617231); SegtoLCTXY_3__87->SetBinContent(26,0.0277271); SegtoLCTXY_3__87->SetBinContent(27,0.02824537); SegtoLCTXY_3__87->SetBinContent(28,0.01684357); SegtoLCTXY_3__87->SetBinContent(29,0.01528878); SegtoLCTXY_3__87->SetBinContent(30,0.01788009); SegtoLCTXY_3__87->SetBinContent(31,0.01813923); SegtoLCTXY_3__87->SetBinContent(32,0.0171027); SegtoLCTXY_3__87->SetBinContent(33,0.01399312); SegtoLCTXY_3__87->SetBinContent(34,0.01477051); SegtoLCTXY_3__87->SetBinContent(35,0.01347485); SegtoLCTXY_3__87->SetBinContent(36,0.009587877); SegtoLCTXY_3__87->SetBinContent(37,0.01373399); SegtoLCTXY_3__87->SetBinContent(38,0.01217919); SegtoLCTXY_3__87->SetBinContent(39,0.01114267); SegtoLCTXY_3__87->SetBinContent(40,0.01010614); SegtoLCTXY_3__87->SetBinContent(41,0.0114018); SegtoLCTXY_3__87->SetBinContent(42,0.01192006); SegtoLCTXY_3__87->SetBinContent(43,0.01088354); SegtoLCTXY_3__87->SetBinContent(44,0.009847009); SegtoLCTXY_3__87->SetBinContent(45,0.01114267); SegtoLCTXY_3__87->SetBinContent(46,0.009587877); SegtoLCTXY_3__87->SetBinContent(47,0.007773954); SegtoLCTXY_3__87->SetBinContent(48,0.008810481); SegtoLCTXY_3__87->SetBinContent(49,0.007255691); SegtoLCTXY_3__87->SetBinContent(50,0.009587877); SegtoLCTXY_3__87->SetBinContent(51,0.0057009); SegtoLCTXY_3__87->SetBinContent(52,0.007773954); SegtoLCTXY_3__87->SetBinContent(53,0.006219163); SegtoLCTXY_3__87->SetBinContent(54,0.004664372); SegtoLCTXY_3__87->SetBinContent(55,0.006737427); SegtoLCTXY_3__87->SetBinContent(56,0.004146109); SegtoLCTXY_3__87->SetBinContent(57,0.005182636); SegtoLCTXY_3__87->SetBinContent(58,0.006737427); SegtoLCTXY_3__87->SetBinContent(59,0.005960032); SegtoLCTXY_3__87->SetBinContent(60,0.005182636); SegtoLCTXY_3__87->SetBinContent(61,0.005182636); SegtoLCTXY_3__87->SetBinContent(62,0.005441768); SegtoLCTXY_3__87->SetBinContent(63,0.006478295); SegtoLCTXY_3__87->SetBinContent(64,0.004146109); SegtoLCTXY_3__87->SetBinContent(65,0.004146109); SegtoLCTXY_3__87->SetBinContent(66,0.004664372); SegtoLCTXY_3__87->SetBinContent(67,0.003886977); SegtoLCTXY_3__87->SetBinContent(68,0.005182636); SegtoLCTXY_3__87->SetBinContent(69,0.006478295); SegtoLCTXY_3__87->SetBinContent(70,0.004923504); SegtoLCTXY_3__87->SetBinContent(71,0.004146109); SegtoLCTXY_3__87->SetBinContent(72,0.003886977); SegtoLCTXY_3__87->SetBinContent(73,0.003627845); SegtoLCTXY_3__87->SetBinContent(74,0.0057009); SegtoLCTXY_3__87->SetBinContent(75,0.004664372); SegtoLCTXY_3__87->SetBinContent(76,0.002591318); SegtoLCTXY_3__87->SetBinContent(77,0.004405241); SegtoLCTXY_3__87->SetBinContent(78,0.004664372); SegtoLCTXY_3__87->SetBinContent(79,0.003886977); SegtoLCTXY_3__87->SetBinContent(80,0.002591318); SegtoLCTXY_3__87->SetBinContent(81,0.0057009); SegtoLCTXY_3__87->SetBinContent(82,0.003886977); SegtoLCTXY_3__87->SetBinContent(83,0.002332186); SegtoLCTXY_3__87->SetBinContent(84,0.004405241); SegtoLCTXY_3__87->SetBinContent(85,0.003627845); SegtoLCTXY_3__87->SetBinContent(86,0.002591318); SegtoLCTXY_3__87->SetBinContent(87,0.003886977); SegtoLCTXY_3__87->SetBinContent(88,0.003886977); SegtoLCTXY_3__87->SetBinContent(89,0.003886977); SegtoLCTXY_3__87->SetBinContent(90,0.003627845); SegtoLCTXY_3__87->SetBinContent(91,0.002332186); SegtoLCTXY_3__87->SetBinContent(92,0.003109582); SegtoLCTXY_3__87->SetBinContent(93,0.002591318); SegtoLCTXY_3__87->SetBinContent(94,0.004664372); SegtoLCTXY_3__87->SetBinContent(95,0.00285045); SegtoLCTXY_3__87->SetBinContent(96,0.002591318); SegtoLCTXY_3__87->SetBinContent(97,0.001036527); SegtoLCTXY_3__87->SetBinContent(98,0.002591318); SegtoLCTXY_3__87->SetBinContent(99,0.003109582); SegtoLCTXY_3__87->SetBinContent(100,0.00285045); SegtoLCTXY_3__87->SetBinContent(101,0.9567146); SegtoLCTXY_3__87->SetEntries(389596); SegtoLCTXY_3__87->SetStats(0); SegtoLCTXY_3__87->GetXaxis()->SetTitle("cm"); SegtoLCTXY_3__87->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_3__87->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTXY_4__88 = new TH1D("SegtoLCTXY_4__88","SegtoLCTXY",100,-1,40); SegtoLCTXY_4__88->SetBinContent(3,69.67343); SegtoLCTXY_4__88->SetBinContent(4,9.36773); SegtoLCTXY_4__88->SetBinContent(5,7.842806); SegtoLCTXY_4__88->SetBinContent(6,3.823261); SegtoLCTXY_4__88->SetBinContent(7,2.984367); SegtoLCTXY_4__88->SetBinContent(8,1.160144); SegtoLCTXY_4__88->SetBinContent(9,2.364835); SegtoLCTXY_4__88->SetBinContent(10,0.8711254); SegtoLCTXY_4__88->SetBinContent(11,0.533223); SegtoLCTXY_4__88->SetBinContent(12,0.3724904); SegtoLCTXY_4__88->SetBinContent(13,0.1784549); SegtoLCTXY_4__88->SetBinContent(14,0.1092789); SegtoLCTXY_4__88->SetBinContent(15,0.08566691); SegtoLCTXY_4__88->SetBinContent(16,0.06826582); SegtoLCTXY_4__88->SetBinContent(17,0.05375599); SegtoLCTXY_4__88->SetBinContent(18,0.04486804); SegtoLCTXY_4__88->SetBinContent(19,0.03806823); SegtoLCTXY_4__88->SetBinContent(20,0.03201801); SegtoLCTXY_4__88->SetBinContent(21,0.02950154); SegtoLCTXY_4__88->SetBinContent(22,0.02553945); SegtoLCTXY_4__88->SetBinContent(23,0.02002464); SegtoLCTXY_4__88->SetBinContent(24,0.01804359); SegtoLCTXY_4__88->SetBinContent(25,0.01761526); SegtoLCTXY_4__88->SetBinContent(26,0.01461692); SegtoLCTXY_4__88->SetBinContent(27,0.01359962); SegtoLCTXY_4__88->SetBinContent(28,0.01108316); SegtoLCTXY_4__88->SetBinContent(29,0.01322483); SegtoLCTXY_4__88->SetBinContent(30,0.009958778); SegtoLCTXY_4__88->SetBinContent(31,0.008995025); SegtoLCTXY_4__88->SetBinContent(32,0.009316276); SegtoLCTXY_4__88->SetBinContent(33,0.009048567); SegtoLCTXY_4__88->SetBinContent(34,0.008780858); SegtoLCTXY_4__88->SetBinContent(35,0.007549396); SegtoLCTXY_4__88->SetBinContent(36,0.007817105); SegtoLCTXY_4__88->SetBinContent(37,0.006639185); SegtoLCTXY_4__88->SetBinContent(38,0.007549396); SegtoLCTXY_4__88->SetBinContent(39,0.005943142); SegtoLCTXY_4__88->SetBinContent(40,0.0058896); SegtoLCTXY_4__88->SetBinContent(41,0.004872305); SegtoLCTXY_4__88->SetBinContent(42,0.004229804); SegtoLCTXY_4__88->SetBinContent(43,0.004443971); SegtoLCTXY_4__88->SetBinContent(44,0.004336887); SegtoLCTXY_4__88->SetBinContent(45,0.004604596); SegtoLCTXY_4__88->SetBinContent(46,0.004658138); SegtoLCTXY_4__88->SetBinContent(47,0.003747927); SegtoLCTXY_4__88->SetBinContent(48,0.003426676); SegtoLCTXY_4__88->SetBinContent(49,0.003801469); SegtoLCTXY_4__88->SetBinContent(50,0.003319593); SegtoLCTXY_4__88->SetBinContent(51,0.003480218); SegtoLCTXY_4__88->SetBinContent(52,0.003694385); SegtoLCTXY_4__88->SetBinContent(53,0.002891258); SegtoLCTXY_4__88->SetBinContent(54,0.003747927); SegtoLCTXY_4__88->SetBinContent(55,0.002784175); SegtoLCTXY_4__88->SetBinContent(56,0.00235584); SegtoLCTXY_4__88->SetBinContent(57,0.003587302); SegtoLCTXY_4__88->SetBinContent(58,0.002623549); SegtoLCTXY_4__88->SetBinContent(59,0.003212509); SegtoLCTXY_4__88->SetBinContent(60,0.002570007); SegtoLCTXY_4__88->SetBinContent(61,0.002409382); SegtoLCTXY_4__88->SetBinContent(62,0.002837716); SegtoLCTXY_4__88->SetBinContent(63,0.002409382); SegtoLCTXY_4__88->SetBinContent(64,0.002302298); SegtoLCTXY_4__88->SetBinContent(65,0.001927505); SegtoLCTXY_4__88->SetBinContent(66,0.002034589); SegtoLCTXY_4__88->SetBinContent(67,0.001873964); SegtoLCTXY_4__88->SetBinContent(68,0.001552713); SegtoLCTXY_4__88->SetBinContent(69,0.002837716); SegtoLCTXY_4__88->SetBinContent(70,0.002409382); SegtoLCTXY_4__88->SetBinContent(71,0.001499171); SegtoLCTXY_4__88->SetBinContent(72,0.001927505); SegtoLCTXY_4__88->SetBinContent(73,0.002088131); SegtoLCTXY_4__88->SetBinContent(74,0.001713338); SegtoLCTXY_4__88->SetBinContent(75,0.001981047); SegtoLCTXY_4__88->SetBinContent(76,0.002302298); SegtoLCTXY_4__88->SetBinContent(77,0.001606255); SegtoLCTXY_4__88->SetBinContent(78,0.001873964); SegtoLCTXY_4__88->SetBinContent(79,0.002302298); SegtoLCTXY_4__88->SetBinContent(80,0.001231462); SegtoLCTXY_4__88->SetBinContent(81,0.001927505); SegtoLCTXY_4__88->SetBinContent(82,0.001927505); SegtoLCTXY_4__88->SetBinContent(83,0.001499171); SegtoLCTXY_4__88->SetBinContent(84,0.002248756); SegtoLCTXY_4__88->SetBinContent(85,0.001338545); SegtoLCTXY_4__88->SetBinContent(86,0.001873964); SegtoLCTXY_4__88->SetBinContent(87,0.001606255); SegtoLCTXY_4__88->SetBinContent(88,0.001392087); SegtoLCTXY_4__88->SetBinContent(89,0.001017295); SegtoLCTXY_4__88->SetBinContent(90,0.001285004); SegtoLCTXY_4__88->SetBinContent(91,0.001499171); SegtoLCTXY_4__88->SetBinContent(92,0.001820422); SegtoLCTXY_4__88->SetBinContent(93,0.002034589); SegtoLCTXY_4__88->SetBinContent(94,0.001231462); SegtoLCTXY_4__88->SetBinContent(95,0.001499171); SegtoLCTXY_4__88->SetBinContent(96,0.00117792); SegtoLCTXY_4__88->SetBinContent(97,0.001873964); SegtoLCTXY_4__88->SetBinContent(98,0.001499171); SegtoLCTXY_4__88->SetBinContent(99,0.00176688); SegtoLCTXY_4__88->SetBinContent(100,0.001445629); SegtoLCTXY_4__88->SetBinContent(101,1.231783); SegtoLCTXY_4__88->SetEntries(1890705); SegtoLCTXY_4__88->SetStats(0); ci = TColor::GetColor("#ff0000"); SegtoLCTXY_4__88->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); SegtoLCTXY_4__88->SetMarkerColor(ci); SegtoLCTXY_4__88->GetXaxis()->SetTitle("cm"); SegtoLCTXY_4__88->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_4__88->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTXY_5__89 = new TH1D("SegtoLCTXY_5__89","SegtoLCTXY",100,-1,40); SegtoLCTXY_5__89->SetBinContent(3,63.282); SegtoLCTXY_5__89->SetBinContent(4,11.41746); SegtoLCTXY_5__89->SetBinContent(5,9.348075); SegtoLCTXY_5__89->SetBinContent(6,4.156944); SegtoLCTXY_5__89->SetBinContent(7,4.457318); SegtoLCTXY_5__89->SetBinContent(8,2.223664); SegtoLCTXY_5__89->SetBinContent(9,3.338355); SegtoLCTXY_5__89->SetBinContent(10,0.5627393); SegtoLCTXY_5__89->SetBinContent(11,0.2315969); SegtoLCTXY_5__89->SetBinContent(12,0.1500059); SegtoLCTXY_5__89->SetBinContent(13,0.1137352); SegtoLCTXY_5__89->SetBinContent(14,0.09027865); SegtoLCTXY_5__89->SetBinContent(15,0.07123832); SegtoLCTXY_5__89->SetBinContent(16,0.0608856); SegtoLCTXY_5__89->SetBinContent(17,0.0478542); SegtoLCTXY_5__89->SetBinContent(18,0.04314842); SegtoLCTXY_5__89->SetBinContent(19,0.03663272); SegtoLCTXY_5__89->SetBinContent(20,0.02859668); SegtoLCTXY_5__89->SetBinContent(21,0.02671437); SegtoLCTXY_5__89->SetBinContent(22,0.02468726); SegtoLCTXY_5__89->SetBinContent(23,0.02135702); SegtoLCTXY_5__89->SetBinContent(24,0.02041586); SegtoLCTXY_5__89->SetBinContent(25,0.02005388); SegtoLCTXY_5__89->SetBinContent(26,0.01657884); SegtoLCTXY_5__89->SetBinContent(27,0.01187305); SegtoLCTXY_5__89->SetBinContent(28,0.01158347); SegtoLCTXY_5__89->SetBinContent(29,0.01006314); SegtoLCTXY_5__89->SetBinContent(30,0.00933917); SegtoLCTXY_5__89->SetBinContent(31,0.009049584); SegtoLCTXY_5__89->SetBinContent(32,0.007312064); SegtoLCTXY_5__89->SetBinContent(33,0.008542807); SegtoLCTXY_5__89->SetBinContent(34,0.006443304); SegtoLCTXY_5__89->SetBinContent(35,0.006153717); SegtoLCTXY_5__89->SetBinContent(36,0.00564694); SegtoLCTXY_5__89->SetBinContent(37,0.004633387); SegtoLCTXY_5__89->SetBinContent(38,0.004271404); SegtoLCTXY_5__89->SetBinContent(39,0.004850577); SegtoLCTXY_5__89->SetBinContent(40,0.004488594); SegtoLCTXY_5__89->SetBinContent(41,0.004850577); SegtoLCTXY_5__89->SetBinContent(42,0.003837024); SegtoLCTXY_5__89->SetBinContent(43,0.003185453); SegtoLCTXY_5__89->SetBinContent(44,0.002968263); SegtoLCTXY_5__89->SetBinContent(45,0.00412661); SegtoLCTXY_5__89->SetBinContent(46,0.00282347); SegtoLCTXY_5__89->SetBinContent(47,0.002751073); SegtoLCTXY_5__89->SetBinContent(48,0.00282347); SegtoLCTXY_5__89->SetBinContent(49,0.003837024); SegtoLCTXY_5__89->SetBinContent(50,0.002533883); SegtoLCTXY_5__89->SetBinContent(51,0.003113057); SegtoLCTXY_5__89->SetBinContent(52,0.002461487); SegtoLCTXY_5__89->SetBinContent(53,0.002461487); SegtoLCTXY_5__89->SetBinContent(54,0.002099503); SegtoLCTXY_5__89->SetBinContent(55,0.00238909); SegtoLCTXY_5__89->SetBinContent(56,0.002099503); SegtoLCTXY_5__89->SetBinContent(57,0.002316693); SegtoLCTXY_5__89->SetBinContent(58,0.002099503); SegtoLCTXY_5__89->SetBinContent(59,0.002461487); SegtoLCTXY_5__89->SetBinContent(60,0.001592727); SegtoLCTXY_5__89->SetBinContent(61,0.00195471); SegtoLCTXY_5__89->SetBinContent(62,0.002244297); SegtoLCTXY_5__89->SetBinContent(63,0.00195471); SegtoLCTXY_5__89->SetBinContent(64,0.00195471); SegtoLCTXY_5__89->SetBinContent(65,0.001375537); SegtoLCTXY_5__89->SetBinContent(66,0.002027107); SegtoLCTXY_5__89->SetBinContent(67,0.001447933); SegtoLCTXY_5__89->SetBinContent(68,0.001375537); SegtoLCTXY_5__89->SetBinContent(69,0.001882313); SegtoLCTXY_5__89->SetBinContent(70,0.00086876); SegtoLCTXY_5__89->SetBinContent(71,0.001230743); SegtoLCTXY_5__89->SetBinContent(72,0.00152033); SegtoLCTXY_5__89->SetBinContent(73,0.001013553); SegtoLCTXY_5__89->SetBinContent(74,0.00152033); SegtoLCTXY_5__89->SetBinContent(75,0.00108595); SegtoLCTXY_5__89->SetBinContent(76,0.001375537); SegtoLCTXY_5__89->SetBinContent(77,0.00130314); SegtoLCTXY_5__89->SetBinContent(78,0.001230743); SegtoLCTXY_5__89->SetBinContent(79,0.00130314); SegtoLCTXY_5__89->SetBinContent(80,0.001447933); SegtoLCTXY_5__89->SetBinContent(81,0.001013553); SegtoLCTXY_5__89->SetBinContent(82,0.0005791734); SegtoLCTXY_5__89->SetBinContent(83,0.0007963634); SegtoLCTXY_5__89->SetBinContent(84,0.001013553); SegtoLCTXY_5__89->SetBinContent(85,0.001013553); SegtoLCTXY_5__89->SetBinContent(86,0.00086876); SegtoLCTXY_5__89->SetBinContent(87,0.0009411567); SegtoLCTXY_5__89->SetBinContent(88,0.0007239667); SegtoLCTXY_5__89->SetBinContent(89,0.0009411567); SegtoLCTXY_5__89->SetBinContent(90,0.00086876); SegtoLCTXY_5__89->SetBinContent(91,0.0009411567); SegtoLCTXY_5__89->SetBinContent(92,0.00086876); SegtoLCTXY_5__89->SetBinContent(93,0.001158347); SegtoLCTXY_5__89->SetBinContent(94,0.001013553); SegtoLCTXY_5__89->SetBinContent(95,0.00086876); SegtoLCTXY_5__89->SetBinContent(96,0.00108595); SegtoLCTXY_5__89->SetBinContent(97,0.0007239667); SegtoLCTXY_5__89->SetBinContent(98,0.00130314); SegtoLCTXY_5__89->SetBinContent(99,0.0009411567); SegtoLCTXY_5__89->SetBinContent(100,0.0007963634); SegtoLCTXY_5__89->SetBinContent(101,0.9719253); SegtoLCTXY_5__89->SetEntries(1394704); SegtoLCTXY_5__89->SetStats(0); ci = TColor::GetColor("#00ff00"); SegtoLCTXY_5__89->SetLineColor(ci); ci = TColor::GetColor("#00ff00"); SegtoLCTXY_5__89->SetMarkerColor(ci); SegtoLCTXY_5__89->GetXaxis()->SetTitle("cm"); SegtoLCTXY_5__89->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_5__89->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegtoLCTXY_6__90 = new TH1D("SegtoLCTXY_6__90","SegtoLCTXY",100,-1,40); SegtoLCTXY_6__90->SetBinContent(3,58.76496); SegtoLCTXY_6__90->SetBinContent(4,11.83379); SegtoLCTXY_6__90->SetBinContent(5,10.59451); SegtoLCTXY_6__90->SetBinContent(6,3.901292); SegtoLCTXY_6__90->SetBinContent(7,5.929365); SegtoLCTXY_6__90->SetBinContent(8,2.829106); SegtoLCTXY_6__90->SetBinContent(9,4.145586); SegtoLCTXY_6__90->SetBinContent(10,0.6414297); SegtoLCTXY_6__90->SetBinContent(11,0.2611946); SegtoLCTXY_6__90->SetBinContent(12,0.1720285); SegtoLCTXY_6__90->SetBinContent(13,0.1303689); SegtoLCTXY_6__90->SetBinContent(14,0.1024131); SegtoLCTXY_6__90->SetBinContent(15,0.08249694); SegtoLCTXY_6__90->SetBinContent(16,0.06897585); SegtoLCTXY_6__90->SetBinContent(17,0.05618563); SegtoLCTXY_6__90->SetBinContent(18,0.04732383); SegtoLCTXY_6__90->SetBinContent(19,0.04129415); SegtoLCTXY_6__90->SetBinContent(20,0.03197556); SegtoLCTXY_6__90->SetBinContent(21,0.02941751); SegtoLCTXY_6__90->SetBinContent(22,0.02786442); SegtoLCTXY_6__90->SetBinContent(23,0.02494094); SegtoLCTXY_6__90->SetBinContent(24,0.01991621); SegtoLCTXY_6__90->SetBinContent(25,0.01918534); SegtoLCTXY_6__90->SetBinContent(26,0.01991621); SegtoLCTXY_6__90->SetBinContent(27,0.01342974); SegtoLCTXY_6__90->SetBinContent(28,0.01397789); SegtoLCTXY_6__90->SetBinContent(29,0.0115112); SegtoLCTXY_6__90->SetBinContent(30,0.01004946); SegtoLCTXY_6__90->SetBinContent(31,0.006577829); SegtoLCTXY_6__90->SetBinContent(32,0.008953157); SegtoLCTXY_6__90->SetBinContent(33,0.007217341); SegtoLCTXY_6__90->SetBinContent(34,0.007400058); SegtoLCTXY_6__90->SetBinContent(35,0.007765493); SegtoLCTXY_6__90->SetBinContent(36,0.005664242); SegtoLCTXY_6__90->SetBinContent(37,0.005024731); SegtoLCTXY_6__90->SetBinContent(38,0.005298807); SegtoLCTXY_6__90->SetBinContent(39,0.005298807); SegtoLCTXY_6__90->SetBinContent(40,0.003562991); SegtoLCTXY_6__90->SetBinContent(41,0.004111143); SegtoLCTXY_6__90->SetBinContent(42,0.005664242); SegtoLCTXY_6__90->SetBinContent(43,0.003288915); SegtoLCTXY_6__90->SetBinContent(44,0.002740762); SegtoLCTXY_6__90->SetBinContent(45,0.004293861); SegtoLCTXY_6__90->SetBinContent(46,0.005481525); SegtoLCTXY_6__90->SetBinContent(47,0.002466686); SegtoLCTXY_6__90->SetBinContent(48,0.003014838); SegtoLCTXY_6__90->SetBinContent(49,0.002558045); SegtoLCTXY_6__90->SetBinContent(50,0.002101251); SegtoLCTXY_6__90->SetBinContent(51,0.004019785); SegtoLCTXY_6__90->SetBinContent(52,0.004293861); SegtoLCTXY_6__90->SetBinContent(53,0.002649404); SegtoLCTXY_6__90->SetBinContent(54,0.002740762); SegtoLCTXY_6__90->SetBinContent(55,0.002009892); SegtoLCTXY_6__90->SetBinContent(56,0.00219261); SegtoLCTXY_6__90->SetBinContent(57,0.001735816); SegtoLCTXY_6__90->SetBinContent(58,0.00146174); SegtoLCTXY_6__90->SetBinContent(59,0.002101251); SegtoLCTXY_6__90->SetBinContent(60,0.002283969); SegtoLCTXY_6__90->SetBinContent(61,0.002283969); SegtoLCTXY_6__90->SetBinContent(62,0.001827175); SegtoLCTXY_6__90->SetBinContent(63,0.002101251); SegtoLCTXY_6__90->SetBinContent(64,0.001096305); SegtoLCTXY_6__90->SetBinContent(65,0.001370381); SegtoLCTXY_6__90->SetBinContent(66,0.001644457); SegtoLCTXY_6__90->SetBinContent(67,0.001279022); SegtoLCTXY_6__90->SetBinContent(68,0.00146174); SegtoLCTXY_6__90->SetBinContent(69,0.001096305); SegtoLCTXY_6__90->SetBinContent(70,0.001644457); SegtoLCTXY_6__90->SetBinContent(71,0.002375327); SegtoLCTXY_6__90->SetBinContent(72,0.0009135874); SegtoLCTXY_6__90->SetBinContent(73,0.001096305); SegtoLCTXY_6__90->SetBinContent(74,0.002009892); SegtoLCTXY_6__90->SetBinContent(75,0.001370381); SegtoLCTXY_6__90->SetBinContent(76,0.001735816); SegtoLCTXY_6__90->SetBinContent(77,0.001004946); SegtoLCTXY_6__90->SetBinContent(78,0.001279022); SegtoLCTXY_6__90->SetBinContent(79,0.001096305); SegtoLCTXY_6__90->SetBinContent(80,0.001735816); SegtoLCTXY_6__90->SetBinContent(81,0.00146174); SegtoLCTXY_6__90->SetBinContent(82,0.0006395112); SegtoLCTXY_6__90->SetBinContent(83,0.001004946); SegtoLCTXY_6__90->SetBinContent(84,0.001370381); SegtoLCTXY_6__90->SetBinContent(85,0.0005481525); SegtoLCTXY_6__90->SetBinContent(86,0.001004946); SegtoLCTXY_6__90->SetBinContent(87,0.001735816); SegtoLCTXY_6__90->SetBinContent(88,0.0007308699); SegtoLCTXY_6__90->SetBinContent(89,0.00146174); SegtoLCTXY_6__90->SetBinContent(90,0.001096305); SegtoLCTXY_6__90->SetBinContent(91,0.0008222287); SegtoLCTXY_6__90->SetBinContent(92,0.0007308699); SegtoLCTXY_6__90->SetBinContent(93,0.001096305); SegtoLCTXY_6__90->SetBinContent(94,0.0009135874); SegtoLCTXY_6__90->SetBinContent(95,0.0009135874); SegtoLCTXY_6__90->SetBinContent(96,0.001370381); SegtoLCTXY_6__90->SetBinContent(97,0.001279022); SegtoLCTXY_6__90->SetBinContent(98,0.0007308699); SegtoLCTXY_6__90->SetBinContent(99,0.001279022); SegtoLCTXY_6__90->SetBinContent(100,0.0009135874); SegtoLCTXY_6__90->SetBinContent(101,0.7038277); SegtoLCTXY_6__90->SetEntries(1102290); SegtoLCTXY_6__90->SetStats(0); ci = TColor::GetColor("#0000ff"); SegtoLCTXY_6__90->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); SegtoLCTXY_6__90->SetMarkerColor(ci); SegtoLCTXY_6__90->GetXaxis()->SetTitle("cm"); SegtoLCTXY_6__90->GetYaxis()->SetTitle("scaled number of entries"); SegtoLCTXY_6__90->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegtoLCTXY_1","ME11A: mean:0.4cm;RMS:1.9cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_2","ME11B: mean:0.4cm;RMS:1.8cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_3","ME12+13: mean:0.8cm;RMS:1.8cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_4","ME2: mean:0.4cm;RMS:1.4cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_5","ME3: mean:0.5cm;RMS:1.2cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegtoLCTXY_6","ME4: mean:0.6cm;RMS:1.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TPaveText *pt = new TPaveText(0.01,0.9390678,0.2981452,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(1); pt->SetFillColor(0); TText *AText = pt->AddText("SegtoLCTXY"); pt->Draw(); SegtoLCTXY->Modified(); SegtoLCTXY->cd(); SegtoLCTXY->SetSelected(SegtoLCTXY); }
void SegX_2016B_June22all_sameYrange_fullIntegral_10k9k() { //=========Macro generated from canvas: SegX/SegX //========= (Fri Aug 5 09:22:37 2016) by ROOT version6.06/01 TCanvas *SegX = new TCanvas("SegX", "SegX",0,0,500,500); gStyle->SetOptStat(0); SegX->SetHighLightColor(2); SegX->Range(-125,-2.848556,125,2.626708); SegX->SetFillColor(0); SegX->SetBorderMode(0); SegX->SetBorderSize(2); SegX->SetLogy(); SegX->SetFrameBorderMode(0); SegX->SetFrameBorderMode(0); TH1D *SegX_1__19 = new TH1D("SegX_1__19","SegX",100,-100,100); SegX_1__19->SetBinContent(0,399.7427); SegX_1__19->SetBinContent(39,0.0007394809); SegX_1__19->SetBinContent(40,0.01109221); SegX_1__19->SetBinContent(41,0.02366339); SegX_1__19->SetBinContent(42,0.04880574); SegX_1__19->SetBinContent(43,0.09613251); SegX_1__19->SetBinContent(44,0.5671818); SegX_1__19->SetBinContent(45,1.913037); SegX_1__19->SetBinContent(46,3.895585); SegX_1__19->SetBinContent(47,8.348); SegX_1__19->SetBinContent(48,11.60985); SegX_1__19->SetBinContent(49,11.7363); SegX_1__19->SetBinContent(50,12.04171); SegX_1__19->SetBinContent(51,12.05058); SegX_1__19->SetBinContent(52,11.89159); SegX_1__19->SetBinContent(53,11.26081); SegX_1__19->SetBinContent(54,8.149079); SegX_1__19->SetBinContent(55,3.796495); SegX_1__19->SetBinContent(56,1.839089); SegX_1__19->SetBinContent(57,0.5302078); SegX_1__19->SetBinContent(58,0.09835096); SegX_1__19->SetBinContent(59,0.05472159); SegX_1__19->SetBinContent(60,0.02292391); SegX_1__19->SetBinContent(61,0.008873771); SegX_1__19->SetBinContent(62,0.005176366); SegX_1__19->SetMinimum(0.005); SegX_1__19->SetMaximum(120); SegX_1__19->SetEntries(675802); SegX_1__19->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ff00ff"); SegX_1__19->SetLineColor(ci); ci = TColor::GetColor("#ff00ff"); SegX_1__19->SetMarkerColor(ci); SegX_1__19->GetXaxis()->SetTitle("cm"); SegX_1__19->GetYaxis()->SetTitle("scaled number of entries"); SegX_1__19->Draw("H"); TLegend *leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegX_2__20 = new TH1D("SegX_2__20","SegX",100,-100,100); SegX_2__20->SetBinContent(0,270.1449); SegX_2__20->SetBinContent(39,0.0249815); SegX_2__20->SetBinContent(40,0.1142904); SegX_2__20->SetBinContent(41,0.3269454); SegX_2__20->SetBinContent(42,1.204733); SegX_2__20->SetBinContent(43,2.505957); SegX_2__20->SetBinContent(44,3.989545); SegX_2__20->SetBinContent(45,5.530904); SegX_2__20->SetBinContent(46,6.957972); SegX_2__20->SetBinContent(47,7.25369); SegX_2__20->SetBinContent(48,7.353304); SegX_2__20->SetBinContent(49,7.47384); SegX_2__20->SetBinContent(50,7.455104); SegX_2__20->SetBinContent(51,7.516308); SegX_2__20->SetBinContent(52,7.505691); SegX_2__20->SetBinContent(53,7.34581); SegX_2__20->SetBinContent(54,7.34862); SegX_2__20->SetBinContent(55,6.910819); SegX_2__20->SetBinContent(56,5.432227); SegX_2__20->SetBinContent(57,3.844028); SegX_2__20->SetBinContent(58,2.401034); SegX_2__20->SetBinContent(59,1.067022); SegX_2__20->SetBinContent(60,0.2994657); SegX_2__20->SetBinContent(61,0.1164762); SegX_2__20->SetBinContent(62,0.02123427); SegX_2__20->SetEntries(1185341); SegX_2__20->SetStats(0); ci = TColor::GetColor("#ff9999"); SegX_2__20->SetLineColor(ci); ci = TColor::GetColor("#ff9999"); SegX_2__20->SetMarkerColor(ci); SegX_2__20->GetXaxis()->SetTitle("cm"); SegX_2__20->GetYaxis()->SetTitle("scaled number of entries"); SegX_2__20->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegX_3__21 = new TH1D("SegX_3__21","SegX",100,-100,100); SegX_3__21->SetBinContent(0,80.5951); SegX_3__21->SetBinContent(28,0.0004635445); SegX_3__21->SetBinContent(29,0.001390634); SegX_3__21->SetBinContent(30,0.01344279); SegX_3__21->SetBinContent(31,0.03754711); SegX_3__21->SetBinContent(32,0.1219122); SegX_3__21->SetBinContent(33,0.3712992); SegX_3__21->SetBinContent(34,0.817229); SegX_3__21->SetBinContent(35,1.240445); SegX_3__21->SetBinContent(36,1.838418); SegX_3__21->SetBinContent(37,2.596777); SegX_3__21->SetBinContent(38,3.1229); SegX_3__21->SetBinContent(39,3.203556); SegX_3__21->SetBinContent(40,3.271697); SegX_3__21->SetBinContent(41,3.325005); SegX_3__21->SetBinContent(42,3.348646); SegX_3__21->SetBinContent(43,3.330568); SegX_3__21->SetBinContent(44,3.375068); SegX_3__21->SetBinContent(45,3.360234); SegX_3__21->SetBinContent(46,3.349109); SegX_3__21->SetBinContent(47,3.318515); SegX_3__21->SetBinContent(48,3.375531); SegX_3__21->SetBinContent(49,3.312489); SegX_3__21->SetBinContent(50,3.43162); SegX_3__21->SetBinContent(51,3.357453); SegX_3__21->SetBinContent(52,3.422813); SegX_3__21->SetBinContent(53,3.361625); SegX_3__21->SetBinContent(54,3.392682); SegX_3__21->SetBinContent(55,3.39361); SegX_3__21->SetBinContent(56,3.321297); SegX_3__21->SetBinContent(57,3.326859); SegX_3__21->SetBinContent(58,3.282822); SegX_3__21->SetBinContent(59,3.388047); SegX_3__21->SetBinContent(60,3.411224); SegX_3__21->SetBinContent(61,3.326859); SegX_3__21->SetBinContent(62,3.22627); SegX_3__21->SetBinContent(63,3.022774); SegX_3__21->SetBinContent(64,2.55274); SegX_3__21->SetBinContent(65,1.746172); SegX_3__21->SetBinContent(66,1.123632); SegX_3__21->SetBinContent(67,0.7268378); SegX_3__21->SetBinContent(68,0.3203093); SegX_3__21->SetBinContent(69,0.09409954); SegX_3__21->SetBinContent(70,0.03337521); SegX_3__21->SetBinContent(71,0.003708356); SegX_3__21->SetBinContent(72,0.0009270891); SegX_3__21->SetEntries(389596); SegX_3__21->SetStats(0); SegX_3__21->GetXaxis()->SetTitle("cm"); SegX_3__21->GetYaxis()->SetTitle("scaled number of entries"); SegX_3__21->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegX_4__22 = new TH1D("SegX_4__22","SegX",100,-100,100); SegX_4__22->SetBinContent(0,205.6549); SegX_4__22->SetBinContent(20,0.002748252); SegX_4__22->SetBinContent(21,0.008244756); SegX_4__22->SetBinContent(22,0.01972275); SegX_4__22->SetBinContent(23,0.06773633); SegX_4__22->SetBinContent(24,0.1547104); SegX_4__22->SetBinContent(25,0.2565574); SegX_4__22->SetBinContent(26,0.3739239); SegX_4__22->SetBinContent(27,0.4752859); SegX_4__22->SetBinContent(28,0.5855393); SegX_4__22->SetBinContent(29,0.687063); SegX_4__22->SetBinContent(30,0.84339); SegX_4__22->SetBinContent(31,1.017177); SegX_4__22->SetBinContent(32,1.278746); SegX_4__22->SetBinContent(33,1.383664); SegX_4__22->SetBinContent(34,1.584286); SegX_4__22->SetBinContent(35,1.911167); SegX_4__22->SetBinContent(36,2.183405); SegX_4__22->SetBinContent(37,2.35606); SegX_4__22->SetBinContent(38,2.533727); SegX_4__22->SetBinContent(39,2.709938); SegX_4__22->SetBinContent(40,2.69458); SegX_4__22->SetBinContent(41,2.674696); SegX_4__22->SetBinContent(42,2.683264); SegX_4__22->SetBinContent(43,2.654165); SegX_4__22->SetBinContent(44,2.712525); SegX_4__22->SetBinContent(45,2.747282); SegX_4__22->SetBinContent(46,2.711231); SegX_4__22->SetBinContent(47,2.720446); SegX_4__22->SetBinContent(48,2.75585); SegX_4__22->SetBinContent(49,2.717375); SegX_4__22->SetBinContent(50,2.758275); SegX_4__22->SetBinContent(51,2.76943); SegX_4__22->SetBinContent(52,2.74906); SegX_4__22->SetBinContent(53,2.771046); SegX_4__22->SetBinContent(54,2.740816); SegX_4__22->SetBinContent(55,2.685851); SegX_4__22->SetBinContent(56,2.669523); SegX_4__22->SetBinContent(57,2.647213); SegX_4__22->SetBinContent(58,2.597745); SegX_4__22->SetBinContent(59,2.6401); SegX_4__22->SetBinContent(60,2.63913); SegX_4__22->SetBinContent(61,2.655943); SegX_4__22->SetBinContent(62,2.623126); SegX_4__22->SetBinContent(63,2.52629); SegX_4__22->SetBinContent(64,2.347007); SegX_4__22->SetBinContent(65,2.170634); SegX_4__22->SetBinContent(66,1.884493); SegX_4__22->SetBinContent(67,1.603524); SegX_4__22->SetBinContent(68,1.388999); SegX_4__22->SetBinContent(69,1.219901); SegX_4__22->SetBinContent(70,1.018147); SegX_4__22->SetBinContent(71,0.8441984); SegX_4__22->SetBinContent(72,0.6936911); SegX_4__22->SetBinContent(73,0.5441539); SegX_4__22->SetBinContent(74,0.4651012); SegX_4__22->SetBinContent(75,0.3503213); SegX_4__22->SetBinContent(76,0.2463727); SegX_4__22->SetBinContent(77,0.1514772); SegX_4__22->SetBinContent(78,0.06708968); SegX_4__22->SetBinContent(79,0.01762115); SegX_4__22->SetBinContent(80,0.006951461); SegX_4__22->SetBinContent(81,0.001939943); SegX_4__22->SetBinContent(82,0.0003233238); SegX_4__22->SetEntries(1890705); SegX_4__22->SetStats(0); ci = TColor::GetColor("#ff0000"); SegX_4__22->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); SegX_4__22->SetMarkerColor(ci); SegX_4__22->GetXaxis()->SetTitle("cm"); SegX_4__22->GetYaxis()->SetTitle("scaled number of entries"); SegX_4__22->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegX_5__23 = new TH1D("SegX_5__23","SegX",100,-100,100); SegX_5__23->SetBinContent(0,157.814); SegX_5__23->SetBinContent(20,0.002033373); SegX_5__23->SetBinContent(21,0.006839528); SegX_5__23->SetBinContent(22,0.01959432); SegX_5__23->SetBinContent(23,0.07671363); SegX_5__23->SetBinContent(24,0.1695094); SegX_5__23->SetBinContent(25,0.2972422); SegX_5__23->SetBinContent(26,0.4053807); SegX_5__23->SetBinContent(27,0.513704); SegX_5__23->SetBinContent(28,0.6421762); SegX_5__23->SetBinContent(29,0.7730515); SegX_5__23->SetBinContent(30,0.9682553); SegX_5__23->SetBinContent(31,1.173626); SegX_5__23->SetBinContent(32,1.3936); SegX_5__23->SetBinContent(33,1.584737); SegX_5__23->SetBinContent(34,1.798056); SegX_5__23->SetBinContent(35,2.092526); SegX_5__23->SetBinContent(36,2.351134); SegX_5__23->SetBinContent(37,2.561681); SegX_5__23->SetBinContent(38,2.586636); SegX_5__23->SetBinContent(39,2.621203); SegX_5__23->SetBinContent(40,2.579241); SegX_5__23->SetBinContent(41,2.579057); SegX_5__23->SetBinContent(42,2.579796); SegX_5__23->SetBinContent(43,2.63784); SegX_5__23->SetBinContent(44,2.620279); SegX_5__23->SetBinContent(45,2.582569); SegX_5__23->SetBinContent(46,2.566302); SegX_5__23->SetBinContent(47,2.530441); SegX_5__23->SetBinContent(48,2.528777); SegX_5__23->SetBinContent(49,2.546338); SegX_5__23->SetBinContent(50,2.577208); SegX_5__23->SetBinContent(51,2.52545); SegX_5__23->SetBinContent(52,2.498461); SegX_5__23->SetBinContent(53,2.490882); SegX_5__23->SetBinContent(54,2.534138); SegX_5__23->SetBinContent(55,2.527113); SegX_5__23->SetBinContent(56,2.571478); SegX_5__23->SetBinContent(57,2.530071); SegX_5__23->SetBinContent(58,2.587005); SegX_5__23->SetBinContent(59,2.566117); SegX_5__23->SetBinContent(60,2.54301); SegX_5__23->SetBinContent(61,2.554102); SegX_5__23->SetBinContent(62,2.535247); SegX_5__23->SetBinContent(63,2.604012); SegX_5__23->SetBinContent(64,2.53155); SegX_5__23->SetBinContent(65,2.317861); SegX_5__23->SetBinContent(66,2.053707); SegX_5__23->SetBinContent(67,1.759977); SegX_5__23->SetBinContent(68,1.516342); SegX_5__23->SetBinContent(69,1.373451); SegX_5__23->SetBinContent(70,1.156989); SegX_5__23->SetBinContent(71,0.9863709); SegX_5__23->SetBinContent(72,0.7802608); SegX_5__23->SetBinContent(73,0.6194394); SegX_5__23->SetBinContent(74,0.5092676); SegX_5__23->SetBinContent(75,0.4011291); SegX_5__23->SetBinContent(76,0.2872602); SegX_5__23->SetBinContent(77,0.163779); SegX_5__23->SetBinContent(78,0.08170463); SegX_5__23->SetBinContent(79,0.02051858); SegX_5__23->SetBinContent(80,0.006654676); SegX_5__23->SetBinContent(81,0.001109113); SegX_5__23->SetEntries(1394704); SegX_5__23->SetStats(0); ci = TColor::GetColor("#00ff00"); SegX_5__23->SetLineColor(ci); ci = TColor::GetColor("#00ff00"); SegX_5__23->SetMarkerColor(ci); SegX_5__23->GetXaxis()->SetTitle("cm"); SegX_5__23->GetYaxis()->SetTitle("scaled number of entries"); SegX_5__23->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TH1D *SegX_6__24 = new TH1D("SegX_6__24","SegX",100,-100,100); SegX_6__24->SetBinContent(0,127.6015); SegX_6__24->SetBinContent(20,0.001032403); SegX_6__24->SetBinContent(21,0.004336093); SegX_6__24->SetBinContent(22,0.01817029); SegX_6__24->SetBinContent(23,0.08341816); SegX_6__24->SetBinContent(24,0.1755085); SegX_6__24->SetBinContent(25,0.3111663); SegX_6__24->SetBinContent(26,0.4148195); SegX_6__24->SetBinContent(27,0.5382949); SegX_6__24->SetBinContent(28,0.6943943); SegX_6__24->SetBinContent(29,0.8948869); SegX_6__24->SetBinContent(30,1.059452); SegX_6__24->SetBinContent(31,1.265726); SegX_6__24->SetBinContent(32,1.461057); SegX_6__24->SetBinContent(33,1.634294); SegX_6__24->SetBinContent(34,1.885787); SegX_6__24->SetBinContent(35,2.235772); SegX_6__24->SetBinContent(36,2.351608); SegX_6__24->SetBinContent(37,2.469508); SegX_6__24->SetBinContent(38,2.50048); SegX_6__24->SetBinContent(39,2.516792); SegX_6__24->SetBinContent(40,2.462488); SegX_6__24->SetBinContent(41,2.513488); SegX_6__24->SetBinContent(42,2.529387); SegX_6__24->SetBinContent(43,2.509152); SegX_6__24->SetBinContent(44,2.564283); SegX_6__24->SetBinContent(45,2.531865); SegX_6__24->SetBinContent(46,2.500687); SegX_6__24->SetBinContent(47,2.495937); SegX_6__24->SetBinContent(48,2.522367); SegX_6__24->SetBinContent(49,2.535169); SegX_6__24->SetBinContent(50,2.563663); SegX_6__24->SetBinContent(51,2.495112); SegX_6__24->SetBinContent(52,2.525051); SegX_6__24->SetBinContent(53,2.496144); SegX_6__24->SetBinContent(54,2.51163); SegX_6__24->SetBinContent(55,2.514727); SegX_6__24->SetBinContent(56,2.579562); SegX_6__24->SetBinContent(57,2.585137); SegX_6__24->SetBinContent(58,2.518857); SegX_6__24->SetBinContent(59,2.536201); SegX_6__24->SetBinContent(60,2.563457); SegX_6__24->SetBinContent(61,2.528768); SegX_6__24->SetBinContent(62,2.531865); SegX_6__24->SetBinContent(63,2.472192); SegX_6__24->SetBinContent(64,2.477767); SegX_6__24->SetBinContent(65,2.363377); SegX_6__24->SetBinContent(66,2.154832); SegX_6__24->SetBinContent(67,1.816616); SegX_6__24->SetBinContent(68,1.592172); SegX_6__24->SetBinContent(69,1.388582); SegX_6__24->SetBinContent(70,1.132133); SegX_6__24->SetBinContent(71,1.010723); SegX_6__24->SetBinContent(72,0.82489); SegX_6__24->SetBinContent(73,0.6696166); SegX_6__24->SetBinContent(74,0.5168209); SegX_6__24->SetBinContent(75,0.3947909); SegX_6__24->SetBinContent(76,0.2859756); SegX_6__24->SetBinContent(77,0.1655974); SegX_6__24->SetBinContent(78,0.0755719); SegX_6__24->SetBinContent(79,0.02064806); SegX_6__24->SetBinContent(80,0.005368496); SegX_6__24->SetBinContent(81,0.0008259224); SegX_6__24->SetEntries(1102290); SegX_6__24->SetStats(0); ci = TColor::GetColor("#0000ff"); SegX_6__24->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); SegX_6__24->SetMarkerColor(ci); SegX_6__24->GetXaxis()->SetTitle("cm"); SegX_6__24->GetYaxis()->SetTitle("scaled number of entries"); SegX_6__24->Draw("H,same"); leg = new TLegend(0.5,0.7,0.9,0.9,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextFont(62); leg->SetTextSize(0.02); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); entry=leg->AddEntry("SegX_1","ME11A: mean:-0.0cm;RMS:5.4cm","l"); ci = TColor::GetColor("#ff00ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_2","ME11B: mean:-0.1cm;RMS:8.4cm","l"); ci = TColor::GetColor("#ff9999"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_3","ME12+13: mean:-0.1cm;RMS:17.6cm","l"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_4","ME2: mean:-0.1cm;RMS:23.2cm","l"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_5","ME3: mean:-0.1cm;RMS:24.0cm","l"); ci = TColor::GetColor("#00ff00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); entry=leg->AddEntry("SegX_6","ME4: mean:-0.2cm;RMS:24.3cm","l"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(62); leg->Draw(); TPaveText *pt = new TPaveText(0.01,0.9390678,0.1408871,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(1); pt->SetFillColor(0); TText *AText = pt->AddText("SegX"); pt->Draw(); SegX->Modified(); SegX->cd(); SegX->SetSelected(SegX); }
void RDK2AnalysisPlotter::makeEPPlot(CoDet detType) { gROOT->cd(); TCanvas* theCanvas; TPad* mainPad; TPad* titlePad; TPad* pTPad; TPad* eEPad; TPad* pEPad; TPad* pTPadSubs[3]; TPad* eEPadSubs[3]; TPad* pEPadSubs[3]; int numTitleLines=getTitleBoxLines( detType); int canvasNumPixelsYPlot=600; int canvasNumPixelsYPlots=3*canvasNumPixelsYPlot; int canvasNumPixelsYTitle=40*numTitleLines; int canvasNumPixelsY=canvasNumPixelsYPlots+canvasNumPixelsYTitle; theCanvas = new TCanvas("EPExpMCAnalysisComparisonPlot","EPExpMCAnalysisComparisonPlot",10,10,1200,canvasNumPixelsY); mainPad=(TPad*) theCanvas->GetPad(0); double ylow,yhigh; yhigh=1; ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY; titlePad=new TPad("titlePad", "titlePad", 0., ylow, 1., yhigh, -1, 1, 1); yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY; ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-canvasNumPixelsYPlot/(double)canvasNumPixelsY; pTPad=new TPad("pTPad", "pTPad", 0., ylow, 1., yhigh, -1, 1, 1); yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-canvasNumPixelsYPlot/(double)canvasNumPixelsY; ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY- 2*canvasNumPixelsYPlot/(double)canvasNumPixelsY; eEPad=new TPad("eEPad", "eEPad", 0., ylow, 1., yhigh, -1, 1, 1); yhigh=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY-2*canvasNumPixelsYPlot/(double)canvasNumPixelsY; ylow=0; pEPad=new TPad("pEPad", "pEPad", 0., ylow, 1., yhigh, -1, 1, 1); titlePad->Draw(); pTPad->Draw(); eEPad->Draw(); pEPad->Draw(); // titlePad=(TPad*) theCanvas->GetPad(1); // pTPad=(TPad*) theCanvas->GetPad(2); // eEPad=(TPad*) theCanvas->GetPad(3); // pEPad=(TPad*) theCanvas->GetPad(4); titlePad->SetMargin(0.05,0.0,0.0,0.0); pTPad->SetMargin(0.05,0.0,0.0,0.05); pEPad->SetMargin(0.05,0.0,0.0,0.05); eEPad->SetMargin(0.05,0.0,0.0,0.05); if(numExp+numMC >1) { pTPad->Divide(2); eEPad->Divide(2); pEPad->Divide(2); pTPadSubs[0]=(TPad*) pTPad->GetPad(1); eEPadSubs[0]=(TPad*) eEPad->GetPad(1); pEPadSubs[0]=(TPad*) pEPad->GetPad(1); TPad* tempPad; tempPad=(TPad*) pTPad->GetPad(2); tempPad->Divide(1,2); pTPadSubs[1]=(TPad*) tempPad->GetPad(1); pTPadSubs[2]=(TPad*) tempPad->GetPad(2); tempPad=(TPad*) pEPad->GetPad(2); tempPad->Divide(1,2); pEPadSubs[1]=(TPad*) tempPad->GetPad(1); pEPadSubs[2]=(TPad*) tempPad->GetPad(2); tempPad=(TPad*) eEPad->GetPad(2); tempPad->Divide(1,2); eEPadSubs[1]=(TPad*) tempPad->GetPad(1); eEPadSubs[2]=(TPad*) tempPad->GetPad(2); TPad* allBasePads[10]={titlePad,pTPadSubs[0],pTPadSubs[1],pTPadSubs[2],eEPadSubs[0],eEPadSubs[1],eEPadSubs[2],pEPadSubs[0],pEPadSubs[1],pEPadSubs[2]}; for (int i = 1;i< 10;i++) { allBasePads[i]->SetGrid(1,1); allBasePads[i]->SetTickx(1); allBasePads[i]->SetTicky(1); } pTPadSubs[0]->SetMargin(0.13,0.1,.1,0.1); pEPadSubs[0]->SetMargin(0.13,0.1,.1,0.1); eEPadSubs[0]->SetMargin(0.13,0.1,.1,0.1); pTPadSubs[1]->SetMargin(0.1,0.1,.1,0.1); pEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1); eEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1); pTPadSubs[2]->SetMargin(0.1,0.1,.1,0.1); pEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1); eEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1); //Plot pT pTPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_COMP); pTPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_RESID); pTPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_NORMRESID); //Plot eE eEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_COMP); eEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_RESID); eEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_NORMRESID); //Plot pE pEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_COMP); pEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_RESID); pEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_NORMRESID); } else { TPad* allBasePads[4]={titlePad,pTPad,eEPad,pEPad}; for (int i = 1;i< 4;i++) { allBasePads[i]->SetGrid(1,1); allBasePads[i]->SetTickx(1); allBasePads[i]->SetTicky(1); } pTPad->SetMargin(0.13,0.1,.1,0.1); pEPad->SetMargin(0.13,0.1,.1,0.1); eEPad->SetMargin(0.13,0.1,.1,0.1); pTPad->cd(); drawPlot(detType, PLOTVAR_PT,PLOT_COMP); eEPad->cd(); drawPlot(detType, PLOTVAR_EE,PLOT_COMP); pEPad->cd(); drawPlot(detType, PLOTVAR_PE,PLOT_COMP); } mainPad->SetFillColor(kGray); ///Make Title box titlePad->cd(); titlePad->SetFillColor(kGray); TPaveText* titleBox = makeTitleBox( detType); titleBox->Draw(); TString coTypeString; if(detType==DET_EP) { coTypeString="EP"; } else if(detType==DET_EPG) { coTypeString="EPG"; } else if(detType==DET_EPBG) { coTypeString="EPBG"; } TString imagePath=GRAPHS_DIR; imagePath+="layouts/PlotLayout"; if(numMC>0) imagePath+="_MC"; for (int i = 0;i< numMC;i++) { imagePath+=TString("_")+mc[i]->GetName(); } if(numExp>0) imagePath+="_Exp"; for (int i = 0;i< numExp;i++) { imagePath+=TString("_")+exp[i]->GetName(); } imagePath+="_"+coTypeString+"_EPPlots.pdf"; theCanvas->SaveAs(imagePath); delete theCanvas; clearPlotHists(); }
void proc_pileup(const AliVdMMetaData& vdmMetaData, AliVdMScanData& allData, const char* classAC, const char* classAnotC, const char* classCnotA, const std::vector<Double_t>& par0) { typedef std::map<Short_t, TGraphErrors> map_t; // BCID -> TGraphErrors map_t gAnotC, gCnotA; // one-arm/two-arm ratios // (1) fill one-arm/two-arm ratio graphs for all BCIDs for (Int_t iScan=0; iScan<4; ++iScan) { AliVdMTree& vtAND = allData.GetMap(iScan)[classAC]; AliVdMTree& vtAnotC = allData.GetMap(iScan)[classAnotC]; AliVdMTree& vtCnotA = allData.GetMap(iScan)[classCnotA]; vtAND.Zip3([&gAnotC,&gCnotA](const AliVdMTree::DefaultBranchData& d, AliVdMTree::branchMap_t& mapAC, AliVdMTree::branchMap_t& mapAnotC, AliVdMTree::branchMap_t& mapCnotA) { AliVdMTree::ValErr v1 = mapAnotC["rate"]; v1 /= mapAC["rate"]; // v1 /= mapAC["relBkgd"]; v1 *= mapAnotC["relBkgd"]; if (!v1.isInf() && v1.val()) { const Int_t m1 = gAnotC[d.BCID()].GetN(); gAnotC[d.BCID()].SetPoint (m1, mapAC["mu"].val(), v1.val()); gAnotC[d.BCID()].SetPointError(m1, mapAC["mu"].err(), v1.err()); } AliVdMTree::ValErr v2 = mapCnotA["rate"]; v2 /= mapAC["rate"]; // v2 /= mapAC["relBkgd"]; v2 *= mapCnotA["relBkgd"]; if (!v2.isInf() && v2.val()) { const Int_t m2 = gCnotA[d.BCID()].GetN(); gCnotA[d.BCID()].SetPoint (m2, mapAC["mu"].val(), v2.val()); gCnotA[d.BCID()].SetPointError(m2, mapAC["mu"].err(), v2.err()); } }, vtAnotC, vtCnotA); } // (2) fit model AliVdMPileup pileupModel; TString pn = TString::Format("pileup_%s.pdf", classAC); TCanvas *c1 = new TCanvas; c1->SaveAs(pn+"["); const AliTriggerBCMask& bcMask = vdmMetaData.GetTriggerBCMask(); const Int_t nBCs = bcMask.GetNUnmaskedBCs(); TH1 *hPar[5] = { SetAttr(new TH1D("hrA", ";BCID;r_{A}", nBCs,0,nBCs), kRed), SetAttr(new TH1D("hrC", ";BCID;r_{C}", nBCs,0,nBCs), kBlue), SetAttr(new TH1D("hbkgdA", ";BCID;bkgd_{A}", nBCs,0,nBCs), kRed), SetAttr(new TH1D("hbkgdC", ";BCID;bkgd_{C}", nBCs,0,nBCs), kBlue), SetAttr(new TH1D("hChi2NDF", ";BCID;#chi^{2}/n.d.f.", nBCs,0,nBCs), kBlue) }; for (Int_t bc=0, counter=0; bc<3564; ++bc) { if (bcMask.GetMask(bc)) continue; const TString binLabel = TString::Format("%d", bc); for (Int_t i=0; i<5; ++i) hPar[i]->GetXaxis()->SetBinLabel(1+counter, binLabel); c1->Clear(); c1->SetLogx(); c1->SetLogy(); TH1 *hf = c1->DrawFrame(1e-6, 0.01, 0.5, 20); hf->SetTitle(TString::Format("BCID=%d %s;two-arm #mu;one-arm/two-arm", bc, classAC)); pileupModel.DoFit(&gAnotC[bc], &gCnotA[bc], &par0[0]); SetAttr(&gAnotC[bc], kBlue); SetAttr(&gCnotA[bc], kRed); gAnotC[bc].Draw("PE"); gCnotA[bc].Draw("PE"); TF1 *fAnotC = SetAttr(new TF1("fAnotC", &pileupModel, &AliVdMPileup::fcnAnotC, 1e-6, 0.5, 5), kBlue); fAnotC->SetParameters(pileupModel.GetPar()); fAnotC->SetNpx(1000); fAnotC->Draw("same"); TF1 *fCnotA = SetAttr(new TF1("fCnotA", &pileupModel, &AliVdMPileup::fcnCnotA, 1e-6, 0.5, 5), kRed); fCnotA->SetParameters(pileupModel.GetPar()); fCnotA->SetNpx(1000); fCnotA->Draw("same"); TLegend *leg = new TLegend(0.6, 0.75, 0.9, 0.9); leg->AddEntry(&gCnotA[bc], "AnotC/AandC", "PEL"); leg->AddEntry(&gAnotC[bc], "CnotA/AandC", "PEL"); leg->Draw(); TPaveText *pt = new TPaveText(0.6, 0.4, 0.9, 0.7, "NDC NB"); pt->SetFillStyle(0); pt->AddText(TString::Format("#chi^{2}/n.d.f = %.0f/%.0f = %.2f", pileupModel.GetChi2(), pileupModel.GetNDF(), pileupModel.GetChi2()/pileupModel.GetNDF())); { double curval,err, lowlim, uplim; int iuint; TString name; for (Int_t ivar=0; ivar<4; ++ivar) { gMinuit->mnpout(ivar, name, curval, err, lowlim, uplim,iuint); hPar[ivar]->SetBinContent(1+counter, curval); hPar[ivar]->SetBinError(1+counter, err); if (ivar==0) { hf->SetMinimum(0.5*curval); } if (ivar==1) { hf->SetMinimum(TMath::Min(hf->GetMinimum(), 0.5*curval)); } if (ivar < 2) pt->AddText(TString::Format("%s = %.4f#pm%.4f", name.Data(), curval, err)); else pt->AddText(TString::Format("%s = %.1e#pm%.1e", name.Data(), curval, err)); pt->GetLine(1+ivar)->SetTextColor(ivar%2 ? kRed : kBlue); } hPar[4]->SetBinContent(1+counter, pileupModel.GetChi2()/pileupModel.GetNDF()); } pt->Draw(); c1->SaveAs(pn); Printf("%f / %f", pileupModel.GetChi2(), pileupModel.GetNDF()); ++counter; } gStyle->SetOptStat("n"); gStyle->SetOptFit(111); TCanvas *c2 = new TCanvas; for (Int_t i=0; i<4; ++i) { FitPol0(hPar[i])->Draw(); c2->SaveAs(pn); } hPar[4]->SetMinimum(0); hPar[4]->Draw(); c2->SaveAs(pn+")"); }
int main(int argc, char* argv[]) { AmFitter amfitter(argv[1]); const double* results; int count = 0; double x_wdeg[300]; double y_fval[300]; double y_X[300]; int n_blacklist; for(double curr_wdeg = 2.7; curr_wdeg <= 2.7; curr_wdeg += 0.01) { amfitter.set_wdeg(curr_wdeg); for(int i=0;i<N_HSK;i++) { amfitter.set_file_id(i); results = amfitter.findmin(); //amfitter._blacklist[i] = 1; } //amfitter._blacklist[19] = 0; n_blacklist = 0; for(int i=0;i<N_HSK;i++) { n_blacklist += amfitter._blacklist[i]; } cout << n_blacklist << " files blacklisted" << endl; // do final fit accounting for blacklisted files amfitter.set_file_id(-1); results = amfitter.findmin(); x_wdeg[count] = curr_wdeg; y_fval[count] = amfitter.chi_sq_sum(results[0],results[1],results[2],results[3]); y_X[count] = results[1]; cout << ": wdeg = " << curr_wdeg << ": wfval = " << y_fval[count] << ": X = " << y_X[count] << endl; count++; } // make some plot to see if things are well behaved /*TCanvas cfval; TGraph grfval = TGraph(count,x_wdeg,y_fval); grfval.Draw("A*"); cfval.SaveAs("fval.gif"); TCanvas cX; TGraph grX = TGraph(count,x_wdeg,y_X); grX.Draw("A*"); cX.SaveAs("X.gif");*/ cout << endl << "AMBER GALACTIC CALIBRATION FIT RESULTS" << endl << endl; cout << "const B: " << results[0] << endl; cout << "const X: " << results[1] << endl; cout << "noise: " << results[2] << endl; cout << "time shift: " << results[3] << endl; cout << endl; // stuff to write the resulting fit to a .gif //double wdeg = results[0]; //double A = results[1]; double B = results[0]; double X = results[1]; //double C = results[3]; double n = results[2]; double t_shift = results[3]; double val = amfitter.chi_sq_sum(B, X, n, t_shift); cout << "VALUE: " << val << endl; cout << endl; // if we're fitting by hand, this is in effect //wdeg = 2.2; //A = 66.2721; //B = 0.02714; //X = -133.019; //n = 6.89e-10; //t_shift = 1.846; double y1[215]; double y2[215]; double x[215]; for(int i=0;i<215;i++) { y1[i-0] = 10*log10((5.0E8)*(1.38065E-23)*(amfitter.temps_func(amfitter.time_arr[0][i]))/.001); //y2[i] = 10*log((A*exp(amfitter.hsk_func(amfitter.time_arr[0][i])*B+C) - n)/1); y2[i-0] = 10*log10( (pow(10,0.1*(amfitter.hsk_func(amfitter.time_arr[0][i]+t_shift)*B+X)) - n)/1); x[i-0] = amfitter.time_arr[0][i] - amfitter.time_arr[0][0]; if( (i>100) && (i<120) ) { cout << x[i-0] << " " << y1[i-0] << " " << y2[i-0] << " " << amfitter.hsk_func(amfitter.time_arr[0][i]) << " " << amfitter.temps_func(amfitter.time_arr[0][i]) << " " << amfitter.time_arr[0][i] << endl; } } TGraph* gr1 = new TGraph(215,x,y1); TGraph* gr2 = new TGraph(215,x,y2); gROOT->SetStyle("Plain"); gStyle->SetTitleBorderSize(1); gStyle->SetFillStyle(1001); gStyle->SetFillColor(kWhite); gStyle->SetLabelSize(0.033,"xyz"); gROOT->ForceStyle(); TCanvas *c = new TCanvas("c1","calib plot",400,300); TPaveText *fitinfo = new TPaveText(0.7,0.7,0.95,0.95,"blNDC"); fitinfo->SetBorderSize(1); fitinfo->SetFillColor(kWhite); stringstream line1; stringstream line2; stringstream line3; stringstream line4; stringstream line5; stringstream line6; line1 << "funcVal: " << val; line2 <<"D: " << B; line3 << "X: " << X; line4 << "noise: " << n; line5 << "time shift: " << t_shift; line6 << "transits used: " << (N_HSK-n_blacklist); fitinfo->AddText(line1.str().c_str()); fitinfo->AddText(line2.str().c_str()); fitinfo->AddText(line3.str().c_str()); fitinfo->AddText(line4.str().c_str()); fitinfo->AddText(line5.str().c_str()); fitinfo->AddText(line6.str().c_str()); // tricky thing to get channel name from filename char chan[5]; for(int i=0; i<5; i++) { if( argv[1][i] != '_' ) { chan[i] = argv[1][i]; } else { chan[i] = '\0'; break; } } string chanstr(chan); string titlestr = chanstr+" MW Plane Calibration"; string plotname = chanstr+"_calib.gif"; // compiler yelled about weird characters here //c->DrawFrame(x[0],-250, x[199], -190); gr1->SetTitle(titlestr.c_str()); gr2->SetTitle(titlestr.c_str()); gr2->SetLineColor(kBlue); gr2->SetLineWidth(2); gr2->GetXaxis()->SetTitle("seconds"); gr2->GetYaxis()->SetTitle("dBm"); gr2->GetXaxis()->CenterTitle(); gr2->GetYaxis()->CenterTitle(); gr2->GetYaxis()->SetTitleOffset(1.2); gr2->GetXaxis()->SetLimits(x[0],x[214]); gr2->Draw("AC"); gr1->SetLineColor(kRed); gr1->SetLineWidth(2); gr1->Draw("C"); fitinfo->Draw(); //gr1->GetYaxis()->SetRange(-250,-150); c->SaveAs(plotname.c_str()); return 0; }
void RooToyMCFit1Bin(const int _bin){ if(_bin<1 || _bin>8){ cout << "Bin number should be between 1 and 8" << endl; return; } stringstream out; out.str(""); out << "toyMC_" << _sigma_over_tau << "_" << _purity << "_" << mistag_rate << ".root"; TFile* file = TFile::Open(out.str().c_str()); TTree* tree = (TTree*)file->Get("ToyTree"); cout << "The tree has been readed from the file " << out.str().c_str() << endl; RooRealVar tau("tau","tau",_tau,"ps"); tau.setConstant(kTRUE); RooRealVar dm("dm","dm",_dm,"ps^{-1}"); dm.setConstant(kTRUE); RooRealVar sin2beta("sin2beta","sin2beta",_sin2beta,-5.,5.); if(constBeta) sin2beta.setConstant(kTRUE); RooRealVar cos2beta("cos2beta","cos2beta",_cos2beta,-5.,5.); if(constBeta) cos2beta.setConstant(kTRUE); RooRealVar dt("dt","#Deltat",-5.,5.,"ps"); RooRealVar avgMisgat("avgMisgat","avgMisgat",mistag_rate,0.0,0.5); if(constMistag) avgMisgat.setConstant(kTRUE); RooRealVar delMisgat("delMisgat","delMisgat",0); delMisgat.setConstant(kTRUE); RooRealVar mu("mu","mu",0); mu.setConstant(kTRUE); RooRealVar moment("moment","moment",0.); moment.setConstant(kTRUE); RooRealVar parity("parity","parity",-1.); parity.setConstant(kTRUE); cout << "Preparing coefficients..." << endl; RooRealVar* K = new RooRealVar("K","K",K8[_bin-1],0.,1.); if(constK) K->setConstant(kTRUE); RooFormulaVar* Kb = new RooFormulaVar("Kb","Kb","1-@0",RooArgList(*K)); RooRealVar* C = new RooRealVar("C","C",_C[_bin-1]); C->setConstant(kTRUE); RooRealVar* S = new RooRealVar("S","S",_S[_bin-1]); S->setConstant(kTRUE); RooFormulaVar* a1 = new RooFormulaVar("a1","a1","-(@0-@1)/(@0+@1)",RooArgList(*K,*Kb)); RooFormulaVar* a1b = new RooFormulaVar("a1b","a1b","(@0-@1)/(@0+@1)",RooArgList(*K,*Kb)); RooFormulaVar* a2 = new RooFormulaVar("a2","a2","(@0-@1)/(@0+@1)",RooArgList(*K,*Kb)); RooFormulaVar* a2b = new RooFormulaVar("a2b","a2b","-(@0-@1)/(@0+@1)",RooArgList(*K,*Kb)); RooFormulaVar* b1 = new RooFormulaVar("b1","b1","2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1);",RooArgList(*K,*Kb,*C,*S,sin2beta,cos2beta)); RooFormulaVar* b1b = new RooFormulaVar("b1b","b1b","2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1);",RooArgList(*K,*Kb,*C,*S,sin2beta,cos2beta)); RooFormulaVar* b2 = new RooFormulaVar("b2","b2","-2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1);",RooArgList(*K,*Kb,*C,*S,sin2beta,cos2beta)); RooFormulaVar* b2b = new RooFormulaVar("b2b","b2b","-2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1);",RooArgList(*K,*Kb,*C,*S,sin2beta,cos2beta)); RooRealVar* dgamma = new RooRealVar("dgamma","dgamma",0.); dgamma->setConstant(kTRUE); RooRealVar* f0 = new RooRealVar("f0","f0",1.); f0->setConstant(kTRUE); RooRealVar* f1 = new RooRealVar("f1","f1",0.); f1->setConstant(kTRUE); RooCategory tag("tag","tag"); tag.defineType("B0",1); tag.defineType("anti-B0",-1); RooCategory bin("bin","bin"); bin.defineType("bin",_bin); bin.defineType("binb",-_bin); RooSuperCategory bintag("bintag","bintag",RooArgSet(bin,tag)); RooDataSet d("data","data",tree,RooArgSet(dt,bin,tag)); cout << "DataSet is ready." << endl; d.Print(); RooRealVar mean("mean","mean",0.,"ps"); mean.setConstant(kTRUE); RooRealVar sigma("sigma","sigma",_sigma_over_tau*_tau,0.,_tau,"ps"); if(constSigma) sigma.setConstant(kTRUE); RooGaussModel rf("rf","rf",dt,mean,sigma); // RooTruthModel rf("rf","rf",dt); RooGaussian rfpdf("rfpdf","rfpdf",dt,mean,sigma); cout << "Preparing PDFs..." << endl; RooBDecay* sigpdf1 = new RooBDecay("sigpdf1","sigpdf1",dt,tau,*dgamma,*f0,*f1,*a1,*b1,dm,rf,RooBDecay::DoubleSided); RooBDecay* sigpdf2 = new RooBDecay("sigpdf2","sigpdf2",dt,tau,*dgamma,*f0,*f1,*a2,*b2,dm,rf,RooBDecay::DoubleSided); RooBDecay* sigpdf1b = new RooBDecay("sigpdf1b","sigpdf1b",dt,tau,*dgamma,*f0,*f1,*a1b,*b1b,dm,rf,RooBDecay::DoubleSided); RooBDecay* sigpdf2b = new RooBDecay("sigpdf2b","sigpdf2b",dt,tau,*dgamma,*f0,*f1,*a2b,*b2b,dm,rf,RooBDecay::DoubleSided); RooRealVar fsig("fsig","fsigs",_purity,0.,1.); if(constFSig) fsig.setConstant(kTRUE); RooAddPdf* PDF1 = new RooAddPdf("PDF1","PDF1",RooArgList(*sigpdf1,rfpdf),RooArgList(fsig)); RooAddPdf* PDF2 = new RooAddPdf("PDF2","PDF2",RooArgList(*sigpdf2,rfpdf),RooArgList(fsig)); RooAddPdf* PDF1b= new RooAddPdf("PDF1b","PDF1b",RooArgList(*sigpdf1b,rfpdf),RooArgList(fsig)); RooAddPdf* PDF2b= new RooAddPdf("PDF2b","PDF2b",RooArgList(*sigpdf2b,rfpdf),RooArgList(fsig)); //Adding mistaging RooAddPdf* pdf1 = new RooAddPdf("pdf1","pdf1",RooArgList(*PDF2,*PDF1),RooArgList(avgMisgat)); RooAddPdf* pdf2 = new RooAddPdf("pdf2","pdf2",RooArgList(*PDF1,*PDF2),RooArgList(avgMisgat)); RooAddPdf* pdf1b= new RooAddPdf("pdf1b","pdf1b",RooArgList(*PDF2b,*PDF1b),RooArgList(avgMisgat)); RooAddPdf* pdf2b= new RooAddPdf("pdf2b","pdf2b",RooArgList(*PDF1b,*PDF2b),RooArgList(avgMisgat)); RooSimultaneous pdf("pdf","pdf",bintag); pdf.addPdf(*pdf1,"{bin;B0}"); pdf.addPdf(*pdf2,"{bin;anti-B0}"); pdf.addPdf(*pdf1b,"{binb;B0}"); pdf.addPdf(*pdf2b,"{binb;anti-B0}"); cout << "Fitting..." << endl; pdf.fitTo(d,Verbose(),Timer()); cout << "Drawing plots." << endl; // Plus bin RooPlot* dtFrame = dt.frame(); // B0 out.str(""); out << "tag == 1 && bin == " << _bin; cout << out.str() << endl; RooDataSet* ds = d.reduce(out.str().c_str()); ds->Print(); ds->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),MarkerColor(kBlue)); bintag = "{bin;B0}"; pdf.plotOn(dtFrame,ProjWData(RooArgSet(),*ds),Slice(bintag),LineColor(kBlue)); double chi2 = dtFrame->chiSquare(); // anti-B0 out.str(""); out << "tag == -1 && bin == " << _bin; cout << out.str() << endl; RooDataSet* dsb = d.reduce(out.str().c_str()); dsb->Print(); dsb->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),MarkerColor(kRed)); bintag = "{bin;anti-B0}"; pdf.plotOn(dtFrame,ProjWData(RooArgSet(),*dsb),Slice(bintag),LineColor(kRed)); double chi2b = dtFrame->chiSquare(); // Canvas out.str(""); out << "#Delta t, toy MC, bin == " << _bin; TCanvas* cm = new TCanvas(out.str().c_str(),out.str().c_str(),600,400); cm->cd(); dtFrame->GetXaxis()->SetTitleSize(0.05); dtFrame->GetXaxis()->SetTitleOffset(0.85); dtFrame->GetXaxis()->SetLabelSize(0.05); dtFrame->GetYaxis()->SetTitleOffset(1.6); TPaveText *pt = new TPaveText(0.7,0.6,0.98,0.99,"brNDC"); pt->SetFillColor(0); pt->SetTextAlign(12); out.str(""); out << "bin = " << _bin; pt->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(B^{0}) = " << chi2; pt->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(#barB^{0}) = " << chi2b; pt->AddText(out.str().c_str()); out.str(""); out << "#sigma/#tau = " << sigma.getVal()/tau.getVal(); pt->AddText(out.str().c_str()); out.str(""); out << "purity = " << _purity; pt->AddText(out.str().c_str()); out.str(""); out << "mistag = " << mistag_rate; pt->AddText(out.str().c_str()); dtFrame->Draw(); pt->Draw(); // Minus bin RooPlot* dtFrameB = dt.frame(); // B0 out.str(""); out << "tag == 1 && bin == " << -_bin; cout << out.str() << endl; RooDataSet* ds2 = d.reduce(out.str().c_str()); ds2->Print(); ds2->plotOn(dtFrameB,DataError(RooAbsData::SumW2),MarkerSize(1),MarkerColor(kBlue)); bintag = "{binb;B0}"; pdf.plotOn(dtFrameB,ProjWData(RooArgSet(),*ds2),Slice(bintag),LineColor(kBlue)); chi2 = dtFrameB->chiSquare(); //anti-B0 out.str(""); out << "tag == -1 && bin == " << -_bin; cout << out.str() << endl; RooDataSet* dsb2 = d.reduce(out.str().c_str()); dsb2->Print(); dsb2->plotOn(dtFrameB,DataError(RooAbsData::SumW2),MarkerSize(1),MarkerColor(kRed)); bintag = "{binb;anti-B0}"; pdf.plotOn(dtFrameB,ProjWData(RooArgSet(),*dsb2),Slice(bintag),LineColor(kRed)); chi2b = dtFrameB->chiSquare(); //Canvas out.str(""); out << "#Delta t, toy MC, bin == " << -_bin; TCanvas* cm2 = new TCanvas(out.str().c_str(),out.str().c_str(),600,400); cm2->cd(); dtFrameB->GetXaxis()->SetTitleSize(0.05); dtFrameB->GetXaxis()->SetTitleOffset(0.85); dtFrameB->GetXaxis()->SetLabelSize(0.05); dtFrameB->GetYaxis()->SetTitleOffset(1.6); TPaveText *ptB = new TPaveText(0.7,0.65,0.98,0.99,"brNDC"); ptB->SetFillColor(0); ptB->SetTextAlign(12); out.str(""); out << "bin = " << -_bin; ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(B^{0}) = " << chi2; ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(#barB^{0}) = " << chi2b; ptB->AddText(out.str().c_str()); out.str(""); out << "#sigma/#tau = " << sigma.getVal()/tau.getVal(); ptB->AddText(out.str().c_str()); out.str(""); out << "purity = " << _purity; ptB->AddText(out.str().c_str()); out.str(""); out << "mistag = " << mistag_rate; ptB->AddText(out.str().c_str()); dtFrameB->Draw(); ptB->Draw(); return; }
void phimuphimet() { //=========Macro generated from canvas: phimuphimet/phimuphimet //========= (Fri Nov 13 11:38:57 2015) by ROOT version6.02/05 TCanvas *phimuphimet = new TCanvas("phimuphimet", "phimuphimet",340,362,700,700); phimuphimet->Range(-0.3926991,-3.745915,3.534292,3.369465); phimuphimet->SetFillColor(0); phimuphimet->SetBorderMode(0); phimuphimet->SetBorderSize(2); phimuphimet->SetLogy(); phimuphimet->SetFrameBorderMode(0); phimuphimet->SetFrameBorderMode(0); THStack *phimuphimet = new THStack(); phimuphimet->SetName("phimuphimet"); phimuphimet->SetTitle("phimuphimet"); TH1F *phimuphimet_stack_18 = new TH1F("phimuphimet_stack_18","phimuphimet",10,0,3.141593); phimuphimet_stack_18->SetMinimum(0.0009238963); phimuphimet_stack_18->SetMaximum(454.9117); phimuphimet_stack_18->SetDirectory(0); phimuphimet_stack_18->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); phimuphimet_stack_18->SetLineColor(ci); phimuphimet_stack_18->GetXaxis()->SetTitle("phimuphimet"); phimuphimet_stack_18->GetXaxis()->SetLabelFont(42); phimuphimet_stack_18->GetXaxis()->SetLabelSize(0.035); phimuphimet_stack_18->GetXaxis()->SetTitleSize(0.035); phimuphimet_stack_18->GetXaxis()->SetTitleFont(42); phimuphimet_stack_18->GetYaxis()->SetTitle("Events/pb"); phimuphimet_stack_18->GetYaxis()->SetLabelFont(42); phimuphimet_stack_18->GetYaxis()->SetLabelSize(0.035); phimuphimet_stack_18->GetYaxis()->SetTitleSize(0.035); phimuphimet_stack_18->GetYaxis()->SetTitleFont(42); phimuphimet_stack_18->GetZaxis()->SetLabelFont(42); phimuphimet_stack_18->GetZaxis()->SetLabelSize(0.035); phimuphimet_stack_18->GetZaxis()->SetTitleSize(0.035); phimuphimet_stack_18->GetZaxis()->SetTitleFont(42); phimuphimet->SetHistogram(phimuphimet_stack_18); TH1D *phimuphimet86 = new TH1D("phimuphimet86"," #Delta_{#phi}[#mu,MET]",10,0,3.141593); phimuphimet86->SetBinContent(1,230.641); phimuphimet86->SetBinContent(2,216.3046); phimuphimet86->SetBinContent(3,223.2529); phimuphimet86->SetBinContent(4,205.0752); phimuphimet86->SetBinContent(5,177.4887); phimuphimet86->SetBinContent(6,185.6797); phimuphimet86->SetBinContent(7,165.8596); phimuphimet86->SetBinContent(8,166.2099); phimuphimet86->SetBinContent(9,159.2644); phimuphimet86->SetBinContent(10,174.5095); phimuphimet86->SetBinError(1,8.61142); phimuphimet86->SetBinError(2,8.327371); phimuphimet86->SetBinError(3,8.486581); phimuphimet86->SetBinError(4,8.129407); phimuphimet86->SetBinError(5,7.536633); phimuphimet86->SetBinError(6,7.726982); phimuphimet86->SetBinError(7,7.294678); phimuphimet86->SetBinError(8,7.302349); phimuphimet86->SetBinError(9,7.154931); phimuphimet86->SetBinError(10,7.4987); phimuphimet86->SetEntries(17572); ci = TColor::GetColor("#00cc00"); phimuphimet86->SetFillColor(ci); ci = TColor::GetColor("#00cc00"); phimuphimet86->SetLineColor(ci); ci = TColor::GetColor("#00cc00"); phimuphimet86->SetMarkerColor(ci); phimuphimet86->SetMarkerStyle(22); phimuphimet86->GetXaxis()->SetTitle("phimuphimet"); phimuphimet86->GetXaxis()->SetLabelFont(42); phimuphimet86->GetXaxis()->SetLabelSize(0.035); phimuphimet86->GetXaxis()->SetTitleSize(0.035); phimuphimet86->GetXaxis()->SetTitleFont(42); phimuphimet86->GetYaxis()->SetTitle("Events/pb"); phimuphimet86->GetYaxis()->SetLabelFont(42); phimuphimet86->GetYaxis()->SetLabelSize(0.035); phimuphimet86->GetYaxis()->SetTitleSize(0.035); phimuphimet86->GetYaxis()->SetTitleFont(42); phimuphimet86->GetZaxis()->SetLabelFont(42); phimuphimet86->GetZaxis()->SetLabelSize(0.035); phimuphimet86->GetZaxis()->SetTitleSize(0.035); phimuphimet86->GetZaxis()->SetTitleFont(42); phimuphimet->Add(phimuphimet,""); TH1D *phimuphimet87 = new TH1D("phimuphimet87"," #Delta_{#phi}[#mu,MET]",10,0,3.141593); phimuphimet87->SetBinContent(1,6.11516); phimuphimet87->SetBinContent(2,5.535954); phimuphimet87->SetBinContent(3,5.331195); phimuphimet87->SetBinContent(4,5.298494); phimuphimet87->SetBinContent(5,5.612855); phimuphimet87->SetBinContent(6,5.975299); phimuphimet87->SetBinContent(7,6.323196); phimuphimet87->SetBinContent(8,6.999136); phimuphimet87->SetBinContent(9,7.03292); phimuphimet87->SetBinContent(10,7.011011); phimuphimet87->SetBinError(1,0.06763086); phimuphimet87->SetBinError(2,0.06433893); phimuphimet87->SetBinError(3,0.06348647); phimuphimet87->SetBinError(4,0.06307663); phimuphimet87->SetBinError(5,0.06520844); phimuphimet87->SetBinError(6,0.06748244); phimuphimet87->SetBinError(7,0.06973671); phimuphimet87->SetBinError(8,0.07416886); phimuphimet87->SetBinError(9,0.07436969); phimuphimet87->SetBinError(10,0.07420837); phimuphimet87->SetEntries(277262); ci = TColor::GetColor("#00ffff"); phimuphimet87->SetFillColor(ci); ci = TColor::GetColor("#00ffff"); phimuphimet87->SetLineColor(ci); ci = TColor::GetColor("#00ffff"); phimuphimet87->SetMarkerColor(ci); phimuphimet87->SetMarkerStyle(20); phimuphimet87->GetXaxis()->SetTitle("phimuphimet"); phimuphimet87->GetXaxis()->SetLabelFont(42); phimuphimet87->GetXaxis()->SetLabelSize(0.035); phimuphimet87->GetXaxis()->SetTitleSize(0.035); phimuphimet87->GetXaxis()->SetTitleFont(42); phimuphimet87->GetYaxis()->SetTitle("Events/pb"); phimuphimet87->GetYaxis()->SetLabelFont(42); phimuphimet87->GetYaxis()->SetLabelSize(0.035); phimuphimet87->GetYaxis()->SetTitleSize(0.035); phimuphimet87->GetYaxis()->SetTitleFont(42); phimuphimet87->GetZaxis()->SetLabelFont(42); phimuphimet87->GetZaxis()->SetLabelSize(0.035); phimuphimet87->GetZaxis()->SetTitleSize(0.035); phimuphimet87->GetZaxis()->SetTitleFont(42); phimuphimet->Add(phimuphimet,""); TH1D *phimuphimet88 = new TH1D("phimuphimet88"," #Delta_{#phi}[#mu,MET]",10,0,3.141593); phimuphimet88->SetBinContent(1,0.1344125); phimuphimet88->SetBinContent(2,0.132705); phimuphimet88->SetBinContent(3,0.1303004); phimuphimet88->SetBinContent(4,0.1480002); phimuphimet88->SetBinContent(5,0.1484594); phimuphimet88->SetBinContent(6,0.1440116); phimuphimet88->SetBinContent(7,0.1488838); phimuphimet88->SetBinContent(8,0.1551468); phimuphimet88->SetBinContent(9,0.1613277); phimuphimet88->SetBinContent(10,0.1643883); phimuphimet88->SetBinError(1,0.003182629); phimuphimet88->SetBinError(2,0.003158543); phimuphimet88->SetBinError(3,0.003130767); phimuphimet88->SetBinError(4,0.003374797); phimuphimet88->SetBinError(5,0.003387715); phimuphimet88->SetBinError(6,0.003328977); phimuphimet88->SetBinError(7,0.003366558); phimuphimet88->SetBinError(8,0.003466203); phimuphimet88->SetBinError(9,0.003519969); phimuphimet88->SetBinError(10,0.003565516); phimuphimet88->SetEntries(46443); ci = TColor::GetColor("#ffcc00"); phimuphimet88->SetFillColor(ci); ci = TColor::GetColor("#ffcc00"); phimuphimet88->SetLineColor(ci); ci = TColor::GetColor("#ffcc00"); phimuphimet88->SetMarkerColor(ci); phimuphimet88->SetMarkerStyle(21); phimuphimet88->GetXaxis()->SetTitle("phimuphimet"); phimuphimet88->GetXaxis()->SetLabelFont(42); phimuphimet88->GetXaxis()->SetLabelSize(0.035); phimuphimet88->GetXaxis()->SetTitleSize(0.035); phimuphimet88->GetXaxis()->SetTitleFont(42); phimuphimet88->GetYaxis()->SetTitle("Events/pb"); phimuphimet88->GetYaxis()->SetLabelFont(42); phimuphimet88->GetYaxis()->SetLabelSize(0.035); phimuphimet88->GetYaxis()->SetTitleSize(0.035); phimuphimet88->GetYaxis()->SetTitleFont(42); phimuphimet88->GetZaxis()->SetLabelFont(42); phimuphimet88->GetZaxis()->SetLabelSize(0.035); phimuphimet88->GetZaxis()->SetTitleSize(0.035); phimuphimet88->GetZaxis()->SetTitleFont(42); phimuphimet->Add(phimuphimet,""); TH1D *phimuphimet89 = new TH1D("phimuphimet89"," #Delta_{#phi}[#mu,MET]",10,0,3.141593); phimuphimet89->SetBinContent(1,0.02346078); phimuphimet89->SetBinContent(2,0.02244276); phimuphimet89->SetBinContent(3,0.02157898); phimuphimet89->SetBinContent(4,0.01833982); phimuphimet89->SetBinContent(5,0.01554797); phimuphimet89->SetBinContent(6,0.01431401); phimuphimet89->SetBinContent(7,0.01304919); phimuphimet89->SetBinContent(8,0.0118615); phimuphimet89->SetBinContent(9,0.01159928); phimuphimet89->SetBinContent(10,0.01039616); phimuphimet89->SetBinError(1,0.0006015585); phimuphimet89->SetBinError(2,0.0005883622); phimuphimet89->SetBinError(3,0.0005769286); phimuphimet89->SetBinError(4,0.0005318684); phimuphimet89->SetBinError(5,0.0004897151); phimuphimet89->SetBinError(6,0.0004698803); phimuphimet89->SetBinError(7,0.0004486404); phimuphimet89->SetBinError(8,0.0004277366); phimuphimet89->SetBinError(9,0.0004229823); phimuphimet89->SetBinError(10,0.0004004453); phimuphimet89->SetEntries(10541); ci = TColor::GetColor("#ff0000"); phimuphimet89->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); phimuphimet89->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); phimuphimet89->SetMarkerColor(ci); phimuphimet89->SetMarkerStyle(20); phimuphimet89->GetXaxis()->SetTitle("phimuphimet"); phimuphimet89->GetXaxis()->SetLabelFont(42); phimuphimet89->GetXaxis()->SetLabelSize(0.035); phimuphimet89->GetXaxis()->SetTitleSize(0.035); phimuphimet89->GetXaxis()->SetTitleFont(42); phimuphimet89->GetYaxis()->SetTitle("Events/pb"); phimuphimet89->GetYaxis()->SetLabelFont(42); phimuphimet89->GetYaxis()->SetLabelSize(0.035); phimuphimet89->GetYaxis()->SetTitleSize(0.035); phimuphimet89->GetYaxis()->SetTitleFont(42); phimuphimet89->GetZaxis()->SetLabelFont(42); phimuphimet89->GetZaxis()->SetLabelSize(0.035); phimuphimet89->GetZaxis()->SetTitleSize(0.035); phimuphimet89->GetZaxis()->SetTitleFont(42); phimuphimet->Add(phimuphimet,""); TH1D *phimuphimet90 = new TH1D("phimuphimet90"," #Delta_{#phi}[#mu,MET]",10,0,3.141593); phimuphimet90->SetBinContent(1,0.005199211); phimuphimet90->SetBinContent(2,0.004561888); phimuphimet90->SetBinContent(3,0.004595431); phimuphimet90->SetBinContent(4,0.00447803); phimuphimet90->SetBinContent(5,0.004159369); phimuphimet90->SetBinContent(6,0.003891022); phimuphimet90->SetBinContent(7,0.004394172); phimuphimet90->SetBinContent(8,0.003907794); phimuphimet90->SetBinContent(9,0.00407551); phimuphimet90->SetBinContent(10,0.003522046); phimuphimet90->SetBinError(1,0.0002952953); phimuphimet90->SetBinError(2,0.0002766051); phimuphimet90->SetBinError(3,0.0002776202); phimuphimet90->SetBinError(4,0.000274051); phimuphimet90->SetBinError(5,0.0002641202); phimuphimet90->SetBinError(6,0.0002554581); phimuphimet90->SetBinError(7,0.0002714728); phimuphimet90->SetBinError(8,0.0002560081); phimuphimet90->SetBinError(9,0.0002614441); phimuphimet90->SetBinError(10,0.0002430443); phimuphimet90->SetEntries(2551); ci = TColor::GetColor("#0000ff"); phimuphimet90->SetFillColor(ci); ci = TColor::GetColor("#0000ff"); phimuphimet90->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); phimuphimet90->SetMarkerColor(ci); phimuphimet90->SetMarkerStyle(21); phimuphimet90->GetXaxis()->SetTitle("phimuphimet"); phimuphimet90->GetXaxis()->SetLabelFont(42); phimuphimet90->GetXaxis()->SetLabelSize(0.035); phimuphimet90->GetXaxis()->SetTitleSize(0.035); phimuphimet90->GetXaxis()->SetTitleFont(42); phimuphimet90->GetYaxis()->SetTitle("Events/pb"); phimuphimet90->GetYaxis()->SetLabelFont(42); phimuphimet90->GetYaxis()->SetLabelSize(0.035); phimuphimet90->GetYaxis()->SetTitleSize(0.035); phimuphimet90->GetYaxis()->SetTitleFont(42); phimuphimet90->GetZaxis()->SetLabelFont(42); phimuphimet90->GetZaxis()->SetLabelSize(0.035); phimuphimet90->GetZaxis()->SetTitleSize(0.035); phimuphimet90->GetZaxis()->SetTitleFont(42); phimuphimet->Add(phimuphimet,""); phimuphimet->Draw("nostack"); TPaveText *pt = new TPaveText(0.3326724,0.9342857,0.6673276,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("phimuphimet"); pt->Draw(); TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextSize(0.034965); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("phimuphimet","phimuphimet_QCD","lp"); ci = TColor::GetColor("#00cc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00cc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(22); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimuphimet","phimuphimet_WJetsToLNu","lp"); ci = TColor::GetColor("#00ffff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00ffff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimuphimet","phimuphimet_ZJetsToNuNu","lp"); ci = TColor::GetColor("#ffcc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ffcc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimuphimet","phimuphimet_signal","lp"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ff0000"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("phimuphimet","phimuphimet_ttbar","lp"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#0000ff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); phimuphimet->Modified(); phimuphimet->cd(); phimuphimet->SetSelected(phimuphimet); }
void hmt() { //=========Macro generated from canvas: hmt/hmt //========= (Mon Nov 23 11:05:05 2015) by ROOT version6.02/05 TCanvas *hmt = new TCanvas("hmt", "hmt",220,242,700,700); hmt->Range(-25,-7.557249,225,5.510816); hmt->SetFillColor(0); hmt->SetBorderMode(0); hmt->SetBorderSize(2); hmt->SetLogy(); hmt->SetFrameBorderMode(0); hmt->SetFrameBorderMode(0); THStack *hmt = new THStack(); hmt->SetName("hmt"); hmt->SetTitle("hmt"); TH1F *hmt_stack_12 = new TH1F("hmt_stack_12","hmt",8,0,200); hmt_stack_12->SetMinimum(5.617689e-07); hmt_stack_12->SetMaximum(15995.94); hmt_stack_12->SetDirectory(0); hmt_stack_12->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); hmt_stack_12->SetLineColor(ci); hmt_stack_12->GetXaxis()->SetTitle("hmt"); hmt_stack_12->GetXaxis()->SetLabelFont(42); hmt_stack_12->GetXaxis()->SetLabelSize(0.035); hmt_stack_12->GetXaxis()->SetTitleSize(0.035); hmt_stack_12->GetXaxis()->SetTitleFont(42); hmt_stack_12->GetYaxis()->SetTitle("Events/pb"); hmt_stack_12->GetYaxis()->SetLabelFont(42); hmt_stack_12->GetYaxis()->SetLabelSize(0.035); hmt_stack_12->GetYaxis()->SetTitleSize(0.035); hmt_stack_12->GetYaxis()->SetTitleFont(42); hmt_stack_12->GetZaxis()->SetLabelFont(42); hmt_stack_12->GetZaxis()->SetLabelSize(0.035); hmt_stack_12->GetZaxis()->SetTitleSize(0.035); hmt_stack_12->GetZaxis()->SetTitleFont(42); hmt->SetHistogram(hmt_stack_12); TH1D *hmt56 = new TH1D("hmt56"," Transverse mass",8,0,200); hmt56->SetBinContent(1,5612.801); hmt56->SetBinContent(2,96.67354); hmt56->SetBinContent(3,1.843083); hmt56->SetBinContent(4,0.00068069); hmt56->SetBinError(1,42.85727); hmt56->SetBinError(2,5.590091); hmt56->SetBinError(3,0.7489465); hmt56->SetBinError(4,0.00068069); hmt56->SetEntries(35032); ci = TColor::GetColor("#00cc00"); hmt56->SetFillColor(ci); ci = TColor::GetColor("#00cc00"); hmt56->SetLineColor(ci); ci = TColor::GetColor("#00cc00"); hmt56->SetMarkerColor(ci); hmt56->SetMarkerStyle(22); hmt56->GetXaxis()->SetTitle("hmt"); hmt56->GetXaxis()->SetLabelFont(42); hmt56->GetXaxis()->SetLabelSize(0.035); hmt56->GetXaxis()->SetTitleSize(0.035); hmt56->GetXaxis()->SetTitleFont(42); hmt56->GetYaxis()->SetTitle("Events/pb"); hmt56->GetYaxis()->SetLabelFont(42); hmt56->GetYaxis()->SetLabelSize(0.035); hmt56->GetYaxis()->SetTitleSize(0.035); hmt56->GetYaxis()->SetTitleFont(42); hmt56->GetZaxis()->SetLabelFont(42); hmt56->GetZaxis()->SetLabelSize(0.035); hmt56->GetZaxis()->SetTitleSize(0.035); hmt56->GetZaxis()->SetTitleFont(42); hmt->Add(hmt,""); TH1D *hmt57 = new TH1D("hmt57"," Transverse mass",8,0,200); hmt57->SetBinContent(1,20.71688); hmt57->SetBinContent(2,9.067683); hmt57->SetBinContent(3,5.102584); hmt57->SetBinContent(4,1.066239); hmt57->SetBinContent(5,0.004897312); hmt57->SetBinContent(6,8.681582e-05); hmt57->SetBinContent(7,2.866842e-05); hmt57->SetBinError(1,0.1278328); hmt57->SetBinError(2,0.08350833); hmt57->SetBinError(3,0.06062541); hmt57->SetBinError(4,0.025646); hmt57->SetBinError(5,0.001471335); hmt57->SetBinError(6,3.545477e-05); hmt57->SetBinError(7,2.027973e-05); hmt57->SetEntries(136801); ci = TColor::GetColor("#00ffff"); hmt57->SetFillColor(ci); ci = TColor::GetColor("#00ffff"); hmt57->SetLineColor(ci); ci = TColor::GetColor("#00ffff"); hmt57->SetMarkerColor(ci); hmt57->SetMarkerStyle(20); hmt57->GetXaxis()->SetTitle("hmt"); hmt57->GetXaxis()->SetLabelFont(42); hmt57->GetXaxis()->SetLabelSize(0.035); hmt57->GetXaxis()->SetTitleSize(0.035); hmt57->GetXaxis()->SetTitleFont(42); hmt57->GetYaxis()->SetTitle("Events/pb"); hmt57->GetYaxis()->SetLabelFont(42); hmt57->GetYaxis()->SetLabelSize(0.035); hmt57->GetYaxis()->SetTitleSize(0.035); hmt57->GetYaxis()->SetTitleFont(42); hmt57->GetZaxis()->SetLabelFont(42); hmt57->GetZaxis()->SetLabelSize(0.035); hmt57->GetZaxis()->SetTitleSize(0.035); hmt57->GetZaxis()->SetTitleFont(42); hmt->Add(hmt,""); TH1D *hmt58 = new TH1D("hmt58"," Transverse mass",8,0,200); hmt58->SetBinContent(1,4.450283); hmt58->SetBinContent(2,0.4423873); hmt58->SetBinContent(3,0.0414851); hmt58->SetBinContent(4,0.005226811); hmt58->SetBinContent(5,0.0005983346); hmt58->SetBinContent(6,4.854534e-05); hmt58->SetBinContent(7,4.681207e-06); hmt58->SetBinContent(8,3.510905e-06); hmt58->SetBinContent(9,2.340604e-06); hmt58->SetBinError(1,0.01852365); hmt58->SetBinError(2,0.005347213); hmt58->SetBinError(3,0.001581388); hmt58->SetBinError(4,0.000472027); hmt58->SetBinError(5,0.000107885); hmt58->SetBinError(6,1.091083e-05); hmt58->SetBinError(7,2.340604e-06); hmt58->SetBinError(8,2.027022e-06); hmt58->SetBinError(9,1.655057e-06); hmt58->SetEntries(131338); ci = TColor::GetColor("#ffcc00"); hmt58->SetFillColor(ci); ci = TColor::GetColor("#ffcc00"); hmt58->SetLineColor(ci); ci = TColor::GetColor("#ffcc00"); hmt58->SetMarkerColor(ci); hmt58->SetMarkerStyle(21); hmt58->GetXaxis()->SetTitle("hmt"); hmt58->GetXaxis()->SetLabelFont(42); hmt58->GetXaxis()->SetLabelSize(0.035); hmt58->GetXaxis()->SetTitleSize(0.035); hmt58->GetXaxis()->SetTitleFont(42); hmt58->GetYaxis()->SetTitle("Events/pb"); hmt58->GetYaxis()->SetLabelFont(42); hmt58->GetYaxis()->SetLabelSize(0.035); hmt58->GetYaxis()->SetTitleSize(0.035); hmt58->GetYaxis()->SetTitleFont(42); hmt58->GetZaxis()->SetLabelFont(42); hmt58->GetZaxis()->SetLabelSize(0.035); hmt58->GetZaxis()->SetTitleSize(0.035); hmt58->GetZaxis()->SetTitleFont(42); hmt->Add(hmt,""); TH1D *hmt59 = new TH1D("hmt59"," Transverse mass",8,0,200); hmt59->SetBinContent(1,0.03415001); hmt59->SetBinContent(2,0.02037586); hmt59->SetBinContent(3,0.007434646); hmt59->SetBinContent(4,0.001881798); hmt59->SetBinContent(5,0.0003547652); hmt59->SetBinContent(6,3.084915e-05); hmt59->SetBinError(1,0.0007257751); hmt59->SetBinError(2,0.0005606149); hmt59->SetBinError(3,0.0003386388); hmt59->SetBinError(4,0.00017037); hmt59->SetBinError(5,7.397367e-05); hmt59->SetBinError(6,2.181364e-05); hmt59->SetEntries(4164); ci = TColor::GetColor("#ff0000"); hmt59->SetFillColor(ci); ci = TColor::GetColor("#ff0000"); hmt59->SetLineColor(ci); ci = TColor::GetColor("#ff0000"); hmt59->SetMarkerColor(ci); hmt59->SetMarkerStyle(20); hmt59->GetXaxis()->SetTitle("hmt"); hmt59->GetXaxis()->SetLabelFont(42); hmt59->GetXaxis()->SetLabelSize(0.035); hmt59->GetXaxis()->SetTitleSize(0.035); hmt59->GetXaxis()->SetTitleFont(42); hmt59->GetYaxis()->SetTitle("Events/pb"); hmt59->GetYaxis()->SetLabelFont(42); hmt59->GetYaxis()->SetLabelSize(0.035); hmt59->GetYaxis()->SetTitleSize(0.035); hmt59->GetYaxis()->SetTitleFont(42); hmt59->GetZaxis()->SetLabelFont(42); hmt59->GetZaxis()->SetLabelSize(0.035); hmt59->GetZaxis()->SetTitleSize(0.035); hmt59->GetZaxis()->SetTitleFont(42); hmt->Add(hmt,""); TH1D *hmt60 = new TH1D("hmt60"," Transverse mass",8,0,200); hmt60->SetBinContent(1,0.0006037793); hmt60->SetBinContent(2,0.0002683464); hmt60->SetBinContent(3,0.0001341732); hmt60->SetBinContent(4,1.677165e-05); hmt60->SetBinError(1,0.0001006299); hmt60->SetBinError(2,6.708659e-05); hmt60->SetBinError(3,4.743738e-05); hmt60->SetBinError(4,1.677165e-05); hmt60->SetEntries(61); ci = TColor::GetColor("#0000ff"); hmt60->SetFillColor(ci); ci = TColor::GetColor("#0000ff"); hmt60->SetLineColor(ci); ci = TColor::GetColor("#0000ff"); hmt60->SetMarkerColor(ci); hmt60->SetMarkerStyle(21); hmt60->GetXaxis()->SetTitle("hmt"); hmt60->GetXaxis()->SetLabelFont(42); hmt60->GetXaxis()->SetLabelSize(0.035); hmt60->GetXaxis()->SetTitleSize(0.035); hmt60->GetXaxis()->SetTitleFont(42); hmt60->GetYaxis()->SetTitle("Events/pb"); hmt60->GetYaxis()->SetLabelFont(42); hmt60->GetYaxis()->SetLabelSize(0.035); hmt60->GetYaxis()->SetTitleSize(0.035); hmt60->GetYaxis()->SetTitleFont(42); hmt60->GetZaxis()->SetLabelFont(42); hmt60->GetZaxis()->SetLabelSize(0.035); hmt60->GetZaxis()->SetTitleSize(0.035); hmt60->GetZaxis()->SetTitleFont(42); hmt->Add(hmt,""); hmt->Draw("nostack"); TPaveText *pt = new TPaveText(0.444023,0.94,0.555977,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("hmt"); pt->Draw(); TLegend *leg = new TLegend(0.54023,0.639881,0.938218,0.924107,NULL,"brNDC"); leg->SetBorderSize(1); leg->SetTextSize(0.034965); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("hmt","hmt_QCD","lp"); ci = TColor::GetColor("#00cc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00cc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(22); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("hmt","hmt_WJetsToLNu","lp"); ci = TColor::GetColor("#00ffff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#00ffff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("hmt","hmt_ZJetsToNuNu","lp"); ci = TColor::GetColor("#ffcc00"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ffcc00"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("hmt","hmt_signal","lp"); ci = TColor::GetColor("#ff0000"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#ff0000"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(20); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("hmt","hmt_ttbar","lp"); ci = TColor::GetColor("#0000ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#0000ff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); hmt->Modified(); hmt->cd(); hmt->SetSelected(hmt); }
void HTT_EE_X(bool scaled=true, bool log=true, float min=0.1, float max=-1., string inputfile="root/$HISTFILE", const char* directory="ee_$CATEGORY") { // define common canvas, axes pad styles SetStyle(); gStyle->SetLineStyleString(11,"20 10"); // determine category tag const char* category = ""; const char* category_extra = ""; const char* category_extra2 = ""; if(std::string(directory) == std::string("ee_0jet_low" )){ category = "ee, 0 jet"; } if(std::string(directory) == std::string("ee_0jet_low" )){ category_extra = "p_{T}(lep1) low"; } if(std::string(directory) == std::string("ee_0jet_high" )){ category = "ee, 0 jet"; } if(std::string(directory) == std::string("ee_0jet_high" )){ category_extra = "p_{T}(lep1) high"; } if(std::string(directory) == std::string("ee_1jet_low" )){ category = "ee, 1 jet"; } if(std::string(directory) == std::string("ee_1jet_low" )){ category_extra = "p_{T}(lep1) low"; } if(std::string(directory) == std::string("ee_1jet_high" )){ category = "ee, 1 jet"; } if(std::string(directory) == std::string("ee_1jet_high" )){ category_extra = "p_{T}(lep1) high"; } if(std::string(directory) == std::string("ee_vbf" )){ category = "ee, 2 jet"; } if(std::string(directory) == std::string("ee_vbf" )){ category_extra = "VBF"; } if(std::string(directory) == std::string("ee_nobtag" )){ category = "ee"; } if(std::string(directory) == std::string("ee_nobtag" )){ category_extra = "No B-Tag"; } if(std::string(directory) == std::string("ee_btag" )){ category = "ee"; } if(std::string(directory) == std::string("ee_btag" )){ category_extra = "B-Tag"; } const char* dataset; if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 4.9 fb^{-1} at 7 TeV";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 19.8 fb^{-1} at 8 TeV";} TFile* input = new TFile(inputfile.c_str()); #ifdef MSSM TFile* input2 = new TFile((inputfile+"_$MA_$TANB").c_str()); #endif TH1F* ZTT = refill((TH1F*)input ->Get(TString::Format("%s/ZTT" , directory)), "ZTT" ); InitHist(ZTT , "", "", kOrange - 4, 1001); TH1F* ZEE = refill((TH1F*)input ->Get(TString::Format("%s/ZEE" , directory)), "ZEE" ); InitHist(ZEE , "", "", kAzure + 2, 1001); TH1F* TTJ = refill((TH1F*)input ->Get(TString::Format("%s/TTJ" , directory)), "TTJ" ); InitHist(TTJ , "", "", kBlue - 8, 1001); TH1F* QCD = refill((TH1F*)input ->Get(TString::Format("%s/QCD" , directory)), "QCD" ); InitHist(QCD , "", "", kMagenta - 10, 1001); TH1F* Dibosons= refill((TH1F*)input ->Get(TString::Format("%s/Dibosons", directory)), "Dibosons"); InitHist(Dibosons, "", "", kGreen - 4, 1001); TH1F* WJets = refill((TH1F*)input ->Get(TString::Format("%s/WJets" , directory)), "WJets" ); InitHist(WJets , "", "", kRed + 2, 1001); #ifdef MSSM TH1F* ggH = refill((TH1F*)input2->Get(TString::Format("%s/ggH$MA" , directory)), "ggH" ); InitSignal(ggH); ggH->Scale($TANB); TH1F* bbH = refill((TH1F*)input2->Get(TString::Format("%s/bbH$MA" , directory)), "bbH" ); InitSignal(bbH); bbH->Scale($TANB); #else #ifndef DROP_SIGNAL TH1F* ggH = refill((TH1F*)input ->Get(TString::Format("%s/ggH125" , directory)), "ggH" ); InitSignal(ggH); ggH->Scale(SIGNAL_SCALE); TH1F* qqH = refill((TH1F*)input ->Get(TString::Format("%s/qqH125" , directory)), "qqH" ); InitSignal(qqH); qqH->Scale(SIGNAL_SCALE); TH1F* VH = refill((TH1F*)input ->Get(TString::Format("%s/VH125" , directory)), "VH" ); InitSignal(VH ); VH ->Scale(SIGNAL_SCALE); #endif #endif #ifdef ASIMOV TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs_asimov", directory)), "data", true); #else TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs", directory)), "data", true); #endif #ifdef MSSM InitHist(data, "#bf{m_{#tau#tau} [GeV]}" , "#bf{dN/dm_{#tau#tau} [1/GeV]}"); InitData(data); #else InitHist(data, "#bf{D}", "#bf{dN/dD}" ); InitData(data); #endif TH1F* ref=(TH1F*)ZTT->Clone("ref"); ref->Add(ZEE); ref->Add(TTJ); ref->Add(QCD); ref->Add(Dibosons); ref->Add(WJets); double unscaled[9]; unscaled[0] = ZTT->Integral(); unscaled[1] = ZEE->Integral(); unscaled[2] = TTJ->Integral(); unscaled[3] = QCD->Integral(); unscaled[4] = Dibosons->Integral(); unscaled[5] = WJets->Integral(); #ifdef MSSM unscaled[6] = ggH->Integral(); unscaled[7] = bbH->Integral(); unscaled[8] = 0; #else #ifndef DROP_SIGNAL unscaled[6] = ggH->Integral(); unscaled[7] = qqH->Integral(); unscaled[8] = VH ->Integral(); #endif #endif if(scaled){ rescale(ZTT, 1); rescale(ZEE, 2); rescale(TTJ, 3); rescale(QCD, 4); rescale(Dibosons, 5); rescale(WJets, 6); #ifdef MSSM rescale(ggH, 7); rescale(bbH, 8); #else #ifndef DROP_SIGNAL rescale(ggH, 7); rescale(qqH, 8); rescale(VH, 9); #endif #endif } TH1F* scales[9]; scales[0] = new TH1F("scales-ZTT", "", 9, 0, 9); scales[0]->SetBinContent(1, unscaled[0]>0 ? (ZTT->Integral()/unscaled[0]-1.) : 0.); scales[1] = new TH1F("scales-ZEE" , "", 9, 0, 9); scales[1]->SetBinContent(2, unscaled[1]>0 ? (ZEE->Integral()/unscaled[1]-1.) : 0.); scales[2] = new TH1F("scales-TTJ", "", 9, 0, 9); scales[2]->SetBinContent(3, unscaled[2]>0 ? (TTJ->Integral()/unscaled[2]-1.) : 0.); scales[3] = new TH1F("scales-QCD" , "", 9, 0, 9); scales[3]->SetBinContent(4, unscaled[3]>0 ? (QCD->Integral()/unscaled[3]-1.) : 0.); scales[4] = new TH1F("scales-Dibosons", "", 9, 0, 9); scales[4]->SetBinContent(5, unscaled[4]>0 ? (Dibosons->Integral()/unscaled[4]-1.) : 0.); scales[5] = new TH1F("scales-WJets" , "", 9, 0, 9); scales[5]->SetBinContent(6, unscaled[5]>0 ? (WJets->Integral()/unscaled[5]-1.) : 0.); #ifdef MSSM scales[6] = new TH1F("scales-ggH" , "", 9, 0, 9); scales[6]->SetBinContent(7, unscaled[6]>0 ? (ggH->Integral()/unscaled[6]-1.) : 0.); scales[7] = new TH1F("scales-bbH" , "", 9, 0, 9); scales[7]->SetBinContent(8, unscaled[7]>0 ? (bbH->Integral()/unscaled[7]-1.) : 0.); scales[8] = new TH1F("scales-NONE" , "", 9, 0, 9); scales[8]->SetBinContent(9, 0.); #else #ifndef DROP_SIGNAL scales[6] = new TH1F("scales-ggH" , "", 9, 0, 9); scales[6]->SetBinContent(7, unscaled[6]>0 ? (ggH->Integral()/unscaled[4]-1.) : 0.); scales[7] = new TH1F("scales-qqH" , "", 9, 0, 9); scales[7]->SetBinContent(8, unscaled[7]>0 ? (qqH->Integral()/unscaled[5]-1.) : 0.); scales[8] = new TH1F("scales-VH" , "", 9, 0, 9); scales[8]->SetBinContent(9, unscaled[8]>0 ? (VH ->Integral()/unscaled[6]-1.) : 0.); #endif #endif WJets->Add(Dibosons); QCD->Add(WJets); TTJ->Add(QCD); ZTT->Add(TTJ); ZEE->Add(ZTT); if(log){ #ifdef MSSM ggH ->Add(bbH); #else #ifndef DROP_SIGNAL qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } else{ #ifdef MSSM bbH ->Add(WJets); ggH ->Add(bbH); #else #ifndef DROP_SIGNAL VH ->Add(WJets); qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } /* mass plot before and after fit */ TCanvas* canv = MakeCanvas("canv", "histograms", 600, 600); canv->cd(); if(log){ canv->SetLogy(1); } #if defined MSSM if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(345)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(UPPER_EDGE)); }; #else data->GetXaxis()->SetRange(0, data->FindBin(345)); #endif data->SetNdivisions(505); data->SetMinimum(min); #ifndef DROP_SIGNAL data->SetMaximum(max>0 ? max : std::max(std::max(maximum(data, log), maximum(ZTT, log)), maximum(ggH, log))); #else data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(ZTT, log))); #endif data->Draw("e"); TH1F* errorBand = (TH1F*)ZEE ->Clone("errorBand"); errorBand ->SetMarkerSize(0); errorBand ->SetFillColor(1); errorBand ->SetFillStyle(3013); errorBand ->SetLineWidth(1); for(int idx=0; idx<errorBand->GetNbinsX(); ++idx){ if(errorBand->GetBinContent(idx)>0){ std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl; break; } } if(log){ ZEE->Draw("histsame"); ZTT->Draw("histsame"); TTJ->Draw("histsame"); QCD->Draw("histsame"); WJets->Draw("histsame"); //Dibosons->Draw("histsame"); $DRAW_ERROR #ifndef DROP_SIGNAL ggH->Draw("histsame"); #endif } else{ #ifndef DROP_SIGNAL ggH ->Draw("histsame"); #endif ZEE->Draw("histsame"); ZTT->Draw("histsame"); TTJ->Draw("histsame"); QCD->Draw("histsame"); WJets->Draw("histsame"); //Dibosons->Draw("histsame"); $DRAW_ERROR } data->Draw("esame"); canv->RedrawAxis(); //CMSPrelim(dataset, "#tau_{e}#tau_{e}", 0.17, 0.835); CMSPrelim(dataset, "", 0.16, 0.835); TPaveText* chan = new TPaveText(0.20, (category_extra2 && category_extra2[0]=='\0') ? 0.65+0.061 : 0.65+0.061, 0.32, 0.75+0.161, "tlbrNDC"); chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.05 ); chan->SetTextColor( 1 ); chan->SetTextFont ( 62 ); chan->AddText(category); chan->AddText(category_extra); chan->AddText(category_extra2); chan->Draw(); /* TPaveText* cat = new TPaveText(0.20, 0.71+0.061, 0.32, 0.71+0.161, "NDC"); cat->SetBorderSize( 0 ); cat->SetFillStyle( 0 ); cat->SetTextAlign( 12 ); cat->SetTextSize ( 0.05 ); cat->SetTextColor( 1 ); cat->SetTextFont ( 62 ); cat->AddText(category_extra); cat->Draw(); */ #ifdef MSSM TPaveText* massA = new TPaveText(0.55, 0.50+0.061, 0.95, 0.50+0.161, "NDC"); massA->SetBorderSize( 0 ); massA->SetFillStyle( 0 ); massA->SetTextAlign( 12 ); massA->SetTextSize ( 0.03 ); massA->SetTextColor( 1 ); massA->SetTextFont ( 62 ); massA->AddText("m^{h}_{max} (m_{A}=$MA GeV, tan#beta=$TANB)"); massA->Draw(); #endif #ifdef MSSM TLegend* leg = new TLegend(0.55, 0.65, 0.95, 0.90); SetLegendStyle(leg); leg->AddEntry(ggH , "#phi#rightarrow#tau#tau" , "L" ); #else TLegend* leg = new TLegend(0.50, 0.65, 0.95, 0.90); SetLegendStyle(leg); #ifndef DROP_SIGNAL if(SIGNAL_SCALE!=1){ leg->AddEntry(ggH , TString::Format("%.0f#timesH(125 GeV)#rightarrow#tau#tau", SIGNAL_SCALE) , "L" ); } else{ leg->AddEntry(ggH , "H(125 GeV)#rightarrow#tau#tau" , "L" ); } #endif #endif #ifdef ASIMOV leg->AddEntry(data , "sum(bkg) + H(125)" , "LP"); #else leg->AddEntry(data , "observed" , "LP"); #endif leg->AddEntry(ZEE , "Z#rightarrowee" , "F" ); leg->AddEntry(ZTT , "Z#rightarrow#tau#tau" , "F" ); leg->AddEntry(TTJ , "t#bar{t}" , "F" ); leg->AddEntry(QCD , "QCD" , "F" ); leg->AddEntry(WJets, "electroweak" , "F" ); //leg->AddEntry(Dibosons , "Dibosons" , "F" ); $ERROR_LEGEND leg->Draw(); /* Ratio Data over MC */ TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400); canv0->SetGridx(); canv0->SetGridy(); canv0->cd(); TH1F* model = (TH1F*)ZEE ->Clone("model"); TH1F* test1 = (TH1F*)data->Clone("test1"); for(int ibin=0; ibin<test1->GetNbinsX(); ++ibin){ //the small value in case of 0 entries in the model is added to prevent the chis2 test from failing model->SetBinContent(ibin+1, model->GetBinContent(ibin+1)>0 ? model->GetBinContent(ibin+1)*model->GetBinWidth(ibin+1) : 0.01); model->SetBinError (ibin+1, CONVERVATIVE_CHI2 ? 0. : model->GetBinError (ibin+1)*model->GetBinWidth(ibin+1)); test1->SetBinContent(ibin+1, test1->GetBinContent(ibin+1)*test1->GetBinWidth(ibin+1)); test1->SetBinError (ibin+1, test1->GetBinError (ibin+1)*test1->GetBinWidth(ibin+1)); } double chi2prob = test1->Chi2Test (model,"PUW"); std::cout << "chi2prob:" << chi2prob << std::endl; double chi2ndof = test1->Chi2Test (model,"CHI2/NDFUW"); std::cout << "chi2ndf :" << chi2ndof << std::endl; double ksprob = test1->KolmogorovTest(model); std::cout << "ksprob :" << ksprob << std::endl; double ksprobpe = test1->KolmogorovTest(model,"DX"); std::cout << "ksprobpe:" << ksprobpe << std::endl; std::vector<double> edges; TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear(); TH1F* rat1 = (TH1F*)data->Clone("rat1"); for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ rat1->SetBinContent(ibin+1, ZEE->GetBinContent(ibin+1)>0 ? data->GetBinContent(ibin+1)/ZEE->GetBinContent(ibin+1) : 0); rat1->SetBinError (ibin+1, ZEE->GetBinContent(ibin+1)>0 ? data->GetBinError (ibin+1)/ZEE->GetBinContent(ibin+1) : 0); zero->SetBinContent(ibin+1, 0.); zero->SetBinError (ibin+1, ZEE->GetBinContent(ibin+1)>0 ? ZEE ->GetBinError (ibin+1)/ZEE->GetBinContent(ibin+1) : 0); } for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ if(rat1->GetBinContent(ibin+1)>0){ edges.push_back(TMath::Abs(rat1->GetBinContent(ibin+1)-1.)+TMath::Abs(rat1->GetBinError(ibin+1))); // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.); } } float range = 0.1; std::sort(edges.begin(), edges.end()); if (edges[edges.size()-2]>0.1) { range = 0.2; } if (edges[edges.size()-2]>0.2) { range = 0.5; } if (edges[edges.size()-2]>0.5) { range = 1.0; } if (edges[edges.size()-2]>1.0) { range = 1.5; } if (edges[edges.size()-2]>1.5) { range = 2.0; } rat1->SetLineColor(kBlack); rat1->SetFillColor(kGray ); rat1->SetMaximum(+range); rat1->SetMinimum(-range); rat1->GetYaxis()->CenterTitle(); rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}"); #ifdef MSSM rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); #else rat1->GetXaxis()->SetTitle("#bf{D}"); #endif rat1->Draw(); zero->SetFillStyle( 3013); zero->SetFillColor(kBlack); zero->SetLineColor(kBlack); zero->SetMarkerSize(0.1); zero->Draw("e2histsame"); canv0->RedrawAxis(); TPaveText* stat1 = new TPaveText(0.20, 0.76+0.061, 0.32, 0.76+0.161, "NDC"); stat1->SetBorderSize( 0 ); stat1->SetFillStyle( 0 ); stat1->SetTextAlign( 12 ); stat1->SetTextSize ( 0.05 ); stat1->SetTextColor( 1 ); stat1->SetTextFont ( 62 ); stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f", chi2ndof, chi2prob)); //stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f, P(KS)=%.3f", chi2ndof, chi2prob, ksprob)); stat1->Draw(); /* Ratio After fit over Prefit */ TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400); canv1->SetGridx(); canv1->SetGridy(); canv1->cd(); edges.clear(); TH1F* rat2 = (TH1F*) ZEE->Clone("rat2"); for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ rat2->SetBinContent(ibin+1, ref->GetBinContent(ibin+1)>0 ? ZEE->GetBinContent(ibin+1)/ref->GetBinContent(ibin+1) : 0); rat2->SetBinError (ibin+1, ref->GetBinContent(ibin+1)>0 ? ZEE->GetBinError (ibin+1)/ref->GetBinContent(ibin+1) : 0); } for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ if(rat2->GetBinContent(ibin+1)>0){ edges.push_back(TMath::Abs(rat2->GetBinContent(ibin+1)-1.)+TMath::Abs(rat2->GetBinError(ibin+1))); // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat2 ->SetBinContent(ibin+1, rat2->GetBinContent(ibin+1)-1.); } } range = 0.1; std::sort(edges.begin(), edges.end()); if (edges[edges.size()-2]>0.1) { range = 0.2; } if (edges[edges.size()-2]>0.2) { range = 0.5; } if (edges[edges.size()-2]>0.5) { range = 1.0; } if (edges[edges.size()-2]>1.0) { range = 1.5; } if (edges[edges.size()-2]>1.5) { range = 2.0; } #if defined MSSM if(!log){ rat2->GetXaxis()->SetRange(0, rat2->FindBin(345)); } else{ rat2->GetXaxis()->SetRange(0, rat2->FindBin(UPPER_EDGE)); }; #else rat2->GetXaxis()->SetRange(0, rat2->FindBin(345)); #endif rat2->SetNdivisions(505); rat2->SetLineColor(kRed+ 3); rat2->SetMarkerColor(kRed+3); rat2->SetMarkerSize(1.1); rat2->SetMaximum(+range); rat2->SetMinimum(-range); rat2->GetYaxis()->SetTitle("#bf{Postfit/Prefit-1}"); rat2->GetYaxis()->CenterTitle(); #if defined MSSM rat2->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); #else rat2->GetXaxis()->SetTitle("#bf{D}"); #endif rat2->Draw(); zero->SetFillStyle( 3013); zero->SetFillColor(kBlack); zero->SetLineColor(kBlack); zero->Draw("e2histsame"); canv1->RedrawAxis(); /* Relative shift per sample */ TCanvas *canv2 = MakeCanvas("canv2", "histograms", 600, 400); canv2->SetGridx(); canv2->SetGridy(); canv2->cd(); InitHist (scales[0], "", "", kOrange - 4, 1001); InitHist (scales[1], "", "", kAzure + 2, 1001); InitHist (scales[2], "", "", kBlue - 8, 1001); InitHist (scales[3], "", "", kMagenta - 10, 1001); InitHist (scales[4], "", "", kGreen - 4, 1001); InitHist (scales[5], "", "", kRed + 2, 1001); #ifndef DROP_SIGNAL InitSignal(scales[6]); InitSignal(scales[7]); InitSignal(scales[8]); #endif scales[0]->Draw(); scales[0]->GetXaxis()->SetBinLabel(1, "#bf{ZTT}"); scales[0]->GetXaxis()->SetBinLabel(2, "#bf{ZEE}" ); scales[0]->GetXaxis()->SetBinLabel(3, "#bf{TTJ}"); scales[0]->GetXaxis()->SetBinLabel(4, "#bf{QCD}" ); scales[0]->GetXaxis()->SetBinLabel(5, "#bf{Dibosons}"); scales[0]->GetXaxis()->SetBinLabel(6, "#bf{WJets}" ); #ifdef MSSM scales[0]->GetXaxis()->SetBinLabel(7, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(8, "#bf{bbH}" ); scales[0]->GetXaxis()->SetBinLabel(9, "#bf{NONE}" ); #else scales[0]->GetXaxis()->SetBinLabel(7, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(8, "#bf{qqH}" ); scales[0]->GetXaxis()->SetBinLabel(9, "#bf{VH}" ); #endif scales[0]->SetMaximum(+0.5); scales[0]->SetMinimum(-0.5); scales[0]->GetYaxis()->CenterTitle(); scales[0]->GetYaxis()->SetTitle("#bf{Postfit/Prefit-1}"); scales[1]->Draw("same"); scales[2]->Draw("same"); scales[3]->Draw("same"); scales[4]->Draw("same"); scales[5]->Draw("same"); #ifndef DROP_SIGNAL scales[6]->Draw("same"); scales[7]->Draw("same"); scales[8]->Draw("same"); #endif TH1F* zero_samples = (TH1F*)scales[0]->Clone("zero_samples"); zero_samples->Clear(); zero_samples->SetBinContent(1,0.); zero_samples->Draw("same"); canv2->RedrawAxis(); /* prepare output */ bool isSevenTeV = std::string(inputfile).find("7TeV")!=std::string::npos; canv ->Print(TString::Format("%s_%sfit_%s_%s.png" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv ->Print(TString::Format("%s_%sfit_%s_%s.pdf" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv ->Print(TString::Format("%s_%sfit_%s_%s.eps" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); if(log || FULLPLOTS) { canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); } if((log && scaled) || FULLPLOTS) { canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); } TFile* output = new TFile(TString::Format("%s_%sfit_%s_%s.root", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN"), "update"); output->cd(); data ->Write("data_obs"); ZTT->Write("Ztt" ); ZEE->Write("Zee" ); TTJ->Write("ttbar"); QCD->Write("Fakes"); Dibosons->Write("Dibosons"); WJets->Write("EWK"); #ifdef MSSM ggH ->Write("ggH"); bbH ->Write("bbH"); #else #ifndef DROP_SIGNAL ggH ->Write("ggH"); qqH ->Write("qqH"); VH ->Write("VH" ); #endif #endif if(errorBand){ errorBand->Write("errorBand"); } output->Close(); delete errorBand; delete model; delete test1; delete zero; delete rat1; delete rat2; delete zero_samples; delete ref; }
void drawComparisonResponse(const string& canvasName, TMultiGraph *mgResponse, TGraphErrors *gResponseMC, TGraphErrors *gResponseData, TGraph *gratio,const string& mcSample, const string& path, bool doFit = false, bool setRangeUser = true) { // Mikko's tdrstyle_mod14 TCanvas *c2 = tdrDiCanvas(canvasName.c_str(),mgResponse,gratio,2,0); c2->cd(1); gStyle->SetOptStat(0); gStyle->SetOptFit(0); if (setRangeUser) { mgResponse->SetMaximum(1.05); mgResponse->SetMinimum(0.9); } else { mgResponse->SetMaximum(0.5); mgResponse->SetMinimum(0.3); } mgResponse->Draw("P"); gPad->RedrawAxis(); c2->SetLogx(1); if(doFit) { TF1* myLinFit = new TF1("myLinFit", "[0]*x + [1]", mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); myLinFit->SetParameter(0.5, 1.); myLinFit->SetLineColor(1); myLinFit->SetLineWidth(2); c2->Update(); gResponseData->Fit(myLinFit, "RQ"); double linfitValue = myLinFit->GetParameter(0); double linfitError = myLinFit->GetParError(0); TPaveText* linfitlabel = new TPaveText(0.55, 0.77, 0.88, 0.83, "brNDC"); linfitlabel->SetTextSize(0.035); linfitlabel->SetFillColor(0); linfitlabel->SetTextFont(43); TString linfitLabelText = TString::Format("Data slope: %.5f #pm %.5f", linfitValue, linfitError); linfitlabel->AddText(linfitLabelText); linfitlabel->Draw("same"); gPad->RedrawAxis(); } //TLegend* legend = new TLegend(0.55, 0.15, 0.92, 0.38); TLegend* legend = new TLegend(0.65, 0.15, 0.95, 0.30); legend->SetFillColor(kWhite); legend->SetFillStyle(kNone); legend->SetTextFont(43); legend->SetBorderSize(0); //legend->SetTextSize(0.045); legend->AddEntry(gResponseMC,"MC","p"); legend->AddEntry(gResponseData,"Data 2012","p"); legend->Draw("same"); legend->Draw("same"); c2->cd(2); TF1* ratioFit = new TF1("ratioFit", "[0]", mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); ratioFit->SetParameter(0, 0.); ratioFit->SetLineColor(46); ratioFit->SetLineWidth(2); gratio->Draw("APE1"); gratio->GetYaxis()->SetTitle("Data / MC"); // //gratio->GetXaxis()->SetLabelOffset(0.1); // gratio->GetXaxis()->SetLabelFont(42); // gratio->GetXaxis()->SetLabelSize(0.06); // //gratio->GetYaxis()->SetLabelOffset(0.1); // gratio->GetYaxis()->SetLabelFont(42); // gratio->GetYaxis()->SetLabelSize(0.06); // gratio->GetXaxis()->SetTitleOffset(-0.6); // gratio->GetXaxis()->SetTitleFont(42); // gratio->GetXaxis()->SetTitleSize(0.06); //gratio->GetYaxis()->SetTitleOffset(1.3); // gratio->GetYaxis()->SetTitleFont(42); // gratio->GetYaxis()->SetTitleSize(0.06); gratio->SetMarkerSize(1.0); gratio->SetMaximum(1.05); gratio->SetMinimum(0.95); gratio->GetXaxis()->SetLimits(mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); c2->Update(); gratio->Fit(ratioFit, "RQ"); //gratio->GetYaxis()->SetRangeUser(-1,3); double fitValue = ratioFit->GetParameter(0); double fitError = ratioFit->GetParError(0); TPaveText* fitlabel = new TPaveText(0.55, 0.77, 0.88, 0.83, "brNDC"); fitlabel->SetTextSize(0.08); fitlabel->SetFillColor(0); fitlabel->SetTextFont(42); TString fitLabelText = TString::Format("Fit: %.4f #pm %.4f", fitValue, fitError); fitlabel->AddText(fitLabelText); fitlabel->Draw("same"); gPad->RedrawAxis(); c2->SaveAs(path.c_str()); }
void mergePlotResponse(const string& canvasName, TMultiGraph *mgResponse, TGraph *gResponseMC_MJB, TGraph *gResponseData_MJB, TGraph *gratio_MJB, TGraph *gResponseMC_MPF, TGraph *gResponseData_MPF, TGraph *gratio_MPF, double y_min, double y_max, const string& label_MJB, const string& label_MPF, const string& path) { // Mikko's tdrstyle_mod14 TCanvas *c3 = tdrDiCanvas(canvasName.c_str(),mgResponse,gratio_MJB,2,0); c3->cd(1); gStyle->SetOptStat(0); gStyle->SetOptFit(0); mgResponse->SetMaximum(y_max); mgResponse->SetMinimum(y_min); mgResponse->Draw("P"); gPad->RedrawAxis(); //c3->SetLogx(1); //TLegend* legend = new TLegend(0.55, 0.15, 0.92, 0.38); TLegend* legend = new TLegend(0.63, 0.15, 0.93, 0.30); legend->SetFillColor(kWhite); legend->SetFillStyle(kNone); legend->SetTextFont(43); legend->SetBorderSize(0); //legend->SetTextSize(0.045); string toLeg = label_MJB + ", MC"; legend->AddEntry(gResponseMC_MJB, toLeg.c_str(),"p"); toLeg = label_MJB + ", data"; legend->AddEntry(gResponseData_MJB,toLeg.c_str(),"p"); toLeg = label_MPF + ", MC"; legend->AddEntry(gResponseMC_MPF,toLeg.c_str(),"p"); toLeg = label_MPF + ", data"; legend->AddEntry(gResponseData_MPF,toLeg.c_str(),"p"); legend->Draw("same"); c3->cd(2); TF1* ratioFit_MJB = new TF1("ratioFit_MJB", "[0]", mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); ratioFit_MJB->SetParameter(0, 0.); ratioFit_MJB->SetLineColor(gratio_MJB->GetLineColor()); ratioFit_MJB->SetLineWidth(0); gratio_MJB->Draw("APE1"); gratio_MJB->GetYaxis()->SetTitle("Data / MC"); gratio_MJB->SetMarkerSize(1.0); gratio_MJB->SetMaximum(1.05); gratio_MJB->SetMinimum(0.95); gratio_MJB->GetXaxis()->SetLimits(mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); gratio_MPF->Draw("PE1same"); c3->Update(); gratio_MJB->Fit(ratioFit_MJB, "RQ"); //gratio_MJB->GetYaxis()->SetRangeUser(-1,3); double fitValue_MJB = ratioFit_MJB->GetParameter(0); double fitError_MJB = ratioFit_MJB->GetParError(0); TF1* ratioFit_MPF = new TF1("ratioFit_MPF", "[0]", mgResponse->GetXaxis()->GetXmin(),mgResponse->GetXaxis()->GetXmax()); ratioFit_MPF->SetParameter(0, 0.); ratioFit_MPF->SetLineColor(gratio_MPF->GetLineColor()); ratioFit_MPF->SetLineWidth(0); gratio_MPF->Fit(ratioFit_MPF, "RQ"); //gratio_MPF->GetYaxis()->SetRangeUser(-1,3); double fitValue_MPF = ratioFit_MPF->GetParameter(0); double fitError_MPF = ratioFit_MPF->GetParError(0); TPaveText* fitlabel = new TPaveText(0.57, 0.82, 0.85, 0.84, "brNDC"); fitlabel->SetTextSize(0.08); fitlabel->SetFillColor(0); fitlabel->SetTextFont(42); fitlabel->SetTextColor(gratio_MJB->GetLineColor()); TString fitLabelTextMJB = TString::Format("Fit %s: %.4f #pm %.4f", label_MJB.c_str(), fitValue_MJB, fitError_MJB); fitlabel->AddText(fitLabelTextMJB); fitlabel->Draw("same"); TPaveText* fitlabel_MPF = new TPaveText(0.57, 0.72, 0.85, 0.74, "brNDC"); fitlabel_MPF->SetTextSize(0.08); fitlabel_MPF->SetFillColor(0); fitlabel_MPF->SetTextFont(42); fitlabel_MPF->SetTextColor(gratio_MPF->GetLineColor()); TString fitLabelTextMPF = TString::Format("Fit %s: %.4f #pm %.4f", label_MPF.c_str(), fitValue_MPF, fitError_MPF); fitlabel_MPF->AddText(fitLabelTextMPF); fitlabel_MPF->Draw("same"); gPad->RedrawAxis(); c3->SaveAs(path.c_str()); }
void gluinoMass(double lumi=-1., double maxInstLumi=-1.) { if (lumi<0) lumi=877.; if (maxInstLumi<0) maxInstLumi=1300.; LimitPlots plots(lumi); plots.calculateCrossSections(7,4,39,9); // expected limit (1 and 2 sigma bands) TGraph* g_exp = plots.getExpMassLimitGluino(); TGraphAsymmErrors* g_exp1 = plots.getExpMassLimitGluino1Sig(); TGraphAsymmErrors* g_exp2 = plots.getExpMassLimitGluino2Sig(); // three points on counting expt curve TGraph* g_gluino = plots.getMassLimitGluino(); TGraph* g_stop = plots.getMassLimitStop(); // one point from lifetime fit TGraph* g_tp = plots.getMassLimitGluinoTP(); // theory prediction TGraph* g_thGluino = plots.getGluinoTheory(); TGraph* g_thStop = plots.getStopTheory(); TCanvas* canvas = new TCanvas("canvas"); //canvas->SetGrid(); canvas->SetLogy(); TH1 * h; h = canvas->DrawFrame(300., .02, 1000., 1e2); //h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; Stopped HSCP Cross Section #times BR [pb]"); h->SetTitle("Beamgap Expt;m_{#tilde{g}} [GeV/c^{2}]; #sigma(pp #rightarrow #tilde{g}#tilde{g}) #times BR(#tilde{g} #rightarrow g#tilde{#chi}^{0}) [pb]"); // not covered region TBox* nc = new TBox(100., .1, 150., 5e2); nc->SetFillStyle(3354); nc->SetFillColor(kRed-4); //nc->Draw(); // details TPaveText* blurb = new TPaveText(300., 2, 550., 1e2); blurb->AddText("CMS Preliminary 2012"); std::stringstream label; label<<"#int L dt = "<<lumi<<" fb^{-1}"; blurb->AddText(label.str().c_str()); label.str(""); double peakInstLumi=maxInstLumi; int exponent=30; while (peakInstLumi>10) { peakInstLumi/=10.; ++exponent; } label<<"L^{max}_{inst} = "<<peakInstLumi<<" x 10^{"<<exponent<<"} cm^{-2}s^{-1}"; blurb->AddText(label.str().c_str()); label.str(""); label << "#sqrt{s} = " << ENERGY << " TeV"; blurb->AddText(label.str().c_str()); blurb->AddText("m_{#tilde{g}} - m_{#tilde{#chi}^{0}} = 100 GeV/c^{2}"); //blurb->AddText("m_{#tilde{t}} - m_{#tilde{#chi}^{0}} = 200 GeV/c^{2}"); blurb->SetTextFont(42); blurb->SetBorderSize(0); blurb->SetFillColor(0); blurb->SetShadowColor(0); blurb->SetTextAlign(12); blurb->SetTextSize(0.032); // legend TBox *legbg = new TBox(600., 2., 900., 1e2); legbg->Draw(); TLegend *leg = new TLegend(600., 2., 900., 1e2,"95% C.L. Limits",""); leg->SetTextSize(0.028); leg->SetBorderSize(0); leg->SetTextFont(42); leg->SetFillColor(0); leg->AddEntry(g_exp, "Expected: 10 #mus - 1000 s Counting Exp. ", "l"); leg->AddEntry(g_exp1, "Expected #pm1#sigma: 10 #mus - 1000 s Counting Exp. ", "f"); leg->AddEntry(g_exp2, "Expected #pm2#sigma: 10 #mus - 1000 s Counting Exp. ", "f"); // leg->AddEntry(graph3, "Obs.: 10^{6} s Counting Exp.", "l"); leg->AddEntry(g_gluino, "Obs.: 10 #mus - 1000 s Counting Exp. ", "l"); leg->AddEntry(g_tp, "Obs.: 10 #mus Timing Profile ", "l"); //leg->AddEntry(g_stop, "Obs.: 10 #mus - 1000 s Counting Exp. (#tilde{t})", "l"); //leg->AddEntry(graph_em, "Obs.: 10 #mus - 1000 s Counting Exp. (EM only)", "l"); // leg->AddEntry(graph1, "Obs.: 570 ns Counting Exp.", "l"); leg->Draw(); // 2 sigma expected band g_exp2->SetLineColor(0); g_exp2->SetLineStyle(0); g_exp2->SetLineWidth(0); g_exp2->SetFillColor(5); g_exp2->SetFillStyle(1001); g_exp2->Draw("3"); // 1 sigma expected band g_exp1->SetLineColor(0); g_exp1->SetLineStyle(0); g_exp1->SetLineWidth(0); g_exp1->SetFillColor(3); g_exp1->SetFillStyle(1001); g_exp1->Draw("3"); // expected line g_exp->SetLineStyle(2); g_exp->SetLineWidth(1); g_exp->Draw("l"); // plateau limit - 1 ms g_gluino->SetLineColor(1); g_gluino->SetLineStyle(1); g_gluino->SetLineWidth(2); g_gluino->Draw("l"); // stop curve g_stop->SetLineColor(1); g_stop->SetLineStyle(5); g_stop->SetLineWidth(2); //g_stop->Draw("l"); // 1 mus lifetime fit limit g_tp->SetLineColor(kRed); g_tp->SetLineStyle(1); g_tp->SetLineWidth(2); g_tp->Draw("l"); // theory line g_thGluino->SetLineColor(kBlue); g_thGluino->SetLineStyle(1); g_thGluino->SetLineWidth(2); g_thGluino->SetFillStyle(3001); g_thGluino->SetFillColor(kBlue-4); g_thGluino->Draw("l3"); g_thStop->SetLineColor(kRed); g_thStop->SetLineStyle(1); g_thStop->SetLineWidth(2); g_thStop->SetFillStyle(3001); g_thStop->SetFillColor(kRed-4); //g_thStop->Draw("l3"); // theory line label TLatex* th = new TLatex(600., .3, "NLO+NLL #tilde{g}"); th->SetTextColor(kBlue); th->SetTextFont(42); th->SetTextSize(0.035); th->Draw(); TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}"); ths->SetTextColor(kRed); ths->SetTextFont(42); ths->SetTextSize(0.035); //ths->Draw(); // not explored label TText* ne = new TText(125., .2, "Not Sensitive"); ne->SetTextColor(kRed+1); ne->SetTextFont(42); ne->SetTextAngle(90); ne->SetTextSize(0.035); //ne->Draw(); blurb->Draw(); canvas->RedrawAxis(); canvas->Print("gluinoMassLimit.pdf"); canvas->Print("gluinoMassLimit.C"); plots.calculateIntercepts(); }
void getCalibrationResults(TString url="TopMassCalibration.root",int nCategs=4) { TString mpts[]={"161.5","163.5","166.5","169.5","172.5","175.5","178.5","181.5","184.5"}; const size_t nmpts=sizeof(mpts)/sizeof(TString); std::vector<TString> labels; if(nCategs==2) { labels.push_back("1 b-tags"); labels.push_back("#geq 2 b-tags"); } else if(nCategs==4) { labels.push_back("1 b-tags (ee+#mu#mu)"); labels.push_back("#geq 2 b-tags (ee+#mu#mu)"); labels.push_back("1 b-tags (e#mu)"); labels.push_back("#geq 2 b-tags (e#mu)"); } else { labels.push_back("1 b-tags (ee)"); labels.push_back("#geq 2 b-tags (ee)"); labels.push_back("1 b-tags (#mu#mu)"); labels.push_back("#geq 2 b-tags (#mu#mu)"); labels.push_back("1 b-tags (e#mu)"); labels.push_back("#geq 2 b-tags (e#mu)"); } TString outDir=gSystem->DirName(url); report << "Plots will be stored at @ " << outDir << endl; TGraphErrors *lingr = new TGraphErrors; lingr->SetMarkerStyle(20); TGraphErrors *biasgr = new TGraphErrors; biasgr->SetMarkerStyle(20); std::vector<TGraphErrors *> categbiasgr; for(int icat=0; icat<nCategs; icat++) categbiasgr.push_back( new TGraphErrors ); TObjArray statUncResults; TObjArray pullResults; //get results from file TFile *fin=TFile::Open(url); for(size_t i=0; i<nmpts; i++) { Float_t trueMass=mpts[i].Atof(); TH1D *massFitH=(TH1D *)fin->Get(mpts[i]+"/massfit"); if(massFitH==0) continue; TF1 *ffunc=massFitH->GetFunction("gaus"); float avgMass=ffunc->GetParameter(1); float avgMassErr=ffunc->GetParError(1); int ipt=lingr->GetN(); lingr->SetPoint(ipt,trueMass,avgMass); lingr->SetPointError(ipt,0,avgMassErr); for(int icat=0; icat<=nCategs;icat++) { TString postfix(""); TGraphErrors *gr=biasgr; if(icat<nCategs){ postfix ="_"; postfix +=( icat+1); gr=categbiasgr[icat]; } TH1D *biasH=(TH1D *)fin->Get(mpts[i]+"/bias"+postfix); ffunc=biasH->GetFunction("gaus"); float avgBias=ffunc->GetParameter(1); float avgBiasErr=ffunc->GetParError(1); ipt=gr->GetN(); gr->SetPoint(ipt,trueMass,avgBias); gr->SetPointError(ipt,0,avgBiasErr); if(trueMass==172.5) { TH1D *h=(TH1D *)fin->Get(mpts[i]+"/statunc"+postfix); h->SetDirectory(0); h->SetLineColor(icat==nCategs? 1 : icat+2); h->SetMarkerColor(icat==nCategs? 1 : icat+2); h->SetMarkerStyle(1); h->SetLineWidth(2); statUncResults.Add(h); } } TH1D *pullH=(TH1D *)fin->Get(mpts[i]+"/pull"); pullH->SetDirectory(0); pullResults.Add(pullH); } fin->Close(); //plot results setStyle(); gStyle->SetOptFit(0); TCanvas *c=new TCanvas("linc","linc",600,600); c->SetWindowSize(600,600); c->Divide(1,2); TPad *p=(TPad *)c->cd(1); p->SetPad(0,0.3,1.0,1.0); lingr->Draw("ap"); lingr->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]"); lingr->GetXaxis()->SetTitle("Fitted m_{top} [GeV/c^{2}]"); TLine *l=new TLine(lingr->GetXaxis()->GetXmin(),lingr->GetYaxis()->GetXmin(), lingr->GetXaxis()->GetXmax(),lingr->GetYaxis()->GetXmax()); l->SetLineColor(kGray); l->SetLineStyle(6); l->Draw("same"); TLegend *leg = p->BuildLegend(); formatForCmsPublic(p,leg,"CMS simulation",3); leg->Delete(); p=(TPad *)c->cd(2); p->SetPad(0,0.0,1.0,0.28); p->SetTopMargin(0); p->SetBottomMargin(0.5); float yscale = (1.0-0.3)/(0.28-0); biasgr->Draw("ap"); biasgr->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]"); biasgr->GetYaxis()->SetTitle("Bias"); biasgr->GetYaxis()->SetRangeUser(-5.2,5.2); biasgr->GetXaxis()->SetTitleOffset(0.85); biasgr->GetXaxis()->SetLabelSize(0.04 * yscale); biasgr->GetXaxis()->SetTitleSize(0.05 * yscale); biasgr->GetXaxis()->SetTickLength( 0.03 * yscale ); biasgr->GetYaxis()->SetTitleOffset(0.5); biasgr->GetYaxis()->SetLabelSize(0.04 * yscale); biasgr->GetYaxis()->SetTitleSize(0.04 * yscale); biasgr->Fit("pol1"); float a=biasgr->GetFunction("pol1")->GetParameter(1); float b=biasgr->GetFunction("pol1")->GetParameter(0); report << "[Inclusive bias correction] resslope:" << (a+1.) << " resbias:" << b << endl; c->Modified(); c->Update(); c->SaveAs(outDir+"/TopMassCalibrationResults.C"); c->SaveAs(outDir+"/TopMassCalibrationResults.png"); c->SaveAs(outDir+"/TopMassCalibrationResults.pdf"); // delete c; //biases per category c=new TCanvas("biasc","biasc",600,600); c->SetWindowSize(600,600); c->Divide(1,nCategs+1); c->cd(nCategs+1)->Delete(); float ystep=(1.0)/(nCategs+1); for(int icat=nCategs-1; icat>=0; --icat) { TGraphErrors *gr=categbiasgr[icat]; gr->SetMarkerStyle(20); TPad *p=(TPad *)c->cd(icat+1); p->SetFillStyle(1001); p->SetFillColor(0); float ymin=(icat+1)*ystep-0.05; float ymax=(icat+2)*ystep-0.05; if(icat==0) { ymin=icat*ystep; } p->SetPad(0,ymin,1.0,ymax); p->SetTopMargin(0.0); p->SetBottomMargin(icat==0?0.4:0.0); gr->Draw("ap"); float yscale = (0.95-ystep)/(ystep-0.0); if(icat==0) yscale=(0.95-2*ystep)/(1.2*ystep-0); if(icat==0) gr->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]"); else gr->GetXaxis()->SetNdivisions(0); gr->GetYaxis()->SetTitle("Bias"); gr->GetYaxis()->SetRangeUser(-5.2,5.2); gr->GetXaxis()->SetTitleOffset(0.85); gr->GetXaxis()->SetLabelSize(0.04 * yscale); gr->GetXaxis()->SetTitleSize(0.05 * yscale); gr->GetXaxis()->SetTickLength( 0.03 * yscale ); gr->GetYaxis()->SetTitleOffset(icat==0?0.5:0.3); gr->GetYaxis()->SetLabelSize(0.04 * yscale); gr->GetYaxis()->SetTitleSize(0.04 * yscale); gr->Fit("pol1"); float a=gr->GetFunction("pol1")->GetParameter(1); float b=gr->GetFunction("pol1")->GetParameter(0); report << "[Bias correction #" << icat+1 << "] resslope:" << (a+1.) << " resbias:" << b << endl; //prepare label TPaveText *pave = new TPaveText(0.70,0.65,0.8,0.92,"NDC"); pave->SetTextFont(42); pave->SetFillStyle(0); pave->SetBorderSize(0); pave->AddText( labels[icat] )->SetTextAlign(11); pave->Draw(); if(icat==nCategs-1) { pave = new TPaveText(0.2,0.75,0.45,0.92,"NDC"); pave->SetTextFont(42); pave->SetFillStyle(0); pave->SetBorderSize(0); pave->AddText( "CMS simulation" )->SetTextAlign(11); pave->Draw(); } } c->Modified(); c->Update(); c->SaveAs(outDir+"/TopMassCalibrationBiases.C"); c->SaveAs(outDir+"/TopMassCalibrationBiases.png"); c->SaveAs(outDir+"/TopMassCalibrationBiases.pdf"); //delete c; //stat uncertainty c=new TCanvas("statc","statc",600,600); c->SetWindowSize(600,600); for(int i=0; i<statUncResults.GetEntriesFast(); i++) { int idx=statUncResults.GetEntriesFast()-1-i; statUncResults.At(idx)->Draw(i==0?"hist":"histsame"); ((TH1*)statUncResults.At(idx))->SetTitle( i==0 ? "combined" :labels[idx] ); } leg = c->BuildLegend(); formatForCmsPublic(c,leg,"CMS simulation",3); c->Modified(); c->Update(); c->SaveAs(outDir+"/TopMassCalibrationStat.C"); c->SaveAs(outDir+"/TopMassCalibrationStat.png"); c->SaveAs(outDir+"/TopMassCalibrationStat.pdf"); //delete c; //pulls TGraphErrors *avgPull = new TGraphErrors; avgPull->SetMarkerStyle(20); TGraphErrors *sigmaPull = new TGraphErrors; sigmaPull->SetMarkerStyle(20); c=new TCanvas("pullsc","pullsc",1600,(pullResults.GetEntriesFast()/4+1)*400); c->SetWindowSize(1600,(pullResults.GetEntriesFast()/4+1)*400); c->Divide(4,pullResults.GetEntriesFast()/4+1); for(int i=0; i<pullResults.GetEntriesFast(); i++) { TPad *p=(TPad *)c->cd(i+1); TH1 *pullH=(TH1 *)pullResults.At(i); pullH->Draw("e1"); Float_t trueMass=mpts[i].Atof(); TF1 *gaus=pullH->GetFunction("gaus"); avgPull->SetPoint(i,trueMass,gaus->GetParameter(1)); avgPull->SetPointError(i,0,gaus->GetParError(1)); sigmaPull->SetPoint(i,trueMass,gaus->GetParameter(2)); sigmaPull->SetPointError(i,0,gaus->GetParError(2)); if(i==0) { leg = p->BuildLegend(); formatForCmsPublic(p,leg,"CMS simulation",3); leg->Delete(); } TPaveText *pave = new TPaveText(0.2,0.8,0.35,0.88,"NDC"); pave->SetTextFont(42); pave->SetFillStyle(0); pave->SetBorderSize(0); pave->AddText( mpts[i] )->SetTextAlign(11); pave->Draw(); } c->Modified(); c->Update(); c->SaveAs(outDir+"/TopMassCalibrationPulls.C"); c->SaveAs(outDir+"/TopMassCalibrationPulls.png"); c->SaveAs(outDir+"/TopMassCalibrationPulls.pdf"); //delete c; //pull momenta c=new TCanvas("pullsmomc","pullsmomc",600,600); c->SetWindowSize(600,600); c->Divide(1,2); p=(TPad *)c->cd(1); avgPull->Draw("ap"); avgPull->GetYaxis()->SetRangeUser(-3,3); avgPull->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]"); avgPull->GetYaxis()->SetTitle("Average pull"); leg = p->BuildLegend(); formatForCmsPublic(p,leg,"CMS simulation",3); leg->Delete(); c->cd(2); sigmaPull->GetYaxis()->SetRangeUser(0.9,1.2); sigmaPull->Draw("ap"); sigmaPull->GetXaxis()->SetTitle("Generated m_{top} [GeV/c^{2}]"); sigmaPull->GetYaxis()->SetTitle("Pull width"); c->Modified(); c->Update(); c->SaveAs(outDir+"/TopMassCalibrationPullsMomenta.C"); c->SaveAs(outDir+"/TopMassCalibrationPullsMomenta.png"); c->SaveAs(outDir+"/TopMassCalibrationPullsMomenta.pdf"); //delete c; cout << report.str() << endl; }
void sphere() { /********************/ /*Mpi initialization*/ /********************/ ROOT::Mpi::TEnvironment env(gApplication->Argc(), gApplication->Argv()); ROOT::Mpi::TIntraCommunicator world; /*********************************/ /*Error control, need 4 processes*/ /*********************************/ if(world.Size()!=4) { std::cout<<"Error: You need run with 4 processes exactly, the sphere was spplitted in four regions. \nExample: mpirun -np 4 root -l sphere.C\n"; std::cout.flush(); world.Abort(ROOT::Mpi::ERR_SIZE); } /*********************************************************************/ /*Section to calculate volume with parallel multimensional integrator*/ /*********************************************************************/ //integrator creation root's style ROOT::Math::Functor1D function(&sphere_function); ROOT::Math::Integrator integrator; integrator.SetFunction(function); //Mpi's integrator wrapper, integrator from ROOT in one dimension ROOT::Mpi::Math::TIntegratorWrapper MpiIntegrator(&integrator); //integrate in parallel and send the result to rank zero, intervar [0,radius] MpiIntegrator.Integrate(0, 0, radius); /*****************************************************************************************/ /*this is the root process,calculate the surface z=+qsrt(1−(x2+b2)) for x∈[−1,0],y∈[−1,1]*/ /*and recv the other surface regions in TPolyMarker3D object from others ranks */ /*****************************************************************************************/ if (world.Rank() == 0) { gBenchmark->Start("sphere"); // create and open a canvas TCanvas *canvas = new TCanvas("sphere", "sphere", 300, 10, 700, 500); canvas->SetFillColor(14); // creating view TView *view = TView::CreateView(1, 0, 0); view->RotateView(90,-10); view->SetRange(-radius*2, -radius*2, -2*radius, 2*radius, 2*radius, 2*radius); // create a PolyMarker3D for region/segment 1 calculate in rank 0(this rank) TPolyMarker3D *surfaceSeg13d = new TPolyMarker3D(); for (theta = 0; theta <0.5*M_PI ; theta+= delta) { for (phi = 0; phi <M_PI; phi += delta) { x=radius*cos(theta)*sin(phi); y=radius*sin(theta)*sin(phi); z=radius*cos(phi); // set points surfaceSeg13d->SetPoint(point, x, y, z); point++; } } // set marker size, color & style surfaceSeg13d->SetMarkerSize(1); surfaceSeg13d->SetMarkerColor(world.Rank() + world.Size()); surfaceSeg13d->SetMarkerStyle(1); //drawing region 1 surfaceSeg13d->Draw(); //getting region 2 from rank 1 TPolyMarker3D *surfaceSeg23d = new TPolyMarker3D; world.RecvObject(1, 1, *surfaceSeg23d); surfaceSeg23d->Draw(); //getting region 3 from rank 2 TPolyMarker3D *surfaceSeg33d = new TPolyMarker3D; world.RecvObject(2, 1, *surfaceSeg33d); surfaceSeg33d->Draw(); //getting region 4 from rank 3 TPolyMarker3D *surfaceSeg43d = new TPolyMarker3D; world.RecvObject(3, 1, *surfaceSeg43d); surfaceSeg43d->Draw(); Char_t timeStr[60]; Char_t pointsStr[100]; Char_t radiusStr[100]; Char_t deltaStr[100]; gBenchmark->Show("sphere"); Float_t ct = gBenchmark->GetCpuTime("sphere"); sprintf(timeStr, "Execution time: %g sec.", ct); sprintf(radiusStr, "Radius : %g", radius); sprintf(deltaStr, "Delta : %g", delta); sprintf(pointsStr, "Total surface points : %g", point*4); TPaveText *text = new TPaveText(0.1, 0.6, 0.9, 0.99); text->SetFillColor(42); text->AddText("ROOTMpi example: sphere.C"); text->AddText(timeStr); text->AddText(radiusStr); text->AddText(deltaStr); text->AddText(pointsStr); text->Draw(); //sphere volume V=(4/3)*pi*r3 //and compare the result integration's volume Char_t volumeStr[100]; Double_t volume= MpiIntegrator.Result(); Double_t volumeTeo=(4/3.0)*M_PI*(radius*radius*radius); sprintf(volumeStr, "Volumen with integration = %.15g \nVolumen with (4/3)*pi*r3 = %.15g", volume,volumeTeo); TPaveText *volumeText = new TPaveText(-0.1, -0.81, -0.9, -0.97); volumeText->SetFillColor(41); volumeText->SetTextAlign(11); volumeText->AddText(volumeStr); volumeText->Draw(); } /*************************************************************************/ /*this rank calculate the surface for theta ∈[0.5pi,pi] and phi ∈[0,pi] */ /*and send the surface regions in TPolyMarker3D object to rank root zero */ /*************************************************************************/ if (world.Rank() == 1) { TPolyMarker3D *surfaceSeg23d = new TPolyMarker3D(); for (theta = 0.5*M_PI; theta <M_PI ; theta+= delta) { for (phi = 0; phi <M_PI; phi += delta) { x=radius*cos(theta)*sin(phi); y=radius*sin(theta)*sin(phi); z=radius*cos(phi); // set points surfaceSeg23d->SetPoint(point, x, y, z); point++; } } // set marker size, color & style surfaceSeg23d->SetMarkerSize(1); surfaceSeg23d->SetMarkerColor(world.Rank() + world.Size()); surfaceSeg23d->SetMarkerStyle(1); //send surface points to root process world.SendObject(0, 1, *surfaceSeg23d); } /*************************************************************************/ /*this rank calculate the surface for theta ∈[pi,1.5pi] and phi ∈[0,pi] */ /*and send the surface regions in TPolyMarker3D object to rank root zero */ /*************************************************************************/ if (world.Rank() == 2) { TPolyMarker3D *surfaceSeg33d = new TPolyMarker3D(); for (theta = M_PI; theta <1.5*M_PI ; theta+= delta) { for (phi = 0; phi <M_PI; phi += delta) { x=radius*cos(theta)*sin(phi); y=radius*sin(theta)*sin(phi); z=radius*cos(phi); // set points surfaceSeg33d->SetPoint(point, x, y, z); point++; } } // set marker size, color & style surfaceSeg33d->SetMarkerSize(1); surfaceSeg33d->SetMarkerColor(world.Rank() + world.Size()); surfaceSeg33d->SetMarkerStyle(1); //send surface points to root process world.SendObject(0, 1, *surfaceSeg33d); } /*************************************************************************/ /*this rank calculate the surface for theta ∈[1.5pi,2pi] and phi ∈[0,pi] */ /*and send the surface regions in TPolyMarker3D object to rank root zero */ /*************************************************************************/ if (world.Rank() == 3) { TPolyMarker3D *surfaceSeg43d = new TPolyMarker3D(); for (theta = 1.5*M_PI; theta <2*M_PI ; theta+= delta) { for (phi = 0; phi <M_PI; phi += delta) { x=radius*cos(theta)*sin(phi); y=radius*sin(theta)*sin(phi); z=radius*cos(phi); // set points surfaceSeg43d->SetPoint(point, x, y, z); point++; } } // set marker size, color & style surfaceSeg43d->SetMarkerSize(1); surfaceSeg43d->SetMarkerColor(world.Rank() + world.Size()); surfaceSeg43d->SetMarkerStyle(1); //send surface points to root process world.SendObject(0, 1, *surfaceSeg43d); } }
//************************************************************* void arrangeBiasCanvas(TCanvas *canv,TH1F* dxyPhiMeanTrend[100],TH1F* dzPhiMeanTrend[100],TH1F* dxyEtaMeanTrend[100],TH1F* dzEtaMeanTrend[100],Int_t nFiles, TString LegLabels[10]){ //************************************************************* TLegend *lego = new TLegend(0.19,0.70,0.79,0.92); lego-> SetNColumns(2); lego->SetFillColor(10); lego->SetTextSize(0.042); lego->SetTextFont(42); lego->SetFillColor(10); lego->SetLineColor(10); lego->SetShadowColor(10); TPaveText *pt = new TPaveText(0.13,0.95,0.89,0.97,"NDC"); pt->SetFillColor(10); pt->SetTextColor(1); pt->SetTextFont(42); pt->SetTextAlign(11); TText *text1 = pt->AddText("CMS Preliminary 2015 - 3.8T collision data"); text1->SetTextSize(0.05); TPaveText *pt2 = new TPaveText(0.70,0.75,0.89,0.92,"NDC"); pt2->SetFillColor(10); pt2->SetTextColor(kBlue); pt2->SetTextFont(62); pt2->SetTextAlign(11); TText *text2 = pt2->AddText("run 247078"); text2->SetTextSize(0.05); canv->SetFillColor(10); canv->Divide(2,2); canv->cd(1)->SetBottomMargin(0.14); canv->cd(1)->SetLeftMargin(0.18); canv->cd(1)->SetRightMargin(0.01); canv->cd(1)->SetTopMargin(0.06); canv->cd(2)->SetBottomMargin(0.14); canv->cd(2)->SetLeftMargin(0.18); canv->cd(2)->SetRightMargin(0.01); canv->cd(2)->SetTopMargin(0.06); canv->cd(3)->SetBottomMargin(0.14); canv->cd(3)->SetLeftMargin(0.18); canv->cd(3)->SetRightMargin(0.01); canv->cd(3)->SetTopMargin(0.06); canv->cd(4)->SetBottomMargin(0.14); canv->cd(4)->SetLeftMargin(0.18); canv->cd(4)->SetRightMargin(0.01); canv->cd(4)->SetTopMargin(0.06); TH1F *dBiasTrend[4][nFiles]; for(Int_t i=0;i<nFiles;i++){ dBiasTrend[0][i] = dxyPhiMeanTrend[i]; dBiasTrend[1][i] = dzPhiMeanTrend[i]; dBiasTrend[2][i] = dxyEtaMeanTrend[i]; dBiasTrend[3][i] = dzEtaMeanTrend[i]; } Double_t absmin[4]={999.,999.,999.,999.}; Double_t absmax[4]={-999.,-999.-999.,-999.}; for(Int_t k=0; k<4; k++){ canv->cd(k+1); for(Int_t i=0; i<nFiles; i++){ if(dBiasTrend[k][i]->GetMaximum()>absmax[k]) absmax[k] = dBiasTrend[k][i]->GetMaximum(); if(dBiasTrend[k][i]->GetMinimum()<absmin[k]) absmin[k] = dBiasTrend[k][i]->GetMinimum(); } Double_t safeDelta=(absmax[k]-absmin[k])/8.; Double_t theExtreme=std::max(absmax[k],TMath::Abs(absmin[k])); for(Int_t i=0; i<nFiles; i++){ if(i==0){ //dBiasTrend[i]->GetYaxis()->SetRangeUser(absmin-safeDelta/2.,absmax+safeDelta); //std::cout<<"name is: "<< dBiasTrend[k][i]->GetName() <<std::endl; TString theTitle = dBiasTrend[k][i]->GetName(); if( theTitle.Contains("Norm")){ dBiasTrend[k][i]->GetYaxis()->SetRangeUser(std::min(-0.48,absmin[k]-safeDelta/2.),std::max(0.48,absmax[k]+safeDelta/2.)); } else { //dBiasTrend[k][i]->GetYaxis()->SetRangeUser(std::min(-8.8,absmin[k]-safeDelta/2.),std::max(8.8,absmax[k]+safeDelta/2.)); dBiasTrend[k][i]->GetYaxis()->SetRangeUser(-theExtreme-(safeDelta/2.),theExtreme+(safeDelta/2.)); //dBiasTrend[k][i]->GetYaxis()->SetRangeUser(-theExtreme,theExtreme); } dBiasTrend[k][i]->Draw("Le1"); } else dBiasTrend[k][i]->Draw("Le1sames"); if(k==0){ lego->AddEntry(dBiasTrend[k][i],LegLabels[i]); } } lego->Draw(); pt->Draw("same"); } }
void //HTT_ET_X(bool scaled=true, bool log=true, float min=0.1, float max=-1., string inputfile="root/$HISTFILE", const char* directory="eleTau_$CATEGORY") HTT_ET_X(bool scaled=true, bool log=true, float min=0.1, float max=-1., TString datacard="htt_et_1_7TeV", string inputfile="root/$HISTFILE", const char* directory="eleTau_$CATEGORY") { // defining the common canvas, axes pad styles SetStyle(); gStyle->SetLineStyleString(11,"20 10"); // determine category tag const char* category = ""; const char* category_extra = ""; const char* category_extra2 = ""; if(std::string(directory) == std::string("eleTau_0jet_low" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_0jet_low" )){ category_extra = "0-jet low p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_0jet_medium" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_0jet_medium" )){ category_extra = "0-jet low p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_0jet_high" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_0jet_high" )){ category_extra = "0-jet high p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_1jet_medium" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_1jet_medium" )){ category_extra = "1-jet low p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_1jet_high_lowhiggs" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_1jet_high_lowhiggs" )){ category_extra= "1-jet high p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_1jet_high_mediumhiggs")){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_1jet_high_mediumhiggs")){ category_extra= "1-jet high p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_1jet_high_mediumhiggs")){ category_extra2= "boosted"; } if(std::string(directory) == std::string("eleTau_vbf" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_vbf" )){ category_extra = "VBF tag"; } if(std::string(directory) == std::string("eleTau_vbf_loose" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_vbf_loose" )){ category_extra = "Loose VBF tag"; } if(std::string(directory) == std::string("eleTau_vbf_tight" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_vbf_tight" )){ category_extra = "Tight VBF tag"; } if(std::string(directory) == std::string("eleTau_nobtag" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_nobtag" )){ category_extra = "no b-tag"; } if(std::string(directory) == std::string("eleTau_btag" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_btag" )){ category_extra = "b-tag"; } if(std::string(directory) == std::string("eleTau_nobtag_low" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_nobtag_low" )){ category_extra = "no b-tag"; } if(std::string(directory) == std::string("eleTau_nobtag_low" )){ category_extra2 = "low p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_nobtag_medium" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_nobtag_medium" )){ category_extra = "no b-tag"; } if(std::string(directory) == std::string("eleTau_nobtag_medium" )){ category_extra2 = "medium p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_nobtag_high" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_nobtag_high" )){ category_extra = "no b-tag"; } if(std::string(directory) == std::string("eleTau_nobtag_high" )){ category_extra2 = "high p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_btag_low" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_btag_low" )){ category_extra = "b-tag"; } if(std::string(directory) == std::string("eleTau_btag_low" )){ category_extra2 = "low p_{T}^{#tau_{h}}"; } if(std::string(directory) == std::string("eleTau_btag_high" )){ category = "e#tau_{h}"; } if(std::string(directory) == std::string("eleTau_btag_high" )){ category_extra = "b-tag"; } if(std::string(directory) == std::string("eleTau_btag_high" )){ category_extra2 = "high p_{T}^{#tau_{h}}"; } const char* dataset; #ifdef MSSM if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "#scale[1.5]{CMS} h,H,A#rightarrow#tau#tau 4.9 fb^{-1} (7 TeV)";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "#scale[1.5]{CMS} h,H,A#rightarrow#tau#tau 19.7 fb^{-1} (8 TeV)";} #else if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "CMS, 4.9 fb^{-1} at 7 TeV";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS, 19.7 fb^{-1} at 8 TeV";} #endif TFile* input = new TFile(inputfile.c_str()); #ifdef MSSM TFile* input2 = new TFile((inputfile+"_$MA_$TANB").c_str()); #endif TH1F* Fakes = refill((TH1F*)input->Get(TString::Format("%s/QCD" , directory)), "QCD"); InitHist(Fakes, "", "", TColor::GetColor(250,202,255), 1001); TH1F* EWK0 = refill((TH1F*)input->Get(TString::Format("%s/VV" , directory)), "VV" ); InitHist(EWK0 , "", "", TColor::GetColor(222,90,106), 1001); TH1F* EWK1 = refill((TH1F*)input->Get(TString::Format("%s/W" , directory)), "W" ); InitHist(EWK1 , "", "", TColor::GetColor(222,90,106), 1001); #ifdef EXTRA_SAMPLES TH1F* EWK2 = refill((TH1F*)input->Get(TString::Format("%s/ZJ" , directory)), "ZJ" ); InitHist(EWK2 , "", "", TColor::GetColor(100,182,232), 1001); TH1F* EWK = refill((TH1F*)input->Get(TString::Format("%s/ZL" , directory)), "ZL" ); InitHist(EWK , "", "", TColor::GetColor(100,182,232), 1001); #else TH1F* EWK = refill((TH1F*)input->Get(TString::Format("%s/ZLL" , directory)), "ZLL"); InitHist(EWK , "", "", TColor::GetColor(100,182,232), 1001); #endif TH1F* ttbar = refill((TH1F*)input->Get(TString::Format("%s/TT" , directory)), "TT" ); InitHist(ttbar, "", "", TColor::GetColor(155,152,204), 1001); TH1F* Ztt = refill((TH1F*)input->Get(TString::Format("%s/ZTT" , directory)), "ZTT"); InitHist(Ztt , "", "", TColor::GetColor(248,206,104), 1001); #ifdef MSSM TH1F* ggH = refill((TH1F*)input2->Get(TString::Format("%s/ggH$MA" , directory)), "ggH"); InitSignal(ggH); ggH->Scale($TANB); TH1F* bbH = refill((TH1F*)input2->Get(TString::Format("%s/bbH$MA" , directory)), "bbH"); InitSignal(bbH); bbH->Scale($TANB); #else #ifndef DROP_SIGNAL TH1F* ggH = refill((TH1F*)input->Get(TString::Format("%s/ggH125" , directory)), "ggH"); InitSignal(ggH); ggH->Scale(SIGNAL_SCALE); TH1F* qqH = refill((TH1F*)input->Get(TString::Format("%s/qqH125" , directory)), "qqH"); InitSignal(qqH); qqH->Scale(SIGNAL_SCALE); TH1F* VH = refill((TH1F*)input->Get(TString::Format("%s/VH125" , directory)), "VH" ); InitSignal(VH ); VH ->Scale(SIGNAL_SCALE); #endif #endif #ifdef ASIMOV TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs_asimov", directory)), "data", true); #else TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs", directory)), "data", true); #endif InitHist(data, "#bf{m_{#tau#tau} [GeV]}", "#bf{dN/dm_{#tau#tau} [1/GeV]}"); InitData(data); TH1F* ref=(TH1F*)Fakes->Clone("ref"); ref->Add(EWK0 ); ref->Add(EWK1 ); #ifdef EXTRA_SAMPLES ref->Add(EWK2 ); #endif ref->Add(EWK ); ref->Add(ttbar); ref->Add(Ztt ); double unscaled[7]; unscaled[0] = Fakes->Integral(); unscaled[1] = EWK ->Integral(); unscaled[1]+= EWK0 ->Integral(); unscaled[1]+= EWK1 ->Integral(); #ifdef EXTRA_SAMPLES unscaled[1]+= EWK2 ->Integral(); #endif unscaled[2] = ttbar->Integral(); unscaled[3] = Ztt ->Integral(); #ifdef MSSM unscaled[4] = ggH ->Integral(); unscaled[5] = bbH ->Integral(); unscaled[6] = 0; #else #ifndef DROP_SIGNAL unscaled[4] = ggH ->Integral(); unscaled[5] = qqH ->Integral(); unscaled[6] = VH ->Integral(); #endif #endif if(scaled){ /* Fakes = refill(shape_histos(Fakes, datacard, "QCD"), "QCD"); EWK0 = refill(shape_histos(EWK0, datacard, "VV"), "VV"); EWK1 = refill(shape_histos(EWK1, datacard, "W"), "W"); #ifdef EXTRA_SAMPLES EWK2 = refill(shape_histos(EWK2, datacard, "ZJ"), "ZJ"); EWK = refill(shape_histos(EWK, datacard, "ZL"), "ZL"); #else // EWK = refill(shape_histos(EWK, datacard, "ZLL"), "ZLL"); #endif ttbar = refill(shape_histos(ttbar, datacard, "TT"), "TT"); Ztt = refill(shape_histos(Ztt, datacard, "ZTT"), "ZTT"); #ifdef MSSM ggH = refill(shape_histos(ggH, datacard, "ggH$MA"), "ggH$MA"); bbH = refill(shape_histos(bbH, datacard, "bbH$MA"), "bbH$MA"); #else #ifndef DROP_SIGNAL ggH = refill(shape_histos(ggH, datacard, "ggH"), "ggH"); qqH = refill(shape_histos(qqH, datacard, "qqH"), "qqH"); VH = refill(shape_histos(VH, datacard, "VH"), "VH"); #endif #endif */ rescale(Fakes, 7); rescale(EWK0 , 6); rescale(EWK1 , 3); #ifdef EXTRA_SAMPLES rescale(EWK2 , 4); rescale(EWK , 5); #else rescale(EWK , 4); #endif rescale(ttbar, 2); rescale(Ztt , 1); #ifdef MSSM rescale(ggH , 8); rescale(bbH , 9); #else #ifndef DROP_SIGNAL rescale(ggH , 8); rescale(qqH , 9); rescale(VH ,10); #endif #endif } TH1F* scales[7]; scales[0] = new TH1F("scales-Fakes", "", 7, 0, 7); scales[0]->SetBinContent(1, unscaled[0]>0 ? (Fakes->Integral()/unscaled[0]-1.) : 0.); scales[1] = new TH1F("scales-EWK" , "", 7, 0, 7); scales[1]->SetBinContent(2, unscaled[1]>0 ? ((EWK ->Integral() +EWK0 ->Integral() +EWK1 ->Integral() #ifdef EXTRA_SAMPLES +EWK2 ->Integral() #endif )/unscaled[1]-1.) : 0.); scales[2] = new TH1F("scales-ttbar", "", 7, 0, 7); scales[2]->SetBinContent(3, unscaled[2]>0 ? (ttbar->Integral()/unscaled[2]-1.) : 0.); scales[3] = new TH1F("scales-Ztt" , "", 7, 0, 7); scales[3]->SetBinContent(4, unscaled[3]>0 ? (Ztt ->Integral()/unscaled[3]-1.) : 0.); #ifdef MSSM scales[4] = new TH1F("scales-ggH" , "", 7, 0, 7); scales[4]->SetBinContent(5, unscaled[4]>0 ? (ggH ->Integral()/unscaled[4]-1.) : 0.); scales[5] = new TH1F("scales-bbH" , "", 7, 0, 7); scales[5]->SetBinContent(6, unscaled[5]>0 ? (bbH ->Integral()/unscaled[5]-1.) : 0.); scales[6] = new TH1F("scales-NONE" , "", 7, 0, 7); scales[6]->SetBinContent(7, 0.); #else #ifndef DROP_SIGNAL scales[4] = new TH1F("scales-ggH" , "", 7, 0, 7); scales[4]->SetBinContent(5, unscaled[4]>0 ? (ggH ->Integral()/unscaled[4]-1.) : 0.); scales[5] = new TH1F("scales-qqH" , "", 7, 0, 7); scales[5]->SetBinContent(6, unscaled[5]>0 ? (qqH ->Integral()/unscaled[5]-1.) : 0.); scales[6] = new TH1F("scales-VH" , "", 7, 0, 7); scales[6]->SetBinContent(7, unscaled[6]>0 ? (VH ->Integral()/unscaled[6]-1.) : 0.); #endif #endif EWK0 ->Add(Fakes); EWK1 ->Add(EWK0 ); #ifdef EXTRA_SAMPLES EWK2 ->Add(EWK1 ); EWK ->Add(EWK2 ); #else EWK ->Add(EWK1 ); #endif ttbar->Add(EWK ); Ztt ->Add(ttbar); if(log){ #ifdef MSSM ggH ->Add(bbH); #else #ifndef DROP_SIGNAL qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } else{ #ifdef MSSM bbH ->Add(Ztt); ggH ->Add(bbH); #else #ifndef DROP_SIGNAL VH ->Add(Ztt); qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } /* Mass plot before and after fit */ TCanvas *canv = MakeCanvas("canv", "histograms", 600, 600); canv->cd(); if(log){ canv->SetLogy(1); } #if defined MSSM if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(345)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(UPPER_EDGE)); }; #else data->GetXaxis()->SetRange(0, data->FindBin(345)); #endif data->SetNdivisions(505); data->SetMinimum(min); #ifndef DROP_SIGNAL data->SetMaximum(max>0 ? max : std::max(std::max(maximum(data, log), maximum(Ztt, log)), maximum(ggH, log))); #else data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(Ztt, log))); #endif data->Draw("e"); TH1F* errorBand = (TH1F*)Ztt ->Clone("errorBand"); errorBand ->SetMarkerSize(0); errorBand ->SetFillColor(13); errorBand ->SetFillStyle(3013); errorBand ->SetLineWidth(1); for(int idx=0; idx<errorBand->GetNbinsX(); ++idx){ if(errorBand->GetBinContent(idx)>0){ std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl; break; } } if(log){ Ztt ->Draw("histsame"); ttbar->Draw("histsame"); EWK ->Draw("histsame"); EWK1 ->Draw("histsame"); Fakes->Draw("histsame"); $DRAW_ERROR #ifndef DROP_SIGNAL ggH ->Draw("histsame"); #endif } else{ #ifndef DROP_SIGNAL ggH ->Draw("histsame"); #endif Ztt ->Draw("histsame"); ttbar->Draw("histsame"); EWK ->Draw("histsame"); EWK1 ->Draw("histsame"); Fakes->Draw("histsame"); $DRAW_ERROR } data->Draw("esame"); canv->RedrawAxis(); //CMSPrelim(dataset, "#tau_{e}#tau_{h}", 0.17, 0.835); CMSPrelim(dataset, "", 0.16, 0.835); #if defined MSSM TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "tlbrNDC"); if (category_extra2!="") chan = new TPaveText(0.20, 0.69+0.061, 0.32, 0.74+0.161, "tlbrNDC"); #else TPaveText* chan = new TPaveText(0.52, 0.35, 0.91, 0.55, "tlbrNDC"); #endif chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.05 ); chan->SetTextColor( 1 ); chan->SetTextFont ( 62 ); chan->AddText(category); chan->AddText(category_extra); #if defined MSSM if (category_extra2!="") chan->AddText(category_extra2); #else chan->AddText(category_extra2); #endif chan->Draw(); /* TPaveText* cat = new TPaveText(0.20, 0.71+0.061, 0.32, 0.71+0.161, "NDC"); cat->SetBorderSize( 0 ); cat->SetFillStyle( 0 ); cat->SetTextAlign( 12 ); cat->SetTextSize ( 0.05 ); cat->SetTextColor( 1 ); cat->SetTextFont ( 62 ); cat->AddText(category_extra); cat->Draw(); TPaveText* cat2 = new TPaveText(0.20, 0.66+0.061, 0.32, 0.66+0.161, "NDC"); cat2->SetBorderSize( 0 ); cat2->SetFillStyle( 0 ); cat2->SetTextAlign( 12 ); cat2->SetTextSize ( 0.05 ); cat2->SetTextColor( 1 ); cat2->SetTextFont ( 62 ); cat2->AddText(category_extra2); cat2->Draw(); */ #ifdef MSSM TPaveText* massA = new TPaveText(0.53, 0.44+0.061, 0.95, 0.44+0.151, "NDC"); massA->SetBorderSize( 0 ); massA->SetFillStyle( 0 ); massA->SetTextAlign( 12 ); massA->SetTextSize ( 0.03 ); massA->SetTextColor( 1 ); massA->SetTextFont ( 62 ); massA->AddText("MSSM m^{h}_{max} scenario"); massA->AddText("m_{A}=$MA GeV, tan#beta=$TANB"); massA->Draw(); #endif #ifdef MSSM TLegend* leg = new TLegend(0.53, 0.60, 0.95, 0.90); SetLegendStyle(leg); leg->AddEntry(ggH , "h,A,H#rightarrow#tau#tau" , "L" ); #else TLegend* leg = new TLegend(0.52, 0.58, 0.92, 0.89); SetLegendStyle(leg); #ifndef DROP_SIGNAL if(SIGNAL_SCALE!=1){ leg->AddEntry(ggH , TString::Format("%.0f#timesH(125 GeV)#rightarrow#tau#tau", SIGNAL_SCALE) , "L" ); } else{ leg->AddEntry(ggH , "SM H(125 GeV)#rightarrow#tau#tau" , "L" ); } #endif #endif #ifdef ASIMOV leg->AddEntry(data , "sum(bkg) + H(125)" , "LP"); #else leg->AddEntry(data , "Observed" , "LP"); #endif leg->AddEntry(Ztt , "Z#rightarrow#tau#tau" , "F" ); leg->AddEntry(EWK , "Z#rightarrow ee" , "F" ); leg->AddEntry(EWK1 , "W+jets" , "F" ); leg->AddEntry(ttbar, "t#bar{t}" , "F" ); leg->AddEntry(Fakes, "QCD" , "F" ); $ERROR_LEGEND leg->Draw(); /* Ratio Data over MC */ TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400); canv0->SetGridx(); canv0->SetGridy(); canv0->cd(); TH1F* model = (TH1F*)Ztt ->Clone("model"); TH1F* test1 = (TH1F*)data->Clone("test1"); for(int ibin=0; ibin<test1->GetNbinsX(); ++ibin){ //the small value in case of 0 entries in the model is added to prevent the chis2 test from failing model->SetBinContent(ibin+1, model->GetBinContent(ibin+1)>0 ? model->GetBinContent(ibin+1)*model->GetBinWidth(ibin+1) : 0.01); model->SetBinError (ibin+1, CONVERVATIVE_CHI2 ? 0. : model->GetBinError (ibin+1)*model->GetBinWidth(ibin+1)); test1->SetBinContent(ibin+1, test1->GetBinContent(ibin+1)*test1->GetBinWidth(ibin+1)); test1->SetBinError (ibin+1, test1->GetBinError (ibin+1)*test1->GetBinWidth(ibin+1)); } double chi2prob = test1->Chi2Test (model,"PUW"); std::cout << "chi2prob:" << chi2prob << std::endl; double chi2ndof = test1->Chi2Test (model,"CHI2/NDFUW"); std::cout << "chi2ndf :" << chi2ndof << std::endl; double ksprob = test1->KolmogorovTest(model); std::cout << "ksprob :" << ksprob << std::endl; double ksprobpe = test1->KolmogorovTest(model,"DX"); std::cout << "ksprobpe:" << ksprobpe << std::endl; std::vector<double> edges; TH1F* zero = (TH1F*)ref->Clone("zero"); zero->Clear(); TH1F* rat1 = (TH1F*)data->Clone("rat1"); for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ rat1->SetBinContent(ibin+1, Ztt->GetBinContent(ibin+1)>0 ? data->GetBinContent(ibin+1)/Ztt->GetBinContent(ibin+1) : 0); rat1->SetBinError (ibin+1, Ztt->GetBinContent(ibin+1)>0 ? data->GetBinError (ibin+1)/Ztt->GetBinContent(ibin+1) : 0); zero->SetBinContent(ibin+1, 0.); zero->SetBinError (ibin+1, Ztt->GetBinContent(ibin+1)>0 ? Ztt ->GetBinError (ibin+1)/Ztt->GetBinContent(ibin+1) : 0); } for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ if(rat1->GetBinContent(ibin+1)>0){ edges.push_back(TMath::Abs(rat1->GetBinContent(ibin+1)-1.)+TMath::Abs(rat1->GetBinError(ibin+1))); // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.); } } float range = 0.1; std::sort(edges.begin(), edges.end()); if (edges[edges.size()-2]>0.1) { range = 0.2; } if (edges[edges.size()-2]>0.2) { range = 0.5; } if (edges[edges.size()-2]>0.5) { range = 1.0; } if (edges[edges.size()-2]>1.0) { range = 1.5; } if (edges[edges.size()-2]>1.5) { range = 2.0; } rat1->SetLineColor(kBlack); rat1->SetFillColor(kGray ); rat1->SetMaximum(+range); rat1->SetMinimum(-range); rat1->GetYaxis()->CenterTitle(); rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}"); rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); rat1->Draw(); zero->SetFillStyle( 3013); zero->SetFillColor(kBlack); zero->SetLineColor(kBlack); zero->SetMarkerSize(0.1); zero->Draw("e2histsame"); canv0->RedrawAxis(); TPaveText* stat1 = new TPaveText(0.20, 0.76+0.061, 0.32, 0.76+0.161, "NDC"); stat1->SetBorderSize( 0 ); stat1->SetFillStyle( 0 ); stat1->SetTextAlign( 12 ); stat1->SetTextSize ( 0.05 ); stat1->SetTextColor( 1 ); stat1->SetTextFont ( 62 ); stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f", chi2ndof, chi2prob)); //stat1->AddText(TString::Format("#chi^{2}/ndf=%.3f, P(#chi^{2})=%.3f, P(KS)=%.3f", chi2ndof, chi2prob, ksprob)); stat1->Draw(); /* Ratio After fit over Prefit */ TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400); canv1->SetGridx(); canv1->SetGridy(); canv1->cd(); edges.clear(); TH1F* rat2 = (TH1F*) Ztt->Clone("rat2"); for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ rat2->SetBinContent(ibin+1, ref->GetBinContent(ibin+1)>0 ? Ztt->GetBinContent(ibin+1)/ref->GetBinContent(ibin+1) : 0); rat2->SetBinError (ibin+1, ref->GetBinContent(ibin+1)>0 ? Ztt->GetBinError (ibin+1)/ref->GetBinContent(ibin+1) : 0); } for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ if(rat2->GetBinContent(ibin+1)>0){ edges.push_back(TMath::Abs(rat2->GetBinContent(ibin+1)-1.)+TMath::Abs(rat2->GetBinError(ibin+1))); // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat2 ->SetBinContent(ibin+1, rat2->GetBinContent(ibin+1)-1.); } } range = 0.1; std::sort(edges.begin(), edges.end()); if (edges[edges.size()-2]>0.1) { range = 0.2; } if (edges[edges.size()-2]>0.2) { range = 0.5; } if (edges[edges.size()-2]>0.5) { range = 1.0; } if (edges[edges.size()-2]>1.0) { range = 1.5; } if (edges[edges.size()-2]>1.5) { range = 2.0; } #if defined MSSM if(!log){ rat2->GetXaxis()->SetRange(0, rat2->FindBin(345)); } else{ rat2->GetXaxis()->SetRange(0, rat2->FindBin(UPPER_EDGE)); }; #else rat2->GetXaxis()->SetRange(0, rat2->FindBin(345)); #endif rat2->SetNdivisions(505); rat2->SetLineColor(kRed+ 3); rat2->SetMarkerColor(kRed+3); rat2->SetMarkerSize(1.1); rat2->SetMaximum(+range); rat2->SetMinimum(-range); rat2->GetYaxis()->SetTitle("#bf{Postfit/Prefit-1}"); rat2->GetYaxis()->CenterTitle(); rat2->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); rat2->Draw(); zero->SetFillStyle( 3013); zero->SetFillColor(kBlack); zero->SetLineColor(kBlack); zero->Draw("e2histsame"); canv1->RedrawAxis(); /* Relative shift per sample */ TCanvas *canv2 = MakeCanvas("canv2", "histograms", 600, 400); canv2->SetGridx(); canv2->SetGridy(); canv2->cd(); InitHist (scales[0], "", "", TColor::GetColor(250,202,255), 1001); InitHist (scales[1], "", "", TColor::GetColor(222,90,106), 1001); InitHist (scales[2], "", "", TColor::GetColor(155,152,204), 1001); InitHist (scales[3], "", "", TColor::GetColor(248,206,104), 1001); #ifndef DROP_SIGNAL InitSignal(scales[4]); InitSignal(scales[5]); InitSignal(scales[6]); #endif scales[0]->Draw(); scales[0]->GetXaxis()->SetBinLabel(1, "#bf{Fakes}"); scales[0]->GetXaxis()->SetBinLabel(2, "#bf{EWK}" ); scales[0]->GetXaxis()->SetBinLabel(3, "#bf{ttbar}"); scales[0]->GetXaxis()->SetBinLabel(4, "#bf{Ztt}" ); #ifdef MSSM scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(6, "#bf{bbH}" ); scales[0]->GetXaxis()->SetBinLabel(7, "NONE" ); #else scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(6, "#bf{qqH}" ); scales[0]->GetXaxis()->SetBinLabel(7, "#bf{VH}" ); #endif scales[0]->SetMaximum(+0.5); scales[0]->SetMinimum(-0.5); scales[0]->GetYaxis()->CenterTitle(); scales[0]->GetYaxis()->SetTitle("#bf{Postfit/Prefit-1}"); scales[1]->Draw("same"); scales[2]->Draw("same"); scales[3]->Draw("same"); #ifndef DROP_SIGNAL scales[4]->Draw("same"); scales[5]->Draw("same"); scales[6]->Draw("same"); #endif TH1F* zero_samples = (TH1F*)scales[0]->Clone("zero_samples"); zero_samples->Clear(); zero_samples->SetBinContent(1,0.); zero_samples->Draw("same"); canv2->RedrawAxis(); /* prepare output */ bool isSevenTeV = std::string(inputfile).find("7TeV")!=std::string::npos; canv ->Print(TString::Format("%s_%sfit_%s_%s.png" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv ->Print(TString::Format("%s_%sfit_%s_%s.pdf" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv ->Print(TString::Format("%s_%sfit_%s_%s.eps" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); if(!log || FULLPLOTS) { canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); } if((!log && scaled) || FULLPLOTS) { canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN")); } TFile* output = new TFile(TString::Format("%s_%sfit_%s_%s.root", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "LIN"), "update"); output->cd(); data ->Write("data_obs"); Fakes->Write("Fakes" ); EWK ->Write("Zee" ); EWK1 ->Write("EWK" ); //EWK ->Write("EWK" ); EWK1 ->Write("EWK1" ); ttbar->Write("ttbar" ); Ztt ->Write("Ztt" ); #ifdef MSSM ggH ->Write("ggH" ); bbH ->Write("bbH" ); #else #ifndef DROP_SIGNAL ggH ->Write("ggH" ); qqH ->Write("qqH" ); VH ->Write("VH" ); #endif #endif if(errorBand){ errorBand->Write("errorBand"); } output->Close(); delete errorBand; delete model; delete test1; delete zero; delete rat1; delete rat2; delete zero_samples; delete ref; }
//************************************************************* void arrangeCanvas(TCanvas *canv,TH1F* meanplots[100],TH1F* widthplots[100],Int_t nFiles, TString LegLabels[10], bool onlyBias){ //************************************************************* TPaveText *ali = new TPaveText(0.18,0.87,0.50,0.93,"NDC"); ali->SetFillColor(10); ali->SetTextColor(1); ali->SetTextFont(42); ali->SetMargin(0.); ali->SetLineColor(10); ali->SetShadowColor(10); // pt->SetTextAlign(11); TText *alitext = ali->AddText("Alignment: PCL"); //"Preliminary 2015 - 0T collision data"); alitext->SetTextSize(0.04); TLegend *lego = new TLegend(0.18,0.80,0.78,0.92); lego-> SetNColumns(2); //TLegend *lego = new TLegend(0.18,0.77,0.50,0.86); lego->SetFillColor(10); lego->SetTextSize(0.04); lego->SetTextFont(42); lego->SetFillColor(10); lego->SetLineColor(10); lego->SetShadowColor(10); TPaveText *pt = NULL; TPaveText *pt2 = NULL; TPaveText *pt3 = NULL; if(!onlyBias){ pt =new TPaveText(0.179,0.955,0.260,0.985,"NDC"); } else { pt =new TPaveText(0.179,0.955,0.260,0.985,"NDC"); } pt->SetFillColor(10); pt->SetTextColor(1); pt->SetTextFont(61); // pt->SetTextAlign(11); TText *text1 = pt->AddText("CMS"); //"Preliminary 2015 - 0T collision data"); text1->SetTextSize(0.05); float extraOverCmsTextSize = 0.76; if(!onlyBias){ pt2 =new TPaveText(0.3,0.95,0.503,0.98,"NDC"); } else { pt2 =new TPaveText(0.3,0.95,0.503,0.98,"NDC"); } pt2->SetFillColor(10); pt2->SetTextColor(1); pt2->SetTextFont(52); pt2->SetTextAlign(22); TText *text2 = pt2->AddText("work in progress"); text2->SetTextSize(0.05*extraOverCmsTextSize); if(!onlyBias){ pt3 =new TPaveText(0.6,0.95,0.98,0.98,"NDC"); } else { pt3 =new TPaveText(0.6,0.95,0.98,0.98,"NDC"); } pt3->SetFillColor(10); pt3->SetTextColor(1); pt3->SetTextFont(42); // pt2->SetTextAlign(11); TText *text3 = pt3->AddText("3.8T collision data 2015"); text3->SetTextSize(0.05*extraOverCmsTextSize); canv->SetFillColor(10); if(!onlyBias) { canv->Divide(2,1); canv->cd(1)->SetBottomMargin(0.12); canv->cd(1)->SetLeftMargin(0.17); canv->cd(1)->SetRightMargin(0.02); canv->cd(1)->SetTopMargin(0.06); canv->cd(2)->SetBottomMargin(0.12); canv->cd(2)->SetLeftMargin(0.17); canv->cd(2)->SetRightMargin(0.02); canv->cd(2)->SetTopMargin(0.06); canv->cd(1); } else { canv->cd()->SetBottomMargin(0.14); canv->cd()->SetLeftMargin(0.17); canv->cd()->SetRightMargin(0.02); canv->cd()->SetTopMargin(0.06); canv->cd(); } Double_t absmin(999.); Double_t absmax(-999.); for(Int_t i=0; i<nFiles; i++){ if(meanplots[i]->GetMaximum()>absmax) absmax = meanplots[i]->GetMaximum(); if(meanplots[i]->GetMinimum()<absmin) absmin = meanplots[i]->GetMinimum(); } Double_t safeDelta=(absmax-absmin)/2.; Double_t theExtreme=std::max(absmax,TMath::Abs(absmin)); for(Int_t i=0; i<nFiles; i++){ TString myTitle = meanplots[i]->GetName(); float axmin = -999; float axmax = 999.; int ndiv = 510; if(myTitle.Contains("eta")){ axmin = -2.5; axmax = 2.5; ndiv = 505; } else if (myTitle.Contains("phi")){ axmin = -TMath::Pi(); axmax = TMath::Pi(); ndiv = 510; } else { std::cout<<"unrecongnized variable"; } meanplots[i]->GetXaxis()->SetLabelOffset(999); meanplots[i]->GetXaxis()->SetTickLength(0); // Redraw the new axis gPad->Update(); TGaxis *newaxis = new TGaxis(gPad->GetUxmin(),gPad->GetUymin(), gPad->GetUxmax(),gPad->GetUymin(), axmin, axmax, //meanplots[i]->GetXaxis()->GetXmin(), //meanplots[i]->GetXaxis()->GetXmax(), ndiv,"SDH"); TGaxis *newaxisup = new TGaxis(gPad->GetUxmin(),gPad->GetUymax(), gPad->GetUxmax(),gPad->GetUymax(), axmin, axmax, //meanplots[i]->GetXaxis()->GetXmin(), //meanplots[i]->GetXaxis()->GetXmax(), ndiv,"-SDH"); newaxis->SetLabelOffset(0.02); newaxis->SetLabelFont(42); newaxis->SetLabelSize(.05); newaxis->Draw(); newaxisup->SetLabelOffset(-0.02); newaxisup->SetLabelFont(42); newaxisup->SetLabelSize(0); newaxisup->Draw(); if(i==0){ //meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta/2.,absmax+safeDelta); std::cout<<"name is: "<< meanplots[i]->GetName() << " absmin:" <<absmin<<" absmax: "<<absmax<<" safeDelta: "<<safeDelta<<std::endl; TString theTitle = meanplots[i]->GetName(); if( theTitle.Contains("Norm")){ meanplots[i]->GetYaxis()->SetRangeUser(std::min(-0.48,absmin-safeDelta),std::max(0.48,absmax+safeDelta)); } else { if(!onlyBias){ meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta,absmax+safeDelta); } else { meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme-(TMath::Abs(absmin)/10.),theExtreme+(TMath::Abs(absmax/10.))); } //meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme,theExtreme); } meanplots[i]->Draw("e1"); if(onlyBias){ Int_t nbins = meanplots[i]->GetNbinsX(); Double_t lowedge = meanplots[i]->GetBinLowEdge(1); Double_t highedge = meanplots[i]->GetBinLowEdge(nbins+1); TH1F* hzero = DrawZero(meanplots[i],nbins,lowedge,highedge); hzero->Draw("PLsame"); } } else meanplots[i]->Draw("e1sames"); lego->AddEntry(meanplots[i],LegLabels[i]); } //ali->Draw(); lego->Draw(); pt->Draw("same"); pt2->Draw("same"); pt3->Draw("same"); if(!onlyBias){ canv->cd(2); Double_t absmax2(-999.); for(Int_t i=0; i<nFiles; i++){ if(widthplots[i]->GetMaximum()>absmax2) absmax2 = widthplots[i]->GetMaximum(); } Double_t safeDelta2=absmax2/3.; for(Int_t i=0; i<nFiles; i++){ TString myTitle = widthplots[i]->GetName(); float axmin = -999; float axmax = 999.; int ndiv = 510; if(myTitle.Contains("eta")){ axmin = -2.5; axmax = 2.5; ndiv = 505; } else if (myTitle.Contains("phi")){ axmin = -TMath::Pi(); axmax = TMath::Pi(); ndiv = 510; } else { std::cout<<"unrecongnized variable"; } widthplots[i]->GetXaxis()->SetLabelOffset(999); widthplots[i]->GetXaxis()->SetTickLength(0); // Redraw the new axis gPad->Update(); TGaxis *newaxis2 = new TGaxis(gPad->GetUxmin(),gPad->GetUymin(), gPad->GetUxmax(),gPad->GetUymin(), axmin, axmax, //widthplots[i]->GetXaxis()->GetXmin(), //widthplots[i]->GetXaxis()->GetXmax(), ndiv,"SDH"); newaxis2->SetLabelOffset(0.02); newaxis2->SetLabelFont(42); newaxis2->SetLabelSize(.05); newaxis2->Draw(); TGaxis *newaxis2up = new TGaxis(gPad->GetUxmin(),gPad->GetUymax(), gPad->GetUxmax(),gPad->GetUymax(), axmin, axmax, //widthplots[i]->GetXaxis()->GetXmin(), //widthplots[i]->GetXaxis()->GetXmax(), ndiv,"-SDH"); newaxis2up->SetLabelOffset(-0.02); newaxis2up->SetLabelFont(42); newaxis2up->SetLabelSize(0.); newaxis2up->Draw(); if(i==0) widthplots[i]->Draw("e1"); else widthplots[i]->Draw("e1sames"); widthplots[i]->SetMinimum(0.5); widthplots[i]->SetMaximum(absmax2+safeDelta2); } lego->Draw(); pt->Draw("same"); pt2->Draw("same"); pt3->Draw("same"); } }
void makePlot(const TString& title, TGraphAsymmErrors* graph_Data_passed, TF1* fit_Data_passed, const TString& legendEntry_Data_passed, TGraphAsymmErrors* graph_mcSum_passed, TF1* fit_mcSum_passed, const TString& legendEntry_mcSum_passed, TGraphAsymmErrors* graph_Data_failed, TF1* fit_Data_failed, const TString& legendEntry_Data_failed, TGraphAsymmErrors* graph_mcSum_failed, TF1* fit_mcSum_failed, const TString& legendEntry_mcSum_failed, const TString& outputFileName) { TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 900); canvas->SetFillColor(10); canvas->SetBorderSize(2); canvas->SetLeftMargin(0.12); canvas->SetBottomMargin(0.12); //TPad* topPad = new TPad("topPad", "topPad", 0.00, 0.35, 1.00, 1.00); TPad* topPad = new TPad("topPad", "topPad", 0.00, 1.00 - 0.65*(0.93/0.84), 1.00, 1.00); topPad->SetFillColor(10); topPad->SetTopMargin(0.04); topPad->SetLeftMargin(0.15); //topPad->SetBottomMargin(0.03); topPad->SetBottomMargin(0.12); topPad->SetRightMargin(0.05); topPad->SetGridx(); topPad->SetGridy(); canvas->cd(); topPad->Draw(); topPad->cd(); TH1* dummyHistogram_top = new TH1D("dummyHistogram_top", "dummyHistogram_top", 10, 0., 100.); dummyHistogram_top->SetTitle(""); dummyHistogram_top->SetStats(false); dummyHistogram_top->SetMaximum(1.2); dummyHistogram_top->SetMinimum(0.); TAxis* xAxis_top = dummyHistogram_top->GetXaxis(); xAxis_top->SetTitle("calo-E_{T}^{miss} / GeV"); xAxis_top->SetTitleOffset(1.15); //xAxis_top->SetLabelColor(10); //xAxis_top->SetTitleColor(10); TAxis* yAxis_top = dummyHistogram_top->GetYaxis(); yAxis_top->SetTitle("#varepsilon"); yAxis_top->SetTitleOffset(1.2); dummyHistogram_top->Draw(); //dummyHistogram_top->Draw("axis"); //graph_Data_passed->SetLineColor(4); //graph_Data_passed->SetMarkerColor(4); //graph_Data_passed->SetMarkerStyle(20); //graph_Data_passed->Draw("p"); //fit_Data_passed->SetLineColor(graph_Data_passed->GetLineColor()); //fit_Data_passed->SetLineWidth(2); //fit_Data_passed->Draw("same"); graph_mcSum_passed->SetLineColor(7); graph_mcSum_passed->SetMarkerColor(7); graph_mcSum_passed->SetMarkerStyle(24); graph_mcSum_passed->Draw("p"); fit_mcSum_passed->SetLineColor(graph_mcSum_passed->GetLineColor()); fit_mcSum_passed->SetLineWidth(2); fit_mcSum_passed->Draw("same"); graph_Data_failed->SetLineColor(2); graph_Data_failed->SetMarkerColor(2); graph_Data_failed->SetMarkerStyle(21); //graph_Data_failed->Draw("p"); fit_Data_failed->SetLineColor(graph_Data_failed->GetLineColor()); fit_Data_failed->SetLineWidth(2); //fit_Data_failed->Draw("same"); graph_mcSum_failed->SetLineColor(6); graph_mcSum_failed->SetMarkerColor(6); graph_mcSum_failed->SetMarkerStyle(25); graph_mcSum_failed->Draw("p"); fit_mcSum_failed->SetLineColor(graph_mcSum_failed->GetLineColor()); fit_mcSum_failed->SetLineWidth(2); fit_mcSum_failed->Draw("same"); TLegend* legend = new TLegend(0.61, 0.16, 0.89, 0.47, "", "brNDC"); legend->SetBorderSize(0); legend->SetFillColor(0); //legend->AddEntry(graph_Data_passed, legendEntry_Data_passed.Data(), "p"); legend->AddEntry(graph_mcSum_passed, legendEntry_mcSum_passed.Data(), "p"); //legend->AddEntry(graph_Data_failed, legendEntry_Data_failed.Data(), "p"); legend->AddEntry(graph_mcSum_failed, legendEntry_mcSum_failed.Data(), "p"); legend->Draw(); TPaveText* label = 0; if ( title.Length() > 0 ) { label = new TPaveText(0.175, 0.89, 0.48, 0.94, "NDC"); label->AddText(title.Data()); label->SetTextAlign(13); label->SetTextSize(0.045); label->SetFillStyle(0); label->SetBorderSize(0); label->Draw(); } TPad* bottomPad = new TPad("bottomPad", "bottomPad", 0.00, 0.00, 1.00, 0.35); bottomPad->SetFillColor(10); bottomPad->SetTopMargin(0.02); bottomPad->SetLeftMargin(0.15); bottomPad->SetBottomMargin(0.24); bottomPad->SetRightMargin(0.05); bottomPad->SetGridx(); bottomPad->SetGridy(); canvas->cd(); bottomPad->Draw(); bottomPad->cd(); TH1* dummyHistogram_bottom = new TH1D("dummyHistogram_bottom", "dummyHistogram_bottom", 10, 0., 100.); dummyHistogram_bottom->SetMinimum(-1.0); dummyHistogram_bottom->SetMaximum(+1.0); TAxis* xAxis_bottom = dummyHistogram_bottom->GetXaxis(); xAxis_bottom->SetTitle("calo-E_{T}^{miss} / GeV"); xAxis_bottom->SetTitleOffset(1.20); xAxis_bottom->SetLabelColor(1); xAxis_bottom->SetTitleColor(1); xAxis_bottom->SetTitleSize(0.08); xAxis_bottom->SetLabelOffset(0.02); xAxis_bottom->SetLabelSize(0.08); xAxis_bottom->SetTickLength(0.055); TAxis* yAxis_bottom = dummyHistogram_bottom->GetYaxis(); yAxis_bottom->SetTitle("#frac{Data-Simulation}{Simulation}"); yAxis_bottom->SetTitleOffset(0.85); yAxis_bottom->SetNdivisions(505); yAxis_bottom->CenterTitle(); yAxis_bottom->SetTitleSize(0.08); yAxis_bottom->SetLabelSize(0.08); yAxis_bottom->SetTickLength(0.04); dummyHistogram_bottom->SetTitle(""); dummyHistogram_bottom->SetStats(false); dummyHistogram_bottom->Draw("axis"); TGraphAsymmErrors* graph_Data_div_mc_passed = makeGraph_data_div_mc(graph_Data_passed, graph_mcSum_passed); graph_Data_div_mc_passed->SetLineColor(graph_Data_passed->GetLineColor()); graph_Data_div_mc_passed->SetMarkerColor(graph_Data_passed->GetMarkerColor()); graph_Data_div_mc_passed->SetMarkerStyle(graph_Data_passed->GetMarkerStyle()); graph_Data_div_mc_passed->Draw("p"); TF1* fit_Data_div_mc_passed = new TF1("fit_Data_div_mc_passed", &integralCrystalBall_f_div_f, fit_mcSum_passed->GetMinimumX(), fit_mcSum_passed->GetMaximumX(), 2*fit_mcSum_passed->GetNpar()); for ( int iPar = 0; iPar < fit_mcSum_passed->GetNpar(); ++iPar ) { fit_Data_div_mc_passed->SetParameter(iPar, fit_Data_passed->GetParameter(iPar)); fit_Data_div_mc_passed->SetParameter(iPar + fit_mcSum_passed->GetNpar(), fit_mcSum_passed->GetParameter(iPar)); } fit_Data_div_mc_passed->SetLineColor(graph_Data_div_mc_passed->GetLineColor()); fit_Data_div_mc_passed->SetLineWidth(2); fit_Data_div_mc_passed->Draw("same"); TGraphAsymmErrors* graph_Data_div_mc_failed = makeGraph_data_div_mc(graph_Data_failed, graph_mcSum_failed); graph_Data_div_mc_failed->SetLineColor(graph_Data_failed->GetLineColor()); graph_Data_div_mc_failed->SetMarkerColor(graph_Data_failed->GetMarkerColor()); graph_Data_div_mc_failed->SetMarkerStyle(graph_Data_failed->GetMarkerStyle()); graph_Data_div_mc_failed->Draw("p"); TF1* fit_Data_div_mc_failed = new TF1("fit_Data_div_mc_failed", &integralCrystalBall_f_div_f, fit_mcSum_failed->GetMinimumX(), fit_mcSum_failed->GetMaximumX(), 2*fit_mcSum_failed->GetNpar()); for ( int iPar = 0; iPar < fit_mcSum_failed->GetNpar(); ++iPar ) { fit_Data_div_mc_failed->SetParameter(iPar, fit_Data_failed->GetParameter(iPar)); fit_Data_div_mc_failed->SetParameter(iPar + fit_mcSum_failed->GetNpar(), fit_mcSum_failed->GetParameter(iPar)); } fit_Data_div_mc_failed->SetLineColor(graph_Data_div_mc_failed->GetLineColor()); fit_Data_div_mc_failed->SetLineWidth(2); fit_Data_div_mc_failed->Draw("same"); topPad->RedrawAxis(); bottomPad->RedrawAxis(); canvas->Update(); size_t idx = outputFileName.Last('.'); std::string outputFileName_plot = std::string(outputFileName.Data(), 0, idx); if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName.Data(), idx)).data()); //canvas->Print(std::string(outputFileName_plot).append(".png").data()); //canvas->Print(std::string(outputFileName_plot).append(".pdf").data()); topPad->Print(std::string(outputFileName_plot).append(".png").data()); topPad->Print(std::string(outputFileName_plot).append(".pdf").data()); delete legend; delete label; delete dummyHistogram_top; delete topPad; delete dummyHistogram_bottom; delete bottomPad; delete canvas; }
void PlotPhaseSpaceAutoTag2D( const TString &sim, Int_t time, Int_t index = 0,TString dcom = "p1:x1", const TString &options="") { #ifdef __CINT__ gSystem->Load("libplasma.so"); #endif PlasmaGlob::Initialize(); TString opt = options; // Palettes! gROOT->Macro("PlasmaPalettes.C"); if(opt.Contains("gridx")) { gStyle->SetPadGridX(1); } else if(opt.Contains("gridy")) { gStyle->SetPadGridY(1); } gStyle->SetTitleAlign(22); gStyle->SetPadRightMargin(0.17); // Margin for palettes in 2D histos gStyle->SetLabelFont(42,"xyz"); gStyle->SetTitleFont(42,"xyz"); // Load PData PData *pData = PData::Get(sim.Data()); 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(); // 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; //opt += "comovcenter"; // Centering time and z position: Double_t shiftz = 0.0; if(opt.Contains("center")) { Time -= zStartPlasma; if(opt.Contains("comov")) { // Centers on the head of the beam. Time += zStartBeam; shiftz += zStartBeam; } else { shiftz += zStartPlasma; } } if(opt.Contains("comov")) { Double_t v = pData->GetBeamVelocity(); if(v==0) v = 1.0; // If equals to 0 (default), then set to c. shiftz += v * pData->GetRealTime(); } TString sshiftz = Form("(x1-%f)",shiftz); //cout << Form("string = %s",sshiftz.Data()) << endl; TString sx1 = "x1"; dcom.ReplaceAll(sx1,sshiftz); //cout << Form("%s replaced by %s result = %s",sx1.Data(),sshiftz.Data(),dcom.Data()) << endl; // ---- // Weighting by the macroparticle charge: char cutString[128]; sprintf(cutString,"TMath::Abs(q)"); TCut Cut = cutString; // Bining, intervals, labels, etc. Int_t xNbin = 200; Int_t yNbin = 200; // Pointer to data TTree TTree *tree = pData->GetTreeRaw(pData->GetRawFileName(index)->c_str(),opt); // Get phasespace histos TH2F *hPha2D = NULL; char hName[24]; sprintf(hName,"hPha2D"); char dCom[128]; sprintf(dCom,"%s>>%s(%i,%i)",dcom.Data(),hName,xNbin,yNbin); tree->Draw(dCom,Cut,"goff"); hPha2D = (TH2F*) gROOT->FindObject(hName); hPha2D->GetXaxis()->CenterTitle(); hPha2D->GetYaxis()->CenterTitle(); hPha2D->GetZaxis()->CenterTitle(); // hPha2D->GetXaxis()->SetTitle("#zeta [c/#omega_{p}]"); // hPha2D->GetYaxis()->SetTitle("y [c/#omega_{p}]"); // hPha2D->GetZaxis()->SetTitle("dn/d#zetady"); Float_t xMean = hPha2D->GetMean(1); Float_t xRms = hPha2D->GetRMS(1); Float_t yMean = hPha2D->GetMean(2); Float_t yRms = hPha2D->GetRMS(2); cout << Form(" xMean = %f xRms = %f yMean = %f yRms = %f",xMean,xRms,yMean,yRms) << endl; // Read array of tags: TString filename = Form("./%s/Plots/RakeDump/RakeDump-%s_%i.raw",sim.Data(),sim.Data(),100); ifstream fDataIn(filename.Data(),ios::in); Int_t Npart; fDataIn >> Npart; vector<Int_t*> tags; Int_t it = 0; while (!fDataIn.eof()) { tags.push_back(new Int_t[2]); fDataIn >> tags[it][0] >> tags[it][1]; // cout << Form("%10i %10i",tags[it][0],tags[it][1]) << endl; it++; } // Redo the histogram with only tagged particles: TH2F *hPha2DTag = (TH2F*) hPha2D->Clone("hPha2DTag"); hPha2DTag->Reset(); // Loop for event selection: const Int_t Nvar = 8; Float_t var[Nvar]; char varname[Nvar][4] = {{"ene"},{"p1"},{"p2"},{"p3"},{"q"},{"x1"},{"x2"},{"x3"}}; for(Int_t i=0;i<Nvar;i++) { tree->SetBranchAddress(varname[i],&var[i]); } Int_t tag[2]; tree->SetBranchAddress("tag",&tag); Int_t nentries = (Int_t)tree->GetEntries(); for(Int_t i=0;i<nentries;i++) { tree->GetEntry(i); var[5] = var[5] - shiftz; Bool_t found = kFALSE; for(Int_t it = 0; it<(int)tags.size(); it++) { if((tag[0]==tags[it][0]) && (tag[1]==tags[it][1])) { hPha2DTag->Fill(var[5],var[6]); //tags.erase(tags.begin()+it); continue; } } } // Plotting // ----------------------------------------------- // Canvas setup TCanvas *C; if(opt.Contains("hres") && !opt.Contains("pdf")) // high resolution for plain graphics output. C = new TCanvas("C","Phasespace",1200,750); else C = new TCanvas("C","Phasespace",960,600); // Text objects TPaveText *textTime = new TPaveText(0.55,0.85,0.82,0.9,"NDC"); PlasmaGlob::SetPaveTextStyle(textTime,32); char ctext[128]; if(opt.Contains("units") && pData->GetPlasmaDensity()) sprintf(ctext,"z = %5.1f mm", Time * skindepth / PUnits::mm); else sprintf(ctext,"t = %5.1f #omega_{p}^{-1}",Time); textTime->AddText(ctext); // Actual Plotting! // ------------------------------------------------------------ // Output file TString fOutName = Form("./%s/Plots/PhaseSpaceAutoTag2D/PhaseSpaceAutoTag2D",sim.Data()); fOutName += Form("-%s_%i",sim.Data(),time); C->cd(); gPad->SetFrameLineWidth(2); if(opt.Contains("logz")) { gPad->SetLogz(1); } else { gPad->SetLogz(0); } // Set palette: PPalette * pPalette = (PPalette*) gROOT->FindObject("electron"); pPalette->cd(); hPha2D->Draw("colz"); hPha2DTag->SetMarkerStyle(6); hPha2DTag->SetMarkerColor(kGray+2); hPha2DTag->Draw("same"); textTime->Draw(); gPad->RedrawAxis(); C->cd(); // Print to a file PlasmaGlob::imgconv(C,fOutName,opt); // --------------------------------------------------------- }
int fgtRawSpectraQA( const Char_t *filenameIn = "testfile.daq", const Char_t *filebaseOut = "testfile.rawQA", Int_t date = 20120115, Int_t time = 0, Float_t pedRelThres = 0, // 0 = no cut, otherwise: # of sigma above pedestal for cut Int_t nevents = 2000, Int_t timebin = 2, UInt_t statusMask, Bool_t cutShortEvents = 1 ){ LoadLibs(); Int_t ierr = 0; // // START CONSTRUCTING THE CHAIN // cout << "Constructing the chain" << endl; analysisChain = new StChain("eemcAnalysisChain"); // // THE DATABASE // // note: DB is used to convert elec coords into geoIds in // StEvent/StFgtStrip, and do determine the disc and quad given // an rdo/arm/apv combination. cout << "Constructing St_db_Maker" << endl; TString dir0 = "MySQL:StarDb"; TString dir1 = "$STAR/StarDb"; St_db_Maker *dbMkr = new St_db_Maker( "dbMkr", dir0, dir1 ); dbMkr->SetDateTime(date,time); cout << "Constructing StFgtDbMaker" << endl; fgtDbMkr = new StFgtDbMaker( "fgtDbMkr" ); // // NOW THE OTHER READERS AND MAKERS // cout << "Constructing the daq reader" << endl; daqRdr = new StFgtRawDaqReader( "daqReader", filenameIn, "" ); daqRdr->setIsCosmic( 0 ); daqRdr->cutShortEvents( cutShortEvents ); // a2cMkr = new StFgtA2CMaker( "a2cMkr" ); // a2cMkr->setStatusMask( statusMask ); // a2cMkr->setAbsThres( -10000 ); // set to below -4096 to skip cut // a2cMkr->setRelThres( pedRelThres ); // set to zero to skip cut cout << "Constructing the QA Makers" << endl; qaMkr = new StFgtQaRawOctAdc( "qaMkr", 2 ); qaMkr->setTimeBin( 2 ); // debug analysisChain->ls(4); cout << "Initializing" << endl; ierr = analysisChain->Init(); if( ierr ){ cout << "Error initializing" << endl; return; }; if( nevents < 0 ) nevents = 1<<30; // a big number cout << "max nevents = " << nevents << endl; for( int i=0; i<nevents && !ierr; ++i ){ if( i+1 % 100 == 0 ) cout << "\ton event number " << i << endl; //cout << "clear" << endl; analysisChain->Clear(); //cout << "make" << endl; ierr = analysisChain->Make(); }; // // Calls the ::Finish() method on all makers // cout << "finish" << endl; analysisChain->Finish(); cout << "Making plots" << endl; gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); gStyle->SetPalette(1); can = new TCanvas( "fgtRawQA", "fgtRawQA", 850, 1100); can->Divide( 1, 4 ); // open output file can->Print( (std::string(filebaseOut) + ".ps[").data() ); //std::vector< TH2F* >& hist = qaMkr->getHistVec(); cout << "First hist at " << qaMkr->getHist(0) << endl; cout << "Finding max" << endl; // get max Float_t max = 0; for( Int_t idx = 0; idx < 48; ++idx ){ if( qaMkr->getHist(idx) ) if( qaMkr->getHist(idx)->GetMaximum() > max ) max = qaMkr->getHist(idx)->GetMaximum(); }; max = 0.9*max; cout << "Max is " << max << endl; TH2F *dummy[4]; const Char_t dummyNames[4][20] = { "dummy1", "dummy2", "dummy3", "dummy4" }; Float_t xMin = qaMkr->getHist(0)->GetXaxis()->GetXmin(); Float_t xMax = qaMkr->getHist(0)->GetXaxis()->GetXmax(); Float_t yMin = qaMkr->getHist(0)->GetYaxis()->GetXmin(); Float_t yMax = qaMkr->getHist(0)->GetYaxis()->GetXmax(); for( Int_t i=0; i<4; ++i ) dummy[i] = new TH2F( dummyNames[i], "", 5, xMin, xMax, 1, yMin, yMax ); std::stringstream ss; Int_t subpad = 1; idx = 0; for( Int_t rdo = 1; rdo < 3; ++rdo ){ for( Int_t arm = 0; arm < 6; ++arm ){ for( Int_t startIdx = 0; startIdx < 4; ++startIdx, ++idx ){ for( Int_t oct = 0; oct < 1; ++oct ){ cout << "rdo/arm/disc/oct = " << rdo << '/' << arm << '/' << startIdx << '/' << oct << endl; if( qaMkr->getHist(idx)->GetEntries() > 0 ){ can->cd(subpad); gPad->SetLeftMargin( 0.06 ); gPad->SetRightMargin( 0.05 ); gPad->SetBottomMargin( 0.11 ); qaMkr->getHist(idx)->SetMaximum( max ); dummy[subpad-1]->GetXaxis()->SetTitleOffset(0.9); dummy[subpad-1]->GetXaxis()->SetTitleSize(0.06); dummy[subpad-1]->GetXaxis()->SetLabelSize(0.06); dummy[subpad-1]->GetYaxis()->SetTitleOffset(0.55); dummy[subpad-1]->GetYaxis()->SetTitleSize(0.06); dummy[subpad-1]->GetYaxis()->SetLabelSize(0.06); gPad->SetGridx(0); gPad->SetGridy(0); for( Int_t i = 0; i<5; ++i ){ ss.str(""); ss.clear(); ss << "channels in APV "; // startArray[startIdx]+i; dummy[subpad-1]->GetXaxis()->SetBinLabel( i+1, ss.str().data() ); }; dummy[subpad-1]->GetXaxis()->SetNdivisions(222,0); dummy[subpad-1]->SetMinimum( 0 ); dummy[subpad-1]->SetMaximum( max ); dummy[subpad-1]->SetTitle( qaMkr->getHist(idx)->GetTitle() ); qaMkr->getHist(idx)->SetTitle(""); dummy[subpad-1]->GetYaxis()->SetTitle( qaMkr->getHist(idx)->GetYaxis()->GetTitle() ); qaMkr->getHist(idx)->GetYaxis()->SetTitle(""); dummy[subpad-1]->Draw("COLZ"); qaMkr->getHist(idx)->Draw("COLZ SAME"); gPad->Update(); gPad->Modified(); TPaveText *title = (TPaveText*)(gPad->GetPrimitive("title")); if( title ){ title->SetX1NDC( 0.045 ); title->SetX2NDC( 0.55 ); title->SetY1NDC( 0.91 ) ; title->SetY2NDC( 0.999 ); title->SetBorderSize(0); title->SetTextAlign( 12 ); title->SetTextColor(kBlue); title->Draw(); }; TPave *palette = (TPave*)(gPad->GetPrimitive("palette")); if( palette ){ palette->SetX1NDC( 0.955 ); palette->SetX2NDC( 0.985 ); palette->Draw(); }; ++subpad; if( subpad == 5 ){ subpad = 1; can->Print( (std::string(filebaseOut) + ".ps").data() ); }; }; }; }; }; }; if( subpad != 1 ) can->Print( (std::string(filebaseOut) + ".ps").data() ); can->Print( (std::string(filebaseOut) + ".ps]").data() ); gSystem->Exec(( std::string("ps2pdf -dAutoRotatePages=/None ") + filebaseOut + ".ps" ).data()); cerr << "\tall done" << endl; return; };
int main(int argc, char** argv){ //=========Macro generated from canvas: Canvas_1/Canvas_1 //========= (Wed Aug 27 23:28:50 2014) by ROOT version5.34/04 TCanvas *Canvas_1 = new TCanvas("Canvas_1", "Canvas_1",258,73,1243,811); Canvas_1->Range(-0.0625,-0.0625,0.0625,0.0625); Canvas_1->SetFillColor(0); Canvas_1->SetBorderMode(0); Canvas_1->SetBorderSize(2); Canvas_1->SetFrameBorderMode(0); Canvas_1->SetFrameBorderMode(0); TFile f(argv[1],"r"); TH2F *h1 = (TH2F*)f.Get("h2dir/h4"); /* TPaletteAxis *palette = new TPaletteAxis(0.050625,-0.05,0.05625,0.05,h1); palette->SetLabelColor(1); palette->SetLabelFont(42); palette->SetLabelOffset(0.005); palette->SetLabelSize(0.035); palette->SetTitleOffset(1); palette->SetTitleSize(0.035); palette->SetFillColor(100); palette->SetFillStyle(1001); h1->GetListOfFunctions()->Add(palette,"br"); */ TPaveStats *ptstats = new TPaveStats(0.700565,0.6608696,0.9007264,0.9006211,"brNDC"); ptstats->SetName("stats"); ptstats->SetBorderSize(1); ptstats->SetFillColor(0); ptstats->SetTextAlign(12); ptstats->SetTextFont(42); TText *text = ptstats->AddText("h1"); text->SetTextSize(0.03676191); text = ptstats->AddText("Entries = 101 "); text = ptstats->AddText("Mean x = -0.0003512"); text = ptstats->AddText("Mean y = -0.0003318"); text = ptstats->AddText("RMS x = 0.01432"); text = ptstats->AddText("RMS y = 0.01428"); ptstats->SetOptStat(1111); ptstats->SetOptFit(0); ptstats->Draw(); h1->GetListOfFunctions()->Add(ptstats); ptstats->SetParent(h1); Int_t ci; // for color index setting ci = TColor::GetColor("#000099"); h1->SetLineColor(ci); h1->GetXaxis()->SetTitle("mm"); h1->GetXaxis()->SetLabelFont(42); h1->GetXaxis()->SetLabelSize(0.035); h1->GetXaxis()->SetTitleSize(0.035); h1->GetXaxis()->SetTitleFont(42); h1->GetYaxis()->SetTitle("mm"); h1->GetYaxis()->SetLabelFont(42); h1->GetYaxis()->SetLabelSize(0.035); h1->GetYaxis()->SetTitleSize(0.035); h1->GetYaxis()->SetTitleFont(42); h1->GetZaxis()->SetLabelFont(42); h1->GetZaxis()->SetLabelSize(0.035); h1->GetZaxis()->SetTitleSize(0.035); h1->GetZaxis()->SetTitleFont(42); h1->Draw("COLZ "); TPaveText *pt = new TPaveText(0.1594915,0.9368634,0.8405085,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); text = pt->AddText("2D Energy deposit distribution at z=-25um"); pt->Draw(); Canvas_1->Modified(); Canvas_1->cd(); Canvas_1->SetSelected(Canvas_1); std::cout<<argv[1]<<std::endl; Canvas_1->SaveAs(TString(argv[1])+"35#.png"); }
void HBB_HAD_X(bool scaled=true, bool log=true, float min=0.1, float max=-1., string inputfile="root/$HISTFILE", const char* directory="bb_$CATEGORY") { // define common canvas, axes pad styles SetStyle(); gStyle->SetLineStyleString(11,"20 10"); const char* category_extra = ""; if(std::string(directory) == std::string("bb_had0" )){ category_extra = "all-had_{0}"; } if(std::string(directory) == std::string("bb_had1" )){ category_extra = "all-had_{1}"; } if(std::string(directory) == std::string("bb_had2" )){ category_extra = "all-had_{2}"; } if(std::string(directory) == std::string("bb_had3" )){ category_extra = "all-had_{3}"; } if(std::string(directory) == std::string("bb_had4" )){ category_extra = "all-had_{4}"; } if(std::string(directory) == std::string("bb_had5" )){ category_extra = "all-had_{5}"; } if(std::string(directory) == std::string("bb_lep" )){ category_extra = "semi-lep"; } const char* dataset; if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "Preliminary, #sqrt{s} = 7 TeV, L = 2.7 fb^{-1}";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "Preliminary, #sqrt{s} = 8 TeV, L = 19.4 fb^{-1}";} TFile* input = new TFile(inputfile.c_str()); #ifdef MSSM TFile* input2 = new TFile((inputfile+"_$MA_$TANB").c_str()); #endif TH1F* Bbb = refill((TH1F*)input->Get(TString::Format("%s/Bbb" , directory)), "Bbb"); InitHist(Bbb, "", "", kMagenta-10, 1001); TH1F* Cbb = refill((TH1F*)input->Get(TString::Format("%s/Cbb" , directory)), "Cbb"); InitHist(Cbb, "", "", kRed + 2, 1001); TH1F* Qbb = refill((TH1F*)input->Get(TString::Format("%s/Qbb" , directory)), "Qbb"); InitHist(Qbb, "", "", kBlue - 8, 1001); TH1F* bbB = refill((TH1F*)input->Get(TString::Format("%s/bbB" , directory)), "bbB"); InitHist(bbB, "", "", kOrange - 4, 1001); TH1F* bbX = refill((TH1F*)input->Get(TString::Format("%s/bbX" , directory)), "bbX"); InitHist(bbX, "", "", kViolet - 0, 1001); #ifdef MSSM //float bbHScale = 1.; //ggHScale = ($MSSM_SIGNAL_ggH_xseff_A + $MSSM_SIGNAL_ggH_xseff_hH); //bbHScale = ($MSSM_SIGNAL_bbH_xseff_A + $MSSM_SIGNAL_bbH_xseff_hH); TH1F* bbH = refill((TH1F*)input2->Get(TString::Format("%s/bbH$MA" , directory)), "bbH" ); InitSignal(bbH); bbH->Scale($TANB); //bbH->Scale(bbHScale); #endif #ifdef ASIMOV TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs_asimov", directory)), "data", true); #else TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs", directory)), "data", true); #endif InitHist(data, "#bf{m_{b#bar{b}} [GeV]}", "#bf{dN/dm_{b#bar{b}} [1/GeV]}"); InitData(data); TH1F* ref=(TH1F*)Qbb->Clone("ref"); ref->Add(bbX); ref->Add(Cbb); ref->Add(bbB); ref->Add(Bbb); double unscaled[7]; unscaled[0] = Qbb ->Integral(); unscaled[1] = bbX ->Integral(); unscaled[2] = Cbb ->Integral(); unscaled[3] = bbB ->Integral(); unscaled[4] = Bbb ->Integral(); #ifdef MSSM unscaled[5] = bbH ->Integral(); unscaled[6] = 0; #endif if(scaled){ rescale(Bbb, 1); rescale(bbB, 4); rescale(Cbb, 2); rescale(bbX, 5); rescale(Qbb, 3); #ifdef MSSM rescale(bbH, 6); #endif } TH1F* scales[7]; scales[0] = new TH1F("scales-Qbb", "", 7, 0, 7); scales[0]->SetBinContent(1, unscaled[0]>0 ? (Qbb ->Integral()/unscaled[0]-1.) : 0.); scales[1] = new TH1F("scales-bbX" , "", 7, 0, 7); scales[1]->SetBinContent(2, unscaled[1]>0 ? (bbX ->Integral()/unscaled[1]-1.) : 0.); scales[2] = new TH1F("scales-Cbb", "", 7, 0, 7); scales[2]->SetBinContent(3, unscaled[2]>0 ? (Cbb ->Integral()/unscaled[2]-1.) : 0.); scales[3] = new TH1F("scales-bbB" , "", 7, 0, 7); scales[3]->SetBinContent(4, unscaled[3]>0 ? (bbB ->Integral()/unscaled[3]-1.) : 0.); scales[4] = new TH1F("scales-Bbb" , "", 7, 0, 7); scales[4]->SetBinContent(5, unscaled[4]>0 ? (Bbb ->Integral()/unscaled[4]-1.) : 0.); #ifdef MSSM scales[5] = new TH1F("scales-bbH" , "", 7, 0, 7); scales[5]->SetBinContent(6, unscaled[5]>0 ? (bbH ->Integral()/unscaled[5]-1.) : 0.); scales[6] = new TH1F("scales-NONE" , "", 7, 0, 7); scales[6]->SetBinContent(7, 0.); #endif bbX ->Add(Qbb); Cbb ->Add(bbX); bbB ->Add(Cbb); Bbb ->Add(bbB); if(!log){ #ifdef MSSM bbH ->Add(Bbb); #endif } /* mass plot before and after fit */ TCanvas* canv = MakeCanvas("canv", "histograms", 600, 600); canv->cd(); if(log){ canv->SetLogy(1); } #if defined MSSM if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(350)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(1000)); }; #endif data->SetNdivisions(505); data->SetMinimum(min); data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(Bbb, log))); data->Draw("e"); TH1F* errorBand = (TH1F*)Bbb ->Clone(); errorBand ->SetMarkerSize(0); errorBand ->SetFillColor(1); errorBand ->SetFillStyle(3013); errorBand ->SetLineWidth(1); if(log){ Bbb ->Draw("histsame"); bbB ->Draw("histsame"); Cbb ->Draw("histsame"); bbX ->Draw("histsame"); Qbb ->Draw("histsame"); $DRAW_ERROR #ifndef DROP_SIGNAL bbH ->Draw("histsame"); #endif } else{ #ifndef DROP_SIGNAL bbH ->Draw("histsame"); #endif Bbb ->Draw("histsame"); bbB ->Draw("histsame"); Cbb ->Draw("histsame"); bbX ->Draw("histsame"); Qbb ->Draw("histsame"); $DRAW_ERROR } data->Draw("esame"); canv->RedrawAxis(); //CMSPrelim(dataset, "b#bar{b}", 0.17, 0.835); CMSPrelim(dataset, "", 0.17, 0.835); TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC"); chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.05 ); chan->SetTextColor( 1 ); chan->SetTextFont ( 62 ); chan->AddText("b#bar{b}"); chan->Draw(); TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC"); cat->SetBorderSize( 0 ); cat->SetFillStyle( 0 ); cat->SetTextAlign( 12 ); cat->SetTextSize ( 0.05 ); cat->SetTextColor( 1 ); cat->SetTextFont ( 62 ); cat->AddText(category_extra); cat->Draw(); #ifdef MSSM TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC"); massA->SetBorderSize( 0 ); massA->SetFillStyle( 0 ); massA->SetTextAlign( 12 ); massA->SetTextSize ( 0.03 ); massA->SetTextColor( 1 ); massA->SetTextFont ( 62 ); massA->AddText("m_{A}=$MA GeV"); massA->Draw(); TPaveText* tanb = new TPaveText(0.75, 0.44+0.061, 0.85, 0.44+0.161, "NDC"); tanb->SetBorderSize( 0 ); tanb->SetFillStyle( 0 ); tanb->SetTextAlign( 12 ); tanb->SetTextSize ( 0.03 ); tanb->SetTextColor( 1 ); tanb->SetTextFont ( 62 ); tanb->AddText("tan#beta=$TANB"); tanb->Draw(); TPaveText* scen = new TPaveText(0.75, 0.40+0.061, 0.85, 0.40+0.161, "NDC"); scen->SetBorderSize( 0 ); scen->SetFillStyle( 0 ); scen->SetTextAlign( 12 ); scen->SetTextSize ( 0.03 ); scen->SetTextColor( 1 ); scen->SetTextFont ( 62 ); scen->AddText("m^{h}_{max}"); scen->Draw(); #endif #ifdef MSSM TLegend* leg = new TLegend(0.55, 0.65, 0.95, 0.90); SetLegendStyle(leg); leg->AddEntry(bbH , "#phi#rightarrowb#bar{b}" , "L" ); #endif #ifdef ASIMOV leg->AddEntry(data , "sum(bkg) + SM125 GeV signal" , "LP"); #else leg->AddEntry(data , "observed" , "LP"); #endif leg->AddEntry(Bbb, "Bbb" , "F" ); leg->AddEntry(bbB, "bbB" , "F" ); leg->AddEntry(Cbb, "Cbb" , "F" ); leg->AddEntry(bbX, "bbX" , "F" ); leg->AddEntry(Qbb, "Qbb" , "F" ); $ERROR_LEGEND leg->Draw(); //#ifdef MSSM // TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC"); // mssm->SetBorderSize( 0 ); // mssm->SetFillStyle( 0 ); // mssm->SetTextAlign( 12 ); // mssm->SetTextSize ( 0.03 ); // mssm->SetTextColor( 1 ); // mssm->SetTextFont ( 62 ); // mssm->AddText("(m_{A}=250, tan#beta=5)"); // mssm->Draw(); //#else // TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC"); // mssm->SetBorderSize( 0 ); // mssm->SetFillStyle( 0 ); // mssm->SetTextAlign( 12 ); // mssm->SetTextSize ( 0.03 ); // mssm->SetTextColor( 1 ); // mssm->SetTextFont ( 62 ); // mssm->AddText("m_{H}=125"); // mssm->Draw(); //#endif /* Ratio Data over MC */ TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400); canv0->SetGridx(); canv0->SetGridy(); canv0->cd(); TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear(); TH1F* rat1 = (TH1F*)data->Clone("rat"); rat1->Divide(Bbb); for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ if(rat1->GetBinContent(ibin+1)>0){ // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.); } zero->SetBinContent(ibin+1, 0.); } rat1->SetLineColor(kBlack); rat1->SetFillColor(kGray ); rat1->SetMaximum(+1.5); rat1->SetMinimum(-1.5); rat1->GetYaxis()->CenterTitle(); rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}"); rat1->GetXaxis()->SetTitle("#bf{m_{b#bar{b}} [GeV]}"); rat1->Draw(); zero->SetLineColor(kBlack); zero->Draw("same"); canv0->RedrawAxis(); /* Ratio After fit over Prefit */ TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400); canv1->SetGridx(); canv1->SetGridy(); canv1->cd(); TH1F* rat2 = (TH1F*) Bbb->Clone("rat2"); rat2->Divide(ref); for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ if(rat2->GetBinContent(ibin+1)>0){ // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat2 ->SetBinContent(ibin+1, rat2->GetBinContent(ibin+1)-1.); } } rat2->SetLineColor(kRed+ 3); rat2->SetFillColor(kRed-10); rat2->SetMaximum(+0.3); rat2->SetMinimum(-0.3); rat2->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); rat2->GetYaxis()->CenterTitle(); rat2->GetXaxis()->SetTitle("#bf{m_{b#bar{b}} [GeV]}"); rat2->GetXaxis()->SetRange(0, 28); rat2->Draw(); zero->SetLineColor(kBlack); zero->Draw("same"); canv1->RedrawAxis(); /* Relative shift per sample */ TCanvas *canv2 = MakeCanvas("canv2", "histograms", 600, 400); canv2->SetGridx(); canv2->SetGridy(); canv2->cd(); InitHist (scales[4], "", "", kMagenta-10, 1001); InitHist (scales[2], "", "", kRed + 2, 1001); InitHist (scales[0], "", "", kBlue - 8, 1001); InitHist (scales[3], "", "", kOrange - 4, 1001); InitHist (scales[1], "", "", kViolet - 0, 1001); scales[0]->Draw(); scales[0]->GetXaxis()->SetBinLabel(1, "#bf{Qbb}"); scales[0]->GetXaxis()->SetBinLabel(2, "#bf{bbX}"); scales[0]->GetXaxis()->SetBinLabel(3, "#bf{Cbb}"); scales[0]->GetXaxis()->SetBinLabel(4, "#bf{bbB}"); scales[0]->GetXaxis()->SetBinLabel(5, "#bf{Bbb}"); #ifdef MSSM scales[0]->GetXaxis()->SetBinLabel(6, "#bf{bbH}" ); scales[0]->GetXaxis()->SetBinLabel(7, "#bf{NONE}" ); #endif scales[0]->SetMaximum(+1.0); scales[0]->SetMinimum(-1.0); scales[0]->GetYaxis()->CenterTitle(); scales[0]->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); scales[1]->Draw("same"); scales[2]->Draw("same"); scales[3]->Draw("same"); scales[4]->Draw("same"); zero->Draw("same"); canv2->RedrawAxis(); /* prepare output */ bool isSevenTeV = std::string(inputfile).find("7TeV")!=std::string::npos; canv ->Print(TString::Format("%s_%sfit_%s_%s.png" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sfit_%s_%s.pdf" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sfit_%s_%s.eps" , directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); if(!log || FULLPLOTS) { canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv0->Print(TString::Format("%s_datamc_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); } if((!log && scaled) || FULLPLOTS) { canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv1->Print(TString::Format("%s_prefit_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.png", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.pdf", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sfit_%s_%s.eps", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); } TFile* output = new TFile(TString::Format("%s_%sfit_%s_%s.root", directory, scaled ? "post" : "pre", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : ""), "update"); output->cd(); data ->Write("data_obs"); Qbb ->Write("Qbb" ); bbX ->Write("bbX" ); Cbb ->Write("Cbb" ); bbB ->Write("bbB" ); Bbb ->Write("Bbb" ); #ifdef MSSM bbH ->Write("bbH" ); #endif if(errorBand){ errorBand->Write("errorBand"); } output->Close(); }
// The actual job void backgroundFits_qqzz_1Dw(int channel, int sqrts, int VBFtag) { if(sqrts==7)return; TString schannel; if (channel == 1) schannel = "4mu"; else if (channel == 2) schannel = "4e"; else if (channel == 3) schannel = "2e2mu"; else cout << "Not a valid channel: " << schannel << endl; TString ssqrts = (long) sqrts + TString("TeV"); cout << "schannel = " << schannel << " sqrts = " << sqrts << " VBFtag = " << VBFtag << endl; TString outfile; if(VBFtag<2) outfile = "CardFragments/qqzzBackgroundFit_" + ssqrts + "_" + schannel + "_" + Form("%d",int(VBFtag)) + ".txt"; if(VBFtag==2) outfile = "CardFragments/qqzzBackgroundFit_" + ssqrts + "_" + schannel + ".txt"; ofstream of(outfile,ios_base::out); of << "### background functions ###" << endl; gSystem->AddIncludePath("-I$ROOFITSYS/include"); gROOT->ProcessLine(".L ../CreateDatacards/include/tdrstyle.cc"); setTDRStyle(false); gStyle->SetPadLeftMargin(0.16); TString filepath; if (sqrts==7) { filepath = filePath7TeV; } else if (sqrts==8) { filepath = filePath8TeV; } TChain* tree = new TChain("SelectedTree"); tree->Add( filepath+ "/" + (schannel=="2e2mu"?"2mu2e":schannel) + "/HZZ4lTree_ZZTo*.root"); RooRealVar* MC_weight = new RooRealVar("MC_weight","MC_weight",0.,2.) ; RooRealVar* ZZMass = new RooRealVar("ZZMass","ZZMass",100.,1000.); RooRealVar* NJets30 = new RooRealVar("NJets30","NJets30",0.,100.); RooArgSet ntupleVarSet(*ZZMass,*NJets30,*MC_weight); RooDataSet *set = new RooDataSet("set","set",ntupleVarSet,WeightVar("MC_weight")); Float_t myMC,myMass; Short_t myNJets; int nentries = tree->GetEntries(); tree->SetBranchAddress("ZZMass",&myMass); tree->SetBranchAddress("MC_weight",&myMC); tree->SetBranchAddress("NJets30",&myNJets); for(int i =0;i<nentries;i++) { tree->GetEntry(i); if(VBFtag==1 && myNJets<2)continue; if(VBFtag==0 && myNJets>1)continue; ntupleVarSet.setRealValue("ZZMass",myMass); ntupleVarSet.setRealValue("MC_weight",myMC); ntupleVarSet.setRealValue("NJets30",(double)myNJets); set->add(ntupleVarSet, myMC); } double totalweight = 0.; double totalweight_z = 0.; for (int i=0 ; i<set->numEntries() ; i++) { //set->get(i) ; RooArgSet* row = set->get(i) ; //row->Print("v"); totalweight += set->weight(); if (row->getRealValue("ZZMass") < 200) totalweight_z += set->weight(); } cout << "nEntries: " << set->numEntries() << ", totalweight: " << totalweight << ", totalweight_z: " << totalweight_z << endl; gSystem->Load("libHiggsAnalysisCombinedLimit.so"); //// --------------------------------------- //Background RooRealVar CMS_qqzzbkg_a0("CMS_qqzzbkg_a0","CMS_qqzzbkg_a0",115.3,0.,200.); RooRealVar CMS_qqzzbkg_a1("CMS_qqzzbkg_a1","CMS_qqzzbkg_a1",21.96,0.,200.); RooRealVar CMS_qqzzbkg_a2("CMS_qqzzbkg_a2","CMS_qqzzbkg_a2",122.8,0.,200.); RooRealVar CMS_qqzzbkg_a3("CMS_qqzzbkg_a3","CMS_qqzzbkg_a3",0.03479,0.,1.); RooRealVar CMS_qqzzbkg_a4("CMS_qqzzbkg_a4","CMS_qqzzbkg_a4",185.5,0.,200.); RooRealVar CMS_qqzzbkg_a5("CMS_qqzzbkg_a5","CMS_qqzzbkg_a5",12.67,0.,200.); RooRealVar CMS_qqzzbkg_a6("CMS_qqzzbkg_a6","CMS_qqzzbkg_a6",34.81,0.,100.); RooRealVar CMS_qqzzbkg_a7("CMS_qqzzbkg_a7","CMS_qqzzbkg_a7",0.1393,0.,1.); RooRealVar CMS_qqzzbkg_a8("CMS_qqzzbkg_a8","CMS_qqzzbkg_a8",66.,0.,200.); RooRealVar CMS_qqzzbkg_a9("CMS_qqzzbkg_a9","CMS_qqzzbkg_a9",0.07191,0.,1.); RooRealVar CMS_qqzzbkg_a10("CMS_qqzzbkg_a10","CMS_qqzzbkg_a10",94.11,0.,200.); RooRealVar CMS_qqzzbkg_a11("CMS_qqzzbkg_a11","CMS_qqzzbkg_a11",-5.111,-100.,100.); RooRealVar CMS_qqzzbkg_a12("CMS_qqzzbkg_a12","CMS_qqzzbkg_a12",4834,0.,10000.); RooRealVar CMS_qqzzbkg_a13("CMS_qqzzbkg_a13","CMS_qqzzbkg_a13",0.2543,0.,1.); if (channel == 1){ ///* 4mu CMS_qqzzbkg_a0.setVal(103.854); CMS_qqzzbkg_a1.setVal(10.0718); CMS_qqzzbkg_a2.setVal(117.551); CMS_qqzzbkg_a3.setVal(0.0450287); CMS_qqzzbkg_a4.setVal(185.262); CMS_qqzzbkg_a5.setVal(7.99428); CMS_qqzzbkg_a6.setVal(39.7813); CMS_qqzzbkg_a7.setVal(0.0986891); CMS_qqzzbkg_a8.setVal(49.1325); CMS_qqzzbkg_a9.setVal(0.0389984); CMS_qqzzbkg_a10.setVal(98.6645); CMS_qqzzbkg_a11.setVal(-7.02043); CMS_qqzzbkg_a12.setVal(5694.66); CMS_qqzzbkg_a13.setVal(0.0774525); //*/ } else if (channel == 2){ ///* 4e CMS_qqzzbkg_a0.setVal(111.165); CMS_qqzzbkg_a1.setVal(19.8178); CMS_qqzzbkg_a2.setVal(120.89); CMS_qqzzbkg_a3.setVal(0.0546639); CMS_qqzzbkg_a4.setVal(184.878); CMS_qqzzbkg_a5.setVal(11.7041); CMS_qqzzbkg_a6.setVal(33.2659); CMS_qqzzbkg_a7.setVal(0.140858); CMS_qqzzbkg_a8.setVal(56.1226); CMS_qqzzbkg_a9.setVal(0.0957699); CMS_qqzzbkg_a10.setVal(98.3662); CMS_qqzzbkg_a11.setVal(-6.98701); CMS_qqzzbkg_a12.setVal(10.0536); CMS_qqzzbkg_a13.setVal(0.110576); //*/ } else if (channel == 3){ ///* 2e2mu CMS_qqzzbkg_a0.setVal(110.293); CMS_qqzzbkg_a1.setVal(11.8334); CMS_qqzzbkg_a2.setVal(116.91); CMS_qqzzbkg_a3.setVal(0.0433151); CMS_qqzzbkg_a4.setVal(185.817); CMS_qqzzbkg_a5.setVal(10.5945); CMS_qqzzbkg_a6.setVal(29.6208); CMS_qqzzbkg_a7.setVal(0.0826); CMS_qqzzbkg_a8.setVal(53.1346); CMS_qqzzbkg_a9.setVal(0.0882081); CMS_qqzzbkg_a10.setVal(85.3776); CMS_qqzzbkg_a11.setVal(-13.3836); CMS_qqzzbkg_a12.setVal(7587.95); CMS_qqzzbkg_a13.setVal(0.325621); //*/ } else { cout << "disaster" << endl; } RooqqZZPdf_v2* bkg_qqzz = new RooqqZZPdf_v2("bkg_qqzz","bkg_qqzz",*ZZMass, CMS_qqzzbkg_a0,CMS_qqzzbkg_a1,CMS_qqzzbkg_a2,CMS_qqzzbkg_a3,CMS_qqzzbkg_a4, CMS_qqzzbkg_a5,CMS_qqzzbkg_a6,CMS_qqzzbkg_a7,CMS_qqzzbkg_a8, CMS_qqzzbkg_a9,CMS_qqzzbkg_a10,CMS_qqzzbkg_a11,CMS_qqzzbkg_a12,CMS_qqzzbkg_a13); RooArgSet myASet(*ZZMass, CMS_qqzzbkg_a0,CMS_qqzzbkg_a1,CMS_qqzzbkg_a2,CMS_qqzzbkg_a3,CMS_qqzzbkg_a4, CMS_qqzzbkg_a5,CMS_qqzzbkg_a6,CMS_qqzzbkg_a7); myASet.add(CMS_qqzzbkg_a8); myASet.add(CMS_qqzzbkg_a9); myASet.add(CMS_qqzzbkg_a10); myASet.add(CMS_qqzzbkg_a11); myASet.add(CMS_qqzzbkg_a12); myASet.add(CMS_qqzzbkg_a13); RooFitResult *r1 = bkg_qqzz->fitTo( *set, Save(kTRUE), SumW2Error(kTRUE) );//, Save(kTRUE), SumW2Error(kTRUE)) ; cout << endl; cout << "------- Parameters for " << schannel << " sqrts=" << sqrts << endl; cout << " a0_bkgd = " << CMS_qqzzbkg_a0.getVal() << endl; cout << " a1_bkgd = " << CMS_qqzzbkg_a1.getVal() << endl; cout << " a2_bkgd = " << CMS_qqzzbkg_a2.getVal() << endl; cout << " a3_bkgd = " << CMS_qqzzbkg_a3.getVal() << endl; cout << " a4_bkgd = " << CMS_qqzzbkg_a4.getVal() << endl; cout << " a5_bkgd = " << CMS_qqzzbkg_a5.getVal() << endl; cout << " a6_bkgd = " << CMS_qqzzbkg_a6.getVal() << endl; cout << " a7_bkgd = " << CMS_qqzzbkg_a7.getVal() << endl; cout << " a8_bkgd = " << CMS_qqzzbkg_a8.getVal() << endl; cout << " a9_bkgd = " << CMS_qqzzbkg_a9.getVal() << endl; cout << " a10_bkgd = " << CMS_qqzzbkg_a10.getVal() << endl; cout << " a11_bkgd = " << CMS_qqzzbkg_a11.getVal() << endl; cout << " a12_bkgd = " << CMS_qqzzbkg_a12.getVal() << endl; cout << " a13_bkgd = " << CMS_qqzzbkg_a13.getVal() << endl; cout << "}" << endl; cout << "---------------------------" << endl; of << "qqZZshape a0_bkgd " << CMS_qqzzbkg_a0.getVal() << endl; of << "qqZZshape a1_bkgd " << CMS_qqzzbkg_a1.getVal() << endl; of << "qqZZshape a2_bkgd " << CMS_qqzzbkg_a2.getVal() << endl; of << "qqZZshape a3_bkgd " << CMS_qqzzbkg_a3.getVal() << endl; of << "qqZZshape a4_bkgd " << CMS_qqzzbkg_a4.getVal() << endl; of << "qqZZshape a5_bkgd " << CMS_qqzzbkg_a5.getVal() << endl; of << "qqZZshape a6_bkgd " << CMS_qqzzbkg_a6.getVal() << endl; of << "qqZZshape a7_bkgd " << CMS_qqzzbkg_a7.getVal() << endl; of << "qqZZshape a8_bkgd " << CMS_qqzzbkg_a8.getVal() << endl; of << "qqZZshape a9_bkgd " << CMS_qqzzbkg_a9.getVal() << endl; of << "qqZZshape a10_bkgd " << CMS_qqzzbkg_a10.getVal() << endl; of << "qqZZshape a11_bkgd " << CMS_qqzzbkg_a11.getVal() << endl; of << "qqZZshape a12_bkgd " << CMS_qqzzbkg_a12.getVal() << endl; of << "qqZZshape a13_bkgd " << CMS_qqzzbkg_a13.getVal() << endl; of << endl << endl; of.close(); cout << endl << "Output written to: " << outfile << endl; double qqzznorm; if (channel == 1) qqzznorm = 20.5836; else if (channel == 2) qqzznorm = 13.8871; else if (channel == 3) qqzznorm = 32.9883; else { cout << "disaster!" << endl; } ZZMass->setRange("fullrange",100.,1000.); ZZMass->setRange("largerange",100.,600.); ZZMass->setRange("zoomrange",100.,200.); double rescale = qqzznorm/totalweight; double rescale_z = qqzznorm/totalweight_z; cout << "rescale: " << rescale << ", rescale_z: " << rescale_z << endl; // Plot m4l and RooPlot* frameM4l = ZZMass->frame(Title("M4L"),Range(100,600),Bins(250)) ; set->plotOn(frameM4l, MarkerStyle(20), Rescale(rescale)) ; //set->plotOn(frameM4l) ; RooPlot* frameM4lz = ZZMass->frame(Title("M4L"),Range(100,200),Bins(100)) ; set->plotOn(frameM4lz, MarkerStyle(20), Rescale(rescale)) ; int iLineColor = 1; string lab = "blah"; if (channel == 1) { iLineColor = 2; lab = "4#mu"; } if (channel == 3) { iLineColor = 4; lab = "2e2#mu"; } if (channel == 2) { iLineColor = 6; lab = "4e"; } bkg_qqzz->plotOn(frameM4l,LineColor(iLineColor),NormRange("largerange")) ; bkg_qqzz->plotOn(frameM4lz,LineColor(iLineColor),NormRange("zoomrange")) ; //second shape to compare with (if previous comparison code unceommented) //bkg_qqzz_bkgd->plotOn(frameM4l,LineColor(1),NormRange("largerange")) ; //bkg_qqzz_bkgd->plotOn(frameM4lz,LineColor(1),NormRange("zoomrange")) ; double normalizationBackground_qqzz = bkg_qqzz->createIntegral( RooArgSet(*ZZMass), Range("fullrange") )->getVal(); cout << "Norm all = " << normalizationBackground_qqzz << endl; frameM4l->GetXaxis()->SetTitle("m_{4l} [GeV]"); frameM4l->GetYaxis()->SetTitle("a.u."); frameM4lz->GetXaxis()->SetTitle("m_{4l} [GeV]"); frameM4lz->GetYaxis()->SetTitle("a.u."); char lname[192]; sprintf(lname,"qq #rightarrow ZZ #rightarrow %s", lab.c_str() ); char lname2[192]; sprintf(lname2,"Shape Model, %s", lab.c_str() ); // dummy! TF1* dummyF = new TF1("dummyF","1",0.,1.); TH1F* dummyH = new TH1F("dummyH","",1, 0.,1.); dummyF->SetLineColor( iLineColor ); dummyF->SetLineWidth( 2 ); dummyH->SetLineColor( kBlue ); TLegend * box2 = new TLegend(0.4,0.70,0.80,0.90); box2->SetFillColor(0); box2->SetBorderSize(0); box2->AddEntry(dummyH,"Simulation (POWHEG+Pythia) ","pe"); box2->AddEntry(dummyH,lname,""); box2->AddEntry(dummyH,"",""); box2->AddEntry(dummyF,lname2,"l"); TPaveText *pt = new TPaveText(0.15,0.955,0.4,0.99,"NDC"); pt->SetFillColor(0); pt->SetBorderSize(0); pt->AddText("CMS Preliminary 2012"); TPaveText *pt2 = new TPaveText(0.84,0.955,0.99,0.99,"NDC"); pt2->SetFillColor(0); pt2->SetBorderSize(0); TString entag;entag.Form("#sqrt{s} = %d TeV",sqrts); pt2->AddText(entag.Data()); TCanvas *c = new TCanvas("c","c",800,600); c->cd(); frameM4l->Draw(); frameM4l->GetYaxis()->SetRangeUser(0,0.4); if(channel == 3)frameM4l->GetYaxis()->SetRangeUser(0,0.7); box2->Draw(); pt->Draw(); pt2->Draw(); TString outputPath = "bkgFigs"; outputPath = outputPath+ (long) sqrts + "TeV/"; TString outputName; if(VBFtag<2) outputName = outputPath + "bkgqqzz_" + schannel + "_" + Form("%d",int(VBFtag)); if(VBFtag==2) outputName = outputPath + "bkgqqzz_" + schannel; c->SaveAs(outputName + ".eps"); c->SaveAs(outputName + ".png"); TCanvas *c2 = new TCanvas("c2","c2",1000,500); c2->Divide(2,1); c2->cd(1); frameM4l->Draw(); box2->Draw("same"); c2->cd(2); frameM4lz->Draw(); box2->Draw("same"); if (VBFtag<2) outputName = outputPath + "bkgqqzz_" + schannel + "_z" + "_" + Form("%d",int(VBFtag)); if (VBFtag==2) outputName = outputPath + "bkgqqzz_" + schannel + "_z"; c2->SaveAs(outputName + ".eps"); c2->SaveAs(outputName + ".png"); /* TO make the ratio btw 2 shapes, if needed for compairson TCanvas *c3 = new TCanvas("c3","c3",1000,500); if(sqrts==7) sprintf(outputName, "bkgFigs7TeV/bkgqqzz_%s_ratio.eps",schannel.c_str()); else if(sqrts==8) sprintf(outputName, "bkgFigs8TeV/bkgqqzz_%s_ratio.eps",schannel.c_str()); const int nPoints = 501.; double masses[nPoints] ; int j=0; for (int i=100; i<601; i++){ masses[j] = i; j++; } cout<<j<<endl; double effDiff[nPoints]; for (int i = 0; i < nPoints; i++){ ZZMass->setVal(masses[i]); double eval = (bkg_qqzz_bkgd->getVal(otherASet)-bkg_qqzz->getVal(myASet))/(bkg_qqzz->getVal(myASet)); //cout<<bkg_qqzz_bkgd->getVal(otherASet)<<" "<<bkg_qqzz->getVal(myASet)<<" "<<eval<<endl; effDiff[i]=eval; } TGraph* grEffDiff = new TGraph( nPoints, masses, effDiff ); grEffDiff->SetMarkerStyle(20); grEffDiff->Draw("AL"); //c3->SaveAs(outputName); */ if (VBFtag<2) outputName = outputPath + "bkgqqzz_" + schannel + "_z" + "_" + Form("%d",int(VBFtag)) + ".root"; if (VBFtag==2) outputName = outputPath + "bkgqqzz_" + schannel + "_z" + ".root"; TFile* outF = new TFile(outputName,"RECREATE"); outF->cd(); c2->Write(); frameM4l->Write(); frameM4lz->Write(); outF->Close(); delete c; delete c2; }
void DrawPtResolutionComparison(const char algorithm[100]) { const int NETA = 6; const double eta_boundaries[NETA+1]={0.0,0.55,1.1,1.7,2.5,3.2,5.0}; TCanvas *c[NETA],*c1[NETA]; int i,j,etabin,counter; char name[100],cname[100],filename[100]; TF1 *fitRes[NETA][2]; TFile *inf[2]; sprintf(filename,"ResolutionResults_%s_AllJets.root",algorithm); inf[0] = new TFile(filename); sprintf(filename,"ResolutionResults_%s_LeadingJets.root",algorithm); inf[1] = new TFile(filename); for(etabin=0;etabin<NETA;etabin++) { sprintf(name,"ResolutionFit_Eta%d",etabin); fitRes[etabin][0] = (TF1*)inf[0]->Get(name); fitRes[etabin][1] = (TF1*)inf[1]->Get(name); } for(etabin=0;etabin<NETA;etabin++) { double ptmax = TMath::Min(2000.,5000./cosh(eta_boundaries[etabin])); TH1F *tmp = new TH1F("tmp","tmp",100,20,ptmax); sprintf(name,"%1.2f<|y|<%1.2f",eta_boundaries[etabin],eta_boundaries[etabin+1]); TPaveText *pave = new TPaveText(0.6,0.7,0.9,0.9,"NDC"); pave->AddText("Monte Carlo Truth"); pave->AddText(name); if (strcmp(algorithm,"SC7")==0) pave->AddText("Seedless Cone R = 0.7"); else pave->AddText("k_{T} D = 0.6"); pave->SetFillColor(0); pave->SetLineColor(0); pave->SetBorderSize(0); pave->SetTextFont(42); TLegend *leg = new TLegend(0.6,0.6,0.9,0.7); sprintf(cname,"%s_Resolution_EtaBin%d",algorithm,etabin); c1[etabin] = new TCanvas(cname,cname); c1[etabin]->cd(); gPad->SetLogx(); tmp->SetTitle(""); tmp->SetMaximum(0.4); tmp->SetMinimum(0.); tmp->GetXaxis()->SetTitle("Particle jet p_{T} (GeV)"); tmp->GetYaxis()->SetTitle("Relative Energy Resolution"); fitRes[etabin][0]->SetLineColor(1); fitRes[etabin][1]->SetLineColor(2); tmp->Draw(); fitRes[etabin][0]->Draw("same"); fitRes[etabin][1]->Draw("same"); leg->AddEntry(fitRes[etabin][0],"All jets","L"); leg->AddEntry(fitRes[etabin][1],"2 leading jets","L"); leg->SetFillColor(0); leg->SetLineColor(0); leg->SetBorderSize(0); leg->SetTextFont(42); leg->Draw(); pave->Draw(); } }
void acceptance_mass() { //=========Macro generated from canvas: c2/c2 //========= (Mon Oct 26 11:11:00 2015) by ROOT version6.02/05 TCanvas *c2 = new TCanvas("c2", "c2",20,42,700,500); gStyle->SetOptStat(0); c2->Range(-1.3125,-0.025,9.8125,0.225); c2->SetFillColor(0); c2->SetBorderMode(0); c2->SetBorderSize(2); c2->SetFrameBorderMode(0); c2->SetFrameBorderMode(0); TH2F *dummy42 = new TH2F("dummy42","dummy4",178,-0.2,8.7,100,0,0.2); dummy42->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); dummy42->SetLineColor(ci); dummy42->GetXaxis()->SetTitle("Mass [GeV]"); dummy42->GetXaxis()->SetLabelFont(42); dummy42->GetXaxis()->SetLabelSize(0.035); dummy42->GetXaxis()->SetTitleSize(0.035); dummy42->GetXaxis()->SetTitleFont(42); dummy42->GetYaxis()->SetTitle("#epsilon_{rec} = N_{rec}/N_{tot}"); dummy42->GetYaxis()->SetLabelFont(42); dummy42->GetYaxis()->SetLabelSize(0.035); dummy42->GetYaxis()->SetTitleSize(0.035); dummy42->GetYaxis()->SetTitleFont(42); dummy42->GetZaxis()->SetLabelFont(42); dummy42->GetZaxis()->SetLabelSize(0.035); dummy42->GetZaxis()->SetTitleSize(0.035); dummy42->GetZaxis()->SetTitleFont(42); dummy42->Draw(""); Double_t Graph0_fx1006[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph0_fy1006[5] = { 0.0865404, 0.08208333, 0.0749858, 0.05958333, 0.1375897}; Double_t Graph0_fex1006[5] = { 0, 0, 0, 0, 0}; Double_t Graph0_fey1006[5] = { 0.0009990599, 0.0009753636, 0.0009926071, 0.0008541653, 0.001244048}; TGraphErrors *gre = new TGraphErrors(5,Graph0_fx1006,Graph0_fy1006,Graph0_fex1006,Graph0_fey1006); gre->SetName("Graph0"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","Graph",100,0,9.325); Graph_Graph1006->SetMinimum(0.05071871); Graph_Graph1006->SetMaximum(0.1468442); Graph_Graph1006->SetDirectory(0); Graph_Graph1006->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1006->SetLineColor(ci); Graph_Graph1006->GetXaxis()->SetLabelFont(42); Graph_Graph1006->GetXaxis()->SetLabelSize(0.035); Graph_Graph1006->GetXaxis()->SetTitleSize(0.035); Graph_Graph1006->GetXaxis()->SetTitleFont(42); Graph_Graph1006->GetYaxis()->SetLabelFont(42); Graph_Graph1006->GetYaxis()->SetLabelSize(0.035); Graph_Graph1006->GetYaxis()->SetTitleSize(0.035); Graph_Graph1006->GetYaxis()->SetTitleFont(42); Graph_Graph1006->GetZaxis()->SetLabelFont(42); Graph_Graph1006->GetZaxis()->SetLabelSize(0.035); Graph_Graph1006->GetZaxis()->SetTitleSize(0.035); Graph_Graph1006->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1006); gre->Draw(" pl"); Double_t Graph1_fx1007[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph1_fy1007[4] = { 0.08294682, 0.07862374, 0.06207908, 0.137474}; Double_t Graph1_fex1007[4] = { 0, 0, 0, 0}; Double_t Graph1_fey1007[4] = { 0.0009899688, 0.000956385, 0.0008617826, 0.001242555}; gre = new TGraphErrors(4,Graph1_fx1007,Graph1_fy1007,Graph1_fex1007,Graph1_fey1007); gre->SetName("Graph1"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(2); gre->SetMarkerColor(2); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","Graph",100,0,9.325); Graph_Graph1007->SetMinimum(0.05346738); Graph_Graph1007->SetMaximum(0.1464664); Graph_Graph1007->SetDirectory(0); Graph_Graph1007->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1007->SetLineColor(ci); Graph_Graph1007->GetXaxis()->SetLabelFont(42); Graph_Graph1007->GetXaxis()->SetLabelSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleFont(42); Graph_Graph1007->GetYaxis()->SetLabelFont(42); Graph_Graph1007->GetYaxis()->SetLabelSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleFont(42); Graph_Graph1007->GetZaxis()->SetLabelFont(42); Graph_Graph1007->GetZaxis()->SetLabelSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1007); gre->Draw(" pl"); Double_t Graph2_fx1008[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph2_fy1008[5] = { 0.06949495, 0.06748737, 0.0642268, 0.06051768, 0.1364046}; Double_t Graph2_fex1008[5] = { 0, 0, 0, 0, 0}; Double_t Graph2_fey1008[5] = { 0.0009035941, 0.000891407, 0.0008800606, 0.000847272, 0.00123208}; gre = new TGraphErrors(5,Graph2_fx1008,Graph2_fy1008,Graph2_fex1008,Graph2_fey1008); gre->SetName("Graph2"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(3); gre->SetMarkerColor(3); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,9.325); Graph_Graph1008->SetMinimum(0.05187377); Graph_Graph1008->SetMaximum(0.1454334); Graph_Graph1008->SetDirectory(0); Graph_Graph1008->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1008->SetLineColor(ci); Graph_Graph1008->GetXaxis()->SetLabelFont(42); Graph_Graph1008->GetXaxis()->SetLabelSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleFont(42); Graph_Graph1008->GetYaxis()->SetLabelFont(42); Graph_Graph1008->GetYaxis()->SetLabelSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleFont(42); Graph_Graph1008->GetZaxis()->SetLabelFont(42); Graph_Graph1008->GetZaxis()->SetLabelSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1008); gre->Draw(" pl"); Double_t Graph3_fx1009[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph3_fy1009[5] = { 0.04645202, 0.04597222, 0.04502717, 0.05941919, 0.1359975}; Double_t Graph3_fex1009[5] = { 0, 0, 0, 0, 0}; Double_t Graph3_fey1009[5] = { 0.000747844, 0.0007441589, 0.0007643529, 0.0008400378, 0.001218037}; gre = new TGraphErrors(5,Graph3_fx1009,Graph3_fy1009,Graph3_fex1009,Graph3_fey1009); gre->SetName("Graph3"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","Graph",100,0,9.325); Graph_Graph1009->SetMinimum(0.03496755); Graph_Graph1009->SetMaximum(0.1465108); Graph_Graph1009->SetDirectory(0); Graph_Graph1009->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1009->SetLineColor(ci); Graph_Graph1009->GetXaxis()->SetLabelFont(42); Graph_Graph1009->GetXaxis()->SetLabelSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleFont(42); Graph_Graph1009->GetYaxis()->SetLabelFont(42); Graph_Graph1009->GetYaxis()->SetLabelSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleFont(42); Graph_Graph1009->GetZaxis()->SetLabelFont(42); Graph_Graph1009->GetZaxis()->SetLabelSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1009); gre->Draw(" pl"); Double_t Graph4_fx1010[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph4_fy1010[5] = { 0.0157633, 0.01659091, 0.01693182, 0.05516582, 0.1364646}; Double_t Graph4_fex1010[5] = { 0, 0, 0, 0, 0}; Double_t Graph4_fey1010[5] = { 0.0004493916, 0.0004538785, 0.0004584384, 0.0008153701, 0.001219797}; gre = new TGraphErrors(5,Graph4_fx1010,Graph4_fy1010,Graph4_fex1010,Graph4_fey1010); gre->SetName("Graph4"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(6); gre->SetMarkerColor(6); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1010 = new TH1F("Graph_Graph1010","Graph",100,0,9.325); Graph_Graph1010->SetMinimum(0.003076858); Graph_Graph1010->SetMaximum(0.1499215); Graph_Graph1010->SetDirectory(0); Graph_Graph1010->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1010->SetLineColor(ci); Graph_Graph1010->GetXaxis()->SetLabelFont(42); Graph_Graph1010->GetXaxis()->SetLabelSize(0.035); Graph_Graph1010->GetXaxis()->SetTitleSize(0.035); Graph_Graph1010->GetXaxis()->SetTitleFont(42); Graph_Graph1010->GetYaxis()->SetLabelFont(42); Graph_Graph1010->GetYaxis()->SetLabelSize(0.035); Graph_Graph1010->GetYaxis()->SetTitleSize(0.035); Graph_Graph1010->GetYaxis()->SetTitleFont(42); Graph_Graph1010->GetZaxis()->SetLabelFont(42); Graph_Graph1010->GetZaxis()->SetLabelSize(0.035); Graph_Graph1010->GetZaxis()->SetTitleSize(0.035); Graph_Graph1010->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1010); gre->Draw(" pl"); Double_t Graph5_fx1011[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph5_fy1011[4] = { 0.005542929, 0.005892857, 0.04303571, 0.132096}; Double_t Graph5_fex1011[4] = { 0, 0, 0, 0}; Double_t Graph5_fey1011[4] = { 0.0002638154, 0.0002733515, 0.0007247769, 0.001203145}; gre = new TGraphErrors(4,Graph5_fx1011,Graph5_fy1011,Graph5_fex1011,Graph5_fey1011); gre->SetName("Graph5"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(7); gre->SetMarkerColor(7); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1011 = new TH1F("Graph_Graph1011","Graph",100,0,9.325); Graph_Graph1011->SetMinimum(0); Graph_Graph1011->SetMaximum(0.1461011); Graph_Graph1011->SetDirectory(0); Graph_Graph1011->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1011->SetLineColor(ci); Graph_Graph1011->GetXaxis()->SetLabelFont(42); Graph_Graph1011->GetXaxis()->SetLabelSize(0.035); Graph_Graph1011->GetXaxis()->SetTitleSize(0.035); Graph_Graph1011->GetXaxis()->SetTitleFont(42); Graph_Graph1011->GetYaxis()->SetLabelFont(42); Graph_Graph1011->GetYaxis()->SetLabelSize(0.035); Graph_Graph1011->GetYaxis()->SetTitleSize(0.035); Graph_Graph1011->GetYaxis()->SetTitleFont(42); Graph_Graph1011->GetZaxis()->SetLabelFont(42); Graph_Graph1011->GetZaxis()->SetLabelSize(0.035); Graph_Graph1011->GetZaxis()->SetTitleSize(0.035); Graph_Graph1011->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1011); gre->Draw(" pl"); Double_t Graph6_fx1012[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph6_fy1012[5] = { 0.00155303, 0.001868687, 0.002222281, 0.02356061, 0.1211862}; Double_t Graph6_fex1012[5] = { 0, 0, 0, 0, 0}; Double_t Graph6_fey1012[5] = { 0.0001399232, 0.0001534615, 0.0001707546, 0.000538956, 0.001165513}; gre = new TGraphErrors(5,Graph6_fx1012,Graph6_fy1012,Graph6_fex1012,Graph6_fey1012); gre->SetName("Graph6"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(8); gre->SetMarkerColor(8); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1012 = new TH1F("Graph_Graph1012","Graph",100,0,9.325); Graph_Graph1012->SetMinimum(0); Graph_Graph1012->SetMaximum(0.1344456); Graph_Graph1012->SetDirectory(0); Graph_Graph1012->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1012->SetLineColor(ci); Graph_Graph1012->GetXaxis()->SetLabelFont(42); Graph_Graph1012->GetXaxis()->SetLabelSize(0.035); Graph_Graph1012->GetXaxis()->SetTitleSize(0.035); Graph_Graph1012->GetXaxis()->SetTitleFont(42); Graph_Graph1012->GetYaxis()->SetLabelFont(42); Graph_Graph1012->GetYaxis()->SetLabelSize(0.035); Graph_Graph1012->GetYaxis()->SetTitleSize(0.035); Graph_Graph1012->GetYaxis()->SetTitleFont(42); Graph_Graph1012->GetZaxis()->SetLabelFont(42); Graph_Graph1012->GetZaxis()->SetLabelSize(0.035); Graph_Graph1012->GetZaxis()->SetTitleSize(0.035); Graph_Graph1012->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1012); gre->Draw(" pl"); Double_t Graph7_fx1013[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph7_fy1013[4] = { 0.0009974747, 0.0009974747, 0.01513298, 0.1061111}; Double_t Graph7_fex1013[4] = { 0, 0, 0, 0}; Double_t Graph7_fey1013[4] = { 0.0001121687, 0.0001121687, 0.0004451866, 0.001147773}; gre = new TGraphErrors(4,Graph7_fx1013,Graph7_fy1013,Graph7_fex1013,Graph7_fey1013); gre->SetName("Graph7"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(9); gre->SetMarkerColor(9); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1013 = new TH1F("Graph_Graph1013","Graph",100,0,9.325); Graph_Graph1013->SetMinimum(0); Graph_Graph1013->SetMaximum(0.1178962); Graph_Graph1013->SetDirectory(0); Graph_Graph1013->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1013->SetLineColor(ci); Graph_Graph1013->GetXaxis()->SetLabelFont(42); Graph_Graph1013->GetXaxis()->SetLabelSize(0.035); Graph_Graph1013->GetXaxis()->SetTitleSize(0.035); Graph_Graph1013->GetXaxis()->SetTitleFont(42); Graph_Graph1013->GetYaxis()->SetLabelFont(42); Graph_Graph1013->GetYaxis()->SetLabelSize(0.035); Graph_Graph1013->GetYaxis()->SetTitleSize(0.035); Graph_Graph1013->GetYaxis()->SetTitleFont(42); Graph_Graph1013->GetZaxis()->SetLabelFont(42); Graph_Graph1013->GetZaxis()->SetLabelSize(0.035); Graph_Graph1013->GetZaxis()->SetTitleSize(0.035); Graph_Graph1013->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1013); gre->Draw(" pl"); Double_t Graph8_fx1014[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph8_fy1014[5] = { 0.0002651515, 0.0004419192, 0.0003815789, 0.006989796, 0.07766414}; Double_t Graph8_fex1014[5] = { 0, 0, 0, 0, 0}; Double_t Graph8_fey1014[5] = { 5.785313e-05, 7.468147e-05, 7.084391e-05, 0.0002975439, 0.0009510256}; gre = new TGraphErrors(5,Graph8_fx1014,Graph8_fy1014,Graph8_fex1014,Graph8_fey1014); gre->SetName("Graph8"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(40); gre->SetMarkerColor(40); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1014 = new TH1F("Graph_Graph1014","Graph",100,0,9.325); Graph_Graph1014->SetMinimum(0); Graph_Graph1014->SetMaximum(0.08645595); Graph_Graph1014->SetDirectory(0); Graph_Graph1014->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1014->SetLineColor(ci); Graph_Graph1014->GetXaxis()->SetLabelFont(42); Graph_Graph1014->GetXaxis()->SetLabelSize(0.035); Graph_Graph1014->GetXaxis()->SetTitleSize(0.035); Graph_Graph1014->GetXaxis()->SetTitleFont(42); Graph_Graph1014->GetYaxis()->SetLabelFont(42); Graph_Graph1014->GetYaxis()->SetLabelSize(0.035); Graph_Graph1014->GetYaxis()->SetTitleSize(0.035); Graph_Graph1014->GetYaxis()->SetTitleFont(42); Graph_Graph1014->GetZaxis()->SetLabelFont(42); Graph_Graph1014->GetZaxis()->SetLabelSize(0.035); Graph_Graph1014->GetZaxis()->SetTitleSize(0.035); Graph_Graph1014->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1014); gre->Draw(" pl"); Double_t Graph9_fx1015[2] = { 0.25, 2}; Double_t Graph9_fy1015[2] = { 6.47017e-05, 0.002367956}; Double_t Graph9_fex1015[2] = { 0, 0}; Double_t Graph9_fey1015[2] = { 1.3794e-05, 6.810597e-05}; gre = new TGraphErrors(2,Graph9_fx1015,Graph9_fy1015,Graph9_fex1015,Graph9_fey1015); gre->SetName("Graph9"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1015 = new TH1F("Graph_Graph1015","Graph",100,0.075,2.175); Graph_Graph1015->SetMinimum(0); Graph_Graph1015->SetMaximum(0.002674577); Graph_Graph1015->SetDirectory(0); Graph_Graph1015->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1015->SetLineColor(ci); Graph_Graph1015->GetXaxis()->SetLabelFont(42); Graph_Graph1015->GetXaxis()->SetLabelSize(0.035); Graph_Graph1015->GetXaxis()->SetTitleSize(0.035); Graph_Graph1015->GetXaxis()->SetTitleFont(42); Graph_Graph1015->GetYaxis()->SetLabelFont(42); Graph_Graph1015->GetYaxis()->SetLabelSize(0.035); Graph_Graph1015->GetYaxis()->SetTitleSize(0.035); Graph_Graph1015->GetYaxis()->SetTitleFont(42); Graph_Graph1015->GetZaxis()->SetLabelFont(42); Graph_Graph1015->GetZaxis()->SetLabelSize(0.035); Graph_Graph1015->GetZaxis()->SetTitleSize(0.035); Graph_Graph1015->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1015); gre->Draw(" pl"); Double_t Graph10_fx1016[2] = { 0.25, 2}; Double_t Graph10_fy1016[2] = { 2.397917e-05, 0.0007142042}; Double_t Graph10_fex1016[2] = { 0, 0}; Double_t Graph10_fey1016[2] = { 9.063167e-06, 4.035479e-05}; gre = new TGraphErrors(2,Graph10_fx1016,Graph10_fy1016,Graph10_fex1016,Graph10_fey1016); gre->SetName("Graph10"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1016 = new TH1F("Graph_Graph1016","Graph",100,0.075,2.175); Graph_Graph1016->SetMinimum(0); Graph_Graph1016->SetMaximum(0.0008285233); Graph_Graph1016->SetDirectory(0); Graph_Graph1016->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1016->SetLineColor(ci); Graph_Graph1016->GetXaxis()->SetLabelFont(42); Graph_Graph1016->GetXaxis()->SetLabelSize(0.035); Graph_Graph1016->GetXaxis()->SetTitleSize(0.035); Graph_Graph1016->GetXaxis()->SetTitleFont(42); Graph_Graph1016->GetYaxis()->SetLabelFont(42); Graph_Graph1016->GetYaxis()->SetLabelSize(0.035); Graph_Graph1016->GetYaxis()->SetTitleSize(0.035); Graph_Graph1016->GetYaxis()->SetTitleFont(42); Graph_Graph1016->GetZaxis()->SetLabelFont(42); Graph_Graph1016->GetZaxis()->SetLabelSize(0.035); Graph_Graph1016->GetZaxis()->SetTitleSize(0.035); Graph_Graph1016->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1016); gre->Draw(" pl"); TLegend *leg = new TLegend(0.158046,0.5369979,0.5071839,0.8372093,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.045); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph0","c#Tau=0.00 mm","PL"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph1","c#Tau=0.05 mm","PL"); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(2); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","c#Tau=0.10 mm","PL"); entry->SetLineColor(3); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(3); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph3","c#Tau=0.20 mm","PL"); entry->SetLineColor(4); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph4","c#Tau=0.50 mm","PL"); entry->SetLineColor(6); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(6); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph5","c#Tau=1.00 mm","PL"); entry->SetLineColor(7); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(7); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph6","c#Tau=2.00 mm","PL"); entry->SetLineColor(8); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(8); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph7","c#Tau=3.00 mm","PL"); entry->SetLineColor(9); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(9); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph8","c#Tau=5.00 mm","PL"); entry->SetLineColor(40); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(40); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); leg->Draw(); TPaveText *pt = new TPaveText(0.4195977,0.9339831,0.5804023,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("dummy4"); pt->Draw(); c2->Modified(); c2->cd(); c2->SetSelected(c2); }
void jeteta2() { TString sysname ="JETETA.root"; TFile *sysinput(0); sysinput = TFile::Open( sysname ); // if not: download from ROOT server std::vector<string> variables_; TString name; variables_.push_back("BDT__zjethist"); // variables_.push_back("BDT__phjethist"); variables_.push_back("BDT__tbartchhist"); variables_.push_back("BDT__tt3hist"); variables_.push_back("BDT__ttphhist"); variables_.push_back("BDT__wwphhist"); variables_.push_back("BDT__zzhist"); variables_.push_back("BDT__zgammahist"); variables_.push_back("BDT__singleantitopphotonhist"); std::vector<TH1F*> addhists; std::vector<TH1F*> wjetandwphjet; wjetandwphjet.push_back((TH1F*) sysinput->Get((std::string("BDT__wjet").c_str()))); wjetandwphjet.push_back((TH1F*) sysinput->Get((std::string("BDT__wphjethist").c_str()))); std::vector<TH1F*> jesuphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__JES__plus"; jesuphists.push_back((TH1F*) sysinput->Get(name)); } //jesuphists.push_back((TH1F*) sysinput->Get((std::string("BDT__wjet").c_str()))); //jesuphists.push_back((TH1F*) sysinput->Get((std::string("BDT__wphjethist").c_str()))); for(unsigned int idx=1; idx<variables_.size(); ++idx){ jesuphists[idx]->Add(jesuphists[idx-1]); } addhists.push_back(jesuphists[variables_.size()-1]); std::vector<TH1F*> jesdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__JES__minus"; jesdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ jesdownhists[idx]->Add(jesdownhists[idx-1]);} addhists.push_back(jesdownhists[variables_.size()-1]); std::vector<TH1F*> jeruphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__JER__plus"; jeruphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ jeruphists[idx]->Add(jeruphists[idx-1]);} addhists.push_back(jeruphists[variables_.size()-1]); std::vector<TH1F*> jerdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__JER__minus"; jerdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ jerdownhists[idx]->Add(jerdownhists[idx-1]);} addhists.push_back(jerdownhists[variables_.size()-1]); std::vector<TH1F*> phesuphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PhES__plus"; phesuphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ phesuphists[idx]->Add(phesuphists[idx-1]);} addhists.push_back(phesuphists[variables_.size()-1]); std::vector<TH1F*> phesdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PhES__minus"; phesdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ phesdownhists[idx]->Add(phesdownhists[idx-1]);} addhists.push_back(phesdownhists[variables_.size()-1]); std::vector<TH1F*> puuphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PU__plus"; puuphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ puuphists[idx]->Add(puuphists[idx-1]);} addhists.push_back(puuphists[variables_.size()-1]); std::vector<TH1F*> pudownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PU__minus"; pudownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ pudownhists[idx]->Add(pudownhists[idx-1]);} addhists.push_back(pudownhists[variables_.size()-1]); std::vector<TH1F*> triguphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__TRIG__plus"; triguphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ triguphists[idx]->Add(triguphists[idx-1]);} addhists.push_back(triguphists[variables_.size()-1]); std::vector<TH1F*> trigdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__TRIG__minus"; trigdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ trigdownhists[idx]->Add(trigdownhists[idx-1]);} addhists.push_back(trigdownhists[variables_.size()-1]); std::vector<TH1F*> btaguphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__BTAG__plus"; btaguphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ btaguphists[idx]->Add(btaguphists[idx-1]);} addhists.push_back(btaguphists[variables_.size()-1]); std::vector<TH1F*> btagdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__BTAG__minus"; btagdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ btagdownhists[idx]->Add(btagdownhists[idx-1]);} addhists.push_back(btagdownhists[variables_.size()-1]); std::vector<TH1F*> misstaguphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__MISSTAG__plus"; misstaguphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ misstaguphists[idx]->Add(misstaguphists[idx-1]);} addhists.push_back(misstaguphists[variables_.size()-1]); std::vector<TH1F*> misstagdownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__MISSTAG__minus"; misstagdownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ misstagdownhists[idx]->Add(misstagdownhists[idx-1]);} addhists.push_back(misstagdownhists[variables_.size()-1]); std::vector<TH1F*> muonuphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__MUON__plus"; muonuphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ muonuphists[idx]->Add(muonuphists[idx-1]);} addhists.push_back(muonuphists[variables_.size()-1]); std::vector<TH1F*> muondownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__MUON__minus"; muondownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ muondownhists[idx]->Add(muondownhists[idx-1]);} addhists.push_back(muondownhists[variables_.size()-1]); std::vector<TH1F*> photonuphists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PHOTON__plus"; photonuphists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ photonuphists[idx]->Add(photonuphists[idx-1]);} addhists.push_back(photonuphists[variables_.size()-1]); std::vector<TH1F*> photondownhists; for(unsigned int i=0; i<variables_.size(); ++i){ name=variables_[i]+"__PHOTON__minus"; photondownhists.push_back((TH1F*) sysinput->Get(name));} for(unsigned int idx=1; idx<variables_.size(); ++idx){ photondownhists[idx]->Add(photondownhists[idx-1]);} addhists.push_back(photondownhists[variables_.size()-1]); std::vector<std::vector<double_t> > vec(photondownhists[0]->GetNbinsX(), vector<double>(18)); for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins for(int m = 0; m < 18; m++){ //loop over systematics vec[p][m]=addhists[m]->GetBinContent(p+1)+wjetandwphjet[0]->GetBinContent(p+1)+wjetandwphjet[1]->GetBinContent(p+1); cout<<vec[p][m]<<endl; }} // Book output histograms UInt_t nbin = 15; double min=-3; double max=3; // Prepare input tree (this must be replaced by your data source) // in this example, there is a toy tree with signal and one with background events // we'll later on use only the "signal" events for the test in this example. // TFile *input(0); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// std::vector<string> samples_; std::vector<string> datasamples_; std::vector<TH1F*> hists; std::vector<TH1F*> datahists; std::vector<TH1F*> revDATAhists; float scales[] = {0.628,0.0978,34.01,6.133,1.04,0.32,0.02,0.002,0.0961,0.0253,0.0224,0.0145,0.0125,0.0160,0.0158,0.0341,0.0341,0.0341,0.020,0.0017,0.0055,0.0032,0.00084,0.02,0.01139,0.01139,0.049094905/19.145}; samples_.push_back("WJET.root"); samples_.push_back("ZJET.root"); samples_.push_back("G_Pt_50to80.root"); samples_.push_back("G_Pt_80to120.root"); samples_.push_back("G_Pt_120to170.root"); samples_.push_back("G_Pt_170to300.root"); samples_.push_back("G_Pt_300to470.root"); samples_.push_back("G_Pt_470to800.root"); samples_.push_back("WPHJET.root"); samples_.push_back("T-W-CH.root"); samples_.push_back("TBAR-W-CH.root"); samples_.push_back("T-S-CH.root"); samples_.push_back("TBAR-S-CH.root"); samples_.push_back("T-T-CH.root"); samples_.push_back("TBAR-T-CH.root"); samples_.push_back("TTBAR1.root"); samples_.push_back("TTBAR2.root"); samples_.push_back("TTBAR3.root"); samples_.push_back("TTG.root"); samples_.push_back("WWG.root"); samples_.push_back("WW.root"); samples_.push_back("WZ.root"); samples_.push_back("ZZ.root"); samples_.push_back("ZGAMMA.root"); samples_.push_back("SINGLE-TOP-PH.root"); samples_.push_back("SINGLE-ANTITOP-PH.root"); samples_.push_back("SIGNALtGu.root"); datasamples_.push_back("REALDATA1.root"); datasamples_.push_back("REALDATA2.root"); datasamples_.push_back("REALDATA3.root"); std::vector<string> datasamplesreverse_; datasamplesreverse_.push_back("etarev/REALDATA1.root"); datasamplesreverse_.push_back("etarev/REALDATA2.root"); datasamplesreverse_.push_back("etarev/REALDATA3.root"); TH1F *wphjethist(0), *zjethist(0) , *phjethist(0), *wjethist(0), *twchhist(0), *tbarwhist(0), *tschhist(0), *tbarschhist(0), *ttchhist(0), *tbartchhist(0), *tt1hist(0) ,*tt2hist(0), *tt3hist(0), *ttphhist(0), *wwphhist(0), *wwhist(0), *wzhist(0), *zzhist(0), *zgammahist(0),*singletopphotonhist(0), *singleantitopphotonhist(0), *signalhist(0), *G_Pt_50to80(0),*G_Pt_80to120(0), *G_Pt_120to170(0), *G_Pt_170to300(0) ,*G_Pt_300to470(0),*G_Pt_470to800(0) ; TH1F *wphjethistSB(0), *zjethistSB(0) , *phjethistSB(0), *wjethistSB(0), *twchhistSB(0), *tbarwhistSB(0), *tschhistSB(0), *tbarschhistSB(0), *ttchhistSB(0), *tbartchhistSB(0), *tt1histSB(0) ,*tt2histSB(0), *tt3histSB(0), *ttphhistSB(0), *wwphhistSB(0), *wwhistSB(0), *wzhistSB(0), *zzhistSB(0), *zgammahistSB(0),*singletopphotonhistSB(0), *singleantitopphotonhistSB(0), *signalhistSB(0), *G_Pt_50to80SB(0),*G_Pt_80to120SB(0), *G_Pt_120to170SB(0), *G_Pt_170to300SB(0) ,*G_Pt_300to470SB(0),*G_Pt_470to800SB(0) ; TH1F *data1hist(0), *data2hist(0) ,*data3hist(0) ,*datahistsideband(0); TH1F *data1histrev(0), *data2histrev(0) ,*data3histrev(0), *datahistrevsideband(0); wphjethist = new TH1F( "mu_BDT__wphjethist", "mu_BDT__wphjethist", nbin, min, max ); zjethist = new TH1F( "mu_BDT__zjethist", "mu_BDT__zjethist", nbin, min, max ); G_Pt_50to80= new TH1F( "mu_BDT__G_Pt_50to80", "mu_BDT__G_Pt_50to80", nbin, min, max ); G_Pt_80to120= new TH1F( "mu_BDT__G_Pt_80to120", "mu_BDT__G_Pt_80to120", nbin, min, max ); G_Pt_120to170= new TH1F( "mu_BDT__G_Pt_120to170", "mu_BDT__G_Pt_120to170", nbin, min, max ); G_Pt_170to300= new TH1F( "mu_BDT__G_Pt_170to300", "mu_BDT__G_Pt_170to300", nbin, min, max ); G_Pt_300to470= new TH1F( "mu_BDT__G_Pt_300to470", "mu_BDT__G_Pt_300to470", nbin, min, max ); G_Pt_470to800= new TH1F( "mu_BDT__G_Pt_470to800", "mu_BDT__G_Pt_470to800", nbin, min, max ); wjethist = new TH1F( "mu_BDT__wjethist", "mu_BDT__wjethist", nbin, min, max); twchhist = new TH1F( "mu_BDT__twchhist", "mu_BDT__twchhist", nbin, min, max ); tbarwhist = new TH1F( "mu_BDT__tbarwhist", "mu_BDT__tbarwhist", nbin, min, max ); tschhist = new TH1F( "mu_BDT__tschhist", "mu_BDT__tschhist", nbin, min, max ); tbarschhist = new TH1F( "mu_BDT__tbarschhist", "mu_BDT__tbarschhist", nbin, min, max ); ttchhist = new TH1F( "mu_BDT__ttchhist", "mu_BDT__ttchhist", nbin, min, max ); tbartchhist = new TH1F( "mu_BDT__tbartchhist", "mu_BDT__tbartchhist", nbin, min, max); tt1hist = new TH1F( "mu_BDT__tt1hist", "mu_BDT__tt1hist", nbin,min, max ); tt2hist = new TH1F( "mu_BDT__tt2hist", "mu_BDT__tt2hist", nbin, min, max); tt3hist = new TH1F( "mu_BDT__tt3hist", "mu_BDT__tt3hist", nbin, min, max); ttphhist = new TH1F( "mu_BDT__ttphhist", "mu_BDT__ttphhist", nbin, min, max); wwphhist = new TH1F( "mu_BDT__wwphhist", "BDT__wwphhist", nbin,min, max ); wwhist = new TH1F( "mu_BDT__wwhist", "mu_BDT__wwhist", nbin,min, max ); wzhist = new TH1F( "mu_BDT__wzhist", "mu_BDT__wzhist", nbin, min, max ); zzhist = new TH1F( "mu_BDT__zzhist", "mu_BDT__zzhist", nbin, min, max ); zgammahist = new TH1F( "mu_BDT__zgammahist", "mu_BDT__zgammahist", nbin,min, max ); singletopphotonhist = new TH1F( "mu_BDT__singletopphotonhist", "mu_BDT__singletopphotonhist", nbin, min, max); singleantitopphotonhist = new TH1F( "mu_BDT__singleantitopphotonhist", "mu_BDT__singleantitopphotonhist", nbin,min, max ); signalhist = new TH1F( "mu_BDT__signal100", "mu_BDT__signal100", nbin, min, max ); data1hist = new TH1F( "mu_BDT__data1hist", "mu_BDT__data1hist", nbin, min, max ); data2hist = new TH1F( "mu_BDT__data2hist", "mu_BDT__data2hist", nbin, min, max ); data3hist = new TH1F( "mu_BDT__DATA", "mu_BDT__DATA", nbin, min, max ); datahistsideband = new TH1F( "mu_BDT__DATA_sideband", "mu_BDT__DATA_sideband", nbin, min, max); data1histrev = new TH1F( "mu_BDT__data1histrev", "mu_BDT__data1histrev", nbin, min, max ); data2histrev = new TH1F( "mu_BDT__data2histrev", "mu_BDT__data2histrev", nbin,min, max ); data3histrev = new TH1F( "mu_BDT__DATArev", "mu_BDT__DATArev", nbin, min, max ); datahistrevsideband = new TH1F( "mu_BDT__DATArevsideband", "mu_BDT__DATArevsideband", nbin, min, max ); wphjethistSB = new TH1F( "mu_BDT__wphjethist__JES__SB", "mu_BDT__wphjethist__JES__SB", nbin,min, max ); zjethistSB = new TH1F( "mu_BDT__zjethist__JES__SB", "mu_BDT__zjethist__JES__SB", nbin, min, max ); G_Pt_50to80SB= new TH1F( "mu_BDT__G_Pt_50to80SB", "mu_BDT__G_Pt_50to80SB", nbin, min, max ); G_Pt_80to120SB= new TH1F( "mu_BDT__G_Pt_80to120SB", "mu_BDT__G_Pt_80to120SB", nbin, min, max ); G_Pt_120to170SB= new TH1F( "mu_BDT__G_Pt_120to170SB", "mu_BDT__G_Pt_120to170SB", nbin, min, max ); G_Pt_170to300SB= new TH1F( "mu_BDT__G_Pt_170to300SB", "mu_BDT__G_Pt_170to300SB", nbin, min, max ); G_Pt_300to470SB= new TH1F( "mu_BDT__G_Pt_300to470SB", "mu_BDT__G_Pt_300to470SB", nbin, min, max ); G_Pt_470to800SB= new TH1F( "mu_BDT__G_Pt_470to800SB", "mu_BDT__G_Pt_470to800SB", nbin, min, max ); wjethistSB = new TH1F( "mu_BDT__wjethist__JES__SB", "mu_BDT__wjethist__JES__SB", nbin, min, max ); twchhistSB = new TH1F( "mu_BDT__twchhist__JES__SB", "mu_BDT__twchhist__JES__SB", nbin,min, max); tbarwhistSB = new TH1F( "mu_BDT__tbarwhist__JES__SB", "mu_BDT__tbarwhist__JES__SB", nbin,min, max ); tschhistSB = new TH1F( "mu_BDT__tschhist__JES__SB", "mu_BDT__tschhist__JES__SB", nbin, min, max ); tbarschhistSB = new TH1F( "mu_BDT__tbarschhist__JES__SB", "mu_BDT__tbarschhist__JES__SB", nbin, min, max ); ttchhistSB = new TH1F( "mu_BDT__ttchhist__JES__SB", "mu_BDT__ttchhist__JES__SB", nbin, min, max ); tbartchhistSB = new TH1F( "mu_BDT__tbartchhist__JES__SB", "mu_BDT__tbartchhist__JES__SB", nbin, min, max); tt1histSB = new TH1F( "mu_BDT__tt1hist__JES__SB", "mu_BDT__tt1hist__JES__SB", nbin, min, max ); tt2histSB = new TH1F( "mu_BDT__tt2hist__JES__SB", "mu_BDT__tt2hist__JES__SB", nbin, min, max ); tt3histSB = new TH1F( "mu_BDT__tt3hist__JES__SB", "mu_BDT__tt3hist__JES__SB", nbin, min, max ); ttphhistSB = new TH1F( "mu_BDT__ttphhist__JES__SB", "mu_BDT__ttphhist__JES__SB", nbin,min, max ); wwphhistSB = new TH1F( "mu_BDT__wwphhist__JES__SB", "BDT__wwphhist__JES__SB", nbin,min, max ); wwhistSB = new TH1F( "mu_BDT__wwhist__JES__SB", "mu_BDT__wwhist__JES__SB", nbin, min, max ); wzhistSB = new TH1F( "mu_BDT__wzhist__JES__SB", "mu_BDT__wzhist__JES__SB", nbin, min, max ); zzhistSB = new TH1F( "mu_BDT__zzhist__JES__SB", "mu_BDT__zzhist__JES__SB", nbin, min, max); zgammahistSB = new TH1F( "mu_BDT__zgammahist__JES__SB", "mu_BDT__zgammahist__JES__SB", nbin, min, max ); singletopphotonhistSB = new TH1F( "mu_BDT__singletopphotonhistSB", "mu_BDT__singletopphotonhistSB", nbin,min, max ); singleantitopphotonhistSB = new TH1F( "mu_BDT__singleantitopphotonhistSB", "mu_BDT__singleantitopphotonhistSB", nbin, min, max); signalhistSB = new TH1F( "mu_BDT__signal100__JES__SB", "mu_BDT__signal100__JES__SB", nbin,min, max ); std::vector<TH1F*> SBhists; SBhists.push_back(wjethistSB); SBhists.push_back(zjethistSB); SBhists.push_back(G_Pt_50to80SB); SBhists.push_back(G_Pt_80to120SB); SBhists.push_back(G_Pt_120to170SB); SBhists.push_back(G_Pt_170to300SB); SBhists.push_back(G_Pt_300to470SB); SBhists.push_back(G_Pt_470to800SB); SBhists.push_back(wphjethistSB); SBhists.push_back(twchhistSB); SBhists.push_back(tbarwhistSB); SBhists.push_back(tschhistSB); SBhists.push_back(tbarschhistSB); SBhists.push_back(ttchhistSB); SBhists.push_back(tbartchhistSB); SBhists.push_back(tt1histSB); SBhists.push_back(tt2histSB); SBhists.push_back(tt3histSB); SBhists.push_back(ttphhistSB); SBhists.push_back(wwphhistSB); SBhists.push_back(wwhistSB); SBhists.push_back(wzhistSB); SBhists.push_back(zzhistSB); SBhists.push_back(zgammahistSB); SBhists.push_back(singletopphotonhistSB); SBhists.push_back(singleantitopphotonhistSB); SBhists.push_back(signalhistSB); hists.push_back(wjethist); hists.push_back(zjethist); hists.push_back(G_Pt_50to80); hists.push_back(G_Pt_80to120); hists.push_back(G_Pt_120to170); hists.push_back(G_Pt_170to300); hists.push_back(G_Pt_300to470); hists.push_back(G_Pt_470to800); hists.push_back(wphjethist); hists.push_back(twchhist); hists.push_back(tbarwhist); hists.push_back(tschhist); hists.push_back(tbarschhist); hists.push_back(ttchhist); hists.push_back(tbartchhist); hists.push_back(tt1hist); hists.push_back(tt2hist); hists.push_back(tt3hist); hists.push_back(ttphhist); hists.push_back(wwphhist); hists.push_back(wwhist); hists.push_back(wzhist); hists.push_back(zzhist); hists.push_back(zgammahist); hists.push_back(singletopphotonhist); hists.push_back(singleantitopphotonhist); hists.push_back(signalhist); for(unsigned int idx=0; idx<samples_.size(); ++idx){ hists[idx]->Sumw2();} datahists.push_back(data1hist); datahists.push_back(data2hist); datahists.push_back(data3hist); datahists.push_back(datahistsideband); for(unsigned int idx=0; idx<datasamples_.size(); ++idx){ datahists[idx]->Sumw2();} revDATAhists.push_back(data1histrev); revDATAhists.push_back(data2histrev); revDATAhists.push_back(data3histrev); revDATAhists.push_back(datahistrevsideband); double insidewphjet=0; double outsidewphjet=0; double insidewjet=0; double outsidewjet=0; double nsignalevent=0; double mtopup=220; double mtopdown=130; //bool SR=false; //bool SB=true; bool SR=true; bool SB=false; for(unsigned int idx=0; idx<samples_.size(); ++idx){ TString fname =samples_[idx]; if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists else input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server if (!input) { std::cout << "ERROR: could not open data file" << std::endl; exit(1); } std::cout << "--- TMVAClassificationApp : Using input file: " << input->GetName() << std::endl; // --- Event loop // Prepare the event tree // - here the variable names have to corres[1]ponds to your tree // - you can use the same variables as above which is slightly faster, // but of course you can use different ones and copy the values inside the event loop // //Double_t myptphoton,myetaphoton,myptmuon,myetamuon,myptjet,myetajet,mymasstop,mymtw,mydeltaRphotonjet,mydeltaRphotonmuon,myht,mycostopphoton,mydeltaphiphotonmet,mycvsdiscriminant,myjetmultiplicity,mybjetmultiplicity,myleptoncharge; std::vector<double> *myptphoton=0; std::vector<double> *myetaphoton=0; std::vector<double> *myptmuon=0; std::vector<double> *myetamuon=0; std::vector<double> *myptjet=0; std::vector<double> *myetajet=0; std::vector<double> *mymasstop=0; //std::vector<double> *mymtw=0; std::vector<double> *mydeltaRphotonjet=0; std::vector<double> *mydeltaRphotonmuon=0; //std::vector<double> *myht=0; std::vector<double> *mycostopphoton=0; std::vector<double> *mydeltaphiphotonmet=0; std::vector<double> *mycvsdiscriminant=0; std::vector<double> *myjetmultiplicity=0; //std::vector<double> *mybjetmultiplicity=0; //std::vector<double> *myleptoncharge=0; std::vector<double> *myweight=0; std::vector<double> *myjetmatchinginfo=0; std::vector<double> *mycoswphoton=0; std::cout << "--- Select signal sample" << std::endl; TTree* theTree = (TTree*)input->Get("analyzestep2/atq"); // Int_t myjetmultiplicity, mybjetmultiplicity , myleptoncharge; // Float_t userVar1, userVar2; theTree->SetBranchAddress("ptphoton", &myptphoton ); theTree->SetBranchAddress( "etaphoton", &myetaphoton ); theTree->SetBranchAddress( "ptmuon", &myptmuon ); theTree->SetBranchAddress( "etamuon", &myetamuon ); theTree->SetBranchAddress( "ptjet", &myptjet ); theTree->SetBranchAddress( "etajet", &myetajet ); theTree->SetBranchAddress( "masstop", &mymasstop ); // theTree->SetBranchAddress( "mtw", &mymtw ); theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet ); theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon ); // theTree->SetBranchAddress( "ht", &myht ); theTree->SetBranchAddress( "costopphoton", &mycostopphoton ); theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity ); // theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity ); theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet ); theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant ); // theTree->SetBranchAddress( "leptoncharge", &myleptoncharge ); theTree->SetBranchAddress( "weight", &myweight); theTree->SetBranchAddress( "coswphoton", &mycoswphoton ); theTree->SetBranchAddress( "jetmatchinginfo", &myjetmatchinginfo ); // std::cout << "--- Processing: " << theTree->GetEntries() << " events" << std::endl; TStopwatch sw; sw.Start(); for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) { // std::cout << "--- ... Processing event: " << ievt << std::endl; double finalweight; if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl; theTree->GetEntry(ievt); //for (int l=0;l<sizeof(myptphoton);l++){ //std::cout << "--- ... reza: " << myptphoton[l] <<std::endl; //} //std::cout << "--- ......................."<< (*mycvsdiscriminant)[0]<<std::endl; // --- Return the MVA outputs and fill into histograms finalweight=(*myweight)[0]; //cout<<(*myweight)[0]<<endl; if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup){ hists[idx] ->Fill( (*myetajet)[0],finalweight ); if (samples_[idx]=="WPHJET.root")insidewphjet=insidewphjet+finalweight; if (samples_[idx]=="SIGNALtGu.root")nsignalevent=nsignalevent+1; //cout<<insidewphjet<<endl; } else { SBhists[idx] ->Fill( (*myetajet)[0],finalweight ); if (samples_[idx]=="WPHJET.root")outsidewphjet=outsidewphjet+finalweight;} // Retrieve also per-event error } delete myptphoton; delete myetaphoton; delete myptmuon; delete myetamuon; delete myptjet; delete myetajet; delete mymasstop; //delete mymtw; delete mydeltaRphotonjet; delete mydeltaRphotonmuon; //delete myht; delete mycostopphoton; delete mydeltaphiphotonmet; delete mycvsdiscriminant; delete myjetmultiplicity; //delete mybjetmultiplicity; //delete myleptoncharge; //delete myplot; } for(unsigned int idx=0; idx<datasamples_.size(); ++idx){ TString fname =datasamples_[idx]; if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists else input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server if (!input) { std::cout << "ERROR: could not open data file" << std::endl; exit(1); } std::cout << "--- TMVAClassificationApp : Using input file: " << input->GetName() << std::endl; // --- Event loop // Prepare the event tree // - here the variable names have to corres[1]ponds to your tree // - you can use the same variables as above which is slightly faster, // but of course you can use different ones and copy the values inside the event loop // //Double_t myptphoton,myetaphoton,myptmuon,myetamuon,myptjet,myetajet,mymasstop,mymtw,mydeltaRphotonjet,mydeltaRphotonmuon,myht,mycostopphoton,mydeltaphiphotonmet,mycvsdiscriminant,myjetmultiplicity,mybjetmultiplicity,myleptoncharge; std::vector<double> *myptphoton=0; std::vector<double> *myetaphoton=0; std::vector<double> *myptmuon=0; std::vector<double> *myetamuon=0; std::vector<double> *myptjet=0; std::vector<double> *myetajet=0; std::vector<double> *mymasstop=0; //std::vector<double> *mymtw=0; std::vector<double> *mydeltaRphotonjet=0; std::vector<double> *mydeltaRphotonmuon=0; //std::vector<double> *myht=0; std::vector<double> *mycostopphoton=0; std::vector<double> *mydeltaphiphotonmet=0; std::vector<double> *mycvsdiscriminant=0; std::vector<double> *myjetmultiplicity=0; //std::vector<double> *mybjetmultiplicity=0; //std::vector<double> *myleptoncharge=0; std::vector<double> *mycoswphoton=0; std::cout << "--- Select signal sample" << std::endl; TTree* theTree = (TTree*)input->Get("analyzestep2/atq"); // Int_t myjetmultiplicity, mybjetmultiplicity , myleptoncharge; // Float_t userVar1, userVar2; theTree->SetBranchAddress("ptphoton", &myptphoton ); theTree->SetBranchAddress( "etaphoton", &myetaphoton ); theTree->SetBranchAddress( "ptmuon", &myptmuon ); theTree->SetBranchAddress( "etamuon", &myetamuon ); theTree->SetBranchAddress( "ptjet", &myptjet ); theTree->SetBranchAddress( "etajet", &myetajet ); theTree->SetBranchAddress( "masstop", &mymasstop ); // theTree->SetBranchAddress( "mtw", &mymtw ); theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet ); theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon ); // theTree->SetBranchAddress( "ht", &myht ); theTree->SetBranchAddress( "costopphoton", &mycostopphoton ); theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity ); // theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity ); theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet ); theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant ); theTree->SetBranchAddress( "coswphoton", &mycoswphoton ); // theTree->SetBranchAddress( "leptoncharge", &myleptoncharge ); for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) { // std::cout << "--- ... Processing event: " << ievt << std::endl; theTree->GetEntry(ievt); // --- Return the MVA outputs and fill into histograms //leptoncharge=(float)(*myleptoncharge )[0]; if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup) datahists[idx] ->Fill( (*myetajet)[0] ); else datahists[3]->Fill( (*myetajet)[0] ); } delete myptphoton; delete myetaphoton; delete myptmuon; delete myetamuon; delete myptjet; delete myetajet; delete mymasstop; //delete mymtw; delete mydeltaRphotonjet; delete mydeltaRphotonmuon; //delete myht; delete mycostopphoton; delete mydeltaphiphotonmet; delete mycvsdiscriminant; delete myjetmultiplicity; //delete mybjetmultiplicity; //delete myleptoncharge; //delete myplot; } for(unsigned int idx=0; idx<datasamplesreverse_.size(); ++idx){ TString fname =datasamplesreverse_[idx]; if (!gSystem->AccessPathName( fname )) input = TFile::Open( fname ); // check if file in local directory exists else input = TFile::Open( "http://root.cern.ch/files/tmva_class_example.root" ); // if not: download from ROOT server if (!input) { std::cout << "ERROR: could not open data file" << std::endl; exit(1); } std::cout << "--- TMVAClassificationApp : Using input file: " << input->GetName() << std::endl; std::vector<double> *myptphoton=0; std::vector<double> *myetaphoton=0; std::vector<double> *myptmuon=0; std::vector<double> *myetamuon=0; std::vector<double> *myptjet=0; std::vector<double> *myetajet=0; std::vector<double> *mymasstop=0; //std::vector<double> *mymtw=0; std::vector<double> *mydeltaRphotonjet=0; std::vector<double> *mydeltaRphotonmuon=0; //std::vector<double> *myht=0; std::vector<double> *mycostopphoton=0; std::vector<double> *mydeltaphiphotonmet=0; std::vector<double> *mycvsdiscriminant=0; std::vector<double> *myjetmultiplicity=0; std::vector<double> *mycoswphoton=0; //std::vector<double> *mybjetmultiplicity=0; //std::vector<double> *myleptoncharge=0; TTree* theTree = (TTree*)input->Get("analyzestep2/atq"); theTree->SetBranchAddress("ptphoton", &myptphoton ); theTree->SetBranchAddress( "etaphoton", &myetaphoton ); theTree->SetBranchAddress( "ptmuon", &myptmuon ); theTree->SetBranchAddress( "etamuon", &myetamuon ); theTree->SetBranchAddress( "ptjet", &myptjet ); theTree->SetBranchAddress( "etajet", &myetajet ); theTree->SetBranchAddress( "masstop", &mymasstop ); // theTree->SetBranchAddress( "mtw", &mymtw ); theTree->SetBranchAddress( "deltaRphotonjet", &mydeltaRphotonjet ); theTree->SetBranchAddress( "deltaRphotonmuon", &mydeltaRphotonmuon ); // theTree->SetBranchAddress( "ht", &myht ); theTree->SetBranchAddress( "costopphoton", &mycostopphoton ); theTree->SetBranchAddress( "jetmultiplicity", &myjetmultiplicity ); // theTree->SetBranchAddress( "bjetmultiplicity", &mybjetmultiplicity ); theTree->SetBranchAddress( "deltaphiphotonmet", &mydeltaphiphotonmet ); theTree->SetBranchAddress( "cvsdiscriminant", &mycvsdiscriminant ); theTree->SetBranchAddress( "coswphoton", &mycoswphoton ); // theTree->SetBranchAddress( "leptoncharge", &myleptoncharge ); // Efficiency calculator for cut method for (Long64_t ievt=0; ievt<theTree->GetEntries();ievt++) { // std::cout << "--- ... Processing event: " << ievt << std::endl; if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl; theTree->GetEntry(ievt); if((*mymasstop )[0]>mtopdown && (*mymasstop )[0]<mtopup) { //revDATAhists[idx]->Fill( reader->EvaluateMVA( "BDT method" ) ); insidewjet=insidewjet+1; revDATAhists[idx]->Fill( (*myetajet)[0]); } else { //revDATAhists[3]->Fill( reader->EvaluateMVA( "BDT method" ) ); outsidewjet=outsidewjet+1; revDATAhists[3]->Fill( (*myetajet)[0]); } //cout<<insidewjet<<endl; } delete myptphoton; delete myetaphoton; delete myptmuon; delete myetamuon; delete myptjet; delete myetajet; delete mymasstop; //delete mymtw; delete mydeltaRphotonjet; delete mydeltaRphotonmuon; //delete myht; delete mycostopphoton; delete mydeltaphiphotonmet; delete mycvsdiscriminant; delete myjetmultiplicity; ////delete mybjetmultiplicity; ////delete myleptoncharge; ////delete myplot; // } double wphjetscale; wphjetscale=insidewphjet/(insidewphjet+outsidewphjet); cout<<"wphjetscale= "<<wphjetscale<<endl; double wjetscale; wjetscale=insidewjet/(insidewjet+outsidewjet); cout<<"wjetscale= "<<wjetscale<<endl; cout<<"nsignalevent= "<<nsignalevent<<endl; //cout<<insidewphjet<<"insidewphjet"<<" "<<wphjetscale<<" "<<insidewjet/(insidewjet+outsidewjet)<<endl; float lumi = 1; if (SR==true){ double ff=0; for(unsigned int idx=0; idx<samples_.size(); ++idx){ hists[idx]->Scale(lumi*scales[idx]); if (idx !=0 && idx!=3){ ff=hists[idx]->Integral()+ff; cout<<samples_[idx]<<" = "<<hists[idx]->Integral()<<" " <<ff<<endl;} } for(unsigned int idx=0; idx<samples_.size(); ++idx){ SBhists[idx]->Scale(lumi*scales[idx]);} THStack *hs1 = new THStack("hs1","BDT output"); for(unsigned int idx=1; idx<datasamplesreverse_.size(); ++idx){ revDATAhists[idx]->Add(revDATAhists[idx-1]); } //cout<<"*********************"<< datahists[3]->Integral()<<" "<<wphjetscale<<endl; //cout<<"*********************"<< revDATAhists[2]->Integral()<<" "<<wjetscale<<endl; revDATAhists[2]->Scale(219.373/revDATAhists[2]->Integral()); for(unsigned int idx=1; idx<revDATAhists[2]->GetNbinsX()+1; ++idx){ //revDATAhists[2]->SetBinError(idx,(revDATAhists[2]->GetBinContent(idx)/revDATAhists[2]->Integral())*74.84); revDATAhists[2]->SetBinError(idx,0); //if (revDATAhists[2]->GetBinError(idx)>revDATAhists[2]->GetBinContent(idx)) revDATAhists[2]->SetBinError(idx, revDATAhists[2]->GetBinContent(idx)/2); } //revDATAhists[2]->Scale(wjetscale); revDATAhists[3]->Scale(219.373/revDATAhists[3]->Integral()); revDATAhists[3]->Scale((1-wjetscale)/wjetscale); for(unsigned int idx=1; idx<datasamples_.size(); ++idx){ datahists[idx]->Add(datahists[idx-1]);} cout<<" " <<datahists[2]->Integral()<<endl; datahists[3]->Add(revDATAhists[3],-1); datahists[3]->Add(SBhists[1],-1); datahists[3]->Add(SBhists[2],-1); for(unsigned int idx=9; idx<samples_.size()-1; ++idx){ datahists[3]->Add(SBhists[idx],-1);} for(unsigned int idx=1; idx<nbin; ++idx){ if (datahists[3]->GetBinContent(idx)<0)datahists[3]->SetBinContent(idx,0); } datahists[3]->Scale(1112.2/datahists[3]->Integral()); for(unsigned int idx=1; idx<datahists[3]->GetNbinsX()+1; ++idx){ //datahists[3]->SetBinError(idx,(datahists[3]->GetBinContent(idx)/datahists[3]->Integral())*139.11);} datahists[3]->SetBinError(idx,0);} TH1F *datatoMC(0); //datahists[3]->Scale(wphjetscale); //hists[1]->Add(revDATAhists[2]); //hists[2]->Add(hists[1]); //datahists[3]->Add(hists[2]); //hists[4]->Add(datahists[3]); //for(unsigned int idx=5; idx<samples_.size()-1; ++idx){ // hists[idx]->Add(hists[idx-1]);} //cout<<"**********real data***********"<< datahists[2]->Integral()<<" "<<wphjetscale<<endl; //cout<<"********** mc ***********"<< hists[18]->Integral()<<" "<<wjetscale<<endl; // setup the canvas and draw the histograms TH1F *sum_h= new TH1F ( *hists[1] ) ; sum_h->Sumw2(); for(unsigned int idx=2; idx<samples_.size()-1; ++idx){ if (idx!=8)sum_h->Add(hists[idx],1); } sum_h->Add(revDATAhists[2],1); sum_h->Add(datahists[3],1); std::vector<std::vector<double_t> > vecplus(photondownhists[0]->GetNbinsX(), vector<double>(18)); std::vector<std::vector<double_t> > vecminus(photondownhists[0]->GetNbinsX(), vector<double>(18)); for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins for(int m = 0; m < 18; m++){ //loop over systematics vecplus[p][m]=0; vecminus[p][m]=0; if (vec[p][m]>sum_h->GetBinContent(p+1)) vecplus[p][m] = vec[p][m]-sum_h->GetBinContent(p+1); else if (vec[p][m]<sum_h->GetBinContent(p+1)) vecminus[p][m] = sum_h->GetBinContent(p+1)-vec[p][m]; cout<<vecplus[p][m]<<endl; }} TCanvas *c1 = new TCanvas("c1","signal region",50,50,865,780); c1->cd(); TPad *pad1 = new TPad("pad1","pad1",0,0.25,1,1); pad1->SetFillStyle(0); pad1->SetFrameFillStyle(0); pad1->SetBottomMargin(0); TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.25); pad2->SetFillStyle(0); pad2->SetFrameFillStyle(0); pad2->SetTopMargin(0); pad2->SetBottomMargin(0.12/0.46); pad2->Draw(); pad1->Draw(); pad1->cd(); //W+jet revDATAhists[2]->SetFillColor(kBlue-2); revDATAhists[2]->SetLineColor(kBlack); hs1->Add(revDATAhists[2]); //Z+jet hists[1]->SetFillColor(kOrange-4); hists[1]->SetLineColor(kBlack); hs1->Add(hists[1]); //photon+jet hists[3]->Add(hists[2]); hists[4]->Add(hists[3]); hists[5]->Add(hists[4]); hists[6]->Add(hists[5]); hists[7]->Add(hists[6]); hists[7]->SetFillColor(19); //hs1->Add(hists[7]); //W+photon+jet datahists[3]->SetFillColor(kGreen-3); datahists[3]->SetLineColor(kBlack); hs1->Add(datahists[3]); //single top+singletop photon hists[5+5]->Add(hists[4+5]); hists[6+5]->Add(hists[5+5]); hists[7+5]->Add(hists[6+5]); hists[8+5]->Add(hists[7+5]); hists[9+5]->Add(hists[8+5]); hists[19+5]->Add(hists[9+5]); hists[20+5]->Add(hists[19+5]); hists[20+5]->SetFillColor(kRed+3); hists[20+5]->SetLineColor(kBlack); hs1->Add(hists[20+5]); //hists[9+5]->SetFillColor(kAzure+10); //hs1->Add(hists[9+5]); hists[11+5]->Add(hists[10+5]); hists[12+5]->Add(hists[11+5]); hists[13+5]->Add(hists[12+5]); hists[13+5]->SetFillColor(kPink+1); hists[13+5]->SetLineColor(kBlack); hs1->Add(hists[13+5]); //hists[13+5]->SetFillColor(17); //hs1->Add(hists[13+5]); //hists[14+5]->SetFillColor(kSpring-9); //hs1->Add(hists[14+5]); hists[15+5]->Add(hists[14+5]); hists[16+5]->Add(hists[15+5]); hists[17+5]->Add(hists[16+5]); hists[17+5]->SetFillColor(kViolet-7); hists[17+5]->SetLineColor(kBlack); hs1->Add(hists[17+5]); hists[18+5]->SetFillColor(kAzure+10); hists[18+5]->SetLineColor(kBlack); hs1->Add(hists[18+5]); //hists[20+5]->Add(hists[19+5]); //hists[20+5]->SetFillColor(kYellow+3); //hs1->Add(hists[20+5]); hs1->Draw("hist"); hs1->SetMaximum(1.6*datahists[2]->GetMaximum()); //hs1->GetXaxis()->SetTitle("BDT output"); hs1->GetYaxis()->SetTitle("Events / 0.4"); hs1->GetYaxis()->SetTitleSize(0.045); hs1->GetYaxis()->SetTitleFont(22); hs1->GetYaxis()->SetTitleOffset(0.8); hs1->GetYaxis()->SetLabelSize(0.044); hists[21+5]->SetLineColor(kRed+3); hists[21+5]->SetLineWidth(3); hists[21+5]->Draw("histsame"); datahists[2]->SetLineWidth(3.); datahists[2]->SetLineColor(kBlack); datahists[2]->SetMarkerColor(kBlack); datahists[2]->SetMarkerStyle(20.); datahists[2]->SetMarkerSize(1.35); datahists[2]->Draw("esame"); sum_h->SetLineColor(kBlack); sum_h->SetFillColor(1); sum_h->SetFillStyle(3001); sum_h->Draw("e2same"); TPaveText *pt = new TPaveText(0.1,0.95,0.4,0.95, "NDC"); // NDC sets coords pt->SetLineColor(10); // relative to pad dimensions pt->SetFillColor(10); // text is black on white pt->SetTextSize(0.045); pt->SetTextAlign(12); pt->AddText("CMS Preliminary, 19.1 fb^{-1}, #sqrt{s} = 8 TeV"); pt->SetShadowColor(10); pt->Draw("same"); std::vector<double_t> errorup(photondownhists[0]->GetNbinsX()); std::vector<double_t> errordown(photondownhists[0]->GetNbinsX()); for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins for(int m = 0; m < 18; m++){ //loop over systematics if (m==0) {errorup[p]=0; errordown[p]=0;} errorup[p]=pow(vecplus[p][m],2)+errorup[p]; errordown[p]=pow(vecminus[p][m],2)+errordown[p]; } errorup[p]=pow(0.024*sum_h->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.024*sum_h->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.4*wjetandwphjet[0]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.4*wjetandwphjet[0]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*wjetandwphjet[1]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*wjetandwphjet[1]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*hists[1]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*hists[1]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*hists[20+5]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*hists[20+5]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*hists[13+5]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*hists[13+5]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*hists[17+5]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*hists[17+5]->GetBinContent(p+1),2)+errordown[p]; errorup[p]=pow(0.3*hists[18+5]->GetBinContent(p+1),2)+errorup[p]; errordown[p]=pow(0.3*hists[18+5]->GetBinContent(p+1),2)+errordown[p]; cout<<errorup[p]<<endl; cout<<errordown[p]<<endl; } double ax[photondownhists[0]->GetNbinsX()]; double ay[photondownhists[0]->GetNbinsX()]; double aexl[photondownhists[0]->GetNbinsX()]; double aexh[photondownhists[0]->GetNbinsX()]; double aeyl[photondownhists[0]->GetNbinsX()]; double aeyh[photondownhists[0]->GetNbinsX()]; for(int p = 0; p <photondownhists[0]->GetNbinsX(); p++){ //loop over bins ax[p]=min+(max-min)/(2*nbin)+p*((max-min)/nbin); ay[p]=sum_h->GetBinContent(p+1); aexl[p]=(max-min)/(2*nbin); aexh[p]=(max-min)/(2*nbin); aeyl[p]=sqrt(errordown[p]); aeyh[p]=sqrt(errorup[p]); } TGraphAsymmErrors* gae = new TGraphAsymmErrors(photondownhists[0]->GetNbinsX(), ax, ay, aexl, aexh, aeyl, aeyh); gae->SetFillColor(1); gae->SetFillStyle(3003); gae->Draw("e2same"); TLegend* leg = new TLegend(0.70,0.58,0.89,0.88); leg->SetFillStyle ( 0); leg->SetFillColor ( 0); leg->SetBorderSize( 0); leg->AddEntry( datahists[2], "Data" , "PL"); // leg->AddEntry( hists[25], "Single top+#gamma" , "F"); leg->AddEntry( hists[23], "Z#gamma" , "F"); leg->AddEntry( hists[22], "WW,WZ,ZZ,WW#gamma " , "F"); // leg->AddEntry( hists[19], "WW#gamma" , "F"); leg->AddEntry( hists[18], "t#bar{t}, t#bar{t}#gamma" , "F"); // leg->AddEntry( hists[17], "t#bar{t}" , "F"); leg->AddEntry( hists[25], "Single top, Single top+#gamma" , "F"); // leg->AddEntry( hists[14], "Single top" , "F"); leg->AddEntry( datahists[3], "W#gamma" , "F"); // leg->AddEntry( hists[7], "#gamma+jets" , "F"); leg->AddEntry( hists[1], "Z+jets" , "F"); leg->AddEntry(revDATAhists[2], "W+jets" , "F"); leg->AddEntry( hists[26], "Signal(tu#gamma) 1 pb" , "L"); leg->AddEntry(sum_h, "Stat uncertainty" , "F"); leg->AddEntry(gae, "Syst uncertainty" , "F"); // leg->AddEntry( datahists[2], "CMS Data 2012(19.145/fb)" , "PL"); leg->Draw("same"); sum_h->Draw("AXISSAMEY+"); sum_h->Draw("AXISSAMEX+"); pad1->Draw(); TCanvas *c22 = new TCanvas("c22","signal region22",50,50,865,780); c22->cd(); gae->Draw("a2"); gae->Draw("psame"); TH1F *h_ratio = (TH1F*)datahists[2]->Clone("h_copy"); h_ratio->Sumw2(); pad2->cd(); pad2->SetGridy(); datatoMC = new TH1F( "datatoMC", "datatoMC", nbin, min, max ); datatoMC->Sumw2(); datatoMC->Divide(datahists[2],sum_h); h_ratio->Divide(sum_h); h_ratio->SetFillStyle(3004); h_ratio->GetXaxis()->SetTitle("b-jet #eta"); h_ratio->GetYaxis()->SetTitle("DATA/MC"); h_ratio->GetXaxis()->SetTitleSize(0.12); h_ratio->GetYaxis()->SetTitleSize(0.12); h_ratio->GetXaxis()->SetTitleFont(22); h_ratio->GetYaxis()->SetTitleFont(22); h_ratio->GetXaxis()->SetTickLength(0.05); h_ratio->GetYaxis()->SetTickLength(0.05); h_ratio->GetXaxis()->SetLabelSize(0.14); h_ratio->GetYaxis()->SetLabelSize(0.14); h_ratio->GetYaxis()->SetTitleOffset(0.25); h_ratio->GetYaxis()->SetNdivisions(504); h_ratio->SetLineWidth(2); //h_ratio->SetStats(0); //h_ratio->SetMarkerStyle(20); h_ratio->SetMinimum(0); h_ratio->SetMaximum(2); h_ratio->Draw("E"); //datatoMC->Draw(""); TLine *l3 = new TLine(h_ratio->GetXaxis()->GetXmin(), 1.00, h_ratio->GetXaxis()->GetXmax(), 1.00); l3->SetLineWidth(1); //l3->SetLineStyle(7); //l3->Draw(); h_ratio->Draw("AXISSAMEY+"); h_ratio->Draw("AXISSAMEX+"); c1->Update(); for(unsigned int idx=1; idx<nbin+1; ++idx){ cout<<"MC "<<"nbin= "<<idx<<" content= "<<sum_h->GetBinContent(idx)<<endl; cout<<"signal "<<"nbin= "<<idx<<" content= "<<hists[21+5]->GetBinContent(idx)<<endl; cout<<"Data "<<"nbin= "<<idx<<" content= "<<datahists[2]->GetBinContent(idx)<<endl; } cout<<"signal Integral "<<hists[21+5]->Integral()<<endl; } if (SB==true){ for(unsigned int idx=0; idx<samples_.size(); ++idx){ SBhists[idx]->Scale(lumi*scales[idx]);} revDATAhists[3]->Scale(620.32/revDATAhists[3]->Integral()); revDATAhists[3]->Scale(1-wjetscale); SBhists[1]->Add(revDATAhists[3]); SBhists[2]->Add(SBhists[1]); SBhists[4]->Add(SBhists[2]); for(unsigned int idx=5; idx<samples_.size()-1; ++idx){ SBhists[idx]->Add(SBhists[idx-1]);} SBhists[20]->SetMaximum(1.5*datahists[3]->GetMaximum()); SBhists[20]->SetFillColor(kMagenta+2); SBhists[20]->Draw(); SBhists[18]->SetFillColor(kOrange+4); SBhists[18]->Draw("same"); SBhists[17]->SetFillColor(kOrange-2); SBhists[17]->Draw("same"); SBhists[16]->SetFillColor(kRed); SBhists[16]->Draw("same"); SBhists[15]->SetFillColor(kViolet+1); SBhists[15]->Draw("same"); SBhists[14]->SetFillColor(kSpring-9); SBhists[14]->Draw("same"); SBhists[13]->SetFillColor(32); SBhists[13]->Draw("same"); SBhists[12]->SetFillColor(6); SBhists[12]->Draw("same"); SBhists[9]->SetFillColor(4); SBhists[9]->Draw("same"); //hists[8]->SetFillColor(4); //hists[8]->Draw("same"); //hists[7]->SetFillColor(3); //hists[7]->Draw("same"); //hists[6]->SetFillColor(3); //hists[6]->Draw("same"); //hists[5]->SetFillColor(2); //hists[5]->Draw("same"); //hists[4]->SetFillColor(2); //hists[4]->Draw("same"); //hists[3]->SetFillColor(5); //hists[3]->Draw("same"); //datahists[3]->SetFillColor(5); //datahists[3]->Draw("same"); SBhists[2]->SetFillColor(8); SBhists[2]->Draw("same"); SBhists[1]->SetFillColor(kOrange+7); SBhists[1]->Draw("same"); revDATAhists[3]->SetFillColor(7); revDATAhists[3]->Draw("same"); //hists[0]->SetFillColor(7); //hists[0]->Draw("same"); SBhists[21]->SetFillColor(1); SBhists[21]->SetFillStyle(3004); SBhists[21]->Draw("same"); // plot data points datahists[3]->SetLineWidth(3.); datahists[3]->SetLineColor(kBlack); datahists[3]->SetMarkerColor(kBlack); datahists[3]->SetMarkerStyle(20.); datahists[3]->Draw("esame"); //conv->RedrawAxis(); TLegend* leg = new TLegend(0.60,0.40,0.89,0.87); leg->SetFillStyle ( 0); leg->SetFillColor ( 0); leg->SetBorderSize( 0); leg->AddEntry( revDATAhists[2], "W JET" , "F"); leg->AddEntry( SBhists[1], "Z JET" , "F"); leg->AddEntry( SBhists[2], "PH JET" , "F"); // leg->AddEntry( datahists[3], "W PH JET" , "F"); // leg->AddEntry( hists[5], "TOP-W-CH" , "F"); // leg->AddEntry( hists[5], "T-S-CH" , "F"); // leg->AddEntry( hists[7], "TOP-S-CH" , "F"); // leg->AddEntry( hists[7], "TTBAR-CH" , "F"); // leg->AddEntry( hists[8], "TBAR-W-CH" , "F"); leg->AddEntry( SBhists[9], "SINGLE TOP " , "F"); leg->AddEntry( SBhists[12], "TTBAR" , "F"); leg->AddEntry( SBhists[13], "TTG" , "F"); leg->AddEntry( SBhists[14], "WWG" , "F"); leg->AddEntry( SBhists[15], "WW" , "F"); leg->AddEntry( SBhists[16], "WZ" , "F"); leg->AddEntry( SBhists[17], "ZZ" , "F"); leg->AddEntry( SBhists[18], "ZGAMMA" , "F"); leg->AddEntry( SBhists[20], "SINGLE TOP+PHOTON" , "F"); leg->AddEntry( SBhists[21], "SIGNAL" , "F"); leg->AddEntry( datahists[3], "CMS Data 2012(19.145/fb)" , "PL"); leg->Draw("same"); } }
int BtagEfficiencies() { // Define sample TFile* TTJets = new TFile("TTJetsFall11.root" , "READ"); TFile* WJetsHT = new TFile("WJetsHT.root" , "READ"); TFile* SingleTop = new TFile("SingleTop.root" , "READ"); // addSample(TFile* sample, TString name) addSample(TTJets, "t#bar{t}+Jets", kRed, 21, 0.9, 7); addSample(SingleTop, "single top", kBlue, 20, 1.0, 7); addSample(WJetsHT, "W+Jets", kGreen+2, 23, 1.1, 7); //addSample(SingleTop, "single top", kBlue, 24, 1, 7); //addSample(WJetsHT, "W+Jets", kGreen, 25, 1, 7); // addAlgorithm(TString name) addAlgorithm("TCHEM"); // addSelectionStep(TString name, int lc, TString sn); addSelectionStep("", 8, "RA4b"); // Flavors Flavors.push_back("B"); Flavors.push_back("C"); Flavors.push_back("L"); // global settings // gStyle->SetCanvasColor(10); // gStyle->SetOptStat(0); // gStyle->SetPalette(1); // gStyle->SetTitleFillColor(0); setTDRStyle(); // loop over algorithms for(int a=0; a<Algos.size(); ++a) { std::cout << Algos[a] << std::endl; // loop over flavor for(int flv=0; flv<(int)Flavors.size(); ++flv) { // loop over selection steps for(int s=0; s < Steps.size(); ++s) { std::cout << "Selection step " << Steps[s] << std::endl; // Define canvas and legend/afs/desy.de/user/n/npietsch TCanvas *canvas =new TCanvas(SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",SelectionNames[s]+"_"+Algos[a]+"_"+Flavors[flv]+"_Pt",1); TLegend *leg = new TLegend(.64,.18,.91,.35); leg->SetTextFont(42); leg->SetFillColor(0); leg->SetLineColor(1); TPaveText *label = new TPaveText(0.14,0.91,0.6,0.99,"NDC"); label->SetFillColor(0); label->SetTextFont(42); label->SetBorderSize(0); TText *text=label->AddText("CMS Simulation, #sqrt{s}=7 TeV"); text->SetTextAlign(22); TPaveText *label2 = new TPaveText(0.33,0.23,0.53,0.33,"NDC"); label2->SetFillColor(0); label2->SetTextFont(62); label2->SetBorderSize(0); TText *text2=label2->AddText("0 < |#eta| < 0.8"); text2->SetTextAlign(22); // declare maximum and ybin double Maximum=0; double ybin=1; // loop over files for(int f=0; f<(int)Files.size(); ++f) { TH2F* Pt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta"); TH2F* Pt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsPtEta"); Pt_->Add(Pt2_); TH2F* TaggedPt_=(TH2F*)Files[f]->Get("bTagEffRA4bMu"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta"); TH2F* TaggedPt2_=(TH2F*)Files[f]->Get("bTagEffRA4bEl"+Algos[a]+Steps[s]+"/Num"+Flavors[flv]+"JetsTaggedPtEta"); TaggedPt_->Add(TaggedPt2_); TaggedPt_->Divide(Pt_); //-------------------------------------- // Draw x and y errors //-------------------------------------- // define shifts double shift_=4*(f-1); double shift2_=5*(f-1); double shift3_=6*(f-1); // define array xbinsPt Int_t nBins=TaggedPt_->GetNbinsX(); double xbinsPt[18]; double xbinsPtX[18]; // fill array xbinsPt double xbin0=TaggedPt_->GetBinLowEdge(1); xbinsPt[0]=xbin0; xbinsPtX[0]=xbin0; std::cout << xbin0 << std::endl; // double ibinX=0; for(int xbin=1; xbin<TaggedPt_->GetNbinsX(); ++xbin) { ibinX=ibinX+TaggedPt_->GetXaxis()->GetBinWidth(xbin); if(TaggedPt_->GetXaxis()->GetBinWidth(xbin)>20) shift_=shift3_; xbinsPtX[xbin]=ibinX; xbinsPt[xbin]=ibinX+shift_; } xbinsPt[TaggedPt_->GetNbinsX()]=TaggedPt_->GetBinLowEdge(TaggedPt_->GetNbinsX()+1)+shift_; xbinsPtX[TaggedPt_->GetNbinsX()]=TaggedPt_->GetBinLowEdge(TaggedPt_->GetNbinsX()+1); // define new histograms char Tmp [70]; char Tmp2 [70]; sprintf(Tmp,"%i_%i_%i_%i_Pt", f, a, flv, s); sprintf(Tmp2,"%i_%i_%i_%i_Pt2", f, a, flv, s); TH1F* Tmp_=new TH1F(Tmp, Tmp, nBins, xbinsPt); TH1F* Tmp2_=new TH1F(Tmp2, Tmp2, nBins, xbinsPtX); // fill histogram Tmp_ for(int xbin=0; xbin<Tmp_->GetNbinsX()+1; ++xbin) { Tmp_->SetBinContent(xbin,TaggedPt_->GetBinContent(xbin, ybin)); Tmp_->SetBinError(xbin,TaggedPt_->GetBinError(xbin, ybin)); Tmp2_->SetBinContent(xbin,TaggedPt_->GetBinContent(xbin, ybin)); Tmp2_->SetBinError(xbin,0.0000001); if(TaggedPt_->GetBinContent(xbin, ybin)+TaggedPt_->GetBinError(xbin, ybin) > Maximum) { Maximum=TaggedPt_->GetBinContent(xbin, ybin)+TaggedPt_->GetBinError(xbin, ybin); } } //-------------------------------------- // Draw histogram //-------------------------------------- // draw histogram Tmp2_ if(Flavors[flv]=="B") Tmp2_->SetMaximum(1.05*0.947686); if(Flavors[flv]=="C") Tmp2_->SetMaximum(1.05*0.388437); if(Flavors[flv]=="L") Tmp2_->SetMaximum(1.05*0.0880499); Tmp2_->SetMinimum(0); Tmp2_->SetTitle(""); if(Flavors[flv]=="B") Tmp2_->GetXaxis()->SetTitle("b-jet p_{T} [GeV]"); if(Flavors[flv]=="C") Tmp2_->GetXaxis()->SetTitle("c-jet p_{T} [GeV]"); if(Flavors[flv]=="L") Tmp2_->GetXaxis()->SetTitle("light quark jet p_{T} [GeV]"); Tmp2_->GetXaxis()->SetTitleOffset(1.35); //Tmp2_->GetXaxis()->CenterTitle(); Tmp2_->GetYaxis()->SetTitle("b-tag efficiency"); Tmp2_->GetYaxis()->SetTitleOffset(1.35); //Tmp2_->GetYaxis()->CenterTitle(); Tmp2_->SetLineColor(SampleColors[f]); Tmp2_->SetLineWidth(2); if(f==0) Tmp2_->Draw(""); else Tmp2_->Draw("same"); // TF1 *myfit1 = new TF1("myfit1","[0]+[1]*x", 40, 160); // myfit1->SetLineWidth(2); // myfit1->SetLineColor(SampleColors[f]); // Tmp2_->Fit("myfit1","0EMR"); // "0" = do NOT automatically draw "hist" // Tmp2_->GetFunction("myfit1")->ResetBit(1<<9); // make "fitname" visible // TF1 *myfit2 = new TF1("myfit2","[0]+[1]*x", 160, 670); // myfit2->SetLineWidth(2); // myfit2->SetLineColor(SampleColors[f]); // Tmp2_->Fit("myfit2","0EMR+"); // "0" = do NOT automatically draw "hist" // Tmp2_->GetFunction("myfit2")->ResetBit(1<<9); // make "fitname" visible // fit functions // Double_t par[6]; // if(Flavors[flv] == "B") // { // TF1 *g1 = new TF1("g1","[1]+[2]*x+[3]*x**2",40,160); // g1->SetLineColor(SampleColors[f]); // Tmp2_->Fit(g1,"0EMR"); // Tmp2_->GetFunction("g1")->ResetBit(1<<9); // TF1 *g2 = new TF1("g2","[4]+[5]*x",160,670); // g2->SetLineColor(SampleColors[f]); // Tmp2_->Fit(g2,"0EMR+"); // Tmp2_->GetFunction("g2")->ResetBit(1<<9); // } // if(Flavors[flv] == "C" || Flavors[flv] == "L") // { // TF1 *g1 = new TF1("g1","[1]+[2]*x+[3]*x**2",40,670); // g1->SetLineColor(SampleColors[f]); // g1->SetLineWidth(2); // Tmp2_->Fit(g1,"0EMR"); // Tmp2_->GetFunction("g1")->ResetBit(1<<9); // } // TF1 *total = new TF1("total","[0]+[1]*x+[2]*x**2+[3]+[4]*x",40,670); // total->SetLineColor(SampleColors[f]); // g1->GetParameters(&par[0]); // g2->GetParameters(&par[3]); // total->SetParameters(par); // Tmp2_->Fit("total","0EMR+"); // "0" = do NOT automatically draw "hist" // Tmp2_->GetFunction("total")->ResetBit(1<<9); // make "fitname" visible // draw histogram Tmp_ Tmp_->SetLineColor(SampleColors[f]); Tmp_->SetLineWidth(2); Tmp_->SetMarkerStyle(MarkerStyles[f]); Tmp_->SetMarkerColor(SampleColors[f]); Tmp_->SetMarkerSize(MarkerSizes[f]); Tmp_->Draw("same E x0"); leg->AddEntry(Tmp_,Names[f],"l P"); } std::cout << "==============================" << std::endl; std::cout << "Maximum: " << Maximum << std::endl; std::cout << "==============================" << std::endl; leg->SetShadowColor(0); leg->Draw(); label->Draw(); label2->Draw(); canvas->SaveAs(Algos[a]+Steps[s]+"_"+Flavors[flv]+"jetsEff_MuPt_08.pdf"); } } } std::cout << "" << std::endl; return 0; }
//************************************************************* void FillTrendPlot(TH1F* trendPlot, TH1F* residualsPlot[100], TString fitPar_, TString var_,Int_t nBins_) //************************************************************* { std::cout<<"trendPlot name: "<<trendPlot->GetName()<<std::endl; // float phiInterval = (360.)/nBins_; float phiInterval = (2*TMath::Pi()/nBins_); float etaInterval = 5./nBins_; for ( int i=0; i<nBins_; ++i ) { int binn = i+1; char phipositionString[129]; // float phiposition = (-180+i*phiInterval)+(phiInterval/2); float phiposition = (-TMath::Pi()+i*phiInterval)+(phiInterval/2); sprintf(phipositionString,"%.1f",phiposition); char etapositionString[129]; float etaposition = (-2.5+i*etaInterval)+(etaInterval/2); sprintf(etapositionString,"%.1f",etaposition); std::pair<std::pair<Double_t,Double_t>, std::pair<Double_t,Double_t> > myFit = std::make_pair(std::make_pair(0.,0.),std::make_pair(0.,0.)); if ( ((TString)trendPlot->GetName()).Contains("Norm") ) { //std::pair<std::pair<Double_t,Double_t>, std::pair<Double_t,Double_t> > myFit = fitResiduals(residualsPlot[i]); myFit = fitResiduals(residualsPlot[i]); } else { //std::pair<std::pair<Double_t,Double_t>, std::pair<Double_t,Double_t> > myFit = fitStudentTResiduals(residualsPlot[i]); myFit = fitResiduals(residualsPlot[i]); } if(fitPar_=="mean"){ float mean_ = myFit.first.first; float meanErr_ = myFit.first.second; trendPlot->SetBinContent(i+1,mean_); trendPlot->SetBinError(i+1,meanErr_); } else if (fitPar_=="width"){ float width_ = myFit.second.first; float widthErr_ = myFit.second.second; trendPlot->SetBinContent(i+1,width_); trendPlot->SetBinError(i+1,widthErr_); } else if (fitPar_=="median"){ float median_ = getMedian(residualsPlot[i]).first; float medianErr_ = getMedian(residualsPlot[i]).second; trendPlot->SetBinContent(i+1,median_); trendPlot->SetBinError(i+1,medianErr_); } else if (fitPar_=="mad"){ float mad_ = getMAD(residualsPlot[i]).first; float madErr_ = getMAD(residualsPlot[i]).second; trendPlot->SetBinContent(i+1,mad_); trendPlot->SetBinError(i+1,madErr_); } else { std::cout<<"PrimaryVertexValidation::FillTrendPlot() "<<fitPar_<<" unknown estimator!"<<std::endl; } if(var_=="phi"){ // if( ((binn%2==0)&&(binn<=12)) || ((binn%2==1)&&(binn>12)) ) // if( ((binn%3==1)&&(binn<=12)) || ((binn%3==0)&&(binn>12)) ) //if((binn%3==0)) // trendPlot->GetXaxis()->SetBinLabel(binn,phipositionString); } else if(var_=="eta"){ // if( ((binn%2==0)&&(binn<=12)) || ((binn%2==1)&&(binn>12)) ) // if( ((binn%3==1)&&(binn<=12)) || ((binn%3==0)&&(binn>12)) ) //if((binn%3==0)) //trendPlot->GetXaxis()->SetBinLabel(binn,etapositionString); } else { //std::cout<<"PrimaryVertexValidation::FillTrendPlot() "<<var_<<" unknown track parameter!"<<std::endl; } } //trendPlot->GetXaxis()->LabelsOption("h"); if(fitPar_=="mean" || fitPar_=="median"){ TString res; if(TString(residualsPlot[0]->GetName()).Contains("dxy")) res="dxy"; else if(TString(residualsPlot[0]->GetName()).Contains("dz")) res="dz"; else if(TString(residualsPlot[0]->GetName()).Contains("IP2D")) res="IP2D"; else if(TString(residualsPlot[0]->GetName()).Contains("resz")) res="resz"; TCanvas *fitOutput = new TCanvas(Form("fitOutput_%s_%s_%s",res.Data(),var_.Data(),trendPlot->GetName()),Form("fitOutput_%s_%s",res.Data(),var_.Data()),1200,1200); fitOutput->Divide(5,5); TCanvas *fitPulls = new TCanvas(Form("fitPulls_%s_%s_%s",res.Data(),var_.Data(),trendPlot->GetName()),Form("fitPulls_%s_%s",res.Data(),var_.Data()),1200,1200); fitPulls->Divide(5,5); TH1F* residualsPull[nBins_]; for(Int_t i=0;i<nBins_;i++){ TF1 *tmp1 = (TF1*)residualsPlot[i]->GetListOfFunctions()->FindObject("tmp"); fitOutput->cd(i+1)->SetLogy(); fitOutput->cd(i+1)->SetBottomMargin(0.16); //fitOutput->cd(i+1)->SetTopMargin(0.05); //residualsPlot[i]->Sumw2(); MakeNicePlotStyle(residualsPlot[i]); residualsPlot[i]->SetMarkerStyle(20); residualsPlot[i]->SetMarkerSize(1.); residualsPlot[i]->SetStats(0); //residualsPlot[i]->GetXaxis()->SetRangeUser(-3*(tmp1->GetParameter(1)),3*(tmp1->GetParameter(1))); residualsPlot[i]->Draw("e1"); residualsPlot[i]->GetYaxis()->UnZoom(); //std::cout<<"*********************"<<std::endl; //std::cout<<"fitOutput->cd("<<i+1<<")"<<std::endl; //std::cout<<"residualsPlot["<<i<<"]->GetTitle() = "<<residualsPlot[i]->GetTitle()<<std::endl; // -- for chi2 ---- TPaveText *pt = new TPaveText(0.13,0.78,0.33,0.88,"NDC"); pt->SetFillColor(10); pt->SetTextColor(1); pt->SetTextSize(0.07); pt->SetTextFont(42); pt->SetTextAlign(11); //TF1 *tmp1 = (TF1*)residualsPlot[i]->GetListOfFunctions()->FindObject("tmp"); TString COUT = Form("#chi^{2}/ndf=%.1f",tmp1->GetChisquare()/tmp1->GetNDF()); TText *text1 = pt->AddText(COUT); text1->SetTextFont(72); text1->SetTextColor(kBlue); pt->Draw("same"); // -- for bins -- TPaveText *title = new TPaveText(0.1,0.93,0.8,0.95,"NDC"); title->SetFillColor(10); title->SetTextColor(1); title->SetTextSize(0.07); title->SetTextFont(42); title->SetTextAlign(11); //TText *text2 = title->AddText(residualsPlot[i]->GetTitle()); //text2->SetTextFont(72); //text2->SetTextColor(kBlue); title->Draw("same"); fitPulls->cd(i+1); fitPulls->cd(i+1)->SetBottomMargin(0.15); fitPulls->cd(i+1)->SetLeftMargin(0.15); fitPulls->cd(i+1)->SetRightMargin(0.05); residualsPull[i]=(TH1F*)residualsPlot[i]->Clone(Form("pull_%s",residualsPlot[i]->GetName())); for(Int_t nbin=1;nbin<=residualsPull[i]->GetNbinsX(); nbin++){ if(residualsPlot[i]->GetBinContent(nbin)!=0){ residualsPull[i]->SetBinContent(nbin,(residualsPlot[i]->GetBinContent(nbin) - tmp1->Eval(residualsPlot[i]->GetBinCenter(nbin)))/residualsPlot[i]->GetBinContent(nbin)); residualsPull[i]->SetBinError(nbin,0.1); } } TF1* toDel = (TF1*)residualsPull[i]->FindObject("tmp"); if(toDel) residualsPull[i]->GetListOfFunctions()->Remove(toDel); residualsPull[i]->SetMarkerStyle(20); residualsPull[i]->SetMarkerSize(1.); residualsPull[i]->SetStats(0); residualsPull[i]->GetYaxis()->SetTitle("(res-fit)/res"); // residualsPull[i]->SetOptTitle(1); residualsPull[i]->GetXaxis()->SetLabelFont(42); residualsPull[i]->GetYaxis()->SetLabelFont(42); residualsPull[i]->GetYaxis()->SetLabelSize(.07); residualsPull[i]->GetXaxis()->SetLabelSize(.07); residualsPull[i]->GetYaxis()->SetTitleSize(.07); residualsPull[i]->GetXaxis()->SetTitleSize(.07); residualsPull[i]->GetXaxis()->SetTitleOffset(0.9); residualsPull[i]->GetYaxis()->SetTitleOffset(1.2); residualsPull[i]->GetXaxis()->SetTitleFont(42); residualsPull[i]->GetYaxis()->SetTitleFont(42); residualsPull[i]->Draw("e1"); residualsPull[i]->GetYaxis()->UnZoom(); } TString tpName =trendPlot->GetName(); TString FitNameToSame = Form("fitOutput_%s",(tpName.ReplaceAll("means_","").Data())); //fitOutput->SaveAs(FitNameToSame+".pdf"); //fitOutput->SaveAs(FitNameToSame+".png"); TString PullNameToSave = Form("fitPulls_%s",(tpName.ReplaceAll("means_","").Data())); //fitPulls->SaveAs(PullNameToSave+".pdf"); //fitPulls->SaveAs(PullNameToSave+".png"); //fitOutput->SaveAs(Form("fitOutput_%s_%s_%s.pdf",res.Data(),var_.Data(),trendPlot->GetName())); fitOutput->SaveAs(Form("fitOutput_%s.pdf",(((TString)trendPlot->GetName()).ReplaceAll("means_","")).Data())); fitPulls->SaveAs(Form("fitPulls_%s.pdf",(((TString)trendPlot->GetName()).ReplaceAll("means_","")).Data())); //fitOutput->SaveAs(Form("fitOutput_%s.png",(((TString)trendPlot->GetName()).ReplaceAll("means_","")).Data())); } }
void RDK2AnalysisPlotter::makeEPGPlot(CoDet detType) { gROOT->cd(); TCanvas* theCanvas; TPad* mainPad; TPad* titlePad; TPad* gEPad; TPad* detPad; TPad* gEPadSubs[3]; int numTitleLines=getTitleBoxLines( detType); int canvasNumPixelsYPlot=600; int canvasNumPixelsYPlots=2*canvasNumPixelsYPlot; int canvasNumPixelsYTitle=40*numTitleLines; int canvasNumPixelsY=canvasNumPixelsYPlots+canvasNumPixelsYTitle; theCanvas = new TCanvas("EPGExpMCAnalysisComparisonPlot","EPGExpMCAnalysisComparisonPlot",10,10,1200,canvasNumPixelsY); mainPad=(TPad*) theCanvas->GetPad(0); double ylow,yhigh; yhigh=1; ylow=1.-canvasNumPixelsYTitle/(double)canvasNumPixelsY; titlePad=new TPad("titlePad", "titlePad", 0., ylow, 1., yhigh, -1, 1, 1); yhigh=ylow; ylow=ylow-canvasNumPixelsYPlot/(double)canvasNumPixelsY; gEPad=new TPad("gEPad", "gEPad", 0., ylow, 1., yhigh, -1, 1, 1); yhigh=ylow; ylow=0; detPad=new TPad("detPad", "detPad", 0., ylow, 1., yhigh, -1, 1, 1); titlePad->Draw(); gEPad->Draw(); detPad->Draw(); // titlePad=(TPad*) theCanvas->GetPad(1); // gEPad=(TPad*) theCanvas->GetPad(2); // detPad=(TPad*) theCanvas->GetPad(3); // egTPad=(TPad*) theCanvas->GetPad(4); titlePad->SetMargin(0.05,0.0,0.0,0.0); gEPad->SetMargin(0.05,0.0,0.0,0.05); if(numExp>1 && numMC>1) { gEPad->Divide(2); gEPadSubs[0]=(TPad*) gEPad->GetPad(1); TPad* tempPad; tempPad=(TPad*) gEPad->GetPad(2); tempPad->Divide(1,2); gEPadSubs[1]=(TPad*) tempPad->GetPad(1); gEPadSubs[2]=(TPad*) tempPad->GetPad(2); TPad* allBasePads[5]={titlePad,gEPadSubs[0],gEPadSubs[1],gEPadSubs[2],detPad}; for (int i = 1;i< 5;i++) { allBasePads[i]->SetGrid(1,1); allBasePads[i]->SetTickx(1); allBasePads[i]->SetTicky(1); } gEPadSubs[2]->SetLogx(); gEPadSubs[0]->SetMargin(0.15,0.1,.1,0.1); gEPadSubs[1]->SetMargin(0.1,0.1,.1,0.1); gEPadSubs[2]->SetMargin(0.1,0.1,.1,0.1); //Plot gE gEPadSubs[0]->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_COMP); gEPadSubs[1]->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_RESID); gEPadSubs[2]->cd(); drawPlot(detType, PLOTVAR_GEVAR,PLOT_NORMRESID); } else { TPad* allBasePads[3]={titlePad,gEPad,detPad}; for (int i = 1;i< 3;i++) { allBasePads[i]->SetGrid(1,1); allBasePads[i]->SetTickx(1); allBasePads[i]->SetTicky(1); } gEPad->SetMargin(0.13,0.1,.1,0.1); //Plot gE gEPad->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_COMP); } mainPad->SetFillColor(kGray); ///Make Title box titlePad->cd(); titlePad->SetFillColor(kGray); TPaveText* titleBox = makeTitleBox( detType); titleBox->Draw(); detPad->SetMargin(0.1,0.05,.1,0.1); //Plot det detPad->cd(); drawPlot(detType, PLOTVAR_GE,PLOT_DETS); TString coTypeString; if(detType==DET_EP) { coTypeString="EP"; } else if(detType==DET_EPG) { coTypeString="EPG"; } else if(detType==DET_EPBG) { coTypeString="EPBG"; } TString imagePath=GRAPHS_DIR; imagePath+="layouts/PlotLayout"; if(numMC) imagePath+="_MC"; for (int i = 0;i< numMC;i++) { imagePath+=TString("_")+mc[i]->GetName(); } if(numExp) imagePath+="_Exp"; for (int i = 0;i< numExp;i++) { imagePath+=TString("_")+exp[i]->GetName(); } imagePath+="_"+coTypeString+"_EPGPlots.pdf"; theCanvas->SaveAs(imagePath); delete theCanvas; clearPlotHists(); }
void singlejeteff(){ Double_t xbins[13] = {10,20,30,35,40,45,50,60,80,90,100,150,200}; int nbins = 12; TFile* g = new TFile("oct9/effoct11.root"); g->TFile::Open(); TH1F *h = (TH1F*)g->Get("Denom"); h->Sumw2(); h->Rebin(2,"hnew"); TH1F *h20 = (TH1F*)g->Get("a4tt/hista4tt15"); //h20->Sumw2(); h20->Rebin(nbins,"hnew20",xbins); h20->Rebin(2,"hnew20"); TH1F *h20h = (TH1F*)g->Get("a4ttjes/hista4ttjes35"); //h20h->Sumw2(); h20h->Rebin(nbins,"hnew20h",xbins); h20h->Rebin(2,"hnew20h"); TGraphAsymmErrors *h5=new TGraphAsymmErrors(hnew20,hnew); h5->Draw("AP"); h5->SetMarkerStyle(20); //h5->SetMarkerSize(1.6); h5->SetMaximum(1.2); //to set the y axis maximum h5->SetMinimum(0.1); // to set the y axis minimum h5->GetXaxis()->SetRangeUser(0.,120.); h5->GetXaxis()->SetTitle("Leading jet p_{T,offline} (EM+JES) [GeV]"); h5->GetYaxis()->SetTitle("Efficiency"); TGraphAsymmErrors *h6=new TGraphAsymmErrors(hnew20h,hnew); h6->Draw("P,same"); h6->SetMarkerStyle(22);h6->SetMarkerColor(2);h6->SetLineColor(2);h6->SetLineStyle(2); TPaveText *pt = new TPaveText(0.506182,0.4016529,0.75163,0.65,"blNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextFont(42); pt->SetTextSize(0.05); pt->AddText("| #eta_{offline} | <2.8"); pt->Draw("same"); TLegend *leg = new TLegend(0.506182,0.2016529,0.75163,0.4,"","brNDC");leg->SetFillColor(kWhite); leg->SetBorderSize(0); leg->SetTextSize(0.05); leg->SetTextFont(42); leg->AddEntry(h5,"L2FS EM J15"); leg->AddEntry(h6,"L2FS EM+JES J35"); leg->SetBorderSize(0); leg->SetTextSize(0.05); leg->SetTextFont(42); leg->Draw("same"); //c1->SetGridx(); c1->SetGridy(); // c1->SetGridx(); c1->SetGridy(); //c1->SetLogx(1); //h6->Draw("HIST,C,same");h6->SetLineColor(2); //c1->SetGridx(); c1->SetGridy(); //TH1F *h5 = new TH1F("h5","L2FS_6j25 Efficiency",nbins,xbins); // TH1F *h5 = new TH1F("h5","L2FS_6j25 Efficiency",125,0,500); // h5->Divide(hnew20,hnew,1,1,"B"); }