ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/NonMCBackground/src/plotSignalFakes.cc
(Generate patch)

Comparing UserCode/MitHzz4l/NonMCBackground/src/plotSignalFakes.cc (file contents):
Revision 1.3 by dkralph, Thu Jul 26 16:23:06 2012 UTC vs.
Revision 1.4 by dkralph, Tue Jul 31 16:46:22 2012 UTC

# Line 34 | Line 34 | using namespace std;
34   using namespace RooFit;
35   using namespace mithep;
36  
37 + TH1D* hpu_2011;
38 + TH1D* hpu_2012;
39 + //----------------------------------------------------------------------------------------
40 + class EvtsOfInterest
41 + {
42 + public:
43 +  EvtsOfInterest(TString config="");
44 +  bool has(unsigned run, unsigned evt);
45 +  vector<unsigned> runs,evts;
46 + };
47 + EvtsOfInterest::EvtsOfInterest(TString config)
48 + {
49 +  if(config!="") {
50 +    ifstream ifs(config);
51 +    assert(ifs.is_open());
52 +    string line;
53 +    while(getline(ifs,line)) {
54 +      stringstream ss(line);
55 +      unsigned run,evt;
56 +      ss >> run >> evt;
57 +      runs.push_back(run);
58 +      evts.push_back(evt);
59 +    }
60 +    ifs.close();
61 +  }
62 + }
63 + bool EvtsOfInterest::has(unsigned run, unsigned evt)
64 + {
65 +  for(unsigned i=0; i<runs.size(); i++) {
66 +    if(runs[i]==run && evts[i]==evt)
67 +      return true;
68 +  }
69 +  return false;
70 + }
71 + //----------------------------------------------------------------------------------------
72   TCanvas *can;
73 <
73 > //----------------------------------------------------------------------------------------
74 > class lepFrs
75 > {
76 > public:
77 >  double fwgt_3,fwgt_4;
78 >  double fwgt_lo_3,fwgt_lo_4;
79 >  double fwgt_hi_3,fwgt_hi_4;
80 > };
81 > //----------------------------------------------------------------------------------------
82   class dr_struct
83   {
84   public:
# Line 87 | Line 130 | bool passHlt(FOFlags &ctrl, TrigInfo ti,
130               unsigned lep4matchBits);
131   dr_struct fill_dr_struct(vector<SimpleLepton> jets, SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
132   void init_cuts(vector<TString> &cutstrs, map<TString,int> &cutvec);
133 + void fillLeptonFakeWeights(lepFrs &fwgts, FR_struct *fr, SimpleLepton lep3, SimpleLepton lep4);
134   void resetCutVect(map<TString,int> &cutvec) {
135    for(map<TString,int>::iterator it=cutvec.begin(); it!=cutvec.end(); it++)
136      cutvec[(*it).first] = 0;
137   }
138 + map<TString,TH1D*> setHistSet(CSample *cs, TString type, TString var);
139 + void shiftOverflows(map<TString,TH1D*> &hset);
140 + void scaleHists(map<TString,TH1D*> &hset);
141 + void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight);
142   //----------------------------------------------------------------------------------------
143   int main(int argc, char** argv)
144   {
145 +  initPUWeights();
146    vector<TString> cutstrs;
147    map<TString,int> cutvec;
148    init_cuts(cutstrs, cutvec);
149  
150 +  EvtsOfInterest eoiAdish("/tmp/adish-uniq");
151 +  EvtsOfInterest eoiMe("/tmp/me-uniq");
152 +
153 +  // arguments...
154    FOFlags ctrl;
155    parse_foargs( argc, argv, ctrl );
156    ctrl.dump();
157    bool makeFakeTuples = (ctrl.extraArgs.Contains("makeFakeTuples"));
158    FusionMva fusion(ctrl.uncert);//"./weights/againstZZ-fusion_BDTG.weights.xml");
159 <  bool makeJetTuple=false;
159 >  bool makeJetTuple=false; // jet tuple for vbf mva training
160 >  assert(ctrl.faketype=="SR"   || // plot events in signal region, if requested including ntuples of the extrapolation from 2P2F and 3P1F regions
161 >         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)
162 >         ctrl.faketype=="3P1F");  // plot 3P1F region (including the extrapolation to there from the 2P2F region), and if requested write out ntuple with SR prediction
163 >  if(ctrl.heavyFlavor) assert(ctrl.faketype=="2P2F");
164 >  if(ctrl.ssof) assert(ctrl.faketype=="2P2F");
165  
166    can = new TCanvas("can","can");
167  
# Line 146 | Line 204 | int main(int argc, char** argv)
204      resetCutVect(cutvec);
205      for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
206        filestuff *fs = (cs->fsv)[ifs];
207 <      if(makeFakeTuples) { // write a copy of the input trees for events that will be used for the SR fake prediction
207 >      if(makeFakeTuples && fs->dataset_!="fakes") { // write a copy of the input trees for events that will be used for the SR fake prediction
208          TString fakefilename(fs->fname_);
209          fakefilename.ReplaceAll(".root","-fakes.root");
210          fs->makeOutputFile(fakefilename);
211        }
212 <      cout << "\t" << fs->fname_ << endl;
212 >      cout << "\t" << fs->fname_; cout.flush();
213        FR_struct *fr = (fs->era_==2011) ? &fr2011 : &fr2012;
214        unsigned nDuplSkipped=0;
215        for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
216 <        fs->getentry(ientry,"","FOtree");
216 >        fs->getentry(ientry,"FOs","FOtree");
217 >        fs->getentry(ientry,"Zleptons","FOtree");
218          fs->getentry(ientry,"info","zznt");
219 <        if(ctrl.debug) cout << "----------------------\n" << "Run: " << fs->info->run << " Event: " << fs->info->evt << endl;
219 >
220 >        // if(eoiAdish.has(fs->info->run, fs->info->evt) &&
221 >        //    !eoiMe.has(fs->info->run, fs->info->evt)) {
222 >        //   cout << "found an event: " << fs->info->run << " " << fs->info->evt << endl;
223 >        //   ctrl.debug = true;
224 >        // } else
225 >        //   ctrl.debug = false;
226  
227          cutvec["start"] = fs->total_entries_;
228          if(fs->isdata_) {// && !(fs->dataset_=="fakes")) {
# Line 165 | Line 230 | int main(int argc, char** argv)
230            // in plotH4l I *don't* want to remove these, but here I *do*, because in this file I again loop over all z2 candidates
231            setMinMaxRun(fs->info->run, minRun, maxRun);
232            bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, runEvtv, nDuplSkipped);
233 <          if(dupl) continue;
234 <          pair<unsigned,unsigned> rl(fs->info->run, fs->info->lumi);
170 <          if(!fs->rlrm_.HasRunLumi(rl))
171 <            continue;
233 >          if(dupl) { if(ctrl.debug) cout << " failing dupl" << endl; continue; }
234 >          if(!fs->rlrm_.HasRunLumi(pair<unsigned,unsigned> (fs->info->run, fs->info->lumi))) { if(ctrl.debug) cout << " failing rlrm" << endl; continue; }
235          }
236          cutvec["rlrmAndDupl"] += 1;
237  
238          double wgt=1;
239          if(!fs->isdata_) {
240            double xsWgt = fs->lumi_*xstab.Get(fs->dataset_)/fs->total_entries_;
241 <          // double puWgt = weightTrue2012(fs->info->npu);
242 <          wgt = xsWgt;//*puWgt;
241 >          double puWgt = getPUWeight(fs->era_,fs->info->npu);
242 >          if(fs->era_==2012)
243 >            puWgt = weightTrue2012(fs->info->npu);
244 >          wgt = xsWgt*puWgt;
245          }
246          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)
247            fs->getentry(ientry,"weights","zznt");
# Line 192 | Line 257 | int main(int argc, char** argv)
257          if(best_mz1<=0) {
258            cout << "WARNING: best z1 mass: " << best_mz1 << endl;
259          }
260 +        if(ctrl.heavyFlavor && best_mz1<60) { if(ctrl.debug) cout << " failing mz1" << endl; continue; }
261          EventData evtdata;
262          evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
263          evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
# Line 199 | Line 265 | int main(int argc, char** argv)
265          // Look for a z2
266          vector<pair<SimpleLepton,SimpleLepton> > z2cands;
267          vector<TString> types;
268 <        int hiPtPassingZ2 = findZ2Candidates(fs->passingL, z2cands, types, true, 12, "pass",&best_z_indices);
269 <        if(z2cands.size() >1)
270 <          cout << "number of \"passing\" z2 cands: " << z2cands.size() << endl;
271 <        findZ2Candidates(fs->failingL, z2cands, types, true, 12, "fail");
268 >        TString signFlavor;
269 >        if(ctrl.heavyFlavor) signFlavor = "";
270 >        else if(ctrl.ssof)   signFlavor = "SS-SF";
271 >        else                 signFlavor = "OS-SF";
272 >        double minMz2 = ctrl.heavyFlavor ? 0 : 12;
273 >        int hiPtPassingZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "pass",&best_z_indices); // signal region
274 >        int hiPtFailingZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, signFlavor, minMz2, "fail"); // 2P+2F
275 >        int hiPtPfZ2      = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "PF", &best_z_indices, fs->failingL); // 3P+1F
276 >
277 >        if(ctrl.debug) {
278 >          cout << "z2 cands: " << endl;
279 >          for(unsigned iz2=0; iz2<z2cands.size(); iz2++)
280 >            cout << " ---" << types[iz2] << "'ing z2" << endl;
281 >        }
282  
283          for(unsigned iz2=0; iz2<z2cands.size(); iz2++) {
284            SimpleLepton lep1 = evtdata.Z1leptons[0];
285            SimpleLepton lep2 = evtdata.Z1leptons[1];
286            SimpleLepton lep3 = z2cands[iz2].first;
287            SimpleLepton lep4 = z2cands[iz2].second;
212
213          // bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.bdtfail,lep2.bdtfail,lep3.bdtfail,lep4.bdtfail) : true;
214            
215          TString channel = getChannel(lep1,lep2,lep3,lep4);
288            evtdata.Z2leptons.clear();
289            evtdata.Z2leptons.push_back(lep3);
290            evtdata.Z2leptons.push_back(lep4);
291            fillKinematics(evtdata,kine);
292 +          lepFrs fwgts;
293 +          fillLeptonFakeWeights(fwgts, fr, lep3, lep4);
294 +          TString channel = getChannel(lep1,lep2,lep3,lep4);
295 +          // bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.scID,lep2.scID,lep3.scID,lep4.scID) : true;
296 +
297 +          if(ctrl.heavyFlavor) {
298 +            if(fabs(lep1.dz) > 0.01 || fabs(lep2.dz) > 0.01)            { cout << " failing XXX" << endl; continue; }
299 +            if( !(fabs(lep3.ip3dSig) > 2 && fabs(lep4.ip3dSig) > 8) &&
300 +                !(fabs(lep4.ip3dSig) > 2 && fabs(lep3.ip3dSig) > 8)  )  { cout << " failing XXX" << endl; continue; }
301 +            if( !(fabs(lep3.d0) > .002 && fabs(lep4.d0) > .01) &&
302 +                !(fabs(lep4.d0) > .002 && fabs(lep3.d0) > .01)  )       { cout << " failing XXX" << endl; continue; }
303 +            if(fabs(lep3.d0) > 0.1 || fabs(lep4.d0) > 0.1)              { cout << " failing XXX" << endl; continue; }
304 +            if(fabs(lep3.dz) > 0.2 || fabs(lep4.dz) > 0.2)              { cout << " failing XXX" << endl; continue; }
305 +          } else {
306 +            if(fabs(lep3.ip3dSig) >= 4 || fabs(lep4.ip3dSig) >= 4)      { if(ctrl.debug) cout << " failing sip" << endl; continue; } // |sip| < 4 is applied to lep1, lep2 in ZPlusX
307 +            if(!leptonDrReqs(lep1,lep2,lep3,lep4))                      { if(ctrl.debug) cout << " failing dr" << endl; continue; }
308 +            if(kine.m4l < 100)                                          { if(ctrl.debug) cout << " failing m4l 100" << endl; continue; }
309 +            if(!resonanceKilling(lep1,lep2,lep3,lep4))                  { if(ctrl.debug) cout << " failing reskill" << endl; continue; }
310 +          }
311 +          if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4))                   { if(ctrl.debug) cout << " failing lepton pt " << endl; continue; }
312  
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          
313            cutvec["4lsele"] += 1;
314  
315            //
316            // jets!
317            //
318 <          bool doJets=true;
318 >          bool doJets=false;
319            vector<SimpleLepton> goodJets;
320            if(doJets) {
321 +            fs->getentry(ientry,"jets","FOtree");
322              if(fs->jets->size() > 1) cutvec["twoJets"] += 1;
323              bool hazJetz = findGoodJets(goodJets, fs, lep1, lep2, lep3, lep4);
324              if(goodJets.size() > 1) cutvec["twoJetsAfter"] += 1;
325 <            if(!hazJetz) continue;
325 >            if(!hazJetz) { cout << " failing XXX" << endl; continue; }
326              ControlFlags ctrlTmp;
327              fillJetInfo(goodJets,ji,ctrlTmp);
328              if(makeJetTuple) {
329                evtVar = fs->info->evt;
330                jettuple->Fill();
331              }
332 +            fusion.setValues(ji,kine);
333            }
334  
335            cutvec["filling"] += 1;
336  
337 <          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
338 <            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)
339 <              cout << "    iz2: " << iz2 << " -------> not highest pt z2 candidate, so skip it" << endl;
252 <              continue;
253 <            }
337 >          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
338 >            // llll events
339 >            if((fs->dataset_!="fakes") && (iz2!=hiPtPassingZ2)) { cout << " failing XXX" << endl; 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)
340              cutvec["fillPass"] += 1;
341              fillAllHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, wgt);
342 <            if(doJets) {
343 <              fusion.setValues(ji,kine);
344 <              fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
342 >            if(doJets) fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
343 >
344 >          } else if(types[iz2]=="fail") { // lljj events
345 >            if(iz2!=hiPtFailingZ2 && ctrl.plotWholeSample) { cout << " failing XXX" << endl; continue; }
346 >            double centr=0,lo=0,hi=0;
347 >            if(ctrl.faketype=="2P2F") {
348 >              if(ctrl.plotWholeSample) { // make plots without weighting with the FR
349 >                centr = wgt;
350 >              } else {
351 >                centr = wgt*fwgts.fwgt_3*fwgts.fwgt_4;
352 >                lo    = wgt*fwgts.fwgt_lo_3*fwgts.fwgt_lo_4;
353 >                hi    = wgt*fwgts.fwgt_hi_3*fwgts.fwgt_hi_4;
354 >              }
355 >            } else if(ctrl.faketype=="3P1F") { // apply the weights for extrapolation from 2P2F region to 3P1F region
356 >              centr = wgt*(fwgts.fwgt_3    + fwgts.fwgt_4);
357 >              lo    = wgt*(fwgts.fwgt_lo_3 + fwgts.fwgt_lo_4);
358 >              hi    = wgt*(fwgts.fwgt_hi_3 + fwgts.fwgt_hi_4);
359              }
360 <          } else if(types[iz2]=="fail") {
361 <            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;
360 >
361 >            // runfile << fixed << setprecision(0) << fs->info->run << " " << fixed << setprecision(0) << fs->info->evt << endl;
362  
363              if(makeFakeTuples && fs->dataset_!="fakes") {
364 <              fs->getentry(ientry,"","zznt"); // make sure we've got this entry for all the branches
365 <              fillKinematics(evtdata,*fs->kine);
366 <              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?)
367 <              fs->outtuple->Fill();
368 <              fs->outFotuple->Fill();
364 >              double fillwgt;
365 >              bool dofill=true;
366 >              if(ctrl.faketype=="2P2F") {
367 >                assert(fs->isdata_);
368 >                fillwgt = centr;
369 >              } else if(ctrl.faketype=="3P1F") {
370 >                fillwgt = - wgt*(fwgts.fwgt_3*fwgts.fwgt_4 + fwgts.fwgt_4*fwgts.fwgt_3);
371 >                dofill = (cs->name=="data" || cs->name=="2012" || cs->name=="2011");
372 >              } else assert(0);
373 >              fillFakeTuple(cs,fs,evtdata,ientry,fillwgt);
374              }
375 <
375 >            cutvec["fillFail"] += 1;
376              fillAllHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, centr, lo, hi);
377 <            if(doJets) {
378 <              fusion.setValues(ji,kine);
379 <              fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, centr, lo, hi);
377 >            if(doJets) fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, centr, lo, hi);
378 >
379 >          } else if(types[iz2]=="PF") { // lllj events
380 >            if(fs->dataset_!="fakes" && iz2!=hiPtPfZ2) continue; // shouldn't have this when I extrapolate to signal region
381 >
382 >            if(makeFakeTuples && fs->dataset_!="fakes" && ctrl.faketype=="3P1F") {
383 >              assert(lep3.isLoose || lep4.isLoose);
384 >              assert(!(lep3.isLoose && lep4.isLoose));
385 >              double fwgt = lep3.isLoose ? fwgts.fwgt_4 : fwgts.fwgt_3;
386 >              double fillwgt;// only fill for data or ZZ
387 >              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?)
388 >              else if(cs->name=="zz")   fillwgt = -wgt*fwgt;    // subtract off the zz contribution in the 3P1F region
389 >              else assert(0);
390 >              fillFakeTuple(cs,fs,evtdata,ientry,fillwgt);
391              }
392 +            
393 +            cutvec["fillPF"] += 1;
394 +            fillAllHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, wgt);
395 +            if(doJets) fillAllJetHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
396            } else assert(0);
397          }
398        }
399 <      cout << "\t\tWARNING: skipped " << nDuplSkipped << " duplicate events" << endl;
399 >      cout << "\t\t" << setw(7) << nDuplSkipped << " duplicate events skipped" << endl;
400        if(makeFakeTuples) {
401          fs->outFotuple->getFile()->cd();
402          fs->outFotuple->getTree()->Write();
# Line 304 | Line 415 | int main(int argc, char** argv)
415    assert(samplev.size()>0);
416    vector<TString> typev;
417    typev.push_back("all");
418 +
419    bool plotAllCats=false;
420    if(plotAllCats) {
421      typev.push_back("4e");
422      typev.push_back("4m");
423      typev.push_back("2e2m");
424    }
425 +
426 +  // loop over channels
427    for(unsigned itype=0; itype<typev.size(); itype++) {
428      TString type(typev[itype]);
429      gSystem->mkdir(ctrl.outdir+"/"+plotLabel+"/"+type,true);
430      TFile runHistFile(ctrl.outdir+"/"+plotLabel+"/"+type+"/runs.root","recreate");
431 +    // loop over variables
432      map<TString,TH1D*>::iterator it_v;
433      for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
434        TString var((*it_v).first);
435        CPlot cplot(var,"",(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),"events",ctrl.outdir+"/"+plotLabel+"/"+type+"/plots");
436 +      double fakeCounter=0;
437        double ymax=0;
438 +      // loop over csamples
439        for(unsigned isam=0; isam<samplev.size(); isam++) {
440          CSample *cs = samplev[isam];
441 <        TH1D *hObs = (*(cs->hists)[type+"_obs"])[var];
442 <        TH1D *hPred = (*(cs->hists)[type+"_pred"])[var];
443 <        TH1D *hPred_lo = (*(cs->hists)[type+"_pred_lo"])[var];
327 <        TH1D *hPred_hi = (*(cs->hists)[type+"_pred_hi"])[var];
328 <        if(false) { //var=="mjj" || var=="etaProd" || var=="ncj") {
329 <          shiftOverflows(hObs);
330 <          shiftOverflows(hPred);
331 <          shiftOverflows(hPred_lo);
332 <          shiftOverflows(hPred_hi);
333 <        }
441 >        map<TString,TH1D*> hs = setHistSet(cs,type,var);
442 >        if(var=="met")  //var=="mjj" || var=="etaProd" || var=="ncj")
443 >          shiftOverflows(hs);
444          bool plotShapeOnly = false;
445 <        if(plotShapeOnly) {
446 <          hObs->Scale(1./integrateHist(hObs));
447 <          hPred->Scale(1./integrateHist(hPred));
338 <          hPred_lo->Scale(1./integrateHist(hPred_lo));
339 <          hPred_hi->Scale(1./integrateHist(hPred_hi));
340 <        }
341 <
445 >        if(plotShapeOnly)
446 >          scaleHists(hs);
447 >        
448          if(cs->isdata && !(cs->name=="fakes")) {
449 <          double ratio = integrateHist(hObs) / integrateHist(hPred);
450 <          bool plotObs = true;
451 <          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));
449 >          if(ctrl.faketype=="SR" || (ctrl.heavyFlavor && !ctrl.plotWholeSample)) {
450 >            cplot.AddHist1D(hs["obs"],cs->legend+": "+integral_str(hs["obs"],0),"E");
451 >            ymax = max(ymax,hs["obs"]->GetMaximum());
452            }
453 <        } else {
454 <          TH1D *mchist = hObs;
455 <          bool stackMc = false;
453 >          if(ctrl.faketype=="2P2F") {
454 >            if(ctrl.plotWholeSample) {
455 >              cplot.AddHist1D(hs["pred"],cs->legend+": "+integral_str(hs["pred"],0),"E");
456 >              ymax = max(ymax,hs["pred"]->GetMaximum());
457 >            } else {
458 >              cplot.AddHist1D(hs["pred"],   "FR predic: "+integral_str(hs["pred"],3),   "hist",kRed);
459 >              cplot.AddHist1D(hs["pred_lo"],  "stat lo: "+integral_str(hs["pred_lo"],2),"hist",kRed,kDashed);
460 >              cplot.AddHist1D(hs["pred_hi"],  "stat hi: "+integral_str(hs["pred_hi"],2),"hist",kRed,kDashed);
461 >              ymax = max(ymax,histMax(hs["pred"],hs["pred_lo"],hs["pred_hi"]));
462 >            }
463 >          }
464 >          if(ctrl.faketype=="3P1F") {
465 >            double ratio = 0;//integrateHist(hs["PF"]) / integrateHist(hs["pred"]);
466 >            cplot.AddHist1D(hs["PF"],cs->legend+": "+integral_str(hs["PF"],0)+", ratio: "+f_to_a(ratio),"E",cs->color);
467 >            if(!ctrl.plotWholeSample) {
468 >              cplot.AddToStack(hs["pred"],cs->legend+"(2P2F extrap.): "+integral_str(hs["pred"],1), kRed);
469 >              ymax = max(ymax,histMax(hs["PF"],cplot.GetStack(),hs["pred"]));
470 >            } else {
471 >              ymax = max(ymax,hs["PF"]->GetMaximum());
472 >            }
473 >            fakeCounter = integrateHist(hs["PF"]) - integrateHist(hs["pred"]);
474 >          }
475 >        } else { // mc
476 >          TH1D *mchist = 0;
477 >          if(ctrl.faketype=="SR")   mchist = hs["obs"];
478 >          if(ctrl.faketype=="2P2F") {
479 >            if(ctrl.plotWholeSample)  mchist = hs["pred"];
480 >            else                      mchist = hs["obs"];
481 >          }
482 >          if(ctrl.faketype=="3P1F")   mchist = hs["PF"];
483 >          assert(mchist);
484 >          bool stackMc = true;
485            if(stackMc) cplot.AddToStack(mchist,cs->legend+": "+integral_str(mchist,2),cs->color);
486            else        cplot.AddHist1D(mchist,cs->legend +": "+integral_str(mchist,3),"Ehist",cs->color);//cs->color);
487 <          ymax = max(ymax,mchist->GetMaximum());
487 >          if(cs->name=="zz") fakeCounter -= integrateHist(hs["PF"]);
488 >          ymax = max(ymax,histMax(mchist,cplot.GetStack()));
489          }
490          if(cs->isdata && var=="run") {
491 <          assert(hObs->GetBinContent(0)==0 && hObs->GetBinContent(hObs->GetXaxis()->GetNbins()+1)==0);
492 <          hObs->Write("runs");
491 >          assert(hs["obs"]->GetBinContent(0)==0 && hs["obs"]->GetBinContent(hs["obs"]->GetXaxis()->GetNbins()+1)==0);
492 >          hs["obs"]->Write("runs");
493          }
494 <        if(var.Contains("fusionMVA"))
366 <          cplot.SetLogy();
367 <        else
494 >        if(!var.Contains("fusionMVA"))
495            cplot.SetYRange(0,1.2*ymax);
496 +        if(ctrl.faketype=="3P1F") cplot.AddTextBox("diff: "+f_to_a(fakeCounter),.7,.5,.8,.6);
497        }
498        cplot.Draw(can,true,"png");
499 +      if(var.Contains("fusionMVA")) {
500 +        cplot.SetLogy();
501 +        cplot.Draw(can,true,"png",0,var+"-log");
502 +        cplot.SetLogy(false);
503 +      }
504      }
505      runHistFile.Close();
506      makeHTML(ctrl,type,plotLabel);
# Line 381 | Line 514 | map<TString,map<TString,TH1D*>* > init_h
514    map<TString,TH1D*> *h_4e_pred         = new map<TString,TH1D*>;      hists["4e_pred"]         = h_4e_pred;
515    map<TString,TH1D*> *h_4e_pred_lo      = new map<TString,TH1D*>;      hists["4e_pred_lo"]      = h_4e_pred_lo;
516    map<TString,TH1D*> *h_4e_pred_hi      = new map<TString,TH1D*>;      hists["4e_pred_hi"]      = h_4e_pred_hi;
517 +  map<TString,TH1D*> *h_4e_PF           = new map<TString,TH1D*>;      hists["4e_PF"]           = h_4e_PF;
518 +  map<TString,TH1D*> *h_4e_PF_lo        = new map<TString,TH1D*>;      hists["4e_PF_lo"]        = h_4e_PF_lo;
519 +  map<TString,TH1D*> *h_4e_PF_hi        = new map<TString,TH1D*>;      hists["4e_PF_hi"]        = h_4e_PF_hi;
520    map<TString,TH1D*> *h_4m_obs          = new map<TString,TH1D*>;      hists["4m_obs"]          = h_4m_obs;
521    map<TString,TH1D*> *h_4m_pred         = new map<TString,TH1D*>;      hists["4m_pred"]         = h_4m_pred;
522    map<TString,TH1D*> *h_4m_pred_lo      = new map<TString,TH1D*>;      hists["4m_pred_lo"]      = h_4m_pred_lo;
523    map<TString,TH1D*> *h_4m_pred_hi      = new map<TString,TH1D*>;      hists["4m_pred_hi"]      = h_4m_pred_hi;
524 +  map<TString,TH1D*> *h_4m_PF           = new map<TString,TH1D*>;      hists["4m_PF"]           = h_4m_PF;
525 +  map<TString,TH1D*> *h_4m_PF_lo        = new map<TString,TH1D*>;      hists["4m_PF_lo"]        = h_4m_PF_lo;
526 +  map<TString,TH1D*> *h_4m_PF_hi        = new map<TString,TH1D*>;      hists["4m_PF_hi"]        = h_4m_PF_hi;
527    map<TString,TH1D*> *h_2e2m_obs        = new map<TString,TH1D*>;      hists["2e2m_obs"]        = h_2e2m_obs;
528    map<TString,TH1D*> *h_2e2m_pred       = new map<TString,TH1D*>;      hists["2e2m_pred"]       = h_2e2m_pred;
529    map<TString,TH1D*> *h_2e2m_pred_lo    = new map<TString,TH1D*>;      hists["2e2m_pred_lo"]    = h_2e2m_pred_lo;
530    map<TString,TH1D*> *h_2e2m_pred_hi    = new map<TString,TH1D*>;      hists["2e2m_pred_hi"]    = h_2e2m_pred_hi;
531 +  map<TString,TH1D*> *h_2e2m_PF         = new map<TString,TH1D*>;      hists["2e2m_PF"]         = h_2e2m_PF;
532 +  map<TString,TH1D*> *h_2e2m_PF_lo      = new map<TString,TH1D*>;      hists["2e2m_PF_lo"]      = h_2e2m_PF_lo;
533 +  map<TString,TH1D*> *h_2e2m_PF_hi      = new map<TString,TH1D*>;      hists["2e2m_PF_hi"]      = h_2e2m_PF_hi;
534    map<TString,TH1D*> *h_all_obs         = new map<TString,TH1D*>;      hists["all_obs"]         = h_all_obs;
535    map<TString,TH1D*> *h_all_pred        = new map<TString,TH1D*>;      hists["all_pred"]        = h_all_pred;
536    map<TString,TH1D*> *h_all_pred_lo     = new map<TString,TH1D*>;      hists["all_pred_lo"]     = h_all_pred_lo;
537    map<TString,TH1D*> *h_all_pred_hi     = new map<TString,TH1D*>;      hists["all_pred_hi"]     = h_all_pred_hi;
538 +  map<TString,TH1D*> *h_all_PF          = new map<TString,TH1D*>;      hists["all_PF"]          = h_all_PF;
539 +  map<TString,TH1D*> *h_all_PF_lo       = new map<TString,TH1D*>;      hists["all_PF_lo"]       = h_all_PF_lo;
540 +  map<TString,TH1D*> *h_all_PF_hi       = new map<TString,TH1D*>;      hists["all_PF_hi"]       = h_all_PF_hi;
541    map<TString,map<TString,TH1D*>* >::iterator it_h;
542  
543    for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
544      (*((*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();
545      (*((*it_h).second))["run"]          = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};",          50,160800,196535);   (*((*it_h).second))["run"]->Sumw2();
546 <    (*((*it_h).second))["mZ1"]          = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};",    20,60,120);          (*((*it_h).second))["mZ1"]->Sumw2();
546 >    (*((*it_h).second))["mZ1"]          = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};",    20,40,120);          (*((*it_h).second))["mZ1"]->Sumw2();
547      (*((*it_h).second))["mZ2"]          = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};",    30,0,115);           (*((*it_h).second))["mZ2"]->Sumw2();
548      (*((*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();
549      (*((*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();
# Line 406 | Line 551 | map<TString,map<TString,TH1D*>* > init_h
551      (*((*it_h).second))["m4l"]          = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};",    35,100,600);          (*((*it_h).second))["m4l"]->Sumw2();
552      (*((*it_h).second))["Z1pt"]         = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};",  20,0,200);           (*((*it_h).second))["Z1pt"]->Sumw2();
553      (*((*it_h).second))["ZZpt"]         = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};",  30,0,200);           (*((*it_h).second))["ZZpt"]->Sumw2();
554 +    (*((*it_h).second))["met"]          = new TH1D(TString("met") +"_"+(*it_h).first+str,";#bf{met [GeV]};",    30,0,100);           (*((*it_h).second))["met"]->Sumw2();
555  
556      (*((*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();
557      (*((*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();
# Line 417 | Line 563 | map<TString,map<TString,TH1D*>* > init_h
563      (*((*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();
564      (*((*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();
565  
566 <    (*((*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();
567 <    (*((*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();
568 <    (*((*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();
569 <    (*((*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();
566 >    (*((*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();
567 >    (*((*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();
568 >    (*((*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();
569 >    (*((*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();
570 >    (*((*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();
571 >    (*((*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();
572 >
573 >    (*((*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();
574 >    (*((*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();
575 >    (*((*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();
576 >    (*((*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();
577 >    (*((*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();
578 >    (*((*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();
579 >
580 >    (*((*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();
581 >    (*((*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();
582 >    (*((*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();
583 >    (*((*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();
584  
585      (*((*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();
586      (*((*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();
# Line 478 | Line 638 | map<TString,map<TString,TH1D*>* > init_h
638   //--------------------------------------------------------------------------------------------------
639   void makeHTML(FOFlags &ctrl, TString type, TString plotLabel)
640   {
641 <  TString title("Signal region: "+type+", "+plotLabel);
642 <  ofstream htmlfile;
643 <  char htmlfname[100];
644 <  sprintf(htmlfname,"%s/plots.html",TString(ctrl.outdir+"/"+plotLabel+"/"+type).Data());
645 <  htmlfile.open(htmlfname);
641 >  TString tmpString(plotLabel);
642 >  tmpString.ReplaceAll("/"," ");
643 >  TString title(ctrl.faketype+", "+tmpString+", "+type);
644 >  TString htmlfname(ctrl.outdir+"/"+plotLabel+"/"+type+"/plots.html");
645 >  ofstream htmlfile(htmlfname);
646  
647    htmlfile << "<!DOCTYPE html" << endl;
648    htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
649    htmlfile << "<html>" << endl;
650  
651    htmlfile << "<head><title>"+title+"</title></head>" << endl;
652 <  htmlfile << "<body bgcolor=\"EEEEEE\">" << endl;
652 >  htmlfile << "<body bgcolor=\"000000\">" << endl;
653    htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
654  
655 +  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">boson kinematics</h3>" << endl;
656    htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
657  
658    htmlfile << "<tr>" << endl;
659 <  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;
660 <  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;
661 <  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;
659 >  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;
660 >  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;
661 >  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;
662    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
663    htmlfile << "</tr>" << endl;
664  
665    htmlfile << "<tr>" << endl;
666 <  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;
667 <  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;
668 <  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;
666 >  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;
667 >  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;
668 >  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;
669    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
670    htmlfile << "</tr>" << endl;
671  
672    htmlfile << "<tr>" << endl;
673    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;
674    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;
675 +  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;
676    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
677    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
678    htmlfile << "</tr>" << endl;
679  
680 +  htmlfile << "</table>" << endl;
681 +  htmlfile << "<hr />" << endl;
682 +  htmlfile << "control: " << endl;
683 +  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
684 +
685    htmlfile << "<tr>" << endl;
686 <  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;
687 <  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;
688 <  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;
689 <  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;
686 >  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;
687 >  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;
688 >  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
689 >  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
690    htmlfile << "</tr>" << endl;
691  
692 +  htmlfile << "</table>" << endl;
693 +
694 +  htmlfile << "</body>" << endl;
695 +  htmlfile << "</html>" << endl;
696 +  htmlfile.close();
697 +
698 +  TString leptonfname(htmlfname);
699 +  leptonfname.ReplaceAll("plots.html","leptonplots.html");
700 +  htmlfile.open(leptonfname);
701 +  cout << "opening: " << leptonfname << endl;
702 +
703 +  htmlfile << "<!DOCTYPE html" << endl;
704 +  htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
705 +  htmlfile << "<html>" << endl;
706 +
707 +  htmlfile << "<head><title>"+title+"</title></head>" << endl;
708 +  htmlfile << "<body bgcolor=\"000000\">" << endl;
709 +  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
710 +
711 +  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">lepton plots</h3>" << endl;
712 +  htmlfile << "<hr />" << endl;
713 +  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
714 +  htmlfile << "</table>" << endl;
715 +
716 +  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Z1 leptons:</h3>" << 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/pt_l1.png\"><img src=\"plots/pt_l1.png\" alt=\"plots/pt_l1.png\" width=\"100%\"></a></td>" << endl;
721    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;
722 <  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;
723 <  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;
722 >  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;
723 >  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;
724 >  htmlfile << "</tr>" << endl;
725 >
726 >  htmlfile << "<tr>" << endl;
727 >  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;
728 >  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;
729 >  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
730 >  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
731 >  htmlfile << "</tr>" << endl;
732 >
733 >  htmlfile << "<tr>" << endl;
734 >  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;
735 >  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;
736 >  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;
737 >  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;
738    htmlfile << "</tr>" << endl;
739  
740    // htmlfile << "<tr>" << endl;
# Line 536 | Line 744 | void makeHTML(FOFlags &ctrl, TString typ
744    // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
745    // htmlfile << "</tr>" << endl;
746  
747 +  htmlfile << "</table>" << endl;
748 +  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">extra leptons (l3 and l4): </h3>" << endl;
749 +  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
750 +
751    htmlfile << "<tr>" << endl;
752 <  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;
753 <  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;
752 >  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;
753 >  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;
754    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;
755    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;
756    htmlfile << "</tr>" << endl;
757  
758 +  htmlfile << "<tr>" << endl;
759 +  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;
760 +  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;
761 +  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;
762 +  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;
763 +  htmlfile << "</tr>" << endl;
764 +
765 +  htmlfile << "<tr>" << endl;
766 +  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;
767 +  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;
768 +  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;
769 +  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;
770 +  htmlfile << "</tr>" << endl;
771 +
772 +  htmlfile << "<tr>" << endl;
773 +  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;
774 +  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;
775 +  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
776 +  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
777 +  htmlfile << "</tr>" << endl;
778 +
779    htmlfile << "</table>" << endl;
780 <  htmlfile << "jet plots: " << endl;
780 >
781 >  htmlfile << "</body>" << endl;
782 >  htmlfile << "</html>" << endl;
783 >  htmlfile.close();
784 >
785 >  TString jetfname(htmlfname);
786 >  jetfname.ReplaceAll("plots.html","jetplots.html");
787 >  htmlfile.open(jetfname);
788 >
789 >  htmlfile << "<!DOCTYPE html" << endl;
790 >  htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
791 >  htmlfile << "<html>" << endl;
792 >
793 >  htmlfile << "<head><title>"+title+"</title></head>" << endl;
794 >  htmlfile << "<body bgcolor=\"000000\">" << endl;
795 >  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
796 >
797 >  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">jet plots</h3>" << endl;
798 >  htmlfile << "<hr />" << endl;
799    htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
800  
801    htmlfile << "<tr>" << endl;
# Line 618 | Line 869 | void makeHTML(FOFlags &ctrl, TString typ
869    htmlfile << "</tr>" << endl;
870  
871    htmlfile << "<tr>" << endl;
872 <  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;
873 <  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;
874 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
872 >  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;
873 >  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;
874 >  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;
875    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
876    htmlfile << "</tr>" << endl;
877  
878    htmlfile << "<tr>" << endl;
879 <  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;
880 <  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;
879 >  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;
880 >  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;
881    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
882    htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
883    htmlfile << "</tr>" << endl;
884 +
885 +
886    htmlfile << "</table>" << endl;
887  
888    htmlfile << "<hr />" << endl;
# Line 646 | Line 899 | void fillHist(CSample *cs, TString chann
899    (*(cs->hists)["all_"+type])[var]->Fill(           val,   wgt);
900    if(channel!="")
901       (*(cs->hists)[channel+"_"+type])[var]->Fill(   val,   wgt);
902 <  if(type=="pred") {
902 >  if(type=="pred" || type=="PF") {
903      (*(cs->hists)["all_"+type+"_lo"])[var]->Fill(   val,   wgt_lo);
904      (*(cs->hists)["all_"+type+"_hi"])[var]->Fill(   val,   wgt_hi);
905      if(channel!="") {
# Line 660 | Line 913 | void fillAllHists(FOFlags ctrl, CSample
913                    SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
914                    double wgt, double wgt_lo, double wgt_hi)
915   {
916 <  fillHist( cs, channel, type, "npv"      , fs->info->npv  ,    wgt, wgt_lo, wgt_hi);
917 <  fillHist( cs, channel, type, "run"      , fs->info->run  ,    wgt, wgt_lo, wgt_hi);
918 <  fillHist( cs, channel, type, "mZ1"      , kine.mZ1  ,         wgt, wgt_lo, wgt_hi);                
919 <  fillHist( cs, channel, type, "mZ2"      , kine.mZ2  ,         wgt, wgt_lo, wgt_hi);                
920 <  fillHist( cs, channel, type, "mZ2_lo"   , kine.mZ2  ,         wgt, wgt_lo, wgt_hi);                
921 <  fillHist( cs, channel, type, "m4l_lo"   , kine.m4l  ,         wgt, wgt_lo, wgt_hi);                
922 <  fillHist( cs, channel, type, "m4l_med"  , kine.m4l  ,         wgt, wgt_lo, wgt_hi);                
923 <  fillHist( cs, channel, type, "m4l"      , kine.m4l  ,         wgt, wgt_lo, wgt_hi);                
924 <  fillHist( cs, channel, type, "Z1pt"     , kine.Z1pt ,         wgt, wgt_lo, wgt_hi);                
925 <  fillHist( cs, channel, type, "ZZpt"     , kine.ZZpt ,         wgt, wgt_lo, wgt_hi);                
926 <  fillHist( cs, channel, type, "ip3ds_l1" , lep1.ip3dSig ,      wgt, wgt_lo, wgt_hi);
927 <  fillHist( cs, channel, type, "ip3ds_l2" , lep2.ip3dSig ,      wgt, wgt_lo, wgt_hi);
928 <  fillHist( cs, channel, type, "ip3ds_l3" , lep3.ip3dSig ,      wgt, wgt_lo, wgt_hi);
929 <  fillHist( cs, channel, type, "ip3ds_l4" , lep4.ip3dSig ,      wgt, wgt_lo, wgt_hi);
930 <  fillHist( cs, channel, type, "pt_l1"    , lep1.vec.Pt() ,     wgt, wgt_lo, wgt_hi);
931 <  fillHist( cs, channel, type, "pt_l2"    , lep2.vec.Pt() ,     wgt, wgt_lo, wgt_hi);
932 <  fillHist( cs, channel, type, "pt_l3"    , lep3.vec.Pt() ,     wgt, wgt_lo, wgt_hi);
933 <  fillHist( cs, channel, type, "pt_l4"    , lep4.vec.Pt() ,     wgt, wgt_lo, wgt_hi);
934 <  fillHist( cs, channel, type, "eta_l1"   , lep1.vec.Eta() ,    wgt, wgt_lo, wgt_hi);
935 <  fillHist( cs, channel, type, "eta_l2"   , lep2.vec.Eta() ,    wgt, wgt_lo, wgt_hi);
936 <  fillHist( cs, channel, type, "eta_l3"   , lep3.vec.Eta() ,    wgt, wgt_lo, wgt_hi);
937 <  fillHist( cs, channel, type, "eta_l4"   , lep4.vec.Eta() ,    wgt, wgt_lo, wgt_hi);
938 <  fillHist( cs, channel, type, "dR_l3l4_lo",dr(lep3,lep4),      wgt, wgt_lo, wgt_hi);
939 <  fillHist( cs, channel, type, "dR_l3l4",   dr(lep3,lep4),      wgt, wgt_lo, wgt_hi);
916 >  fillHist( cs, channel, type, "npv"         , fs->info->npv  , wgt, wgt_lo, wgt_hi);
917 >  fillHist( cs, channel, type, "run"         , fs->info->run  , wgt, wgt_lo, wgt_hi);
918 >  fillHist( cs, channel, type, "mZ1"         , kine.mZ1       , wgt, wgt_lo, wgt_hi);                
919 >  fillHist( cs, channel, type, "mZ2"         , kine.mZ2       , wgt, wgt_lo, wgt_hi);                
920 >  fillHist( cs, channel, type, "mZ2_lo"      , kine.mZ2       , wgt, wgt_lo, wgt_hi);                
921 >  fillHist( cs, channel, type, "m4l_lo"      , kine.m4l       , wgt, wgt_lo, wgt_hi);                
922 >  fillHist( cs, channel, type, "m4l_med"     , kine.m4l       , wgt, wgt_lo, wgt_hi);                
923 >  fillHist( cs, channel, type, "m4l"         , kine.m4l       , wgt, wgt_lo, wgt_hi);                
924 >  fillHist( cs, channel, type, "Z1pt"        , kine.Z1pt      , wgt, wgt_lo, wgt_hi);                
925 >  fillHist( cs, channel, type, "ZZpt"        , kine.ZZpt      , wgt, wgt_lo, wgt_hi);                
926 >  fillHist( cs, channel, type, "met"         , fs->info->met  , wgt, wgt_lo, wgt_hi);                
927 >  fillHist( cs, channel, type, "ip3ds_l1"    , lep1.ip3dSig   , wgt, wgt_lo, wgt_hi);
928 >  fillHist( cs, channel, type, "ip3ds_l2"    , lep2.ip3dSig   , wgt, wgt_lo, wgt_hi);
929 >  fillHist( cs, channel, type, "ip3ds_l3"    , lep3.ip3dSig   , wgt, wgt_lo, wgt_hi);
930 >  fillHist( cs, channel, type, "ip3ds_l4"    , lep4.ip3dSig   , wgt, wgt_lo, wgt_hi);
931 >  fillHist( cs, channel, type, "ip3ds_l3_lo" , lep3.ip3dSig   , wgt, wgt_lo, wgt_hi);
932 >  fillHist( cs, channel, type, "ip3ds_l4_lo" , lep4.ip3dSig   , wgt, wgt_lo, wgt_hi);
933 >  fillHist( cs, channel, type, "d0_l1"       , lep1.d0        , wgt, wgt_lo, wgt_hi);
934 >  fillHist( cs, channel, type, "d0_l2"       , lep2.d0        , wgt, wgt_lo, wgt_hi);
935 >  fillHist( cs, channel, type, "d0_l3"       , lep3.d0        , wgt, wgt_lo, wgt_hi);
936 >  fillHist( cs, channel, type, "d0_l4"       , lep4.d0        , wgt, wgt_lo, wgt_hi);
937 >  fillHist( cs, channel, type, "d0_l3_lo"    , lep3.d0        , wgt, wgt_lo, wgt_hi);
938 >  fillHist( cs, channel, type, "d0_l4_lo"    , lep4.d0        , wgt, wgt_lo, wgt_hi);
939 >  fillHist( cs, channel, type, "dz_l1"       , lep1.dz        , wgt, wgt_lo, wgt_hi);
940 >  fillHist( cs, channel, type, "dz_l2"       , lep2.dz        , wgt, wgt_lo, wgt_hi);
941 >  fillHist( cs, channel, type, "dz_l3"       , lep3.dz        , wgt, wgt_lo, wgt_hi);
942 >  fillHist( cs, channel, type, "dz_l4"       , lep4.dz        , wgt, wgt_lo, wgt_hi);
943 >  fillHist( cs, channel, type, "pt_l1"       , lep1.vec.Pt()  , wgt, wgt_lo, wgt_hi);
944 >  fillHist( cs, channel, type, "pt_l2"       , lep2.vec.Pt()  , wgt, wgt_lo, wgt_hi);
945 >  fillHist( cs, channel, type, "pt_l3"       , lep3.vec.Pt()  , wgt, wgt_lo, wgt_hi);
946 >  fillHist( cs, channel, type, "pt_l4"       , lep4.vec.Pt()  , wgt, wgt_lo, wgt_hi);
947 >  fillHist( cs, channel, type, "eta_l1"      , lep1.vec.Eta() , wgt, wgt_lo, wgt_hi);
948 >  fillHist( cs, channel, type, "eta_l2"      , lep2.vec.Eta() , wgt, wgt_lo, wgt_hi);
949 >  fillHist( cs, channel, type, "eta_l3"      , lep3.vec.Eta() , wgt, wgt_lo, wgt_hi);
950 >  fillHist( cs, channel, type, "eta_l4"      , lep4.vec.Eta() , wgt, wgt_lo, wgt_hi);
951 >  fillHist( cs, channel, type, "dR_l3l4_lo"  , dr(lep3,lep4)  , wgt, wgt_lo, wgt_hi);
952 >  fillHist( cs, channel, type, "dR_l3l4"     , dr(lep3,lep4)  , wgt, wgt_lo, wgt_hi);
953   }
954   //----------------------------------------------------------------------------------------
955   void fillAllJetHists( FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
# Line 767 | Line 1033 | bool passHlt(FOFlags &ctrl, TrigInfo ti,
1033    return pass;
1034   }
1035   //----------------------------------------------------------------------------------------
1036 + void fillLeptonFakeWeights(lepFrs &fwgts, FR_struct *fr, SimpleLepton lep3, SimpleLepton lep4)
1037 + {
1038 +  fwgts.fwgt_3    = get_fake_weight("",lep3,*fr);
1039 +  fwgts.fwgt_lo_3 = get_fake_weight("lo",lep3,*fr);
1040 +  fwgts.fwgt_hi_3 = get_fake_weight("hi",lep3,*fr);
1041 +  fwgts.fwgt_4    = get_fake_weight("",lep4,*fr);
1042 +  fwgts.fwgt_lo_4 = get_fake_weight("lo",lep4,*fr);
1043 +  fwgts.fwgt_hi_4 = get_fake_weight("hi",lep4,*fr);
1044 + }
1045 + //----------------------------------------------------------------------------------------
1046   dr_struct fill_dr_struct(vector<SimpleLepton> jets, SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4)
1047   {
1048    dr_struct drs;
# Line 807 | Line 1083 | void init_cuts( vector<TString> &cutstrs
1083    cutstrs.push_back("twoJetsAfter"  );  cutvec["twoJetsAfter"] = 0;
1084    cutstrs.push_back("filling"  );  cutvec["filling"] = 0;
1085    cutstrs.push_back("fillPass"  );  cutvec["fillPass"] = 0;
1086 +  cutstrs.push_back("fillFail"  );  cutvec["fillFail"] = 0;
1087 +  cutstrs.push_back("fillPF"  );  cutvec["fillPF"] = 0;
1088   }
1089   //----------------------------------------------------------------------------------------
1090   bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
# Line 833 | Line 1111 | bool findGoodJets(vector<SimpleLepton> &
1111    else
1112      return true;
1113   }
1114 + //----------------------------------------------------------------------------------------
1115 + map<TString,TH1D*> setHistSet(CSample *cs, TString type, TString var)
1116 + {
1117 +  map<TString,TH1D*> hset;
1118 +  hset["obs"]            = (*(cs->hists)[type+"_obs"])[var];
1119 +  hset["pred"]           = (*(cs->hists)[type+"_pred"])[var];
1120 +  hset["pred_lo"]        = (*(cs->hists)[type+"_pred_lo"])[var];
1121 +  hset["pred_hi"]        = (*(cs->hists)[type+"_pred_hi"])[var];
1122 +  hset["PF"]             = (*(cs->hists)[type+"_PF"])[var];
1123 +  hset["PF_lo"]          = (*(cs->hists)[type+"_PF_lo"])[var];
1124 +  hset["PF_hi"]          = (*(cs->hists)[type+"_PF_hi"])[var];
1125 +  return hset;
1126 + }
1127 + //----------------------------------------------------------------------------------------
1128 + void shiftOverflows(map<TString,TH1D*> &hset)
1129 + {
1130 +  for(map<TString,TH1D*>::iterator it=hset.begin(); it!=hset.end(); it++)
1131 +    shiftOverflows((*it).second);
1132 + }
1133 + //----------------------------------------------------------------------------------------
1134 + void scaleHists(map<TString,TH1D*> &hset)
1135 + {
1136 +  for(map<TString,TH1D*>::iterator it=hset.begin(); it!=hset.end(); it++)
1137 +    (*it).second->Scale(1./integrateHist((*it).second));
1138 + }
1139 + //----------------------------------------------------------------------------------------
1140 + void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight)
1141 + {
1142 +  fs->getentry(ientry,"","zznt"); // make sure we've got this entry for all the branches
1143 +  fillKinematics(evtdata,*fs->kine); // reminder: kine has the fake information, while fs->kine *had*, until this line, whatever ZPlusX put in it
1144 +  fs->weights->w = fillweight;
1145 +  fs->outtuple->Fill();
1146 +  fs->outFotuple->Fill();
1147 + }
1148 +
1149            // double mjj=0,dEta=0,etaProd=0,nCentralJets=0;
1150            // if(jet1 && jet2) {
1151            //   cutvec["twoJets"] += 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines