#include "TCanvas.h" #include "TFile.h" #include "TROOT.h" #include "TH1F.h" #include #include int met_transposition() { // variables double aux_wm, aux_wp, aux_z, aux_s; TH1F *hist_wm, *hist_wp, *hist_z, *hist_s; THStack *hs = new THStack("hs",""); // loading histograms TFile fwm("histogramas_Wm.root"); TFile fwp("histogramas_Wp.root"); TFile fz("histogramas_Z.root"); TFile fs("histogramas_sinal.root"); TH1F *hist_wm = (TH1F*)fwm.Get("Wm_MET"); hist_wm->SetFillColorAlpha(38, 1); hist_wm->SetLineWidth(2); hist_wm->SetFillStyle(1001); hist_wm->SetStats(0); TH1F *hist_wp = (TH1F*)fwp.Get("Wp_MET"); hist_wp->SetFillColorAlpha(kGreen+2, 1); hist_wp->SetLineWidth(2); hist_wp->SetFillStyle(1001); hist_wp->SetStats(0); TH1F *hist_z = (TH1F*)fz.Get("Z_MET"); hist_z->SetFillColorAlpha(kOrange, 1); hist_z->SetLineWidth(2); hist_z->SetFillStyle(1001); hist_z->SetStats(0); TH1F *hist_s = (TH1F*)fs.Get("sinal_MET"); hist_s->SetFillColorAlpha(41, 0); hist_s->SetLineWidth(3); hist_s->SetFillStyle(1001); hist_s->SetLineColor(kRed); hist_s->SetStats(0); // norm. histograms aux_wm = 5015/(40*pow(10,3)); aux_wp = 6982/(40*pow(10,3)); aux_z = 2321/(40*pow(10,3)); aux_s = 317.0/(40*pow(10,3)); //1000x to signal //cout << hist_wm->Integral() << "\n " << hist_wp->Integral()<< "\n " << hist_z->Integral() <<"\n " << hist_s->Integral(); hist_wm -> Scale(aux_wm); hist_wp -> Scale(aux_wp); hist_z -> Scale(aux_z); hist_s -> Scale(aux_s); // Stack hs->Add(hist_z); hs->Add(hist_wp); hs->Add(hist_wm); // Canvas TCanvas *cs = new TCanvas("cs","cs",10,10,550,600); hs->Draw(); hs->SetTitle("MET Distribution"); hs->GetXaxis()->SetTitle("meT [GeV]"); hs->GetYaxis()->SetTitle("pb / 20GeV"); hs->GetYaxis()->SetLimits(1, pow(10,4)); hs->GetXaxis()->SetLimits(0, 400); hist_s->Draw("Same"); // drawing legend TLegend *legend = new TLegend(0.48, 0.50, 1, 0.80); legend -> SetTextFont(42); legend -> SetTextSize(0.035); legend -> SetFillColorAlpha(10, 0); legend -> AddEntry(hist_wm, "W^{-}(l#nu)+jets","f"); legend -> AddEntry(hist_wp, "W^{+}(l#nu)+jets","f"); legend -> AddEntry(hist_z, "Z^{0}(#nu#nu)+jets","f"); legend -> AddEntry(hist_s, "1000x Signal","l"); legend -> Draw("Same"); //gPad->RedrawAxis(); cs->SetGrid(0); cs->SetLogy(1); hs->GetYaxis()->SetLimits(1, pow(10,4)); cs->Print("MET_transposition.pdf"); return 0; }