ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
(Generate patch)

Comparing UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc (file contents):
Revision 1.42 by wulsin, Wed Mar 27 22:38:08 2013 UTC vs.
Revision 1.52 by lantonel, Sat Apr 27 15:53:06 2013 UTC

# Line 11 | Line 11 | OSUAnalysis::OSUAnalysis (const edm::Par
11    tracks_ (cfg.getParameter<edm::InputTag> ("tracks")),
12    genjets_ (cfg.getParameter<edm::InputTag> ("genjets")),
13    mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")),
14 +  stops_ (cfg.getParameter<edm::InputTag> ("stops")),
15    primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")),
16    bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")),
17    photons_ (cfg.getParameter<edm::InputTag> ("photons")),
# Line 29 | Line 30 | OSUAnalysis::OSUAnalysis (const edm::Par
30    plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")),
31    doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")),
32    printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")),
33 <  useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr"))
33 >  useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")),
34 >  stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau"))
35  
36   {
37  
# Line 41 | Line 43 | OSUAnalysis::OSUAnalysis (const edm::Par
43      //    muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_);
44      //    electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_);
45    }
46 + #ifdef DISPLACED_SUSY
47 +  if (datasetType_ == "signalMC")
48 +    cTauWeight_ = new CTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_);
49 + #endif
50  
51  
52    // Construct Cutflow Objects. These store the results of cut decisions and
# Line 51 | Line 57 | OSUAnalysis::OSUAnalysis (const edm::Par
57    //always get vertex collection so we can assign the primary vertex in the event
58    objectsToGet.push_back("primaryvertexs");
59  
60 <  //always make the plot of number of primary verticex (to check pile-up reweighting)
60 >  //always make the plot of number of primary vertices (to check pile-up reweighting)
61    objectsToPlot.push_back("primaryvertexs");
62  
63    //always get the MC particles to do GEN-matching
# Line 65 | Line 71 | OSUAnalysis::OSUAnalysis (const edm::Par
71  
72      string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection");
73      if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs";
74 +    if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs";
75 +    if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs";
76      if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
77 +    if(tempInputCollection == "secondary muon-muon pairs")   tempInputCollection = "muon-secondary muon pairs";
78 +    if(tempInputCollection == "secondary electron-electron pairs")   tempInputCollection = "electron-secondary electron pairs";
79      if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
80 <      objectsToGet.push_back(tempInputCollection);
80 >      if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
81 >        int spaceIndex = tempInputCollection.find(" ");
82 >        int secondWordLength = tempInputCollection.size() - spaceIndex;
83 >        objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
84 >      }
85 >      else{
86 >        objectsToGet.push_back(tempInputCollection);
87 >      }
88        objectsToPlot.push_back(tempInputCollection);
89        objectsToCut.push_back(tempInputCollection);
90      }
91 <    else{//pair of objects, need to add them both to the things to objectsToGet
92 <      int dashIndex = tempInputCollection.find("-");
93 <      int spaceIndex = tempInputCollection.find(" ");
94 <      int secondWordLength = spaceIndex - dashIndex;
95 <      objectsToGet.push_back(tempInputCollection);
79 <      objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
80 <      objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
81 <      objectsToPlot.push_back(tempInputCollection);
82 <      objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s");
83 <      objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
91 >    else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut
92 >      string obj1;
93 >      string obj2;
94 >      getTwoObjs(tempInputCollection, obj1, obj2);
95 >      string obj2ToGet = getObjToGet(obj2);  
96        objectsToCut.push_back(tempInputCollection);
97 <      objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s");
98 <      objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
97 >      objectsToCut.push_back(obj1);
98 >      objectsToCut.push_back(obj2);  
99 >      objectsToPlot.push_back(tempInputCollection);
100 >      objectsToPlot.push_back(obj1);
101 >      objectsToPlot.push_back(obj2);  
102 >      objectsToGet.push_back(tempInputCollection);
103 >      objectsToGet.push_back(obj1);
104 >      objectsToGet.push_back(obj2ToGet);
105  
106 <      }
106 >    }
107  
108      vector<edm::ParameterSet> histogramList_  (histogramSets_.at(currentHistogramSet).getParameter<vector<edm::ParameterSet> >("histograms"));
109  
# Line 112 | Line 130 | OSUAnalysis::OSUAnalysis (const edm::Par
130    for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
131  
132      string currentObject = objectsToPlot.at(currentObjectIndex);
133 <    if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue;
133 >    if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue;
134  
135      histogram tempIdHisto;
136      histogram tempMomIdHisto;
137      histogram tempGmaIdHisto;
138      histogram tempIdVsMomIdHisto;
139 +    histogram tempIdVsGmaIdHisto;
140  
141      tempIdHisto.inputCollection = currentObject;
142      tempMomIdHisto.inputCollection = currentObject;
143      tempGmaIdHisto.inputCollection = currentObject;
144      tempIdVsMomIdHisto.inputCollection = currentObject;
145 +    tempIdVsGmaIdHisto.inputCollection = currentObject;
146 +
147 +    if(currentObject == "secondary muons") currentObject = "secondaryMuons";
148 +    if(currentObject == "secondary electrons") currentObject = "secondaryElectrons";
149  
150      currentObject = currentObject.substr(0, currentObject.size()-1);
151      tempIdHisto.name = currentObject+"GenMatchId";
152      tempMomIdHisto.name = currentObject+"GenMatchMotherId";
153      tempGmaIdHisto.name = currentObject+"GenMatchGrandmotherId";
154      tempIdVsMomIdHisto.name = currentObject+"GenMatchIdVsMotherId";
155 +    tempIdVsGmaIdHisto.name = currentObject+"GenMatchIdVsGrandmotherId";
156  
157      currentObject.at(0) = toupper(currentObject.at(0));
158      tempIdHisto.title = currentObject+" Gen-matched Particle";
159      tempMomIdHisto.title = currentObject+" Gen-matched Particle's Mother";
160      tempGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother";
161      tempIdVsMomIdHisto.title = currentObject+" Gen-matched Particle's Mother vs. Particle;Particle;Mother";
162 +    tempIdVsGmaIdHisto.title = currentObject+" Gen-matched Particle's Grandmother vs. Particle;Particle;Grandmother";
163 +
164  
165      int maxNum = 24;
166      vector<double> binVector;
# Line 154 | Line 180 | OSUAnalysis::OSUAnalysis (const edm::Par
180      tempIdVsMomIdHisto.bins = binVector;
181      tempIdVsMomIdHisto.inputVariables.push_back("genMatchedId");
182      tempIdVsMomIdHisto.inputVariables.push_back("genMatchedMotherIdReverse");
183 +    tempIdVsGmaIdHisto.bins = binVector;
184 +    tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedId");
185 +    tempIdVsGmaIdHisto.inputVariables.push_back("genMatchedGrandmotherIdReverse");
186  
187      histograms.push_back(tempIdHisto);
188      histograms.push_back(tempMomIdHisto);
189      histograms.push_back(tempGmaIdHisto);
190      histograms.push_back(tempIdVsMomIdHisto);
191 +    histograms.push_back(tempIdVsGmaIdHisto);
192    }
193  
194  
# Line 224 | Line 254 | OSUAnalysis::OSUAnalysis (const edm::Par
254  
255        if(currentHistogram.name.find("GenMatch")==std::string::npos) continue;
256  
257 < // bin      particle type
258 < // ---      -------------
259 < //  0        unmatched
260 < //  1        u
261 < //  2        d
262 < //  3        s
263 < //  4        c
264 < //  5        b
265 < //  6        t
266 < //  7        e
267 < //  8        mu
268 < //  9        tau
269 < // 10        nu
270 < // 11        g
271 < // 12        gamma
272 < // 13        Z
273 < // 14        W
274 < // 15        light meson
275 < // 16        K meson
276 < // 17        D meson
277 < // 18        B meson
278 < // 19        light baryon
279 < // 20        strange baryon
280 < // 21        charm baryon
281 < // 22        bottom baryon
282 < // 23        other
257 >      // bin      particle type
258 >      // ---      -------------
259 >      //  0        unmatched
260 >      //  1        u
261 >      //  2        d
262 >      //  3        s
263 >      //  4        c
264 >      //  5        b
265 >      //  6        t
266 >      //  7        e
267 >      //  8        mu
268 >      //  9        tau
269 >      // 10        nu
270 >      // 11        g
271 >      // 12        gamma
272 >      // 13        Z
273 >      // 14        W
274 >      // 15        light meson
275 >      // 16        K meson
276 >      // 17        D meson
277 >      // 18        B meson
278 >      // 19        light baryon
279 >      // 20        strange baryon
280 >      // 21        charm baryon
281 >      // 22        bottom baryon
282 >      // 23        other
283  
284        vector<TString> labelArray;
285        labelArray.push_back("unmatched");
# Line 278 | Line 308 | OSUAnalysis::OSUAnalysis (const edm::Par
308        labelArray.push_back("other");
309  
310        for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){
311 <        if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos) {
311 >        if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==std::string::npos) {
312            oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
313          }
314          else {
# Line 286 | Line 316 | OSUAnalysis::OSUAnalysis (const edm::Par
316            twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
317          }
318        }
319 <      if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos) {
319 >      if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=std::string::npos) {
320          twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle();
321          twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle();
322        }
# Line 300 | Line 330 | OSUAnalysis::OSUAnalysis (const edm::Par
330        int maxNum = 10;
331        if(currentObject == "mcparticles") maxNum = 50;
332        else if(currentObject == "primaryvertexs") maxNum = 50;
303      else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs";
304      else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs";
305      else if(currentObject == "electron-muon pairs")     currentObject = "electronMuonPairs";
306      else if(currentObject == "track-event pairs")       currentObject = "trackEventPairs";
333  
334 <      currentObject.at(0) = toupper(currentObject.at(0));
334 >      if(currentObject == "muon-muon pairs")                currentObject = "dimuonPairs";
335 >      else if(currentObject == "electron-electron pairs")   currentObject = "dielectronPairs";
336 >      else if(currentObject == "electron-muon pairs")       currentObject = "electronMuonPairs";
337 >      else if(currentObject == "electron-jet pairs")        currentObject = "electronJetPairs";
338 >      else if(currentObject == "muon-jet pairs")            currentObject = "muonJetPairs";
339 >      else if(currentObject == "track-event pairs")         currentObject = "trackEventPairs";
340 >      else if(currentObject == "electron-track pairs")      currentObject = "electronTrackPairs";        
341 >      else if(currentObject == "muon-track pairs")          currentObject = "muonTrackPairs";    
342 >      else if(currentObject == "muon-tau pairs")            currentObject = "muonTauPairs";      
343 >      else if(currentObject == "tau-tau pairs")             currentObject = "ditauPairs";
344 >      else if(currentObject == "tau-track pairs")           currentObject = "tauTrackPairs";
345 >      else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs";
346 >      else if(currentObject == "secondary muons")           currentObject = "secondaryMuons";
347 >      else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs";
348 >      else if(currentObject == "secondary electrons")           currentObject = "secondaryElectrons";
349 >
350 >      currentObject.at(0) = toupper(currentObject.at(0));  
351        string histoName = "num" + currentObject;
352  
353        if(histoName == "numPrimaryvertexs"){
# Line 329 | Line 371 | OSUAnalysis::OSUAnalysis (const edm::Par
371        cut tempCut;
372        //store input collection for cut
373        string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection");
374 +      if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs";
375 +      if(tempInputCollection == "jet-electron pairs") tempInputCollection = "electron-jet pairs";
376 +      if(tempInputCollection == "jet-muon pairs") tempInputCollection = "muon-jet pairs";
377 +      if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
378 +      if(tempInputCollection == "secondary muon-muon pairs")   tempInputCollection = "muon-secondary muon pairs";
379 +      if(tempInputCollection == "secondary electron-electron pairs")   tempInputCollection = "electron-secondary electron pairs";
380        tempCut.inputCollection = tempInputCollection;
381        if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
382 <        objectsToGet.push_back(tempInputCollection);
383 <        objectsToCut.push_back(tempInputCollection);
382 >        if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
383 >          int spaceIndex = tempInputCollection.find(" ");
384 >          int secondWordLength = tempInputCollection.size() - spaceIndex;
385 >          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
386 >        }
387 >        else{
388 >          objectsToGet.push_back(tempInputCollection);
389 >        }
390 >        objectsToCut.push_back(tempInputCollection);
391        }
392 <      else{//pair of objects, need to add them both to the things to objectsToGet
393 <        int dashIndex = tempInputCollection.find("-");
394 <        int spaceIndex = tempInputCollection.find(" ");
395 <        int secondWordLength = spaceIndex - dashIndex;
396 <        objectsToGet.push_back(tempInputCollection);
342 <        objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
343 <        objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
392 >      else{//pair of objects, need to add them both to objectsToGet
393 >        string obj1;
394 >        string obj2;
395 >        getTwoObjs(tempInputCollection, obj1, obj2);
396 >        string obj2ToGet = getObjToGet(obj2);  
397          objectsToCut.push_back(tempInputCollection);
398 <        objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s");
399 <        objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
398 >        objectsToCut.push_back(obj1);
399 >        objectsToCut.push_back(obj2);  
400 >        objectsToGet.push_back(tempInputCollection);
401 >        objectsToGet.push_back(obj1);
402 >        objectsToGet.push_back(obj2ToGet);
403  
404        }
405  
# Line 400 | Line 456 | OSUAnalysis::OSUAnalysis (const edm::Par
456        }
457        tempCut.name = tempCutName;
458  
403
459        tempChannel.cuts.push_back(tempCut);
460  
461  
407
462      }//end loop over cuts
463  
464      channels.push_back(tempChannel);
# Line 480 | Line 534 | OSUAnalysis::analyze (const edm::Event &
534    if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
535      event.getByLabel (superclusters_, superclusters);
536  
537 + #ifdef DISPLACED_SUSY
538 +  if (datasetType_ == "signalMC"){
539 +    if (std::find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end())
540 +      event.getByLabel (stops_, stops);
541 +  }
542 + #endif
543 +
544    if (useTrackCaloRhoCorr_) {  
545      // Used only for pile-up correction of by-hand calculation of isolation energy.  
546      // This rho collection is not available in all BEANs.  
# Line 494 | Line 555 | OSUAnalysis::analyze (const edm::Event &
555    if(doPileupReweighting_ && datasetType_ != "data")
556      scaleFactor = puWeight_->at (events->at (0).numTruePV);
557  
558 +  cTauScaleFactor_ = 1.0;
559 + #ifdef DISPLACED_SUSY
560 +  if (datasetType_ == "signalMC")
561 +    cTauScaleFactor_ = cTauWeight_->at (event);
562 + #endif
563 +  scaleFactor *= cTauScaleFactor_;
564  
565    //loop over all channels
566  
# Line 532 | Line 599 | OSUAnalysis::analyze (const edm::Event &
599  
600  
601          if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets");
602 +
603          else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
604 +
605 +        else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons");
606 +        else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons");
607          else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
608          else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
609          else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus");
# Line 546 | Line 617 | OSUAnalysis::analyze (const edm::Event &
617          else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters");
618  
619  
620 +
621          else if(currentObject == "muon-muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \
622                                                                     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
623                                                                     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
624                                                                     "muon-muon pairs");
625 +
626 +        else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \
627 +                                                                   cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
628 +                                                                   cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \
629 +                                                                   "muon-secondary muon pairs");
630 +
631 +        else if(currentObject == "electron-secondary electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \
632 +                                                                   cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
633 +                                                                   cumulativeFlags.at("secondary electrons").at(flagsForPairCutsIndex), \
634 +                                                                   "electron-secondary electron pairs");
635 +
636          else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \
637                                                                             cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
638                                                                             cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
# Line 558 | Line 641 | OSUAnalysis::analyze (const edm::Event &
641                                                                         cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
642                                                                         cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
643                                                                         "electron-muon pairs");
644 +        else if(currentObject == "electron-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),jets.product(), \
645 +                                                                       cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
646 +                                                                       cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \
647 +                                                                       "electron-jet pairs");
648 +        else if(currentObject == "muon-jet pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), \
649 +                                                                       cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
650 +                                                                       cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \
651 +                                                                       "muon-jet pairs");
652          else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(),
653                                                                       cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
654                                                                       cumulativeFlags.at("events").at(flagsForPairCutsIndex),
655                                                                       "track-event pairs");
656 <        
657 <
656 >        else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),
657 >                                                                        cumulativeFlags.at("electrons").at(flagsForPairCutsIndex),
658 >                                                                        cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
659 >                                                                        "electron-track pairs");
660 >        else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),
661 >                                                                    cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
662 >                                                                    cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
663 >                                                                    "muon-track pairs");
664 >        else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),
665 >                                                                  cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
666 >                                                                  cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
667 >                                                                  "muon-tau pairs");
668 >        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),
669 >                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
670 >                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
671 >                                                                 "tau-tau pairs");
672 >        else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),
673 >                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
674 >                                                                 cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
675 >                                                                 "tau-track pairs");
676 >
677 > #ifdef DISPLACED_SUSY
678 >        if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops");
679 > #endif
680        }
681  
682  
# Line 579 | Line 692 | OSUAnalysis::analyze (const edm::Event &
692      eventPassedAllCuts = eventPassedAllCuts && triggerDecision;
693  
694  
582
695      for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
696  
697        //loop over all objects and count how many passed the cumulative selection up to this point
# Line 587 | Line 699 | OSUAnalysis::analyze (const edm::Event &
699        int numberPassing = 0;
700  
701        for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){
702 <          if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
702 >        if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
703        }
592
704        bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
705        cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
595
706        eventPassedAllCuts = eventPassedAllCuts && cutDecision;
707  
708      }
709  
710 +    //     if(datasetType_ != "data") {
711 +    //       scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta);
712 +    //       scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
713 +    //     }
714 +
715      cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor);
716  
717  
# Line 613 | Line 728 | OSUAnalysis::analyze (const edm::Event &
728      }
729  
730  
616 //     if(datasetType_ != "data") {
617 //       scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta);
618 //       scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
619 //     }
620
731      //filling histograms
732      for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){
733        histogram currentHistogram = histograms.at(histogramIndex);
# Line 626 | Line 736 | OSUAnalysis::analyze (const edm::Event &
736          TH1D* histo;
737          histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name);
738  
629
630
739          if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor);
740 <         else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
740 >        else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
741 >        else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
742 >        else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor);
743          else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
744                                                                                         cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
745                                                                                         cumulativeFlags.at("muon-muon pairs").back(),scaleFactor);
746 +        else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
747 +                                                                                       cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \
748 +                                                                                       cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor);
749          else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor);
750          else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\
751                                                                                                 cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\
752                                                                                                 cumulativeFlags.at("electron-electron pairs").back(),scaleFactor);
753 +        else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \
754 +                                                                                       cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \
755 +                                                                                       cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor);
756          else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \
757 <                                                                                              cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
758 <                                                                                              cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
757 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
758 >                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
759 >        else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \
760 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(),
761 >                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
762 >        else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \
763 >                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(),
764 >                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
765 >        else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(),        
766 >                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),  
767 >                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);      
768 >        else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(),        
769 >                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),  
770 >                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);      
771 >        else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(),    
772 >                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),      
773 >                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);  
774 >        else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(),      
775 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
776 >                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
777 >        else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(),
778 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
779 >                                                                                     cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
780 >
781          else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
782          else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
783          else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
# Line 650 | Line 788 | OSUAnalysis::analyze (const edm::Event &
788          else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor);
789          else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor);
790          else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor);
791 +
792 + #ifdef DISPLACED_SUSY
793 +        if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor);
794 + #endif
795        }
796        else if(currentHistogram.inputVariables.size() == 2){
797          TH2D* histo;
798          histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name);
799  
658
659
800          if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor);
801          else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
802 +        else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
803          else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
804                                                                                         cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
805                                                                                         cumulativeFlags.at("muon-muon pairs").back(),scaleFactor);
806 +        else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
807 +                                                                                       cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \
808 +                                                                                       cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor);
809          else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor);
810 +        else if(currentHistogram.inputCollection == "secondary electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor);
811          else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \
812                                                                                                 cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \
813                                                                                                 cumulativeFlags.at("electron-electron pairs").back(),scaleFactor);
814 +        else if(currentHistogram.inputCollection == "electron-secondary electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \
815 +                                                                                       cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \
816 +                                                                                       cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor);
817          else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \
818 <                                                                                               cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
819 <                                                                                               cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
820 <        else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
818 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
819 >                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
820 >        else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \
821 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \
822 >                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
823 >        else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \
824 >                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \
825 >                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
826 >        else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(),        
827 >                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),          
828 >                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);      
829 >        else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(),        
830 >                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),          
831 >                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);      
832 >        else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(),    
833 >                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),      
834 >                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);  
835 >        else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(),      
836 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
837 >                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
838 >        else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(),
839 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
840 >                                                                                     cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
841 >        else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
842          else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
843          else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
844          else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor);
# Line 682 | Line 851 | OSUAnalysis::analyze (const edm::Event &
851          else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor);
852          else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor);
853          else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor);
854 + #ifdef DISPLACED_SUSY
855 +        else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor);
856 + #endif
857        }
858      }
859  
860 +
861 +
862      //fills histograms with the sizes of collections
863      for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
864  
# Line 693 | Line 867 | OSUAnalysis::analyze (const edm::Event &
867        string objectToPlot = "";  
868  
869        // Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis().  
870 <      if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs";
871 <      else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs";
872 <      else if(currentObject == "electron-muon pairs")     objectToPlot = "electronMuonPairs";
873 <      else if(currentObject == "track-event pairs")       objectToPlot = "trackEventPairs";  
870 >      if(currentObject == "muon-muon pairs")                         objectToPlot = "dimuonPairs";
871 >      else if(currentObject == "electron-electron pairs")            objectToPlot = "dielectronPairs";
872 >      else if(currentObject == "electron-muon pairs")                objectToPlot = "electronMuonPairs";
873 >      else if(currentObject == "electron-jet pairs")                 objectToPlot = "electronJetPairs";
874 >      else if(currentObject == "muon-jet pairs")                     objectToPlot = "muonJetPairs";
875 >      else if(currentObject == "electron-track pairs")               objectToPlot = "electronTrackPairs";
876 >      else if(currentObject == "muon-track pairs")                   objectToPlot = "muonTrackPairs";    
877 >      else if(currentObject == "muon-tau pairs")                     objectToPlot = "muonTauPairs";      
878 >      else if(currentObject == "tau-tau pairs")                      objectToPlot = "ditauPairs";
879 >      else if(currentObject == "tau-track pairs")                    objectToPlot = "tauTrackPairs";
880 >      else if(currentObject == "track-event pairs")                  objectToPlot = "trackEventPairs";  
881 >      else if(currentObject == "muon-secondary muon pairs")          objectToPlot = "muonSecondaryMuonPairs";  
882 >      else if(currentObject == "secondary muons")                    objectToPlot = "secondaryMuons";  
883 >      else if(currentObject == "electron-secondary electron pairs")  objectToPlot = "electronSecondaryElectronPairs";  
884 >      else if(currentObject == "secondary electrons")                objectToPlot = "secondaryElectrons";  
885        else objectToPlot = currentObject;
886 +
887        string tempCurrentObject = objectToPlot;
888 <      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));  // Capitalize the first letter.  
888 >      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));  
889        string histoName = "num" + tempCurrentObject;
890  
705
891        //set position of primary vertex in event, in order to calculate quantities relative to it
892        if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
893          vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back();
894 <        int numToPlot = 0;
894 >        int numToPlot = 0;
895          for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){
896            if(lastCutFlags.at(currentFlag)) numToPlot++;
897          }
# Line 720 | Line 905 | OSUAnalysis::analyze (const edm::Event &
905        }
906        else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor);
907        else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
908 +      else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
909        else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor);
910 +      else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor);
911        else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor);
912 +      else if(objectToPlot == "secondaryElectrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor);
913        else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor);
914 +      else if(objectToPlot == "electronSecondaryElectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor);
915        else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor);
916 +      else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor);
917 +      else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor);
918 +      else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor);
919        else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor);
920        else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor);
921        else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor);
# Line 737 | Line 929 | OSUAnalysis::analyze (const edm::Event &
929          oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
930          oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor);
931        }
932 + #ifdef DISPLACED_SUSY
933 +      if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(stops->size(),scaleFactor);
934 + #endif
935  
936      } // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
937  
# Line 793 | Line 988 | OSUAnalysis::splitString (string inputSt
988  
989   }
990  
991 +
992 + void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) {
993 +  // Set two object strings from the tempInputCollection string,
994 +  // For example, if tempInputCollection is "electron-muon pairs",
995 +  // then obj1 = "electrons" and obj2 = "muons".  
996 +  // Note that the objects have an "s" appended.  
997 +
998 +  int dashIndex = tempInputCollection.find("-");
999 +  int spaceIndex = tempInputCollection.find_last_of(" ");
1000 +  int secondWordLength = spaceIndex - dashIndex;
1001 +  obj1 = tempInputCollection.substr(0,dashIndex) + "s";  
1002 +  obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s";
1003 +  
1004 + }
1005 +
1006 +
1007 + string OSUAnalysis::getObjToGet(string obj) {
1008 +  // Return the string corresponding to the object to get for the given obj string.
1009 +  // Right now this only handles the case in which obj contains "secondary",
1010 +  // e.g, "secondary muons".  
1011 +  // Note that "s" is NOT appended.  
1012 +  
1013 +  if (obj.find("secondary")==std::string::npos) return obj;  // "secondary" is not found  
1014 +  int firstSpaceIndex = obj.find_first_of(" ");  
1015 +  return obj.substr(firstSpaceIndex+1,obj.length()-1);
1016 +
1017 + }  
1018 +
1019 +
1020 + //!jet valueLookup
1021   double
1022   OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){
1023  
# Line 922 | Line 1147 | OSUAnalysis::valueLookup (const BNjet* o
1147   }
1148  
1149  
1150 <
1150 > //!muon valueLookup
1151   double
1152   OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){
1153  
# Line 1089 | Line 1314 | OSUAnalysis::valueLookup (const BNmuon*
1314      if (met)
1315        {
1316          TLorentzVector p1 (object->px, object->py, object->pz, object->energy),
1317 <                       p2 (met->px, met->py, 0.0, met->pt);
1317 >          p2 (met->px, met->py, 0.0, met->pt);
1318  
1319          value = (p1 + p2).Mt ();
1320        }
# Line 1209 | Line 1434 | OSUAnalysis::valueLookup (const BNmuon*
1434      value = object->isGlobalMuon > 0                \
1435        && object->isPFMuon > 0                        \
1436        && object->normalizedChi2 < 10                \
1437 <      && object->numberOfValidMuonHits > 0        \
1437 >                                  && object->numberOfValidMuonHits > 0        \
1438        && object->numberOfMatchedStations > 1        \
1439        && fabs(object->correctedD0Vertex) < 0.2        \
1440        && fabs(object->correctedDZ) < 0.5        \
# Line 1219 | Line 1444 | OSUAnalysis::valueLookup (const BNmuon*
1444    else if(variable == "tightIDdisplaced"){
1445      value = object->isGlobalMuon > 0                \
1446        && object->normalizedChi2 < 10                \
1447 <      && object->numberOfValidMuonHits > 0        \
1447 >                                  && object->numberOfValidMuonHits > 0        \
1448        && object->numberOfMatchedStations > 1        \
1449        && object->numberOfValidPixelHits > 0        \
1450        && object->numberOfLayersWithMeasurement > 5;
# Line 1246 | Line 1471 | OSUAnalysis::valueLookup (const BNmuon*
1471    else if(variable == "genMatchedMotherIdReverse"){
1472      int index = getGenMatchedParticleIndex(object);
1473      if(index == -1) value = 23;
1474 <    else value = 23 -getPdgIdBinValue(mcparticles->at(index).motherId);
1474 >    else value = 23 - getPdgIdBinValue(mcparticles->at(index).motherId);
1475    }
1476    else if(variable == "genMatchedGrandmotherId"){
1477      int index = getGenMatchedParticleIndex(object);
# Line 1258 | Line 1483 | OSUAnalysis::valueLookup (const BNmuon*
1483      }
1484      else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1485    }
1486 +  else if(variable == "genMatchedGrandmotherIdReverse"){
1487 +    int index = getGenMatchedParticleIndex(object);
1488 +    if(index == -1) value = 23;
1489 +    else if(fabs(mcparticles->at(index).motherId) == 15){
1490 +      int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1491 +      if(motherIndex == -1) value = 23;
1492 +      else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1493 +    }
1494 +    else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1495 +  }
1496  
1497  
1498  
# Line 1268 | Line 1503 | OSUAnalysis::valueLookup (const BNmuon*
1503    return value;
1504   }
1505  
1506 <
1506 > //!electron valueLookup
1507   double
1508   OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){
1509  
# Line 1440 | Line 1675 | OSUAnalysis::valueLookup (const BNelectr
1675      if (met)
1676        {
1677          TLorentzVector p1 (object->px, object->py, object->pz, object->energy),
1678 <                       p2 (met->px, met->py, 0.0, met->pt);
1678 >          p2 (met->px, met->py, 0.0, met->pt);
1679  
1680          value = (p1 + p2).Mt ();
1681        }
# Line 1641 | Line 1876 | OSUAnalysis::valueLookup (const BNelectr
1876      }
1877      else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1878    }
1879 +  else if(variable == "genMatchedGrandmotherIdReverse"){
1880 +    int index = getGenMatchedParticleIndex(object);
1881 +    if(index == -1) value = 23;
1882 +    else if(fabs(mcparticles->at(index).motherId) == 15){
1883 +      int motherIndex = findTauMotherIndex(&mcparticles->at(index));
1884 +      if(motherIndex == -1) value = 23;
1885 +      else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
1886 +    }
1887 +    else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId);
1888 +  }
1889  
1890  
1891  
# Line 1651 | Line 1896 | OSUAnalysis::valueLookup (const BNelectr
1896    return value;
1897   }
1898  
1899 <
1899 > //!event valueLookup
1900   double
1901   OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){
1902  
# Line 1730 | Line 1975 | OSUAnalysis::valueLookup (const BNevent*
1975    else if(variable == "muonScaleFactor"){
1976      if(datasetType_ != "data")
1977        //      value = muonSFWeight_->at (chosenMuon ()->eta);
1978 <    value = 1.0;
1978 >      value = 1.0;
1979      else
1980        value = 1.0;
1981    }
1982    else if(variable == "electronScaleFactor"){
1983      if(datasetType_ != "data")
1984        //      value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
1985 <    value = 1.0;
1985 >      value = 1.0;
1986      else
1987        value = 1.0;
1988    }
1989 +  else if(variable == "cTauScaleFactor")
1990 +    value = cTauScaleFactor_;
1991  
1992    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1993  
# Line 1749 | Line 1996 | OSUAnalysis::valueLookup (const BNevent*
1996    return value;
1997   }
1998  
1999 + //!tau valueLookup
2000   double
2001   OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){
2002  
# Line 1829 | Line 2077 | OSUAnalysis::valueLookup (const BNtau* o
2077      }
2078      else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2079    }
2080 +  else if(variable == "genMatchedGrandmotherIdReverse"){
2081 +    int index = getGenMatchedParticleIndex(object);
2082 +    if(index == -1) value = 23;
2083 +    else if(fabs(mcparticles->at(index).motherId) == 15){
2084 +      int motherIndex = findTauMotherIndex(&mcparticles->at(index));
2085 +      if(motherIndex == -1) value = 23;
2086 +      else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
2087 +    }
2088 +    else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2089 +  }
2090  
2091  
2092    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
# Line 1838 | Line 2096 | OSUAnalysis::valueLookup (const BNtau* o
2096    return value;
2097   }
2098  
2099 + //!met valueLookup
2100   double
2101   OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){
2102  
# Line 1910 | Line 2169 | OSUAnalysis::valueLookup (const BNmet* o
2169    return value;
2170   }
2171  
2172 + //!track valueLookup
2173   double
2174   OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){
2175  
# Line 1937 | Line 2197 | OSUAnalysis::valueLookup (const BNtrack*
2197  
2198  
2199    //additional BNs info for disappTrks
1940  else if(variable == "isGoodPtResolution") value = object->isGoodPtResolution;
2200    else if(variable == "caloEMDeltaRp3") value = object->caloEMDeltaRp3;
2201    else if(variable == "caloHadDeltaRp3") value = object->caloHadDeltaRp3;
2202    else if(variable == "caloEMDeltaRp4") value = object->caloEMDeltaRp4;
# Line 1954 | Line 2213 | OSUAnalysis::valueLookup (const BNtrack*
2213    else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz;
2214    else if(variable == "caloTotDeltaRp5")            value =  (object->caloHadDeltaRp5 + object->caloEMDeltaRp5);
2215    else if(variable == "caloTotDeltaRp5ByP")         value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag);
2216 <  else if(variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object);  
2217 <  else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag;  
2216 >  else if(variable == "caloTotDeltaRp5RhoCorr")     value = getTrkCaloTotRhoCorr(object);  
2217 >  else if(variable == "caloTotDeltaRp5ByPRhoCorr")  value = getTrkCaloTotRhoCorr(object) / pMag;  
2218    else if(variable == "isIso")                      value = getTrkIsIso(object, tracks.product());
2219    else if(variable == "isMatchedDeadEcal")          value = getTrkIsMatchedDeadEcal(object);
2220    else if(variable == "ptErrorByPt")                value = (object->ptError/object->pt);
2221    else if(variable == "ptError")                    value = object->ptError;
2222    else if(variable == "ptRes")                      value = getTrkPtRes(object);
2223 <
2223 >  else if (variable == "d0wrtPV"){      
2224 >    double vx = object->vx - chosenVertex ()->x,        
2225 >      vy = object->vy - chosenVertex ()->y,      
2226 >      px = object->px,  
2227 >      py = object->py,  
2228 >      pt = object->pt;  
2229 >    value = (-vx * py + vy * px) / pt;  
2230 >  }      
2231 >  else if (variable == "dZwrtPV"){      
2232 >    double vx = object->vx - chosenVertex ()->x,        
2233 >      vy = object->vy - chosenVertex ()->y,      
2234 >      vz = object->vz - chosenVertex ()->z,      
2235 >      px = object->px,  
2236 >      py = object->py,  
2237 >      pz = object->pz,  
2238 >      pt = object->pt;  
2239 >    value = vz - (vx * px + vy * py)/pt * (pz/pt);      
2240 >  }    
2241    else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2242  
2243    else if(variable == "genMatchedPdgId"){
# Line 1996 | Line 2272 | OSUAnalysis::valueLookup (const BNtrack*
2272      }
2273      else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2274    }
2275 +  else if(variable == "genMatchedGrandmotherIdReverse"){
2276 +    int index = getGenMatchedParticleIndex(object);
2277 +    if(index == -1) value = 23;
2278 +    else if(fabs(mcparticles->at(index).motherId) == 15){
2279 +      int motherIndex = findTauMotherIndex(&mcparticles->at(index));
2280 +      if(motherIndex == -1) value = 23;
2281 +      else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
2282 +    }
2283 +    else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2284 +  }
2285  
2286  
2287  
# Line 2006 | Line 2292 | OSUAnalysis::valueLookup (const BNtrack*
2292    return value;
2293   }
2294  
2295 + //!genjet valueLookup
2296   double
2297   OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){
2298  
# Line 2034 | Line 2321 | OSUAnalysis::valueLookup (const BNgenjet
2321    return value;
2322   }
2323  
2324 + //!mcparticle valueLookup
2325   double
2326   OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){
2327  
# Line 2167 | Line 2455 | OSUAnalysis::valueLookup (const BNmcpart
2455    return value;
2456   }
2457  
2458 + //!primaryvertex valueLookup
2459   double
2460   OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){
2461  
# Line 2194 | Line 2483 | OSUAnalysis::valueLookup (const BNprimar
2483    return value;
2484   }
2485  
2486 + //!bxlumi valueLookup
2487   double
2488   OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){
2489  
# Line 2211 | Line 2501 | OSUAnalysis::valueLookup (const BNbxlumi
2501    return value;
2502   }
2503  
2504 + //!photon valueLookup
2505   double
2506   OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){
2507  
# Line 2324 | Line 2615 | OSUAnalysis::valueLookup (const BNphoton
2615      }
2616      else value = getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2617    }
2618 +  else if(variable == "genMatchedGrandmotherIdReverse"){
2619 +    int index = getGenMatchedParticleIndex(object);
2620 +    if(index == -1) value = 23;
2621 +    else if(fabs(mcparticles->at(index).motherId) == 15){
2622 +      int motherIndex = findTauMotherIndex(&mcparticles->at(index));
2623 +      if(motherIndex == -1) value = 23;
2624 +      else value = 23 - getPdgIdBinValue(mcparticles->at(motherIndex).motherId);
2625 +    }
2626 +    else value = 23 - getPdgIdBinValue(mcparticles->at(index).grandMotherId);
2627 +  }
2628  
2629  
2630    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
# Line 2333 | Line 2634 | OSUAnalysis::valueLookup (const BNphoton
2634    return value;
2635   }
2636  
2637 + //!supercluster valueLookup
2638   double
2639   OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){
2640  
# Line 2355 | Line 2657 | OSUAnalysis::valueLookup (const BNsuperc
2657    return value;
2658   }
2659  
2660 <
2660 > //!muon-muon pair valueLookup
2661   double
2662   OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){
2663  
2664    double value = 0.0;
2665  
2666    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2667 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2668    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2669    else if(variable == "invMass"){
2670      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2403 | Line 2706 | OSUAnalysis::valueLookup (const BNmuon*
2706    else if(variable == "muon2CorrectedD0Vertex"){
2707      value = object2->correctedD0Vertex;
2708    }
2709 < else if(variable == "muon1timeAtIpInOut"){
2709 >  else if(variable == "muon1timeAtIpInOut"){
2710      value = object1->timeAtIpInOut;
2711    }
2712 < else if(variable == "muon2timeAtIpInOut"){
2712 >  else if(variable == "muon2timeAtIpInOut"){
2713      value = object2->timeAtIpInOut;
2714    }
2715 < else if(variable == "muon1correctedD0")
2716 <   {
2717 <     value = object1->correctedD0;
2718 <   }
2719 < else if(variable == "muon2correctedD0")
2720 <   {
2721 <     value = object2->correctedD0;
2722 <   }
2715 >  else if(variable == "muon1correctedD0")
2716 >    {
2717 >      value = object1->correctedD0;
2718 >    }
2719 >  else if(variable == "muon2correctedD0")
2720 >    {
2721 >      value = object2->correctedD0;
2722 >    }
2723  
2724    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2725  
# Line 2425 | Line 2728 | OSUAnalysis::valueLookup (const BNmuon*
2728    return value;
2729   }
2730  
2731 + //!electron-electron pair valueLookup
2732   double
2733   OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){
2734  
2735    double value = 0.0;
2736  
2737    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2738 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2739    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2740    else if(variable == "invMass"){
2741      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2479 | Line 2784 | OSUAnalysis::valueLookup (const BNelectr
2784    return value;
2785   }
2786  
2787 + //!electron-muon pair valueLookup
2788   double
2789   OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){
2790  
2791    double value = 0.0;
2792  
2793    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2794 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2795    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2796    else if(variable == "invMass"){
2797      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2531 | Line 2838 | OSUAnalysis::valueLookup (const BNelectr
2838    else if(variable == "muonDetIso"){
2839      value = (object2->trackIsoDR03) / object2->pt;
2840    }
2841 +  else if(variable == "electronRelPFrhoIso"){
2842 +    value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt;
2843 +  }
2844 +  else if(variable == "muonRelPFdBetaIso"){
2845 +    value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt;
2846 +  }
2847 +
2848 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2849 +
2850 +  value = applyFunction(function, value);
2851  
2852 +  return value;
2853 + }
2854 +
2855 + //!electron-jet pair valueLookup
2856 + double
2857 + OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function){
2858 +
2859 +  double value = 0.0;
2860 +
2861 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2862 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2863 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2864 +  else if(variable == "invMass"){
2865 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2866 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2867 +    value = (fourVector1 + fourVector2).M();
2868 +  }
2869 +  else if(variable == "pt"){
2870 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2871 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2872 +    value = (fourVector1 + fourVector2).Pt();
2873 +  }
2874 +  else if(variable == "threeDAngle")
2875 +    {
2876 +      TVector3 threeVector1(object1->px, object1->py, object1->pz);
2877 +      TVector3 threeVector2(object2->px, object2->py, object2->pz);
2878 +      value = (threeVector1.Angle(threeVector2));
2879 +    }
2880 +  else if(variable == "chargeProduct"){
2881 +    value = object1->charge*object2->charge;
2882 +  }
2883  
2884    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2885  
# Line 2540 | Line 2888 | OSUAnalysis::valueLookup (const BNelectr
2888    return value;
2889   }
2890  
2891 + //!muon-jet pair valueLookup
2892 + double
2893 + OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function){
2894  
2895 +  double value = 0.0;
2896 +
2897 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2898 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2899 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2900 +  else if(variable == "invMass"){
2901 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2902 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2903 +    value = (fourVector1 + fourVector2).M();
2904 +  }
2905 +  else if(variable == "pt"){
2906 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2907 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2908 +    value = (fourVector1 + fourVector2).Pt();
2909 +  }
2910 +  else if(variable == "threeDAngle")
2911 +    {
2912 +      TVector3 threeVector1(object1->px, object1->py, object1->pz);
2913 +      TVector3 threeVector2(object2->px, object2->py, object2->pz);
2914 +      value = (threeVector1.Angle(threeVector2));
2915 +    }
2916 +  else if(variable == "chargeProduct"){
2917 +    value = object1->charge*object2->charge;
2918 +  }
2919 +
2920 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2921 +
2922 +  value = applyFunction(function, value);
2923 +
2924 +  return value;
2925 + }
2926 +
2927 + //!electron-track pair valueLookup
2928 + double  
2929 + OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){  
2930 +  double electronMass = 0.000511;        
2931 +  double value = 0.0;    
2932 +  TLorentzVector fourVector1(0, 0, 0, 0);        
2933 +  TLorentzVector fourVector2(0, 0, 0, 0);        
2934 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));  
2935 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2936 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);    
2937 +  else if(variable == "invMass"){        
2938 +    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);    
2939 +    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass );    
2940 +        
2941 +    value = (fourVector1 + fourVector2).M();    
2942 +  }
2943 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}  
2944 +  value = applyFunction(function, value);        
2945 +  return value;  
2946 + }
2947 +
2948 +
2949 + //!muon-track pair valueLookup
2950 + double
2951 + OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){
2952 +  double pionMass = 0.140;
2953 +  double muonMass = 0.106;
2954 +  double value = 0.0;
2955 +  TLorentzVector fourVector1(0, 0, 0, 0);
2956 +  TLorentzVector fourVector2(0, 0, 0, 0);
2957 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2958 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2959 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2960 +  else if(variable == "invMass"){
2961 +    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass);
2962 +    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass );
2963 +
2964 +    value = (fourVector1 + fourVector2).M();
2965 +  }
2966 +
2967 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2968 +  value = applyFunction(function, value);
2969 +  return value;
2970 + }
2971 +
2972 + //!tau-tau pair valueLookup
2973 + double
2974 + OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){
2975 +  double value = 0.0;
2976 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2977 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2978 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2979 +  else if(variable == "invMass"){
2980 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2981 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2982 +    value = (fourVector1 + fourVector2).M();
2983 +  }
2984 +
2985 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2986 +  value = applyFunction(function, value);
2987 +  return value;
2988 + }
2989 +
2990 + //!muon-tau pair valueLookup
2991 + double
2992 + OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){
2993 +  double value = 0.0;
2994 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2995 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2996 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2997 +  else if(variable == "invMass"){
2998 +    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2999 +    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
3000 +    value = (fourVector1 + fourVector2).M();
3001 +  }
3002 +
3003 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3004 +  value = applyFunction(function, value);
3005 +  return value;
3006 + }
3007 +
3008 + //!tau-track pair valueLookup
3009 + double
3010 + OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){
3011 +  double value = 0.0;
3012 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3013 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3014 +
3015 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3016 +  value = applyFunction(function, value);
3017 +  return value;
3018 + }
3019  
3020  
3021 + //!track-event pair valueLookup
3022   double
3023   OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){
3024  
# Line 2562 | Line 3038 | OSUAnalysis::valueLookup (const BNtrack*
3038  
3039    return value;
3040  
3041 + }
3042 +
3043 + //!stop valueLookup
3044 + double
3045 + OSUAnalysis::valueLookup (const BNstop* object, string variable, string function){
3046 +
3047 +
3048 +  double value = 0.0;
3049 +
3050 +  if(variable == "ctau") value = object->ctau;
3051 +
3052 +  else if (variable == "d0"){
3053 +    double vx = object->vx - chosenVertex ()->x,
3054 +      vy = object->vy - chosenVertex ()->y,
3055 +      px = object->px,
3056 +      py = object->py,
3057 +      pt = object->pt;
3058 +    value = (-vx * py + vy * px) / pt;
3059 +  }
3060 +
3061 +  else if (variable == "dz"){
3062 +    double vx = object->vx - chosenVertex ()->x,
3063 +      vy = object->vy - chosenVertex ()->y,
3064 +      vz = object->vz - chosenVertex ()->z,
3065 +      px = object->px,
3066 +      py = object->py,
3067 +      pz = object->pz,
3068 +      pt = object->pt;
3069 +    value = vz - (vx * px + vy * py)/pt * (pz/pt);
3070 +  }
3071 +
3072 +  else if (variable == "minD0"){
3073 +    double minD0=999;
3074 +    for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3075 +      double vx = object->vx - vertex->x,
3076 +        vy = object->vy - vertex->y,
3077 +        px = object->px,
3078 +        py = object->py,
3079 +        pt = object->pt;
3080 +      value = (-vx * py + vy * px) / pt;
3081 +      if(abs(value) < abs(minD0)) minD0 = value;
3082 +    }
3083 +    value = minD0;
3084 +  }
3085 +  else if (variable == "minDz"){
3086 +    double minDz=999;
3087 +    for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3088 +      double vx = object->vx - vertex->x,
3089 +        vy = object->vy - vertex->y,
3090 +        vz = object->vz - vertex->z,
3091 +        px = object->px,
3092 +        py = object->py,
3093 +        pz = object->pz,
3094 +        pt = object->pt;
3095 +      value = vz - (vx * px + vy * py)/pt * (pz/pt);
3096 +      if(abs(value) < abs(minDz)) minDz = value;
3097 +    }
3098 +    value = minDz;
3099 +  }
3100 +  else if(variable == "distToVertex"){
3101 +    value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \
3102 +                 (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3103 +                 (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3104 +  }
3105 +  else if (variable == "minDistToVertex"){
3106 +    double minDistToVertex=999;
3107 +    for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3108 +      value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3109 +                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3110 +                   (object->vz-vertex->z)*(object->vz-vertex->z));
3111 +      
3112 +      if(abs(value) < abs(minDistToVertex)) minDistToVertex = value;
3113 +    }
3114 +    value = minDistToVertex;
3115 +  }
3116 +  else if (variable == "distToVertexDifference"){
3117 +    double minDistToVertex=999;
3118 +    for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3119 +      value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3120 +                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3121 +                   (object->vz-vertex->z)*(object->vz-vertex->z));
3122 +      
3123 +      if(abs(value) < abs(minDistToVertex)) minDistToVertex = value;
3124 +    }
3125 +    double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \
3126 +                                     (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3127 +                                     (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3128 +
3129 +    value = distToChosenVertex - minDistToVertex;
3130 +  }
3131 +
3132 +  else if (variable == "closestVertexRank"){
3133 +    double minDistToVertex=999;
3134 +    int vertex_rank = 0;
3135 +    for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3136 +      vertex_rank++;
3137 +      int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3138 +                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3139 +                   (object->vz-vertex->z)*(object->vz-vertex->z));
3140 +      
3141 +      if(abs(dist) < abs(minDistToVertex)){
3142 +        value = vertex_rank;
3143 +        minDistToVertex = dist;
3144 +      }
3145 +    }
3146 +  }
3147 +
3148 +
3149 +
3150 +
3151 +  else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3152 +
3153 +  value = applyFunction(function, value);
3154 +
3155 +  return value;
3156 +
3157   }  
3158  
3159 +
3160 +
3161 +
3162   // Calculate the number of tracks in cone of DeltaR<0.5 around track1.
3163   // Return true iff no other tracks are found in this cone.
3164   int
# Line 2678 | Line 3273 | double OSUAnalysis::getGenDeltaRLowest(I
3273    for(BNmcparticleCollection::const_iterator mcparticle = mcparticles->begin (); mcparticle != mcparticles->end (); mcparticle++){
3274      double deltaRtemp = deltaR(mcparticle->eta, mcparticle->phi, object->eta, object->phi);
3275      if (deltaRtemp < genDeltaRLowest) genDeltaRLowest = deltaRtemp;
3276 < }
3276 >  }
3277    return genDeltaRLowest;
3278   }
3279  
# Line 2700 | Line 3295 | OSUAnalysis::applyFunction(string functi
3295  
3296   template <class InputCollection>
3297   void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
3298 <
3298 >
3299 >  if (currentCut.inputCollection.find("pair")!=std::string::npos)  {
3300 >    string obj1, obj2;
3301 >    getTwoObjs(currentCut.inputCollection, obj1, obj2);
3302 >    if (inputType==obj1 ||
3303 >        inputType==obj2) {
3304 >      // Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection,
3305 >      // and the inputType is a member of the pair.  
3306 >      // The cut will instead be applied when the setObjectFlags() is called for the paired collection.  
3307 >      // For example, if currentCut.inputCollection==electron-muon pairs,
3308 >      // then the flags should not be set here when inputType==muons or inputType==electrons.  
3309 >      return;
3310 >    }  
3311 >  }    
3312  
3313    for (uint object = 0; object != inputCollection->size(); object++){
3314  
2707
3315      bool decision = true;//object passes if this cut doesn't cut on that type of object
3316  
2710
3317      if(currentCut.inputCollection == inputType){
3318  
3319        vector<bool> subcutDecisions;
3320        for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){
3321          double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex));
3322          subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
3323 +
3324        }
3325        if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0);
3326        else{
# Line 2727 | Line 3334 | void OSUAnalysis::setObjectFlags(cut &cu
3334          decision = tempDecision;
3335        }
3336      }
2730    individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
3337  
3338 +    individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
3339  
3340      //set flags for objects that pass each cut AND all the previous cuts
3341      bool previousCumulativeFlag = true;
# Line 2738 | Line 3345 | void OSUAnalysis::setObjectFlags(cut &cu
3345      }
3346      cumulativeFlags.at(inputType).at(currentCutIndex).push_back(previousCumulativeFlag && decision);
3347  
2741
3348    }
3349  
3350   }
# Line 2752 | Line 3358 | void OSUAnalysis::setObjectFlags(cut &cu
3358    bool sameObjects = false;
3359    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3360  
3361 <
3361 >  // Get the strings for the two objects that make up the pair.  
3362 >  string obj1Type, obj2Type;
3363 >  getTwoObjs(inputType, obj1Type, obj2Type);
3364 >  bool isTwoTypesOfObject = true;
3365 >  if (obj1Type==obj2Type) isTwoTypesOfObject = false;  
3366 >
3367 >  // Initialize the flags for individual objects to all be false, if the cut is on the pair.  
3368 >  // Set them to true later, if any paired object passes (in which case both of its constituents should pass).  
3369 >  if (currentCut.inputCollection == inputType) {    
3370 >    for (uint object1 = 0; object1 != inputCollection1->size(); object1++) {
3371 >      individualFlags.at(obj1Type).at(currentCutIndex).push_back(false);
3372 >      cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false);
3373 >    }
3374 >    if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first.  
3375 >      for (uint object2 = 0; object2 != inputCollection2->size(); object2++)  {
3376 >        individualFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3377 >        cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3378 >      }
3379 >    }
3380 >  }
3381 >  
3382    int counter = 0;
3383 +
3384    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3385      for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3386  
# Line 2782 | Line 3409 | void OSUAnalysis::setObjectFlags(cut &cu
3409            decision = tempDecision;
3410          }
3411        }
3412 <      individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
3412 >      // if (decision) isPassObj1.at(object1) = true;
3413 >      // if (decision) isPassObj2.at(object2) = true;
3414 >      individualFlags.at(inputType).at(currentCutIndex).push_back(decision);  
3415 >      if (decision && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on  
3416 >        individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true;  
3417 >        individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true;  
3418 >      }  
3419  
3420        //set flags for objects that pass each cut AND all the previous cuts
3421        bool previousCumulativeFlag = true;
# Line 2797 | Line 3430 | void OSUAnalysis::setObjectFlags(cut &cu
3430        else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1);
3431        else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2);
3432        cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag);
3433 <
3433 >      if (currentCumulativeFlag && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on  
3434 >        cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1);  
3435 >        cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2);  
3436 >      }
3437        counter++;
2802    }
2803
2804  }
3438  
3439 +    } // end   for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3440 +  }  // end   for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3441  
3442   }
3443  
3444  
3445 + bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) {
3446 +  // Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for
3447 +  // all cuts up to currentCutIndex  
3448 +  bool previousCumulativeFlag = true;  
3449 +  for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) {  
3450 +    if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true;
3451 +    else {  
3452 +      previousCumulativeFlag = false; break;  
3453 +    }
3454 +  }
3455 +  return previousCumulativeFlag;  
3456 + }  
3457 +
3458 +
3459   template <class InputCollection>
3460   void OSUAnalysis::fill1DHistogram(TH1* histo, histogram parameters, InputCollection inputCollection,vector<bool> flags, double scaleFactor){
3461  
# Line 2843 | Line 3492 | void OSUAnalysis::fill1DHistogram(TH1* h
3492    bool sameObjects = false;
3493    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3494  
3495 <  int pairCounter = 0;
3495 >  int pairCounter = -1;
3496    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3497      for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3498  
3499        if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
3500  
3501 +      pairCounter++;
3502        //only take objects which have passed all cuts and pairs which have passed all cuts
3503        if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
3504        if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
# Line 2869 | Line 3519 | void OSUAnalysis::fill1DHistogram(TH1* h
3519        double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
3520        histo->Fill(value,scaleFactor);
3521  
2872      pairCounter++;
3522      }
3523    }
3524  
# Line 2922 | Line 3571 | void OSUAnalysis::fill2DHistogram(TH2* h
3571    bool sameObjects = false;
3572    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3573  
3574 <  int pairCounter = 0;
3574 >  int pairCounter = -1;
3575    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3576      for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3577  
3578        if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
3579  
3580 +      pairCounter++;
3581 +
3582        //only take objects which have passed all cuts and pairs which have passed all cuts
3583        if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
3584        if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
# Line 2962 | Line 3613 | void OSUAnalysis::fill2DHistogram(TH2* h
3613  
3614        histo->Fill(valueX,valueY,scaleFactor);
3615  
2965      pairCounter++;
2966
3616      }
3617    }
3618  
# Line 2980 | Line 3629 | int OSUAnalysis::getGenMatchedParticleIn
3629  
3630      double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi);
3631      if(currentDeltaR > 0.05) continue;
3632 < //     cout << std::setprecision(3) << std::setw(20)
3633 < //          << "\tcurrentParticle:  eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta
3634 < //          << std::setw(20)
3635 < //          << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi
3636 < //          << std::setw(20)
3637 < //          << "\tdeltaR = " << currentDeltaR
3638 < //          << std::setprecision(1)
3639 < //          << std::setw(20)
3640 < //          << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id
3641 < //          << std::setw(20)
3642 < //          << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId
3643 < //          << std::setw(20)
3644 < //          << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl;
3632 >    //     cout << std::setprecision(3) << std::setw(20)
3633 >    //          << "\tcurrentParticle:  eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta
3634 >    //          << std::setw(20)
3635 >    //          << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi
3636 >    //          << std::setw(20)
3637 >    //          << "\tdeltaR = " << currentDeltaR
3638 >    //          << std::setprecision(1)
3639 >    //          << std::setw(20)
3640 >    //          << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id
3641 >    //          << std::setw(20)
3642 >    //          << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId
3643 >    //          << std::setw(20)
3644 >    //          << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl;
3645      if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){
3646        bestMatchIndex = mcparticle - mcparticles->begin();
3647        bestMatchDeltaR = currentDeltaR;
3648      }
3649  
3650    }
3651 < //   if(bestMatchDeltaR != 999)  cout << "bestMatch:  deltaR = " << bestMatchDeltaR << "   id = " << mcparticles->at(bestMatchIndex).id << "   motherId = " << mcparticles->at(bestMatchIndex).motherId << endl;
3652 < //   else cout << "no match found..." << endl;
3651 >  //   if(bestMatchDeltaR != 999)  cout << "bestMatch:  deltaR = " << bestMatchDeltaR << "   id = " << mcparticles->at(bestMatchIndex).id << "   motherId = " << mcparticles->at(bestMatchIndex).motherId << endl;
3652 >  //   else cout << "no match found..." << endl;
3653    return bestMatchIndex;
3654  
3655   }
# Line 3091 | Line 3740 | OSUAnalysis::chosenVertex ()
3740    const BNprimaryvertex *chosenVertex = 0;
3741    if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) {
3742      vector<bool> vertexFlags = cumulativeFlags.at("primaryvertexs").back().size() ? cumulativeFlags.at("primaryvertexs").back() :
3743 <                               cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2);
3743 >      cumulativeFlags.at("primaryvertexs").at(cumulativeFlags.at("primaryvertexs").size() - 2);
3744      for (uint vertexIndex = 0; vertexIndex != vertexFlags.size(); vertexIndex++){
3745        if(!vertexFlags.at(vertexIndex)) continue;
3746        chosenVertex = & primaryvertexs->at(vertexIndex);
# Line 3111 | Line 3760 | OSUAnalysis::chosenMET ()
3760    const BNmet *chosenMET = 0;
3761    if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) {
3762      vector<bool> metFlags = cumulativeFlags.at("mets").back().size() ? cumulativeFlags.at("mets").back() :
3763 <                            cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2);
3763 >      cumulativeFlags.at("mets").at(cumulativeFlags.at("mets").size() - 2);
3764      for (uint metIndex = 0; metIndex != metFlags.size(); metIndex++){
3765        if(!metFlags.at(metIndex)) continue;
3766        chosenMET = & mets->at(metIndex);
# Line 3131 | Line 3780 | OSUAnalysis::chosenElectron ()
3780    const BNelectron *chosenElectron = 0;
3781    if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) {
3782      vector<bool> electronFlags = cumulativeFlags.at("electrons").back().size() ? cumulativeFlags.at("electrons").back() :
3783 <                                 cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2);
3783 >      cumulativeFlags.at("electrons").at(cumulativeFlags.at("electrons").size() - 2);
3784      for (uint electronIndex = 0; electronIndex != electronFlags.size(); electronIndex++){
3785        if(!electronFlags.at(electronIndex)) continue;
3786        chosenElectron = & electrons->at(electronIndex);
# Line 3151 | Line 3800 | OSUAnalysis::chosenMuon ()
3800    const BNmuon *chosenMuon = 0;
3801    if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) {
3802      vector<bool> muonFlags = cumulativeFlags.at("muons").back().size() ? cumulativeFlags.at("muons").back() :
3803 <                             cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2);
3803 >      cumulativeFlags.at("muons").at(cumulativeFlags.at("muons").size() - 2);
3804      for (uint muonIndex = 0; muonIndex != muonFlags.size(); muonIndex++){
3805        if(!muonFlags.at(muonIndex)) continue;
3806        chosenMuon = & muons->at(muonIndex);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines