Skip to content

Commit

Permalink
di lepton correction
Browse files Browse the repository at this point in the history
  • Loading branch information
weihua19900704 committed Feb 11, 2015
1 parent 38e0b45 commit f08d53f
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 63 deletions.
102 changes: 67 additions & 35 deletions Tool/ClosurePlots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,65 +22,97 @@ int main()
{
ClosurePlots myClosurePlots;
myClosurePlots.Initialization();
myClosurePlots.SetScale(
25446993, //NEvents
806.1, //Xsec
1000 //Lumi in pb
);
//initialize the closure plots parameter we want to investigate
vector<Plotting_Parameter> myPlotting_Paramete =
{
//muon closure plots, all
{"_mu_all_met" , "MET[GeV]" ,200 , 600 },
{"_mu_all_njets" , "NJets30" ,2 , 17 },
{"_mu_all_mt2" , "MT2[GeV]" ,100 , 600 },
{"_mu_all_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_mu_all_met" , "MET [GeV]" ,200 , 600 },
{"_mu_all_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_mu_all_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_mu_all_topmass" , "Top mass [GeV]" ,50 , 300 },
//muon closure plots, acc
{"_mu_acc_met" , "MET[GeV]" ,200 , 600 },
{"_mu_acc_njets" , "NJets30" ,2 , 17 },
{"_mu_acc_mt2" , "MT2[GeV]" ,100 , 600 },
{"_mu_acc_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_mu_acc_met" , "MET [GeV]" ,200 , 600 },
{"_mu_acc_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_mu_acc_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_mu_acc_topmass" , "Top mass [GeV]" ,50 , 300 },
//muon closure plots, id
{"_mu_id_met" , "MET[GeV]" ,200 , 600 },
{"_mu_id_njets" , "NJets30" ,2 , 17 },
{"_mu_id_mt2" , "MT2[GeV]" ,100 , 600 },
{"_mu_id_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_mu_id_met" , "MET [GeV]" ,200 , 600 },
{"_mu_id_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_mu_id_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_mu_id_topmass" , "Top mass [GeV]" ,50 , 300 },
//muon closure plots, iso
{"_mu_iso_met" , "MET[GeV]" ,200 , 600 },
{"_mu_iso_njets" , "NJets30" ,2 , 17 },
{"_mu_iso_mt2" , "MT2[GeV]" ,100 , 600 },
{"_mu_iso_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_mu_iso_met" , "MET [GeV]" ,200 , 600 },
{"_mu_iso_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_mu_iso_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_mu_iso_topmass" , "Top mass [GeV]" ,50 , 300 },
//electron closure plots, all
{"_el_all_met" , "MET[GeV]" ,200 , 600 },
{"_el_all_njets" , "NJets30" ,2 , 17 },
{"_el_all_mt2" , "MT2[GeV]" ,100 , 600 },
{"_el_all_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_el_all_met" , "MET [GeV]" ,200 , 600 },
{"_el_all_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_el_all_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_el_all_topmass" , "Top mass [GeV]" ,50 , 300 },
//electron closure plots, acc
{"_el_acc_met" , "MET[GeV]" ,200 , 600 },
{"_el_acc_njets" , "NJets30" ,2 , 17 },
{"_el_acc_mt2" , "MT2[GeV]" ,100 , 600 },
{"_el_acc_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_el_acc_met" , "MET [GeV]" ,200 , 600 },
{"_el_acc_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_el_acc_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_el_acc_topmass" , "Top mass [GeV]" ,50 , 300 },
//electron closure plots, id
{"_el_id_met" , "MET[GeV]" ,200 , 600 },
{"_el_id_njets" , "NJets30" ,2 , 17 },
{"_el_id_mt2" , "MT2[GeV]" ,100 , 600 },
{"_el_id_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_el_id_met" , "MET [GeV]" ,200 , 600 },
{"_el_id_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_el_id_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_el_id_topmass" , "Top mass [GeV]" ,50 , 300 },
//electron closure plots, iso
{"_el_iso_met" , "MET[GeV]" ,200 , 600 },
{"_el_iso_njets" , "NJets30" ,2 , 17 },
{"_el_iso_mt2" , "MT2[GeV]" ,100 , 600 },
{"_el_iso_topmass" , "TopMass[GeV]" ,50 , 300 },
{"_el_iso_met" , "MET [GeV]" ,200 , 600 },
{"_el_iso_njets" , "Number of 30 GeV jets" ,2 , 17 },
{"_el_iso_mt2" , "MT2 [GeV]" ,100 , 600 },
{"_el_iso_topmass" , "Top mass [GeV]" ,50 , 300 },
};


/*
vector<Plotting_Parameter>::iterator iter_p;
for( iter_p = myPlotting_Paramete.begin() ; iter_p != myPlotting_Paramete.end() ; iter_p ++)
{

myClosurePlots.ClosureTemplate(
(*iter_p).hist_tag,
(*iter_p).XTitle,
(*iter_p).min,
(*iter_p).max
);
}

*/
myClosurePlots.DiLeptonPlots(
"h_exp_mu_all_met",
"h_exp_mu1plus2_all_met",
"MET [GeV]",
200,
600
);
myClosurePlots.DiLeptonPlots(
"h_exp_mu_all_njets",
"h_exp_mu1plus2_all_njets",
"Number of 30 GeV jets",
2,
17
);
myClosurePlots.DiLeptonPlots(
"h_exp_mu_all_mt2",
"h_exp_mu1plus2_all_mt2",
"MT2 [GeV]",
100,
600
);
myClosurePlots.DiLeptonPlots(
"h_exp_mu_all_topmass",
"h_exp_mu1plus2_all_topmass",
"Top mass [GeV]",
50,
300
);
return 0;
}

93 changes: 88 additions & 5 deletions Tool/ClosurePlots.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,30 @@ class ClosurePlots
public:
TFile * fin;
TList * list;


double scale;

void Initialization();
void PrintPlotsName();
void SetScale(
double Nevents,
double XSec,
double Lumi
);
void ClosureTemplate(
TString hist_tag,
TString XTitle,
double min,
double max
);
void DiLeptonPlots(
TString SLhist,
TString DLhist,
TString XTitle,
double min,
double max
);

};

void ClosurePlots::Initialization()
Expand All @@ -46,6 +61,66 @@ void ClosurePlots::PrintPlotsName()
return ;
}


void ClosurePlots::SetScale(
double Nevents,
double XSec,
double Lumi
)
{
scale = XSec*Lumi/Nevents;
}



void ClosurePlots::DiLeptonPlots(
TString SLhist,
TString DLhist,
TString XTitle,
double min,
double max
)
{
TH1D * h_exp_sl = (TH1D*)fin->Get(SLhist);
TH1D * h_exp_dl = (TH1D*)fin->Get(DLhist);

TCanvas *c = new TCanvas("c","A Simple Graph Example",200,10,700,500);
gStyle->SetOptStat(0);

h_exp_dl->GetXaxis()->SetRangeUser(min,max);
h_exp_dl->GetXaxis()->SetTitle(XTitle);
h_exp_dl->SetLineColor(1);
h_exp_dl->SetLineWidth(3);
h_exp_dl->Sumw2();
h_exp_dl->Scale(scale);

h_exp_sl->GetXaxis()->SetRangeUser(min,max);
h_exp_sl->SetLineColor(2);
h_exp_sl->SetLineWidth(3);
h_exp_sl->Sumw2();
h_exp_sl->Scale(scale);

h_exp_dl->Draw();
h_exp_sl->Draw("same");

const std::string titre="CMS Preliminary 2015, 1 fb^{-1}, #sqrt{s} = 13 TeV";
TLatex *title = new TLatex(0.09770115,0.9194915,titre.c_str());
title->SetNDC();
title->SetTextSize(0.045);
title->Draw("same");

TLegend* leg = new TLegend(0.6,0.75,0.85,0.85);
leg->SetBorderSize(0);
leg->SetTextFont(42);
leg->SetFillColor(0);
leg->AddEntry(h_exp_dl,"Expectation 1 or 2 lepton","l");
leg->AddEntry(h_exp_sl,"Expectation 1 lepton","l");
leg->Draw("same");

c->SaveAs( DLhist + TString("_compare.png") );
c->SaveAs( DLhist + TString("_compare.C") );
}

void ClosurePlots::ClosureTemplate(
TString hist_tag,
TString XTitle,
Expand Down Expand Up @@ -93,14 +168,20 @@ void ClosurePlots::ClosureTemplate(
h_pred->GetXaxis()->SetRangeUser(min,max);
h_pred->GetXaxis()->SetTitle(XTitle);
h_pred->SetLineColor(1);
h_pred->SetLineWidth(3);
h_pred->Sumw2();
h_pred->Scale(scale);

h_exp->GetXaxis()->SetRangeUser(min,max);
h_exp->SetLineColor(2);

h_pred->Draw("E");
h_exp->SetLineWidth(3);
h_exp->Sumw2();
h_exp->Scale(scale);

h_pred->Draw();
h_exp->Draw("same");

const std::string titre="CMS Preliminary 2015, Simulation #sqrt{s} = 13 TeV";
const std::string titre="CMS Preliminary 2015, 1 fb^{-1}, #sqrt{s} = 13 TeV";
TLatex *title = new TLatex(0.09770115,0.9194915,titre.c_str());
title->SetNDC();
title->SetTextSize(0.045);
Expand Down Expand Up @@ -147,7 +228,8 @@ void ClosurePlots::ClosureTemplate(
ratio->SetTitleSize(0.15);
ratio->SetStats(kFALSE);
ratio->SetMarkerStyle(kFullDotMedium);
ratio->DrawCopy("E");
ratio->Sumw2();
ratio->DrawCopy();

TH1D *zero = (TH1D*)ratio->Clone();
zero->Reset();
Expand All @@ -156,6 +238,7 @@ void ClosurePlots::ClosureTemplate(
zero->DrawCopy("same");

c->SaveAs( hist_tag + TString(".png") );
c->SaveAs( hist_tag + TString(".C") );
}


Expand Down
Loading

0 comments on commit f08d53f

Please sign in to comment.