ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/NonMCBackground/src/plotZPlusFake.cc
Revision: 1.3
Committed: Fri Jul 13 07:44:52 2012 UTC (12 years, 10 months ago) by dkralph
Content type: text/plain
Branch: MAIN
Changes since 1.2: +3 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #include <iostream>
2 #include <algorithm>
3 #include <iomanip>
4 // #include <pair.h>
5
6 #include "RooHistPdf.h"
7 #include "RooGlobalFunc.h"
8 #include "RooPlot.h"
9 #include "RooRealVar.h"
10 #include "RooDataHist.h"
11 #include "RooGenericPdf.h"
12 #include "RooDataSet.h"
13 #include "RooAddPdf.h"
14 #include "RooFormulaVar.h"
15 #include "RooFitResult.h"
16 #include "RooCurve.h"
17 #include "RooBinning.h"
18 #include "RooExponential.h"
19 #include "RooExtendPdf.h"
20
21 #include "RunLumiSet.h"
22
23 #include "TCanvas.h"
24 #include "TChain.h"
25 #include "TString.h"
26 #include "TStyle.h"
27 #include "TH1D.h"
28
29 #include "CPlot.h"
30 #include "FOArgs.h"
31
32 #include "fake_defs.h"
33 #include "Various.h"
34 #include "CommonDefs.h"
35 #include "PlotHeaders.h"
36
37 #ifndef CMSSW_BASE
38 #define CMSSW_BASE "../../"
39 #endif
40
41 using namespace std;
42 using namespace RooFit;
43
44 TCanvas *can;
45
46 void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo=0, double wgt_hi=0);
47 void makeHTML(FOFlags &ctrl, TString type, TString plotLabel);
48 map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str="");
49 TString f_to_a(double val) { stringstream ss; ss << fixed << setprecision(2) << val; return TString(ss.str().c_str()); }
50
51 //----------------------------------------------------------------------------------------
52 int main(int argc, char** argv)
53 {
54 double lumi = 5000;
55
56 FOFlags ctrl;
57 parse_foargs( argc, argv, ctrl );
58 ctrl.dump();
59
60 can = new TCanvas("can","can");
61
62 FR_struct fr2011 = initFRs(ctrl.mufakefile2011,ctrl.elefakefile2011);
63 FR_struct fr2012 = initFRs(ctrl.mufakefile2012,ctrl.elefakefile2012);
64
65 TString cmsswpath(CMSSW_BASE + TString("/src"));
66 string xspath = (string(cmsswpath)+"/MitPhysics/data/xs.dat");
67 SimpleTable xstab(xspath.c_str());
68
69 vector<CSample*> samplev;
70 TString ntupledir(""),label(""),plotLabel("");
71 readConfigFile(ctrl.config, ntupledir, label, plotLabel, samplev, &ctrl, init_hists);
72
73 RunLumiSet rls;
74 UInt_t minRun=999999999,maxRun=0;
75 for(unsigned ics=0; ics<samplev.size(); ics++) {
76 CSample *cs = samplev[ics];
77 cout << cs->name << endl;
78 for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
79 filestuff *fs = (cs->fsv)[ifs];
80 cout << "\t" << fs->fname_ << endl;
81 FR_struct *fr = (fs->era_==2011) ? &fr2011 : &fr2012;
82 unsigned nDuplSkipped=0;
83 for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
84 fs->getentry(ientry,"","FOtree");
85 fs->getentry(ientry,"info","zznt");
86
87 if(fs->isdata_) {
88 setMinMaxRun(fs->info->run, minRun, maxRun);
89 bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, rls, nDuplSkipped);
90 if(dupl) continue;
91 }
92
93 double wgt=1;
94 if(!fs->isdata_) {
95 double xsWgt = lumi*xstab.Get(fs->dataset_)/fs->total_entries_;
96 // double puWgt = weightTrue2012(fs->info->npu);
97 wgt = xsWgt;//*puWgt;
98 // cout << "npu: " << fs->info->npu
99 }
100
101 if(fs->info->met > 25) continue;
102
103 unsigned npass = fs->passingL->size();
104 unsigned nfail = fs->failingL->size();
105
106 float best_z_mass = -99999;
107 pair<int,int> best_z_indices;
108 for(unsigned ilep1=0; ilep1<npass; ilep1++) {
109 SimpleLepton lep1 = (*fs->passingL)[ilep1];
110 for(unsigned ilep2=ilep1+1; ilep2<npass; ilep2++) {
111 SimpleLepton lep2 = (*fs->passingL)[ilep2];
112 if(abs(lep1.type) != abs(lep2.type)) continue;
113 if(lep1.charge == lep2.charge) continue;
114
115 if(lep1.vec.Pt() < 20 && lep2.vec.Pt() < 20) continue;
116 if(lep1.vec.Pt() < 10 || lep2.vec.Pt() < 10) continue;
117
118 float tmpM = ((lep1.vec)+(lep2.vec)).M();
119 if( fabs(tmpM-Z_MASS) < fabs(best_z_mass-Z_MASS) ) {
120 best_z_mass = tmpM;
121 best_z_indices = pair<int,int> (ilep1,ilep2);
122 }
123 }
124 }
125 assert( best_z_mass != 0 );
126 if( best_z_mass < 80 || best_z_mass > 100 ) continue;
127 EventData evtdata;
128 evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
129 evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
130
131 //
132 // Look extra leptons
133 //
134 vector<SimpleLepton> ex_leps;
135 vector<TString> types;
136 for(unsigned ipass=0; ipass<npass; ipass++) {
137 SimpleLepton ex_lep = (*fs->passingL)[ipass];
138 if(ipass == best_z_indices.first) continue;
139 if(ipass == best_z_indices.second) continue;
140 ex_leps.push_back(ex_lep);
141 types.push_back("pass");
142 }
143 for(unsigned ifail=0; ifail<nfail; ifail++) {
144 SimpleLepton ex_lep = (*fs->failingL)[ifail];
145 ex_leps.push_back(ex_lep);
146 types.push_back("fail");
147 }
148
149 if(npass>3) continue;
150
151 for(unsigned iextra=0; iextra<ex_leps.size(); iextra++) {
152 SimpleLepton ex_lep = ex_leps[iextra];
153
154 if(types[iextra]=="fail" && npass>2) continue;
155 SimpleLepton lep1=evtdata.Z1leptons[0],lep2=evtdata.Z1leptons[1];
156 if( dr(lep1,ex_lep) < 0.3) continue;
157 if( dr(lep2,ex_lep) < 0.3) continue;
158
159
160 TString channel;
161 if(abs(ex_lep.type) == 13) channel = "mu";
162 if(abs(ex_lep.type) == 11) channel = "ele";
163
164 // if( !(fabs(lep1.ip3dSig) > 3. &&
165 // fabs(lep2.ip3dSig) > 5.) &&
166 // !(fabs(lep2.ip3dSig) > 3. &&
167 // fabs(lep1.ip3dSig) > 5.) ) continue;
168
169 evtdata.Z2leptons.clear();
170 //????????????????????????????????????????????????????????????????????????????????????????
171 // hack:
172 evtdata.Z2leptons.push_back((*fs->passingL)[best_z_indices.first]);
173 evtdata.Z2leptons.push_back((*fs->passingL)[best_z_indices.second]);
174 //????????????????????????????????????????????????????????????????????????????????????????
175 KinematicsStruct kine;
176 fillKinematics(evtdata,kine);
177 TLorentzVector l1l3(lep1.vec+ex_lep.vec);
178 TLorentzVector l2l3(lep2.vec+ex_lep.vec);
179
180 if(types[iextra]=="pass") {
181 fillHist( cs, channel, "obs", "run", fs->info->run , wgt);
182 fillHist( cs, channel, "obs", "mZ1", kine.mZ1 , wgt);
183 fillHist( cs, channel, "obs", "Z1pt", kine.Z1pt , wgt);
184 fillHist( cs, channel, "obs", "ip3ds_l1", lep1.ip3dSig , wgt);
185 fillHist( cs, channel, "obs", "ip3ds_l2", lep2.ip3dSig , wgt);
186 fillHist( cs, channel, "obs", "ip3ds_l3", ex_lep.ip3dSig , wgt);
187 fillHist( cs, channel, "obs", "pt_l1", lep1.vec.Pt() , wgt);
188 fillHist( cs, channel, "obs", "pt_l2", lep2.vec.Pt() , wgt);
189 fillHist( cs, channel, "obs", "pt_l3", ex_lep.vec.Pt() , wgt);
190 fillHist( cs, channel, "obs", "pt_l3_lo", ex_lep.vec.Pt() , wgt);
191 fillHist( cs, channel, "obs", "eta_l1", lep1.vec.Eta(), wgt);
192 fillHist( cs, channel, "obs", "eta_l2", lep2.vec.Eta(), wgt);
193 fillHist( cs, channel, "obs", "eta_l3", ex_lep.vec.Eta(), wgt);
194 fillHist( cs, channel, "obs", "dR_l1l3_lo",dr(lep1,ex_lep), wgt);
195 fillHist( cs, channel, "obs", "dR_l1l3", dr(lep1,ex_lep), wgt);
196 fillHist( cs, channel, "obs", "dR_l2l3_lo",dr(lep2,ex_lep), wgt);
197 fillHist( cs, channel, "obs", "dR_l2l3", dr(lep2,ex_lep), wgt);
198 fillHist( cs, channel, "obs", "ml1l3", l1l3.M(), wgt);
199 fillHist( cs, channel, "obs", "ml2l3", l2l3.M(), wgt);
200 fillHist( cs, channel, "obs", "met", fs->info->met, wgt);
201 } else if(types[iextra]=="fail") {
202 double fwgt = get_fake_weight("",ex_lep,*fr);
203 double fwgt_lo = get_fake_weight("lo",ex_lep,*fr);
204 double fwgt_hi = get_fake_weight("hi",ex_lep,*fr);
205 double centr = wgt*fwgt;
206 double lo = wgt*fwgt_lo;
207 double hi = wgt*fwgt_hi;
208
209 fillHist( cs, channel, "pred", "run", fs->info->run, centr, lo, hi);
210 fillHist( cs, channel, "pred", "mZ1", kine.mZ1, centr, lo, hi);
211 fillHist( cs, channel, "pred", "Z1pt", kine.Z1pt, centr, lo, hi);
212 fillHist( cs, channel, "pred", "ip3ds_l1", lep1.ip3dSig, centr, lo, hi);
213 fillHist( cs, channel, "pred", "ip3ds_l2", lep2.ip3dSig, centr, lo, hi);
214 fillHist( cs, channel, "pred", "ip3ds_l3", ex_lep.ip3dSig, centr, lo, hi);
215 fillHist( cs, channel, "pred", "pt_l1", lep1.vec.Pt(), centr, lo, hi);
216 fillHist( cs, channel, "pred", "pt_l2", lep2.vec.Pt(), centr, lo, hi);
217 fillHist( cs, channel, "pred", "pt_l3", ex_lep.vec.Pt(), centr, lo, hi);
218 fillHist( cs, channel, "pred", "pt_l3_lo", ex_lep.vec.Pt(), centr, lo, hi);
219 fillHist( cs, channel, "pred", "eta_l1", lep1.vec.Eta(), centr, lo, hi);
220 fillHist( cs, channel, "pred", "eta_l2", lep2.vec.Eta(), centr, lo, hi);
221 fillHist( cs, channel, "pred", "eta_l3", ex_lep.vec.Eta(), centr, lo, hi);
222 fillHist( cs, channel, "pred", "dR_l1l3_lo",dr(lep1,ex_lep), centr, lo, hi);
223 fillHist( cs, channel, "pred", "dR_l1l3", dr(lep1,ex_lep), centr, lo, hi);
224 fillHist( cs, channel, "pred", "dR_l2l3_lo",dr(lep2,ex_lep), centr, lo, hi);
225 fillHist( cs, channel, "pred", "dR_l2l3", dr(lep2,ex_lep), centr, lo, hi);
226 fillHist( cs, channel, "pred", "ml1l3", l1l3.M(), centr, lo, hi);
227 fillHist( cs, channel, "pred", "ml2l3", l2l3.M(), centr, lo, hi);
228 fillHist( cs, channel, "pred", "met", fs->info->met, centr, lo, hi);
229 } else assert(0);
230 }
231 }
232 cout << "\t\tWARNING: skipped " << nDuplSkipped << " duplicate events" << endl;
233 }
234 }
235 cout << "run range: " << setw(12) << minRun << setw(12) << maxRun << endl;
236
237 assert(samplev.size()>0);
238 vector<TString> typev;
239 typev.push_back("both");
240 typev.push_back("mu");
241 typev.push_back("ele");
242 for(unsigned itype=0; itype<typev.size(); itype++) {
243 TString type(typev[itype]);
244 gSystem->mkdir(ctrl.outdir+"/"+plotLabel+"/"+type,true);
245 TFile runHistFile(ctrl.outdir+"/"+plotLabel+"/"+type+"/runs.root","recreate");
246 map<TString,TH1D*>::iterator it_v;
247 for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
248 TString var((*it_v).first);
249 CPlot cplot(var,"",(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),"events",ctrl.outdir+"/"+plotLabel+"/"+type+"/plots");
250 double ymax=0;
251 for(unsigned isam=0; isam<samplev.size(); isam++) {
252 CSample *cs = samplev[isam];
253 TH1D *hObs = (*(cs->hists)[type+"_obs"])[var];
254 TH1D *hPred = (*(cs->hists)[type+"_pred"])[var];
255 TH1D *hPred_lo = (*(cs->hists)[type+"_pred_lo"])[var];
256 TH1D *hPred_hi = (*(cs->hists)[type+"_pred_hi"])[var];
257 if(cs->isdata) {
258 cplot.AddHist1D(hObs,cs->legend+": "+integral_str(hObs),"E");
259 double ratio = integrateHist(hObs) / integrateHist(hPred);
260 cplot.AddHist1D(hPred,"FR predic: "+integral_str(hPred),"hist",kRed);
261 cplot.AddHist1D(hPred_lo,"stat lo: "+integral_str(hPred_lo),"hist",kRed,kDashed);
262 cplot.AddHist1D(hPred_hi,"stat hi: "+integral_str(hPred_hi),"hist",kRed,kDashed);
263 ymax = max(ymax,histMax(hObs,hPred));
264 } else {
265 cplot.AddToStack(hObs,cs->legend+": "+integral_str(hObs),kCyan-6);
266 ymax = max(ymax,histMax(hObs,hPred));
267 }
268 if(cs->isdata && var=="run") {
269 assert(hObs->GetBinContent(0)==0 && hObs->GetBinContent(hObs->GetXaxis()->GetNbins()+1)==0);
270 hObs->Write("runs");
271 }
272 if(var.Contains("ip3d")) {
273 double maxVal = max(hObs->GetMaximum(), hPred->GetMaximum());
274 double isoMin = 0.00005*maxVal;
275 double isoMax = 1.8*maxVal;
276 cplot.SetYRange(isoMin,isoMax);
277 cplot.SetLogy();
278 } else {
279 cplot.SetYRange(0,1.2*ymax);
280 }
281
282 }
283 cplot.Draw(can,true,"png");
284 }
285 runHistFile.Close();
286 makeHTML(ctrl,type, plotLabel);
287 }
288 }
289 //----------------------------------------------------------------------------------------
290 map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str)
291 {
292 map<TString,map<TString,TH1D*>* > hists;
293
294 map<TString,TH1D*> *h_mu_obs = new map<TString,TH1D*>; hists["mu_obs"] = h_mu_obs;
295 map<TString,TH1D*> *h_mu_pred = new map<TString,TH1D*>; hists["mu_pred"] = h_mu_pred;
296 map<TString,TH1D*> *h_mu_pred_lo = new map<TString,TH1D*>; hists["mu_pred_lo"] = h_mu_pred_lo;
297 map<TString,TH1D*> *h_mu_pred_hi = new map<TString,TH1D*>; hists["mu_pred_hi"] = h_mu_pred_hi;
298
299 map<TString,TH1D*> *h_ele_obs = new map<TString,TH1D*>; hists["ele_obs"] = h_ele_obs;
300 map<TString,TH1D*> *h_ele_pred = new map<TString,TH1D*>; hists["ele_pred"] = h_ele_pred;
301 map<TString,TH1D*> *h_ele_pred_lo = new map<TString,TH1D*>; hists["ele_pred_lo"] = h_ele_pred_lo;
302 map<TString,TH1D*> *h_ele_pred_hi = new map<TString,TH1D*>; hists["ele_pred_hi"] = h_ele_pred_hi;
303
304 map<TString,TH1D*> *h_both_obs = new map<TString,TH1D*>; hists["both_obs"] = h_both_obs;
305 map<TString,TH1D*> *h_both_pred = new map<TString,TH1D*>; hists["both_pred"] = h_both_pred;
306 map<TString,TH1D*> *h_both_pred_lo = new map<TString,TH1D*>; hists["both_pred_lo"] = h_both_pred_lo;
307 map<TString,TH1D*> *h_both_pred_hi = new map<TString,TH1D*>; hists["both_pred_hi"] = h_both_pred_hi;
308
309 map<TString,map<TString,TH1D*>* >::iterator it_h;
310 for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
311 (*((*it_h).second))["run"] = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};", 50,160800,196535); (*((*it_h).second))["run"]->Sumw2();
312 (*((*it_h).second))["mZ1"] = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};", 37,70,110); (*((*it_h).second))["mZ1"]->Sumw2();
313 (*((*it_h).second))["Z1pt"] = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};", 37,0,100); (*((*it_h).second))["Z1pt"]->Sumw2();
314
315 (*((*it_h).second))["pt_l1"] = new TH1D(TString("pt_l1") +"_"+(*it_h).first+str,";#bf{l1 p_{T} [GeV]};", 37,0,120); (*((*it_h).second))["pt_l1"]->Sumw2();
316 (*((*it_h).second))["pt_l2"] = new TH1D(TString("pt_l2") +"_"+(*it_h).first+str,";#bf{l2 p_{T} [GeV]};", 37,0,65); (*((*it_h).second))["pt_l2"]->Sumw2();
317 (*((*it_h).second))["pt_l3_lo"] = new TH1D(TString("pt_l3_lo") +"_"+(*it_h).first+str,";#bf{l3_lo p_{T} [GeV]};",37,3,15); (*((*it_h).second))["pt_l3_lo"]->Sumw2();
318 (*((*it_h).second))["pt_l3"] = new TH1D(TString("pt_l3") +"_"+(*it_h).first+str,";#bf{l3 p_{T} [GeV]};", 37,10,40); (*((*it_h).second))["pt_l3"]->Sumw2();
319
320 (*((*it_h).second))["eta_l1"] = new TH1D(TString("eta_l1")+"_"+(*it_h).first+str,";#bf{l1 #eta};", 25,-2.5,2.5); (*((*it_h).second))["eta_l1"]->Sumw2();
321 (*((*it_h).second))["eta_l2"] = new TH1D(TString("eta_l2")+"_"+(*it_h).first+str,";#bf{l2 #eta};", 25,-2.5,2.5); (*((*it_h).second))["eta_l2"]->Sumw2();
322 (*((*it_h).second))["eta_l3"] = new TH1D(TString("eta_l3")+"_"+(*it_h).first+str,";#bf{l3 #eta};", 25,-2.5,2.5); (*((*it_h).second))["eta_l3"]->Sumw2();
323
324 (*((*it_h).second))["ip3ds_l1"] = new TH1D(TString("ip3ds_l1") +"_"+(*it_h).first+str,";#bf{ip3ds l1};",30,0,10); (*((*it_h).second))["ip3ds_l1"]->Sumw2();
325 (*((*it_h).second))["ip3ds_l2"] = new TH1D(TString("ip3ds_l2") +"_"+(*it_h).first+str,";#bf{ip3ds l2};",30,0,10); (*((*it_h).second))["ip3ds_l2"]->Sumw2();
326 (*((*it_h).second))["ip3ds_l3"] = new TH1D(TString("ip3ds_l3") +"_"+(*it_h).first+str,";#bf{ip3ds l3};",30,0,8); (*((*it_h).second))["ip3ds_l3"]->Sumw2();
327
328 (*((*it_h).second))["dR_l1l3_lo"] = new TH1D(TString("dR_l1l3_lo") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,.2); (*((*it_h).second))["dR_l1l3_lo"]->Sumw2();
329 (*((*it_h).second))["dR_l1l3"] = new TH1D(TString("dR_l1l3") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,6); (*((*it_h).second))["dR_l1l3"]->Sumw2();
330 (*((*it_h).second))["dR_l2l3_lo"] = new TH1D(TString("dR_l2l3_lo") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,.2); (*((*it_h).second))["dR_l2l3_lo"]->Sumw2();
331 (*((*it_h).second))["dR_l2l3"] = new TH1D(TString("dR_l2l3") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,6); (*((*it_h).second))["dR_l2l3"]->Sumw2();
332
333 (*((*it_h).second))["ml1l3"] = new TH1D(TString("ml1l3") +"_"+(*it_h).first+str,";#bf{m_{l1l3} [GeV]};",50,0,120); (*((*it_h).second))["ml1l3"]->Sumw2();
334 (*((*it_h).second))["ml2l3"] = new TH1D(TString("ml2l3") +"_"+(*it_h).first+str,";#bf{m_{l2l3} [GeV]};",50,0,120); (*((*it_h).second))["ml2l3"]->Sumw2();
335
336 (*((*it_h).second))["met"] = new TH1D(TString("met") +"_"+(*it_h).first+str,";#bf{m_{l2l3} [GeV]};",50,0,50); (*((*it_h).second))["met"]->Sumw2();
337 }
338
339 return hists;
340 }
341 //--------------------------------------------------------------------------------------------------
342 void makeHTML(FOFlags &ctrl, TString type, TString plotLabel)
343 {
344 TString title("Z Plus Fake: "+type);
345 ofstream htmlfile;
346 char htmlfname[100];
347 sprintf(htmlfname,"%s/plots.html",TString(ctrl.outdir+"/"+plotLabel+"/"+type).Data());
348 htmlfile.open(htmlfname);
349
350 htmlfile << "<!DOCTYPE html" << endl;
351 htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
352 htmlfile << "<html>" << endl;
353
354 htmlfile << "<head><title>"+title+"</title></head>" << endl;
355 htmlfile << "<body bgcolor=\"EEEEEE\">" << endl;
356 htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
357
358 htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
359 htmlfile << "<tr>" << endl;
360 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/mZ1.png\"><img src=\"plots/mZ1.png\" alt=\"plots/mZ1.png\" width=\"100%\"></a></td>" << endl;
361 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Z1pt.png\"><img src=\"plots/Z1pt.png\" alt=\"plots/Z1pt.png\" width=\"100%\"></a></td>" << endl;
362 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/run.png\"><img src=\"plots/run.png\" alt=\"plots/run.png\" width=\"100%\"></a></td>" << endl;
363 htmlfile << "</tr>" << endl;
364
365 htmlfile << "<tr>" << endl;
366 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l1.png\"><img src=\"plots/ip3ds_l1.png\" alt=\"plots/ip3ds_l1.png\" width=\"100%\"></a></td>" << endl;
367 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l2.png\"><img src=\"plots/ip3ds_l2.png\" alt=\"plots/ip3ds_l2.png\" width=\"100%\"></a></td>" << endl;
368 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l3.png\"><img src=\"plots/ip3ds_l3.png\" alt=\"plots/ip3ds_l3.png\" width=\"100%\"></a></td>" << endl;
369 htmlfile << "</tr>" << endl;
370
371 htmlfile << "<tr>" << endl;
372 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_l1.png\"><img src=\"plots/pt_l1.png\" alt=\"plots/pt_l1.png\" width=\"100%\"></a></td>" << endl;
373 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_l2.png\"><img src=\"plots/pt_l2.png\" alt=\"plots/pt_l2.png\" width=\"100%\"></a></td>" << endl;
374 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_l3_lo.png\"><img src=\"plots/pt_l3_lo.png\" alt=\"plots/pt_l3_lo.png\" width=\"100%\"></a></td>" << endl;
375 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_l3.png\"><img src=\"plots/pt_l3.png\" alt=\"plots/pt_l3.png\" width=\"100%\"></a></td>" << endl;
376 htmlfile << "</tr>" << endl;
377
378 htmlfile << "<tr>" << endl;
379 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_l1.png\"><img src=\"plots/eta_l1.png\" alt=\"plots/eta_l1.png\" width=\"100%\"></a></td>" << endl;
380 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_l2.png\"><img src=\"plots/eta_l2.png\" alt=\"plots/eta_l2.png\" width=\"100%\"></a></td>" << endl;
381 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_l3.png\"><img src=\"plots/eta_l3.png\" alt=\"plots/eta_l3.png\" width=\"100%\"></a></td>" << endl;
382 htmlfile << "</tr>" << endl;
383
384 htmlfile << "<tr>" << endl;
385 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1l3_lo.png\"><img src=\"plots/dR_l1l3_lo.png\" alt=\"plots/dR_l1l3_lo.png\" width=\"100%\"></a></td>" << endl;
386 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1l3.png\"><img src=\"plots/dR_l1l3.png\" alt=\"plots/dR_l1l3.png\" width=\"100%\"></a></td>" << endl;
387 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2l3_lo.png\"><img src=\"plots/dR_l2l3_lo.png\" alt=\"plots/dR_l2l3_lo.png\" width=\"100%\"></a></td>" << endl;
388 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2l3.png\"><img src=\"plots/dR_l2l3.png\" alt=\"plots/dR_l2l3.png\" width=\"100%\"></a></td>" << endl;
389 // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
390 htmlfile << "</tr>" << endl;
391
392 htmlfile << "<tr>" << endl;
393 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ml1l3.png\"><img src=\"plots/ml1l3.png\" alt=\"plots/ml1l3.png\" width=\"100%\"></a></td>" << endl;
394 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ml2l3.png\"><img src=\"plots/ml2l3.png\" alt=\"plots/ml2l3.png\" width=\"100%\"></a></td>" << endl;
395 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/met.png\"><img src=\"plots/met.png\" alt=\"plots/met.png\" width=\"100%\"></a></td>" << endl;
396 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
397 htmlfile << "</tr>" << endl;
398
399 htmlfile << "</table>" << endl;
400
401 htmlfile << "<hr />" << endl;
402
403 htmlfile << "<hr />" << endl;
404
405 htmlfile << "</body>" << endl;
406 htmlfile << "</html>" << endl;
407 htmlfile.close();
408 }
409 //----------------------------------------------------------------------------------------
410 void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo, double wgt_hi)
411 {
412 (*(cs->hists)["both_"+type])[var]->Fill( val, wgt);
413 (*(cs->hists)[channel+"_"+type])[var]->Fill( val, wgt);
414 if(type=="pred") {
415 (*(cs->hists)["both_"+type+"_lo"])[var]->Fill( val, wgt_lo);
416 (*(cs->hists)["both_"+type+"_hi"])[var]->Fill( val, wgt_hi);
417 (*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill( val, wgt_lo);
418 (*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill( val, wgt_hi);
419 }
420 }