ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/benhoob/HWW/plot.C
Revision: 1.1
Committed: Mon Feb 14 12:39:14 2011 UTC (14 years, 3 months ago) by benhoob
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
Initial commit

File Contents

# Content
1 #include <algorithm>
2 #include <iostream>
3 #include <map>
4 #include <vector>
5 #include <sstream>
6 #include "TChain.h"
7 #include "TChainElement.h"
8 #include "TDirectory.h"
9 #include "TFile.h"
10 #include "TProfile.h"
11 #include "TTree.h"
12 #include "TH1F.h"
13 #include "TH2F.h"
14 #include "TMath.h"
15 #include "TCut.h"
16 #include "TRandom3.h"
17 #include "TCanvas.h"
18 #include <iomanip>
19
20 using namespace std;
21
22
23 void plot(){
24
25 int mH = 130;
26 //int mH = 160;
27 //int mH = 200;
28
29 TCut met_projpt = "(event_type != 2 && met_projpt>35. ) || (event_type == 2 && met_projpt > 20.)";
30 TCut pt2020 = "lephard_pt > 20 && lepsoft_pt > 20";
31 TCut pt2010 = "lephard_pt > 20 && lepsoft_pt > 10";
32 TCut jetveto = "jets_num==0 && extralep_num==0 && lowptbtags_num==0 && softmu_num == 0";
33 TCut mll12 = "dil_mass > 12.";
34 TCut h130 = "dil_dphi < 1.05 && dil_mass < 45. && lephard_pt > 25 && lepsoft_pt > 20";
35 TCut h160 = "dil_dphi < 1.05 && dil_mass < 50. && lephard_pt > 30 && lepsoft_pt > 25";
36 TCut h200 = "dil_dphi < 1.75 && dil_mass < 90. && lephard_pt > 40 && lepsoft_pt > 25";
37 TCut weight = "event_scale1fb * 0.0355";
38 TCut sel = pt2010 + met_projpt + jetveto + mll12;
39 TCut hsel;
40
41 char* iter = "v2";
42
43 // TChain *bkg = new TChain("Events");
44 // // bkg->Add(Form("babies/%s/WWTo2L2Nu_PU_testFinal_baby.root",iter));
45 // // bkg->Add(Form("babies/%s/GluGluToWWTo4L_PU_testFinal_baby.root",iter));
46 // // bkg->Add(Form("babies/%s/WZ_PU_testFinal_baby.root",iter));
47 // // bkg->Add(Form("babies/%s/ZZ_PU_testFinal_baby.root",iter));
48 // // bkg->Add(Form("babies/%s/TTJets_PU_testFinal_baby.root",iter));
49 // // bkg->Add(Form("babies/%s/tW_PU_testFinal_baby.root",iter));
50 // // bkg->Add(Form("babies/%s/WJetsToLNu_PU_testFinal_baby.root",iter));
51 // // bkg->Add(Form("babies/%s/DYToMuMuM20_PU_testFinal_baby.root",iter) );
52 // // bkg->Add(Form("babies/%s/DYToMuMuM10To20_PU_testFinal_baby.root",iter) );
53 // // bkg->Add(Form("babies/%s/DYToEEM20_PU_testFinal_baby.root",iter) );
54 // // bkg->Add(Form("babies/%s/DYToEEM10To20_PU_testFinal_baby.root",iter) );
55 // // bkg->Add(Form("babies/%s/DYToTauTauM20_PU_testFinal_baby.root",iter) );
56 // // bkg->Add(Form("babies/%s/DYToTauTauM10To20_PU_testFinal_baby.root",iter) );
57
58 TChain *wwbkg = new TChain("Events");
59 wwbkg->Add(Form("babies/%s/WWTo2L2Nu_PU_testFinal_baby.root",iter));
60
61 TChain *wjetsbkg = new TChain("Events");
62 wjetsbkg->Add(Form("babies/%s/WJetsToLNu_PU_testFinal_baby.root",iter));
63
64 TChain* sig = new TChain("Events");
65
66 if( mH == 130 ){
67 sig->Add(Form("babies/%s/HToWWTo2L2NuM130_PU_testFinal_baby.root",iter));
68 sig->Add(Form("babies/%s/HToWWToLNuTauNuM130_PU_testFinal_baby.root",iter));
69 sig->Add(Form("babies/%s/HToWWTo2Tau2NuM130_PU_testFinal_baby.root",iter));
70 hsel = sel + h130;
71 }
72 else if( mH == 160 ){
73 sig->Add(Form("babies/%s/HToWWTo2L2NuM160_PU_testFinal_baby.root",iter));
74 sig->Add(Form("babies/%s/HToWWToLNuTauNuM160_PU_testFinal_baby.root",iter));
75 sig->Add(Form("babies/%s/HToWWTo2Tau2NuM160_PU_testFinal_baby.root",iter));
76 hsel = sel + h160;
77 }
78 else if( mH == 200 ){
79 sig->Add(Form("babies/%s/HToWWTo2L2NuM200_PU_testFinal_baby.root",iter));
80 sig->Add(Form("babies/%s/HToWWToLNuTauNuM200_PU_testFinal_baby.root",iter));
81 sig->Add(Form("babies/%s/HToWWTo2Tau2NuM200_PU_testFinal_baby.root",iter));
82 hsel = sel + h200;
83 }
84 else{
85 std::cout << "Error, unrecognized higgs mass " << mH << " GeV, quitting" << std::endl;
86 exit(0);
87 }
88
89
90 TCanvas *c1 = new TCanvas();
91 c1->cd();
92
93 TH1F* hdphi_ww = new TH1F("hdphi_ww","", 20,0,3.14);
94 TH1F* hdphi_wjets = new TH1F("hdphi_wjets","", 20,0,3.14);
95 TH1F* hdphi_h130 = new TH1F("hdphi_h130","", 20,0,3.14);
96
97 wwbkg->Draw ("dil_dphi>>hdphi_ww", sel * weight );
98 wjetsbkg->Draw("dil_dphi>>hdphi_wjets", sel * weight );
99 sig->Draw ("dil_dphi>>hdphi_h130", sel * weight );
100
101 cout << "WW yield " << hdphi_ww->Integral() << endl;
102 cout << "W+jets yield " << hdphi_wjets->Integral() << endl;
103 cout << "Higgs yield " << hdphi_h130->Integral() << endl;
104
105 hdphi_wjets->SetLineColor(2);
106 hdphi_h130->SetLineColor(4);
107
108
109 hdphi_ww->Draw();
110 hdphi_wjets->Draw("same");
111 hdphi_h130->Draw("same");
112
113
114 TCanvas *c2 = new TCanvas();
115 c2->cd();
116
117 TH1F* hmll_ww = new TH1F("hmll_ww","", 20,0,100);
118 TH1F* hmll_wjets = new TH1F("hmll_wjets","", 20,0,100);
119 TH1F* hmll_h130 = new TH1F("hmll_h130","", 20,0,100);
120
121 wwbkg->Draw ("dil_mass>>hmll_ww", sel * weight );
122 wjetsbkg->Draw("dil_mass>>hmll_wjets", sel * weight );
123 sig->Draw ("dil_mass>>hmll_h130", sel * weight );
124
125 cout << "WW yield " << hmll_ww->Integral() << endl;
126 cout << "W+jets yield " << hmll_wjets->Integral() << endl;
127 cout << "Higgs yield " << hmll_h130->Integral() << endl;
128
129 hmll_wjets->SetLineColor(2);
130 hmll_h130->SetLineColor(4);
131
132
133 hmll_ww->Draw();
134 hmll_wjets->Draw("same");
135 hmll_h130->Draw("same");
136
137 }