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.4 by dkralph, Tue Jul 31 16:46:22 2012 UTC vs.
Revision 1.7 by dkralph, Mon Dec 17 17:25:55 2012 UTC

# Line 5 | Line 5
5  
6   #include "TCanvas.h"
7   #include "TChain.h"
8 + #include "TStopwatch.h"
9   #include "TString.h"
10   #include "TStyle.h"
11   #include "TH1D.h"
12   #include "TNtuple.h"
13 + #include "TROOT.h"
14  
15   #include "CPlot.h"
16   #include "FOArgs.h"
# Line 17 | Line 19
19   #include "Various.h"
20   #include "CommonDefs.h"
21   #include "PlotHeaders.h"
22 + #include "HistHeaders.h"
23   #include "TriggerUtils.h"
24   #include "JetDefs.h"
25   #include "JetInfoStruct.h"
26 + #include "FR_struct.h"
27 + #include "SelectionFuncs.h"
28 + #include "SampleWeight.h"
29 + #include "MitStyleRemix.h"
30  
31   #include "TMVA/Reader.h"
32   #include "TMVA/Tools.h"
# Line 34 | Line 41 | using namespace std;
41   using namespace RooFit;
42   using namespace mithep;
43  
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 }
44   //----------------------------------------------------------------------------------------
45   TCanvas *can;
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:
85  dr_struct();
86  void check();
87  float l1j1,l2j1,l3j1,l4j1;
88  float l1j2,l2j2,l3j2,l4j2;
89  float l1j3,l2j3,l3j3,l4j3;
90  float l1j4,l2j4,l3j4,l4j4;
91 };
92 dr_struct::dr_struct()
93 {  
94  l1j1 = l2j1 = l3j1 = l4j1 = l1j2 = l2j2 = l3j2 = l4j2 = l1j3 = l2j3 = l3j3 = l4j3 = l1j4 = l2j4 = l3j4 = l4j4 = -1;
95 }
96 void dr_struct::check()
97 {
98  if(fabs(l1j1) < 0.2) { cout << "l1j1 too small: " << l1j1 << endl; }
99  if(fabs(l2j1) < 0.2) { cout << "l2j1 too small: " << l2j1 << endl; }
100  if(fabs(l3j1) < 0.2) { cout << "l3j1 too small: " << l3j1 << endl; }
101  if(fabs(l4j1) < 0.2) { cout << "l4j1 too small: " << l4j1 << endl; }
102  if(fabs(l1j2) < 0.2) { cout << "l1j2 too small: " << l1j2 << endl; }
103  if(fabs(l2j2) < 0.2) { cout << "l2j2 too small: " << l2j2 << endl; }
104  if(fabs(l3j2) < 0.2) { cout << "l3j2 too small: " << l3j2 << endl; }
105  if(fabs(l4j2) < 0.2) { cout << "l4j2 too small: " << l4j2 << endl; }
106  if(fabs(l1j3) < 0.2) { cout << "l1j3 too small: " << l1j3 << endl; }
107  if(fabs(l2j3) < 0.2) { cout << "l2j3 too small: " << l2j3 << endl; }
108  if(fabs(l3j3) < 0.2) { cout << "l3j3 too small: " << l3j3 << endl; }
109  if(fabs(l4j3) < 0.2) { cout << "l4j3 too small: " << l4j3 << endl; }
110  if(fabs(l1j4) < 0.2) { cout << "l1j4 too small: " << l1j4 << endl; }
111  if(fabs(l2j4) < 0.2) { cout << "l2j4 too small: " << l2j4 << endl; }
112  if(fabs(l3j4) < 0.2) { cout << "l3j4 too small: " << l3j4 << endl; }
113  if(fabs(l4j4) < 0.2) { cout << "l4j4 too small: " << l4j4 << endl; }
114 }  
46  
47   bool findGoodJets(vector<SimpleLepton> &goodJets, filestuff *fs,
48                    SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
49 < void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo=0, double wgt_hi=0);
50 < void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
51 <                  SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
52 <                  double wgt, double wgt_lo=0, double wgt_hi=0);
53 < void fillAllJetHists(FOFlags ctrl,  CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
54 <                      SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
55 <                      FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
56 <                      double wgt, double wgt_lo=0, double wgt_hi=0);
57 < void makeHTML(FOFlags &ctrl, TString type, TString plotLabel);
49 > // void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo=0, double wgt_hi=0);
50 > // void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine, Angles angles,
51 > //                SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
52 > //                double wgt, double wgt_lo=0, double wgt_hi=0);
53 > // void fillAllJetHists(FOFlags ctrl,  CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
54 > //                    SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
55 > //                    FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
56 > //                    double wgt, double wgt_lo=0, double wgt_hi=0);
57 > // void makeHTML(FOFlags &ctrl, TString type, TString plotLabel, TString fullOutDir);
58   map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str="");
59   bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
60               unsigned lep2matchBits, unsigned lep3matchBits,
61               unsigned lep4matchBits);
131 dr_struct fill_dr_struct(vector<SimpleLepton> jets, SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4);
62   void init_cuts(vector<TString> &cutstrs, map<TString,int> &cutvec);
133 void fillLeptonFakeWeights(lepFrs &fwgts, FR_struct *fr, SimpleLepton lep3, SimpleLepton lep4);
63   void resetCutVect(map<TString,int> &cutvec) {
64    for(map<TString,int>::iterator it=cutvec.begin(); it!=cutvec.end(); it++)
65      cutvec[(*it).first] = 0;
66   }
67   map<TString,TH1D*> setHistSet(CSample *cs, TString type, TString var);
139 void shiftOverflows(map<TString,TH1D*> &hset);
140 void scaleHists(map<TString,TH1D*> &hset);
68   void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight);
69 + void incrementSsofCounters(FOFlags &ctrl, filestuff *fs, double minMz2,
70 +                           pair<int,int> *best_z_indices, double wgt);
71 + map<TString,double> init_counter(TString fname="");
72 + map<TString,double> initSsofRatios(vector<CSample*> &samplev);
73 + double getSsofWgt(TString channel, map<TString,double> &ssofRatios);
74   //----------------------------------------------------------------------------------------
75   int main(int argc, char** argv)
76   {
77 +  // Three usage modes:
78 +  //   ctrl.faketype=="SR":    plot events in signal region, if requested including ntuples of the extrapolation from 2P2F and 3P1F regions
79 +  //   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)
80 +  //   ctrl.faketype=="3P1F":  plot 3P1F region (including the extrapolation to there from the 2P2F region), and if requested write out ntuple with SR prediction
81 +  //
82 +  // ctrl.makeFakeTuples:  write out zznt-type ntuples to be read by plotH4l or by SR mode
83 +  // ctrl.hiStatFakes:     same as makeFakeTuples, but reverse charge and flavor req's to get a larger sample for BDT training (or to plot the WrongFlavorCharge control region)
84 +  // ctrl.ssof:            look only at ssof region
85 +  // ctrl.writessofratio:  write the OS / SS ratio to text files that can be read later in ssof mode
86 +  // ctrl.plotWholeSample: plot the whole fake sample without weighting with the fake rate
87 +
88 +  TStopwatch watch;
89 +  SetStyle();
90    initPUWeights();
91 +  ControlFlags dummyCtrl;
92 +
93    vector<TString> cutstrs;
94    map<TString,int> cutvec;
95    init_cuts(cutstrs, cutvec);
96  
97 <  EvtsOfInterest eoiAdish("/tmp/adish-uniq");
151 <  EvtsOfInterest eoiMe("/tmp/me-uniq");
97 >  bool dummyStr(true); // don't add the yield numbers to legends
98  
99    // arguments...
100    FOFlags ctrl;
101    parse_foargs( argc, argv, ctrl );
102    ctrl.dump();
157  bool makeFakeTuples = (ctrl.extraArgs.Contains("makeFakeTuples"));
103    FusionMva fusion(ctrl.uncert);//"./weights/againstZZ-fusion_BDTG.weights.xml");
104    bool makeJetTuple=false; // jet tuple for vbf mva training
105 <  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
105 >  assert(ctrl.faketype=="SR" || ctrl.faketype=="2P2F" || ctrl.faketype=="3P1F");
106    if(ctrl.heavyFlavor) assert(ctrl.faketype=="2P2F");
107    if(ctrl.ssof) assert(ctrl.faketype=="2P2F");
108  
109 <  can = new TCanvas("can","can");
109 >  can = new TCanvas("can","can",700,500);
110  
111 <  FR_struct fr2011 = initFRs(ctrl.mufakefile2011,ctrl.elefakefile2011);
112 <  FR_struct fr2012 = initFRs(ctrl.mufakefile2012,ctrl.elefakefile2012);
111 >  FR_struct fr2011(ctrl.mufakefile2011,ctrl.elefakefile2011);
112 >  FR_struct fr2012(ctrl.mufakefile2012,ctrl.elefakefile2012);
113  
114    TString cmsswpath(CMSSW_BASE + TString("/src"));
115    string xspath = (string(cmsswpath)+"/MitPhysics/data/xs.dat");
# Line 179 | Line 122 | int main(int argc, char** argv)
122    TString ntupledir(""),label(""),plotLabel(""),jsonFile("");
123    int puTarget;
124    readConfigFile(ctrl.config, ntupledir, label, plotLabel, jsonFile, puTarget, samplev, &ctrl, init_hists);
125 +  map<TString,double> ssofRatios;
126 +  if(ctrl.ssof && !ctrl.writessofratio && !ctrl.plotWholeSample) ssofRatios = initSsofRatios(samplev);
127  
128 +  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    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  
# Line 193 | Line 139 | int main(int argc, char** argv)
139      AngleTuple *jettuple;
140      if(makeJetTuple) {
141        jettuple = new AngleTuple( (const char*)(TString(cs->name)+"_pass.root").Data(), (const char*)"zznt");
142 +      jettuple->makeAngleBranch(angles);
143        jettuple->makeKinematicsBranch(kine);
144        jettuple->makeJetInfoBranch(ji);
145        const char *str1 = "evt";
# Line 204 | Line 151 | int main(int argc, char** argv)
151      resetCutVect(cutvec);
152      for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
153        filestuff *fs = (cs->fsv)[ifs];
154 <      if(makeFakeTuples && fs->dataset_!="fakes") { // write a copy of the input trees for events that will be used for the SR fake prediction
154 >      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          TString fakefilename(fs->fname_);
156 <        fakefilename.ReplaceAll(".root","-fakes.root");
156 >        fakefilename.ReplaceAll(".root","-"+ctrl.faketype+(ctrl.ssof ? "-ssof" : "")+"-fakes.root");
157 >        if(ctrl.hiStatFakes) fakefilename.ReplaceAll("-fakes.root","-fakes-histat.root");
158          fs->makeOutputFile(fakefilename);
159        }
160        cout << "\t" << fs->fname_; cout.flush();
161 <      FR_struct *fr = (fs->era_==2011) ? &fr2011 : &fr2012;
162 <      unsigned nDuplSkipped=0;
161 >      unsigned nDuplSkipped=0,nBadZs=0;
162 >      watch.Start();
163        for(unsigned ientry=0; ientry<fs->getentries("FOtree"); ientry++) {
164          fs->getentry(ientry,"FOs","FOtree");
165          fs->getentry(ientry,"Zleptons","FOtree");
166          fs->getentry(ientry,"info","zznt");
167  
168 <        // if(eoiAdish.has(fs->info->run, fs->info->evt) &&
169 <        //    !eoiMe.has(fs->info->run, fs->info->evt)) {
170 <        //   cout << "found an event: " << fs->info->run << " " << fs->info->evt << endl;
171 <        //   ctrl.debug = true;
172 <        // } else
225 <        //   ctrl.debug = false;
226 <
168 >        if(!(ientry%15000)) {
169 >          watch.Stop();
170 >          cout << "\ntime: " << watch.RealTime() << "  (entry: " << ientry << " )" << endl;
171 >          watch.Start();
172 >        }
173          cutvec["start"] = fs->total_entries_;
174          if(fs->isdata_) {// && !(fs->dataset_=="fakes")) {
175            // 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.
176            // in plotH4l I *don't* want to remove these, but here I *do*, because in this file I again loop over all z2 candidates
177            setMinMaxRun(fs->info->run, minRun, maxRun);
178            bool dupl = takeCareOfDuplicateEvents(fs->info->run, fs->info->evt, runEvtv, nDuplSkipped);
179 <          if(dupl) { if(ctrl.debug) cout << " failing dupl" << endl; continue; }
180 <          if(!fs->rlrm_.HasRunLumi(pair<unsigned,unsigned> (fs->info->run, fs->info->lumi))) { if(ctrl.debug) cout << " failing rlrm" << endl; continue; }
179 >          if(dupl) continue;
180 >          if(!fs->rlrm_.HasRunLumi(pair<unsigned,unsigned> (fs->info->run, fs->info->lumi))) continue;
181          }
182          cutvec["rlrmAndDupl"] += 1;
183  
238        double wgt=1;
239        if(!fs->isdata_) {
240          double xsWgt = fs->lumi_*xstab.Get(fs->dataset_)/fs->total_entries_;
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");
248          wgt = fs->weights->w;
249        }
250
184          unsigned npass = fs->passingL->size();
185          unsigned nfail = fs->failingL->size();
186  
187          // look for a z1
188          pair<int,int> best_z_indices;
189          double best_mz1 = findZ1(fs->passingL,best_z_indices,40);
190 <        if(best_mz1<=0) {
191 <          cout << "WARNING: best z1 mass: " << best_mz1 << endl;
192 <        }
260 <        if(ctrl.heavyFlavor && best_mz1<60) { if(ctrl.debug) cout << " failing mz1" << endl; continue; }
190 >        if(best_mz1<=0) nBadZs++;
191 >        if(best_mz1 < 40 || best_mz1 > 120) continue;
192 >        if(ctrl.heavyFlavor && best_mz1<60) continue;
193          EventData evtdata;
194          evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]);
195          evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]);
# Line 266 | Line 198 | int main(int argc, char** argv)
198          vector<pair<SimpleLepton,SimpleLepton> > z2cands;
199          vector<TString> types;
200          TString signFlavor;
201 <        if(ctrl.heavyFlavor) signFlavor = "";
202 <        else if(ctrl.ssof)   signFlavor = "SS-SF";
203 <        else                 signFlavor = "OS-SF";
201 >        if(ctrl.heavyFlavor)            signFlavor = "";
202 >        else if(ctrl.ssof)              signFlavor = "SS-SF";
203 >        else if(ctrl.hiStatFakes)       signFlavor = "signalExclude";
204 >        else                            signFlavor = "OS-SF";
205          double minMz2 = ctrl.heavyFlavor ? 0 : 12;
206          int hiPtPassingZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "pass",&best_z_indices); // signal region
207          int hiPtFailingZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, signFlavor, minMz2, "fail"); // 2P+2F
208          int hiPtPfZ2      = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "PF", &best_z_indices, fs->failingL); // 3P+1F
209  
210 <        if(ctrl.debug) {
211 <          cout << "z2 cands: " << endl;
212 <          for(unsigned iz2=0; iz2<z2cands.size(); iz2++)
213 <            cout << " ---" << types[iz2] << "'ing z2" << endl;
210 >        double wgt=1;
211 >        if(z2cands.size() > 0) {
212 >          if(!fs->isdata_) {
213 >            fs->getentry(ientry,"weights","zznt");
214 >            double xsWgt = fs->lumi_*xstab.Get(fs->dataset_)/fs->total_entries_;
215 >            double puWgt = getPUWeight(fs->era_, fs->era_==2011 ? "/025/" : "/029/", fs->info->npu);
216 >            // if(fs->era_==2012)
217 >            //   puWgt = hpu_2012_me->GetBinContent(hpu_2012_me->FindBin(fs->info->npu));
218 >            // else if(fs->era_==2011)
219 >            //   puWgt = hpu_2011_me->GetBinContent(hpu_2011_me->FindBin(fs->info->npu));
220 >            // else assert(0);
221 >            wgt = xsWgt * puWgt;//* fs->weights->won * fs->weights->woff;
222 >            if(wgt!=wgt) cout << "xsWgt: " << xsWgt << " puWgt: " << puWgt << endl;
223 >          }
224 >          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)
225 >            // fs->getentry(ientry,"weights","zznt");
226 >            wgt = fs->weights->w;
227 >          }
228 >          if(ctrl.writessofratio) incrementSsofCounters(ctrl, fs, minMz2, &best_z_indices, wgt);
229          }
230  
231          for(unsigned iz2=0; iz2<z2cands.size(); iz2++) {
# Line 288 | Line 236 | int main(int argc, char** argv)
236            evtdata.Z2leptons.clear();
237            evtdata.Z2leptons.push_back(lep3);
238            evtdata.Z2leptons.push_back(lep4);
239 +          fillAngles(evtdata,angles);
240            fillKinematics(evtdata,kine);
241            lepFrs fwgts;
242 <          fillLeptonFakeWeights(fwgts, fr, lep3, lep4);
242 >          fillLeptonFakeWeights(fwgts, (fs->era_==2011) ? &fr2011 : &fr2012, lep3, lep4);
243            TString channel = getChannel(lep1,lep2,lep3,lep4);
244            // bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.scID,lep2.scID,lep3.scID,lep4.scID) : true;
245  
246            if(ctrl.heavyFlavor) {
247 <            if(fabs(lep1.dz) > 0.01 || fabs(lep2.dz) > 0.01)            { cout << " failing XXX" << endl; continue; }
247 >            if(fabs(lep1.dz) > 0.01 || fabs(lep2.dz) > 0.01)            continue;
248              if( !(fabs(lep3.ip3dSig) > 2 && fabs(lep4.ip3dSig) > 8) &&
249 <                !(fabs(lep4.ip3dSig) > 2 && fabs(lep3.ip3dSig) > 8)  )  { cout << " failing XXX" << endl; continue; }
249 >                !(fabs(lep4.ip3dSig) > 2 && fabs(lep3.ip3dSig) > 8)  )  continue;
250              if( !(fabs(lep3.d0) > .002 && fabs(lep4.d0) > .01) &&
251 <                !(fabs(lep4.d0) > .002 && fabs(lep3.d0) > .01)  )       { cout << " failing XXX" << endl; continue; }
252 <            if(fabs(lep3.d0) > 0.1 || fabs(lep4.d0) > 0.1)              { cout << " failing XXX" << endl; continue; }
253 <            if(fabs(lep3.dz) > 0.2 || fabs(lep4.dz) > 0.2)              { cout << " failing XXX" << endl; continue; }
251 >                !(fabs(lep4.d0) > .002 && fabs(lep3.d0) > .01)  )       continue;
252 >            if(fabs(lep3.d0) > 0.1 || fabs(lep4.d0) > 0.1)              continue;
253 >            if(fabs(lep3.dz) > 0.2 || fabs(lep4.dz) > 0.2)              continue;
254            } else {
255 <            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
256 <            if(!leptonDrReqs(lep1,lep2,lep3,lep4))                      { if(ctrl.debug) cout << " failing dr" << endl; continue; }
257 <            if(kine.m4l < 100)                                          { if(ctrl.debug) cout << " failing m4l 100" << endl; continue; }
258 <            if(!resonanceKilling(lep1,lep2,lep3,lep4))                  { if(ctrl.debug) cout << " failing reskill" << endl; continue; }
255 >            if(fabs(lep3.ip3dSig) >= 4 || fabs(lep4.ip3dSig) >= 4)      continue; // |sip| < 4 is applied to lep1, lep2 in ZPlusX
256 >            if(!leptonDrReqs(lep1,lep2,lep3,lep4))                      continue;
257 >            if(kine.m4l < 100)                                          continue;
258 >            if(!resonanceKilling(lep1,lep2,lep3,lep4))                  continue;
259            }
260 <          if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4))                   { if(ctrl.debug) cout << " failing lepton pt " << endl; continue; }
260 >          if(!finalLeptonPtReqs(lep1,lep2,lep3,lep4))                   continue;
261  
262            cutvec["4lsele"] += 1;
263  
# Line 322 | Line 271 | int main(int argc, char** argv)
271              if(fs->jets->size() > 1) cutvec["twoJets"] += 1;
272              bool hazJetz = findGoodJets(goodJets, fs, lep1, lep2, lep3, lep4);
273              if(goodJets.size() > 1) cutvec["twoJetsAfter"] += 1;
274 <            if(!hazJetz) { cout << " failing XXX" << endl; continue; }
274 >            if(!hazJetz) continue;
275              ControlFlags ctrlTmp;
276              fillJetInfo(goodJets,ji,ctrlTmp);
277              if(makeJetTuple) {
# Line 331 | Line 280 | int main(int argc, char** argv)
280              }
281              fusion.setValues(ji,kine);
282            }
283 <
283 >          
284            cutvec["filling"] += 1;
285  
286            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
287              // llll events
288 <            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)
288 >            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)
289              cutvec["fillPass"] += 1;
290 <            fillAllHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, wgt);
291 <            if(doJets) fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
290 >            fillAllHists( ctrl, cs, channel, "obs", fs, kine, angles, lep1, lep2, lep3, lep4, wgt);
291 >            if(doJets) fillAllJetHists( ctrl, cs, channel, "obs", fs, kine, lep1, lep2, lep3, lep4, /*fusion,*/ /*goodJets, */ji, wgt);
292  
293            } else if(types[iz2]=="fail") { // lljj events
294 <            if(iz2!=hiPtFailingZ2 && ctrl.plotWholeSample) { cout << " failing XXX" << endl; continue; }
294 >            if(iz2!=hiPtFailingZ2 && ctrl.plotWholeSample) continue;
295              double centr=0,lo=0,hi=0;
296              if(ctrl.faketype=="2P2F") {
297                if(ctrl.plotWholeSample) { // make plots without weighting with the FR
# Line 351 | Line 300 | int main(int argc, char** argv)
300                  centr = wgt*fwgts.fwgt_3*fwgts.fwgt_4;
301                  lo    = wgt*fwgts.fwgt_lo_3*fwgts.fwgt_lo_4;
302                  hi    = wgt*fwgts.fwgt_hi_3*fwgts.fwgt_hi_4;
303 +                if(ctrl.ssof && !ctrl.writessofratio && !ctrl.plotWholeSample) {
304 +                  double ssof_wgt = getSsofWgt(channel,ssofRatios);
305 +                  centr *= ssof_wgt;
306 +                  lo    *= ssof_wgt;
307 +                  hi    *= ssof_wgt;
308 +                }
309                }
310              } else if(ctrl.faketype=="3P1F") { // apply the weights for extrapolation from 2P2F region to 3P1F region
311                centr = wgt*(fwgts.fwgt_3    + fwgts.fwgt_4);
# Line 358 | Line 313 | int main(int argc, char** argv)
313                hi    = wgt*(fwgts.fwgt_hi_3 + fwgts.fwgt_hi_4);
314              }
315  
316 <            // runfile << fixed << setprecision(0) << fs->info->run << " " << fixed << setprecision(0) << fs->info->evt << endl;
362 <
363 <            if(makeFakeTuples && fs->dataset_!="fakes") {
316 >            if(ctrl.makeFakeTuples && fs->dataset_!="fakes") {
317                double fillwgt;
318                bool dofill=true;
319                if(ctrl.faketype=="2P2F") {
320 <                assert(fs->isdata_);
320 >                // assert(fs->isdata_);
321                  fillwgt = centr;
322                } else if(ctrl.faketype=="3P1F") {
323                  fillwgt = - wgt*(fwgts.fwgt_3*fwgts.fwgt_4 + fwgts.fwgt_4*fwgts.fwgt_3);
# Line 373 | Line 326 | int main(int argc, char** argv)
326                fillFakeTuple(cs,fs,evtdata,ientry,fillwgt);
327              }
328              cutvec["fillFail"] += 1;
329 <            fillAllHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, centr, lo, hi);
330 <            if(doJets) fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, centr, lo, hi);
329 >            fillAllHists( ctrl, cs, channel, "pred", fs, kine, angles, lep1, lep2, lep3, lep4, centr, lo, hi);
330 >            if(doJets) fillAllJetHists( ctrl, cs, channel, "pred", fs, kine, lep1, lep2, lep3, lep4, /*fusion,*/ /*goodJets,*/ ji, centr, lo, hi);
331  
332            } else if(types[iz2]=="PF") { // lllj events
333              if(fs->dataset_!="fakes" && iz2!=hiPtPfZ2) continue; // shouldn't have this when I extrapolate to signal region
334  
335 <            if(makeFakeTuples && fs->dataset_!="fakes" && ctrl.faketype=="3P1F") {
335 >            if(ctrl.makeFakeTuples && fs->dataset_!="fakes" && ctrl.faketype=="3P1F") {
336                assert(lep3.isLoose || lep4.isLoose);
337                assert(!(lep3.isLoose && lep4.isLoose));
338                double fwgt = lep3.isLoose ? fwgts.fwgt_4 : fwgts.fwgt_3;
# Line 391 | Line 344 | int main(int argc, char** argv)
344              }
345              
346              cutvec["fillPF"] += 1;
347 <            fillAllHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, wgt);
348 <            if(doJets) fillAllJetHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, fusion, goodJets, ji, wgt);
347 >            fillAllHists( ctrl, cs, channel, "PF", fs, kine, angles, lep1, lep2, lep3, lep4, wgt);
348 >            if(doJets) fillAllJetHists( ctrl, cs, channel, "PF", fs, kine, lep1, lep2, lep3, lep4, /*fusion,*/ /*goodJets,*/ ji, wgt);
349            } else assert(0);
350          }
351        }
352 <      cout << "\t\t" << setw(7) << nDuplSkipped << " duplicate events skipped" << endl;
353 <      if(makeFakeTuples) {
352 >      if(ctrl.writessofratio) fs->writeSsofRatios();
353 >      cout << "\t\t" << setw(7) << nDuplSkipped << " duplicate events skipped (" << nBadZs << " bad Zs)" << endl;
354 >      if(ctrl.makeFakeTuples) {
355          fs->outFotuple->getFile()->cd();
356          fs->outFotuple->getTree()->Write();
357          fs->outtuple->WriteClose();
358        }
359 +      // fs->del();
360      }
361      for(unsigned icut=0; icut<cutstrs.size(); icut++) {
362        cout << setw(22) << cutstrs[icut] << setw(22) << cutvec[cutstrs[icut]] << endl;
# Line 416 | Line 371 | int main(int argc, char** argv)
371    vector<TString> typev;
372    typev.push_back("all");
373  
374 <  bool plotAllCats=false;
420 <  if(plotAllCats) {
374 >  if(ctrl.plotAllCats) {
375      typev.push_back("4e");
376      typev.push_back("4m");
377      typev.push_back("2e2m");
378    }
379  
380 +  ofstream txtOutFile("fakes.txt",ios_base::app);
381 +  txtOutFile << "---> " << ctrl.faketype << " " << plotLabel << endl;
382    // loop over channels
383    for(unsigned itype=0; itype<typev.size(); itype++) {
384      TString type(typev[itype]);
385 <    gSystem->mkdir(ctrl.outdir+"/"+plotLabel+"/"+type,true);
386 <    TFile runHistFile(ctrl.outdir+"/"+plotLabel+"/"+type+"/runs.root","recreate");
385 >    TString fullOutDir(ctrl.outdir+"/"+plotLabel+"/"+type);
386 >    gSystem->mkdir(fullOutDir,true);
387 >    TFile runHistFile(fullOutDir+"/runs.root","recreate");
388      // loop over variables
389      map<TString,TH1D*>::iterator it_v;
390      for(it_v=(*(samplev[0]->hists)[type+"_obs"]).begin(); it_v!=(*(samplev[0]->hists)[type+"_obs"]).end(); it_v++) {
391        TString var((*it_v).first);
392 <      CPlot cplot(var,"",(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),"events",ctrl.outdir+"/"+plotLabel+"/"+type+"/plots");
392 >      CPlot cplot(var,TString(""),(*(samplev[0]->hists)[type+"_obs"])[var]->GetXaxis()->GetTitle(),TString("events"),TString(fullOutDir+"/plots"));
393        double fakeCounter=0;
394        double ymax=0;
395        // loop over csamples
# Line 446 | Line 403 | int main(int argc, char** argv)
403            scaleHists(hs);
404          
405          if(cs->isdata && !(cs->name=="fakes")) {
406 <          if(ctrl.faketype=="SR" || (ctrl.heavyFlavor && !ctrl.plotWholeSample)) {
407 <            cplot.AddHist1D(hs["obs"],cs->legend+": "+integral_str(hs["obs"],0),"E");
406 >          // add observation (llll events) in an 'E' hists
407 >          if(ctrl.faketype=="SR" || (ctrl.heavyFlavor && !ctrl.plotWholeSample) || (ctrl.ssof && !ctrl.plotWholeSample)) {
408 >            cplot.AddHist1D(hs["obs"],cs->legend+": "+integral_str(hs["obs"],0,dummyStr),"E");
409              ymax = max(ymax,hs["obs"]->GetMaximum());
410            }
411            if(ctrl.faketype=="2P2F") {
412              if(ctrl.plotWholeSample) {
413 <              cplot.AddHist1D(hs["pred"],cs->legend+": "+integral_str(hs["pred"],0),"E");
413 >              // add 'pred' (lljj events with weight *1*) as an 'E' hist
414 >              cplot.AddHist1D(hs["pred"],cs->legend+": "+integral_str(hs["pred"],0,dummyStr),"E");
415                ymax = max(ymax,hs["pred"]->GetMaximum());
416              } else {
417 <              cplot.AddHist1D(hs["pred"],   "FR predic: "+integral_str(hs["pred"],3),   "hist",kRed);
418 <              cplot.AddHist1D(hs["pred_lo"],  "stat lo: "+integral_str(hs["pred_lo"],2),"hist",kRed,kDashed);
419 <              cplot.AddHist1D(hs["pred_hi"],  "stat hi: "+integral_str(hs["pred_hi"],2),"hist",kRed,kDashed);
417 >              // add 'pred' (lljj events with weight w1*w2) as red-line hists
418 >              cplot.AddHist1D(hs["pred"],    TString("FR predic: "+integral_str(hs["pred"],3,dummyStr)),   "hist",kRed);
419 >              cplot.AddHist1D(hs["pred_lo"], TString(  "stat lo: "+integral_str(hs["pred_lo"],2,dummyStr)),"hist",kRed,kDashed);
420 >              cplot.AddHist1D(hs["pred_hi"], TString(  "stat hi: "+integral_str(hs["pred_hi"],2,dummyStr)),"hist",kRed,kDashed);
421 >              if(var=="m4l") {
422 >                txtOutFile << "  " << type << ": " << integral_str(hs["pred"],3) << " (" << integral_str(hs["pred_lo"],2) << "," << integral_str(hs["pred_hi"],2) << ")" << endl;
423 >              }
424                ymax = max(ymax,histMax(hs["pred"],hs["pred_lo"],hs["pred_hi"]));
425              }
426            }
427            if(ctrl.faketype=="3P1F") {
428 <            double ratio = 0;//integrateHist(hs["PF"]) / integrateHist(hs["pred"]);
429 <            cplot.AddHist1D(hs["PF"],cs->legend+": "+integral_str(hs["PF"],0)+", ratio: "+f_to_a(ratio),"E",cs->color);
428 >            // add 'PF' (lllj events with weight 1) as an 'E' hist
429 >            // double ratio = 0;//integrateHist(hs["PF"]) / integrateHist(hs["pred"]);
430 >            // cplot.AddHist1D(hs["PF"],TString(cs->legend+": "+integral_str(hs["PF"],0,dummyStr)+", ratio: "+f_to_a(ratio)),"E",cs->color);
431 >            cplot.AddHist1D(hs["PF"],TString(cs->legend+": "+integral_str(hs["PF"],0,dummyStr)),"E",cs->color);
432              if(!ctrl.plotWholeSample) {
433 <              cplot.AddToStack(hs["pred"],cs->legend+"(2P2F extrap.): "+integral_str(hs["pred"],1), kRed);
433 >              // add 'pred' (lljj events with weight ~w1) as a red stacked hist
434 >              cplot.AddToStack(hs["pred"],TString(cs->legend+"(2P2F extrap.): "+integral_str(hs["pred"],1,dummyStr)), 823, -1);
435                ymax = max(ymax,histMax(hs["PF"],cplot.GetStack(),hs["pred"]));
436              } else {
437                ymax = max(ymax,hs["PF"]->GetMaximum());
# Line 482 | Line 448 | int main(int argc, char** argv)
448            if(ctrl.faketype=="3P1F")   mchist = hs["PF"];
449            assert(mchist);
450            bool stackMc = true;
451 <          if(stackMc) cplot.AddToStack(mchist,cs->legend+": "+integral_str(mchist,2),cs->color);
452 <          else        cplot.AddHist1D(mchist,cs->legend +": "+integral_str(mchist,3),"Ehist",cs->color);//cs->color);
451 >          if(stackMc) cplot.AddToStack(mchist,TString(cs->legend+": "+integral_str(mchist,2,dummyStr)),cs->color,-1);
452 >          else        cplot.AddHist1D(mchist,TString(cs->legend +": "+integral_str(mchist,3,dummyStr)),"Ehist",cs->color);//cs->color);
453            if(cs->name=="zz") fakeCounter -= integrateHist(hs["PF"]);
454            ymax = max(ymax,histMax(mchist,cplot.GetStack()));
455          }
# Line 493 | Line 459 | int main(int argc, char** argv)
459          }
460          if(!var.Contains("fusionMVA"))
461            cplot.SetYRange(0,1.2*ymax);
462 <        if(ctrl.faketype=="3P1F") cplot.AddTextBox("diff: "+f_to_a(fakeCounter),.7,.5,.8,.6);
462 >        if(!dummyStr && ctrl.faketype=="3P1F") cplot.AddTextBox(TString("diff: "+f_to_a(fakeCounter)),.7,.5,.8,.6);
463        }
464 +      TString txt("#bf{CMS Preliminary           L = 5 ( + 12 ) fb^{-1} at #sqrt{s} = 7 ( + 8 ) TeV}"); // #sqrt{s} = 7 TeV, L = 5 fb^{-1}; #sqrt{s} = 8 TeV, L = 12 fb^{-1}");
465 +      cplot.AddTextBox(txt,0.16,0.95,0.85,0.99,0);
466        cplot.Draw(can,true,"png");
467        if(var.Contains("fusionMVA")) {
468          cplot.SetLogy();
# Line 503 | Line 471 | int main(int argc, char** argv)
471        }
472      }
473      runHistFile.Close();
474 <    makeHTML(ctrl,type,plotLabel);
474 >    makeHTML(ctrl,type,plotLabel,fullOutDir);
475    }
476 +  txtOutFile.close();
477 +      
478 +  fr2011.FR_struct::~FR_struct();
479 +  fr2012.FR_struct::~FR_struct();
480   }
481   //----------------------------------------------------------------------------------------
482   map<TString,map<TString,TH1D*>* > init_hists(FOFlags &ctrl, TString str)
# Line 540 | Line 512 | map<TString,map<TString,TH1D*>* > init_h
512    map<TString,TH1D*> *h_all_PF_hi       = new map<TString,TH1D*>;      hists["all_PF_hi"]       = h_all_PF_hi;
513    map<TString,map<TString,TH1D*>* >::iterator it_h;
514  
515 <  for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
516 <    (*((*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();
517 <    (*((*it_h).second))["run"]          = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};",          50,160800,196535);   (*((*it_h).second))["run"]->Sumw2();
518 <    (*((*it_h).second))["mZ1"]          = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};",    20,40,120);          (*((*it_h).second))["mZ1"]->Sumw2();
519 <    (*((*it_h).second))["mZ2"]          = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};",    30,0,115);           (*((*it_h).second))["mZ2"]->Sumw2();
520 <    (*((*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();
521 <    (*((*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();
522 <    (*((*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();
523 <    (*((*it_h).second))["m4l"]          = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};",    35,100,600);          (*((*it_h).second))["m4l"]->Sumw2();
524 <    (*((*it_h).second))["Z1pt"]         = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};",  20,0,200);           (*((*it_h).second))["Z1pt"]->Sumw2();
525 <    (*((*it_h).second))["ZZpt"]         = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};",  30,0,200);           (*((*it_h).second))["ZZpt"]->Sumw2();
526 <    (*((*it_h).second))["met"]          = new TH1D(TString("met") +"_"+(*it_h).first+str,";#bf{met [GeV]};",    30,0,100);           (*((*it_h).second))["met"]->Sumw2();
527 <
528 <    (*((*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();
529 <    (*((*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();
530 <    (*((*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();
531 <    (*((*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();
532 <
533 <    (*((*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();
534 <    (*((*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();
535 <    (*((*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();
536 <    (*((*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();
537 <
538 <    (*((*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();
539 <    (*((*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();
540 <    (*((*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();
541 <    (*((*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();
542 <    (*((*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();
543 <    (*((*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();
544 <
545 <    (*((*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();
546 <    (*((*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();
547 <    (*((*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();
548 <    (*((*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();
549 <    (*((*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();
550 <    (*((*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();
551 <
552 <    (*((*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();
553 <    (*((*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();
554 <    (*((*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();
555 <    (*((*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();
556 <
557 <    (*((*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();
558 <    (*((*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();
559 <
560 <    // jets
561 <    (*((*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();
562 <    (*((*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();
563 <    (*((*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();
564 <    (*((*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();
565 <    (*((*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();
566 <    (*((*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();
567 <    (*((*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();
568 <    (*((*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();
569 <    (*((*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();
570 <    (*((*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();
571 <    (*((*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();
572 <    (*((*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();
573 <    (*((*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();
574 <    (*((*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();
575 <    (*((*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();
576 <    (*((*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();
577 <    (*((*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();
578 <    (*((*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();
579 <    (*((*it_h).second))["mjj"]          = new TH1D(TString("mjj")+"_"+(*it_h).first+str,";#bf{m_{jj}};",                25,10,1550);     (*((*it_h).second))["mjj"]->Sumw2();
580 <    (*((*it_h).second))["dEta"]         = new TH1D(TString("dEta")+"_"+(*it_h).first+str,";#bf{#Delta #eta};",          25,-6,6);       (*((*it_h).second))["dEta"]->Sumw2();
581 <    (*((*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();
582 <    (*((*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();
583 <
584 <    (*((*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();
585 <    (*((*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();
586 <    (*((*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();
587 <    (*((*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();
588 <    (*((*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();
589 <    (*((*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();
590 <    (*((*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();
591 <    (*((*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();
592 <    (*((*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();
593 <    (*((*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();
594 <    (*((*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();
595 <    (*((*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();
596 <    (*((*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();
597 <    (*((*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();
598 <    (*((*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();
599 <    (*((*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();
600 <
601 <    (*((*it_h).second))["fusionMVA"]            = new TH1D(TString("fusionMVA")+"_"+(*it_h).first+str,";#bf{MVA output};",        100,-1,1);      (*((*it_h).second))["fusionMVA"]->Sumw2();
602 <    (*((*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();
603 <    (*((*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();
604 <    (*((*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();
605 <    (*((*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();
606 <    (*((*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();
607 <  }
515 >  allocate_hists(hists,str);
516 >  // for(it_h=hists.begin(); it_h!=hists.end(); it_h++) {
517 >  //   (*((*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();
518 >  //   (*((*it_h).second))["run"]               = new TH1D(TString("run") +"_"+(*it_h).first+str,";#bf{run};",          50,160800,203744/*196535*/);   (*((*it_h).second))["run"]->Sumw2();
519 >  //   (*((*it_h).second))["mZ1"]               = new TH1D(TString("mZ1") +"_"+(*it_h).first+str,";#bf{mZ1 [GeV]};",    20,40,120);          (*((*it_h).second))["mZ1"]->Sumw2();
520 >  //   (*((*it_h).second))["mZ2"]               = new TH1D(TString("mZ2") +"_"+(*it_h).first+str,";#bf{mZ2 [GeV]};",    30,0,115);           (*((*it_h).second))["mZ2"]->Sumw2();
521 >  //   (*((*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();
522 >  //   (*((*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();
523 >  //   (*((*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();
524 >  //   (*((*it_h).second))["m4l"]               = new TH1D(TString("m4l") +"_"+(*it_h).first+str,";#bf{m4l [GeV]};",    35,100,450);          (*((*it_h).second))["m4l"]->Sumw2();
525 >  //   // (*((*it_h).second))["Z1pt"]           = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt [GeV]};",  20,0,200);           (*((*it_h).second))["Z1pt"]->Sumw2();
526 >  //   // (*((*it_h).second))["ZZpt"]           = new TH1D(TString("ZZpt") +"_"+(*it_h).first+str,";#bf{ZZpt [GeV]};",  30,0,200);           (*((*it_h).second))["ZZpt"]->Sumw2();
527 >  //   (*((*it_h).second))["met"]               = new TH1D(TString("met") +"_"+(*it_h).first+str,";#bf{met [GeV]};",    30,0,100);           (*((*it_h).second))["met"]->Sumw2();
528 >
529 >  //   (*((*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();
530 >  //   (*((*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();
531 >  //   (*((*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();
532 >  //   (*((*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();
533 >
534 >  //   (*((*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();
535 >  //   (*((*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();
536 >  //   (*((*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();
537 >  //   (*((*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();
538 >
539 >  //   (*((*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();
540 >  //   (*((*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();
541 >  //   (*((*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();
542 >  //   (*((*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();
543 >  //   (*((*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();
544 >  //   (*((*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();
545 >
546 >  //   (*((*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();
547 >  //   (*((*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();
548 >  //   (*((*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();
549 >  //   (*((*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();
550 >  //   (*((*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();
551 >  //   (*((*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();
552 >
553 >  //   (*((*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();
554 >  //   (*((*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();
555 >  //   (*((*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();
556 >  //   (*((*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();
557 >
558 >  //   (*((*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();
559 >  //   (*((*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();
560 >
561 >  //   // jets
562 >  //   (*((*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();
563 >  //   (*((*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();
564 >  //   (*((*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();
565 >  //   (*((*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();
566 >  //   (*((*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();
567 >  //   (*((*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();
568 >  //   (*((*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();
569 >  //   (*((*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();
570 >  //   (*((*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();
571 >  //   (*((*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();
572 >  //   (*((*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();
573 >  //   (*((*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();
574 >  //   (*((*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();
575 >  //   (*((*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();
576 >  //   (*((*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();
577 >  //   (*((*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();
578 >  //   (*((*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();
579 >  //   (*((*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();
580 >  //   (*((*it_h).second))["mjj"]               = new TH1D(TString("mjj")+"_"+(*it_h).first+str,";#bf{m_{jj}};",                25,10,1550);     (*((*it_h).second))["mjj"]->Sumw2();
581 >  //   (*((*it_h).second))["dEta"]              = new TH1D(TString("dEta")+"_"+(*it_h).first+str,";#bf{#Delta #eta};",          25,-6,6);       (*((*it_h).second))["dEta"]->Sumw2();
582 >  //   (*((*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();
583 >  //   (*((*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();
584 >
585 >  //   // (*((*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();
586 >  //   // (*((*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();
587 >  //   // (*((*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();
588 >  //   // (*((*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();
589 >  //   // (*((*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();
590 >  //   // (*((*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();
591 >  //   // (*((*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();
592 >  //   // (*((*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();
593 >  //   // (*((*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();
594 >  //   // (*((*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();
595 >  //   // (*((*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();
596 >  //   // (*((*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();
597 >  //   // (*((*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();
598 >  //   // (*((*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();
599 >  //   // (*((*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();
600 >  //   // (*((*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();
601 >
602 >  //   int nbins=35;
603 >  //   (*((*it_h).second))["costheta1"] = new TH1D(TString("costheta1") +"_"+(*it_h).first+str,";#bf{costheta1};",                nbins,-1,1);          (*((*it_h).second))["costheta1"]->Sumw2();
604 >  //   (*((*it_h).second))["costheta2"] = new TH1D(TString("costheta2") +"_"+(*it_h).first+str,";#bf{costheta2};",                nbins,-1,1);          (*((*it_h).second))["costheta2"]->Sumw2();
605 >  //   (*((*it_h).second))["costhetastar"]      = new TH1D(TString("costhetastar") +"_"+(*it_h).first+str,";#bf{costhetastar};",          nbins,-1,1);          (*((*it_h).second))["costhetastar"]->Sumw2();
606 >  //   (*((*it_h).second))["Phi"]               = new TH1D(TString("Phi") +"_"+(*it_h).first+str,";#bf{Phi};",                            nbins,-3.15,3.15);          (*((*it_h).second))["Phi"]->Sumw2();
607 >  //   (*((*it_h).second))["Phi1"]              = new TH1D(TString("Phi1") +"_"+(*it_h).first+str,";#bf{Phi1};",                          nbins,-3.15,3.15);          (*((*it_h).second))["Phi1"]->Sumw2();
608 >
609 >  //   (*((*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();
610 >  //   (*((*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();
611 >  //   (*((*it_h).second))["y4l"]               = new TH1D(TString("y4l") +"_"+(*it_h).first+str,";#bf{y4l};",                            nbins,-2.4,2.4);      (*((*it_h).second))["y4l"]->Sumw2();
612 >  //   (*((*it_h).second))["Z1pt"]              = new TH1D(TString("Z1pt") +"_"+(*it_h).first+str,";#bf{Z1pt/m4l};",                      nbins,0,0.5);          (*((*it_h).second))["Z1pt"]->Sumw2();
613 >  //   (*((*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();
614 >  //   (*((*it_h).second))["Z2pt"]              = new TH1D(TString("Z2pt") +"_"+(*it_h).first+str,";#bf{Z2pt/m4l};",                      nbins,0,0.5);          (*((*it_h).second))["Z2pt"]->Sumw2();
615 >  //   (*((*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();
616 >
617 >  //   (*((*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();
618 >  //   (*((*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();
619 >  //   (*((*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();
620 >  //   (*((*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();
621 >  //   (*((*it_h).second))["dphi1"]     = new TH1D(TString("dphi1") +"_"+(*it_h).first+str,";#bf{dphi1};",                        nbins,-1,1);          (*((*it_h).second))["dphi1"]->Sumw2();
622 >  //   (*((*it_h).second))["dphi2"]     = new TH1D(TString("dphi2") +"_"+(*it_h).first+str,";#bf{dphi2};",                        nbins,-1,1);          (*((*it_h).second))["dphi2"]->Sumw2();
623 >  //   (*((*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();
624 >  //   (*((*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();
625 >
626 >  //   (*((*it_h).second))["fusionMVA"]         = new TH1D(TString("fusionMVA")+"_"+(*it_h).first+str,";#bf{MVA output};",        100,-1,1);      (*((*it_h).second))["fusionMVA"]->Sumw2();
627 >  //   (*((*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();
628 >  //   (*((*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();
629 >  //   (*((*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();
630 >  //   (*((*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();
631 >  //   (*((*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();
632 >  // }
633    return hists;
634   }
635   //--------------------------------------------------------------------------------------------------
636 < void makeHTML(FOFlags &ctrl, TString type, TString plotLabel)
637 < {
638 <  TString tmpString(plotLabel);
639 <  tmpString.ReplaceAll("/"," ");
640 <  TString title(ctrl.faketype+", "+tmpString+", "+type);
641 <  TString htmlfname(ctrl.outdir+"/"+plotLabel+"/"+type+"/plots.html");
642 <  ofstream htmlfile(htmlfname);
643 <
644 <  htmlfile << "<!DOCTYPE html" << endl;
645 <  htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
646 <  htmlfile << "<html>" << endl;
647 <
648 <  htmlfile << "<head><title>"+title+"</title></head>" << endl;
649 <  htmlfile << "<body bgcolor=\"000000\">" << endl;
650 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
651 <
652 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">boson kinematics</h3>" << endl;
653 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
654 <
655 <  htmlfile << "<tr>" << endl;
656 <  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;
657 <  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;
658 <  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;
659 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
660 <  htmlfile << "</tr>" << endl;
661 <
662 <  htmlfile << "<tr>" << endl;
663 <  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;
664 <  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;
665 <  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;
666 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
667 <  htmlfile << "</tr>" << endl;
668 <
669 <  htmlfile << "<tr>" << endl;
670 <  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;
671 <  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;
672 <  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;
673 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
674 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
675 <  htmlfile << "</tr>" << endl;
676 <
677 <  htmlfile << "</table>" << endl;
678 <  htmlfile << "<hr />" << endl;
679 <  htmlfile << "control: " << endl;
680 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
681 <
682 <  htmlfile << "<tr>" << endl;
683 <  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;
684 <  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;
685 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
686 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
687 <  htmlfile << "</tr>" << endl;
688 <
689 <  htmlfile << "</table>" << endl;
690 <
691 <  htmlfile << "</body>" << endl;
692 <  htmlfile << "</html>" << endl;
693 <  htmlfile.close();
694 <
695 <  TString leptonfname(htmlfname);
696 <  leptonfname.ReplaceAll("plots.html","leptonplots.html");
697 <  htmlfile.open(leptonfname);
698 <  cout << "opening: " << leptonfname << endl;
699 <
700 <  htmlfile << "<!DOCTYPE html" << endl;
701 <  htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
702 <  htmlfile << "<html>" << endl;
703 <
704 <  htmlfile << "<head><title>"+title+"</title></head>" << endl;
705 <  htmlfile << "<body bgcolor=\"000000\">" << endl;
706 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
707 <
708 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">lepton plots</h3>" << endl;
709 <  htmlfile << "<hr />" << endl;
710 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
711 <  htmlfile << "</table>" << endl;
712 <
713 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Z1 leptons:</h3>" << endl;
714 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
715 <
716 <  htmlfile << "<tr>" << endl;
717 <  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;
718 <  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;
719 <  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;
720 <  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;
721 <  htmlfile << "</tr>" << endl;
722 <
723 <  htmlfile << "<tr>" << endl;
724 <  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;
725 <  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;
726 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
727 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
728 <  htmlfile << "</tr>" << endl;
729 <
730 <  htmlfile << "<tr>" << endl;
731 <  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;
732 <  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;
733 <  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;
734 <  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;
735 <  htmlfile << "</tr>" << endl;
736 <
737 <  // htmlfile << "<tr>" << endl;
738 <  // 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;
739 <  // 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;
740 <  // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
741 <  // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
742 <  // htmlfile << "</tr>" << endl;
743 <
744 <  htmlfile << "</table>" << endl;
745 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">extra leptons (l3 and l4): </h3>" << endl;
746 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
747 <
748 <  htmlfile << "<tr>" << endl;
749 <  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;
750 <  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;
751 <  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;
752 <  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;
753 <  htmlfile << "</tr>" << endl;
754 <
755 <  htmlfile << "<tr>" << endl;
756 <  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;
757 <  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;
758 <  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;
759 <  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;
760 <  htmlfile << "</tr>" << endl;
636 > // void makeHTML(FOFlags &ctrl, TString type, TString plotLabel, TString fullOutDir)
637 > // {
638 > //   TString tmpString(plotLabel);
639 > //   tmpString.ReplaceAll("/"," ");
640 > //   TString title(ctrl.faketype+", "+tmpString+", "+type);
641 > //   TString htmlfname(fullOutDir+"/plots.html");
642 > //   ofstream htmlfile(htmlfname);
643 >
644 > //   htmlfile << "<!DOCTYPE html" << endl;
645 > //   htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
646 > //   htmlfile << "<html>" << endl;
647 >
648 > //   htmlfile << "<head><title>"+title+"</title></head>" << endl;
649 > //   htmlfile << "<body bgcolor=\"000000\">" << endl;
650 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
651 >
652 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">boson kinematics</h3>" << endl;
653 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
654 >
655 > //   htmlfile << "<tr>" << endl;
656 > //   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;
657 > //   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;
658 > //   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;
659 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
660 > //   htmlfile << "</tr>" << endl;
661 >
662 > //   htmlfile << "<tr>" << endl;
663 > //   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;
664 > //   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;
665 > //   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;
666 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
667 > //   htmlfile << "</tr>" << endl;
668 >
669 > //   htmlfile << "<tr>" << endl;
670 > //   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;
671 > //   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;
672 > //   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;
673 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
674 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
675 > //   htmlfile << "</tr>" << endl;
676 >
677 > //   htmlfile << "</table>" << endl;
678 > //   htmlfile << "<hr />" << endl;
679 > //   htmlfile << "control: " << endl;
680 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
681 >
682 > //   htmlfile << "<tr>" << endl;
683 > //   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;
684 > //   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;
685 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
686 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
687 > //   htmlfile << "</tr>" << endl;
688 >
689 > //   htmlfile << "</table>" << endl;
690 >
691 > //   htmlfile << "</body>" << endl;
692 > //   htmlfile << "</html>" << endl;
693 > //   htmlfile.close();
694 >
695 > //   TString anglefname(htmlfname);
696 > //   anglefname.ReplaceAll("plots.html","angleplots.html");
697 > //   htmlfile.open(anglefname);
698 >
699 > //   htmlfile << "<!DOCTYPE html" << endl;
700 > //   htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
701 > //   htmlfile << "<html>" << endl;
702 >
703 > //   htmlfile << "<head><title>"+title+"</title></head>" << endl;
704 > //   htmlfile << "<body bgcolor=\"000000\">" << endl;
705 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
706 >
707 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Angles & Co.</h3>" << endl;
708 > //   htmlfile << "<hr />" << endl;
709 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
710 > //   htmlfile << "</table>" << endl;
711 >
712 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Angles:</h3>" << endl;
713 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
714 >
715 > //   htmlfile << "<tr>" << endl;
716 > //   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;
717 > //   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;
718 > //   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;
719 > //   htmlfile << "<td width=\"25%\"></td>" << endl;
720 > //   htmlfile << "</tr>" << endl;
721 >
722 > //   htmlfile << "<tr>" << endl;
723 > //   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;
724 > //   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;
725 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
726 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
727 > //   htmlfile << "</tr>" << endl;
728 >
729 > //   htmlfile << "</table>" << endl;
730 > //   htmlfile << "<hr />" << endl;
731 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Boson pt variables: " << endl;
732 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
733 >
734 > //   htmlfile << "<tr>" << endl;
735 > //   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;
736 > //   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;
737 > //   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;
738 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
739 > //   htmlfile << "<tr>" << endl;
740 >
741 > //   htmlfile << "</tr>" << endl;
742 > //   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;
743 > //   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;
744 > //   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;
745 > //   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;
746 > //   htmlfile << "</tr>" << endl;
747 >
748 > //   htmlfile << "<tr>" << endl;
749 > //   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;
750 > //   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;
751 > //   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;
752 > //   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;
753 > //   htmlfile << "</tr>" << endl;
754 >
755 > //   htmlfile << "<tr>" << endl;
756 > //   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;
757 > //   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;
758 > //   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;
759 > //   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;
760 > //   htmlfile << "</tr>" << endl;
761 >
762 >
763 > //   htmlfile << "</table>" << endl;
764 >
765 > //   htmlfile << "</body>" << endl;
766 > //   htmlfile << "</html>" << endl;
767 > //   htmlfile.close();
768 >
769 > //   TString leptonfname(htmlfname);
770 > //   leptonfname.ReplaceAll("plots.html","leptonplots.html");
771 > //   htmlfile.open(leptonfname);
772 >
773 > //   htmlfile << "<!DOCTYPE html" << endl;
774 > //   htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
775 > //   htmlfile << "<html>" << endl;
776 >
777 > //   htmlfile << "<head><title>"+title+"</title></head>" << endl;
778 > //   htmlfile << "<body bgcolor=\"000000\">" << endl;
779 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
780 >
781 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">lepton plots</h3>" << endl;
782 > //   htmlfile << "<hr />" << endl;
783 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
784 > //   htmlfile << "</table>" << endl;
785 >
786 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">Z1 leptons:</h3>" << endl;
787 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
788 >
789 > //   htmlfile << "<tr>" << endl;
790 > //   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;
791 > //   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;
792 > //   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;
793 > //   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;
794 > //   htmlfile << "</tr>" << endl;
795 >
796 > //   htmlfile << "<tr>" << endl;
797 > //   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;
798 > //   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;
799 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
800 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
801 > //   htmlfile << "</tr>" << endl;
802 >
803 > //   htmlfile << "<tr>" << endl;
804 > //   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;
805 > //   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;
806 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
807 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
808 > //   htmlfile << "</tr>" << endl;
809 >
810 > //   htmlfile << "<tr>" << endl;
811 > //   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;
812 > //   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;
813 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
814 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
815 > //   htmlfile << "</tr>" << endl;
816 >
817 > //   // htmlfile << "<tr>" << endl;
818 > //   // 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;
819 > //   // 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;
820 > //   // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
821 > //   // htmlfile << "<td width=\"25%\"><a><</a></td>" << endl;
822 > //   // htmlfile << "</tr>" << endl;
823 >
824 > //   htmlfile << "</table>" << endl;
825 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">extra leptons (l3 and l4): </h3>" << endl;
826 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
827 >
828 > //   htmlfile << "<tr>" << endl;
829 > //   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;
830 > //   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;
831 > //   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;
832 > //   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;
833 > //   htmlfile << "</tr>" << endl;
834 >
835 > //   htmlfile << "<tr>" << endl;
836 > //   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;
837 > //   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;
838 > //   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;
839 > //   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;
840 > //   htmlfile << "</tr>" << endl;
841  
842 <  htmlfile << "<tr>" << endl;
843 <  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;
844 <  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;
845 <  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;
846 <  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;
847 <  htmlfile << "</tr>" << endl;
848 <
849 <  htmlfile << "<tr>" << endl;
850 <  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;
851 <  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;
852 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
853 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
854 <  htmlfile << "</tr>" << endl;
842 > //   htmlfile << "<tr>" << endl;
843 > //   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;
844 > //   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;
845 > //   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;
846 > //   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;
847 > //   htmlfile << "</tr>" << endl;
848 >
849 > //   htmlfile << "<tr>" << endl;
850 > //   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;
851 > //   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;
852 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
853 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
854 > //   htmlfile << "</tr>" << endl;
855  
856 <  htmlfile << "</table>" << endl;
856 > //   htmlfile << "</table>" << endl;
857  
858 <  htmlfile << "</body>" << endl;
859 <  htmlfile << "</html>" << endl;
860 <  htmlfile.close();
861 <
862 <  TString jetfname(htmlfname);
863 <  jetfname.ReplaceAll("plots.html","jetplots.html");
864 <  htmlfile.open(jetfname);
865 <
866 <  htmlfile << "<!DOCTYPE html" << endl;
867 <  htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
868 <  htmlfile << "<html>" << endl;
869 <
870 <  htmlfile << "<head><title>"+title+"</title></head>" << endl;
871 <  htmlfile << "<body bgcolor=\"000000\">" << endl;
872 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
873 <
874 <  htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">jet plots</h3>" << endl;
875 <  htmlfile << "<hr />" << endl;
876 <  htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
877 <
878 <  htmlfile << "<tr>" << endl;
879 <  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;
880 <  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;
881 <  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;
882 <  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;
883 <  htmlfile << "</tr>" << endl;
884 <
885 <  htmlfile << "<tr>" << endl;
886 <  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;
887 <  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;
888 <  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;
889 <  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;
890 <  htmlfile << "</tr>" << endl;
891 <
892 <  htmlfile << "<tr>" << endl;
893 <  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;
894 <  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;
895 <  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;
896 <  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;
897 <  htmlfile << "</tr>" << endl;
898 <
899 <  htmlfile << "<tr>" << endl;
900 <  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;
901 <  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;
902 <  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;
903 <  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;
904 <  htmlfile << "</tr>" << endl;
905 <
906 <  htmlfile << "<tr>" << endl;
907 <  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;
908 <  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;
909 <  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;
910 <  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;
911 <  htmlfile << "</tr>" << endl;
912 <
913 <  // htmlfile << "<tr>" << endl;
914 <  // 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;
915 <  // 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;
916 <  // 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;
917 <  // 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;
918 <  // htmlfile << "</tr>" << endl;
919 <
920 <  // htmlfile << "<tr>" << endl;
921 <  // 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;
922 <  // 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;
923 <  // 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;
924 <  // 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;
925 <  // htmlfile << "</tr>" << endl;
926 <
927 <  // htmlfile << "<tr>" << endl;
928 <  // 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;
929 <  // 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;
930 <  // 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;
931 <  // 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;
932 <  // htmlfile << "</tr>" << endl;
933 <
934 <  // htmlfile << "<tr>" << endl;
935 <  // 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;
936 <  // 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;
937 <  // 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;
938 <  // 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;
939 <  // htmlfile << "</tr>" << endl;
940 <
941 <  htmlfile << "<tr>" << endl;
942 <  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;
943 <  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;
944 <  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;
945 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
946 <  htmlfile << "</tr>" << endl;
947 <
948 <  htmlfile << "<tr>" << endl;
949 <  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;
950 <  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;
951 <  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;
952 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
953 <  htmlfile << "</tr>" << endl;
954 <
955 <  htmlfile << "<tr>" << endl;
956 <  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;
957 <  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;
958 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
959 <  htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
960 <  htmlfile << "</tr>" << endl;
858 > //   htmlfile << "</body>" << endl;
859 > //   htmlfile << "</html>" << endl;
860 > //   htmlfile.close();
861 >
862 > //   TString jetfname(htmlfname);
863 > //   jetfname.ReplaceAll("plots.html","jetplots.html");
864 > //   htmlfile.open(jetfname);
865 >
866 > //   htmlfile << "<!DOCTYPE html" << endl;
867 > //   htmlfile << "    PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" << endl;
868 > //   htmlfile << "<html>" << endl;
869 >
870 > //   htmlfile << "<head><title>"+title+"</title></head>" << endl;
871 > //   htmlfile << "<body bgcolor=\"000000\">" << endl;
872 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">"+title+"</h3>" << endl;
873 >
874 > //   htmlfile << "<h3 style=\"text-align:left; color:DD6600;\">jet plots</h3>" << endl;
875 > //   htmlfile << "<hr />" << endl;
876 > //   htmlfile << "<table border=\"0\" cellspacing=\"5\" width=\"100%\">" << endl;  
877 >
878 > //   htmlfile << "<tr>" << endl;
879 > //   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;
880 > //   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;
881 > //   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;
882 > //   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;
883 > //   htmlfile << "</tr>" << endl;
884 >
885 > //   htmlfile << "<tr>" << endl;
886 > //   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;
887 > //   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;
888 > //   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;
889 > //   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;
890 > //   htmlfile << "</tr>" << endl;
891 >
892 > //   htmlfile << "<tr>" << endl;
893 > //   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;
894 > //   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;
895 > //   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;
896 > //   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;
897 > //   htmlfile << "</tr>" << endl;
898 >
899 > //   htmlfile << "<tr>" << endl;
900 > //   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;
901 > //   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;
902 > //   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;
903 > //   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;
904 > //   htmlfile << "</tr>" << endl;
905 >
906 > //   htmlfile << "<tr>" << endl;
907 > //   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;
908 > //   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;
909 > //   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;
910 > //   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;
911 > //   htmlfile << "</tr>" << endl;
912 >
913 > //   // htmlfile << "<tr>" << endl;
914 > //   // 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;
915 > //   // 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;
916 > //   // 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;
917 > //   // 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;
918 > //   // htmlfile << "</tr>" << endl;
919 >
920 > //   // htmlfile << "<tr>" << endl;
921 > //   // 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;
922 > //   // 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;
923 > //   // 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;
924 > //   // 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;
925 > //   // htmlfile << "</tr>" << endl;
926 >
927 > //   // htmlfile << "<tr>" << endl;
928 > //   // 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;
929 > //   // 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;
930 > //   // 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;
931 > //   // 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;
932 > //   // htmlfile << "</tr>" << endl;
933 >
934 > //   // htmlfile << "<tr>" << endl;
935 > //   // 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;
936 > //   // 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;
937 > //   // 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;
938 > //   // 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;
939 > //   // htmlfile << "</tr>" << endl;
940 >
941 > //   htmlfile << "<tr>" << endl;
942 > //   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;
943 > //   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;
944 > //   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;
945 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
946 > //   htmlfile << "</tr>" << endl;
947 >
948 > //   htmlfile << "<tr>" << endl;
949 > //   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;
950 > //   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;
951 > //   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;
952 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
953 > //   htmlfile << "</tr>" << endl;
954 >
955 > //   htmlfile << "<tr>" << endl;
956 > //   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;
957 > //   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;
958 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
959 > //   htmlfile << "<td width=\"25%\"><a></a></td>" << endl;
960 > //   htmlfile << "</tr>" << endl;
961  
962  
963 <  htmlfile << "</table>" << endl;
963 > //   htmlfile << "</table>" << endl;
964  
965 <  htmlfile << "<hr />" << endl;
965 > //   htmlfile << "<hr />" << endl;
966  
967 <  htmlfile << "<hr />" << endl;
967 > //   htmlfile << "<hr />" << endl;
968      
969 <  htmlfile << "</body>" << endl;
970 <  htmlfile << "</html>" << endl;
971 <  htmlfile.close();
972 < }
896 < //----------------------------------------------------------------------------------------
897 < void fillHist(CSample *cs, TString channel, TString type, TString var, double val, double wgt, double wgt_lo, double wgt_hi)
898 < {
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" || 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!="") {
906 <      (*(cs->hists)[channel+"_"+type+"_lo"])[var]->Fill(   val,   wgt_lo);
907 <      (*(cs->hists)[channel+"_"+type+"_hi"])[var]->Fill(   val,   wgt_hi);
908 <    }
909 <  }
910 < }
911 < //----------------------------------------------------------------------------------------
912 < void fillAllHists(FOFlags ctrl, CSample *cs, TString channel, TString type, filestuff *fs, KinematicsStruct kine,
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, "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,
956 <                      SimpleLepton lep1, SimpleLepton lep2, SimpleLepton lep3, SimpleLepton lep4,
957 <                      FusionMva &fusion, vector<SimpleLepton> &goodJets, JetInfoStruct ji,
958 <                      double wgt, double wgt_lo, double wgt_hi)
959 < {
960 <  double fMVAval = (ctrl.uncert=="") ? 0 : fusion.reader->EvaluateMVA("BDTG");
961 <  dr_struct drs = fill_dr_struct(goodJets,lep1,lep2,lep3,lep4);
962 <  drs.check();
963 <  fillHist( cs, channel, type, "pt_j1"  ,     ji.ptJet1,        wgt, wgt_lo, wgt_hi);
964 <  fillHist( cs, channel, type, "pt_j2"  ,     ji.ptJet2,        wgt, wgt_lo, wgt_hi);
965 <  fillHist( cs, channel, type, "pt_j3"  ,     ji.ptJet3,        wgt, wgt_lo, wgt_hi);
966 <  fillHist( cs, channel, type, "pt_j4"  ,     ji.ptJet4,        wgt, wgt_lo, wgt_hi);
967 <  fillHist( cs, channel, type, "eta_j1" ,     ji.etaJet1,       wgt, wgt_lo, wgt_hi);
968 <  fillHist( cs, channel, type, "eta_j2" ,     ji.etaJet2,       wgt, wgt_lo, wgt_hi);
969 <  fillHist( cs, channel, type, "eta_j3" ,     ji.etaJet3,       wgt, wgt_lo, wgt_hi);
970 <  fillHist( cs, channel, type, "eta_j4" ,     ji.etaJet4,       wgt, wgt_lo, wgt_hi);
971 <  fillHist( cs, channel, type, "phi_j1" ,     ji.phiJet1,       wgt, wgt_lo, wgt_hi);
972 <  fillHist( cs, channel, type, "phi_j2" ,     ji.phiJet2,       wgt, wgt_lo, wgt_hi);
973 <  fillHist( cs, channel, type, "phi_j3" ,     ji.phiJet3,       wgt, wgt_lo, wgt_hi);
974 <  fillHist( cs, channel, type, "phi_j4" ,     ji.phiJet4,       wgt, wgt_lo, wgt_hi);
975 <  fillHist( cs, channel, type, "idmva_j1",    ji.mvaJet1,       wgt, wgt_lo, wgt_hi);
976 <  fillHist( cs, channel, type, "idmva_j2",    ji.mvaJet2,       wgt, wgt_lo, wgt_hi);
977 <  fillHist( cs, channel, type, "idmva_j3",    ji.mvaJet3,       wgt, wgt_lo, wgt_hi);
978 <  fillHist( cs, channel, type, "idmva_j4",    ji.mvaJet4,       wgt, wgt_lo, wgt_hi);
979 <  fillHist( cs, channel, type, "mjj"    ,     ji.mjj,           wgt, wgt_lo, wgt_hi);
980 <  fillHist( cs, channel, type, "dEta"   ,     ji.dEta,          wgt, wgt_lo, wgt_hi);
981 <  fillHist( cs, channel, type, "etaProd",     ji.etaProd,       wgt, wgt_lo, wgt_hi);
982 <  fillHist( cs, channel, type, "njets"    ,   goodJets.size(),  wgt, wgt_lo, wgt_hi);
983 <  fillHist( cs, channel, type, "dR_l1j1",     drs.l1j1,         wgt, wgt_lo, wgt_hi);
984 <  fillHist( cs, channel, type, "dR_l2j1",     drs.l2j1,         wgt, wgt_lo, wgt_hi);
985 <  fillHist( cs, channel, type, "dR_l3j1",     drs.l3j1,         wgt, wgt_lo, wgt_hi);
986 <  fillHist( cs, channel, type, "dR_l4j1",     drs.l4j1,         wgt, wgt_lo, wgt_hi);
987 <  fillHist( cs, channel, type, "dR_l1j2",     drs.l1j2,         wgt, wgt_lo, wgt_hi);
988 <  fillHist( cs, channel, type, "dR_l2j2",     drs.l2j2,         wgt, wgt_lo, wgt_hi);
989 <  fillHist( cs, channel, type, "dR_l3j2",     drs.l3j2,         wgt, wgt_lo, wgt_hi);
990 <  fillHist( cs, channel, type, "dR_l4j2",     drs.l4j2,         wgt, wgt_lo, wgt_hi);
991 <  fillHist( cs, channel, type, "dR_l1j3",     drs.l1j3,         wgt, wgt_lo, wgt_hi);
992 <  fillHist( cs, channel, type, "dR_l2j3",     drs.l2j3,         wgt, wgt_lo, wgt_hi);
993 <  fillHist( cs, channel, type, "dR_l3j3",     drs.l3j3,         wgt, wgt_lo, wgt_hi);
994 <  fillHist( cs, channel, type, "dR_l4j3",     drs.l4j3,         wgt, wgt_lo, wgt_hi);
995 <  fillHist( cs, channel, type, "dR_l1j4",     drs.l1j4,         wgt, wgt_lo, wgt_hi);
996 <  fillHist( cs, channel, type, "dR_l2j4",     drs.l2j4,         wgt, wgt_lo, wgt_hi);
997 <  fillHist( cs, channel, type, "dR_l3j4",     drs.l3j4,         wgt, wgt_lo, wgt_hi);
998 <  fillHist( cs, channel, type, "dR_l4j4",     drs.l4j4,         wgt, wgt_lo, wgt_hi);
999 <
1000 <  fillHist( cs, channel, type, "fusionMVA_lo", fMVAval,         wgt, wgt_lo, wgt_hi);
1001 <  fillHist( cs, channel, type, "fusionMVA_med",fMVAval,         wgt, wgt_lo, wgt_hi);
1002 <  fillHist( cs, channel, type, "fusionMVA_hi", fMVAval,         wgt, wgt_lo, wgt_hi);
1003 <  fillHist( cs, channel, type, "fusionMVA",    fMVAval,         wgt, wgt_lo, wgt_hi);
1004 <  if(fMVAval > -.3) {
1005 <    fillHist( cs, channel, type, "m4l_jet_lo",  kine.m4l  ,     wgt, wgt_lo, wgt_hi);                
1006 <    fillHist( cs, channel, type, "m4l_jet",     kine.m4l  ,     wgt, wgt_lo, wgt_hi);
1007 <  }
1008 < }
969 > //   htmlfile << "</body>" << endl;
970 > //   htmlfile << "</html>" << endl;
971 > //   htmlfile.close();
972 > // }
973   //----------------------------------------------------------------------------------------
974   bool passHlt(FOFlags &ctrl, TrigInfo ti, InfoStruct *info, unsigned lep1matchBits,
975               unsigned lep2matchBits, unsigned lep3matchBits,
# Line 1033 | Line 997 | bool passHlt(FOFlags &ctrl, TrigInfo ti,
997    return pass;
998   }
999   //----------------------------------------------------------------------------------------
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;
1049  if(jets.size() > 0) {
1050    drs.l1j1 = dr(lep1,jets[0]);
1051    drs.l2j1 = dr(lep2,jets[0]);
1052    drs.l3j1 = dr(lep3,jets[0]);
1053    drs.l4j1 = dr(lep4,jets[0]);
1054  }
1055  if(jets.size() > 1) {
1056    drs.l1j2 = dr(lep1,jets[1]);
1057    drs.l2j2 = dr(lep2,jets[1]);
1058    drs.l3j2 = dr(lep3,jets[1]);
1059    drs.l4j2 = dr(lep4,jets[1]);
1060  }
1061  if(jets.size() > 2) {
1062    drs.l1j3 = dr(lep1,jets[2]);
1063    drs.l2j3 = dr(lep2,jets[2]);
1064    drs.l3j3 = dr(lep3,jets[2]);
1065    drs.l4j3 = dr(lep4,jets[2]);
1066  }
1067  if(jets.size() > 3) {
1068    drs.l1j4 = dr(lep1,jets[3]);
1069    drs.l2j4 = dr(lep2,jets[3]);
1070    drs.l3j4 = dr(lep3,jets[3]);
1071    drs.l4j4 = dr(lep4,jets[3]);
1072  }
1073  return drs;
1074 }
1075 //----------------------------------------------------------------------------------------
1000   void init_cuts( vector<TString> &cutstrs, map<TString,int> &cutvec)
1001   {
1002    cutstrs.push_back("start"  );    cutvec["start"]  = 0;
# Line 1125 | Line 1049 | map<TString,TH1D*> setHistSet(CSample *c
1049    return hset;
1050   }
1051   //----------------------------------------------------------------------------------------
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 //----------------------------------------------------------------------------------------
1052   void fillFakeTuple(CSample *cs, filestuff *fs, EventData evtdata, unsigned ientry, double fillweight)
1053   {
1054    fs->getentry(ientry,"","zznt"); // make sure we've got this entry for all the branches
1055 +  fillAngles(evtdata,*fs->angles);
1056    fillKinematics(evtdata,*fs->kine); // reminder: kine has the fake information, while fs->kine *had*, until this line, whatever ZPlusX put in it
1057    fs->weights->w = fillweight;
1058    fs->outtuple->Fill();
1059    fs->outFotuple->Fill();
1060   }
1061 + //----------------------------------------------------------------------------------------
1062 + void incrementSsofCounters(FOFlags &ctrl, filestuff *fs, double minMz2,
1063 +                           pair<int,int> *best_z_indices,
1064 +                           double wgt)
1065 + {
1066 +  assert(ctrl.ssof); // only makes sense to write this out when we're thinking about ssof method
1067 +  vector<pair<SimpleLepton,SimpleLepton> > z2cands;
1068 +  vector<TString> types;
1069 +  
1070 +  int hiPtFailZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, "XX-SF", minMz2, "fail");
1071 +  if(hiPtFailZ2 == -1) return; // no z2 found
1072 +  SimpleLepton lep1 = (*fs->passingL)[best_z_indices->first];
1073 +  SimpleLepton lep2 = (*fs->passingL)[best_z_indices->second];
1074 +  SimpleLepton lep3 = z2cands[hiPtFailZ2].first;
1075 +  SimpleLepton lep4 = z2cands[hiPtFailZ2].second;
1076 +  TString channel = getChannel(lep1,lep2,lep3,lep4);
1077 +  TString sign = (lep3.charge == lep4.charge) ? "SS" : "OS";
1078  
1079 <          // double mjj=0,dEta=0,etaProd=0,nCentralJets=0;
1080 <          // if(jet1 && jet2) {
1081 <          //   cutvec["twoJets"] += 1;
1082 <          //   if(ctrl.debug) cout << "looping through " << goodJets.size() << " good jets" << endl;
1083 <          //   if(ctrl.debug) {cout << "jet 1 (" << jet1 << "): "; jet1->print();}
1084 <          //   if(ctrl.debug) {cout << "jet 2 (" << jet2 << "): "; jet2->print();}
1085 <          //   for(unsigned ijet=0; ijet<goodJets.size(); ijet++) {
1086 <          //     SimpleLepton *jet = goodJets[ijet];
1087 <          //     if(jet == jet1) {
1088 <          //    if(ctrl.debug) cout << "  " << jet << " this is jet 1" << endl;
1089 <          //    continue;
1090 <          //     }
1091 <          //     if(jet == jet2) {
1092 <          //    if(ctrl.debug) cout << "  " << jet << " this is jet 2" << endl;
1093 <          //    continue;
1094 <          //     }
1095 <          //     double eta = jet->vec.Eta();
1096 <          //     double eta1 = jet1->vec.Eta();
1097 <          //     double eta2 = jet2->vec.Eta();
1098 <          //     if(eta1 > eta2) {
1099 <          //    if(eta > eta2 && eta < eta1)
1100 <          //      nCentralJets++;
1101 <          //     } else if(eta2 > eta1) {
1102 <          //    if(eta > eta1 && eta < eta2)
1103 <          //      nCentralJets++;
1104 <          //     }
1105 <          //     if(ctrl.debug) cout << "  nCentralJets: " << nCentralJets << endl;
1106 <          //   }
1107 <          //   double mjjMin = 400;
1108 <          //   double dEtaMin = 4;
1109 <          //   TLorentzVector dijet(jet1->vec + jet2->vec);
1110 <          //   mjj = dijet.M();
1111 <          //   if(ctrl.debug) cout << "setting mjj: " << mjj << "(using " << jet1->vec.Pt() << " " << jet2->vec.Pt() << endl;
1112 <          //   dEta = jet1->vec.Eta() - jet2->vec.Eta();
1113 <          //   etaProd = jet1->vec.Eta()*jet2->vec.Eta();
1114 <          //   bool isVbf = (mjj > mjjMin) && (fabs(dEta) > dEtaMin) && (etaProd < 0) && (nCentralJets==0);
1115 <          // }
1116 <
1079 >  fs->counters_[sign+"_"+channel] += wgt;
1080 >  fs->counters_[sign] += wgt;
1081 > }
1082 > //----------------------------------------------------------------------------------------
1083 > double getSsofWgt(TString channel, map<TString,double> &ssofRatios)
1084 > {
1085 >  double returnval = ssofRatios[channel];
1086 >  if(returnval < 0.1 || returnval > 3) {
1087 >    cout << "\nERROR! ssof ratio out of bounds for " << channel << ": " << returnval << endl;
1088 >    assert(0);
1089 >  }
1090 >  return returnval;
1091 > }
1092 > //----------------------------------------------------------------------------------------
1093 > map<TString,double> initSsofRatios(vector<CSample*> &samplev)
1094 > {
1095 >  double OS,SS;
1096 >  double OS_4e,SS_4e;
1097 >  double OS_4m,SS_4m;
1098 >  double OS_2e2m,SS_2e2m;
1099 >  cout << "Initializing ssof ratios: " << endl;
1100 >  for(unsigned isam=0; isam<samplev.size(); isam++) {
1101 >    CSample *cs = samplev[isam];
1102 >    for(unsigned ifs=0; ifs<(cs->fsv).size(); ifs++) {
1103 >      filestuff *fs = (cs->fsv)[ifs];
1104 >      if(fs->useSsofRatio_) {
1105 >        cout << "  adding from: " << fs->fname_ << endl;
1106 >        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;
1107 >        OS      += fs->counters_["OS"];
1108 >        SS      += fs->counters_["SS"];
1109 >        OS_4e   += fs->counters_["OS_4e"];
1110 >        SS_4e   += fs->counters_["SS_4e"];
1111 >        OS_4m   += fs->counters_["OS_4m"];
1112 >        SS_4m   += fs->counters_["SS_4m"];
1113 >        OS_2e2m += fs->counters_["OS_2e2m"];
1114 >        SS_2e2m += fs->counters_["SS_2e2m"];
1115 >      }
1116 >    }
1117 >  }
1118 >  assert(OS!=0 && SS!=0 && OS_4e!=0 && SS_4e!=0 && OS_4m!=0 && SS_4m!=0 && OS_2e2m && SS_2e2m!=0);
1119 >  map<TString,double> ssofRatios;
1120 >  ssofRatios[""]     = OS/SS;
1121 >  ssofRatios["4e"]   = OS_4e/SS_4e;
1122 >  ssofRatios["4m"]   = OS_4m/SS_4m;
1123 >  ssofRatios["2e2m"] = OS_2e2m/SS_2e2m;
1124 >  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;
1125 >  return ssofRatios;
1126 > }
1127 >        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines