ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/NonMCBackground/src/plotSignalFakes.cc
Revision: 1.6
Committed: Tue Oct 23 11:22:41 2012 UTC (12 years, 6 months ago) by dkralph
Content type: text/plain
Branch: MAIN
Changes since 1.5: +181 -45 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
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.5 #include "TROOT.h"
13 dkralph 1.1
14     #include "CPlot.h"
15     #include "FOArgs.h"
16    
17     #include "fake_defs.h"
18     #include "Various.h"
19     #include "CommonDefs.h"
20     #include "PlotHeaders.h"
21 dkralph 1.3 #include "TriggerUtils.h"
22     #include "JetDefs.h"
23     #include "JetInfoStruct.h"
24 dkralph 1.5 #include "FR_struct.h"
25     #include "SelectionFuncs.h"
26     #include "SampleWeight.h"
27 dkralph 1.6 #include "MitStyleRemix.h"
28 dkralph 1.3
29     #include "TMVA/Reader.h"
30     #include "TMVA/Tools.h"
31     #include "TMVA/Config.h"
32     #include "TMVA/MethodBDT.h"
33 dkralph 1.1
34     #ifndef CMSSW_BASE
35     #define CMSSW_BASE "../../"
36     #endif
37    
38     using namespace std;
39     using namespace RooFit;
40     using namespace mithep;
41    
42 dkralph 1.6 // TH1D* hpu_2011;
43     // TH1D* hpu_2012;
44     // TH1D* hpu_2011_me;
45     // TH1D* hpu_2012_me;
46 dkralph 1.4 //----------------------------------------------------------------------------------------
47 dkralph 1.1 TCanvas *can;
48 dkralph 1.3
49 dkralph 1.6 TString dummy_integral_str(TH1D *hist, int nDecPlaces) { return TString(""); };
50 dkralph 1.3 bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
51     SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
52 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);
53 dkralph 1.6 void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine, Angles angles,
54 dkralph 1.3 SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
55     double wgt, double wgt_lo=0, double wgt_hi=0);
56     void fillAllJetHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
57     SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
58     FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
59     double wgt, double wgt_lo=0, double wgt_hi=0);
60 dkralph 1.6 void makeHTML(FOFlags &ctrl, TString type, TString plotLabel, TString fullOutDir);
61 dkralph 1.1 map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str="");
62 dkralph 1.3 bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
63     unsigned lep2matchBits, unsigned lep3matchBits,
64     unsigned lep4matchBits);
65     void init_cuts(vector<TString> &cutstrs, map<TString,int> &cutvec);
66     void resetCutVect(map<TString,int> &cutvec) {
67     for(map<TString,int>::iterator it=cutvec.begin(); it!=cutvec.end(); it++)
68     cutvec[(*it).first] = 0;
69     }
70 dkralph 1.4 map<TString,TH1D*> setHistSet(CSample *cs, TString type, TString var);
71     void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight);
72 dkralph 1.5 void incrementSsofCounters(FOFlags &ctrl, filestuff *fs, double minMz2,
73     pair<int,int> *best_z_indices, double wgt);
74     map<TString,double> init_counter(TString fname="");
75     map<TString,double> initSsofRatios(vector<CSample*> &samplev);
76     double getSsofWgt(TString channel, map<TString,double> &ssofRatios);
77 dkralph 1.1 //----------------------------------------------------------------------------------------
78     int main(int argc, char** argv)
79     {
80 dkralph 1.6 SetStyle();
81 dkralph 1.4 initPUWeights();
82 dkralph 1.6 ControlFlags dummyCtrl;
83     // TFile * puf_me;
84     // puf_me = new TFile("data/pileup/PUWeights_S12To2012_190456-199011.root");
85     // hpu_2012_me = (TH1D*)(puf_me->Get("puWeights"));
86     // hpu_2012_me->SetDirectory(0);
87     // puf_me->Close();
88     // puf_me = new TFile("data/pileup/PUWeights_F11To2011.root");
89     // hpu_2011_me = (TH1D*)(puf_me->Get("puWeights"));
90     // hpu_2011_me->SetDirectory(0);
91     // puf_me->Close();
92 dkralph 1.5
93 dkralph 1.3 vector<TString> cutstrs;
94     map<TString,int> cutvec;
95     init_cuts(cutstrs, cutvec);
96 dkralph 1.1
97 dkralph 1.4 // arguments...
98 dkralph 1.1 FOFlags ctrl;
99     parse_foargs( argc, argv, ctrl );
100     ctrl.dump();
101 dkralph 1.3 FusionMva fusion(ctrl.uncert);//"./weights/againstZZ-fusion_BDTG.weights.xml");
102 dkralph 1.4 bool makeJetTuple=false; // jet tuple for vbf mva training
103     assert(ctrl.faketype=="SR" || // plot events in signal region, if requested including ntuples of the extrapolation from 2P2F and 3P1F regions
104     ctrl.faketype=="2P2F" || // plot 2P2F region, and if requested write out ntuple which gives extrapolation to SR (ntuple would then be read by "SR", above)
105     ctrl.faketype=="3P1F"); // plot 3P1F region (including the extrapolation to there from the 2P2F region), and if requested write out ntuple with SR prediction
106     if(ctrl.heavyFlavor) assert(ctrl.faketype=="2P2F");
107     if(ctrl.ssof) assert(ctrl.faketype=="2P2F");
108 dkralph 1.1
109 dkralph 1.6 can = new TCanvas("can","can",700,500);
110 dkralph 1.1
111 dkralph 1.5 FR_struct fr2011(ctrl.mufakefile2011,ctrl.elefakefile2011);
112     FR_struct fr2012(ctrl.mufakefile2012,ctrl.elefakefile2012);
113 dkralph 1.1
114     TString cmsswpath(CMSSW_BASE + TString("/src"));
115     string xspath = (string(cmsswpath)+"/MitPhysics/data/xs.dat");
116     SimpleTable xstab(xspath.c_str());
117    
118 dkralph 1.3 TrigInfo ti;
119     initAnalysisTriggers(ti);
120    
121 dkralph 1.1 vector<CSample*> samplev;
122     TString ntupledir(""),label(""),plotLabel(""),jsonFile("");
123 dkralph 1.2 int puTarget;
124     readConfigFile(ctrl.config, ntupledir, label, plotLabel, jsonFile, puTarget, samplev, &ctrl, init_hists);
125 dkralph 1.5 map<TString,double> ssofRatios;
126     if(ctrl.ssof && !ctrl.writessofratio && !ctrl.plotWholeSample) ssofRatios = initSsofRatios(samplev);
127 dkralph 1.1
128 dkralph 1.6 Angles angles; // NOTE: this is not the same as fs->angles -- the one in fs is filled with whichever choice of leptons was made in applyZPlusX
129 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
130     JetInfoStruct ji;
131    
132 dkralph 1.1 UInt_t minRun=999999999,maxRun=0;
133     for(unsigned ics=0; ics<samplev.size(); ics++) {
134     CSample *cs = samplev[ics];
135     cout << cs->name << endl;
136 dkralph 1.3
137     // output for vbf mva training
138     unsigned evtVar;
139     AngleTuple *jettuple;
140     if(makeJetTuple) {
141     jettuple = new AngleTuple( (const char*)(TString(cs->name)+"_pass.root").Data(), (const char*)"zznt");
142 dkralph 1.6 jettuple->makeAngleBranch(angles);
143 dkralph 1.3 jettuple->makeKinematicsBranch(kine);
144     jettuple->makeJetInfoBranch(ji);
145     const char *str1 = "evt";
146     const char *str2 = "evt/i";
147     jettuple->makeBranch(str1,(void *)(&evtVar),str2);
148     }
149    
150     vector<pair<unsigned,unsigned> > runEvtv; // vector to veto duplicate events
151     resetCutVect(cutvec);
152 dkralph 1.1 for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
153     filestuff *fs = (cs->fsv)[ifs];
154 dkralph 1.6 if(ctrl.makeFakeTuples && fs->dataset_!="fakes") { // write a copy of the input trees for events that will be used for the SR fake prediction
155 dkralph 1.3 TString fakefilename(fs->fname_);
156     fakefilename.ReplaceAll(".root","-fakes.root");
157 dkralph 1.6 if(ctrl.hiStatFakes) fakefilename.ReplaceAll("-fakes.root","-fakes-histat.root");
158 dkralph 1.3 fs->makeOutputFile(fakefilename);
159     }
160 dkralph 1.4 cout << "\t" << fs->fname_; cout.flush();
161 dkralph 1.1 unsigned nDuplSkipped=0;
162     for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
163 dkralph 1.4 fs->getentry(ientry,"FOs","FOtree");
164     fs->getentry(ientry,"Zleptons","FOtree");
165 dkralph 1.1 fs->getentry(ientry,"info","zznt");
166 dkralph 1.4
167 dkralph 1.3 cutvec["start"] = fs->total_entries_;
168     if(fs->isdata_) {// && !(fs->dataset_=="fakes")) {
169     // 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.
170     // in plotH4l I *don't* want to remove these, but here I *do*, because in this file I again loop over all z2 candidates
171 dkralph 1.1 setMinMaxRun(fs->info->run, minRun, maxRun);
172     bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, runEvtv, nDuplSkipped);
173 dkralph 1.5 if(dupl) continue;
174     if(!fs->rlrm_.HasRunLumi(pair<unsigned,unsigned> (fs->info->run, fs->info->lumi))) continue;
175 dkralph 1.1 }
176 dkralph 1.3 cutvec["rlrmAndDupl"] += 1;
177 dkralph 1.1
178     double wgt=1;
179     if(!fs->isdata_) {
180 dkralph 1.3 double xsWgt = fs->lumi_*xstab.Get(fs->dataset_)/fs->total_entries_;
181 dkralph 1.6 cout << "WARNING: check the pu weihgs funciton here" << endl;
182     double puWgt = getPUWeight(fs->era_, "/029/", fs->info->npu);
183     // if(fs->era_==2012)
184     // puWgt = hpu_2012_me->GetBinContent(hpu_2012_me->FindBin(fs->info->npu));
185     // else if(fs->era_==2011)
186     // puWgt = hpu_2011_me->GetBinContent(hpu_2011_me->FindBin(fs->info->npu));
187     // else assert(0);
188 dkralph 1.4 wgt = xsWgt*puWgt;
189 dkralph 1.5 if(wgt!=wgt) cout << "xsWgt: " << xsWgt << " puWgt: " << puWgt << endl;
190 dkralph 1.1 }
191 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)
192     fs->getentry(ientry,"weights","zznt");
193     wgt = fs->weights->w;
194     }
195 dkralph 1.1
196     unsigned npass = fs->passingL->size();
197     unsigned nfail = fs->failingL->size();
198    
199 dkralph 1.3 // look for a z1
200 dkralph 1.1 pair<int,int> best_z_indices;
201 dkralph 1.3 double best_mz1 = findZ1(fs->passingL,best_z_indices,40);
202     if(best_mz1<=0) {
203     cout << "WARNING: best z1 mass: " << best_mz1 << endl;
204     }
205 dkralph 1.5 if(ctrl.heavyFlavor && best_mz1<60) continue;
206 dkralph 1.1 EventData evtdata;
207     evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
208     evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
209    
210     // Look for a z2
211     vector<pair<SimpleLepton,SimpleLepton> > z2cands;
212     vector<TString> types;
213 dkralph 1.4 TString signFlavor;
214 dkralph 1.6 if(ctrl.heavyFlavor) signFlavor = "";
215     else if(ctrl.ssof) signFlavor = "SS-SF";
216     else if(ctrl.hiStatFakes) signFlavor = "signalExclude";
217     else signFlavor = "OS-SF";
218 dkralph 1.4 double minMz2 = ctrl.heavyFlavor ? 0 : 12;
219     int hiPtPassingZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "pass",&best_z_indices); // signal region
220     int hiPtFailingZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, signFlavor, minMz2, "fail"); // 2P+2F
221     int hiPtPfZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "PF", &best_z_indices, fs->failingL); // 3P+1F
222    
223 dkralph 1.5 if(ctrl.writessofratio) incrementSsofCounters(ctrl, fs, minMz2, &best_z_indices, wgt);
224 dkralph 1.3
225 dkralph 1.1 for(unsigned iz2=0; iz2<z2cands.size(); iz2++) {
226     SimpleLepton lep1 = evtdata.Z1leptons[0];
227     SimpleLepton lep2 = evtdata.Z1leptons[1];
228     SimpleLepton lep3 = z2cands[iz2].first;
229     SimpleLepton lep4 = z2cands[iz2].second;
230     evtdata.Z2leptons.clear();
231     evtdata.Z2leptons.push_back(lep3);
232     evtdata.Z2leptons.push_back(lep4);
233 dkralph 1.6 fillAngles(evtdata,angles);
234 dkralph 1.1 fillKinematics(evtdata,kine);
235 dkralph 1.4 lepFrs fwgts;
236 dkralph 1.5 fillLeptonFakeWeights(fwgts, (fs->era_==2011) ? &fr2011 : &fr2012, lep3, lep4);
237 dkralph 1.4 TString channel = getChannel(lep1,lep2,lep3,lep4);
238     // bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.scID,lep2.scID,lep3.scID,lep4.scID) : true;
239    
240     if(ctrl.heavyFlavor) {
241 dkralph 1.5 if(fabs(lep1.dz) > 0.01 || fabs(lep2.dz) > 0.01) continue;
242 dkralph 1.4 if( !(fabs(lep3.ip3dSig) > 2 && fabs(lep4.ip3dSig) > 8) &&
243 dkralph 1.5 !(fabs(lep4.ip3dSig) > 2 && fabs(lep3.ip3dSig) > 8) ) continue;
244 dkralph 1.4 if( !(fabs(lep3.d0) > .002 && fabs(lep4.d0) > .01) &&
245 dkralph 1.5 !(fabs(lep4.d0) > .002 && fabs(lep3.d0) > .01) ) continue;
246     if(fabs(lep3.d0) > 0.1 || fabs(lep4.d0) > 0.1) continue;
247     if(fabs(lep3.dz) > 0.2 || fabs(lep4.dz) > 0.2) continue;
248 dkralph 1.4 } else {
249 dkralph 1.5 if(fabs(lep3.ip3dSig) >= 4 || fabs(lep4.ip3dSig) >= 4) continue; // |sip| < 4 is applied to lep1, lep2 in ZPlusX
250     if(!leptonDrReqs(lep1,lep2,lep3,lep4)) continue;
251     if(kine.m4l < 100) continue;
252     if(!resonanceKilling(lep1,lep2,lep3,lep4)) continue;
253 dkralph 1.4 }
254 dkralph 1.5 if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4)) continue;
255 dkralph 1.1
256 dkralph 1.3 cutvec["4lsele"] += 1;
257 dkralph 1.1
258 dkralph 1.3 //
259     // jets!
260     //
261 dkralph 1.4 bool doJets=false;
262 dkralph 1.3 vector<SimpleLepton> goodJets;
263     if(doJets) {
264 dkralph 1.4 fs->getentry(ientry,"jets","FOtree");
265 dkralph 1.3 if(fs->jets->size() > 1) cutvec["twoJets"] += 1;
266     bool hazJetz = findGoodJets(goodJets, fs, lep1, lep2, lep3, lep4);
267     if(goodJets.size() > 1) cutvec["twoJetsAfter"] += 1;
268 dkralph 1.5 if(!hazJetz) continue;
269 dkralph 1.3 ControlFlags ctrlTmp;
270     fillJetInfo(goodJets,ji,ctrlTmp);
271     if(makeJetTuple) {
272     evtVar = fs->info->evt;
273     jettuple->Fill();
274     }
275 dkralph 1.4 fusion.setValues(ji,kine);
276 dkralph 1.3 }
277 dkralph 1.5
278 dkralph 1.3 cutvec["filling"] += 1;
279    
280 dkralph 1.4 if(types[iz2]=="pass" || ((fs->dataset_=="fakes") && (types[iz2]=="fail"))) { // for the fakes ntuple, we plot the "failing" z2s as passing ones, i.e. put them in hObs, but with the proper weight
281     // llll events
282 dkralph 1.5 if((fs->dataset_!="fakes") && (iz2!=hiPtPassingZ2)) continue; // for non-fakes, we only want the highest-pt "passing" z2 (for the fakes these are by design failing z2s, and we want all of 'em)
283 dkralph 1.3 cutvec["fillPass"] += 1;
284 dkralph 1.6 fillAllHists( ctrl, cs, channel, "obs", fs, kine, angles, lep1, lep2, lep3, lep4, wgt);
285 dkralph 1.4 if(doJets) fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
286    
287     } else if(types[iz2]=="fail") { // lljj events
288 dkralph 1.5 if(iz2!=hiPtFailingZ2 && ctrl.plotWholeSample) continue;
289 dkralph 1.4 double centr=0,lo=0,hi=0;
290     if(ctrl.faketype=="2P2F") {
291     if(ctrl.plotWholeSample) { // make plots without weighting with the FR
292     centr = wgt;
293     } else {
294     centr = wgt*fwgts.fwgt_3*fwgts.fwgt_4;
295     lo = wgt*fwgts.fwgt_lo_3*fwgts.fwgt_lo_4;
296     hi = wgt*fwgts.fwgt_hi_3*fwgts.fwgt_hi_4;
297 dkralph 1.5 if(ctrl.ssof && !ctrl.writessofratio && !ctrl.plotWholeSample) {
298     double ssof_wgt = getSsofWgt(channel,ssofRatios);
299     centr *= ssof_wgt;
300     lo *= ssof_wgt;
301     hi *= ssof_wgt;
302     }
303 dkralph 1.4 }
304     } else if(ctrl.faketype=="3P1F") { // apply the weights for extrapolation from 2P2F region to 3P1F region
305     centr = wgt*(fwgts.fwgt_3 + fwgts.fwgt_4);
306     lo = wgt*(fwgts.fwgt_lo_3 + fwgts.fwgt_lo_4);
307     hi = wgt*(fwgts.fwgt_hi_3 + fwgts.fwgt_hi_4);
308 dkralph 1.3 }
309 dkralph 1.4
310 dkralph 1.6 if(ctrl.makeFakeTuples && fs->dataset_!="fakes") {
311 dkralph 1.4 double fillwgt;
312     bool dofill=true;
313     if(ctrl.faketype=="2P2F") {
314     assert(fs->isdata_);
315     fillwgt = centr;
316     } else if(ctrl.faketype=="3P1F") {
317     fillwgt = - wgt*(fwgts.fwgt_3*fwgts.fwgt_4 + fwgts.fwgt_4*fwgts.fwgt_3);
318     dofill = (cs->name=="data" || cs->name=="2012" || cs->name=="2011");
319     } else assert(0);
320     fillFakeTuple(cs,fs,evtdata,ientry,fillwgt);
321 dkralph 1.3 }
322 dkralph 1.4 cutvec["fillFail"] += 1;
323 dkralph 1.6 fillAllHists( ctrl, cs, channel, "pred", fs, kine, angles, lep1, lep2, lep3, lep4, centr, lo, hi);
324 dkralph 1.4 if(doJets) fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, centr, lo, hi);
325    
326     } else if(types[iz2]=="PF") { // lllj events
327     if(fs->dataset_!="fakes" && iz2!=hiPtPfZ2) continue; // shouldn't have this when I extrapolate to signal region
328 dkralph 1.3
329 dkralph 1.6 if(ctrl.makeFakeTuples && fs->dataset_!="fakes" && ctrl.faketype=="3P1F") {
330 dkralph 1.4 assert(lep3.isLoose || lep4.isLoose);
331     assert(!(lep3.isLoose && lep4.isLoose));
332     double fwgt = lep3.isLoose ? fwgts.fwgt_4 : fwgts.fwgt_3;
333     double fillwgt;// only fill for data or ZZ
334     if(fs->isdata_) fillwgt = wgt*fwgt; // set the weight to be the fake weight (maybe check that this is the same weight as I read in from the fakes dataset?)
335     else if(cs->name=="zz") fillwgt = -wgt*fwgt; // subtract off the zz contribution in the 3P1F region
336     else assert(0);
337     fillFakeTuple(cs,fs,evtdata,ientry,fillwgt);
338 dkralph 1.3 }
339 dkralph 1.4
340     cutvec["fillPF"] += 1;
341 dkralph 1.6 fillAllHists( ctrl, cs, channel, "PF", fs, kine, angles, lep1, lep2, lep3, lep4, wgt);
342 dkralph 1.4 if(doJets) fillAllJetHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
343 dkralph 1.1 } else assert(0);
344     }
345     }
346 dkralph 1.5 if(ctrl.writessofratio) fs->writeSsofRatios();
347 dkralph 1.4 cout << "\t\t" << setw(7) << nDuplSkipped << " duplicate events skipped" << endl;
348 dkralph 1.6 if(ctrl.makeFakeTuples) {
349 dkralph 1.3 fs->outFotuple->getFile()->cd();
350     fs->outFotuple->getTree()->Write();
351     fs->outtuple->WriteClose();
352     }
353 dkralph 1.5 fs->del();
354 dkralph 1.3 }
355     for(unsigned icut=0; icut<cutstrs.size(); icut++) {
356     cout << setw(22) << cutstrs[icut] << setw(22) << cutvec[cutstrs[icut]] << endl;
357 dkralph 1.1 }
358 dkralph 1.3 if(makeJetTuple)
359     jettuple->WriteClose();
360 dkralph 1.1 }
361     cout << "run range: " << setw(12) << minRun << setw(12) << maxRun << endl;
362 dkralph 1.3
363     // plot!
364 dkralph 1.1 assert(samplev.size()>0);
365     vector<TString> typev;
366     typev.push_back("all");
367 dkralph 1.4
368 dkralph 1.5 if(ctrl.plotAllCats) {
369 dkralph 1.3 typev.push_back("4e");
370     typev.push_back("4m");
371     typev.push_back("2e2m");
372     }
373 dkralph 1.4
374 dkralph 1.6 ofstream txtOutFile("fakes.txt",ios_base::app);
375     txtOutFile << "---> " << ctrl.faketype << " " << plotLabel << endl;
376 dkralph 1.4 // loop over channels
377 dkralph 1.1 for(unsigned itype=0; itype<typev.size(); itype++) {
378     TString type(typev[itype]);
379 dkralph 1.6 TString fullOutDir(ctrl.outdir+"/"+plotLabel+"/"+type);
380     gSystem->mkdir(fullOutDir,true);
381     TFile runHistFile(fullOutDir+"/runs.root","recreate");
382 dkralph 1.4 // loop over variables
383 dkralph 1.1 map<TString,TH1D*>::iterator it_v;
384     for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
385     TString var((*it_v).first);
386 dkralph 1.6 CPlot cplot(var,TString(""),(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),TString("events"),TString(fullOutDir+"/plots"));
387 dkralph 1.4 double fakeCounter=0;
388 dkralph 1.1 double ymax=0;
389 dkralph 1.4 // loop over csamples
390 dkralph 1.1 for(unsigned isam=0; isam<samplev.size(); isam++) {
391     CSample *cs = samplev[isam];
392 dkralph 1.4 map<TString,TH1D*> hs = setHistSet(cs,type,var);
393     if(var=="met") //var=="mjj" || var=="etaProd" || var=="ncj")
394     shiftOverflows(hs);
395 dkralph 1.3 bool plotShapeOnly = false;
396 dkralph 1.4 if(plotShapeOnly)
397     scaleHists(hs);
398    
399 dkralph 1.3 if(cs->isdata && !(cs->name=="fakes")) {
400 dkralph 1.5 if(ctrl.faketype=="SR" || (ctrl.heavyFlavor && !ctrl.plotWholeSample) || (ctrl.ssof && !ctrl.plotWholeSample)) {
401 dkralph 1.4 cplot.AddHist1D(hs["obs"],cs->legend+": "+integral_str(hs["obs"],0),"E");
402     ymax = max(ymax,hs["obs"]->GetMaximum());
403     }
404     if(ctrl.faketype=="2P2F") {
405     if(ctrl.plotWholeSample) {
406     cplot.AddHist1D(hs["pred"],cs->legend+": "+integral_str(hs["pred"],0),"E");
407     ymax = max(ymax,hs["pred"]->GetMaximum());
408     } else {
409 dkralph 1.5 cplot.AddHist1D(hs["pred"], TString("FR predic: "+integral_str(hs["pred"],3)), "hist",kRed);
410     cplot.AddHist1D(hs["pred_lo"], TString( "stat lo: "+integral_str(hs["pred_lo"],2)),"hist",kRed,kDashed);
411     cplot.AddHist1D(hs["pred_hi"], TString( "stat hi: "+integral_str(hs["pred_hi"],2)),"hist",kRed,kDashed);
412     if(var=="m4l") {
413 dkralph 1.6 txtOutFile << " " << type << ": " << integral_str(hs["pred"],3) << " (" << integral_str(hs["pred_lo"],2) << "," << integral_str(hs["pred_hi"],2) << ")" << endl;
414 dkralph 1.5 }
415 dkralph 1.4 ymax = max(ymax,histMax(hs["pred"],hs["pred_lo"],hs["pred_hi"]));
416     }
417     }
418     if(ctrl.faketype=="3P1F") {
419     double ratio = 0;//integrateHist(hs["PF"]) / integrateHist(hs["pred"]);
420 dkralph 1.5 cplot.AddHist1D(hs["PF"],TString(cs->legend+": "+integral_str(hs["PF"],0)+", ratio: "+f_to_a(ratio)),"E",cs->color);
421 dkralph 1.4 if(!ctrl.plotWholeSample) {
422 dkralph 1.6 cplot.AddToStack(hs["pred"],TString(cs->legend+"(2P2F extrap.): "+integral_str(hs["pred"],1)), kRed, -1);
423 dkralph 1.4 ymax = max(ymax,histMax(hs["PF"],cplot.GetStack(),hs["pred"]));
424     } else {
425     ymax = max(ymax,hs["PF"]->GetMaximum());
426     }
427     fakeCounter = integrateHist(hs["PF"]) - integrateHist(hs["pred"]);
428     }
429     } else { // mc
430     TH1D *mchist = 0;
431     if(ctrl.faketype=="SR") mchist = hs["obs"];
432     if(ctrl.faketype=="2P2F") {
433     if(ctrl.plotWholeSample) mchist = hs["pred"];
434     else mchist = hs["obs"];
435 dkralph 1.3 }
436 dkralph 1.4 if(ctrl.faketype=="3P1F") mchist = hs["PF"];
437     assert(mchist);
438     bool stackMc = true;
439 dkralph 1.6 if(stackMc) cplot.AddToStack(mchist,TString(cs->legend+": "+integral_str(mchist,2)),cs->color,-1);
440 dkralph 1.5 else cplot.AddHist1D(mchist,TString(cs->legend +": "+integral_str(mchist,3)),"Ehist",cs->color);//cs->color);
441 dkralph 1.4 if(cs->name=="zz") fakeCounter -= integrateHist(hs["PF"]);
442     ymax = max(ymax,histMax(mchist,cplot.GetStack()));
443 dkralph 1.1 }
444     if(cs->isdata && var=="run") {
445 dkralph 1.4 assert(hs["obs"]->GetBinContent(0)==0 && hs["obs"]->GetBinContent(hs["obs"]->GetXaxis()->GetNbins()+1)==0);
446     hs["obs"]->Write("runs");
447 dkralph 1.1 }
448 dkralph 1.4 if(!var.Contains("fusionMVA"))
449 dkralph 1.1 cplot.SetYRange(0,1.2*ymax);
450 dkralph 1.5 if(ctrl.faketype=="3P1F") cplot.AddTextBox(TString("diff: "+f_to_a(fakeCounter)),.7,.5,.8,.6);
451 dkralph 1.1 }
452     cplot.Draw(can,true,"png");
453 dkralph 1.4 if(var.Contains("fusionMVA")) {
454     cplot.SetLogy();
455     cplot.Draw(can,true,"png",0,var+"-log");
456     cplot.SetLogy(false);
457     }
458 dkralph 1.1 }
459     runHistFile.Close();
460 dkralph 1.6 makeHTML(ctrl,type,plotLabel,fullOutDir);
461 dkralph 1.1 }
462 dkralph 1.6 txtOutFile.close();
463    
464 dkralph 1.5 fr2011.FR_struct::~FR_struct();
465     fr2012.FR_struct::~FR_struct();
466 dkralph 1.1 }
467     //----------------------------------------------------------------------------------------
468     map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str)
469     {
470     map<TString,map<TString,TH1D*>* > hists;
471     map<TString,TH1D*> *h_4e_obs = new map<TString,TH1D*>; hists["4e_obs"] = h_4e_obs;
472     map<TString,TH1D*> *h_4e_pred = new map<TString,TH1D*>; hists["4e_pred"] = h_4e_pred;
473     map<TString,TH1D*> *h_4e_pred_lo = new map<TString,TH1D*>; hists["4e_pred_lo"] = h_4e_pred_lo;
474     map<TString,TH1D*> *h_4e_pred_hi = new map<TString,TH1D*>; hists["4e_pred_hi"] = h_4e_pred_hi;
475 dkralph 1.4 map<TString,TH1D*> *h_4e_PF = new map<TString,TH1D*>; hists["4e_PF"] = h_4e_PF;
476     map<TString,TH1D*> *h_4e_PF_lo = new map<TString,TH1D*>; hists["4e_PF_lo"] = h_4e_PF_lo;
477     map<TString,TH1D*> *h_4e_PF_hi = new map<TString,TH1D*>; hists["4e_PF_hi"] = h_4e_PF_hi;
478 dkralph 1.1 map<TString,TH1D*> *h_4m_obs = new map<TString,TH1D*>; hists["4m_obs"] = h_4m_obs;
479     map<TString,TH1D*> *h_4m_pred = new map<TString,TH1D*>; hists["4m_pred"] = h_4m_pred;
480     map<TString,TH1D*> *h_4m_pred_lo = new map<TString,TH1D*>; hists["4m_pred_lo"] = h_4m_pred_lo;
481     map<TString,TH1D*> *h_4m_pred_hi = new map<TString,TH1D*>; hists["4m_pred_hi"] = h_4m_pred_hi;
482 dkralph 1.4 map<TString,TH1D*> *h_4m_PF = new map<TString,TH1D*>; hists["4m_PF"] = h_4m_PF;
483     map<TString,TH1D*> *h_4m_PF_lo = new map<TString,TH1D*>; hists["4m_PF_lo"] = h_4m_PF_lo;
484     map<TString,TH1D*> *h_4m_PF_hi = new map<TString,TH1D*>; hists["4m_PF_hi"] = h_4m_PF_hi;
485 dkralph 1.1 map<TString,TH1D*> *h_2e2m_obs = new map<TString,TH1D*>; hists["2e2m_obs"] = h_2e2m_obs;
486     map<TString,TH1D*> *h_2e2m_pred = new map<TString,TH1D*>; hists["2e2m_pred"] = h_2e2m_pred;
487     map<TString,TH1D*> *h_2e2m_pred_lo = new map<TString,TH1D*>; hists["2e2m_pred_lo"] = h_2e2m_pred_lo;
488     map<TString,TH1D*> *h_2e2m_pred_hi = new map<TString,TH1D*>; hists["2e2m_pred_hi"] = h_2e2m_pred_hi;
489 dkralph 1.4 map<TString,TH1D*> *h_2e2m_PF = new map<TString,TH1D*>; hists["2e2m_PF"] = h_2e2m_PF;
490     map<TString,TH1D*> *h_2e2m_PF_lo = new map<TString,TH1D*>; hists["2e2m_PF_lo"] = h_2e2m_PF_lo;
491     map<TString,TH1D*> *h_2e2m_PF_hi = new map<TString,TH1D*>; hists["2e2m_PF_hi"] = h_2e2m_PF_hi;
492 dkralph 1.1 map<TString,TH1D*> *h_all_obs = new map<TString,TH1D*>; hists["all_obs"] = h_all_obs;
493     map<TString,TH1D*> *h_all_pred = new map<TString,TH1D*>; hists["all_pred"] = h_all_pred;
494     map<TString,TH1D*> *h_all_pred_lo = new map<TString,TH1D*>; hists["all_pred_lo"] = h_all_pred_lo;
495     map<TString,TH1D*> *h_all_pred_hi = new map<TString,TH1D*>; hists["all_pred_hi"] = h_all_pred_hi;
496 dkralph 1.4 map<TString,TH1D*> *h_all_PF = new map<TString,TH1D*>; hists["all_PF"] = h_all_PF;
497     map<TString,TH1D*> *h_all_PF_lo = new map<TString,TH1D*>; hists["all_PF_lo"] = h_all_PF_lo;
498     map<TString,TH1D*> *h_all_PF_hi = new map<TString,TH1D*>; hists["all_PF_hi"] = h_all_PF_hi;
499 dkralph 1.1 map<TString,map<TString,TH1D*>* >::iterator it_h;
500    
501     for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
502 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();
503 dkralph 1.6 (*((*it_h).second))["run"] = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};", 50,160800,203744/*196535*/); (*((*it_h).second))["run"]->Sumw2();
504 dkralph 1.4 (*((*it_h).second))["mZ1"] = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};", 20,40,120); (*((*it_h).second))["mZ1"]->Sumw2();
505 dkralph 1.1 (*((*it_h).second))["mZ2"] = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};", 30,0,115); (*((*it_h).second))["mZ2"]->Sumw2();
506     (*((*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();
507 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();
508     (*((*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();
509     (*((*it_h).second))["m4l"] = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};", 35,100,600); (*((*it_h).second))["m4l"]->Sumw2();
510 dkralph 1.6 // (*((*it_h).second))["Z1pt"] = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};", 20,0,200); (*((*it_h).second))["Z1pt"]->Sumw2();
511     // (*((*it_h).second))["ZZpt"] = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};", 30,0,200); (*((*it_h).second))["ZZpt"]->Sumw2();
512 dkralph 1.4 (*((*it_h).second))["met"] = new TH1D(TString("met") +"_"+(*it_h).first+str,";#bf{met [GeV]};", 30,0,100); (*((*it_h).second))["met"]->Sumw2();
513 dkralph 1.1
514     (*((*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();
515     (*((*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();
516     (*((*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();
517     (*((*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();
518    
519     (*((*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();
520     (*((*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();
521     (*((*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();
522     (*((*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();
523    
524 dkralph 1.4 (*((*it_h).second))["ip3ds_l1"] = new TH1D(TString("ip3ds_l1") +"_"+(*it_h).first+str,";#bf{ip3ds l1};",37,-3,3); (*((*it_h).second))["ip3ds_l1"]->Sumw2();
525     (*((*it_h).second))["ip3ds_l2"] = new TH1D(TString("ip3ds_l2") +"_"+(*it_h).first+str,";#bf{ip3ds l2};",37,-3,3); (*((*it_h).second))["ip3ds_l2"]->Sumw2();
526     (*((*it_h).second))["ip3ds_l3_lo"] = new TH1D(TString("ip3ds_l3_lo") +"_"+(*it_h).first+str,";#bf{ip3ds l3_lo};",25,-6,6); (*((*it_h).second))["ip3ds_l3_lo"]->Sumw2();
527     (*((*it_h).second))["ip3ds_l4_lo"] = new TH1D(TString("ip3ds_l4_lo") +"_"+(*it_h).first+str,";#bf{ip3ds l4_lo};",25,-6,6); (*((*it_h).second))["ip3ds_l4_lo"]->Sumw2();
528     (*((*it_h).second))["ip3ds_l3"] = new TH1D(TString("ip3ds_l3") +"_"+(*it_h).first+str,";#bf{ip3ds l3};",55,-40,40); (*((*it_h).second))["ip3ds_l3"]->Sumw2();
529     (*((*it_h).second))["ip3ds_l4"] = new TH1D(TString("ip3ds_l4") +"_"+(*it_h).first+str,";#bf{ip3ds l4};",55,-40,40); (*((*it_h).second))["ip3ds_l4"]->Sumw2();
530    
531     (*((*it_h).second))["d0_l1"] = new TH1D(TString("d0_l1") +"_"+(*it_h).first+str,";#bf{d0 l1};",50,-.008,.008); (*((*it_h).second))["d0_l1"]->Sumw2();
532     (*((*it_h).second))["d0_l2"] = new TH1D(TString("d0_l2") +"_"+(*it_h).first+str,";#bf{d0 l2};",50,-.008,.008); (*((*it_h).second))["d0_l2"]->Sumw2();
533     (*((*it_h).second))["d0_l3_lo"] = new TH1D(TString("d0_l3_lo") +"_"+(*it_h).first+str,";#bf{d0 l3_lo};",25,-.03,.03); (*((*it_h).second))["d0_l3_lo"]->Sumw2();
534     (*((*it_h).second))["d0_l4_lo"] = new TH1D(TString("d0_l4_lo") +"_"+(*it_h).first+str,";#bf{d0 l4_lo};",25,-.03,.03); (*((*it_h).second))["d0_l4_lo"]->Sumw2();
535     (*((*it_h).second))["d0_l3"] = new TH1D(TString("d0_l3") +"_"+(*it_h).first+str,";#bf{d0 l3};",50,-.1,.1); (*((*it_h).second))["d0_l3"]->Sumw2();
536     (*((*it_h).second))["d0_l4"] = new TH1D(TString("d0_l4") +"_"+(*it_h).first+str,";#bf{d0 l4};",50,-.1,.1); (*((*it_h).second))["d0_l4"]->Sumw2();
537    
538     (*((*it_h).second))["dz_l1"] = new TH1D(TString("dz_l1") +"_"+(*it_h).first+str,";#bf{dz l1};",50,-.01,.01); (*((*it_h).second))["dz_l1"]->Sumw2();
539     (*((*it_h).second))["dz_l2"] = new TH1D(TString("dz_l2") +"_"+(*it_h).first+str,";#bf{dz l2};",50,-.01,.01); (*((*it_h).second))["dz_l2"]->Sumw2();
540     (*((*it_h).second))["dz_l3"] = new TH1D(TString("dz_l3") +"_"+(*it_h).first+str,";#bf{dz l3};",50,-.2,.2); (*((*it_h).second))["dz_l3"]->Sumw2();
541     (*((*it_h).second))["dz_l4"] = new TH1D(TString("dz_l4") +"_"+(*it_h).first+str,";#bf{dz l4};",50,-.2,.2); (*((*it_h).second))["dz_l4"]->Sumw2();
542 dkralph 1.1
543     (*((*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();
544     (*((*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();
545 dkralph 1.3
546     // jets
547     (*((*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();
548     (*((*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();
549     (*((*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();
550     (*((*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();
551     (*((*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();
552     (*((*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();
553     (*((*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();
554     (*((*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();
555     (*((*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();
556     (*((*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();
557     (*((*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();
558     (*((*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();
559     (*((*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();
560     (*((*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();
561     (*((*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();
562     (*((*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();
563     (*((*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();
564     (*((*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();
565     (*((*it_h).second))["mjj"] = new TH1D(TString("mjj")+"_"+(*it_h).first+str,";#bf{m_{jj}};", 25,10,1550); (*((*it_h).second))["mjj"]->Sumw2();
566     (*((*it_h).second))["dEta"] = new TH1D(TString("dEta")+"_"+(*it_h).first+str,";#bf{#Delta #eta};", 25,-6,6); (*((*it_h).second))["dEta"]->Sumw2();
567     (*((*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();
568     (*((*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();
569    
570     (*((*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();
571     (*((*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();
572     (*((*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();
573     (*((*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();
574     (*((*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();
575     (*((*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();
576     (*((*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();
577     (*((*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();
578     (*((*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();
579     (*((*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();
580     (*((*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();
581     (*((*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();
582     (*((*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();
583     (*((*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();
584     (*((*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();
585     (*((*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();
586    
587 dkralph 1.6 int nbins=35;
588     (*((*it_h).second))["costheta1"] = new TH1D(TString("costheta1") +"_"+(*it_h).first+str,";#bf{costheta1};", nbins,-1,1); (*((*it_h).second))["costheta1"]->Sumw2();
589     (*((*it_h).second))["costheta2"] = new TH1D(TString("costheta2") +"_"+(*it_h).first+str,";#bf{costheta2};", nbins,-1,1); (*((*it_h).second))["costheta2"]->Sumw2();
590     (*((*it_h).second))["costhetastar"] = new TH1D(TString("costhetastar") +"_"+(*it_h).first+str,";#bf{costhetastar};", nbins,-1,1); (*((*it_h).second))["costhetastar"]->Sumw2();
591     (*((*it_h).second))["Phi"] = new TH1D(TString("Phi") +"_"+(*it_h).first+str,";#bf{Phi};", nbins,-3.15,3.15); (*((*it_h).second))["Phi"]->Sumw2();
592     (*((*it_h).second))["Phi1"] = new TH1D(TString("Phi1") +"_"+(*it_h).first+str,";#bf{Phi1};", nbins,-3.15,3.15); (*((*it_h).second))["Phi1"]->Sumw2();
593    
594     (*((*it_h).second))["pt4l"] = new TH1D(TString("pt4l") +"_"+(*it_h).first+str,";#bf{pt4l/m4l};", nbins-7,0,0.5); (*((*it_h).second))["pt4l"]->Sumw2();
595     (*((*it_h).second))["pt4l_log"] = new TH1D(TString("pt4l_log") +"_"+(*it_h).first+str,";#bf{pt4l/m4l};", nbins,0,1.5); (*((*it_h).second))["pt4l_log"]->Sumw2();
596     (*((*it_h).second))["y4l"] = new TH1D(TString("y4l") +"_"+(*it_h).first+str,";#bf{y4l};", nbins,-2.4,2.4); (*((*it_h).second))["y4l"]->Sumw2();
597     (*((*it_h).second))["Z1pt"] = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt/m4l};", nbins,0,0.5); (*((*it_h).second))["Z1pt"]->Sumw2();
598     (*((*it_h).second))["Z1pt_log"] = new TH1D(TString("Z1pt_log") +"_"+(*it_h).first+str,";#bf{Z1pt/m4l};", nbins,0,1.5); (*((*it_h).second))["Z1pt_log"]->Sumw2();
599     (*((*it_h).second))["Z2pt"] = new TH1D(TString("Z2pt") +"_"+(*it_h).first+str,";#bf{Z2pt/m4l};", nbins,0,0.5); (*((*it_h).second))["Z2pt"]->Sumw2();
600     (*((*it_h).second))["Z2pt_log"] = new TH1D(TString("Z2pt_log") +"_"+(*it_h).first+str,";#bf{Z2pt/m4l};", nbins,0,1.5); (*((*it_h).second))["Z2pt_log"]->Sumw2();
601    
602     (*((*it_h).second))["ZZdotZ1"] = new TH1D(TString("ZZdotZ1") +"_"+(*it_h).first+str,";#bf{ZZ #bullet Z1/(m4l*mZ1)};", nbins,-.2,2.5); (*((*it_h).second))["ZZdotZ1"]->Sumw2();
603     (*((*it_h).second))["ZZdotZ2"] = new TH1D(TString("ZZdotZ2") +"_"+(*it_h).first+str,";#bf{ZZ #bullet Z2/(m4l*mZ2)};", nbins,-1,3); (*((*it_h).second))["ZZdotZ2"]->Sumw2();
604     (*((*it_h).second))["ZZdotZ1_log"] = new TH1D(TString("ZZdotZ1_log") +"_"+(*it_h).first+str,";#bf{ZZ #bullet Z1/(m4l*mZ1)};",nbins,-1.5,15); (*((*it_h).second))["ZZdotZ1_log"]->Sumw2();
605     (*((*it_h).second))["ZZdotZ2_log"] = new TH1D(TString("ZZdotZ2_log") +"_"+(*it_h).first+str,";#bf{ZZ #bullet Z2/(m4l*mZ2)};",nbins,-1.5,15); (*((*it_h).second))["ZZdotZ2_log"]->Sumw2();
606     (*((*it_h).second))["dphi1"] = new TH1D(TString("dphi1") +"_"+(*it_h).first+str,";#bf{dphi1};", nbins,-1,1); (*((*it_h).second))["dphi1"]->Sumw2();
607     (*((*it_h).second))["dphi2"] = new TH1D(TString("dphi2") +"_"+(*it_h).first+str,";#bf{dphi2};", nbins,-1,1); (*((*it_h).second))["dphi2"]->Sumw2();
608     (*((*it_h).second))["dphi1_log"] = new TH1D(TString("dphi1_log") +"_"+(*it_h).first+str,";#bf{dphi1};", nbins,-1,1); (*((*it_h).second))["dphi1_log"]->Sumw2();
609     (*((*it_h).second))["dphi2_log"] = new TH1D(TString("dphi2_log") +"_"+(*it_h).first+str,";#bf{dphi2};", nbins,-1,1); (*((*it_h).second))["dphi2_log"]->Sumw2();
610    
611 dkralph 1.3 (*((*it_h).second))["fusionMVA"] = new TH1D(TString("fusionMVA")+"_"+(*it_h).first+str,";#bf{MVA output};", 100,-1,1); (*((*it_h).second))["fusionMVA"]->Sumw2();
612     (*((*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();
613     (*((*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();
614     (*((*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();
615     (*((*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();
616     (*((*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();
617 dkralph 1.1 }
618     return hists;
619     }
620     //--------------------------------------------------------------------------------------------------
621 dkralph 1.6 void makeHTML(FOFlags &ctrl, TString type, TString plotLabel, TString fullOutDir)
622 dkralph 1.1 {
623 dkralph 1.4 TString tmpString(plotLabel);
624     tmpString.ReplaceAll("/"," ");
625     TString title(ctrl.faketype+", "+tmpString+", "+type);
626 dkralph 1.6 TString htmlfname(fullOutDir+"/plots.html");
627 dkralph 1.4 ofstream htmlfile(htmlfname);
628 dkralph 1.1
629     htmlfile << "<!DOCTYPE html" << endl;
630     htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
631     htmlfile << "<html>" << endl;
632    
633     htmlfile << "<head><title>"+title+"</title></head>" << endl;
634 dkralph 1.4 htmlfile << "<body bgcolor=\"000000\">" << endl;
635 dkralph 1.1 htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
636    
637 dkralph 1.4 htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">boson kinematics</h3>" << endl;
638 dkralph 1.1 htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
639    
640     htmlfile << "<tr>" << endl;
641 dkralph 1.4 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;
642     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;
643     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;
644 dkralph 1.3 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
645     htmlfile << "</tr>" << endl;
646    
647     htmlfile << "<tr>" << endl;
648 dkralph 1.4 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;
649     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;
650     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;
651 dkralph 1.1 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
652     htmlfile << "</tr>" << endl;
653    
654     htmlfile << "<tr>" << endl;
655     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;
656     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;
657 dkralph 1.4 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;
658 dkralph 1.1 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
659     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
660     htmlfile << "</tr>" << endl;
661    
662 dkralph 1.4 htmlfile << "</table>" << endl;
663     htmlfile << "<hr />" << endl;
664     htmlfile << "control: " << endl;
665     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
666    
667 dkralph 1.1 htmlfile << "<tr>" << endl;
668 dkralph 1.4 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;
669     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;
670     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
671     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
672 dkralph 1.1 htmlfile << "</tr>" << endl;
673    
674 dkralph 1.4 htmlfile << "</table>" << endl;
675    
676     htmlfile << "</body>" << endl;
677     htmlfile << "</html>" << endl;
678     htmlfile.close();
679    
680 dkralph 1.6 TString anglefname(htmlfname);
681     anglefname.ReplaceAll("plots.html","angleplots.html");
682     htmlfile.open(anglefname);
683    
684     htmlfile << "<!DOCTYPE html" << endl;
685     htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
686     htmlfile << "<html>" << endl;
687    
688     htmlfile << "<head><title>"+title+"</title></head>" << endl;
689     htmlfile << "<body bgcolor=\"000000\">" << endl;
690     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
691    
692     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Angles & Co.</h3>" << endl;
693     htmlfile << "<hr />" << endl;
694     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
695     htmlfile << "</table>" << endl;
696    
697     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Angles:</h3>" << endl;
698     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
699    
700     htmlfile << "<tr>" << endl;
701     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/costheta1.png\"><img src=\"plots/costheta1.png\" alt=\"plots/costheta1.png\" width=\"100%\"></a></td>" << endl;
702     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/costheta2.png\"><img src=\"plots/costheta2.png\" alt=\"plots/costheta2.png\" width=\"100%\"></a></td>" << endl;
703     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/costhetastar.png\"><img src=\"plots/costhetastar.png\" alt=\"plots/costhetastar.png\" width=\"100%\"></a></td>" << endl;
704     htmlfile << "<td width=\"25%\"></td>" << endl;
705     htmlfile << "</tr>" << endl;
706    
707     htmlfile << "<tr>" << endl;
708     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Phi.png\"><img src=\"plots/Phi.png\" alt=\"plots/Phi.png\" width=\"100%\"></a></td>" << endl;
709     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Phi1.png\"><img src=\"plots/Phi1.png\" alt=\"plots/Phi1.png\" width=\"100%\"></a></td>" << endl;
710     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
711     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
712     htmlfile << "</tr>" << endl;
713    
714     htmlfile << "</table>" << endl;
715     htmlfile << "<hr />" << endl;
716     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Boson pt variables: " << endl;
717     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
718    
719     htmlfile << "<tr>" << endl;
720     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/y4l.png\"><img src=\"plots/y4l.png\" alt=\"plots/y4l.png\" width=\"100%\"></a></td>" << endl;
721     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt4l.png\"><img src=\"plots/pt4l.png\" alt=\"plots/pt4l.png\" width=\"100%\"></a></td>" << endl;
722     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/pt4l_log.png\"><img src=\"plots/pt4l_log.png\" alt=\"plots/pt4l_log.png\" width=\"100%\"></a></td>" << endl;
723     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
724     htmlfile << "<tr>" << endl;
725    
726     htmlfile << "</tr>" << endl;
727     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;
728     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Z2pt.png\"><img src=\"plots/Z2pt.png\" alt=\"plots/Z2pt.png\" width=\"100%\"></a></td>" << endl;
729     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Z1pt_log.png\"><img src=\"plots/Z1pt_log.png\" alt=\"plots/Z1pt_log.png\" width=\"100%\"></a></td>" << endl;
730     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/Z2pt_log.png\"><img src=\"plots/Z2pt_log.png\" alt=\"plots/Z2pt_log.png\" width=\"100%\"></a></td>" << endl;
731     htmlfile << "</tr>" << endl;
732    
733     htmlfile << "<tr>" << endl;
734     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ZZdotZ1.png\"><img src=\"plots/ZZdotZ1.png\" alt=\"plots/ZZdotZ1.png\" width=\"100%\"></a></td>" << endl;
735     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ZZdotZ2.png\"><img src=\"plots/ZZdotZ2.png\" alt=\"plots/ZZdotZ2.png\" width=\"100%\"></a></td>" << endl;
736     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ZZdotZ1_log.png\"><img src=\"plots/ZZdotZ1_log.png\" alt=\"plots/ZZdotZ1_log.png\" width=\"100%\"></a></td>" << endl;
737     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ZZdotZ2_log.png\"><img src=\"plots/ZZdotZ2_log.png\" alt=\"plots/ZZdotZ2_log.png\" width=\"100%\"></a></td>" << endl;
738     htmlfile << "</tr>" << endl;
739    
740     htmlfile << "<tr>" << endl;
741     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dphi1.png\"><img src=\"plots/dphi1.png\" alt=\"plots/dphi1.png\" width=\"100%\"></a></td>" << endl;
742     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dphi2.png\"><img src=\"plots/dphi2.png\" alt=\"plots/dphi2.png\" width=\"100%\"></a></td>" << endl;
743     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dphi1_log.png\"><img src=\"plots/dphi1_log.png\" alt=\"plots/dphi1_log.png\" width=\"100%\"></a></td>" << endl;
744     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dphi2_log.png\"><img src=\"plots/dphi2_log.png\" alt=\"plots/dphi2_log.png\" width=\"100%\"></a></td>" << endl;
745     htmlfile << "</tr>" << endl;
746    
747    
748     htmlfile << "</table>" << endl;
749    
750     htmlfile << "</body>" << endl;
751     htmlfile << "</html>" << endl;
752     htmlfile.close();
753    
754 dkralph 1.4 TString leptonfname(htmlfname);
755     leptonfname.ReplaceAll("plots.html","leptonplots.html");
756     htmlfile.open(leptonfname);
757    
758     htmlfile << "<!DOCTYPE html" << endl;
759     htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
760     htmlfile << "<html>" << endl;
761    
762     htmlfile << "<head><title>"+title+"</title></head>" << endl;
763     htmlfile << "<body bgcolor=\"000000\">" << endl;
764     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
765    
766     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">lepton plots</h3>" << endl;
767     htmlfile << "<hr />" << endl;
768     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
769     htmlfile << "</table>" << endl;
770    
771     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Z1 leptons:</h3>" << endl;
772     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
773    
774 dkralph 1.1 htmlfile << "<tr>" << endl;
775     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;
776     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;
777 dkralph 1.4 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;
778     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;
779     htmlfile << "</tr>" << endl;
780    
781     htmlfile << "<tr>" << endl;
782 dkralph 1.5 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;
783     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;
784 dkralph 1.4 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
785     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
786     htmlfile << "</tr>" << endl;
787    
788     htmlfile << "<tr>" << endl;
789     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l1.png\"><img src=\"plots/d0_l1.png\" alt=\"plots/d0_l1.png\" width=\"100%\"></a></td>" << endl;
790     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l2.png\"><img src=\"plots/d0_l2.png\" alt=\"plots/d0_l2.png\" width=\"100%\"></a></td>" << endl;
791 dkralph 1.5 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
792     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
793     htmlfile << "</tr>" << endl;
794    
795     htmlfile << "<tr>" << endl;
796     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dz_l1.png\"><img src=\"plots/dz_l1.png\" alt=\"plots/dz_l1.png\" width=\"100%\"></a></td>" << endl;
797     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dz_l2.png\"><img src=\"plots/dz_l2.png\" alt=\"plots/dz_l2.png\" width=\"100%\"></a></td>" << endl;
798     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
799     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
800 dkralph 1.1 htmlfile << "</tr>" << endl;
801    
802 dkralph 1.3 // htmlfile << "<tr>" << endl;
803     // 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;
804     // 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;
805     // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
806     // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
807     // htmlfile << "</tr>" << endl;
808 dkralph 1.1
809 dkralph 1.4 htmlfile << "</table>" << endl;
810     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">extra leptons (l3 and l4): </h3>" << endl;
811     htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
812    
813 dkralph 1.1 htmlfile << "<tr>" << endl;
814 dkralph 1.4 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;
815     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;
816 dkralph 1.1 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;
817     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;
818     htmlfile << "</tr>" << endl;
819 dkralph 1.3
820 dkralph 1.4 htmlfile << "<tr>" << endl;
821     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l3_lo.png\"><img src=\"plots/ip3ds_l3_lo.png\" alt=\"plots/ip3ds_l3_lo.png\" width=\"100%\"></a></td>" << endl;
822     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/ip3ds_l4_lo.png\"><img src=\"plots/ip3ds_l4_lo.png\" alt=\"plots/ip3ds_l4_lo.png\" width=\"100%\"></a></td>" << endl;
823     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;
824     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;
825     htmlfile << "</tr>" << endl;
826    
827     htmlfile << "<tr>" << endl;
828     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l3_lo.png\"><img src=\"plots/d0_l3_lo.png\" alt=\"plots/d0_l3_lo.png\" width=\"100%\"></a></td>" << endl;
829     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l4_lo.png\"><img src=\"plots/d0_l4_lo.png\" alt=\"plots/d0_l4_lo.png\" width=\"100%\"></a></td>" << endl;
830     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l3.png\"><img src=\"plots/d0_l3.png\" alt=\"plots/d0_l3.png\" width=\"100%\"></a></td>" << endl;
831     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/d0_l4.png\"><img src=\"plots/d0_l4.png\" alt=\"plots/d0_l4.png\" width=\"100%\"></a></td>" << endl;
832     htmlfile << "</tr>" << endl;
833    
834     htmlfile << "<tr>" << endl;
835     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dz_l3.png\"><img src=\"plots/dz_l3.png\" alt=\"plots/dz_l3.png\" width=\"100%\"></a></td>" << endl;
836     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/dz_l4.png\"><img src=\"plots/dz_l4.png\" alt=\"plots/dz_l4.png\" width=\"100%\"></a></td>" << endl;
837     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
838     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
839     htmlfile << "</tr>" << endl;
840    
841 dkralph 1.3 htmlfile << "</table>" << endl;
842 dkralph 1.4
843     htmlfile << "</body>" << endl;
844     htmlfile << "</html>" << endl;
845     htmlfile.close();
846    
847     TString jetfname(htmlfname);
848     jetfname.ReplaceAll("plots.html","jetplots.html");
849     htmlfile.open(jetfname);
850    
851     htmlfile << "<!DOCTYPE html" << endl;
852     htmlfile << " PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
853     htmlfile << "<html>" << endl;
854    
855     htmlfile << "<head><title>"+title+"</title></head>" << endl;
856     htmlfile << "<body bgcolor=\"000000\">" << endl;
857     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
858    
859     htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">jet plots</h3>" << endl;
860     htmlfile << "<hr />" << endl;
861 dkralph 1.3 htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;
862    
863     htmlfile << "<tr>" << endl;
864     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;
865     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;
866     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;
867     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;
868     htmlfile << "</tr>" << endl;
869    
870     htmlfile << "<tr>" << endl;
871     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;
872     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;
873     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;
874     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;
875     htmlfile << "</tr>" << endl;
876    
877     htmlfile << "<tr>" << endl;
878     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;
879     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;
880     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;
881     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;
882     htmlfile << "</tr>" << endl;
883    
884     htmlfile << "<tr>" << endl;
885     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;
886     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;
887     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;
888     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;
889     htmlfile << "</tr>" << endl;
890    
891     htmlfile << "<tr>" << endl;
892     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;
893     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;
894     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;
895     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;
896     htmlfile << "</tr>" << endl;
897    
898     // htmlfile << "<tr>" << endl;
899     // 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;
900     // 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;
901     // 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;
902     // 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;
903     // htmlfile << "</tr>" << endl;
904    
905     // htmlfile << "<tr>" << endl;
906     // 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;
907     // 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;
908     // 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;
909     // 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;
910     // htmlfile << "</tr>" << endl;
911    
912     // htmlfile << "<tr>" << endl;
913     // 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;
914     // 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;
915     // 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;
916     // 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;
917     // htmlfile << "</tr>" << endl;
918    
919     // htmlfile << "<tr>" << endl;
920     // 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;
921     // 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;
922     // 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;
923     // 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;
924     // htmlfile << "</tr>" << endl;
925    
926     htmlfile << "<tr>" << endl;
927     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;
928     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;
929     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;
930     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
931     htmlfile << "</tr>" << endl;
932    
933     htmlfile << "<tr>" << endl;
934 dkralph 1.4 htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA-log.png\"><img src=\"plots/fusionMVA-log.png\" alt=\"plots/fusionMVA-log.png\" width=\"100%\"></a></td>" << endl;
935     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA_lo-log.png\"><img src=\"plots/fusionMVA_lo-log.png\" alt=\"plots/fusionMVA_lo-log.png\" width=\"100%\"></a></td>" << endl;
936     htmlfile << "<td width=\"25%\"><a target=\"_blank\" href=\"plots/fusionMVA_hi-log.png\"><img src=\"plots/fusionMVA_hi-log.png\" alt=\"plots/fusionMVA_hi-log.png\" width=\"100%\"></a></td>" << endl;
937 dkralph 1.3 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
938     htmlfile << "</tr>" << endl;
939    
940     htmlfile << "<tr>" << endl;
941 dkralph 1.4 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;
942     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;
943 dkralph 1.3 htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
944     htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
945     htmlfile << "</tr>" << endl;
946 dkralph 1.4
947    
948 dkralph 1.1 htmlfile << "</table>" << endl;
949    
950     htmlfile << "<hr />" << endl;
951    
952     htmlfile << "<hr />" << endl;
953    
954     htmlfile << "</body>" << endl;
955     htmlfile << "</html>" << endl;
956     htmlfile.close();
957     }
958     //----------------------------------------------------------------------------------------
959     void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo, double wgt_hi)
960     {
961 dkralph 1.5 assert(wgt==wgt);
962     assert(wgt_lo==wgt_lo);
963     assert(wgt_hi==wgt_hi);
964 dkralph 1.1 (*(cs->hists)["all_"+type])[var]->Fill( val, wgt);
965     if(channel!="")
966     (*(cs->hists)[channel+"_"+type])[var]->Fill( val, wgt);
967 dkralph 1.4 if(type=="pred" || type=="PF") {
968 dkralph 1.1 (*(cs->hists)["all_"+type+"_lo"])[var]->Fill( val, wgt_lo);
969     (*(cs->hists)["all_"+type+"_hi"])[var]->Fill( val, wgt_hi);
970     if(channel!="") {
971     (*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill( val, wgt_lo);
972     (*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill( val, wgt_hi);
973     }
974     }
975     }
976 dkralph 1.3 //----------------------------------------------------------------------------------------
977 dkralph 1.6 void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine, Angles angles,
978 dkralph 1.3 SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
979     double wgt, double wgt_lo, double wgt_hi)
980     {
981 dkralph 1.4 fillHist( cs, channel, type, "npv" , fs->info->npv , wgt, wgt_lo, wgt_hi);
982     fillHist( cs, channel, type, "run" , fs->info->run , wgt, wgt_lo, wgt_hi);
983     fillHist( cs, channel, type, "mZ1" , kine.mZ1 , wgt, wgt_lo, wgt_hi);
984     fillHist( cs, channel, type, "mZ2" , kine.mZ2 , wgt, wgt_lo, wgt_hi);
985     fillHist( cs, channel, type, "mZ2_lo" , kine.mZ2 , wgt, wgt_lo, wgt_hi);
986     fillHist( cs, channel, type, "m4l_lo" , kine.m4l , wgt, wgt_lo, wgt_hi);
987     fillHist( cs, channel, type, "m4l_med" , kine.m4l , wgt, wgt_lo, wgt_hi);
988     fillHist( cs, channel, type, "m4l" , kine.m4l , wgt, wgt_lo, wgt_hi);
989     fillHist( cs, channel, type, "met" , fs->info->met , wgt, wgt_lo, wgt_hi);
990     fillHist( cs, channel, type, "ip3ds_l1" , lep1.ip3dSig , wgt, wgt_lo, wgt_hi);
991     fillHist( cs, channel, type, "ip3ds_l2" , lep2.ip3dSig , wgt, wgt_lo, wgt_hi);
992     fillHist( cs, channel, type, "ip3ds_l3" , lep3.ip3dSig , wgt, wgt_lo, wgt_hi);
993     fillHist( cs, channel, type, "ip3ds_l4" , lep4.ip3dSig , wgt, wgt_lo, wgt_hi);
994     fillHist( cs, channel, type, "ip3ds_l3_lo" , lep3.ip3dSig , wgt, wgt_lo, wgt_hi);
995     fillHist( cs, channel, type, "ip3ds_l4_lo" , lep4.ip3dSig , wgt, wgt_lo, wgt_hi);
996     fillHist( cs, channel, type, "d0_l1" , lep1.d0 , wgt, wgt_lo, wgt_hi);
997     fillHist( cs, channel, type, "d0_l2" , lep2.d0 , wgt, wgt_lo, wgt_hi);
998     fillHist( cs, channel, type, "d0_l3" , lep3.d0 , wgt, wgt_lo, wgt_hi);
999     fillHist( cs, channel, type, "d0_l4" , lep4.d0 , wgt, wgt_lo, wgt_hi);
1000     fillHist( cs, channel, type, "d0_l3_lo" , lep3.d0 , wgt, wgt_lo, wgt_hi);
1001     fillHist( cs, channel, type, "d0_l4_lo" , lep4.d0 , wgt, wgt_lo, wgt_hi);
1002     fillHist( cs, channel, type, "dz_l1" , lep1.dz , wgt, wgt_lo, wgt_hi);
1003     fillHist( cs, channel, type, "dz_l2" , lep2.dz , wgt, wgt_lo, wgt_hi);
1004     fillHist( cs, channel, type, "dz_l3" , lep3.dz , wgt, wgt_lo, wgt_hi);
1005     fillHist( cs, channel, type, "dz_l4" , lep4.dz , wgt, wgt_lo, wgt_hi);
1006     fillHist( cs, channel, type, "pt_l1" , lep1.vec.Pt() , wgt, wgt_lo, wgt_hi);
1007     fillHist( cs, channel, type, "pt_l2" , lep2.vec.Pt() , wgt, wgt_lo, wgt_hi);
1008     fillHist( cs, channel, type, "pt_l3" , lep3.vec.Pt() , wgt, wgt_lo, wgt_hi);
1009     fillHist( cs, channel, type, "pt_l4" , lep4.vec.Pt() , wgt, wgt_lo, wgt_hi);
1010     fillHist( cs, channel, type, "eta_l1" , lep1.vec.Eta() , wgt, wgt_lo, wgt_hi);
1011     fillHist( cs, channel, type, "eta_l2" , lep2.vec.Eta() , wgt, wgt_lo, wgt_hi);
1012     fillHist( cs, channel, type, "eta_l3" , lep3.vec.Eta() , wgt, wgt_lo, wgt_hi);
1013     fillHist( cs, channel, type, "eta_l4" , lep4.vec.Eta() , wgt, wgt_lo, wgt_hi);
1014     fillHist( cs, channel, type, "dR_l3l4_lo" , dr(lep3,lep4) , wgt, wgt_lo, wgt_hi);
1015     fillHist( cs, channel, type, "dR_l3l4" , dr(lep3,lep4) , wgt, wgt_lo, wgt_hi);
1016 dkralph 1.6
1017     fillHist( cs, channel, type, "costheta1" , angles.costheta1 , wgt, wgt_lo, wgt_hi);
1018     fillHist( cs, channel, type, "costheta2" , angles.costheta2 , wgt, wgt_lo, wgt_hi);
1019     fillHist( cs, channel, type, "costhetastar" , angles.costhetastar , wgt, wgt_lo, wgt_hi);
1020     fillHist( cs, channel, type, "Phi" , angles.Phi , wgt, wgt_lo, wgt_hi);
1021     fillHist( cs, channel, type, "Phi1" , angles.Phi1 , wgt, wgt_lo, wgt_hi);
1022     fillHist( cs, channel, type, "pt4l" , kine.ZZpt/kine.m4l , wgt, wgt_lo, wgt_hi);
1023     fillHist( cs, channel, type, "pt4l_log" , kine.ZZpt/kine.m4l , wgt, wgt_lo, wgt_hi);
1024     fillHist( cs, channel, type, "y4l" , kine.ZZy , wgt, wgt_lo, wgt_hi);
1025     fillHist( cs, channel, type, "Z1pt" , kine.Z1pt/kine.m4l , wgt, wgt_lo, wgt_hi);
1026     fillHist( cs, channel, type, "Z1pt_log" , kine.Z1pt/kine.m4l , wgt, wgt_lo, wgt_hi);
1027     fillHist( cs, channel, type, "Z2pt" , kine.Z2pt/kine.m4l , wgt, wgt_lo, wgt_hi);
1028     fillHist( cs, channel, type, "Z2pt_log" , kine.Z2pt/kine.m4l , wgt, wgt_lo, wgt_hi);
1029     fillHist( cs, channel, type, "ZZdotZ1" , kine.ZZdotZ1/(kine.m4l*kine.mZ1) , wgt, wgt_lo, wgt_hi);
1030     fillHist( cs, channel, type, "ZZdotZ2" , kine.ZZdotZ2/(kine.m4l*kine.mZ2) , wgt, wgt_lo, wgt_hi);
1031     fillHist( cs, channel, type, "ZZdotZ1_log" , kine.ZZdotZ1/(kine.m4l*kine.mZ1) , wgt, wgt_lo, wgt_hi);
1032     fillHist( cs, channel, type, "ZZdotZ2_log" , kine.ZZdotZ2/(kine.m4l*kine.mZ2) , wgt, wgt_lo, wgt_hi);
1033     fillHist( cs, channel, type, "dphi1" , kine.ZZptZ1ptCosDphi , wgt, wgt_lo, wgt_hi);
1034     fillHist( cs, channel, type, "dphi2" , kine.ZZptZ2ptCosDphi , wgt, wgt_lo, wgt_hi);
1035     fillHist( cs, channel, type, "dphi1_log" , kine.ZZptZ1ptCosDphi , wgt, wgt_lo, wgt_hi);
1036     fillHist( cs, channel, type, "dphi2_log" , kine.ZZptZ2ptCosDphi , wgt, wgt_lo, wgt_hi);
1037    
1038 dkralph 1.3 }
1039     //----------------------------------------------------------------------------------------
1040     void fillAllJetHists( FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
1041     SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
1042     FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
1043     double wgt, double wgt_lo, double wgt_hi)
1044     {
1045     double fMVAval = (ctrl.uncert=="") ? 0 : fusion.reader->EvaluateMVA("BDTG");
1046     dr_struct drs = fill_dr_struct(goodJets,lep1,lep2,lep3,lep4);
1047     fillHist( cs, channel, type, "pt_j1" , ji.ptJet1, wgt, wgt_lo, wgt_hi);
1048     fillHist( cs, channel, type, "pt_j2" , ji.ptJet2, wgt, wgt_lo, wgt_hi);
1049     fillHist( cs, channel, type, "pt_j3" , ji.ptJet3, wgt, wgt_lo, wgt_hi);
1050     fillHist( cs, channel, type, "pt_j4" , ji.ptJet4, wgt, wgt_lo, wgt_hi);
1051     fillHist( cs, channel, type, "eta_j1" , ji.etaJet1, wgt, wgt_lo, wgt_hi);
1052     fillHist( cs, channel, type, "eta_j2" , ji.etaJet2, wgt, wgt_lo, wgt_hi);
1053     fillHist( cs, channel, type, "eta_j3" , ji.etaJet3, wgt, wgt_lo, wgt_hi);
1054     fillHist( cs, channel, type, "eta_j4" , ji.etaJet4, wgt, wgt_lo, wgt_hi);
1055     fillHist( cs, channel, type, "phi_j1" , ji.phiJet1, wgt, wgt_lo, wgt_hi);
1056     fillHist( cs, channel, type, "phi_j2" , ji.phiJet2, wgt, wgt_lo, wgt_hi);
1057     fillHist( cs, channel, type, "phi_j3" , ji.phiJet3, wgt, wgt_lo, wgt_hi);
1058     fillHist( cs, channel, type, "phi_j4" , ji.phiJet4, wgt, wgt_lo, wgt_hi);
1059     fillHist( cs, channel, type, "idmva_j1", ji.mvaJet1, wgt, wgt_lo, wgt_hi);
1060     fillHist( cs, channel, type, "idmva_j2", ji.mvaJet2, wgt, wgt_lo, wgt_hi);
1061     fillHist( cs, channel, type, "idmva_j3", ji.mvaJet3, wgt, wgt_lo, wgt_hi);
1062     fillHist( cs, channel, type, "idmva_j4", ji.mvaJet4, wgt, wgt_lo, wgt_hi);
1063     fillHist( cs, channel, type, "mjj" , ji.mjj, wgt, wgt_lo, wgt_hi);
1064     fillHist( cs, channel, type, "dEta" , ji.dEta, wgt, wgt_lo, wgt_hi);
1065     fillHist( cs, channel, type, "etaProd", ji.etaProd, wgt, wgt_lo, wgt_hi);
1066     fillHist( cs, channel, type, "njets" , goodJets.size(), wgt, wgt_lo, wgt_hi);
1067     fillHist( cs, channel, type, "dR_l1j1", drs.l1j1, wgt, wgt_lo, wgt_hi);
1068     fillHist( cs, channel, type, "dR_l2j1", drs.l2j1, wgt, wgt_lo, wgt_hi);
1069     fillHist( cs, channel, type, "dR_l3j1", drs.l3j1, wgt, wgt_lo, wgt_hi);
1070     fillHist( cs, channel, type, "dR_l4j1", drs.l4j1, wgt, wgt_lo, wgt_hi);
1071     fillHist( cs, channel, type, "dR_l1j2", drs.l1j2, wgt, wgt_lo, wgt_hi);
1072     fillHist( cs, channel, type, "dR_l2j2", drs.l2j2, wgt, wgt_lo, wgt_hi);
1073     fillHist( cs, channel, type, "dR_l3j2", drs.l3j2, wgt, wgt_lo, wgt_hi);
1074     fillHist( cs, channel, type, "dR_l4j2", drs.l4j2, wgt, wgt_lo, wgt_hi);
1075     fillHist( cs, channel, type, "dR_l1j3", drs.l1j3, wgt, wgt_lo, wgt_hi);
1076     fillHist( cs, channel, type, "dR_l2j3", drs.l2j3, wgt, wgt_lo, wgt_hi);
1077     fillHist( cs, channel, type, "dR_l3j3", drs.l3j3, wgt, wgt_lo, wgt_hi);
1078     fillHist( cs, channel, type, "dR_l4j3", drs.l4j3, wgt, wgt_lo, wgt_hi);
1079     fillHist( cs, channel, type, "dR_l1j4", drs.l1j4, wgt, wgt_lo, wgt_hi);
1080     fillHist( cs, channel, type, "dR_l2j4", drs.l2j4, wgt, wgt_lo, wgt_hi);
1081     fillHist( cs, channel, type, "dR_l3j4", drs.l3j4, wgt, wgt_lo, wgt_hi);
1082     fillHist( cs, channel, type, "dR_l4j4", drs.l4j4, wgt, wgt_lo, wgt_hi);
1083    
1084     fillHist( cs, channel, type, "fusionMVA_lo", fMVAval, wgt, wgt_lo, wgt_hi);
1085     fillHist( cs, channel, type, "fusionMVA_med",fMVAval, wgt, wgt_lo, wgt_hi);
1086     fillHist( cs, channel, type, "fusionMVA_hi", fMVAval, wgt, wgt_lo, wgt_hi);
1087     fillHist( cs, channel, type, "fusionMVA", fMVAval, wgt, wgt_lo, wgt_hi);
1088     if(fMVAval > -.3) {
1089     fillHist( cs, channel, type, "m4l_jet_lo", kine.m4l , wgt, wgt_lo, wgt_hi);
1090     fillHist( cs, channel, type, "m4l_jet", kine.m4l , wgt, wgt_lo, wgt_hi);
1091     }
1092     }
1093     //----------------------------------------------------------------------------------------
1094     bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
1095     unsigned lep2matchBits, unsigned lep3matchBits,
1096     unsigned lep4matchBits)
1097     {
1098     bool pass=false;
1099     bool onePassedButWasOutside=false;
1100     bitset<30> firedBits(info->status);
1101     if(ctrl.debug) cout << setw(12) << info->run << setw(12) << info->evt << setw(65) << firedBits <<endl;
1102     for(unsigned ibit=0; ibit<ti.trigBits.size(); ibit++) {
1103     bool outsideRunRange=false;
1104     if(info->run < ti.minRuns[ibit] || info->run > ti.maxRuns[ibit]) {
1105     outsideRunRange = true;
1106     }
1107     int baconBit = ti.trigBits[ibit];
1108     bool passBit = firedBits.test(ibit);
1109     if(ctrl.debug) cout << " ibit: " << setw(4) << ibit << " (bacon bit: " << baconBit << ") fired: " << passBit << endl;
1110     if(ctrl.debug && passBit && outsideRunRange) cout << " would have passed but it's outside run range (" << ti.minRuns[ibit] << "," << ti.maxRuns[ibit] << ")" << endl;
1111     if(passBit && outsideRunRange) {
1112     onePassedButWasOutside = true;
1113     }
1114     if(passBit && !outsideRunRange) pass = true;
1115     }
1116     if(!pass && onePassedButWasOutside) cout << "WARNING: would have passed, but one was outside its run range" << endl;
1117     return pass;
1118     }
1119     //----------------------------------------------------------------------------------------
1120     void init_cuts( vector<TString> &cutstrs, map<TString,int> &cutvec)
1121     {
1122     cutstrs.push_back("start" ); cutvec["start"] = 0;
1123     cutstrs.push_back("rlrmAndDupl" ); cutvec["rlrmAndDupl"] = 0;
1124     // cutstrs.push_back("skim" ); cutvec["skim"] = 0;
1125     cutstrs.push_back("4lsele" ); cutvec["4lsele"] = 0;
1126     cutstrs.push_back("twoJets" ); cutvec["twoJets"] = 0;
1127     cutstrs.push_back("twoJetsAfter" ); cutvec["twoJetsAfter"] = 0;
1128     cutstrs.push_back("filling" ); cutvec["filling"] = 0;
1129     cutstrs.push_back("fillPass" ); cutvec["fillPass"] = 0;
1130 dkralph 1.4 cutstrs.push_back("fillFail" ); cutvec["fillFail"] = 0;
1131     cutstrs.push_back("fillPF" ); cutvec["fillPF"] = 0;
1132 dkralph 1.3 }
1133     //----------------------------------------------------------------------------------------
1134     bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
1135     SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4)
1136     {
1137     int nHighPtJets=0,nLowPtJets=0;
1138     for(unsigned ijet=0; ijet<fs->jets->size(); ijet++) {
1139     SimpleLepton *jet = &((*fs->jets)[ijet]);
1140     if(dr(*jet,lep1) < 0.2) continue;
1141     if(dr(*jet,lep2) < 0.2) continue;
1142     if(dr(*jet,lep3) < 0.2) continue;
1143     if(dr(*jet,lep4) < 0.2) continue;
1144     if(!(jet->status.passPre())) continue;
1145     if(!jet->isLoose) continue;
1146     if(fabs(jet->vec.Eta()) > 4.5) continue;
1147     goodJets.push_back(*jet);
1148     if(jet->vec.Pt() > 40) nHighPtJets++;
1149     if(jet->vec.Pt() > 20) nLowPtJets++;
1150     }
1151     sort( goodJets.begin(), goodJets.end(), SimpleLepton::lep_pt_sort ); // note: they're not sorted, 'cause jet corrections were applied in applyZPlusX
1152     if((goodJets.size()>0 && nHighPtJets<1) || // require pt > 40,20 if the jets are there
1153     (goodJets.size()>1 && nLowPtJets<2))
1154     return false;
1155     else
1156     return true;
1157     }
1158 dkralph 1.4 //----------------------------------------------------------------------------------------
1159     map<TString,TH1D*> setHistSet(CSample *cs, TString type, TString var)
1160     {
1161     map<TString,TH1D*> hset;
1162     hset["obs"] = (*(cs->hists)[type+"_obs"])[var];
1163     hset["pred"] = (*(cs->hists)[type+"_pred"])[var];
1164     hset["pred_lo"] = (*(cs->hists)[type+"_pred_lo"])[var];
1165     hset["pred_hi"] = (*(cs->hists)[type+"_pred_hi"])[var];
1166     hset["PF"] = (*(cs->hists)[type+"_PF"])[var];
1167     hset["PF_lo"] = (*(cs->hists)[type+"_PF_lo"])[var];
1168     hset["PF_hi"] = (*(cs->hists)[type+"_PF_hi"])[var];
1169     return hset;
1170     }
1171     //----------------------------------------------------------------------------------------
1172     void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight)
1173     {
1174     fs->getentry(ientry,"","zznt"); // make sure we've got this entry for all the branches
1175 dkralph 1.6 fillAngles(evtdata,*fs->angles);
1176 dkralph 1.4 fillKinematics(evtdata,*fs->kine); // reminder: kine has the fake information, while fs->kine *had*, until this line, whatever ZPlusX put in it
1177     fs->weights->w = fillweight;
1178     fs->outtuple->Fill();
1179     fs->outFotuple->Fill();
1180     }
1181 dkralph 1.5 //----------------------------------------------------------------------------------------
1182     void incrementSsofCounters(FOFlags &ctrl, filestuff *fs, double minMz2,
1183     pair<int,int> *best_z_indices,
1184     double wgt)
1185     {
1186     assert(ctrl.ssof); // only makes sense to write this out when we're thinking about ssof method
1187     vector<pair<SimpleLepton,SimpleLepton> > z2cands;
1188     vector<TString> types;
1189    
1190     int hiPtFailZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, "XX-SF", minMz2, "fail");
1191     if(hiPtFailZ2 == -1) return; // no z2 found
1192     SimpleLepton lep1 = (*fs->passingL)[best_z_indices->first];
1193     SimpleLepton lep2 = (*fs->passingL)[best_z_indices->second];
1194     SimpleLepton lep3 = z2cands[hiPtFailZ2].first;
1195     SimpleLepton lep4 = z2cands[hiPtFailZ2].second;
1196     TString channel = getChannel(lep1,lep2,lep3,lep4);
1197     TString sign = (lep3.charge == lep4.charge) ? "SS" : "OS";
1198 dkralph 1.4
1199 dkralph 1.5 fs->counters_[sign+"_"+channel] += wgt;
1200     fs->counters_[sign] += wgt;
1201     }
1202     //----------------------------------------------------------------------------------------
1203     double getSsofWgt(TString channel, map<TString,double> &ssofRatios)
1204     {
1205     double returnval = ssofRatios[channel];
1206     if(returnval < 0.1 || returnval > 3) {
1207     cout << "\nERROR! ssof ratio out of bounds for " << channel << ": " << returnval << endl;
1208     assert(0);
1209     }
1210     return returnval;
1211     }
1212     //----------------------------------------------------------------------------------------
1213     map<TString,double> initSsofRatios(vector<CSample*> &samplev)
1214     {
1215     double OS,SS;
1216     double OS_4e,SS_4e;
1217     double OS_4m,SS_4m;
1218     double OS_2e2m,SS_2e2m;
1219     cout << "Initializing ssof ratios: " << endl;
1220     for(unsigned isam=0; isam<samplev.size(); isam++) {
1221     CSample *cs = samplev[isam];
1222     for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
1223     filestuff *fs = (cs->fsv)[ifs];
1224     if(fs->useSsofRatio_) {
1225     cout << " adding from: " << fs->fname_ << endl;
1226     cout << " " << fs->counters_["ratio"] << setw(8) << fixed << setprecision(2) << fs->counters_["ratio_4e"] << setw(8) << fixed << setprecision(2) << fs->counters_["ratio_4m"] << setw(8) << fixed << setprecision(2) << fs->counters_["ratio_2e2m"] << endl;
1227     OS += fs->counters_["OS"];
1228     SS += fs->counters_["SS"];
1229     OS_4e += fs->counters_["OS_4e"];
1230     SS_4e += fs->counters_["SS_4e"];
1231     OS_4m += fs->counters_["OS_4m"];
1232     SS_4m += fs->counters_["SS_4m"];
1233     OS_2e2m += fs->counters_["OS_2e2m"];
1234     SS_2e2m += fs->counters_["SS_2e2m"];
1235     }
1236     }
1237     }
1238     assert(OS!=0 && SS!=0 && OS_4e!=0 && SS_4e!=0 && OS_4m!=0 && SS_4m!=0 && OS_2e2m && SS_2e2m!=0);
1239     map<TString,double> ssofRatios;
1240     ssofRatios[""] = OS/SS;
1241     ssofRatios["4e"] = OS_4e/SS_4e;
1242     ssofRatios["4m"] = OS_4m/SS_4m;
1243     ssofRatios["2e2m"] = OS_2e2m/SS_2e2m;
1244     cout << "returning: " << ssofRatios[""] << setw(8) << fixed << setprecision(2) << ssofRatios["4e"] << setw(8) << fixed << setprecision(2) << ssofRatios["4m"] << setw(8) << fixed << setprecision(2) << ssofRatios["2e2m"] << endl;
1245     return ssofRatios;
1246     }
1247