BIGHOME_UI_MainWindow_titleBar::BIGHOME_UI_MainWindow_titleBar(QWidget *parent) : QWidget(parent) { ui.setupUi(this); init(); setstyle(); }
void GasPlot(TString set, TTree *t){ setstyle(); TH2D* wublu = Get2dMTaT(set , HT350,"(80,0.,200.,60.,0.,1.5)",t); wublu->Draw("COLZ"); wublu->GetYaxis()->SetTitle("AlphaT_Lep"); wublu->GetXaxis()->SetTitle("PFMT"); wublu->SetTitle("Muon Channel - "+set); if(set == "W+Jets"){ wublu->Scale(1.29557302);} if(set == "Z+Jets"){ wublu->Scale(3048./2400.);} if(set == "t #bar{t}"){ wublu->Scale(1.65789474);} TCanvas *cstar = new TCanvas("MTPFAT_Muons"+set,"MTPFAT_Muons"+set,500,400); wublu->Draw("COLZ"); cstar->SaveAs(plots+"MTaT/Muons_2dmtatplot_"+set+".png"); }
void Plot(TString var,TCut cut,TString bins,Double_t xmax,TString cutpoint){ setstyle(); TH1::SetDefaultSumw2(true); TCanvas *c2 = new TCanvas("canvas"+var+cutpoint,"canname"+var+cutpoint,800,800); TPad *mainPad = new TPad("","",0.01,0.25,0.99,0.99); mainPad->SetNumber(1); mainPad->Draw(); TPad *ratioPad = new TPad("","",0.01,0.01,0.99,0.25); ratioPad->SetNumber(2); ratioPad->Draw(); c2->cd(1); // if (cutpoint == "noHT"){ TCut cut = numpj; TCut cutData = numpjData;} // else if (cutpoint == "HT200"){ TCut cut = HT200; TCut cutData = HT200Data; }// // else if (cutpoint == "anoHT"){ TCut cut = anumpj; TCut cutData = anumpjData;} // else if (cutpoint == "aHT200"){ TCut cut = aHT200; TCut cutData = aHT200Data; } // else if (cutpoint == "HT300"){ TCut cut = HT300; TCut cutData = HT300Data;} // else if (cutpoint == "HT350"){ TCut cut = HT350; TCut cutData = HT350Data; } // else if (cutpoint == "aT"){ TCut cut = aT; TCut cutData = aTData;} // else if (cutpoint == "early"){TCut cut = earlyaT; TCut cutData = earlyaTData;} //else{cout << "ERRORRRR: BRaaaaaaaaaaaaaaaaaains" << endl; } TCut cutData = trig && hbhe && cut; TH1D* lm0 = GetHist("LM0",kRed,var,cut,bins,tLM0,cutpoint); /// cout << "lm0" << endl; TH1D* lm1 = GetHist("LM1",kRed,var,cut,bins,tLM1,cutpoint); // cout << "lm1" << endl; TH1D* qcd = GetHist("QCD_AllPtBins_7TeV_Pythia",kOrange+4,var,cut && mu_pt_hi,bins,tQCD,cutpoint); // cout << "qcd" << endl; TH1D* data = GetHist("Data",1,var,cutData,bins,tData,cutpoint); // cout << "data" << endl; TH1D* W = GetHist("Wjets_vols",kBlue,var,cut,bins,tW,cutpoint); //cout << "W" << endl; TH1D* tt = GetHist("ttbarTauola",kGreen,var,cut,bins,tTT,cutpoint); // cout << "tt" << endl; TH1D* Z = GetHist("ZJets_madgraph",kYellow,var,cut,bins,tZ,cutpoint); // cout << "Z" << endl; //TH1D* qcd_lo = GetHist("QCD_AllPtBins_7TeV_Pythia",kOrange+4,var,cut && mu_pt_lo,bins,tQCD,cutpoint); // qcd_lo->Scale(1.94); // qcd->Add(qcd_lo); // TH1D* SM = GetHist("SM",kGray+2,var,cut,binstLM0,cutpoint); lm1->SetLineStyle(2); W->Scale(1.29557302); tt->Scale(1.65789474); Z->Scale(3048./2400.); TH1::SetDefaultSumw2(true); TH1D *SM = (TH1D*)qcd->Clone(); SM->Add(Z); SM->Add(tt); SM->Add(W); //SM->SetLineColor(kGray+2); // SM->SetFillStyle(3001); // SM->SetFillColor(kGray+2); // SM->SetMarkerSize(0.); //for(int bnum = 1; bnum <9; bnum++){ // if(data->GetBinContent(bnum)>0){ // cout << "Bin Number " << bnum << " has qcd " << qcd->GetBinContent(bnum) << " and data " << data->GetBinContent(bnum) << " and SM " << SM->GetBinContent(bnum) << " and scale factor to QCD " << data->GetBinContent(bnum)/qcd->GetBinContent(bnum) << " and scale factor to SM " << data->GetBinContent(bnum)/SM->GetBinContent(bnum) << endl; // } // } c2->cd(1)->SetLogy(); // data->Draw("PE0"); SM->Draw("E"); THStack bkg("bkg","test stacked histograms"); bkg.Add(Z); bkg.Add(tt); bkg.Add(W); bkg.Add(qcd); bkg.Draw("HIST0SAME"); // data->Draw("PE0SAME"); //qcd->Draw("HIST0same"); /* W->Draw("HIST0same"); Z->Draw("HIST0same"); tt->Draw("HIST0same"); */ lm0->Draw("HIST0same"); lm0->SetLineColor(1); lm0->SetFillColor(0); lm1->Draw("HIST0same"); lm1->SetLineColor(1); lm1->SetFillColor(0); lm1->SetLineStyle(2); // data->Draw("EPSAME"); if(xmax == 1337){ double ymax=SM->GetMaximum()*12.6;} else{ double ymax=SM->GetMaximum()*10.6;} SM->GetYaxis()->SetRangeUser(0.05,ymax); if (var=="AlphaT_Lep") { data->GetXaxis()->SetRangeUser(0.,xmax);} SM->GetXaxis()->SetTitle(var); SM->SetTitle(); TLegend *leg = new TLegend(0.73803,0.591026,0.88137,0.880819); // leg->SetShadowColor(0); //leg->SetBorderSize(0); //leg->SetFillStyle(4100); leg->SetTextSize(0.04); leg->SetFillColor(0); leg->SetLineColor(0); // leg->AddEntry(data,"DATA","PL"); leg->AddEntry(qcd,"QCD","FL"); leg->AddEntry(W,"W","FL"); leg->AddEntry(Z,"Z","FL"); leg->AddEntry(tt,"TTbar","FL"); leg->AddEntry(lm0,"LM0","FL"); leg->AddEntry(lm1,"LM1","FL"); //leg->AddEntry(SM,"SM BKGD","FL"); leg->Draw("same"); TLatex *prelim = new TLatex(0.1152,0.81981,"CMS preliminary 2010"); TLatex *lumi = new TLatex(0.1015,.9403,"#scale[0.8]{#int L dt = " +luminum+ "pb^{-1}, #sqrt{s} = 7 TeV}"); prelim->SetNDC(); lumi->SetNDC(); // prelim->Draw("same"); lumi->Draw("same"); TH1D *RatioBottom = (TH1D*)SM->Clone("Ratiob"); TH1D *RatioTop = (TH1D*)data->Clone("Ratiot"); RatioTop->GetYaxis()->SetTitle("data / sim"); RatioTop->GetXaxis()->SetTitle(); RatioTop->Divide(RatioBottom); c2->cd(2); gPad->SetGridx(); gPad->SetGridy(); RatioTop->SetTitleSize(0.1, "XYZ"); RatioTop->SetTitleOffset(0.55, "X"); RatioTop->SetTitleOffset(0.3, "Y"); RatioTop->SetLabelSize(0.06,"XY"); RatioTop->GetYaxis()->SetRangeUser(-2.,4.0); RatioTop->Draw(); RatioTop->GetYaxis()->SetLabelSize(0.05); TBox *unity = new TBox(RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetFirst()), 0.89,RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetLast()), 1.11); unity->SetLineWidth(2); unity->SetLineColor(2); unity->SetFillColor(2); unity->SetFillStyle(3002); unity->Draw(); c2->Update(); if(cutpoint == "early"){ c2->SaveAs(plots+erlee+"Muon_ND"+selec+var+"_"+cutpoint+".png"); } else if (xmax == 90003){ c2->SaveAs(plots+"Muon_ND"+selec+"_zooomed_"+var+"_"+cutpoint+".png");} else{ c2->SaveAs(plots+"Muon_ND"+ptsec++selec+var+"_"+cutpoint+".png");} c2->Close(); }
void control(TString var,TString bin, TCut cuts, TCut cutsA, TString cutpoint,bool log,Double_t ymax){ setstyle(); TH1::SetDefaultSumw2(true); TCanvas *c2 = new TCanvas("canvas"+var+cutpoint,"canname"+var+cutpoint,700,800); TPad *mainPad = new TPad("","",0.01,0.25,0.99,0.99); mainPad->SetNumber(1); mainPad->Draw(); TPad *ratioPad = new TPad("","",0.01,0.01,0.99,0.25); ratioPad->SetNumber(2); ratioPad->Draw(); c2->cd(1); TCut lo = cuts && mu_pt_lo; TCut hi = cuts && mu_pt_hi; // TH1D *Ctrl_lo = GetHist("AS",kBlack,var,lo,bin,astQCD,cutpoint); // TH1D *Sig_lo = GetHist("S",kRed,var,lo,bin,stQCD,cutpoint); TH1D *Ctrl_hi = GetHist("AS",kBlack,var,cuts,bin,astQCD,cutpoint); TH1D *Sig_hi = GetHist("S",kRed,var,cuts,bin,stQCD,cutpoint); // Ctrl_lo->Scale(1.94); // Sig_lo->Scale(1.94); TH1D *Ctrl = Ctrl_hi->Clone(); TH1D *Sig = Sig_hi->Clone(); // Ctrl->Add(Ctrl_hi); // Sig->Add(Sig_hi); Sig->Scale(intlumi); // TH1D *Ctrl = GetHist("AS",kBlack,var,cuts,bin,astQCD,cutpoint); if(Ctrl->Integral()!=0){ Ctrl->Scale(Sig->Integral()/Ctrl->Integral()); } if(log){ c2->cd(1)->SetLogy();} TLegend *leg = new TLegend(0.564,0.719,0.775,0.875); leg->SetTextSize(0.054); leg->SetFillColor(0); leg->SetLineColor(0); // leg->AddEntry(Ctrl,"Anti-Selected","LF"); leg->AddEntry(Sig,"Selected","LF"); leg->AddEntry(Ctrl,"Anti-Selected","LF"); Ctrl->Draw("EHIST9"); Sig->Draw("E9same"); Sig->SetMarkerStyle(20); Sig->SetMarkerColor(kRed); leg->Draw("same"); Ctrl->SetTitle(); Ctrl->GetXaxis()->SetTitle(var); if(log){ Ctrl->GetYaxis()->SetRangeUser(0.001,ymax); } else{ ymax=(Ctrl->GetMaximum()*1.6); Ctrl->GetYaxis()->SetRangeUser(0.,ymax); } TH1D *RatioBottom = (TH1D*)Ctrl->Clone("Ratiob"); TH1D *RatioTop = (TH1D*)Sig->Clone("Ratiot"); RatioTop->GetYaxis()->SetTitle("Selected / Anti-Selected"); RatioTop->GetXaxis()->SetTitle(); RatioTop->SetTitle(); RatioTop->Divide(RatioBottom); c2->cd(2); gPad->SetGridx(); gPad->SetGridy(); RatioTop->SetTitleSize(0.1, "XYZ"); RatioTop->SetTitleOffset(0.55, "X"); RatioTop->SetTitleOffset(0.3, "Y"); RatioTop->SetLabelSize(0.06,"XY"); RatioTop->GetYaxis()->SetRangeUser(-2.,5.0); RatioTop->SetLineColor(kBlack); RatioTop->Draw(); TBox *unity = new TBox(RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetFirst()), 0.79,RatioTop->GetXaxis()->GetBinLowEdge(RatioTop->GetXaxis()->GetLast()), 1.21); unity->SetLineWidth(2); unity->SetLineColor(2); unity->SetFillColor(2); unity->SetFillStyle(3002); unity->Draw(); c2->Update(); c2->SaveAs(plots+"SAS_Muon_10to25"+var+"_"+cutpoint+".png"); // c2->Close(); }