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