1 |
– |
// #define debug |
2 |
– |
//================================================================================================ |
3 |
– |
// |
4 |
– |
// Measure fake rate using muon triggered sample |
5 |
– |
// |
6 |
– |
//________________________________________________________________________________________________ |
7 |
– |
|
1 |
|
#if !defined(__CINT__) || defined(__MAKECINT__) |
2 |
|
#include <TROOT.h> // access to gROOT, entry point to ROOT system |
3 |
|
#include <TLegend.h> |
17 |
|
#endif |
18 |
|
|
19 |
|
TCanvas *c1 = new TCanvas("c1","c1"); |
20 |
< |
TString binning("(100,90,500)"); |
20 |
> |
TString binning("(100,0,500)"); |
21 |
|
|
22 |
|
TH1F *getMCFM(TString mass, TString process) |
23 |
|
{ |
45 |
|
hm->Scale(1./hm->Integral(0,hm->GetNbinsX())); |
46 |
|
return hm; |
47 |
|
} |
48 |
< |
|
48 |
> |
//---------------------------------------------------------------------------------------- |
49 |
|
TH1F *getPowheg(TString mass, TString process) |
50 |
|
{ |
51 |
|
TString fname; |
52 |
|
if(process=="higgs") |
53 |
|
fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-h"+mass+"zz4l-gf-v1g1-pu.root"; |
54 |
|
if(process=="zz") |
55 |
< |
fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz-v11-pu_ntuple.root"; |
55 |
> |
// fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz-v11-pu_ntuple.root"; |
56 |
> |
fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz4l-powheg_ntuple.root"; |
57 |
|
|
58 |
|
TFile fpowheg(fname); |
59 |
|
TTree *tr_powheg = (TTree*)fpowheg.Get("tr_m4l"); |
60 |
< |
tr_powheg->Draw("m4l>>m4l_pow"+binning); |
60 |
> |
tr_powheg->Draw("m4l>>m4l_pow"+binning,"xswgt"); |
61 |
|
TH1F *hm = (TH1F*)gDirectory->Get("m4l_pow"); |
62 |
|
hm->SetDirectory(0); |
63 |
|
fpowheg.Close(); |
64 |
|
hm->Scale(1./hm->Integral(0,hm->GetNbinsX())); |
65 |
|
return hm; |
66 |
|
} |
67 |
+ |
//---------------------------------------------------------------------------------------- |
68 |
|
void Draw_em(TH1F *hm, TH1F *hpowheg, TH1F *hratio, TH1F *hoppo, TH1F *hopporatio) |
69 |
|
{ |
70 |
|
hm->Draw(); |
72 |
|
hpowheg->Draw("same"); |
73 |
|
hratio->SetLineColor(kBlue); |
74 |
|
// hratio->Scale(1./hratio->Integral(0,hratio->GetNbinsX())); // don't scale it! |
75 |
< |
hratio->Draw("same"); |
76 |
< |
hoppo->SetLineColor(kBlack); |
75 |
> |
// hratio->Draw("same"); |
76 |
> |
hoppo->SetLineColor(kBlue); |
77 |
|
hoppo->Scale(1./hoppo->Integral(0,hoppo->GetNbinsX())); |
78 |
< |
hoppo->Draw("same"); |
78 |
> |
// hoppo->Draw("same"); |
79 |
|
hopporatio->SetLineColor(kViolet); |
80 |
|
// hopporatio->Scale(1./hopporatio->Integral(0,hopporatio->GetNbinsX())); // don't scale it! |
81 |
< |
hopporatio->Draw("same"); |
81 |
> |
// hopporatio->Draw("same"); |
82 |
|
TLegend leg(0.7,0.7,0.9,0.9); |
83 |
|
leg.AddEntry(hm,"MCFM","L"); |
84 |
|
leg.AddEntry(hpowheg,"POWHEG","L"); |
86 |
|
leg.AddEntry(hoppo,"opp. mcfm","L"); |
87 |
|
leg.AddEntry(hopporatio,"opp. ratio","L"); |
88 |
|
leg.SetFillColor(0); |
89 |
< |
// leg.Draw(); |
90 |
< |
c1->SetLogy(); |
89 |
> |
leg.Draw(); |
90 |
> |
// c1->SetLogy(); |
91 |
|
c1->SaveAs("~/public_html/fo3o.png"); |
92 |
|
} |
93 |
+ |
//---------------------------------------------------------------------------------------- |
94 |
|
TH1F* makeRatio(TH1F *hm, TH1F *hpowheg) |
95 |
|
{ |
96 |
|
TH1F *ratio = new TH1F(*hm); |
97 |
|
ratio->Divide(hm,hpowheg); |
98 |
|
return ratio; |
99 |
|
} |
100 |
+ |
//---------------------------------------------------------------------------------------- |
101 |
|
TH1F* makeOppo(TH1F *hm, TH1F *hpowheg) |
102 |
|
{ |
103 |
|
TH1F *hoppo = new TH1F(*hm); |
109 |
|
|
110 |
|
return hoppo; |
111 |
|
} |
112 |
+ |
//---------------------------------------------------------------------------------------- |
113 |
|
void writeHists(TH1F *hratio, TH1F *hopporatio, TString process, TString mass) |
114 |
|
{ |
115 |
|
TString fname; |
116 |
|
if(process=="higgs") fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-h"+mass+"zz4l-gf-v1g1-pu_weights.root"; |
117 |
< |
else if(process=="zz") fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz-v11-pu_weights.root"; |
117 |
> |
// else if(process=="zz") fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz-v11-pu_weights.root"; |
118 |
> |
else if(process=="zz") fname = "~/cms/cmssw/025/CMSSW_4_4_1/src/MitHzz4l/data/m4lshapes/s11-zz4l-powheg_weights.root"; |
119 |
|
TFile f(fname,"update"); |
120 |
|
hratio->Write("low"); |
121 |
|
hopporatio->Write("high"); |