16 |
|
#include <TTree.h> |
17 |
|
#include <cmath> |
18 |
|
#include "map.h" |
19 |
+ |
#include <TCut.h> |
20 |
+ |
#include <sstream> |
21 |
|
|
22 |
|
std::map<TString,TString> histName; |
23 |
|
std::map<TString,TH1*> hs; |
24 |
|
std::map<TString,TCanvas*> ts; |
25 |
|
|
24 |
– |
// Output file |
25 |
– |
// New |
26 |
– |
TString fileName = "skimmed361p3_20100621/Data_Incl_NewRelIso_wErrors_TandL_26.root"; |
27 |
– |
//TString fileName = "skimmed361p3_20100621/MC_Incl_NewRelIso_wErrors_TandL_2.root"; |
28 |
– |
//TString fileName = "skimmed361p3_20100621/MC_ppMuX_Incl_NewRelIso_wErrors_TandL_26.root"; |
29 |
– |
//TString fileName = "skimmed361p3_20100621/MC_Wjets_Incl_NewRelIso_wErrors_TandL_26.root"; |
30 |
– |
|
31 |
– |
// Old |
32 |
– |
//TString fileName = "skimmed361p3_20100621/Data_Incl_OldRelIso_wErrors_TandL_26.root"; |
33 |
– |
//TString fileName = "skimmed361p3_20100621/MC_Incl_OldRelIso_wErrors_TandL_2.root"; |
34 |
– |
//TString fileName = "skimmed361p3_20100621/MC_ppMuX_Incl_OldRelIso_wErrors_TandL_26.root"; |
35 |
– |
//TString fileName = "skimmed361p3_20100621/MC_Wjets_Incl_OldRelIso_wErrors_TandL_26.root"; |
36 |
– |
|
26 |
|
// Select New or Old reliso: |
27 |
|
TString isoname = "New"; |
28 |
|
// Jet bin: |
29 |
< |
Int_t jbin = -1; // 0-3, 4 for >=4. Put in number less than 5; -1 for all jets (inclusive), 5 for 1-3 |
30 |
< |
double binwidth = 0.001; // 0.02,0.02,0.05,0.1 for New RelIso |
29 |
> |
Int_t jbin = 2; // 1-4: inclusive. -1 for all jets (inclusive), 5 for 1-3. 11: exclusive 1jet; 12: exclusive 2jets... |
30 |
> |
double binwidth[5] = {0.05,0.02,0.01,0.005,0.002}; |
31 |
> |
|
32 |
|
// Which region (true for CD or false for AB) |
33 |
|
bool regionCD = false; |
34 |
|
|
35 |
|
// d0sigCut and d0Cut == -1 means not used |
36 |
|
double d0sigCut = -1; // 3. |
37 |
|
double d0Cut = 0.02; // 200 microns |
38 |
+ |
double dRcut = 0.3; |
39 |
+ |
int minTkHits = 10; |
40 |
+ |
int minMuHits = 0; |
41 |
|
// Histo range |
42 |
|
double xMin = 0.0; |
43 |
|
double xMax = 0.0; |
46 |
|
Double_t fna; // Num of QCD events in signal region |
47 |
|
Double_t fna1; // Num of QCD events in signal region |
48 |
|
|
49 |
+ |
/* TCut TKM = "top_trk_muon == 1"; */ |
50 |
+ |
/* TCut IMP = "TMath::Abs(top_muon_d0) < 0.02"; */ |
51 |
+ |
/* TCut SIMP = "TMath::Abs(top_muon_d0)/top_muon_d0Error < 3"; */ |
52 |
+ |
/* TCut MID = "top_muon_trackerhits > 10 && top_muon_chi2 < 10 && top_muon_muonhits > 0"; */ |
53 |
+ |
/* TCut DeltaR = "top_muon_jet_dr > 0.3"; */ |
54 |
+ |
|
55 |
|
int nbin; |
56 |
|
|
57 |
|
void skim_data::Loop() |
58 |
|
{ |
59 |
< |
// In a ROOT session, you can do: |
60 |
< |
// Modify jbin, binwidth, wxmin, wxmax |
61 |
< |
// Root > .L skim_data.C++ |
62 |
< |
// Root > skim_data t |
63 |
< |
// Root > t.GetEntry(12); // Fill t data members with entry number 12 |
64 |
< |
// Root > t.Show(); // Show values of entry 12 |
65 |
< |
// Root > t.Show(16); // Read and show values of entry 16 |
66 |
< |
// Root > t.Loop(); // Loop on all entries |
67 |
< |
|
68 |
< |
if ( isoname.Contains("Old") ) { |
69 |
< |
xMax = 1+binwidth; |
70 |
< |
nbin = (1.0-xMin)/binwidth+1; |
71 |
< |
} |
72 |
< |
else if ( isoname.Contains("New") ) { |
73 |
< |
xMax = 2.0; |
74 |
< |
nbin = (xMax-xMin)/binwidth; |
75 |
< |
} |
76 |
< |
else { |
77 |
< |
cout << "No Rel Iso defined!" << endl; |
78 |
< |
return; |
79 |
< |
} |
80 |
< |
cout << "nbin for histo = " << nbin << endl; |
81 |
< |
if ( regionCD ) cout << "==> Selecting Region CD." << endl; |
82 |
< |
|
83 |
< |
TTree *ftree = new TTree("myTree","myTree"); |
84 |
< |
ftree->AutoSave(); |
85 |
< |
ftree->Branch("jbin",&fjbin,"jbin/I"); |
86 |
< |
ftree->Branch("na",&fna,"na/D"); |
87 |
< |
ftree->Branch("na1",&fna1,"na1/D"); |
88 |
< |
ftree->SetBranchAddress("jbin",&fjbin); |
89 |
< |
ftree->SetBranchAddress("na",&fna); |
90 |
< |
ftree->SetBranchAddress("na1",&fna1); |
91 |
< |
|
92 |
< |
TH1D *h_RelIso_qcd = new TH1D("h_RelIso_qcd","h_RelIso_qcd",nbin,xMin,xMax); |
93 |
< |
TH1D *h_RelIso_all = new TH1D("h_RelIso_all","h_RelIso_all",nbin,xMin,xMax); |
59 |
> |
int nfiles = sizeof(binwidth)/sizeof(double); |
60 |
> |
for(int i = 0; i < nfiles ; ++i) { |
61 |
> |
// Output fileName |
62 |
> |
TString fileName = "/tmp/Data_250_Incl2_NewRelIso_wErrors_TandL_4"; |
63 |
> |
//TString fileName = "skimmed361p3_20100720/Data_250_Incl4_NewRelIso_wErrors_TandL_4"; |
64 |
> |
//TString fileName = "skimmed361p3_MC/MC_ppMuX_Inc4_NewRelIso_wErrors_TandL_4"; |
65 |
> |
//TString fileName = "skimmed361p3_MC/MC_Wjets_Inc4_NewRelIso_wErrors_TandL_4"; |
66 |
> |
//TString fileName = "skimmed361p3_MC/MC_Zjets_Inc4_NewRelIso_wErrors_TandL_4"; |
67 |
> |
//TString fileName = "skimmed361p3_MC/MC_Mu15_Incl4_NewRelIso_wErrors_TandL_4"; //InclusiveMu15 |
68 |
> |
|
69 |
> |
//TString fileName = "skimmed361p3_20100720/Data_250_Incl4_OldRelIso_wErrors_TandL_4"; |
70 |
> |
//TString fileName = "skimmed361p3_MC/MC_ppMuX_Incl4_OldRelIso_wErrors_TandL_4"; |
71 |
> |
//TString fileName = "skimmed361p3_MC/MC_Wjets_Incl4_OldRelIso_wErrors_TandL_4"; |
72 |
> |
//TString fileName = "skimmed361p3_MC/MC_Zjets_Incl4_OldRelIso_wErrors_TandL_4"; |
73 |
> |
//TString fileName = "skimmed361p3_MC/MC_Mu15_Incl14_OldRelIso_wErrors_TandL_4"; //InclusiveMu15 |
74 |
> |
std::ostringstream ss; |
75 |
> |
ss << binwidth[i]; |
76 |
> |
fileName = fileName + "_" + ss.str() + ".root"; |
77 |
> |
|
78 |
> |
// In a ROOT session, you can do: |
79 |
> |
// Modify jbin, binwidth, wxmin, wxmax |
80 |
> |
// Root > .L skim_data.C++ |
81 |
> |
// Root > skim_data t |
82 |
> |
// Root > t.GetEntry(12); // Fill t data members with entry number 12 |
83 |
> |
// Root > t.Show(); // Show values of entry 12 |
84 |
> |
// Root > t.Show(16); // Read and show values of entry 16 |
85 |
> |
// Root > t.Loop(); // Loop on all entries |
86 |
> |
|
87 |
> |
if ( isoname.Contains("Old") ) { |
88 |
> |
xMax = 1+binwidth[i]; |
89 |
> |
nbin = (1.0-xMin)/binwidth[i]+1; |
90 |
> |
} |
91 |
> |
else if ( isoname.Contains("New") ) { |
92 |
> |
xMax = 2.0; |
93 |
> |
nbin = (xMax-xMin)/binwidth[i]; |
94 |
> |
} |
95 |
> |
else { |
96 |
> |
cout << "No Rel Iso defined!" << endl; |
97 |
> |
return; |
98 |
> |
} |
99 |
> |
cout << "nbin for histo = " << nbin << endl; |
100 |
> |
if ( regionCD ) cout << "==> Selecting Region CD." << endl; |
101 |
|
|
102 |
< |
h_RelIso_qcd->Sumw2(); |
103 |
< |
|
104 |
< |
// define fit region: |
105 |
< |
double AX0 = 0.; |
106 |
< |
double AXf = 0.; |
107 |
< |
double LooseCut = 0.; |
108 |
< |
|
109 |
< |
cout<<"Use "<<isoname<<" RelIso"<<endl; |
104 |
< |
|
105 |
< |
if ( isoname.Contains("Old") ) { |
106 |
< |
// old |
107 |
< |
AX0 = 0.95; |
108 |
< |
AXf = 1.0; |
109 |
< |
LooseCut = 0.9; |
110 |
< |
} |
111 |
< |
else if ( isoname.Contains("New") ) { |
112 |
< |
// new |
113 |
< |
AX0 = 0.0; |
114 |
< |
AXf = 1./19.; // Tight: 1/19 |
115 |
< |
LooseCut = 1./9.; // Loose: 1/9 |
116 |
< |
} |
102 |
> |
TTree *ftree = new TTree("myTree","myTree"); |
103 |
> |
ftree->AutoSave(); |
104 |
> |
ftree->Branch("jbin",&fjbin,"jbin/I"); |
105 |
> |
ftree->Branch("na",&fna,"na/D"); |
106 |
> |
ftree->Branch("na1",&fna1,"na1/D"); |
107 |
> |
ftree->SetBranchAddress("jbin",&fjbin); |
108 |
> |
ftree->SetBranchAddress("na",&fna); |
109 |
> |
ftree->SetBranchAddress("na1",&fna1); |
110 |
|
|
111 |
< |
// Weights: |
112 |
< |
double wqcd = 1.; |
111 |
> |
TH1D *h_RelIso_qcd = new TH1D("h_RelIso_qcd","h_RelIso_qcd",nbin,xMin,xMax); |
112 |
> |
TH1D *h_RelIso_all = new TH1D("h_RelIso_all","h_RelIso_all",nbin,xMin,xMax); |
113 |
|
|
114 |
< |
// Na = num of qcd in signal region |
122 |
< |
double Na[2] = {0.,0.}; |
123 |
< |
double Nqcd[2] = {0.,0.}; |
124 |
< |
|
125 |
< |
double reliso = 0.0; |
126 |
< |
|
127 |
< |
if (fChain == 0) return; |
128 |
< |
|
129 |
< |
Long64_t nentries = fChain->GetEntries(); |
130 |
< |
|
131 |
< |
Long64_t nbytes = 0, nb = 0; |
132 |
< |
for (Long64_t jentry=0; jentry<nentries;jentry++) { |
133 |
< |
Long64_t ientry = LoadTree(jentry); |
134 |
< |
if (ientry < 0) break; |
135 |
< |
nb = fChain->GetEntry(jentry); nbytes += nb; |
136 |
< |
// if (Cut(ientry) < 0) continue; |
137 |
< |
bool signalRegion1 = false; // Is tight |
138 |
< |
bool signalRegion2 = false; // Is loose |
114 |
> |
h_RelIso_qcd->Sumw2(); |
115 |
|
|
116 |
< |
TString filename(fChain->GetCurrentFile()->GetName()); |
117 |
< |
if (isoname.Contains("Old")) { |
118 |
< |
reliso = top_muon_old_reliso; |
119 |
< |
if ( reliso > AX0 ) signalRegion1 = true; |
120 |
< |
if ( reliso > LooseCut ) signalRegion2 = true; |
116 |
> |
// define fit region: |
117 |
> |
double AX0 = 0.; |
118 |
> |
double AXf = 0.; |
119 |
> |
double LooseCut = 0.; |
120 |
> |
|
121 |
> |
cout<<"Use "<<isoname<<" RelIso"<<endl; |
122 |
> |
|
123 |
> |
if ( isoname.Contains("Old") ) { |
124 |
> |
// old |
125 |
> |
AX0 = 0.95; |
126 |
> |
AXf = 1.0; |
127 |
> |
LooseCut = 0.9; |
128 |
|
} |
129 |
< |
else if (isoname.Contains("New")) { |
130 |
< |
/* reliso = top_muon_new_reliso; */ |
131 |
< |
reliso = 1./top_muon_old_reliso - 1.; |
132 |
< |
if ( reliso < AXf ) signalRegion1 = true; |
133 |
< |
if ( reliso < LooseCut ) signalRegion2 = true; |
151 |
< |
} |
152 |
< |
else { |
153 |
< |
cout<<"No RelIso defined!!!"<<endl; |
154 |
< |
return; |
129 |
> |
else if ( isoname.Contains("New") ) { |
130 |
> |
// new |
131 |
> |
AX0 = 0.0; |
132 |
> |
AXf = 0.05; // Tight: 1/19 |
133 |
> |
LooseCut = 0.1; // Loose: 1/9 |
134 |
|
} |
135 |
+ |
|
136 |
+ |
// Weights: |
137 |
+ |
double wqcd = 1.; |
138 |
|
|
139 |
< |
double d0 = TMath::Abs(top_muon_d0); |
140 |
< |
double d0sig = TMath::Abs(top_muon_d0)/top_muon_d0Error; |
141 |
< |
bool correctBin = false; // jet bin condition |
142 |
< |
bool goodD0sig = false; // d0sig condition |
139 |
> |
// Na = num of qcd in signal region |
140 |
> |
double Na[2] = {0.,0.}; |
141 |
> |
double Nqcd[2] = {0.,0.}; |
142 |
> |
|
143 |
> |
double reliso = 0.0; |
144 |
> |
|
145 |
> |
if (fChain == 0) return; |
146 |
> |
|
147 |
> |
Long64_t nentries = fChain->GetEntries(); |
148 |
> |
|
149 |
> |
Long64_t nbytes = 0, nb = 0; |
150 |
> |
for (Long64_t jentry=0; jentry<nentries;jentry++) { |
151 |
> |
Long64_t ientry = LoadTree(jentry); |
152 |
> |
if (ientry < 0) break; |
153 |
> |
nb = fChain->GetEntry(jentry); nbytes += nb; |
154 |
> |
// if (Cut(ientry) < 0) continue; |
155 |
> |
bool signalRegion1 = false; // Is tight |
156 |
> |
bool signalRegion2 = false; // Is loose |
157 |
|
|
158 |
< |
if ( jbin > 5 ) {cout<<"Don't mess around!!! jbin should be less than 5!"<<endl;return;} |
158 |
> |
TString filename(fChain->GetCurrentFile()->GetName()); |
159 |
> |
if (isoname.Contains("Old")) { |
160 |
> |
reliso = top_muon_old_reliso; |
161 |
> |
if ( reliso > AX0 ) signalRegion1 = true; |
162 |
> |
if ( reliso > LooseCut ) signalRegion2 = true; |
163 |
> |
} |
164 |
> |
else if (isoname.Contains("New")) { |
165 |
> |
/* reliso = top_muon_new_reliso; */ |
166 |
> |
reliso = 1./top_muon_old_reliso - 1.; |
167 |
> |
if ( reliso < AXf ) signalRegion1 = true; |
168 |
> |
if ( reliso < LooseCut ) signalRegion2 = true; |
169 |
> |
} |
170 |
> |
else { |
171 |
> |
cout<<"No RelIso defined!!!"<<endl; |
172 |
> |
return; |
173 |
> |
} |
174 |
> |
|
175 |
> |
double d0 = TMath::Abs(top_muon_d0); |
176 |
> |
double d0sig = TMath::Abs(top_muon_d0)/top_muon_d0Error; |
177 |
> |
bool correctBin = false; // jet bin condition |
178 |
> |
bool goodD0sig = false; // d0sig condition |
179 |
> |
|
180 |
> |
if ( jbin > 15 || jbin < -1) {cout<<"jbin not supported!!!"<<endl;return;} |
181 |
> |
|
182 |
> |
if ( jbin == -1 ) { correctBin = true; } |
183 |
> |
else if ( jbin == 5 ){ |
184 |
> |
if ( top_njets >= 1 && top_njets <= 3 |
185 |
> |
) { correctBin = true; } |
186 |
> |
} |
187 |
> |
else if ( jbin >= 10 ){ // exclusive jet bin: 12 means == 2 jets, 13 means == 3 jets and so on |
188 |
> |
if ( top_njets == (jbin - 10) ) { correctBin = true; } |
189 |
> |
} |
190 |
> |
else if ( jbin <=4 ) { // inclusive jet bin |
191 |
> |
if ( top_njets >= jbin ) { correctBin = true; } //incl |
192 |
> |
} |
193 |
> |
else {cout<<"jbin not supported!!!"<<endl;return;} |
194 |
|
|
195 |
< |
if ( jbin == -1 ) { correctBin = true; } |
196 |
< |
else if ( jbin == 0 ){ |
197 |
< |
if ( top_njets == jbin ) { correctBin = true; } |
195 |
> |
if ( !regionCD && ((d0sigCut != -1 && d0sig < d0sigCut) || (d0Cut != -1 && d0 < d0Cut)) ) goodD0sig = true; |
196 |
> |
if ( regionCD && ((d0sigCut != -1 && d0sig > d0sigCut) || (d0Cut != -1 && d0 > d0Cut)) ) goodD0sig = true; |
197 |
> |
|
198 |
> |
// Counting |
199 |
> |
if( correctBin && goodD0sig |
200 |
> |
//&& top_muon_pt > 10 |
201 |
> |
&& top_muon_pt > 20 |
202 |
> |
&& fabs(top_muon_eta) < 2.1 |
203 |
> |
&& top_trk_muon == 1 |
204 |
> |
//&& top_met > 10 |
205 |
> |
&& top_muon_chi2 < 10 |
206 |
> |
&& top_muon_trackerhits > minTkHits |
207 |
> |
&& top_muon_muonhits > minMuHits |
208 |
> |
&& top_muon_jet_dr > dRcut |
209 |
> |
) { |
210 |
> |
h_RelIso_qcd->Fill(reliso); |
211 |
> |
if ( signalRegion1 ) { Na[0] += wqcd; Nqcd[0] += wqcd; } // QCD in signal region |
212 |
> |
if ( signalRegion2 ) { Na[1] += wqcd; Nqcd[1] += wqcd; } // QCD in signal region |
213 |
> |
} |
214 |
|
} |
215 |
< |
else if ( jbin == 5 ){ |
216 |
< |
if ( top_njets > 0 && top_njets <= 3 ) { correctBin = true; } |
215 |
> |
fjbin=jbin; |
216 |
> |
fna=Na[0]; |
217 |
> |
fna1=Na[1]; |
218 |
> |
ftree->Fill(); |
219 |
> |
cout << "\n"; |
220 |
> |
if (isoname.Contains("New")) |
221 |
> |
cout << " Tight Cut: " << AXf << endl; |
222 |
> |
else if (isoname.Contains("Old")) |
223 |
> |
cout << " Tight Cut: " << AX0 << endl; |
224 |
> |
cout << " N events = " << round(Nqcd[0],0) << endl; |
225 |
> |
cout << "=========================" << endl; |
226 |
> |
cout << "\n"; |
227 |
> |
cout << " Loose Cut: " << LooseCut << endl; |
228 |
> |
cout << " N events = " << round(Nqcd[1],0) << endl << endl; |
229 |
> |
|
230 |
> |
TFile *file0 = new TFile(fileName,"RECREATE"); |
231 |
> |
file0->mkdir("histos"); |
232 |
> |
file0->mkdir("hstack"); |
233 |
> |
file0->cd("histos"); |
234 |
> |
TCanvas *cv1 = new TCanvas("cv1","cv1",800,600); |
235 |
> |
THStack *hs = new THStack("hs","RelIso (stacked)"); |
236 |
> |
|
237 |
> |
// Take care of scaling |
238 |
> |
h_RelIso_qcd->Scale(wqcd); |
239 |
> |
|
240 |
> |
// Save for later use |
241 |
> |
h_RelIso_qcd->Write(); |
242 |
> |
|
243 |
> |
h_RelIso_qcd->SetXTitle("Combined Relative Isolation"); |
244 |
> |
h_RelIso_qcd->SetLineColor(40); |
245 |
> |
h_RelIso_qcd->SetFillStyle(3018); |
246 |
> |
h_RelIso_qcd->SetFillColor(38); |
247 |
> |
h_RelIso_qcd->GetXaxis()->SetTitle("RelIso"); |
248 |
> |
hs->Add(h_RelIso_qcd); |
249 |
> |
hs->Draw(); |
250 |
> |
if ( isoname.Contains("New") ) |
251 |
> |
hs->GetXaxis()->SetTitle("RelIso'"); |
252 |
> |
else if ( isoname.Contains("Old") ) |
253 |
> |
hs->GetXaxis()->SetTitle("RelIso"); |
254 |
> |
hs->GetYaxis()->SetTitle("Events"); |
255 |
> |
hs->GetXaxis()->SetLabelFont(62); |
256 |
> |
hs->GetXaxis()->SetTitleFont(22); |
257 |
> |
hs->GetXaxis()->SetTitleSize(0.04); |
258 |
> |
hs->GetYaxis()->SetLabelFont(62); |
259 |
> |
hs->GetYaxis()->SetTitleFont(62); |
260 |
> |
hs->GetYaxis()->SetTitleSize(0.04); |
261 |
> |
|
262 |
> |
// Label histo |
263 |
> |
TLegend * leg0 = new TLegend(0.65,0.6,0.85,0.8); |
264 |
> |
leg0->SetFillColor(0); |
265 |
> |
leg0->SetFillStyle(0); |
266 |
> |
leg0->AddEntry(h_RelIso_qcd,"Data"); |
267 |
> |
leg0->Draw(); |
268 |
> |
|
269 |
> |
h_RelIso_all->Add(h_RelIso_qcd,1.); |
270 |
> |
h_RelIso_all->Write(); |
271 |
> |
h_RelIso_all->SetLineWidth(2); |
272 |
> |
|
273 |
> |
if ( jbin == -1 ) |
274 |
> |
h_RelIso_all->SetTitle( isoname+" RelIso distribution (inclusive)"); |
275 |
> |
else if ( jbin == 5 ) { |
276 |
> |
h_RelIso_all->SetTitle( isoname+" RelIso distribution (#geq 1 jets (up to 3 jets))"); |
277 |
|
} |
278 |
< |
else if ( jbin == 4 ){ |
279 |
< |
if ( top_njets >= jbin ) { correctBin = true; } |
278 |
> |
else if ( jbin >= 10 ) { |
279 |
> |
ostringstream suffix1; |
280 |
> |
suffix1 << (jbin-10); |
281 |
> |
h_RelIso_all->SetTitle( TString(isoname+" RelIso distribution ("+suffix1.str()+" jets)")); |
282 |
|
} |
283 |
< |
else { |
284 |
< |
if ( top_njets == jbin ) { correctBin = true; } |
283 |
> |
else if ( jbin <= 4 ) { |
284 |
> |
TString title = isoname+" RelIso distribution (#geq "; |
285 |
> |
title += jbin; |
286 |
> |
title += " jets)"; |
287 |
> |
h_RelIso_all->SetTitle(title); |
288 |
|
} |
289 |
< |
|
290 |
< |
if ( !regionCD && ((d0sigCut != -1 && d0sig < d0sigCut) || (d0Cut != -1 && d0 < d0Cut)) ) goodD0sig = true; |
291 |
< |
if ( regionCD && ((d0sigCut != -1 && d0sig > d0sigCut) || (d0Cut != -1 && d0 > d0Cut)) ) goodD0sig = true; |
180 |
< |
|
181 |
< |
// Counting |
182 |
< |
if( correctBin && goodD0sig |
183 |
< |
&& top_muon_pt > 20 |
184 |
< |
//&& top_trk_muon == 1 |
185 |
< |
//&& top_met > 5 |
186 |
< |
) { |
187 |
< |
h_RelIso_qcd->Fill(reliso); |
188 |
< |
if ( signalRegion1 ) { Na[0] += wqcd; Nqcd[0] += wqcd; } // QCD in signal region |
189 |
< |
if ( signalRegion2 ) { Na[1] += wqcd; Nqcd[1] += wqcd; } // QCD in signal region |
289 |
> |
else { |
290 |
> |
cout<<"jbin not supported!"<<endl; |
291 |
> |
return; |
292 |
|
} |
293 |
< |
} |
192 |
< |
fjbin=jbin; |
193 |
< |
fna=Na[0]; |
194 |
< |
fna1=Na[1]; |
195 |
< |
ftree->Fill(); |
196 |
< |
cout << "\n"; |
197 |
< |
if (isoname.Contains("New")) |
198 |
< |
cout << " Tight Cut: " << AXf << endl; |
199 |
< |
else if (isoname.Contains("Old")) |
200 |
< |
cout << " Tight Cut: " << AX0 << endl; |
201 |
< |
cout << " N events = " << round(Nqcd[0],0) << endl; |
202 |
< |
cout << "=========================" << endl; |
203 |
< |
cout << "\n"; |
204 |
< |
cout << " Loose Cut: " << LooseCut << endl; |
205 |
< |
cout << " N events = " << round(Nqcd[1],0) << endl << endl; |
206 |
< |
|
207 |
< |
TFile *file0 = new TFile(fileName,"RECREATE"); |
208 |
< |
file0->mkdir("histos"); |
209 |
< |
file0->mkdir("hstack"); |
210 |
< |
file0->cd("histos"); |
211 |
< |
TCanvas *cv1 = new TCanvas("cv1","cv1",800,600); |
212 |
< |
THStack *hs = new THStack("hs","RelIso (stacked)"); |
213 |
< |
|
214 |
< |
// Take care of scaling |
215 |
< |
h_RelIso_qcd->Scale(wqcd); |
216 |
< |
|
217 |
< |
// Save for later use |
218 |
< |
h_RelIso_qcd->Write(); |
219 |
< |
|
220 |
< |
h_RelIso_qcd->SetXTitle("Combined Relative Isolation"); |
221 |
< |
h_RelIso_qcd->SetLineColor(40); |
222 |
< |
h_RelIso_qcd->SetFillStyle(3018); |
223 |
< |
h_RelIso_qcd->SetFillColor(38); |
224 |
< |
h_RelIso_qcd->GetXaxis()->SetTitle("RelIso"); |
225 |
< |
hs->Add(h_RelIso_qcd); |
226 |
< |
hs->Draw(); |
227 |
< |
if ( isoname.Contains("New") ) |
228 |
< |
hs->GetXaxis()->SetTitle("RelIso'"); |
229 |
< |
else if ( isoname.Contains("Old") ) |
230 |
< |
hs->GetXaxis()->SetTitle("RelIso"); |
231 |
< |
hs->GetYaxis()->SetTitle("Events"); |
232 |
< |
hs->GetXaxis()->SetLabelFont(62); |
233 |
< |
hs->GetXaxis()->SetTitleFont(22); |
234 |
< |
hs->GetXaxis()->SetTitleSize(0.04); |
235 |
< |
hs->GetYaxis()->SetLabelFont(62); |
236 |
< |
hs->GetYaxis()->SetTitleFont(62); |
237 |
< |
hs->GetYaxis()->SetTitleSize(0.04); |
238 |
< |
|
239 |
< |
// Label histo |
240 |
< |
TLegend * leg0 = new TLegend(0.65,0.6,0.85,0.8); |
241 |
< |
leg0->SetFillColor(0); |
242 |
< |
leg0->SetFillStyle(0); |
243 |
< |
leg0->AddEntry(h_RelIso_qcd,"Data"); |
244 |
< |
leg0->Draw(); |
245 |
< |
|
246 |
< |
h_RelIso_all->Add(h_RelIso_qcd,1.); |
247 |
< |
h_RelIso_all->Write(); |
248 |
< |
h_RelIso_all->SetLineWidth(2); |
249 |
< |
|
250 |
< |
if ( jbin == -1 ) |
251 |
< |
h_RelIso_all->SetTitle( isoname+" RelIso distribution (inclusive)"); |
252 |
< |
else if ( jbin == 4 ) |
253 |
< |
h_RelIso_all->SetTitle( isoname+" RelIso distribution (#geq 4 jets)"); |
254 |
< |
else if ( jbin < 4 ) { |
255 |
< |
TString title = isoname+" RelIso distribution ("; |
256 |
< |
title += jbin; |
257 |
< |
title += " jets)"; |
258 |
< |
h_RelIso_all->SetTitle(title); |
259 |
< |
} |
260 |
< |
else if ( jbin == 5 ) { |
261 |
< |
h_RelIso_all->SetTitle( isoname+" RelIso distribution (#geq 1 jets (up to 3 jets))"); |
262 |
< |
} |
263 |
< |
else { |
264 |
< |
cout<<"Don't mess around!!! jbin should be less than 6!"<<endl; |
265 |
< |
return; |
266 |
< |
} |
267 |
< |
h_RelIso_all->SetMinimum(0); |
293 |
> |
h_RelIso_all->SetMinimum(0); |
294 |
|
|
295 |
< |
file0->cd("hstack"); |
296 |
< |
hs->Write(); |
295 |
> |
file0->cd("hstack"); |
296 |
> |
hs->Write(); |
297 |
|
|
298 |
< |
file0->cd(); |
299 |
< |
ftree->Write(); |
300 |
< |
file0->Close(); |
298 |
> |
file0->cd(); |
299 |
> |
ftree->Write(); |
300 |
> |
file0->Close(); |
301 |
> |
|
302 |
> |
delete hs; |
303 |
> |
delete h_RelIso_qcd; |
304 |
> |
delete h_RelIso_all; |
305 |
> |
} |
306 |
|
} |
307 |
|
|
308 |
|
double skim_data::round(double num, int places) |