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 "TCanvas.h"
|
22 |
#include "TChain.h"
|
23 |
#include "TString.h"
|
24 |
#include "TStyle.h"
|
25 |
#include "TH1D.h"
|
26 |
|
27 |
#include "CPlot.h"
|
28 |
#include "FOArgs.h"
|
29 |
|
30 |
#include "fake_defs.h"
|
31 |
#include "Various.h"
|
32 |
#include "CommonDefs.h"
|
33 |
#include "PlotHeaders.h"
|
34 |
|
35 |
#ifndef CMSSW_BASE
|
36 |
#define CMSSW_BASE "../../"
|
37 |
#endif
|
38 |
|
39 |
using namespace std;
|
40 |
using namespace RooFit;
|
41 |
using namespace mithep;
|
42 |
|
43 |
TCanvas *can;
|
44 |
|
45 |
void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo=0, double wgt_hi=0);
|
46 |
void makeHTML(FOFlags &ctrl, TString type, TString plotLabel);
|
47 |
map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str="");
|
48 |
TString f_to_a(double val) { stringstream ss; ss << fixed << setprecision(2) << val; return TString(ss.str().c_str()); }
|
49 |
|
50 |
//----------------------------------------------------------------------------------------
|
51 |
int main(int argc, char** argv)
|
52 |
{
|
53 |
double lumi = 5000;//10093;
|
54 |
|
55 |
FOFlags ctrl;
|
56 |
parse_foargs( argc, argv, ctrl );
|
57 |
ctrl.dump();
|
58 |
|
59 |
can = new TCanvas("can","can");
|
60 |
|
61 |
FR_struct fr2011 = initFRs(ctrl.mufakefile2011,ctrl.elefakefile2011);
|
62 |
FR_struct fr2012 = initFRs(ctrl.mufakefile2012,ctrl.elefakefile2012);
|
63 |
|
64 |
TString cmsswpath(CMSSW_BASE + TString("/src"));
|
65 |
string xspath = (string(cmsswpath)+"/MitPhysics/data/xs.dat");
|
66 |
SimpleTable xstab(xspath.c_str());
|
67 |
|
68 |
vector<CSample*> samplev;
|
69 |
TString ntupledir(""),label(""),plotLabel(""),jsonFile("");
|
70 |
readConfigFile(ctrl.config, ntupledir, label, plotLabel, jsonFile, samplev, &ctrl, init_hists);
|
71 |
|
72 |
vector<pair<unsigned,unsigned> > runEvtv; // vector to veto duplicate events
|
73 |
UInt_t minRun=999999999,maxRun=0;
|
74 |
for(unsigned ics=0; ics<samplev.size(); ics++) {
|
75 |
CSample *cs = samplev[ics];
|
76 |
cout << cs->name << endl;
|
77 |
for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
|
78 |
filestuff *fs = (cs->fsv)[ifs];
|
79 |
cout << "\t" << fs->fname_ << endl;
|
80 |
FR_struct *fr = (fs->era_==2011) ? &fr2011 : &fr2012;
|
81 |
unsigned nDuplSkipped=0;
|
82 |
for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
|
83 |
fs->getentry(ientry,"","FOtree");
|
84 |
fs->getentry(ientry,"info","zznt");
|
85 |
|
86 |
if(fs->isdata_) {
|
87 |
setMinMaxRun(fs->info->run, minRun, maxRun);
|
88 |
bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, runEvtv, nDuplSkipped);
|
89 |
if(dupl) continue;
|
90 |
pair<unsigned,unsigned> rl(fs->info->run, fs->info->lumi);
|
91 |
if(!fs->rlrm_.HasRunLumi(rl)) continue;
|
92 |
}
|
93 |
|
94 |
double wgt=1;
|
95 |
if(!fs->isdata_) {
|
96 |
double xsWgt = lumi*xstab.Get(fs->dataset_)/fs->total_entries_;
|
97 |
// double puWgt = weightTrue2012(fs->info->npu);
|
98 |
wgt = xsWgt;//*puWgt;
|
99 |
}
|
100 |
|
101 |
unsigned npass = fs->passingL->size();
|
102 |
unsigned nfail = fs->failingL->size();
|
103 |
|
104 |
pair<int,int> best_z_indices;
|
105 |
findZ1(fs->passingL,best_z_indices,40);
|
106 |
EventData evtdata;
|
107 |
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
|
108 |
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
|
109 |
|
110 |
// Look for a z2
|
111 |
vector<pair<SimpleLepton,SimpleLepton> > z2cands;
|
112 |
vector<TString> types;
|
113 |
findZ2Candidates(fs->failingL, z2cands, types, true);
|
114 |
|
115 |
for(unsigned iz2=0; iz2<z2cands.size(); iz2++) {
|
116 |
SimpleLepton lep1 = evtdata.Z1leptons[0];
|
117 |
SimpleLepton lep2 = evtdata.Z1leptons[1];
|
118 |
SimpleLepton lep3 = z2cands[iz2].first;
|
119 |
SimpleLepton lep4 = z2cands[iz2].second;
|
120 |
|
121 |
TString channel = getChannel(lep1,lep2,lep3,lep4);
|
122 |
evtdata.Z2leptons.clear();
|
123 |
evtdata.Z2leptons.push_back(lep3);
|
124 |
evtdata.Z2leptons.push_back(lep4);
|
125 |
KinematicsStruct kine;
|
126 |
fillKinematics(evtdata,kine);
|
127 |
|
128 |
if(fabs(lep3.ip3dSig) >= 4 || fabs(lep4.ip3dSig) >= 4) continue; // |sip| < 4 is applied in ZPlusX to lep1, lep2
|
129 |
if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4)) continue;
|
130 |
if(!leptonDrReqs(lep1,lep2,lep3,lep4)) continue;
|
131 |
if(!resonanceKilling(lep1,lep2,lep3,lep4)) continue;
|
132 |
if(kine.m4l < 100) continue;
|
133 |
|
134 |
if(types[iz2]=="pass") {
|
135 |
fillHist( cs, channel, "obs", "run" , fs->info->run , wgt);
|
136 |
fillHist( cs, channel, "obs", "mZ1" , kine.mZ1 , wgt);
|
137 |
fillHist( cs, channel, "obs", "mZ2" , kine.mZ2 , wgt);
|
138 |
fillHist( cs, channel, "obs", "mZ2_lo" , kine.mZ2 , wgt);
|
139 |
fillHist( cs, channel, "obs", "m4l" , kine.m4l , wgt);
|
140 |
fillHist( cs, channel, "obs", "Z1pt" , kine.Z1pt , wgt);
|
141 |
fillHist( cs, channel, "obs", "ZZpt" , kine.ZZpt , wgt);
|
142 |
fillHist( cs, channel, "obs", "ip3ds_l1" , lep1.ip3dSig , wgt);
|
143 |
fillHist( cs, channel, "obs", "ip3ds_l2" , lep2.ip3dSig , wgt);
|
144 |
fillHist( cs, channel, "obs", "ip3ds_l3" , lep3.ip3dSig , wgt);
|
145 |
fillHist( cs, channel, "obs", "ip3ds_l4" , lep4.ip3dSig , wgt);
|
146 |
fillHist( cs, channel, "obs", "pt_l1" , lep1.vec.Pt() , wgt);
|
147 |
fillHist( cs, channel, "obs", "pt_l2" , lep2.vec.Pt() , wgt);
|
148 |
fillHist( cs, channel, "obs", "pt_l3" , lep3.vec.Pt() , wgt);
|
149 |
fillHist( cs, channel, "obs", "pt_l4" , lep4.vec.Pt() , wgt);
|
150 |
fillHist( cs, channel, "obs", "eta_l1" , lep1.vec.Eta() , wgt);
|
151 |
fillHist( cs, channel, "obs", "eta_l2" , lep2.vec.Eta() , wgt);
|
152 |
fillHist( cs, channel, "obs", "eta_l3" , lep3.vec.Eta() , wgt);
|
153 |
fillHist( cs, channel, "obs", "eta_l4" , lep4.vec.Eta() , wgt);
|
154 |
fillHist( cs, channel, "obs", "dR_l3l4_lo",dr(lep3,lep4), wgt);
|
155 |
fillHist( cs, channel, "obs", "dR_l3l4", dr(lep3,lep4), wgt);
|
156 |
} else if(types[iz2]=="fail") {
|
157 |
double fwgt_1 = get_fake_weight("",lep3,*fr);
|
158 |
double fwgt_lo_1 = get_fake_weight("lo",lep3,*fr);
|
159 |
double fwgt_hi_1 = get_fake_weight("hi",lep3,*fr);
|
160 |
double fwgt_2 = get_fake_weight("",lep4,*fr);
|
161 |
double fwgt_lo_2 = get_fake_weight("lo",lep4,*fr);
|
162 |
double fwgt_hi_2 = get_fake_weight("hi",lep4,*fr);
|
163 |
|
164 |
double centr = wgt*fwgt_1*fwgt_2;
|
165 |
double lo = wgt*fwgt_lo_1*fwgt_lo_2;
|
166 |
double hi = wgt*fwgt_hi_1*fwgt_hi_2;
|
167 |
fillHist( cs, channel, "pred", "run", fs->info->run, centr, lo, hi);
|
168 |
fillHist( cs, channel, "pred", "mZ1", kine.mZ1, centr, lo, hi);
|
169 |
fillHist( cs, channel, "pred", "mZ2", kine.mZ2, centr, lo, hi);
|
170 |
fillHist( cs, channel, "pred", "mZ2_lo", kine.mZ2, centr, lo, hi);
|
171 |
fillHist( cs, channel, "pred", "m4l", kine.m4l, centr, lo, hi);
|
172 |
fillHist( cs, channel, "pred", "Z1pt", kine.Z1pt, centr, lo, hi);
|
173 |
fillHist( cs, channel, "pred", "ZZpt", kine.ZZpt, centr, lo, hi);
|
174 |
fillHist( cs, channel, "pred", "ip3ds_l1", lep1.ip3dSig, centr, lo, hi);
|
175 |
fillHist( cs, channel, "pred", "ip3ds_l2", lep2.ip3dSig, centr, lo, hi);
|
176 |
fillHist( cs, channel, "pred", "ip3ds_l3", lep3.ip3dSig, centr, lo, hi);
|
177 |
fillHist( cs, channel, "pred", "ip3ds_l4", lep4.ip3dSig, centr, lo, hi);
|
178 |
fillHist( cs, channel, "pred", "pt_l1", lep1.vec.Pt(), centr, lo, hi);
|
179 |
fillHist( cs, channel, "pred", "pt_l2", lep2.vec.Pt(), centr, lo, hi);
|
180 |
fillHist( cs, channel, "pred", "pt_l3", lep3.vec.Pt(), centr, lo, hi);
|
181 |
fillHist( cs, channel, "pred", "pt_l4", lep4.vec.Pt(), centr, lo, hi);
|
182 |
fillHist( cs, channel, "pred", "eta_l1", lep1.vec.Eta(), centr, lo, hi);
|
183 |
fillHist( cs, channel, "pred", "eta_l2", lep2.vec.Eta(), centr, lo, hi);
|
184 |
fillHist( cs, channel, "pred", "eta_l3", lep3.vec.Eta(), centr, lo, hi);
|
185 |
fillHist( cs, channel, "pred", "eta_l4", lep4.vec.Eta(), centr, lo, hi);
|
186 |
fillHist( cs, channel, "pred", "dR_l3l4_lo",dr(lep3,lep4), centr, lo, hi);
|
187 |
fillHist( cs, channel, "pred", "dR_l3l4", dr(lep3,lep4), centr, lo, hi);
|
188 |
} else assert(0);
|
189 |
}
|
190 |
}
|
191 |
cout << "\t\tWARNING: skipped " << nDuplSkipped << " duplicate events" << endl;
|
192 |
}
|
193 |
}
|
194 |
cout << "run range: " << setw(12) << minRun << setw(12) << maxRun << endl;
|
195 |
assert(samplev.size()>0);
|
196 |
vector<TString> typev;
|
197 |
typev.push_back("all");
|
198 |
typev.push_back("4e");
|
199 |
typev.push_back("4m");
|
200 |
typev.push_back("2e2m");
|
201 |
for(unsigned itype=0; itype<typev.size(); itype++) {
|
202 |
TString type(typev[itype]);
|
203 |
gSystem->mkdir(ctrl.outdir+"/"+plotLabel+"/"+type,true);
|
204 |
TFile runHistFile(ctrl.outdir+"/"+plotLabel+"/"+type+"/runs.root","recreate");
|
205 |
map<TString,TH1D*>::iterator it_v;
|
206 |
for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
|
207 |
TString var((*it_v).first);
|
208 |
CPlot cplot(var,"",(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),"events",ctrl.outdir+"/"+plotLabel+"/"+type+"/plots");
|
209 |
double ymax=0;
|
210 |
for(unsigned isam=0; isam<samplev.size(); isam++) {
|
211 |
CSample *cs = samplev[isam];
|
212 |
TH1D *hObs = (*(cs->hists)[type+"_obs"])[var];
|
213 |
TH1D *hPred = (*(cs->hists)[type+"_pred"])[var];
|
214 |
TH1D *hPred_lo = (*(cs->hists)[type+"_pred_lo"])[var];
|
215 |
TH1D *hPred_hi = (*(cs->hists)[type+"_pred_hi"])[var];
|
216 |
|
217 |
if(cs->isdata) {
|
218 |
double ratio = integrateHist(hObs) / integrateHist(hPred);
|
219 |
cplot.AddHist1D(hObs,cs->legend+": "+integral_str(hObs,0)+", ratio: "+f_to_a(ratio),"E");
|
220 |
cplot.AddHist1D(hPred,"FR predic: "+integral_str(hPred,2),"hist",kRed);
|
221 |
cplot.AddHist1D(hPred_lo,"stat lo: "+integral_str(hPred_lo,2),"hist",kRed,kDashed);
|
222 |
cplot.AddHist1D(hPred_hi,"stat hi: "+integral_str(hPred_hi,2),"hist",kRed,kDashed);
|
223 |
ymax = max(ymax,histMax(hObs,hPred,hPred_lo,hPred_hi));
|
224 |
} else {
|
225 |
cplot.AddToStack(hPred,cs->legend+" pred.: "+integral_str(hPred,2),cs->color);
|
226 |
ymax = max(ymax,hPred->GetMaximum());
|
227 |
// cplot.AddHist1D(hObs,cs->legend+": "+integral_str(hObs),"Ehist",kBlue);//cs->color);
|
228 |
}
|
229 |
if(cs->isdata && var=="run") {
|
230 |
assert(hObs->GetBinContent(0)==0 && hObs->GetBinContent(hObs->GetXaxis()->GetNbins()+1)==0);
|
231 |
hObs->Write("runs");
|
232 |
}
|
233 |
if(var.Contains("ip3d")) {
|
234 |
double maxVal = max(hObs->GetMaximum(), hPred->GetMaximum());
|
235 |
double isoMin = 0.0005*maxVal;
|
236 |
double isoMax = 1.8*maxVal;
|
237 |
cplot.SetYRange(isoMin,isoMax);
|
238 |
// cplot.SetLogy();
|
239 |
} else {
|
240 |
cplot.SetYRange(0,1.2*ymax);
|
241 |
}
|
242 |
}
|
243 |
cplot.Draw(can,true,"png");
|
244 |
}
|
245 |
runHistFile.Close();
|
246 |
makeHTML(ctrl,type,plotLabel);
|
247 |
}
|
248 |
}
|
249 |
//----------------------------------------------------------------------------------------
|
250 |
map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str)
|
251 |
{
|
252 |
map<TString,map<TString,TH1D*>* > hists;
|
253 |
map<TString,TH1D*> *h_4e_obs = new map<TString,TH1D*>; hists["4e_obs"] = h_4e_obs;
|
254 |
map<TString,TH1D*> *h_4e_pred = new map<TString,TH1D*>; hists["4e_pred"] = h_4e_pred;
|
255 |
map<TString,TH1D*> *h_4e_pred_lo = new map<TString,TH1D*>; hists["4e_pred_lo"] = h_4e_pred_lo;
|
256 |
map<TString,TH1D*> *h_4e_pred_hi = new map<TString,TH1D*>; hists["4e_pred_hi"] = h_4e_pred_hi;
|
257 |
map<TString,TH1D*> *h_4m_obs = new map<TString,TH1D*>; hists["4m_obs"] = h_4m_obs;
|
258 |
map<TString,TH1D*> *h_4m_pred = new map<TString,TH1D*>; hists["4m_pred"] = h_4m_pred;
|
259 |
map<TString,TH1D*> *h_4m_pred_lo = new map<TString,TH1D*>; hists["4m_pred_lo"] = h_4m_pred_lo;
|
260 |
map<TString,TH1D*> *h_4m_pred_hi = new map<TString,TH1D*>; hists["4m_pred_hi"] = h_4m_pred_hi;
|
261 |
map<TString,TH1D*> *h_2e2m_obs = new map<TString,TH1D*>; hists["2e2m_obs"] = h_2e2m_obs;
|
262 |
map<TString,TH1D*> *h_2e2m_pred = new map<TString,TH1D*>; hists["2e2m_pred"] = h_2e2m_pred;
|
263 |
map<TString,TH1D*> *h_2e2m_pred_lo = new map<TString,TH1D*>; hists["2e2m_pred_lo"] = h_2e2m_pred_lo;
|
264 |
map<TString,TH1D*> *h_2e2m_pred_hi = new map<TString,TH1D*>; hists["2e2m_pred_hi"] = h_2e2m_pred_hi;
|
265 |
map<TString,TH1D*> *h_all_obs = new map<TString,TH1D*>; hists["all_obs"] = h_all_obs;
|
266 |
map<TString,TH1D*> *h_all_pred = new map<TString,TH1D*>; hists["all_pred"] = h_all_pred;
|
267 |
map<TString,TH1D*> *h_all_pred_lo = new map<TString,TH1D*>; hists["all_pred_lo"] = h_all_pred_lo;
|
268 |
map<TString,TH1D*> *h_all_pred_hi = new map<TString,TH1D*>; hists["all_pred_hi"] = h_all_pred_hi;
|
269 |
map<TString,map<TString,TH1D*>* >::iterator it_h;
|
270 |
|
271 |
for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
|
272 |
(*((*it_h).second))["run"] = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};", 50,160800,196535); (*((*it_h).second))["run"]->Sumw2();
|
273 |
(*((*it_h).second))["mZ1"] = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};", 20,60,120); (*((*it_h).second))["mZ1"]->Sumw2();
|
274 |
(*((*it_h).second))["mZ2"] = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};", 30,0,115); (*((*it_h).second))["mZ2"]->Sumw2();
|
275 |
(*((*it_h).second))["mZ2_lo"] = new TH1D(TString("mZ2_lo") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};", 30,0,10); (*((*it_h).second))["mZ2_lo"]->Sumw2();
|
276 |
(*((*it_h).second))["m4l"] = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 20,50,500); (*((*it_h).second))["m4l"]->Sumw2();
|
277 |
(*((*it_h).second))["Z1pt"] = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};", 20,0,200); (*((*it_h).second))["Z1pt"]->Sumw2();
|
278 |
(*((*it_h).second))["ZZpt"] = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};", 30,0,200); (*((*it_h).second))["ZZpt"]->Sumw2();
|
279 |
|
280 |
(*((*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();
|
281 |
(*((*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();
|
282 |
(*((*it_h).second))["pt_l3"] = new TH1D(TString("pt_l3") +"_"+(*it_h).first+str,";#bf{l3 p_{T} [GeV]};", 37,0,75); (*((*it_h).second))["pt_l3"]->Sumw2();
|
283 |
(*((*it_h).second))["pt_l4"] = new TH1D(TString("pt_l4") +"_"+(*it_h).first+str,";#bf{l4 p_{T} [GeV]};", 37,0,50); (*((*it_h).second))["pt_l4"]->Sumw2();
|
284 |
|
285 |
(*((*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();
|
286 |
(*((*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();
|
287 |
(*((*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();
|
288 |
(*((*it_h).second))["eta_l4"] = new TH1D(TString("eta_l4")+"_"+(*it_h).first+str,";#bf{l4 #eta};", 25,-2.5,2.5); (*((*it_h).second))["eta_l4"]->Sumw2();
|
289 |
|
290 |
(*((*it_h).second))["ip3ds_l1"] = new TH1D(TString("ip3ds_l1") +"_"+(*it_h).first+str,";#bf{ip3ds l1};",30,-5,5); (*((*it_h).second))["ip3ds_l1"]->Sumw2();
|
291 |
(*((*it_h).second))["ip3ds_l2"] = new TH1D(TString("ip3ds_l2") +"_"+(*it_h).first+str,";#bf{ip3ds l2};",30,-5,5); (*((*it_h).second))["ip3ds_l2"]->Sumw2();
|
292 |
(*((*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();
|
293 |
(*((*it_h).second))["ip3ds_l4"] = new TH1D(TString("ip3ds_l4") +"_"+(*it_h).first+str,";#bf{ip3ds l4};",30,-10,10); (*((*it_h).second))["ip3ds_l4"]->Sumw2();
|
294 |
|
295 |
(*((*it_h).second))["dR_l3l4_lo"] = new TH1D(TString("dR_l3l4_lo") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,.2); (*((*it_h).second))["dR_l3l4_lo"]->Sumw2();
|
296 |
(*((*it_h).second))["dR_l3l4"] = new TH1D(TString("dR_l3l4") +"_"+(*it_h).first+str,";#bf{#Delta R l3,l4};",75,0,6); (*((*it_h).second))["dR_l3l4"]->Sumw2();
|
297 |
}
|
298 |
|
299 |
return hists;
|
300 |
}
|
301 |
//--------------------------------------------------------------------------------------------------
|
302 |
void makeHTML(FOFlags &ctrl, TString type, TString plotLabel)
|
303 |
{
|
304 |
TString title("Signal region: "+type);
|
305 |
ofstream htmlfile;
|
306 |
char htmlfname[100];
|
307 |
sprintf(htmlfname,"%s/plots.html",TString(ctrl.outdir+"/"+plotLabel+"/"+type).Data());
|
308 |
htmlfile.open(htmlfname);
|
309 |
|
310 |
htmlfile << "<!DOCTYPE html" << endl;
|
311 |
htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
|
312 |
htmlfile << "<html>" << endl;
|
313 |
|
314 |
htmlfile << "<head><title>"+title+"</title></head>" << endl;
|
315 |
htmlfile << "<body bgcolor=\"EEEEEE\">" << endl;
|
316 |
htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
|
317 |
|
318 |
htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
|
319 |
|
320 |
htmlfile << "<tr>" << endl;
|
321 |
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;
|
322 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/mZ2_lo.png\"><img src=\"plots/mZ2_lo.png\" alt=\"plots/mZ2_lo.png\" width=\"100%\"></a></td>" << endl;
|
323 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/mZ2.png\"><img src=\"plots/mZ2.png\" alt=\"plots/mZ2.png\" width=\"100%\"></a></td>" << endl;
|
324 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/m4l.png\"><img src=\"plots/m4l.png\" alt=\"plots/m4l.png\" width=\"100%\"></a></td>" << endl;
|
325 |
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
326 |
htmlfile << "</tr>" << endl;
|
327 |
|
328 |
htmlfile << "<tr>" << endl;
|
329 |
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;
|
330 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ZZpt.png\"><img src=\"plots/ZZpt.png\" alt=\"plots/ZZpt.png\" width=\"100%\"></a></td>" << endl;
|
331 |
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
332 |
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
333 |
htmlfile << "</tr>" << endl;
|
334 |
|
335 |
htmlfile << "<tr>" << endl;
|
336 |
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;
|
337 |
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;
|
338 |
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;
|
339 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l4.png\"><img src=\"plots/ip3ds_l4.png\" alt=\"plots/ip3ds_l4.png\" width=\"100%\"></a></td>" << endl;
|
340 |
htmlfile << "</tr>" << endl;
|
341 |
|
342 |
htmlfile << "<tr>" << endl;
|
343 |
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;
|
344 |
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;
|
345 |
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;
|
346 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_l4.png\"><img src=\"plots/pt_l4.png\" alt=\"plots/pt_l4.png\" width=\"100%\"></a></td>" << endl;
|
347 |
htmlfile << "</tr>" << endl;
|
348 |
|
349 |
htmlfile << "<tr>" << endl;
|
350 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3l4_lo.png\"><img src=\"plots/dR_l3l4_lo.png\" alt=\"plots/dR_l3l4_lo.png\" width=\"100%\"></a></td>" << endl;
|
351 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3l4.png\"><img src=\"plots/dR_l3l4.png\" alt=\"plots/dR_l3l4.png\" width=\"100%\"></a></td>" << endl;
|
352 |
htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
|
353 |
htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
|
354 |
htmlfile << "</tr>" << endl;
|
355 |
|
356 |
htmlfile << "<tr>" << endl;
|
357 |
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;
|
358 |
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;
|
359 |
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;
|
360 |
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_l4.png\"><img src=\"plots/eta_l4.png\" alt=\"plots/eta_l4.png\" width=\"100%\"></a></td>" << endl;
|
361 |
htmlfile << "</tr>" << endl;
|
362 |
htmlfile << "</table>" << endl;
|
363 |
|
364 |
htmlfile << "<hr />" << endl;
|
365 |
|
366 |
htmlfile << "<hr />" << endl;
|
367 |
|
368 |
htmlfile << "</body>" << endl;
|
369 |
htmlfile << "</html>" << endl;
|
370 |
htmlfile.close();
|
371 |
}
|
372 |
//----------------------------------------------------------------------------------------
|
373 |
void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo, double wgt_hi)
|
374 |
{
|
375 |
// // name = channel+"_"+type;
|
376 |
// // name = "all_"+type+"_lo";
|
377 |
// // name = "all_"+type+"_hi";
|
378 |
// // name = channel+"_"+type+"_lo";
|
379 |
// // name = channel+"_"+type+"_hi";
|
380 |
|
381 |
// cout << endl << "all_"+type;
|
382 |
// (*(cs->hists)["all_"+type])[var]->Fill( val, wgt);
|
383 |
// if(channel!="") {
|
384 |
// cout << endl << channel+"_"+type;
|
385 |
// (*(cs->hists)[channel+"_"+type])[var]->Fill( val, wgt);
|
386 |
// }
|
387 |
// if(type=="pred") {
|
388 |
// cout << endl << "all_"+type+"_lo";
|
389 |
// (*(cs->hists)["all_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
390 |
// cout << endl << "all_"+type+"_hi";
|
391 |
// (*(cs->hists)["all_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
392 |
// if(channel!="") {
|
393 |
// cout << endl << channel+"_"+type+"_lo";
|
394 |
// (*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
395 |
// cout << endl << channel+"_"+type+"_hi" << endl;
|
396 |
// (*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
397 |
// }
|
398 |
// }
|
399 |
(*(cs->hists)["all_"+type])[var]->Fill( val, wgt);
|
400 |
if(channel!="")
|
401 |
(*(cs->hists)[channel+"_"+type])[var]->Fill( val, wgt);
|
402 |
if(type=="pred") {
|
403 |
(*(cs->hists)["all_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
404 |
(*(cs->hists)["all_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
405 |
if(channel!="") {
|
406 |
(*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
407 |
(*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
408 |
}
|
409 |
}
|
410 |
}
|