1 |
dkralph |
1.1 |
#include <iostream>
|
2 |
|
|
#include <algorithm>
|
3 |
|
|
#include <iomanip>
|
4 |
|
|
// #include <pair.h>
|
5 |
|
|
|
6 |
|
|
#include "TCanvas.h"
|
7 |
|
|
#include "TChain.h"
|
8 |
|
|
#include "TString.h"
|
9 |
|
|
#include "TStyle.h"
|
10 |
|
|
#include "TH1D.h"
|
11 |
dkralph |
1.3 |
#include "TNtuple.h"
|
12 |
dkralph |
1.1 |
|
13 |
|
|
#include "CPlot.h"
|
14 |
|
|
#include "FOArgs.h"
|
15 |
|
|
|
16 |
|
|
#include "fake_defs.h"
|
17 |
|
|
#include "Various.h"
|
18 |
|
|
#include "CommonDefs.h"
|
19 |
|
|
#include "PlotHeaders.h"
|
20 |
dkralph |
1.3 |
#include "TriggerUtils.h"
|
21 |
|
|
#include "JetDefs.h"
|
22 |
|
|
#include "JetInfoStruct.h"
|
23 |
|
|
|
24 |
|
|
#include "TMVA/Reader.h"
|
25 |
|
|
#include "TMVA/Tools.h"
|
26 |
|
|
#include "TMVA/Config.h"
|
27 |
|
|
#include "TMVA/MethodBDT.h"
|
28 |
dkralph |
1.1 |
|
29 |
|
|
#ifndef CMSSW_BASE
|
30 |
|
|
#define CMSSW_BASE "../../"
|
31 |
|
|
#endif
|
32 |
|
|
|
33 |
|
|
using namespace std;
|
34 |
|
|
using namespace RooFit;
|
35 |
|
|
using namespace mithep;
|
36 |
|
|
|
37 |
|
|
TCanvas *can;
|
38 |
|
|
|
39 |
dkralph |
1.3 |
class dr_struct
|
40 |
|
|
{
|
41 |
|
|
public:
|
42 |
|
|
dr_struct();
|
43 |
|
|
void check();
|
44 |
|
|
float l1j1,l2j1,l3j1,l4j1;
|
45 |
|
|
float l1j2,l2j2,l3j2,l4j2;
|
46 |
|
|
float l1j3,l2j3,l3j3,l4j3;
|
47 |
|
|
float l1j4,l2j4,l3j4,l4j4;
|
48 |
|
|
};
|
49 |
|
|
dr_struct::dr_struct()
|
50 |
|
|
{
|
51 |
|
|
l1j1 = l2j1 = l3j1 = l4j1 = l1j2 = l2j2 = l3j2 = l4j2 = l1j3 = l2j3 = l3j3 = l4j3 = l1j4 = l2j4 = l3j4 = l4j4 = -1;
|
52 |
|
|
}
|
53 |
|
|
void dr_struct::check()
|
54 |
|
|
{
|
55 |
|
|
if(fabs(l1j1) < 0.2) { cout << "l1j1 too small: " << l1j1 << endl; }
|
56 |
|
|
if(fabs(l2j1) < 0.2) { cout << "l2j1 too small: " << l2j1 << endl; }
|
57 |
|
|
if(fabs(l3j1) < 0.2) { cout << "l3j1 too small: " << l3j1 << endl; }
|
58 |
|
|
if(fabs(l4j1) < 0.2) { cout << "l4j1 too small: " << l4j1 << endl; }
|
59 |
|
|
if(fabs(l1j2) < 0.2) { cout << "l1j2 too small: " << l1j2 << endl; }
|
60 |
|
|
if(fabs(l2j2) < 0.2) { cout << "l2j2 too small: " << l2j2 << endl; }
|
61 |
|
|
if(fabs(l3j2) < 0.2) { cout << "l3j2 too small: " << l3j2 << endl; }
|
62 |
|
|
if(fabs(l4j2) < 0.2) { cout << "l4j2 too small: " << l4j2 << endl; }
|
63 |
|
|
if(fabs(l1j3) < 0.2) { cout << "l1j3 too small: " << l1j3 << endl; }
|
64 |
|
|
if(fabs(l2j3) < 0.2) { cout << "l2j3 too small: " << l2j3 << endl; }
|
65 |
|
|
if(fabs(l3j3) < 0.2) { cout << "l3j3 too small: " << l3j3 << endl; }
|
66 |
|
|
if(fabs(l4j3) < 0.2) { cout << "l4j3 too small: " << l4j3 << endl; }
|
67 |
|
|
if(fabs(l1j4) < 0.2) { cout << "l1j4 too small: " << l1j4 << endl; }
|
68 |
|
|
if(fabs(l2j4) < 0.2) { cout << "l2j4 too small: " << l2j4 << endl; }
|
69 |
|
|
if(fabs(l3j4) < 0.2) { cout << "l3j4 too small: " << l3j4 << endl; }
|
70 |
|
|
if(fabs(l4j4) < 0.2) { cout << "l4j4 too small: " << l4j4 << endl; }
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
|
74 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
|
75 |
dkralph |
1.1 |
void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo=0, double wgt_hi=0);
|
76 |
dkralph |
1.3 |
void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
|
77 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
|
78 |
|
|
double wgt, double wgt_lo=0, double wgt_hi=0);
|
79 |
|
|
void fillAllJetHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
|
80 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
|
81 |
|
|
FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
|
82 |
|
|
double wgt, double wgt_lo=0, double wgt_hi=0);
|
83 |
dkralph |
1.1 |
void makeHTML(FOFlags &ctrl, TString type, TString plotLabel);
|
84 |
|
|
map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str="");
|
85 |
dkralph |
1.3 |
bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
|
86 |
|
|
unsigned lep2matchBits, unsigned lep3matchBits,
|
87 |
|
|
unsigned lep4matchBits);
|
88 |
|
|
dr_struct fill_dr_struct(vector<SimpleLepton> jets, SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
|
89 |
|
|
void init_cuts(vector<TString> &cutstrs, map<TString,int> &cutvec);
|
90 |
|
|
void resetCutVect(map<TString,int> &cutvec) {
|
91 |
|
|
for(map<TString,int>::iterator it=cutvec.begin(); it!=cutvec.end(); it++)
|
92 |
|
|
cutvec[(*it).first] = 0;
|
93 |
|
|
}
|
94 |
dkralph |
1.1 |
//----------------------------------------------------------------------------------------
|
95 |
|
|
int main(int argc, char** argv)
|
96 |
|
|
{
|
97 |
dkralph |
1.3 |
vector<TString> cutstrs;
|
98 |
|
|
map<TString,int> cutvec;
|
99 |
|
|
init_cuts(cutstrs, cutvec);
|
100 |
dkralph |
1.1 |
|
101 |
|
|
FOFlags ctrl;
|
102 |
|
|
parse_foargs( argc, argv, ctrl );
|
103 |
|
|
ctrl.dump();
|
104 |
dkralph |
1.3 |
bool makeFakeTuples = (ctrl.extraArgs.Contains("makeFakeTuples"));
|
105 |
|
|
FusionMva fusion(ctrl.uncert);//"./weights/againstZZ-fusion_BDTG.weights.xml");
|
106 |
|
|
bool makeJetTuple=false;
|
107 |
dkralph |
1.1 |
|
108 |
|
|
can = new TCanvas("can","can");
|
109 |
|
|
|
110 |
|
|
FR_struct fr2011 = initFRs(ctrl.mufakefile2011,ctrl.elefakefile2011);
|
111 |
|
|
FR_struct fr2012 = initFRs(ctrl.mufakefile2012,ctrl.elefakefile2012);
|
112 |
|
|
|
113 |
|
|
TString cmsswpath(CMSSW_BASE + TString("/src"));
|
114 |
|
|
string xspath = (string(cmsswpath)+"/MitPhysics/data/xs.dat");
|
115 |
|
|
SimpleTable xstab(xspath.c_str());
|
116 |
|
|
|
117 |
dkralph |
1.3 |
TrigInfo ti;
|
118 |
|
|
initAnalysisTriggers(ti);
|
119 |
|
|
|
120 |
dkralph |
1.1 |
vector<CSample*> samplev;
|
121 |
|
|
TString ntupledir(""),label(""),plotLabel(""),jsonFile("");
|
122 |
dkralph |
1.2 |
int puTarget;
|
123 |
|
|
readConfigFile(ctrl.config, ntupledir, label, plotLabel, jsonFile, puTarget, samplev, &ctrl, init_hists);
|
124 |
dkralph |
1.1 |
|
125 |
dkralph |
1.3 |
KinematicsStruct kine; // NOTE: this is not the same as fs->kine -- the one in fs is filled with whichever choice of leptons was made in applyZPlusX
|
126 |
|
|
JetInfoStruct ji;
|
127 |
|
|
|
128 |
dkralph |
1.1 |
UInt_t minRun=999999999,maxRun=0;
|
129 |
|
|
for(unsigned ics=0; ics<samplev.size(); ics++) {
|
130 |
|
|
CSample *cs = samplev[ics];
|
131 |
|
|
cout << cs->name << endl;
|
132 |
dkralph |
1.3 |
|
133 |
|
|
// output for vbf mva training
|
134 |
|
|
unsigned evtVar;
|
135 |
|
|
AngleTuple *jettuple;
|
136 |
|
|
if(makeJetTuple) {
|
137 |
|
|
jettuple = new AngleTuple( (const char*)(TString(cs->name)+"_pass.root").Data(), (const char*)"zznt");
|
138 |
|
|
jettuple->makeKinematicsBranch(kine);
|
139 |
|
|
jettuple->makeJetInfoBranch(ji);
|
140 |
|
|
const char *str1 = "evt";
|
141 |
|
|
const char *str2 = "evt/i";
|
142 |
|
|
jettuple->makeBranch(str1,(void *)(&evtVar),str2);
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
vector<pair<unsigned,unsigned> > runEvtv; // vector to veto duplicate events
|
146 |
|
|
resetCutVect(cutvec);
|
147 |
dkralph |
1.1 |
for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
|
148 |
|
|
filestuff *fs = (cs->fsv)[ifs];
|
149 |
dkralph |
1.3 |
if(makeFakeTuples) { // write a copy of the input trees for events that will be used for the SR fake prediction
|
150 |
|
|
TString fakefilename(fs->fname_);
|
151 |
|
|
fakefilename.ReplaceAll(".root","-fakes.root");
|
152 |
|
|
fs->makeOutputFile(fakefilename);
|
153 |
|
|
}
|
154 |
dkralph |
1.1 |
cout << "\t" << fs->fname_ << endl;
|
155 |
|
|
FR_struct *fr = (fs->era_==2011) ? &fr2011 : &fr2012;
|
156 |
|
|
unsigned nDuplSkipped=0;
|
157 |
|
|
for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
|
158 |
|
|
fs->getentry(ientry,"","FOtree");
|
159 |
|
|
fs->getentry(ientry,"info","zznt");
|
160 |
dkralph |
1.3 |
if(ctrl.debug) cout << "----------------------\n" << "Run: " << fs->info->run << " Event: " << fs->info->evt << endl;
|
161 |
dkralph |
1.1 |
|
162 |
dkralph |
1.3 |
cutvec["start"] = fs->total_entries_;
|
163 |
|
|
if(fs->isdata_) {// && !(fs->dataset_=="fakes")) {
|
164 |
|
|
// WARNING: when I write the fakeTuple from here, I fill an event *twice* if it has two fake z2 candidates, so event numbers are duplicated.
|
165 |
|
|
// in plotH4l I *don't* want to remove these, but here I *do*, because in this file I again loop over all z2 candidates
|
166 |
dkralph |
1.1 |
setMinMaxRun(fs->info->run, minRun, maxRun);
|
167 |
|
|
bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, runEvtv, nDuplSkipped);
|
168 |
|
|
if(dupl) continue;
|
169 |
|
|
pair<unsigned,unsigned> rl(fs->info->run, fs->info->lumi);
|
170 |
dkralph |
1.3 |
if(!fs->rlrm_.HasRunLumi(rl))
|
171 |
|
|
continue;
|
172 |
dkralph |
1.1 |
}
|
173 |
dkralph |
1.3 |
cutvec["rlrmAndDupl"] += 1;
|
174 |
dkralph |
1.1 |
|
175 |
|
|
double wgt=1;
|
176 |
|
|
if(!fs->isdata_) {
|
177 |
dkralph |
1.3 |
double xsWgt = fs->lumi_*xstab.Get(fs->dataset_)/fs->total_entries_;
|
178 |
dkralph |
1.1 |
// double puWgt = weightTrue2012(fs->info->npu);
|
179 |
|
|
wgt = xsWgt;//*puWgt;
|
180 |
|
|
}
|
181 |
dkralph |
1.3 |
if(fs->dataset_=="fakes") { // if we're reading in the fake ntuple that we wrote out earlier, use the event weight that was stored (this should be the same as what we'd get if we calculated it below)
|
182 |
|
|
fs->getentry(ientry,"weights","zznt");
|
183 |
|
|
wgt = fs->weights->w;
|
184 |
|
|
}
|
185 |
dkralph |
1.1 |
|
186 |
|
|
unsigned npass = fs->passingL->size();
|
187 |
|
|
unsigned nfail = fs->failingL->size();
|
188 |
|
|
|
189 |
dkralph |
1.3 |
// look for a z1
|
190 |
dkralph |
1.1 |
pair<int,int> best_z_indices;
|
191 |
dkralph |
1.3 |
double best_mz1 = findZ1(fs->passingL,best_z_indices,40);
|
192 |
|
|
if(best_mz1<=0) {
|
193 |
|
|
cout << "WARNING: best z1 mass: " << best_mz1 << endl;
|
194 |
|
|
}
|
195 |
dkralph |
1.1 |
EventData evtdata;
|
196 |
|
|
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
|
197 |
|
|
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
|
198 |
|
|
|
199 |
|
|
// Look for a z2
|
200 |
|
|
vector<pair<SimpleLepton,SimpleLepton> > z2cands;
|
201 |
|
|
vector<TString> types;
|
202 |
dkralph |
1.3 |
int hiPtPassingZ2 = findZ2Candidates(fs->passingL, z2cands, types, true, 12, "pass",&best_z_indices);
|
203 |
|
|
if(z2cands.size() >1)
|
204 |
|
|
cout << "number of \"passing\" z2 cands: " << z2cands.size() << endl;
|
205 |
|
|
findZ2Candidates(fs->failingL, z2cands, types, true, 12, "fail");
|
206 |
|
|
|
207 |
dkralph |
1.1 |
for(unsigned iz2=0; iz2<z2cands.size(); iz2++) {
|
208 |
|
|
SimpleLepton lep1 = evtdata.Z1leptons[0];
|
209 |
|
|
SimpleLepton lep2 = evtdata.Z1leptons[1];
|
210 |
|
|
SimpleLepton lep3 = z2cands[iz2].first;
|
211 |
|
|
SimpleLepton lep4 = z2cands[iz2].second;
|
212 |
dkralph |
1.3 |
|
213 |
|
|
// bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.bdtfail,lep2.bdtfail,lep3.bdtfail,lep4.bdtfail) : true;
|
214 |
dkralph |
1.1 |
|
215 |
|
|
TString channel = getChannel(lep1,lep2,lep3,lep4);
|
216 |
|
|
evtdata.Z2leptons.clear();
|
217 |
|
|
evtdata.Z2leptons.push_back(lep3);
|
218 |
|
|
evtdata.Z2leptons.push_back(lep4);
|
219 |
|
|
fillKinematics(evtdata,kine);
|
220 |
|
|
|
221 |
|
|
if(fabs(lep3.ip3dSig) >= 4 || fabs(lep4.ip3dSig) >= 4) continue; // |sip| < 4 is applied in ZPlusX to lep1, lep2
|
222 |
|
|
if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4)) continue;
|
223 |
|
|
if(!leptonDrReqs(lep1,lep2,lep3,lep4)) continue;
|
224 |
|
|
if(!resonanceKilling(lep1,lep2,lep3,lep4)) continue;
|
225 |
|
|
if(kine.m4l < 100) continue;
|
226 |
dkralph |
1.3 |
|
227 |
|
|
cutvec["4lsele"] += 1;
|
228 |
dkralph |
1.1 |
|
229 |
dkralph |
1.3 |
//
|
230 |
|
|
// jets!
|
231 |
|
|
//
|
232 |
|
|
bool doJets=true;
|
233 |
|
|
vector<SimpleLepton> goodJets;
|
234 |
|
|
if(doJets) {
|
235 |
|
|
if(fs->jets->size() > 1) cutvec["twoJets"] += 1;
|
236 |
|
|
bool hazJetz = findGoodJets(goodJets, fs, lep1, lep2, lep3, lep4);
|
237 |
|
|
if(goodJets.size() > 1) cutvec["twoJetsAfter"] += 1;
|
238 |
|
|
if(!hazJetz) continue;
|
239 |
|
|
ControlFlags ctrlTmp;
|
240 |
|
|
fillJetInfo(goodJets,ji,ctrlTmp);
|
241 |
|
|
if(makeJetTuple) {
|
242 |
|
|
evtVar = fs->info->evt;
|
243 |
|
|
jettuple->Fill();
|
244 |
|
|
}
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
cutvec["filling"] += 1;
|
248 |
|
|
|
249 |
|
|
if(types[iz2]=="pass" || ((fs->dataset_=="fakes") && (types[iz2]=="fail"))) { // for the fakes ntuple, we plot the "failing" z2s as passing ones, i.e. in hObs, but with the proper weight
|
250 |
|
|
if((fs->dataset_!="fakes") && (iz2!=hiPtPassingZ2)) { // for non-fakes, we only want the highest-pt "passing" z2 (for the fakes these are by design failing, though)
|
251 |
|
|
cout << " iz2: " << iz2 << " -------> not highest pt z2 candidate, so skip it" << endl;
|
252 |
|
|
continue;
|
253 |
|
|
}
|
254 |
|
|
cutvec["fillPass"] += 1;
|
255 |
|
|
fillAllHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, wgt);
|
256 |
|
|
if(doJets) {
|
257 |
|
|
fusion.setValues(ji,kine);
|
258 |
|
|
fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
|
259 |
|
|
}
|
260 |
dkralph |
1.1 |
} else if(types[iz2]=="fail") {
|
261 |
|
|
double fwgt_1 = get_fake_weight("",lep3,*fr);
|
262 |
|
|
double fwgt_lo_1 = get_fake_weight("lo",lep3,*fr);
|
263 |
|
|
double fwgt_hi_1 = get_fake_weight("hi",lep3,*fr);
|
264 |
|
|
double fwgt_2 = get_fake_weight("",lep4,*fr);
|
265 |
|
|
double fwgt_lo_2 = get_fake_weight("lo",lep4,*fr);
|
266 |
|
|
double fwgt_hi_2 = get_fake_weight("hi",lep4,*fr);
|
267 |
|
|
|
268 |
|
|
double centr = wgt*fwgt_1*fwgt_2;
|
269 |
|
|
double lo = wgt*fwgt_lo_1*fwgt_lo_2;
|
270 |
|
|
double hi = wgt*fwgt_hi_1*fwgt_hi_2;
|
271 |
dkralph |
1.3 |
|
272 |
|
|
if(makeFakeTuples && fs->dataset_!="fakes") {
|
273 |
|
|
fs->getentry(ientry,"","zznt"); // make sure we've got this entry for all the branches
|
274 |
|
|
fillKinematics(evtdata,*fs->kine);
|
275 |
|
|
fs->weights->w = centr; // set the weight to be the fake weight (maybe check that this is the same weight as I read in from the fakes dataset?)
|
276 |
|
|
fs->outtuple->Fill();
|
277 |
|
|
fs->outFotuple->Fill();
|
278 |
|
|
}
|
279 |
|
|
|
280 |
|
|
fillAllHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, centr, lo, hi);
|
281 |
|
|
if(doJets) {
|
282 |
|
|
fusion.setValues(ji,kine);
|
283 |
|
|
fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, centr, lo, hi);
|
284 |
|
|
}
|
285 |
dkralph |
1.1 |
} else assert(0);
|
286 |
|
|
}
|
287 |
|
|
}
|
288 |
|
|
cout << "\t\tWARNING: skipped " << nDuplSkipped << " duplicate events" << endl;
|
289 |
dkralph |
1.3 |
if(makeFakeTuples) {
|
290 |
|
|
fs->outFotuple->getFile()->cd();
|
291 |
|
|
fs->outFotuple->getTree()->Write();
|
292 |
|
|
fs->outtuple->WriteClose();
|
293 |
|
|
}
|
294 |
|
|
}
|
295 |
|
|
for(unsigned icut=0; icut<cutstrs.size(); icut++) {
|
296 |
|
|
cout << setw(22) << cutstrs[icut] << setw(22) << cutvec[cutstrs[icut]] << endl;
|
297 |
dkralph |
1.1 |
}
|
298 |
dkralph |
1.3 |
if(makeJetTuple)
|
299 |
|
|
jettuple->WriteClose();
|
300 |
dkralph |
1.1 |
}
|
301 |
|
|
cout << "run range: " << setw(12) << minRun << setw(12) << maxRun << endl;
|
302 |
dkralph |
1.3 |
|
303 |
|
|
// plot!
|
304 |
dkralph |
1.1 |
assert(samplev.size()>0);
|
305 |
|
|
vector<TString> typev;
|
306 |
|
|
typev.push_back("all");
|
307 |
dkralph |
1.3 |
bool plotAllCats=false;
|
308 |
|
|
if(plotAllCats) {
|
309 |
|
|
typev.push_back("4e");
|
310 |
|
|
typev.push_back("4m");
|
311 |
|
|
typev.push_back("2e2m");
|
312 |
|
|
}
|
313 |
dkralph |
1.1 |
for(unsigned itype=0; itype<typev.size(); itype++) {
|
314 |
|
|
TString type(typev[itype]);
|
315 |
|
|
gSystem->mkdir(ctrl.outdir+"/"+plotLabel+"/"+type,true);
|
316 |
|
|
TFile runHistFile(ctrl.outdir+"/"+plotLabel+"/"+type+"/runs.root","recreate");
|
317 |
|
|
map<TString,TH1D*>::iterator it_v;
|
318 |
|
|
for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
|
319 |
|
|
TString var((*it_v).first);
|
320 |
|
|
CPlot cplot(var,"",(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),"events",ctrl.outdir+"/"+plotLabel+"/"+type+"/plots");
|
321 |
|
|
double ymax=0;
|
322 |
|
|
for(unsigned isam=0; isam<samplev.size(); isam++) {
|
323 |
|
|
CSample *cs = samplev[isam];
|
324 |
|
|
TH1D *hObs = (*(cs->hists)[type+"_obs"])[var];
|
325 |
|
|
TH1D *hPred = (*(cs->hists)[type+"_pred"])[var];
|
326 |
|
|
TH1D *hPred_lo = (*(cs->hists)[type+"_pred_lo"])[var];
|
327 |
|
|
TH1D *hPred_hi = (*(cs->hists)[type+"_pred_hi"])[var];
|
328 |
dkralph |
1.3 |
if(false) { //var=="mjj" || var=="etaProd" || var=="ncj") {
|
329 |
|
|
shiftOverflows(hObs);
|
330 |
|
|
shiftOverflows(hPred);
|
331 |
|
|
shiftOverflows(hPred_lo);
|
332 |
|
|
shiftOverflows(hPred_hi);
|
333 |
|
|
}
|
334 |
|
|
bool plotShapeOnly = false;
|
335 |
|
|
if(plotShapeOnly) {
|
336 |
|
|
hObs->Scale(1./integrateHist(hObs));
|
337 |
|
|
hPred->Scale(1./integrateHist(hPred));
|
338 |
|
|
hPred_lo->Scale(1./integrateHist(hPred_lo));
|
339 |
|
|
hPred_hi->Scale(1./integrateHist(hPred_hi));
|
340 |
|
|
}
|
341 |
dkralph |
1.1 |
|
342 |
dkralph |
1.3 |
if(cs->isdata && !(cs->name=="fakes")) {
|
343 |
dkralph |
1.1 |
double ratio = integrateHist(hObs) / integrateHist(hPred);
|
344 |
dkralph |
1.3 |
bool plotObs = true;
|
345 |
|
|
if(plotObs) {
|
346 |
|
|
cplot.AddHist1D(hObs,cs->legend+": "+integral_str(hObs,0)+", ratio: "+f_to_a(ratio),"E");
|
347 |
|
|
ymax = max(ymax,hObs->GetMaximum());
|
348 |
|
|
} else {
|
349 |
|
|
cplot.AddHist1D(hPred, "FR predic: "+integral_str(hPred,3), "hist",kRed);
|
350 |
|
|
cplot.AddHist1D(hPred_lo, "stat lo: "+integral_str(hPred_lo,2),"hist",kRed,kDashed);
|
351 |
|
|
cplot.AddHist1D(hPred_hi, "stat hi: "+integral_str(hPred_hi,2),"hist",kRed,kDashed);
|
352 |
|
|
ymax = max(ymax,histMax(hPred,hPred_lo,hPred_hi));
|
353 |
|
|
}
|
354 |
dkralph |
1.1 |
} else {
|
355 |
dkralph |
1.3 |
TH1D *mchist = hObs;
|
356 |
|
|
bool stackMc = false;
|
357 |
|
|
if(stackMc) cplot.AddToStack(mchist,cs->legend+": "+integral_str(mchist,2),cs->color);
|
358 |
|
|
else cplot.AddHist1D(mchist,cs->legend +": "+integral_str(mchist,3),"Ehist",cs->color);//cs->color);
|
359 |
|
|
ymax = max(ymax,mchist->GetMaximum());
|
360 |
dkralph |
1.1 |
}
|
361 |
|
|
if(cs->isdata && var=="run") {
|
362 |
|
|
assert(hObs->GetBinContent(0)==0 && hObs->GetBinContent(hObs->GetXaxis()->GetNbins()+1)==0);
|
363 |
|
|
hObs->Write("runs");
|
364 |
|
|
}
|
365 |
dkralph |
1.3 |
if(var.Contains("fusionMVA"))
|
366 |
|
|
cplot.SetLogy();
|
367 |
|
|
else
|
368 |
dkralph |
1.1 |
cplot.SetYRange(0,1.2*ymax);
|
369 |
|
|
}
|
370 |
|
|
cplot.Draw(can,true,"png");
|
371 |
|
|
}
|
372 |
|
|
runHistFile.Close();
|
373 |
|
|
makeHTML(ctrl,type,plotLabel);
|
374 |
|
|
}
|
375 |
|
|
}
|
376 |
|
|
//----------------------------------------------------------------------------------------
|
377 |
|
|
map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str)
|
378 |
|
|
{
|
379 |
|
|
map<TString,map<TString,TH1D*>* > hists;
|
380 |
|
|
map<TString,TH1D*> *h_4e_obs = new map<TString,TH1D*>; hists["4e_obs"] = h_4e_obs;
|
381 |
|
|
map<TString,TH1D*> *h_4e_pred = new map<TString,TH1D*>; hists["4e_pred"] = h_4e_pred;
|
382 |
|
|
map<TString,TH1D*> *h_4e_pred_lo = new map<TString,TH1D*>; hists["4e_pred_lo"] = h_4e_pred_lo;
|
383 |
|
|
map<TString,TH1D*> *h_4e_pred_hi = new map<TString,TH1D*>; hists["4e_pred_hi"] = h_4e_pred_hi;
|
384 |
|
|
map<TString,TH1D*> *h_4m_obs = new map<TString,TH1D*>; hists["4m_obs"] = h_4m_obs;
|
385 |
|
|
map<TString,TH1D*> *h_4m_pred = new map<TString,TH1D*>; hists["4m_pred"] = h_4m_pred;
|
386 |
|
|
map<TString,TH1D*> *h_4m_pred_lo = new map<TString,TH1D*>; hists["4m_pred_lo"] = h_4m_pred_lo;
|
387 |
|
|
map<TString,TH1D*> *h_4m_pred_hi = new map<TString,TH1D*>; hists["4m_pred_hi"] = h_4m_pred_hi;
|
388 |
|
|
map<TString,TH1D*> *h_2e2m_obs = new map<TString,TH1D*>; hists["2e2m_obs"] = h_2e2m_obs;
|
389 |
|
|
map<TString,TH1D*> *h_2e2m_pred = new map<TString,TH1D*>; hists["2e2m_pred"] = h_2e2m_pred;
|
390 |
|
|
map<TString,TH1D*> *h_2e2m_pred_lo = new map<TString,TH1D*>; hists["2e2m_pred_lo"] = h_2e2m_pred_lo;
|
391 |
|
|
map<TString,TH1D*> *h_2e2m_pred_hi = new map<TString,TH1D*>; hists["2e2m_pred_hi"] = h_2e2m_pred_hi;
|
392 |
|
|
map<TString,TH1D*> *h_all_obs = new map<TString,TH1D*>; hists["all_obs"] = h_all_obs;
|
393 |
|
|
map<TString,TH1D*> *h_all_pred = new map<TString,TH1D*>; hists["all_pred"] = h_all_pred;
|
394 |
|
|
map<TString,TH1D*> *h_all_pred_lo = new map<TString,TH1D*>; hists["all_pred_lo"] = h_all_pred_lo;
|
395 |
|
|
map<TString,TH1D*> *h_all_pred_hi = new map<TString,TH1D*>; hists["all_pred_hi"] = h_all_pred_hi;
|
396 |
|
|
map<TString,map<TString,TH1D*>* >::iterator it_h;
|
397 |
|
|
|
398 |
|
|
for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
|
399 |
dkralph |
1.3 |
(*((*it_h).second))["npv"] = new TH1D(TString("npv") +"_"+(*it_h).first+str,";#bf{N PV};", 50,-0.5,49.5); (*((*it_h).second))["npv"]->Sumw2();
|
400 |
dkralph |
1.1 |
(*((*it_h).second))["run"] = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};", 50,160800,196535); (*((*it_h).second))["run"]->Sumw2();
|
401 |
|
|
(*((*it_h).second))["mZ1"] = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};", 20,60,120); (*((*it_h).second))["mZ1"]->Sumw2();
|
402 |
|
|
(*((*it_h).second))["mZ2"] = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};", 30,0,115); (*((*it_h).second))["mZ2"]->Sumw2();
|
403 |
|
|
(*((*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();
|
404 |
dkralph |
1.3 |
(*((*it_h).second))["m4l_lo"] = new TH1D(TString("m4l_lo") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 35,70,120); (*((*it_h).second))["m4l_lo"]->Sumw2();
|
405 |
|
|
(*((*it_h).second))["m4l_med"] = new TH1D(TString("m4l_med") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};",35,100,180); (*((*it_h).second))["m4l_med"]->Sumw2();
|
406 |
|
|
(*((*it_h).second))["m4l"] = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 35,100,600); (*((*it_h).second))["m4l"]->Sumw2();
|
407 |
dkralph |
1.1 |
(*((*it_h).second))["Z1pt"] = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};", 20,0,200); (*((*it_h).second))["Z1pt"]->Sumw2();
|
408 |
|
|
(*((*it_h).second))["ZZpt"] = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};", 30,0,200); (*((*it_h).second))["ZZpt"]->Sumw2();
|
409 |
|
|
|
410 |
|
|
(*((*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();
|
411 |
|
|
(*((*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();
|
412 |
|
|
(*((*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();
|
413 |
|
|
(*((*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();
|
414 |
|
|
|
415 |
|
|
(*((*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();
|
416 |
|
|
(*((*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();
|
417 |
|
|
(*((*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();
|
418 |
|
|
(*((*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();
|
419 |
|
|
|
420 |
|
|
(*((*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();
|
421 |
|
|
(*((*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();
|
422 |
|
|
(*((*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();
|
423 |
|
|
(*((*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();
|
424 |
|
|
|
425 |
|
|
(*((*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();
|
426 |
|
|
(*((*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();
|
427 |
dkralph |
1.3 |
|
428 |
|
|
// jets
|
429 |
|
|
(*((*it_h).second))["pt_allJet"] = new TH1D(TString("pt_allJet") +"_"+(*it_h).first+str,";#bf{jet 1 p_{T} [GeV]};",37,0,400); (*((*it_h).second))["pt_allJet"]->Sumw2();
|
430 |
|
|
(*((*it_h).second))["eta_allJet"] = new TH1D(TString("eta_allJet") +"_"+(*it_h).first+str,";#bf{jet 1 p_{T} [GeV]};",37,-4.8,4.8); (*((*it_h).second))["eta_allJet"]->Sumw2();
|
431 |
|
|
(*((*it_h).second))["pt_j1"] = new TH1D(TString("pt_j1") +"_"+(*it_h).first+str,";#bf{jet 1 p_{T} [GeV]};", 37,0,400); (*((*it_h).second))["pt_j1"]->Sumw2();
|
432 |
|
|
(*((*it_h).second))["pt_j2"] = new TH1D(TString("pt_j2") +"_"+(*it_h).first+str,";#bf{jet 2 p_{T} [GeV]};", 37,0,125); (*((*it_h).second))["pt_j2"]->Sumw2();
|
433 |
|
|
(*((*it_h).second))["pt_j3"] = new TH1D(TString("pt_j3") +"_"+(*it_h).first+str,";#bf{jet 3 p_{T} [GeV]};", 37,0,125); (*((*it_h).second))["pt_j3"]->Sumw2();
|
434 |
|
|
(*((*it_h).second))["pt_j4"] = new TH1D(TString("pt_j4") +"_"+(*it_h).first+str,";#bf{jet 4 p_{T} [GeV]};", 37,0,125); (*((*it_h).second))["pt_j4"]->Sumw2();
|
435 |
|
|
(*((*it_h).second))["eta_j1"] = new TH1D(TString("eta_j1")+"_"+(*it_h).first+str,";#bf{jet 1 #eta};", 55,-4.8,4.8); (*((*it_h).second))["eta_j1"]->Sumw2();
|
436 |
|
|
(*((*it_h).second))["eta_j2"] = new TH1D(TString("eta_j2")+"_"+(*it_h).first+str,";#bf{jet 2 #eta};", 55,-4.8,4.8); (*((*it_h).second))["eta_j2"]->Sumw2();
|
437 |
|
|
(*((*it_h).second))["eta_j3"] = new TH1D(TString("eta_j3")+"_"+(*it_h).first+str,";#bf{jet 3 #eta};", 55,-4.8,4.8); (*((*it_h).second))["eta_j3"]->Sumw2();
|
438 |
|
|
(*((*it_h).second))["eta_j4"] = new TH1D(TString("eta_j4")+"_"+(*it_h).first+str,";#bf{jet 4 #eta};", 55,-4.8,4.8); (*((*it_h).second))["eta_j4"]->Sumw2();
|
439 |
|
|
(*((*it_h).second))["phi_j1"] = new TH1D(TString("phi_j1")+"_"+(*it_h).first+str,";#bf{jet 1 #phi};", 25,-3.2,3.2); (*((*it_h).second))["phi_j1"]->Sumw2();
|
440 |
|
|
(*((*it_h).second))["phi_j2"] = new TH1D(TString("phi_j2")+"_"+(*it_h).first+str,";#bf{jet 2 #phi};", 25,-3.2,3.2); (*((*it_h).second))["phi_j2"]->Sumw2();
|
441 |
|
|
(*((*it_h).second))["phi_j3"] = new TH1D(TString("phi_j3")+"_"+(*it_h).first+str,";#bf{jet 3 #phi};", 25,-3.2,3.2); (*((*it_h).second))["phi_j3"]->Sumw2();
|
442 |
|
|
(*((*it_h).second))["phi_j4"] = new TH1D(TString("phi_j4")+"_"+(*it_h).first+str,";#bf{jet 4 #phi};", 25,-3.2,3.2); (*((*it_h).second))["phi_j4"]->Sumw2();
|
443 |
|
|
(*((*it_h).second))["idmva_j1"] = new TH1D(TString("idmva_j1")+"_"+(*it_h).first+str,";#bf{jet 1 MVA};", 25,-1.1,1.1); (*((*it_h).second))["idmva_j1"]->Sumw2();
|
444 |
|
|
(*((*it_h).second))["idmva_j2"] = new TH1D(TString("idmva_j2")+"_"+(*it_h).first+str,";#bf{jet 2 MVA};", 25,-1.1,1.1); (*((*it_h).second))["idmva_j2"]->Sumw2();
|
445 |
|
|
(*((*it_h).second))["idmva_j3"] = new TH1D(TString("idmva_j3")+"_"+(*it_h).first+str,";#bf{jet 3 MVA};", 25,-1.1,1.1); (*((*it_h).second))["idmva_j3"]->Sumw2();
|
446 |
|
|
(*((*it_h).second))["idmva_j4"] = new TH1D(TString("idmva_j4")+"_"+(*it_h).first+str,";#bf{jet 4 MVA};", 25,-1.1,1.1); (*((*it_h).second))["idmva_j4"]->Sumw2();
|
447 |
|
|
(*((*it_h).second))["mjj"] = new TH1D(TString("mjj")+"_"+(*it_h).first+str,";#bf{m_{jj}};", 25,10,1550); (*((*it_h).second))["mjj"]->Sumw2();
|
448 |
|
|
(*((*it_h).second))["dEta"] = new TH1D(TString("dEta")+"_"+(*it_h).first+str,";#bf{#Delta #eta};", 25,-6,6); (*((*it_h).second))["dEta"]->Sumw2();
|
449 |
|
|
(*((*it_h).second))["etaProd"] = new TH1D(TString("etaProd")+"_"+(*it_h).first+str,";#bf{#eta_{1} * #eta_{2}};",25,-12,12); (*((*it_h).second))["etaProd"]->Sumw2();
|
450 |
|
|
(*((*it_h).second))["njets"] = new TH1D(TString("njets")+"_"+(*it_h).first+str,";#bf{N Jets};", 7,-0.5,6.5); (*((*it_h).second))["njets"]->Sumw2();
|
451 |
|
|
|
452 |
|
|
(*((*it_h).second))["dR_l1j1"] = new TH1D(TString("dR_l1j1") +"_"+(*it_h).first+str,";#bf{#Delta R l1,jet 1};",75,0,6); (*((*it_h).second))["dR_l1j1"]->Sumw2();
|
453 |
|
|
(*((*it_h).second))["dR_l2j1"] = new TH1D(TString("dR_l2j1") +"_"+(*it_h).first+str,";#bf{#Delta R l2,jet 1};",75,0,6); (*((*it_h).second))["dR_l2j1"]->Sumw2();
|
454 |
|
|
(*((*it_h).second))["dR_l3j1"] = new TH1D(TString("dR_l3j1") +"_"+(*it_h).first+str,";#bf{#Delta R l3,jet 1};",75,0,6); (*((*it_h).second))["dR_l3j1"]->Sumw2();
|
455 |
|
|
(*((*it_h).second))["dR_l4j1"] = new TH1D(TString("dR_l4j1") +"_"+(*it_h).first+str,";#bf{#Delta R l4,jet 1};",75,0,6); (*((*it_h).second))["dR_l4j1"]->Sumw2();
|
456 |
|
|
(*((*it_h).second))["dR_l1j2"] = new TH1D(TString("dR_l1j2") +"_"+(*it_h).first+str,";#bf{#Delta R l1,jet 2};",75,0,6); (*((*it_h).second))["dR_l1j2"]->Sumw2();
|
457 |
|
|
(*((*it_h).second))["dR_l2j2"] = new TH1D(TString("dR_l2j2") +"_"+(*it_h).first+str,";#bf{#Delta R l2,jet 2};",75,0,6); (*((*it_h).second))["dR_l2j2"]->Sumw2();
|
458 |
|
|
(*((*it_h).second))["dR_l3j2"] = new TH1D(TString("dR_l3j2") +"_"+(*it_h).first+str,";#bf{#Delta R l3,jet 2};",75,0,6); (*((*it_h).second))["dR_l3j2"]->Sumw2();
|
459 |
|
|
(*((*it_h).second))["dR_l4j2"] = new TH1D(TString("dR_l4j2") +"_"+(*it_h).first+str,";#bf{#Delta R l4,jet 2};",75,0,6); (*((*it_h).second))["dR_l4j2"]->Sumw2();
|
460 |
|
|
(*((*it_h).second))["dR_l1j3"] = new TH1D(TString("dR_l1j3") +"_"+(*it_h).first+str,";#bf{#Delta R l1,jet 3};",75,0,6); (*((*it_h).second))["dR_l1j3"]->Sumw2();
|
461 |
|
|
(*((*it_h).second))["dR_l2j3"] = new TH1D(TString("dR_l2j3") +"_"+(*it_h).first+str,";#bf{#Delta R l2,jet 3};",75,0,6); (*((*it_h).second))["dR_l2j3"]->Sumw2();
|
462 |
|
|
(*((*it_h).second))["dR_l3j3"] = new TH1D(TString("dR_l3j3") +"_"+(*it_h).first+str,";#bf{#Delta R l3,jet 3};",75,0,6); (*((*it_h).second))["dR_l3j3"]->Sumw2();
|
463 |
|
|
(*((*it_h).second))["dR_l4j3"] = new TH1D(TString("dR_l4j3") +"_"+(*it_h).first+str,";#bf{#Delta R l4,jet 3};",75,0,6); (*((*it_h).second))["dR_l4j3"]->Sumw2();
|
464 |
|
|
(*((*it_h).second))["dR_l1j4"] = new TH1D(TString("dR_l1j4") +"_"+(*it_h).first+str,";#bf{#Delta R l1,jet 4};",75,0,6); (*((*it_h).second))["dR_l1j4"]->Sumw2();
|
465 |
|
|
(*((*it_h).second))["dR_l2j4"] = new TH1D(TString("dR_l2j4") +"_"+(*it_h).first+str,";#bf{#Delta R l2,jet 4};",75,0,6); (*((*it_h).second))["dR_l2j4"]->Sumw2();
|
466 |
|
|
(*((*it_h).second))["dR_l3j4"] = new TH1D(TString("dR_l3j4") +"_"+(*it_h).first+str,";#bf{#Delta R l3,jet 4};",75,0,6); (*((*it_h).second))["dR_l3j4"]->Sumw2();
|
467 |
|
|
(*((*it_h).second))["dR_l4j4"] = new TH1D(TString("dR_l4j4") +"_"+(*it_h).first+str,";#bf{#Delta R l4,jet 4};",75,0,6); (*((*it_h).second))["dR_l4j4"]->Sumw2();
|
468 |
|
|
|
469 |
|
|
(*((*it_h).second))["fusionMVA"] = new TH1D(TString("fusionMVA")+"_"+(*it_h).first+str,";#bf{MVA output};", 100,-1,1); (*((*it_h).second))["fusionMVA"]->Sumw2();
|
470 |
|
|
(*((*it_h).second))["fusionMVA_lo"] = new TH1D(TString("fusionMVA_lo")+"_"+(*it_h).first+str,";#bf{MVA output};", 100,-1,-.83); (*((*it_h).second))["fusionMVA_lo"]->Sumw2();
|
471 |
|
|
(*((*it_h).second))["fusionMVA_med"] = new TH1D(TString("fusionMVA_med")+"_"+(*it_h).first+str,";#bf{MVA output};", 100,-.5,1); (*((*it_h).second))["fusionMVA_med"]->Sumw2();
|
472 |
|
|
(*((*it_h).second))["fusionMVA_hi"] = new TH1D(TString("fusionMVA_hi")+"_"+(*it_h).first+str,";#bf{MVA output};", 100,.75,1); (*((*it_h).second))["fusionMVA_hi"]->Sumw2();
|
473 |
|
|
(*((*it_h).second))["m4l_jet_lo"] = new TH1D(TString("m4l_jet_lo") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 45,100,180); (*((*it_h).second))["m4l_jet_lo"]->Sumw2();
|
474 |
|
|
(*((*it_h).second))["m4l_jet"] = new TH1D(TString("m4l_jet") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 45,100,600); (*((*it_h).second))["m4l_jet"]->Sumw2();
|
475 |
dkralph |
1.1 |
}
|
476 |
|
|
return hists;
|
477 |
|
|
}
|
478 |
|
|
//--------------------------------------------------------------------------------------------------
|
479 |
|
|
void makeHTML(FOFlags &ctrl, TString type, TString plotLabel)
|
480 |
|
|
{
|
481 |
dkralph |
1.3 |
TString title("Signal region: "+type+", "+plotLabel);
|
482 |
dkralph |
1.1 |
ofstream htmlfile;
|
483 |
|
|
char htmlfname[100];
|
484 |
|
|
sprintf(htmlfname,"%s/plots.html",TString(ctrl.outdir+"/"+plotLabel+"/"+type).Data());
|
485 |
|
|
htmlfile.open(htmlfname);
|
486 |
|
|
|
487 |
|
|
htmlfile << "<!DOCTYPE html" << endl;
|
488 |
|
|
htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
|
489 |
|
|
htmlfile << "<html>" << endl;
|
490 |
|
|
|
491 |
|
|
htmlfile << "<head><title>"+title+"</title></head>" << endl;
|
492 |
|
|
htmlfile << "<body bgcolor=\"EEEEEE\">" << endl;
|
493 |
|
|
htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
|
494 |
|
|
|
495 |
|
|
htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
|
496 |
|
|
|
497 |
|
|
htmlfile << "<tr>" << endl;
|
498 |
|
|
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;
|
499 |
|
|
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;
|
500 |
|
|
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;
|
501 |
dkralph |
1.3 |
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
502 |
|
|
htmlfile << "</tr>" << endl;
|
503 |
|
|
|
504 |
|
|
htmlfile << "<tr>" << endl;
|
505 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/m4l_lo.png\"><img src=\"plots/m4l_lo.png\" alt=\"plots/m4l_lo.png\" width=\"100%\"></a></td>" << endl;
|
506 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/m4l_med.png\"><img src=\"plots/m4l_med.png\" alt=\"plots/m4l_med.png\" width=\"100%\"></a></td>" << endl;
|
507 |
dkralph |
1.1 |
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;
|
508 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
509 |
|
|
htmlfile << "</tr>" << endl;
|
510 |
|
|
|
511 |
|
|
htmlfile << "<tr>" << endl;
|
512 |
|
|
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;
|
513 |
|
|
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;
|
514 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
515 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
516 |
|
|
htmlfile << "</tr>" << endl;
|
517 |
|
|
|
518 |
|
|
htmlfile << "<tr>" << endl;
|
519 |
|
|
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;
|
520 |
|
|
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;
|
521 |
|
|
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;
|
522 |
|
|
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;
|
523 |
|
|
htmlfile << "</tr>" << endl;
|
524 |
|
|
|
525 |
|
|
htmlfile << "<tr>" << endl;
|
526 |
|
|
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;
|
527 |
|
|
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;
|
528 |
|
|
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;
|
529 |
|
|
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;
|
530 |
|
|
htmlfile << "</tr>" << endl;
|
531 |
|
|
|
532 |
dkralph |
1.3 |
// htmlfile << "<tr>" << endl;
|
533 |
|
|
// 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;
|
534 |
|
|
// 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;
|
535 |
|
|
// htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
|
536 |
|
|
// htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
|
537 |
|
|
// htmlfile << "</tr>" << endl;
|
538 |
dkralph |
1.1 |
|
539 |
|
|
htmlfile << "<tr>" << endl;
|
540 |
|
|
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;
|
541 |
|
|
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;
|
542 |
|
|
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;
|
543 |
|
|
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;
|
544 |
|
|
htmlfile << "</tr>" << endl;
|
545 |
dkralph |
1.3 |
|
546 |
|
|
htmlfile << "</table>" << endl;
|
547 |
|
|
htmlfile << "jet plots: " << endl;
|
548 |
|
|
htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
|
549 |
|
|
|
550 |
|
|
htmlfile << "<tr>" << endl;
|
551 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_j1.png\"><img src=\"plots/pt_j1.png\" alt=\"plots/pt_j1.png\" width=\"100%\"></a></td>" << endl;
|
552 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_j2.png\"><img src=\"plots/pt_j2.png\" alt=\"plots/pt_j2.png\" width=\"100%\"></a></td>" << endl;
|
553 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_j2.png\"><img src=\"plots/pt_j2.png\" alt=\"plots/pt_j2.png\" width=\"100%\"></a></td>" << endl;
|
554 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt_j4.png\"><img src=\"plots/pt_j4.png\" alt=\"plots/pt_j4.png\" width=\"100%\"></a></td>" << endl;
|
555 |
|
|
htmlfile << "</tr>" << endl;
|
556 |
|
|
|
557 |
|
|
htmlfile << "<tr>" << endl;
|
558 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_j1.png\"><img src=\"plots/eta_j1.png\" alt=\"plots/eta_j1.png\" width=\"100%\"></a></td>" << endl;
|
559 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_j2.png\"><img src=\"plots/eta_j2.png\" alt=\"plots/eta_j2.png\" width=\"100%\"></a></td>" << endl;
|
560 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_j3.png\"><img src=\"plots/eta_j3.png\" alt=\"plots/eta_j3.png\" width=\"100%\"></a></td>" << endl;
|
561 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/eta_j4.png\"><img src=\"plots/eta_j4.png\" alt=\"plots/eta_j4.png\" width=\"100%\"></a></td>" << endl;
|
562 |
|
|
htmlfile << "</tr>" << endl;
|
563 |
|
|
|
564 |
|
|
htmlfile << "<tr>" << endl;
|
565 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/idmva_j1.png\"><img src=\"plots/idmva_j1.png\" alt=\"plots/idmva_j1.png\" width=\"100%\"></a></td>" << endl;
|
566 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/idmva_j2.png\"><img src=\"plots/idmva_j2.png\" alt=\"plots/idmva_j2.png\" width=\"100%\"></a></td>" << endl;
|
567 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/idmva_j3.png\"><img src=\"plots/idmva_j3.png\" alt=\"plots/idmva_j3.png\" width=\"100%\"></a></td>" << endl;
|
568 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/idmva_j4.png\"><img src=\"plots/idmva_j4.png\" alt=\"plots/idmva_j4.png\" width=\"100%\"></a></td>" << endl;
|
569 |
|
|
htmlfile << "</tr>" << endl;
|
570 |
|
|
|
571 |
|
|
htmlfile << "<tr>" << endl;
|
572 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/phi_j1.png\"><img src=\"plots/phi_j1.png\" alt=\"plots/phi_j1.png\" width=\"100%\"></a></td>" << endl;
|
573 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/phi_j2.png\"><img src=\"plots/phi_j2.png\" alt=\"plots/phi_j2.png\" width=\"100%\"></a></td>" << endl;
|
574 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/phi_j3.png\"><img src=\"plots/phi_j3.png\" alt=\"plots/phi_j3.png\" width=\"100%\"></a></td>" << endl;
|
575 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/phi_j4.png\"><img src=\"plots/phi_j4.png\" alt=\"plots/phi_j4.png\" width=\"100%\"></a></td>" << endl;
|
576 |
|
|
htmlfile << "</tr>" << endl;
|
577 |
|
|
|
578 |
|
|
htmlfile << "<tr>" << endl;
|
579 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/mjj.png\"><img src=\"plots/mjj.png\" alt=\"plots/mjj.png\" width=\"100%\"></a></td>" << endl;
|
580 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dEta.png\"><img src=\"plots/dEta.png\" alt=\"plots/dEta.png\" width=\"100%\"></a></td>" << endl;
|
581 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/etaProd.png\"><img src=\"plots/etaProd.png\" alt=\"plots/etaProd.png\" width=\"100%\"></a></td>" << endl;
|
582 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/njets.png\"><img src=\"plots/njets.png\" alt=\"plots/njets.png\" width=\"100%\"></a></td>" << endl;
|
583 |
|
|
htmlfile << "</tr>" << endl;
|
584 |
|
|
|
585 |
|
|
// htmlfile << "<tr>" << endl;
|
586 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1j1.png\"><img src=\"plots/dR_l1j1.png\" alt=\"plots/dR_l1j1.png\" width=\"100%\"></a></td>" << endl;
|
587 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2j1.png\"><img src=\"plots/dR_l2j1.png\" alt=\"plots/dR_l2j1.png\" width=\"100%\"></a></td>" << endl;
|
588 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3j1.png\"><img src=\"plots/dR_l3j1.png\" alt=\"plots/dR_l3j1.png\" width=\"100%\"></a></td>" << endl;
|
589 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l4j1.png\"><img src=\"plots/dR_l4j1.png\" alt=\"plots/dR_l4j1.png\" width=\"100%\"></a></td>" << endl;
|
590 |
|
|
// htmlfile << "</tr>" << endl;
|
591 |
|
|
|
592 |
|
|
// htmlfile << "<tr>" << endl;
|
593 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1j2.png\"><img src=\"plots/dR_l1j2.png\" alt=\"plots/dR_l1j2.png\" width=\"100%\"></a></td>" << endl;
|
594 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2j2.png\"><img src=\"plots/dR_l2j2.png\" alt=\"plots/dR_l2j2.png\" width=\"100%\"></a></td>" << endl;
|
595 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3j2.png\"><img src=\"plots/dR_l3j2.png\" alt=\"plots/dR_l3j2.png\" width=\"100%\"></a></td>" << endl;
|
596 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l4j2.png\"><img src=\"plots/dR_l4j2.png\" alt=\"plots/dR_l4j2.png\" width=\"100%\"></a></td>" << endl;
|
597 |
|
|
// htmlfile << "</tr>" << endl;
|
598 |
|
|
|
599 |
|
|
// htmlfile << "<tr>" << endl;
|
600 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1j3.png\"><img src=\"plots/dR_l1j3.png\" alt=\"plots/dR_l1j3.png\" width=\"100%\"></a></td>" << endl;
|
601 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2j3.png\"><img src=\"plots/dR_l2j3.png\" alt=\"plots/dR_l2j3.png\" width=\"100%\"></a></td>" << endl;
|
602 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3j3.png\"><img src=\"plots/dR_l3j3.png\" alt=\"plots/dR_l3j3.png\" width=\"100%\"></a></td>" << endl;
|
603 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l4j3.png\"><img src=\"plots/dR_l4j3.png\" alt=\"plots/dR_l4j3.png\" width=\"100%\"></a></td>" << endl;
|
604 |
|
|
// htmlfile << "</tr>" << endl;
|
605 |
|
|
|
606 |
|
|
// htmlfile << "<tr>" << endl;
|
607 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l1j4.png\"><img src=\"plots/dR_l1j4.png\" alt=\"plots/dR_l1j4.png\" width=\"100%\"></a></td>" << endl;
|
608 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l2j4.png\"><img src=\"plots/dR_l2j4.png\" alt=\"plots/dR_l2j4.png\" width=\"100%\"></a></td>" << endl;
|
609 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l3j4.png\"><img src=\"plots/dR_l3j4.png\" alt=\"plots/dR_l3j4.png\" width=\"100%\"></a></td>" << endl;
|
610 |
|
|
// htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dR_l4j4.png\"><img src=\"plots/dR_l4j4.png\" alt=\"plots/dR_l4j4.png\" width=\"100%\"></a></td>" << endl;
|
611 |
|
|
// htmlfile << "</tr>" << endl;
|
612 |
|
|
|
613 |
|
|
htmlfile << "<tr>" << endl;
|
614 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA.png\"><img src=\"plots/fusionMVA.png\" alt=\"plots/fusionMVA.png\" width=\"100%\"></a></td>" << endl;
|
615 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA_lo.png\"><img src=\"plots/fusionMVA_lo.png\" alt=\"plots/fusionMVA_lo.png\" width=\"100%\"></a></td>" << endl;
|
616 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA_hi.png\"><img src=\"plots/fusionMVA_hi.png\" alt=\"plots/fusionMVA_hi.png\" width=\"100%\"></a></td>" << endl;
|
617 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
618 |
|
|
htmlfile << "</tr>" << endl;
|
619 |
|
|
|
620 |
|
|
htmlfile << "<tr>" << endl;
|
621 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/m4l_jet_lo.png\"><img src=\"plots/m4l_jet_lo.png\" alt=\"plots/m4l_jet_lo.png\" width=\"100%\"></a></td>" << endl;
|
622 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/m4l_jet.png\"><img src=\"plots/m4l_jet.png\" alt=\"plots/m4l_jet.png\" width=\"100%\"></a></td>" << endl;
|
623 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
624 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
625 |
|
|
htmlfile << "</tr>" << endl;
|
626 |
|
|
|
627 |
|
|
htmlfile << "<tr>" << endl;
|
628 |
|
|
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;
|
629 |
|
|
htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/npv.png\"><img src=\"plots/npv.png\" alt=\"plots/npv.png\" width=\"100%\"></a></td>" << endl;
|
630 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
631 |
|
|
htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
|
632 |
|
|
htmlfile << "</tr>" << endl;
|
633 |
dkralph |
1.1 |
htmlfile << "</table>" << endl;
|
634 |
|
|
|
635 |
|
|
htmlfile << "<hr />" << endl;
|
636 |
|
|
|
637 |
|
|
htmlfile << "<hr />" << endl;
|
638 |
|
|
|
639 |
|
|
htmlfile << "</body>" << endl;
|
640 |
|
|
htmlfile << "</html>" << endl;
|
641 |
|
|
htmlfile.close();
|
642 |
|
|
}
|
643 |
|
|
//----------------------------------------------------------------------------------------
|
644 |
|
|
void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo, double wgt_hi)
|
645 |
|
|
{
|
646 |
|
|
(*(cs->hists)["all_"+type])[var]->Fill( val, wgt);
|
647 |
|
|
if(channel!="")
|
648 |
|
|
(*(cs->hists)[channel+"_"+type])[var]->Fill( val, wgt);
|
649 |
|
|
if(type=="pred") {
|
650 |
|
|
(*(cs->hists)["all_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
651 |
|
|
(*(cs->hists)["all_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
652 |
|
|
if(channel!="") {
|
653 |
|
|
(*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill( val, wgt_lo);
|
654 |
|
|
(*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill( val, wgt_hi);
|
655 |
|
|
}
|
656 |
|
|
}
|
657 |
|
|
}
|
658 |
dkralph |
1.3 |
//----------------------------------------------------------------------------------------
|
659 |
|
|
void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
|
660 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
|
661 |
|
|
double wgt, double wgt_lo, double wgt_hi)
|
662 |
|
|
{
|
663 |
|
|
fillHist( cs, channel, type, "npv" , fs->info->npv , wgt, wgt_lo, wgt_hi);
|
664 |
|
|
fillHist( cs, channel, type, "run" , fs->info->run , wgt, wgt_lo, wgt_hi);
|
665 |
|
|
fillHist( cs, channel, type, "mZ1" , kine.mZ1 , wgt, wgt_lo, wgt_hi);
|
666 |
|
|
fillHist( cs, channel, type, "mZ2" , kine.mZ2 , wgt, wgt_lo, wgt_hi);
|
667 |
|
|
fillHist( cs, channel, type, "mZ2_lo" , kine.mZ2 , wgt, wgt_lo, wgt_hi);
|
668 |
|
|
fillHist( cs, channel, type, "m4l_lo" , kine.m4l , wgt, wgt_lo, wgt_hi);
|
669 |
|
|
fillHist( cs, channel, type, "m4l_med" , kine.m4l , wgt, wgt_lo, wgt_hi);
|
670 |
|
|
fillHist( cs, channel, type, "m4l" , kine.m4l , wgt, wgt_lo, wgt_hi);
|
671 |
|
|
fillHist( cs, channel, type, "Z1pt" , kine.Z1pt , wgt, wgt_lo, wgt_hi);
|
672 |
|
|
fillHist( cs, channel, type, "ZZpt" , kine.ZZpt , wgt, wgt_lo, wgt_hi);
|
673 |
|
|
fillHist( cs, channel, type, "ip3ds_l1" , lep1.ip3dSig , wgt, wgt_lo, wgt_hi);
|
674 |
|
|
fillHist( cs, channel, type, "ip3ds_l2" , lep2.ip3dSig , wgt, wgt_lo, wgt_hi);
|
675 |
|
|
fillHist( cs, channel, type, "ip3ds_l3" , lep3.ip3dSig , wgt, wgt_lo, wgt_hi);
|
676 |
|
|
fillHist( cs, channel, type, "ip3ds_l4" , lep4.ip3dSig , wgt, wgt_lo, wgt_hi);
|
677 |
|
|
fillHist( cs, channel, type, "pt_l1" , lep1.vec.Pt() , wgt, wgt_lo, wgt_hi);
|
678 |
|
|
fillHist( cs, channel, type, "pt_l2" , lep2.vec.Pt() , wgt, wgt_lo, wgt_hi);
|
679 |
|
|
fillHist( cs, channel, type, "pt_l3" , lep3.vec.Pt() , wgt, wgt_lo, wgt_hi);
|
680 |
|
|
fillHist( cs, channel, type, "pt_l4" , lep4.vec.Pt() , wgt, wgt_lo, wgt_hi);
|
681 |
|
|
fillHist( cs, channel, type, "eta_l1" , lep1.vec.Eta() , wgt, wgt_lo, wgt_hi);
|
682 |
|
|
fillHist( cs, channel, type, "eta_l2" , lep2.vec.Eta() , wgt, wgt_lo, wgt_hi);
|
683 |
|
|
fillHist( cs, channel, type, "eta_l3" , lep3.vec.Eta() , wgt, wgt_lo, wgt_hi);
|
684 |
|
|
fillHist( cs, channel, type, "eta_l4" , lep4.vec.Eta() , wgt, wgt_lo, wgt_hi);
|
685 |
|
|
fillHist( cs, channel, type, "dR_l3l4_lo",dr(lep3,lep4), wgt, wgt_lo, wgt_hi);
|
686 |
|
|
fillHist( cs, channel, type, "dR_l3l4", dr(lep3,lep4), wgt, wgt_lo, wgt_hi);
|
687 |
|
|
}
|
688 |
|
|
//----------------------------------------------------------------------------------------
|
689 |
|
|
void fillAllJetHists( FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
|
690 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
|
691 |
|
|
FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
|
692 |
|
|
double wgt, double wgt_lo, double wgt_hi)
|
693 |
|
|
{
|
694 |
|
|
double fMVAval = (ctrl.uncert=="") ? 0 : fusion.reader->EvaluateMVA("BDTG");
|
695 |
|
|
dr_struct drs = fill_dr_struct(goodJets,lep1,lep2,lep3,lep4);
|
696 |
|
|
drs.check();
|
697 |
|
|
fillHist( cs, channel, type, "pt_j1" , ji.ptJet1, wgt, wgt_lo, wgt_hi);
|
698 |
|
|
fillHist( cs, channel, type, "pt_j2" , ji.ptJet2, wgt, wgt_lo, wgt_hi);
|
699 |
|
|
fillHist( cs, channel, type, "pt_j3" , ji.ptJet3, wgt, wgt_lo, wgt_hi);
|
700 |
|
|
fillHist( cs, channel, type, "pt_j4" , ji.ptJet4, wgt, wgt_lo, wgt_hi);
|
701 |
|
|
fillHist( cs, channel, type, "eta_j1" , ji.etaJet1, wgt, wgt_lo, wgt_hi);
|
702 |
|
|
fillHist( cs, channel, type, "eta_j2" , ji.etaJet2, wgt, wgt_lo, wgt_hi);
|
703 |
|
|
fillHist( cs, channel, type, "eta_j3" , ji.etaJet3, wgt, wgt_lo, wgt_hi);
|
704 |
|
|
fillHist( cs, channel, type, "eta_j4" , ji.etaJet4, wgt, wgt_lo, wgt_hi);
|
705 |
|
|
fillHist( cs, channel, type, "phi_j1" , ji.phiJet1, wgt, wgt_lo, wgt_hi);
|
706 |
|
|
fillHist( cs, channel, type, "phi_j2" , ji.phiJet2, wgt, wgt_lo, wgt_hi);
|
707 |
|
|
fillHist( cs, channel, type, "phi_j3" , ji.phiJet3, wgt, wgt_lo, wgt_hi);
|
708 |
|
|
fillHist( cs, channel, type, "phi_j4" , ji.phiJet4, wgt, wgt_lo, wgt_hi);
|
709 |
|
|
fillHist( cs, channel, type, "idmva_j1", ji.mvaJet1, wgt, wgt_lo, wgt_hi);
|
710 |
|
|
fillHist( cs, channel, type, "idmva_j2", ji.mvaJet2, wgt, wgt_lo, wgt_hi);
|
711 |
|
|
fillHist( cs, channel, type, "idmva_j3", ji.mvaJet3, wgt, wgt_lo, wgt_hi);
|
712 |
|
|
fillHist( cs, channel, type, "idmva_j4", ji.mvaJet4, wgt, wgt_lo, wgt_hi);
|
713 |
|
|
fillHist( cs, channel, type, "mjj" , ji.mjj, wgt, wgt_lo, wgt_hi);
|
714 |
|
|
fillHist( cs, channel, type, "dEta" , ji.dEta, wgt, wgt_lo, wgt_hi);
|
715 |
|
|
fillHist( cs, channel, type, "etaProd", ji.etaProd, wgt, wgt_lo, wgt_hi);
|
716 |
|
|
fillHist( cs, channel, type, "njets" , goodJets.size(), wgt, wgt_lo, wgt_hi);
|
717 |
|
|
fillHist( cs, channel, type, "dR_l1j1", drs.l1j1, wgt, wgt_lo, wgt_hi);
|
718 |
|
|
fillHist( cs, channel, type, "dR_l2j1", drs.l2j1, wgt, wgt_lo, wgt_hi);
|
719 |
|
|
fillHist( cs, channel, type, "dR_l3j1", drs.l3j1, wgt, wgt_lo, wgt_hi);
|
720 |
|
|
fillHist( cs, channel, type, "dR_l4j1", drs.l4j1, wgt, wgt_lo, wgt_hi);
|
721 |
|
|
fillHist( cs, channel, type, "dR_l1j2", drs.l1j2, wgt, wgt_lo, wgt_hi);
|
722 |
|
|
fillHist( cs, channel, type, "dR_l2j2", drs.l2j2, wgt, wgt_lo, wgt_hi);
|
723 |
|
|
fillHist( cs, channel, type, "dR_l3j2", drs.l3j2, wgt, wgt_lo, wgt_hi);
|
724 |
|
|
fillHist( cs, channel, type, "dR_l4j2", drs.l4j2, wgt, wgt_lo, wgt_hi);
|
725 |
|
|
fillHist( cs, channel, type, "dR_l1j3", drs.l1j3, wgt, wgt_lo, wgt_hi);
|
726 |
|
|
fillHist( cs, channel, type, "dR_l2j3", drs.l2j3, wgt, wgt_lo, wgt_hi);
|
727 |
|
|
fillHist( cs, channel, type, "dR_l3j3", drs.l3j3, wgt, wgt_lo, wgt_hi);
|
728 |
|
|
fillHist( cs, channel, type, "dR_l4j3", drs.l4j3, wgt, wgt_lo, wgt_hi);
|
729 |
|
|
fillHist( cs, channel, type, "dR_l1j4", drs.l1j4, wgt, wgt_lo, wgt_hi);
|
730 |
|
|
fillHist( cs, channel, type, "dR_l2j4", drs.l2j4, wgt, wgt_lo, wgt_hi);
|
731 |
|
|
fillHist( cs, channel, type, "dR_l3j4", drs.l3j4, wgt, wgt_lo, wgt_hi);
|
732 |
|
|
fillHist( cs, channel, type, "dR_l4j4", drs.l4j4, wgt, wgt_lo, wgt_hi);
|
733 |
|
|
|
734 |
|
|
fillHist( cs, channel, type, "fusionMVA_lo", fMVAval, wgt, wgt_lo, wgt_hi);
|
735 |
|
|
fillHist( cs, channel, type, "fusionMVA_med",fMVAval, wgt, wgt_lo, wgt_hi);
|
736 |
|
|
fillHist( cs, channel, type, "fusionMVA_hi", fMVAval, wgt, wgt_lo, wgt_hi);
|
737 |
|
|
fillHist( cs, channel, type, "fusionMVA", fMVAval, wgt, wgt_lo, wgt_hi);
|
738 |
|
|
if(fMVAval > -.3) {
|
739 |
|
|
fillHist( cs, channel, type, "m4l_jet_lo", kine.m4l , wgt, wgt_lo, wgt_hi);
|
740 |
|
|
fillHist( cs, channel, type, "m4l_jet", kine.m4l , wgt, wgt_lo, wgt_hi);
|
741 |
|
|
}
|
742 |
|
|
}
|
743 |
|
|
//----------------------------------------------------------------------------------------
|
744 |
|
|
bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
|
745 |
|
|
unsigned lep2matchBits, unsigned lep3matchBits,
|
746 |
|
|
unsigned lep4matchBits)
|
747 |
|
|
{
|
748 |
|
|
bool pass=false;
|
749 |
|
|
bool onePassedButWasOutside=false;
|
750 |
|
|
bitset<30> firedBits(info->status);
|
751 |
|
|
if(ctrl.debug) cout << setw(12) << info->run << setw(12) << info->evt << setw(65) << firedBits <<endl;
|
752 |
|
|
for(unsigned ibit=0; ibit<ti.trigBits.size(); ibit++) {
|
753 |
|
|
bool outsideRunRange=false;
|
754 |
|
|
if(info->run < ti.minRuns[ibit] || info->run > ti.maxRuns[ibit]) {
|
755 |
|
|
outsideRunRange = true;
|
756 |
|
|
}
|
757 |
|
|
int baconBit = ti.trigBits[ibit];
|
758 |
|
|
bool passBit = firedBits.test(ibit);
|
759 |
|
|
if(ctrl.debug) cout << " ibit: " << setw(4) << ibit << " (bacon bit: " << baconBit << ") fired: " << passBit << endl;
|
760 |
|
|
if(ctrl.debug && passBit && outsideRunRange) cout << " would have passed but it's outside run range (" << ti.minRuns[ibit] << "," << ti.maxRuns[ibit] << ")" << endl;
|
761 |
|
|
if(passBit && outsideRunRange) {
|
762 |
|
|
onePassedButWasOutside = true;
|
763 |
|
|
}
|
764 |
|
|
if(passBit && !outsideRunRange) pass = true;
|
765 |
|
|
}
|
766 |
|
|
if(!pass && onePassedButWasOutside) cout << "WARNING: would have passed, but one was outside its run range" << endl;
|
767 |
|
|
return pass;
|
768 |
|
|
}
|
769 |
|
|
//----------------------------------------------------------------------------------------
|
770 |
|
|
dr_struct fill_dr_struct(vector<SimpleLepton> jets, SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4)
|
771 |
|
|
{
|
772 |
|
|
dr_struct drs;
|
773 |
|
|
if(jets.size() > 0) {
|
774 |
|
|
drs.l1j1 = dr(lep1,jets[0]);
|
775 |
|
|
drs.l2j1 = dr(lep2,jets[0]);
|
776 |
|
|
drs.l3j1 = dr(lep3,jets[0]);
|
777 |
|
|
drs.l4j1 = dr(lep4,jets[0]);
|
778 |
|
|
}
|
779 |
|
|
if(jets.size() > 1) {
|
780 |
|
|
drs.l1j2 = dr(lep1,jets[1]);
|
781 |
|
|
drs.l2j2 = dr(lep2,jets[1]);
|
782 |
|
|
drs.l3j2 = dr(lep3,jets[1]);
|
783 |
|
|
drs.l4j2 = dr(lep4,jets[1]);
|
784 |
|
|
}
|
785 |
|
|
if(jets.size() > 2) {
|
786 |
|
|
drs.l1j3 = dr(lep1,jets[2]);
|
787 |
|
|
drs.l2j3 = dr(lep2,jets[2]);
|
788 |
|
|
drs.l3j3 = dr(lep3,jets[2]);
|
789 |
|
|
drs.l4j3 = dr(lep4,jets[2]);
|
790 |
|
|
}
|
791 |
|
|
if(jets.size() > 3) {
|
792 |
|
|
drs.l1j4 = dr(lep1,jets[3]);
|
793 |
|
|
drs.l2j4 = dr(lep2,jets[3]);
|
794 |
|
|
drs.l3j4 = dr(lep3,jets[3]);
|
795 |
|
|
drs.l4j4 = dr(lep4,jets[3]);
|
796 |
|
|
}
|
797 |
|
|
return drs;
|
798 |
|
|
}
|
799 |
|
|
//----------------------------------------------------------------------------------------
|
800 |
|
|
void init_cuts( vector<TString> &cutstrs, map<TString,int> &cutvec)
|
801 |
|
|
{
|
802 |
|
|
cutstrs.push_back("start" ); cutvec["start"] = 0;
|
803 |
|
|
cutstrs.push_back("rlrmAndDupl" ); cutvec["rlrmAndDupl"] = 0;
|
804 |
|
|
// cutstrs.push_back("skim" ); cutvec["skim"] = 0;
|
805 |
|
|
cutstrs.push_back("4lsele" ); cutvec["4lsele"] = 0;
|
806 |
|
|
cutstrs.push_back("twoJets" ); cutvec["twoJets"] = 0;
|
807 |
|
|
cutstrs.push_back("twoJetsAfter" ); cutvec["twoJetsAfter"] = 0;
|
808 |
|
|
cutstrs.push_back("filling" ); cutvec["filling"] = 0;
|
809 |
|
|
cutstrs.push_back("fillPass" ); cutvec["fillPass"] = 0;
|
810 |
|
|
}
|
811 |
|
|
//----------------------------------------------------------------------------------------
|
812 |
|
|
bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
|
813 |
|
|
SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4)
|
814 |
|
|
{
|
815 |
|
|
int nHighPtJets=0,nLowPtJets=0;
|
816 |
|
|
for(unsigned ijet=0; ijet<fs->jets->size(); ijet++) {
|
817 |
|
|
SimpleLepton *jet = &((*fs->jets)[ijet]);
|
818 |
|
|
if(dr(*jet,lep1) < 0.2) continue;
|
819 |
|
|
if(dr(*jet,lep2) < 0.2) continue;
|
820 |
|
|
if(dr(*jet,lep3) < 0.2) continue;
|
821 |
|
|
if(dr(*jet,lep4) < 0.2) continue;
|
822 |
|
|
if(!(jet->status.passPre())) continue;
|
823 |
|
|
if(!jet->isLoose) continue;
|
824 |
|
|
if(fabs(jet->vec.Eta()) > 4.5) continue;
|
825 |
|
|
goodJets.push_back(*jet);
|
826 |
|
|
if(jet->vec.Pt() > 40) nHighPtJets++;
|
827 |
|
|
if(jet->vec.Pt() > 20) nLowPtJets++;
|
828 |
|
|
}
|
829 |
|
|
sort( goodJets.begin(), goodJets.end(), SimpleLepton::lep_pt_sort ); // note: they're not sorted, 'cause jet corrections were applied in applyZPlusX
|
830 |
|
|
if((goodJets.size()>0 && nHighPtJets<1) || // require pt > 40,20 if the jets are there
|
831 |
|
|
(goodJets.size()>1 && nLowPtJets<2))
|
832 |
|
|
return false;
|
833 |
|
|
else
|
834 |
|
|
return true;
|
835 |
|
|
}
|
836 |
|
|
// double mjj=0,dEta=0,etaProd=0,nCentralJets=0;
|
837 |
|
|
// if(jet1 && jet2) {
|
838 |
|
|
// cutvec["twoJets"] += 1;
|
839 |
|
|
// if(ctrl.debug) cout << "looping through " << goodJets.size() << " good jets" << endl;
|
840 |
|
|
// if(ctrl.debug) {cout << "jet 1 (" << jet1 << "): "; jet1->print();}
|
841 |
|
|
// if(ctrl.debug) {cout << "jet 2 (" << jet2 << "): "; jet2->print();}
|
842 |
|
|
// for(unsigned ijet=0; ijet<goodJets.size(); ijet++) {
|
843 |
|
|
// SimpleLepton *jet = goodJets[ijet];
|
844 |
|
|
// if(jet == jet1) {
|
845 |
|
|
// if(ctrl.debug) cout << " " << jet << " this is jet 1" << endl;
|
846 |
|
|
// continue;
|
847 |
|
|
// }
|
848 |
|
|
// if(jet == jet2) {
|
849 |
|
|
// if(ctrl.debug) cout << " " << jet << " this is jet 2" << endl;
|
850 |
|
|
// continue;
|
851 |
|
|
// }
|
852 |
|
|
// double eta = jet->vec.Eta();
|
853 |
|
|
// double eta1 = jet1->vec.Eta();
|
854 |
|
|
// double eta2 = jet2->vec.Eta();
|
855 |
|
|
// if(eta1 > eta2) {
|
856 |
|
|
// if(eta > eta2 && eta < eta1)
|
857 |
|
|
// nCentralJets++;
|
858 |
|
|
// } else if(eta2 > eta1) {
|
859 |
|
|
// if(eta > eta1 && eta < eta2)
|
860 |
|
|
// nCentralJets++;
|
861 |
|
|
// }
|
862 |
|
|
// if(ctrl.debug) cout << " nCentralJets: " << nCentralJets << endl;
|
863 |
|
|
// }
|
864 |
|
|
// double mjjMin = 400;
|
865 |
|
|
// double dEtaMin = 4;
|
866 |
|
|
// TLorentzVector dijet(jet1->vec + jet2->vec);
|
867 |
|
|
// mjj = dijet.M();
|
868 |
|
|
// if(ctrl.debug) cout << "setting mjj: " << mjj << "(using " << jet1->vec.Pt() << " " << jet2->vec.Pt() << endl;
|
869 |
|
|
// dEta = jet1->vec.Eta() - jet2->vec.Eta();
|
870 |
|
|
// etaProd = jet1->vec.Eta()*jet2->vec.Eta();
|
871 |
|
|
// bool isVbf = (mjj > mjjMin) && (fabs(dEta) > dEtaMin) && (etaProd < 0) && (nCentralJets==0);
|
872 |
|
|
// }
|
873 |
|
|
|