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.56 by ahart, Sun May 5 23:41:30 2013 UTC vs.
Revision 1.57 by ahart, Tue May 7 02:41:34 2013 UTC

# Line 17 | Line 17 | OSUAnalysis::OSUAnalysis (const edm::Par
17    photons_ (cfg.getParameter<edm::InputTag> ("photons")),
18    superclusters_ (cfg.getParameter<edm::InputTag> ("superclusters")),
19    triggers_ (cfg.getParameter<edm::InputTag> ("triggers")),
20 <  puFile_ (cfg.getParameter<std::string> ("puFile")),
21 <  deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")),
22 <  muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")),
23 <  dataPU_ (cfg.getParameter<std::string> ("dataPU")),
24 <  electronSFID_ (cfg.getParameter<std::string> ("electronSFID")),
25 <  muonSF_ (cfg.getParameter<std::string> ("muonSF")),
26 <  dataset_ (cfg.getParameter<std::string> ("dataset")),
27 <  datasetType_ (cfg.getParameter<std::string> ("datasetType")),
20 >  trigobjs_ (cfg.getParameter<edm::InputTag> ("trigobjs")),
21 >  puFile_ (cfg.getParameter<string> ("puFile")),
22 >  deadEcalFile_ (cfg.getParameter<string> ("deadEcalFile")),
23 >  muonSFFile_ (cfg.getParameter<string> ("muonSFFile")),
24 >  dataPU_ (cfg.getParameter<string> ("dataPU")),
25 >  electronSFID_ (cfg.getParameter<string> ("electronSFID")),
26 >  muonSF_ (cfg.getParameter<string> ("muonSF")),
27 >  dataset_ (cfg.getParameter<string> ("dataset")),
28 >  datasetType_ (cfg.getParameter<string> ("datasetType")),
29    channels_  (cfg.getParameter<vector<edm::ParameterSet> >("channels")),
30    histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")),
31    plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")),
32    doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")),
33    applyLeptonSF_ (cfg.getParameter<bool> ("applyLeptonSF")),
34 <  printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")),
34 >  printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")),
35    useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")),
36    stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau"))
37  
# Line 53 | Line 54 | OSUAnalysis::OSUAnalysis (const edm::Par
54    // Construct Cutflow Objects. These store the results of cut decisions and
55    // handle filling cut flow histograms.
56    masterCutFlow_ = new CutFlow (fs_);
57 <  std::vector<TFileDirectory> directories;
57 >  vector<TFileDirectory> directories;
58  
59    //always get vertex collection so we can assign the primary vertex in the event
60    objectsToGet.push_back("primaryvertexs");
# Line 77 | Line 78 | OSUAnalysis::OSUAnalysis (const edm::Par
78      if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
79      if(tempInputCollection == "secondary muon-muon pairs")   tempInputCollection = "muon-secondary muon pairs";
80      if(tempInputCollection == "secondary electron-electron pairs")   tempInputCollection = "electron-secondary electron pairs";
81 <    if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
82 <      if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
83 <        int spaceIndex = tempInputCollection.find(" ");
84 <        int secondWordLength = tempInputCollection.size() - spaceIndex;
85 <        objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
81 >    if(tempInputCollection == "trigobj-electron pairs")   tempInputCollection = "electron-trigobj pairs";
82 >    if(tempInputCollection == "trigobj-muon pairs")   tempInputCollection = "muon-trigobj pairs";
83 >    if(tempInputCollection.find("pairs")==string::npos){ //just a single object
84 >      if(tempInputCollection.find("secondary")!=string::npos){//secondary object
85 >        int spaceIndex = tempInputCollection.find(" ");
86 >        int secondWordLength = tempInputCollection.size() - spaceIndex;
87 >        objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
88        }
89        else{
90 <        objectsToGet.push_back(tempInputCollection);
90 >        objectsToGet.push_back(tempInputCollection);
91        }
92        objectsToPlot.push_back(tempInputCollection);
93        objectsToCut.push_back(tempInputCollection);
94      }
95      else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut
96 <      string obj1;
96 >      string obj1;
97        string obj2;
98        getTwoObjs(tempInputCollection, obj1, obj2);
99 <      string obj2ToGet = getObjToGet(obj2);  
99 >      string obj2ToGet = getObjToGet(obj2);
100        objectsToCut.push_back(tempInputCollection);
101        objectsToCut.push_back(obj1);
102 <      objectsToCut.push_back(obj2);  
102 >      objectsToCut.push_back(obj2);
103        objectsToPlot.push_back(tempInputCollection);
104        objectsToPlot.push_back(obj1);
105 <      objectsToPlot.push_back(obj2);  
105 >      objectsToPlot.push_back(obj2);
106        objectsToGet.push_back(tempInputCollection);
107        objectsToGet.push_back(obj1);
108        objectsToGet.push_back(obj2ToGet);
# Line 228 | Line 231 | OSUAnalysis::OSUAnalysis (const edm::Par
231      TFileDirectory subDir = fs_->mkdir( channelName );
232      directories.push_back(subDir);
233  
234 <    std::map<std::string, TH1D*> oneDhistoMap;
234 >    map<string, TH1D*> oneDhistoMap;
235      oneDHists_.push_back(oneDhistoMap);
236 <    std::map<std::string, TH2D*> twoDhistoMap;
236 >    map<string, TH2D*> twoDhistoMap;
237      twoDHists_.push_back(twoDhistoMap);
238  
239  
# Line 252 | Line 255 | OSUAnalysis::OSUAnalysis (const edm::Par
255          }
256        }
257        if(numBinsElements != 3 && numBinsElements !=6){
258 <        std::cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n";
258 >        cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n";
259          exit(0);
260        }
261        else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){
262 <        std::cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n";
262 >        cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n";
263          exit(0);
264        }
265        else if(numBinsElements == 3){
# Line 275 | Line 278 | OSUAnalysis::OSUAnalysis (const edm::Par
278        }
279  
280  
281 <      if(currentHistogram.name.find("GenMatch")==std::string::npos) continue;
281 >      if(currentHistogram.name.find("GenMatch")==string::npos) continue;
282  
283        // bin      particle type
284        // ---      -------------
# Line 331 | Line 334 | OSUAnalysis::OSUAnalysis (const edm::Par
334        labelArray.push_back("other");
335  
336        for(int bin = 0; bin !=currentHistogram.bins.at(0); bin++){
337 <        if(currentHistogram.name.find("GenMatchIdVsMotherId")==std::string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==std::string::npos) {
338 <          oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
339 <        }
340 <        else {
341 <          twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1));
342 <          twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
343 <        }
337 >        if(currentHistogram.name.find("GenMatchIdVsMotherId")==string::npos && currentHistogram.name.find("GenMatchIdVsGrandmotherId")==string::npos) {
338 >          oneDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
339 >        }
340 >        else {
341 >          twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->SetBinLabel(bin+1,labelArray.at(currentHistogram.bins.at(0)-bin-1));
342 >          twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->SetBinLabel(bin+1,labelArray.at(bin));
343 >        }
344        }
345 <      if(currentHistogram.name.find("GenMatchIdVsMotherId")!=std::string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=std::string::npos) {
346 <        twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle();
347 <        twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle();
345 >      if(currentHistogram.name.find("GenMatchIdVsMotherId")!=string::npos || currentHistogram.name.find("GenMatchIdVsGrandmotherId")!=string::npos) {
346 >        twoDHists_.at(currentChannel)[currentHistogram.name]->GetXaxis()->CenterTitle();
347 >        twoDHists_.at(currentChannel)[currentHistogram.name]->GetYaxis()->CenterTitle();
348        }
349  
350      }
351  
352 <    // Book a histogram for the number of each object type to be plotted.  
353 <    // Name of objectToPlot here must match the name specified in OSUAnalysis::analyze().  
352 >    // Book a histogram for the number of each object type to be plotted.
353 >    // Name of objectToPlot here must match the name specified in OSUAnalysis::analyze().
354      for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
355        string currentObject = objectsToPlot.at(currentObjectIndex);
356        int maxNum = 10;
# Line 361 | Line 364 | OSUAnalysis::OSUAnalysis (const edm::Par
364        else if(currentObject == "electron-jet pairs")        currentObject = "electronJetPairs";
365        else if(currentObject == "muon-jet pairs")            currentObject = "muonJetPairs";
366        else if(currentObject == "track-event pairs")         currentObject = "trackEventPairs";
367 <      else if(currentObject == "electron-track pairs")      currentObject = "electronTrackPairs";        
368 <      else if(currentObject == "muon-track pairs")          currentObject = "muonTrackPairs";    
369 <      else if(currentObject == "muon-tau pairs")            currentObject = "muonTauPairs";      
367 >      else if(currentObject == "electron-track pairs")      currentObject = "electronTrackPairs";
368 >      else if(currentObject == "muon-track pairs")          currentObject = "muonTrackPairs";
369 >      else if(currentObject == "muon-tau pairs")            currentObject = "muonTauPairs";
370        else if(currentObject == "tau-tau pairs")             currentObject = "ditauPairs";
371        else if(currentObject == "tau-track pairs")           currentObject = "tauTrackPairs";
372        else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs";
373        else if(currentObject == "secondary muons")           currentObject = "secondaryMuons";
374        else if(currentObject == "electron-secondary electron pairs") currentObject = "electronSecondaryElectronPairs";
375        else if(currentObject == "secondary electrons")           currentObject = "secondaryElectrons";
376 +      else if(currentObject == "electron-trigobj pairs")    currentObject = "electronTrigobjPairs";
377 +      else if(currentObject == "muon-trigobj pairs")        currentObject = "muonTrigobjPairs";
378  
379 <      currentObject.at(0) = toupper(currentObject.at(0));  
379 >      currentObject.at(0) = toupper(currentObject.at(0));
380        string histoName = "num" + currentObject;
381  
382        if(histoName == "numPrimaryvertexs"){
# Line 401 | Line 406 | OSUAnalysis::OSUAnalysis (const edm::Par
406        if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
407        if(tempInputCollection == "secondary muon-muon pairs")   tempInputCollection = "muon-secondary muon pairs";
408        if(tempInputCollection == "secondary electron-electron pairs")   tempInputCollection = "electron-secondary electron pairs";
409 +      if(tempInputCollection == "trigobj-electron pairs")   tempInputCollection = "electron-trigobj pairs";
410 +      if(tempInputCollection == "trigobj-muon pairs")   tempInputCollection = "muon-trigobj pairs";
411        tempCut.inputCollection = tempInputCollection;
412 <      if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
413 <        if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
414 <          int spaceIndex = tempInputCollection.find(" ");
415 <          int secondWordLength = tempInputCollection.size() - spaceIndex;
416 <          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
417 <        }
418 <        else{
419 <          objectsToGet.push_back(tempInputCollection);
420 <        }
421 <        objectsToCut.push_back(tempInputCollection);
412 >      if(tempInputCollection.find("pairs")==string::npos){ //just a single object
413 >        if(tempInputCollection.find("secondary")!=string::npos){//secondary object
414 >          int spaceIndex = tempInputCollection.find(" ");
415 >          int secondWordLength = tempInputCollection.size() - spaceIndex;
416 >          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
417 >        }
418 >        else{
419 >          objectsToGet.push_back(tempInputCollection);
420 >        }
421 >        objectsToCut.push_back(tempInputCollection);
422        }
423        else{//pair of objects, need to add them both to objectsToGet
424 <        string obj1;
425 <        string obj2;
426 <        getTwoObjs(tempInputCollection, obj1, obj2);
427 <        string obj2ToGet = getObjToGet(obj2);  
424 >        string obj1;
425 >        string obj2;
426 >        getTwoObjs(tempInputCollection, obj1, obj2);
427 >        string obj2ToGet = getObjToGet(obj2);
428          objectsToCut.push_back(tempInputCollection);
429          objectsToCut.push_back(obj1);
430 <        objectsToCut.push_back(obj2);  
430 >        objectsToCut.push_back(obj2);
431          objectsToGet.push_back(tempInputCollection);
432          objectsToGet.push_back(obj1);
433          objectsToGet.push_back(obj2ToGet);
# Line 431 | Line 438 | OSUAnalysis::OSUAnalysis (const edm::Par
438  
439        //split cut string into parts and store them
440        string cutString = cuts_.at(currentCut).getParameter<string> ("cutString");
441 <      std::vector<string> cutStringVector = splitString(cutString);
441 >      vector<string> cutStringVector = splitString(cutString);
442        if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){
443 <        std::cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n";
443 >        cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n";
444          exit(0);
445        }
446        tempCut.numSubcuts = (cutStringVector.size()+1)/4;
447        for(int subcutIndex = 0; subcutIndex != tempCut.numSubcuts; subcutIndex++){//loop over all the pieces of the cut combined using &,|
448          int indexOffset = 4 * subcutIndex;
449          string currentVariableString = cutStringVector.at(indexOffset);
450 <        if(currentVariableString.find("(")==std::string::npos){
450 >        if(currentVariableString.find("(")==string::npos){
451            tempCut.functions.push_back("");//no function was specified
452            tempCut.variables.push_back(currentVariableString);// variable to cut on
453          }
# Line 451 | Line 458 | OSUAnalysis::OSUAnalysis (const edm::Par
458          }
459          tempCut.comparativeOperators.push_back(cutStringVector.at(indexOffset+1));// comparison to make
460          tempCut.cutValues.push_back(atof(cutStringVector.at(indexOffset+2).c_str()));// threshold value to pass cut
461 +        tempCut.cutStringValues.push_back(cutStringVector.at(indexOffset+2));// string value to pass cut
462          if(subcutIndex != 0) tempCut.logicalOperators.push_back(cutStringVector.at(indexOffset-1)); // logical comparison (and, or)
463        }
464  
465        //get number of objects required to pass cut for event to pass
466        string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired");
467 <      std::vector<string> numberRequiredVector = splitString(numberRequiredString);
467 >      vector<string> numberRequiredVector = splitString(numberRequiredString);
468        if(numberRequiredVector.size()!=2){
469 <        std::cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n";
469 >        cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n";
470          exit(0);
471        }
472  
# Line 516 | Line 524 | OSUAnalysis::analyze (const edm::Event &
524  
525    // Retrieve necessary collections from the event.
526  
527 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end())
527 >  if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end())
528      event.getByLabel (triggers_, triggers);
529  
530 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end())
530 >  if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end())
531 >    event.getByLabel (trigobjs_, trigobjs);
532 >
533 >  if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end())
534      event.getByLabel (jets_, jets);
535  
536 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end())
536 >  if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end())
537      event.getByLabel (muons_, muons);
538  
539 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end())
539 >  if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end())
540      event.getByLabel (electrons_, electrons);
541  
542 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end())
542 >  if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end())
543      event.getByLabel (events_, events);
544  
545 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end())
545 >  if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end())
546      event.getByLabel (taus_, taus);
547  
548 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end())
548 >  if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end())
549      event.getByLabel (mets_, mets);
550  
551 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end())
551 >  if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end())
552      event.getByLabel (tracks_, tracks);
553  
554 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end())
554 >  if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end())
555      event.getByLabel (genjets_, genjets);
556  
557 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end())
557 >  if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end())
558      event.getByLabel (mcparticles_, mcparticles);
559  
560 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end())
560 >  if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end())
561      event.getByLabel (primaryvertexs_, primaryvertexs);
562  
563 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end())
563 >  if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end())
564      event.getByLabel (bxlumis_, bxlumis);
565  
566 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end())
566 >  if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end())
567      event.getByLabel (photons_, photons);
568  
569 <  if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
569 >  if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
570      event.getByLabel (superclusters_, superclusters);
571  
572    if (datasetType_ == "signalMC"){
573 <    if (std::find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end())
573 >    if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end())
574        event.getByLabel (stops_, stops);
575    }
576  
577 <  if (useTrackCaloRhoCorr_) {  
578 <    // Used only for pile-up correction of by-hand calculation of isolation energy.  
579 <    // This rho collection is not available in all BEANs.  
577 >  if (useTrackCaloRhoCorr_) {
578 >    // Used only for pile-up correction of by-hand calculation of isolation energy.
579 >    // This rho collection is not available in all BEANs.
580      // For description of rho values for different jet reconstruction algorithms, see
581 <    // https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms  
582 <    event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_);
581 >    // https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms
582 >    event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_);
583    }
584  
585    double scaleFactor = 1.0;
# Line 624 | Line 635 | OSUAnalysis::analyze (const edm::Event &
635          else if(currentObject == "bxlumis") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,bxlumis.product(),"bxlumis");
636          else if(currentObject == "photons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"photons");
637          else if(currentObject == "superclusters") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,superclusters.product(),"superclusters");
638 +        else if(currentObject == "trigobjs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,trigobjs.product(),"trigobjs");
639  
640  
641  
# Line 662 | Line 674 | OSUAnalysis::analyze (const edm::Event &
674                                                                         cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
675                                                                         cumulativeFlags.at("jets").at(flagsForPairCutsIndex), \
676                                                                         "muon-jet pairs");
677 <        else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(),
678 <                                                                     cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
679 <                                                                     cumulativeFlags.at("events").at(flagsForPairCutsIndex),
680 <                                                                     "track-event pairs");
681 <        else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),
682 <                                                                        cumulativeFlags.at("electrons").at(flagsForPairCutsIndex),
683 <                                                                        cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
684 <                                                                        "electron-track pairs");
685 <        else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),
686 <                                                                    cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
687 <                                                                    cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
688 <                                                                    "muon-track pairs");
689 <        else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),
690 <                                                                  cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
691 <                                                                  cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
692 <                                                                  "muon-tau pairs");
693 <        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),
694 <                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
695 <                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
696 <                                                                 "tau-tau pairs");
697 <        else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),
677 >        else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(),
678 >                                                                     cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
679 >                                                                     cumulativeFlags.at("events").at(flagsForPairCutsIndex),
680 >                                                                     "track-event pairs");
681 >        else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),
682 >                                                                        cumulativeFlags.at("electrons").at(flagsForPairCutsIndex),
683 >                                                                        cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
684 >                                                                        "electron-track pairs");
685 >        else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),
686 >                                                                    cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
687 >                                                                    cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
688 >                                                                    "muon-track pairs");
689 >        else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),
690 >                                                                  cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
691 >                                                                  cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
692 >                                                                  "muon-tau pairs");
693 >        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),
694 >                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
695 >                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
696 >                                                                 "tau-tau pairs");
697 >        else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),
698                                                                   cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
699                                                                   cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
700                                                                   "tau-track pairs");
701 +        else if(currentObject == "electron-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(),
702 +                                                                          cumulativeFlags.at("electrons").at(flagsForPairCutsIndex),
703 +                                                                          cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex),
704 +                                                                          "electron-trigobj pairs");
705 +        else if(currentObject == "muon-trigobj pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(),
706 +                                                                      cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
707 +                                                                      cumulativeFlags.at("trigobjs").at(flagsForPairCutsIndex),
708 +                                                                      "muon-trigobj pairs");
709  
710 <        if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops");
710 >        if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops");
711        }
712  
713  
# Line 710 | Line 730 | OSUAnalysis::analyze (const edm::Event &
730        int numberPassing = 0;
731  
732        for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){
733 <        if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
733 >        if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
734        }
735        bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
736        cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
# Line 737 | Line 757 | OSUAnalysis::analyze (const edm::Event &
757      if(!eventPassedAllCuts)continue;
758  
759      if (printEventInfo_) {
760 <      // Write information about event to screen, for testing purposes.  
761 <      cout << "Event passed all cuts in channel " <<  currentChannel.name
762 <           << ": run="  << events->at(0).run
763 <           << "  lumi=" << events->at(0).lumi
764 <           << "  event=" << events->at(0).evt
765 <           << endl;  
760 >      // Write information about event to screen, for testing purposes.
761 >      cout << "Event passed all cuts in channel " <<  currentChannel.name
762 >           << ": run="  << events->at(0).run
763 >           << "  lumi=" << events->at(0).lumi
764 >           << "  event=" << events->at(0).evt
765 >           << endl;
766      }
767  
768      //filling histograms
# Line 754 | Line 774 | OSUAnalysis::analyze (const edm::Event &
774          histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name);
775  
776          if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor);
777 <        else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
778 <        else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
779 <        else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor);
777 >        else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
778 >        else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
779 >        else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").back(),scaleFactor);
780          else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
781                                                                                         cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
782                                                                                         cumulativeFlags.at("muon-muon pairs").back(),scaleFactor);
# Line 774 | Line 794 | OSUAnalysis::analyze (const edm::Event &
794                                                                                         cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \
795                                                                                         cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor);
796          else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \
797 <                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
798 <                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
797 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
798 >                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
799          else if(currentHistogram.inputCollection == "electron-jet pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),jets.product(), \
800 <                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(),
801 <                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
800 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(),
801 >                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
802          else if(currentHistogram.inputCollection == "muon-jet pairs") fill1DHistogram(histo,currentHistogram, muons.product(),jets.product(), \
803 <                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(),
804 <                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
805 <        else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(),        
806 <                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),  
807 <                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);      
808 <        else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(),        
809 <                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),  
810 <                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);      
811 <        else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(),    
812 <                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),      
813 <                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);  
814 <        else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(),      
815 <                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
816 <                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
817 <        else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(),
803 >                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(),
804 >                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
805 >        else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(),
806 >                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),
807 >                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);
808 >        else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(),
809 >                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),
810 >                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);
811 >        else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(),
812 >                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),
813 >                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);
814 >        else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(),
815 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),
816 >                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);
817 >        else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(),
818                                                                                       cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
819                                                                                       cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
820 +        else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),trigobjs.product(),
821 +                                                                                              cumulativeFlags.at("electrons").back(),cumulativeFlags.at("trigobjs").back(),
822 +                                                                                              cumulativeFlags.at("electron-trigobj pairs").back(),scaleFactor);
823 +        else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill1DHistogram(histo,currentHistogram, muons.product(),trigobjs.product(),
824 +                                                                                          cumulativeFlags.at("muons").back(),cumulativeFlags.at("trigobjs").back(),
825 +                                                                                          cumulativeFlags.at("muon-trigobj pairs").back(),scaleFactor);
826  
827          else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
828          else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
# Line 808 | Line 834 | OSUAnalysis::analyze (const edm::Event &
834          else if(currentHistogram.inputCollection == "bxlumis") fill1DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor);
835          else if(currentHistogram.inputCollection == "photons") fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor);
836          else if(currentHistogram.inputCollection == "superclusters") fill1DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor);
837 <
838 <        if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor);
837 >        else if(currentHistogram.inputCollection == "trigobjs") fill1DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").back(),scaleFactor);
838 >        else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill1DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor);
839        }
840        else if(currentHistogram.inputVariables.size() == 2){
841          TH2D* histo;
# Line 836 | Line 862 | OSUAnalysis::analyze (const edm::Event &
862                                                                                         cumulativeFlags.at("electrons").back(),cumulativeFlags.at("secondary electrons").back(), \
863                                                                                         cumulativeFlags.at("electron-secondary electron pairs").back(),scaleFactor);
864          else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \
865 <                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
866 <                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
865 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
866 >                                                                                           cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
867          else if(currentHistogram.inputCollection == "electron-jet pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),jets.product(), \
868 <                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \
869 <                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
868 >                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("jets").back(), \
869 >                                                                                           cumulativeFlags.at("electron-jet pairs").back(),scaleFactor);
870          else if(currentHistogram.inputCollection == "muon-jet pairs") fill2DHistogram(histo,currentHistogram,muons.product(),jets.product(), \
871 <                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \
872 <                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
873 <        else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(),        
874 <                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),          
875 <                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);      
876 <        else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(),        
877 <                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),          
878 <                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);      
879 <        else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(),    
880 <                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),      
881 <                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);  
882 <        else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(),      
883 <                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
884 <                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
885 <        else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(),
871 >                                                                                           cumulativeFlags.at("muons").back(),cumulativeFlags.at("jets").back(), \
872 >                                                                                           cumulativeFlags.at("muon-jet pairs").back(),scaleFactor);
873 >        else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(),
874 >                                                                                            cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),
875 >                                                                                            cumulativeFlags.at("electron-track pairs").back(),scaleFactor);
876 >        else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(),
877 >                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),
878 >                                                                                        cumulativeFlags.at("muon-track pairs").back(),scaleFactor);
879 >        else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(),
880 >                                                                                      cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),
881 >                                                                                      cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);
882 >        else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(),
883 >                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),
884 >                                                                                     cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);
885 >        else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(),
886                                                                                       cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
887                                                                                       cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
888 <        else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
888 >        else if(currentHistogram.inputCollection == "electron-trigobj pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),trigobjs.product(),
889 >                                                                                              cumulativeFlags.at("electrons").back(),cumulativeFlags.at("trigobjs").back(),
890 >                                                                                              cumulativeFlags.at("electron-trigobj pairs").back(),scaleFactor);
891 >        else if(currentHistogram.inputCollection == "muon-trigobj pairs") fill2DHistogram(histo,currentHistogram,muons.product(),trigobjs.product(),
892 >                                                                                          cumulativeFlags.at("muons").back(),cumulativeFlags.at("trigobjs").back(),
893 >                                                                                          cumulativeFlags.at("muon-trigobj pairs").back(),scaleFactor);
894 >        else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
895          else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
896          else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
897          else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor);
898 <        else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(),
899 <                                                                                         cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(),
900 <                                                                                         cumulativeFlags.at("track-event pairs").back(),scaleFactor);  
898 >        else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(),
899 >                                                                                         cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(),
900 >                                                                                         cumulativeFlags.at("track-event pairs").back(),scaleFactor);
901          else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor);
902          else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor);
903          else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor);
904          else if(currentHistogram.inputCollection == "bxlumis") fill2DHistogram(histo,currentHistogram,bxlumis.product(),cumulativeFlags.at("bxlumis").back(),scaleFactor);
905          else if(currentHistogram.inputCollection == "photons") fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("photons").back(),scaleFactor);
906          else if(currentHistogram.inputCollection == "superclusters") fill2DHistogram(histo,currentHistogram,superclusters.product(),cumulativeFlags.at("superclusters").back(),scaleFactor);
907 +        else if(currentHistogram.inputCollection == "trigobjs") fill2DHistogram(histo,currentHistogram,trigobjs.product(),cumulativeFlags.at("trigobjs").back(),scaleFactor);
908          else if(currentHistogram.inputCollection == "stops" && datasetType_ == "signalMC") fill2DHistogram(histo,currentHistogram,stops.product(),cumulativeFlags.at("stops").back(),scaleFactor);
909        }
910      }
# Line 883 | Line 916 | OSUAnalysis::analyze (const edm::Event &
916  
917        string currentObject = objectsToPlot.at(currentObjectIndex);
918  
919 <      string objectToPlot = "";  
919 >      string objectToPlot = "";
920  
921 <      // Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis().  
921 >      // Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis().
922        if(currentObject == "muon-muon pairs")                         objectToPlot = "dimuonPairs";
923        else if(currentObject == "electron-electron pairs")            objectToPlot = "dielectronPairs";
924        else if(currentObject == "electron-muon pairs")                objectToPlot = "electronMuonPairs";
# Line 893 | Line 926 | OSUAnalysis::analyze (const edm::Event &
926        else if(currentObject == "muon-jet pairs")                     objectToPlot = "muonJetPairs";
927        else if(currentObject == "jet-jet pairs")            objectToPlot = "dijetPairs";
928        else if(currentObject == "electron-track pairs")               objectToPlot = "electronTrackPairs";
929 <      else if(currentObject == "muon-track pairs")                   objectToPlot = "muonTrackPairs";    
930 <      else if(currentObject == "muon-tau pairs")                     objectToPlot = "muonTauPairs";      
929 >      else if(currentObject == "muon-track pairs")                   objectToPlot = "muonTrackPairs";
930 >      else if(currentObject == "muon-tau pairs")                     objectToPlot = "muonTauPairs";
931        else if(currentObject == "tau-tau pairs")                      objectToPlot = "ditauPairs";
932        else if(currentObject == "tau-track pairs")                    objectToPlot = "tauTrackPairs";
933 <      else if(currentObject == "track-event pairs")                  objectToPlot = "trackEventPairs";  
934 <      else if(currentObject == "muon-secondary muon pairs")          objectToPlot = "muonSecondaryMuonPairs";  
935 <      else if(currentObject == "secondary muons")                    objectToPlot = "secondaryMuons";  
936 <      else if(currentObject == "electron-secondary electron pairs")  objectToPlot = "electronSecondaryElectronPairs";  
937 <      else if(currentObject == "secondary electrons")                objectToPlot = "secondaryElectrons";  
933 >      else if(currentObject == "track-event pairs")                  objectToPlot = "trackEventPairs";
934 >      else if(currentObject == "muon-secondary muon pairs")          objectToPlot = "muonSecondaryMuonPairs";
935 >      else if(currentObject == "secondary muons")                    objectToPlot = "secondaryMuons";
936 >      else if(currentObject == "electron-secondary electron pairs")  objectToPlot = "electronSecondaryElectronPairs";
937 >      else if(currentObject == "secondary electrons")                objectToPlot = "secondaryElectrons";
938 >      else if(currentObject == "electron-trigobj pairs")             objectToPlot = "electronTrigobjPairs";
939 >      else if(currentObject == "muon-trigobj pairs")                 objectToPlot = "muonTrigobjPairs";
940        else objectToPlot = currentObject;
941  
942        string tempCurrentObject = objectToPlot;
943 <      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));  
943 >      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));
944        string histoName = "num" + tempCurrentObject;
945  
946        //set position of primary vertex in event, in order to calculate quantities relative to it
947 <      if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
947 >      if(find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
948          vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back();
949 <        int numToPlot = 0;
949 >        int numToPlot = 0;
950          for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){
951            if(lastCutFlags.at(currentFlag)) numToPlot++;
952          }
# Line 921 | Line 956 | OSUAnalysis::analyze (const edm::Event &
956          }
957          else {
958            oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor);
959 <        }
959 >        }
960        }
961        else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor);
962        else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
# Line 936 | Line 971 | OSUAnalysis::analyze (const edm::Event &
971        else if(objectToPlot == "electronJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*jets->size(),scaleFactor);
972        else if(objectToPlot == "muonJetPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*jets->size(),scaleFactor);
973        else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor);
974 +      else if(objectToPlot == "electronTrigobjPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*trigobjs->size(),scaleFactor);
975 +      else if(objectToPlot == "muonTrigobjPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*trigobjs->size(),scaleFactor);
976        else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor);
977        else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor);
978        else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor);
# Line 945 | Line 982 | OSUAnalysis::analyze (const edm::Event &
982        else if(objectToPlot == "bxlumis") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(bxlumis->size(),scaleFactor);
983        else if(objectToPlot == "photons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(photons->size(),scaleFactor);
984        else if(objectToPlot == "superclusters") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(superclusters->size(),scaleFactor);
985 +      else if(objectToPlot == "trigobjs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(trigobjs->size(),scaleFactor);
986        else if(objectToPlot == "primaryvertexs"){
987          oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
988          oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor);
989 <      }
989 >      }
990        if(objectToPlot == "stops" && datasetType_ == "signalMC") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(stops->size(),scaleFactor);
991  
992      } // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++)
# Line 972 | Line 1010 | OSUAnalysis::evaluateComparison (double
1010    else if(comparison == "==") return testValue == cutValue;
1011    else if(comparison == "=") return testValue == cutValue;
1012    else if(comparison == "!=") return testValue != cutValue;
1013 <  else {std::cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
1013 >  else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
1014 >
1015 > }
1016 >
1017 > bool
1018 > OSUAnalysis::evaluateComparison (string testValue, string comparison, string cutValue){
1019 >
1020 >
1021 >  if(comparison == ">")       return testValue >  cutValue;
1022 >  else if(comparison == ">=") return testValue >= cutValue;
1023 >  else if(comparison == "<")  return testValue <  cutValue;
1024 >  else if(comparison == "<=") return testValue <= cutValue;
1025 >  else if(comparison == "==") return testValue == cutValue;
1026 >  else if(comparison == "=") return testValue == cutValue;
1027 >  else if(comparison == "!=") return testValue != cutValue;
1028 >  else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;}
1029  
1030   }
1031  
# Line 986 | Line 1039 | OSUAnalysis::evaluateTriggers (vector<st
1039        if(trigger->pass != 1) continue;
1040        for(uint triggerName = 0; triggerName != triggersToTest.size(); triggerName++)
1041          {
1042 <          if(trigger->name.find(triggersToTest.at(triggerName))!=std::string::npos){
1042 >          if(trigger->name.find(triggersToTest.at(triggerName))!=string::npos){
1043              triggerDecision = true;
1044            }
1045          }
# Line 995 | Line 1048 | OSUAnalysis::evaluateTriggers (vector<st
1048  
1049   }
1050  
1051 < std::vector<std::string>
1051 > vector<string>
1052   OSUAnalysis::splitString (string inputString){
1053  
1054 <  std::stringstream stringStream(inputString);
1055 <  std::istream_iterator<std::string> begin(stringStream);
1056 <  std::istream_iterator<std::string> end;
1057 <  std::vector<std::string> stringVector(begin, end);
1054 >  stringstream stringStream(inputString);
1055 >  istream_iterator<string> begin(stringStream);
1056 >  istream_iterator<string> end;
1057 >  vector<string> stringVector(begin, end);
1058    return stringVector;
1059  
1060   }
1061  
1062  
1063   void OSUAnalysis::getTwoObjs(string tempInputCollection, string& obj1, string& obj2) {
1064 <  // Set two object strings from the tempInputCollection string,
1065 <  // For example, if tempInputCollection is "electron-muon pairs",
1066 <  // then obj1 = "electrons" and obj2 = "muons".  
1067 <  // Note that the objects have an "s" appended.  
1064 >  // Set two object strings from the tempInputCollection string,
1065 >  // For example, if tempInputCollection is "electron-muon pairs",
1066 >  // then obj1 = "electrons" and obj2 = "muons".
1067 >  // Note that the objects have an "s" appended.
1068  
1069    int dashIndex = tempInputCollection.find("-");
1070    int spaceIndex = tempInputCollection.find_last_of(" ");
1071    int secondWordLength = spaceIndex - dashIndex;
1072 <  obj1 = tempInputCollection.substr(0,dashIndex) + "s";  
1072 >  obj1 = tempInputCollection.substr(0,dashIndex) + "s";
1073    obj2 = tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s";
1074 <  
1075 < }
1074 >
1075 > }
1076  
1077  
1078   string OSUAnalysis::getObjToGet(string obj) {
1079    // Return the string corresponding to the object to get for the given obj string.
1080 <  // Right now this only handles the case in which obj contains "secondary",
1081 <  // e.g, "secondary muons".  
1082 <  // Note that "s" is NOT appended.  
1083 <  
1084 <  if (obj.find("secondary")==std::string::npos) return obj;  // "secondary" is not found  
1085 <  int firstSpaceIndex = obj.find_first_of(" ");  
1080 >  // Right now this only handles the case in which obj contains "secondary",
1081 >  // e.g, "secondary muons".
1082 >  // Note that "s" is NOT appended.
1083 >
1084 >  if (obj.find("secondary")==string::npos) return obj;  // "secondary" is not found
1085 >  int firstSpaceIndex = obj.find_first_of(" ");
1086    return obj.substr(firstSpaceIndex+1,obj.length()-1);
1087  
1088 < }  
1088 > }
1089  
1090  
1091   //!jet valueLookup
1092   double
1093 < OSUAnalysis::valueLookup (const BNjet* object, string variable, string function){
1093 > OSUAnalysis::valueLookup (const BNjet* object, string variable, string function, string &stringValue){
1094  
1095    double value = 0.0;
1096    if(variable == "energy") value = object->energy;
# Line 1157 | Line 1210 | OSUAnalysis::valueLookup (const BNjet* o
1210    else if(variable == "puJetId_loose_cutbased") value = object->puJetId_loose_cutbased;
1211  
1212  
1213 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1213 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1214  
1215    value = applyFunction(function, value);
1216  
# Line 1167 | Line 1220 | OSUAnalysis::valueLookup (const BNjet* o
1220  
1221   //!muon valueLookup
1222   double
1223 < OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function){
1223 > OSUAnalysis::valueLookup (const BNmuon* object, string variable, string function, string &stringValue){
1224  
1225    double value = 0.0;
1226    if(variable == "energy") value = object->energy;
# Line 1332 | Line 1385 | OSUAnalysis::valueLookup (const BNmuon*
1385      if (met)
1386        {
1387          TLorentzVector p1 (object->px, object->py, object->pz, object->energy),
1388 <          p2 (met->px, met->py, 0.0, met->pt);
1388 >          p2 (met->px, met->py, 0.0, met->pt);
1389  
1390          value = (p1 + p2).Mt ();
1391        }
# Line 1452 | Line 1505 | OSUAnalysis::valueLookup (const BNmuon*
1505      value = object->isGlobalMuon > 0                \
1506        && object->isPFMuon > 0                        \
1507        && object->normalizedChi2 < 10                \
1508 <                                  && object->numberOfValidMuonHits > 0        \
1508 >                                  && object->numberOfValidMuonHits > 0        \
1509        && object->numberOfMatchedStations > 1        \
1510        && fabs(object->correctedD0Vertex) < 0.2        \
1511        && fabs(object->correctedDZ) < 0.5        \
# Line 1462 | Line 1515 | OSUAnalysis::valueLookup (const BNmuon*
1515    else if(variable == "tightIDdisplaced"){
1516      value = object->isGlobalMuon > 0                \
1517        && object->normalizedChi2 < 10                \
1518 <                                  && object->numberOfValidMuonHits > 0        \
1518 >                                  && object->numberOfValidMuonHits > 0        \
1519        && object->numberOfMatchedStations > 1        \
1520        && object->numberOfValidPixelHits > 0        \
1521        && object->numberOfLayersWithMeasurement > 5;
1522    }
1523  
1524 <  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
1524 >  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
1525  
1526    else if(variable == "genMatchedPdgId"){
1527      int index = getGenMatchedParticleIndex(object);
# Line 1514 | Line 1567 | OSUAnalysis::valueLookup (const BNmuon*
1567  
1568  
1569  
1570 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1570 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1571  
1572    value = applyFunction(function, value);
1573  
# Line 1523 | Line 1576 | OSUAnalysis::valueLookup (const BNmuon*
1576  
1577   //!electron valueLookup
1578   double
1579 < OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function){
1579 > OSUAnalysis::valueLookup (const BNelectron* object, string variable, string function, string &stringValue){
1580  
1581    double value = 0.0;
1582    if(variable == "energy") value = object->energy;
# Line 1693 | Line 1746 | OSUAnalysis::valueLookup (const BNelectr
1746      if (met)
1747        {
1748          TLorentzVector p1 (object->px, object->py, object->pz, object->energy),
1749 <          p2 (met->px, met->py, 0.0, met->pt);
1749 >          p2 (met->px, met->py, 0.0, met->pt);
1750  
1751          value = (p1 + p2).Mt ();
1752        }
# Line 1860 | Line 1913 | OSUAnalysis::valueLookup (const BNelectr
1913    }
1914  
1915  
1916 <  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
1916 >  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
1917  
1918    else if(variable == "genMatchedPdgId"){
1919      int index = getGenMatchedParticleIndex(object);
# Line 1907 | Line 1960 | OSUAnalysis::valueLookup (const BNelectr
1960  
1961  
1962  
1963 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1963 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1964  
1965    value = applyFunction(function, value);
1966  
# Line 1916 | Line 1969 | OSUAnalysis::valueLookup (const BNelectr
1969  
1970   //!event valueLookup
1971   double
1972 < OSUAnalysis::valueLookup (const BNevent* object, string variable, string function){
1972 > OSUAnalysis::valueLookup (const BNevent* object, string variable, string function, string &stringValue){
1973  
1974    double value = 0.0;
1975  
# Line 1991 | Line 2044 | OSUAnalysis::valueLookup (const BNevent*
2044        value = 1.0;
2045    }
2046    else if(variable == "muonScaleFactor"){
2047 <    if(datasetType_ != "data")
2047 >    if(datasetType_ != "data" && applyLeptonSF_)
2048        value = muonSFWeight_->at (chosenMuon ()->eta);
2049      else
2050        value = 1.0;
2051    }
2052    else if(variable == "electronScaleFactor"){
2053 <    if(datasetType_ != "data")
2053 >    if(datasetType_ != "data" && applyLeptonSF_)
2054        value = electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
2055      else
2056        value = 1.0;
# Line 2005 | Line 2058 | OSUAnalysis::valueLookup (const BNevent*
2058    else if(variable == "stopCTauScaleFactor")
2059      value = stopCTauScaleFactor_;
2060  
2061 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2061 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2062  
2063    value = applyFunction(function, value);
2064  
# Line 2014 | Line 2067 | OSUAnalysis::valueLookup (const BNevent*
2067  
2068   //!tau valueLookup
2069   double
2070 < OSUAnalysis::valueLookup (const BNtau* object, string variable, string function){
2070 > OSUAnalysis::valueLookup (const BNtau* object, string variable, string function, string &stringValue){
2071  
2072    double value = 0.0;
2073  
# Line 2060 | Line 2113 | OSUAnalysis::valueLookup (const BNtau* o
2113  
2114  
2115  
2116 <  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2116 >  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2117  
2118    else if(variable == "genMatchedPdgId"){
2119      int index = getGenMatchedParticleIndex(object);
# Line 2105 | Line 2158 | OSUAnalysis::valueLookup (const BNtau* o
2158    }
2159  
2160  
2161 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2161 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2162  
2163    value = applyFunction(function, value);
2164  
# Line 2114 | Line 2167 | OSUAnalysis::valueLookup (const BNtau* o
2167  
2168   //!met valueLookup
2169   double
2170 < OSUAnalysis::valueLookup (const BNmet* object, string variable, string function){
2170 > OSUAnalysis::valueLookup (const BNmet* object, string variable, string function, string &stringValue){
2171  
2172    double value = 0.0;
2173  
# Line 2178 | Line 2231 | OSUAnalysis::valueLookup (const BNmet* o
2231    else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt;
2232    else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi;
2233  
2234 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2234 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2235  
2236    value = applyFunction(function, value);
2237  
# Line 2187 | Line 2240 | OSUAnalysis::valueLookup (const BNmet* o
2240  
2241   //!track valueLookup
2242   double
2243 < OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function){
2243 > OSUAnalysis::valueLookup (const BNtrack* object, string variable, string function, string &stringValue){
2244  
2245    double value = 0.0;
2246    double pMag = sqrt(object->pt * object->pt +
2247 <                     object->pz * object->pz);
2248 <  
2247 >                     object->pz * object->pz);
2248 >
2249    if(variable == "pt") value = object->pt;
2250    else if(variable == "px") value = object->px;
2251    else if(variable == "py") value = object->py;
# Line 2222 | Line 2275 | OSUAnalysis::valueLookup (const BNtrack*
2275    else if(variable == "nHitsMissingOuter") value = object->nHitsMissingOuter;
2276    else if(variable == "nHitsMissingInner") value = object->nHitsMissingInner;
2277    else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle;
2278 <  
2278 >
2279  
2280    //user defined variables
2281    else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt;
2282    else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz;
2283    else if(variable == "caloTotDeltaRp5")            value =  (object->caloHadDeltaRp5 + object->caloEMDeltaRp5);
2284    else if(variable == "caloTotDeltaRp5ByP")         value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag);
2285 <  else if(variable == "caloTotDeltaRp5RhoCorr")     value = getTrkCaloTotRhoCorr(object);  
2286 <  else if(variable == "caloTotDeltaRp5ByPRhoCorr")  value = getTrkCaloTotRhoCorr(object) / pMag;  
2285 >  else if(variable == "caloTotDeltaRp5RhoCorr")     value = getTrkCaloTotRhoCorr(object);
2286 >  else if(variable == "caloTotDeltaRp5ByPRhoCorr")  value = getTrkCaloTotRhoCorr(object) / pMag;
2287    else if(variable == "isIso")                      value = getTrkIsIso(object, tracks.product());
2288    else if(variable == "isMatchedDeadEcal")          value = getTrkIsMatchedDeadEcal(object);
2289    else if(variable == "ptErrorByPt")                value = (object->ptError/object->pt);
2290    else if(variable == "ptError")                    value = object->ptError;
2291    else if(variable == "ptRes")                      value = getTrkPtRes(object);
2292 <  else if (variable == "d0wrtPV"){      
2293 <    double vx = object->vx - chosenVertex ()->x,        
2294 <      vy = object->vy - chosenVertex ()->y,      
2295 <      px = object->px,  
2296 <      py = object->py,  
2297 <      pt = object->pt;  
2298 <    value = (-vx * py + vy * px) / pt;  
2299 <  }      
2300 <  else if (variable == "dZwrtPV"){      
2301 <    double vx = object->vx - chosenVertex ()->x,        
2302 <      vy = object->vy - chosenVertex ()->y,      
2303 <      vz = object->vz - chosenVertex ()->z,      
2304 <      px = object->px,  
2305 <      py = object->py,  
2306 <      pz = object->pz,  
2307 <      pt = object->pt;  
2308 <    value = vz - (vx * px + vy * py)/pt * (pz/pt);      
2309 <  }    
2310 <  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2292 >  else if (variable == "d0wrtPV"){
2293 >    double vx = object->vx - chosenVertex ()->x,
2294 >      vy = object->vy - chosenVertex ()->y,
2295 >      px = object->px,
2296 >      py = object->py,
2297 >      pt = object->pt;
2298 >    value = (-vx * py + vy * px) / pt;
2299 >  }
2300 >  else if (variable == "dZwrtPV"){
2301 >    double vx = object->vx - chosenVertex ()->x,
2302 >      vy = object->vy - chosenVertex ()->y,
2303 >      vz = object->vz - chosenVertex ()->z,
2304 >      px = object->px,
2305 >      py = object->py,
2306 >      pz = object->pz,
2307 >      pt = object->pt;
2308 >    value = vz - (vx * px + vy * py)/pt * (pz/pt);
2309 >  }
2310 >  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2311  
2312    else if(variable == "genMatchedPdgId"){
2313      int index = getGenMatchedParticleIndex(object);
# Line 2301 | Line 2354 | OSUAnalysis::valueLookup (const BNtrack*
2354  
2355  
2356  
2357 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2357 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2358  
2359    value = applyFunction(function, value);
2360  
# Line 2310 | Line 2363 | OSUAnalysis::valueLookup (const BNtrack*
2363  
2364   //!genjet valueLookup
2365   double
2366 < OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function){
2366 > OSUAnalysis::valueLookup (const BNgenjet* object, string variable, string function, string &stringValue){
2367  
2368    double value = 0.0;
2369  
# Line 2330 | Line 2383 | OSUAnalysis::valueLookup (const BNgenjet
2383    else if(variable == "charge") value = object->charge;
2384  
2385  
2386 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2386 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2387  
2388    value = applyFunction(function, value);
2389  
# Line 2339 | Line 2392 | OSUAnalysis::valueLookup (const BNgenjet
2392  
2393   //!mcparticle valueLookup
2394   double
2395 < OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function){
2395 > OSUAnalysis::valueLookup (const BNmcparticle* object, string variable, string function, string &stringValue){
2396  
2397    double value = 0.0;
2398  
# Line 2464 | Line 2517 | OSUAnalysis::valueLookup (const BNmcpart
2517    }
2518  
2519  
2520 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2520 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2521  
2522    value = applyFunction(function, value);
2523  
# Line 2473 | Line 2526 | OSUAnalysis::valueLookup (const BNmcpart
2526  
2527   //!primaryvertex valueLookup
2528   double
2529 < OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function){
2529 > OSUAnalysis::valueLookup (const BNprimaryvertex* object, string variable, string function, string &stringValue){
2530  
2531    double value = 0.0;
2532  
# Line 2492 | Line 2545 | OSUAnalysis::valueLookup (const BNprimar
2545    else if(variable == "isGood") value = object->isGood;
2546  
2547  
2548 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2548 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2549  
2550    value = applyFunction(function, value);
2551  
# Line 2501 | Line 2554 | OSUAnalysis::valueLookup (const BNprimar
2554  
2555   //!bxlumi valueLookup
2556   double
2557 < OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function){
2557 > OSUAnalysis::valueLookup (const BNbxlumi* object, string variable, string function, string &stringValue){
2558  
2559    double value = 0.0;
2560  
# Line 2510 | Line 2563 | OSUAnalysis::valueLookup (const BNbxlumi
2563    else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now;
2564  
2565  
2566 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2566 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2567  
2568    value = applyFunction(function, value);
2569  
# Line 2519 | Line 2572 | OSUAnalysis::valueLookup (const BNbxlumi
2572  
2573   //!photon valueLookup
2574   double
2575 < OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function){
2575 > OSUAnalysis::valueLookup (const BNphoton* object, string variable, string function, string &stringValue){
2576  
2577    double value = 0.0;
2578  
# Line 2594 | Line 2647 | OSUAnalysis::valueLookup (const BNphoton
2647    else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
2648  
2649  
2597
2650  
2651 <  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2651 >
2652 >  else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
2653  
2654    else if(variable == "genMatchedPdgId"){
2655      int index = getGenMatchedParticleIndex(object);
# Line 2643 | Line 2696 | OSUAnalysis::valueLookup (const BNphoton
2696    }
2697  
2698  
2699 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2699 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2700  
2701    value = applyFunction(function, value);
2702  
# Line 2652 | Line 2705 | OSUAnalysis::valueLookup (const BNphoton
2705  
2706   //!supercluster valueLookup
2707   double
2708 < OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function){
2708 > OSUAnalysis::valueLookup (const BNsupercluster* object, string variable, string function, string &stringValue){
2709  
2710    double value = 0.0;
2711  
# Line 2666 | Line 2719 | OSUAnalysis::valueLookup (const BNsuperc
2719    else if(variable == "theta") value = object->theta;
2720  
2721  
2722 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2722 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2723 >
2724 >  value = applyFunction(function, value);
2725 >
2726 >  return value;
2727 > }
2728 >
2729 > //!trigobj valueLookup
2730 > double
2731 > OSUAnalysis::valueLookup (const BNtrigobj* object, string variable, string function, string &stringValue){
2732 >
2733 >  double value = 0.0;
2734 >
2735 >  if(variable == "pt") value = object->pt;
2736 >  else if(variable == "eta") value = object->eta;
2737 >  else if(variable == "phi") value = object->phi;
2738 >  else if(variable == "px") value = object->px;
2739 >  else if(variable == "py") value = object->py;
2740 >  else if(variable == "pz") value = object->pz;
2741 >  else if(variable == "et") value = object->et;
2742 >  else if(variable == "energy") value = object->energy;
2743 >  else if(variable == "etTotal") value = object->etTotal;
2744 >  else if(variable == "id") value = object->id;
2745 >  else if(variable == "charge") value = object->charge;
2746 >  else if(variable == "isIsolated") value = object->isIsolated;
2747 >  else if(variable == "isMip") value = object->isMip;
2748 >  else if(variable == "isForward") value = object->isForward;
2749 >  else if(variable == "isRPC") value = object->isRPC;
2750 >  else if(variable == "bx") value = object->bx;
2751 >  else if(variable == "filter") {
2752 >    if ((stringValue = object->filter) == "")
2753 >      stringValue = "none";  // stringValue should only be empty if value is filled
2754 >  }
2755 >
2756 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2757  
2758    value = applyFunction(function, value);
2759  
# Line 2675 | Line 2762 | OSUAnalysis::valueLookup (const BNsuperc
2762  
2763   //!muon-muon pair valueLookup
2764   double
2765 < OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function){
2765 > OSUAnalysis::valueLookup (const BNmuon* object1, const BNmuon* object2, string variable, string function, string &stringValue){
2766  
2767    double value = 0.0;
2768  
# Line 2737 | Line 2824 | OSUAnalysis::valueLookup (const BNmuon*
2824        value = object2->correctedD0;
2825      }
2826  
2827 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2827 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2828  
2829    value = applyFunction(function, value);
2830  
# Line 2746 | Line 2833 | OSUAnalysis::valueLookup (const BNmuon*
2833  
2834   //!electron-electron pair valueLookup
2835   double
2836 < OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function){
2836 > OSUAnalysis::valueLookup (const BNelectron* object1, const BNelectron* object2, string variable, string function, string &stringValue){
2837  
2838    double value = 0.0;
2839  
# Line 2793 | Line 2880 | OSUAnalysis::valueLookup (const BNelectr
2880      value = object2->correctedD0;
2881    }
2882  
2883 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2883 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2884  
2885    value = applyFunction(function, value);
2886  
# Line 2801 | Line 2888 | OSUAnalysis::valueLookup (const BNelectr
2888   }
2889   //!electron-muon pair valueLookup
2890   double
2891 < OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function){
2891 > OSUAnalysis::valueLookup (const BNelectron* object1, const BNmuon* object2, string variable, string function, string &stringValue){
2892  
2893    double value = 0.0;
2894  
# Line 2860 | Line 2947 | OSUAnalysis::valueLookup (const BNelectr
2947      value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt;
2948    }
2949  
2950 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2950 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2951  
2952    value = applyFunction(function, value);
2953  
# Line 2869 | Line 2956 | OSUAnalysis::valueLookup (const BNelectr
2956  
2957   //!electron-jet pair valueLookup
2958   double
2959 < OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function){
2959 > OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){
2960  
2961    double value = 0.0;
2962  
# Line 2896 | Line 2983 | OSUAnalysis::valueLookup (const BNelectr
2983      value = object1->charge*object2->charge;
2984    }
2985  
2986 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2986 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2987  
2988    value = applyFunction(function, value);
2989  
# Line 2905 | Line 2992 | OSUAnalysis::valueLookup (const BNelectr
2992  
2993   //!muon-jet pair valueLookup
2994   double
2995 < OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function){
2995 > OSUAnalysis::valueLookup (const BNmuon* object1, const BNjet* object2, string variable, string function, string &stringValue){
2996  
2997    double value = 0.0;
2998  
# Line 2932 | Line 3019 | OSUAnalysis::valueLookup (const BNmuon*
3019      value = object1->charge*object2->charge;
3020    }
3021  
3022 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3022 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3023  
3024    value = applyFunction(function, value);
3025  
# Line 2941 | Line 3028 | OSUAnalysis::valueLookup (const BNmuon*
3028  
3029   //!jet-jet pair valueLookup
3030   double
3031 < OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function){
3031 > OSUAnalysis::valueLookup (const BNjet* object1, const BNjet* object2, string variable, string function, string &stringValue){
3032  
3033    double value = 0.0;
3034  
# Line 2967 | Line 3054 | OSUAnalysis::valueLookup (const BNjet* o
3054    else if(variable == "chargeProduct"){
3055      value = object1->charge*object2->charge;
3056    }
3057 <  
3058 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3057 >
3058 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3059  
3060    value = applyFunction(function, value);
3061  
3062    return value;
3063   }
3064   //!electron-track pair valueLookup
3065 < double  
3066 < OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){  
3067 <  double electronMass = 0.000511;        
3068 <  double value = 0.0;    
3069 <  TLorentzVector fourVector1(0, 0, 0, 0);        
3070 <  TLorentzVector fourVector2(0, 0, 0, 0);        
3071 <  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));  
3065 > double
3066 > OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function, string &stringValue){
3067 >  double electronMass = 0.000511;
3068 >  double value = 0.0;
3069 >  TLorentzVector fourVector1(0, 0, 0, 0);
3070 >  TLorentzVector fourVector2(0, 0, 0, 0);
3071 >  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3072    else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
3073 <  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);    
3074 <  else if(variable == "invMass"){        
3075 <    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);    
3076 <    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass );    
3077 <        
3078 <    value = (fourVector1 + fourVector2).M();    
3079 <  }
3080 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}  
3081 <  value = applyFunction(function, value);        
3082 <  return value;  
3073 >  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3074 >  else if(variable == "invMass"){
3075 >    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);
3076 >    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass );
3077 >
3078 >    value = (fourVector1 + fourVector2).M();
3079 >  }
3080 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3081 >  value = applyFunction(function, value);
3082 >  return value;
3083   }
3084  
3085  
3086   //!muon-track pair valueLookup
3087   double
3088 < OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){
3088 > OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){
3089    double pionMass = 0.140;
3090    double muonMass = 0.106;
3091    double value = 0.0;
# Line 3014 | Line 3101 | OSUAnalysis::valueLookup (const BNmuon*
3101      value = (fourVector1 + fourVector2).M();
3102    }
3103  
3104 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3104 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3105    value = applyFunction(function, value);
3106    return value;
3107   }
3108  
3109   //!tau-tau pair valueLookup
3110   double
3111 < OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){
3111 > OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function, string &stringValue){
3112    double value = 0.0;
3113    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3114    else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
# Line 3032 | Line 3119 | OSUAnalysis::valueLookup (const BNtau* o
3119      value = (fourVector1 + fourVector2).M();
3120    }
3121  
3122 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3122 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3123    value = applyFunction(function, value);
3124    return value;
3125   }
3126  
3127   //!muon-tau pair valueLookup
3128   double
3129 < OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){
3129 > OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function, string &stringValue){
3130    double value = 0.0;
3131    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3132    else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
# Line 3050 | Line 3137 | OSUAnalysis::valueLookup (const BNmuon*
3137      value = (fourVector1 + fourVector2).M();
3138    }
3139  
3140 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3140 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3141    value = applyFunction(function, value);
3142    return value;
3143   }
3144  
3145   //!tau-track pair valueLookup
3146   double
3147 < OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){
3147 > OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function, string &stringValue){
3148    double value = 0.0;
3149    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3150    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3151  
3152 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3152 >  else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3153    value = applyFunction(function, value);
3154    return value;
3155   }
# Line 3070 | Line 3157 | OSUAnalysis::valueLookup (const BNtau* o
3157  
3158   //!track-event pair valueLookup
3159   double
3160 < OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){
3160 > OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function, string &stringValue){
3161  
3162    double value = 0.0;
3163    double pMag = sqrt(object1->pt * object1->pt +
3164 <                     object1->pz * object1->pz);  
3164 >                     object1->pz * object1->pz);
3165  
3166    if      (variable == "numPV")                      value = object2->numPV;
3167    else if (variable == "caloTotDeltaRp5")            value =  (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5);
3168    else if (variable == "caloTotDeltaRp5ByP")         value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag);
3169 <  else if (variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object1);  
3170 <  else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag;  
3169 >  else if (variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object1);
3170 >  else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag;
3171  
3172 <  else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3172 >  else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3173 >
3174 >  value = applyFunction(function, value);
3175 >
3176 >  return value;
3177 >
3178 > }
3179 >
3180 > //!electron-trigobj pair valueLookup
3181 > double
3182 > OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){
3183 >
3184 >  double value = 0.0;
3185 >
3186 >  if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3187 >
3188 >  else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3189 >
3190 >  value = applyFunction(function, value);
3191 >
3192 >  return value;
3193 >
3194 > }
3195 >
3196 > //!muon-trigobj pair valueLookup
3197 > double
3198 > OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrigobj* object2, string variable, string function, string &stringValue){
3199 >
3200 >  double value = 0.0;
3201 >
3202 >  if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3203 >
3204 >  else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3205  
3206    value = applyFunction(function, value);
3207  
# Line 3092 | Line 3211 | OSUAnalysis::valueLookup (const BNtrack*
3211  
3212   //!stop valueLookup
3213   double
3214 < OSUAnalysis::valueLookup (const BNstop* object, string variable, string function){
3214 > OSUAnalysis::valueLookup (const BNstop* object, string variable, string function, string &stringValue){
3215  
3216  
3217    double value = 0.0;
# Line 3123 | Line 3242 | OSUAnalysis::valueLookup (const BNstop*
3242      double minD0=999;
3243      for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3244        double vx = object->vx - vertex->x,
3245 <        vy = object->vy - vertex->y,
3246 <        px = object->px,
3247 <        py = object->py,
3248 <        pt = object->pt;
3245 >        vy = object->vy - vertex->y,
3246 >        px = object->px,
3247 >        py = object->py,
3248 >        pt = object->pt;
3249        value = (-vx * py + vy * px) / pt;
3250        if(abs(value) < abs(minD0)) minD0 = value;
3251      }
# Line 3136 | Line 3255 | OSUAnalysis::valueLookup (const BNstop*
3255      double minDz=999;
3256      for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3257        double vx = object->vx - vertex->x,
3258 <        vy = object->vy - vertex->y,
3259 <        vz = object->vz - vertex->z,
3260 <        px = object->px,
3261 <        py = object->py,
3262 <        pz = object->pz,
3263 <        pt = object->pt;
3258 >        vy = object->vy - vertex->y,
3259 >        vz = object->vz - vertex->z,
3260 >        px = object->px,
3261 >        py = object->py,
3262 >        pz = object->pz,
3263 >        pt = object->pt;
3264        value = vz - (vx * px + vy * py)/pt * (pz/pt);
3265        if(abs(value) < abs(minDz)) minDz = value;
3266      }
# Line 3149 | Line 3268 | OSUAnalysis::valueLookup (const BNstop*
3268    }
3269    else if(variable == "distToVertex"){
3270      value = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \
3271 <                 (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3272 <                 (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3271 >                 (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3272 >                 (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3273    }
3274    else if (variable == "minDistToVertex"){
3275      double minDistToVertex=999;
3276      for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3277        value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3278 <                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3279 <                   (object->vz-vertex->z)*(object->vz-vertex->z));
3280 <      
3278 >                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3279 >                   (object->vz-vertex->z)*(object->vz-vertex->z));
3280 >
3281        if(abs(value) < abs(minDistToVertex)) minDistToVertex = value;
3282      }
3283      value = minDistToVertex;
# Line 3167 | Line 3286 | OSUAnalysis::valueLookup (const BNstop*
3286      double minDistToVertex=999;
3287      for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3288        value = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3289 <                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3290 <                   (object->vz-vertex->z)*(object->vz-vertex->z));
3291 <      
3289 >                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3290 >                   (object->vz-vertex->z)*(object->vz-vertex->z));
3291 >
3292        if(abs(value) < abs(minDistToVertex)) minDistToVertex = value;
3293      }
3294      double distToChosenVertex = sqrt((object->vx-chosenVertex()->x)*(object->vx-chosenVertex()->x) + \
3295 <                                     (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3296 <                                     (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3295 >                                     (object->vy-chosenVertex()->y)*(object->vy-chosenVertex()->y) + \
3296 >                                     (object->vz-chosenVertex()->z)*(object->vz-chosenVertex()->z));
3297  
3298      value = distToChosenVertex - minDistToVertex;
3299    }
# Line 3185 | Line 3304 | OSUAnalysis::valueLookup (const BNstop*
3304      for(BNprimaryvertexCollection::const_iterator vertex = primaryvertexs->begin (); vertex != primaryvertexs->end (); vertex++){
3305        vertex_rank++;
3306        int dist = sqrt((object->vx-vertex->x)*(object->vx-vertex->x) + \
3307 <                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3308 <                   (object->vz-vertex->z)*(object->vz-vertex->z));
3309 <      
3307 >                   (object->vy-vertex->y)*(object->vy-vertex->y) + \
3308 >                   (object->vz-vertex->z)*(object->vz-vertex->z));
3309 >
3310        if(abs(dist) < abs(minDistToVertex)){
3311 <        value = vertex_rank;
3312 <        minDistToVertex = dist;
3311 >        value = vertex_rank;
3312 >        minDistToVertex = dist;
3313        }
3314      }
3315    }
# Line 3198 | Line 3317 | OSUAnalysis::valueLookup (const BNstop*
3317  
3318  
3319  
3320 <  else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3320 >  else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
3321  
3322    value = applyFunction(function, value);
3323  
3324    return value;
3325  
3326 < }  
3326 > }
3327  
3328  
3329  
# Line 3256 | Line 3375 | OSUAnalysis::getTrkPtTrue (const BNtrack
3375  
3376   double
3377   OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) {
3378 <  // Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track.  
3379 <  if (!useTrackCaloRhoCorr_) return -99;  
3380 <  // if (!rhokt6CaloJetsHandle_) {
3381 <  //   cout << "ERROR [getTrkCaloTotRhoCorr]:  The collection rhokt6CaloJetsHandle is not available!" << endl;  
3382 <  //   return -99;  
3378 >  // Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track.
3379 >  if (!useTrackCaloRhoCorr_) return -99;
3380 >  // if (!rhokt6CaloJetsHandle_) {
3381 >  //   cout << "ERROR [getTrkCaloTotRhoCorr]:  The collection rhokt6CaloJetsHandle is not available!" << endl;
3382 >  //   return -99;
3383    // }
3384 <  double radDeltaRCone = 0.5;  
3385 <  double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2);  // Define effective area as pi*r^2, where r is radius of DeltaR cone.  
3386 <  double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5;  
3387 <  double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets);  
3388 <  return caloTotRhoCorrCalo;  
3389 <
3384 >  double radDeltaRCone = 0.5;
3385 >  double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2);  // Define effective area as pi*r^2, where r is radius of DeltaR cone.
3386 >  double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5;
3387 >  double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets);
3388 >  return caloTotRhoCorrCalo;
3389 >
3390   }
3391  
3392  
# Line 3305 | Line 3424 | OSUAnalysis::getTrkIsMatchedDeadEcal (co
3424    double deltaRLowest = 999;
3425    int value = 0;
3426    if (DeadEcalVec.size() == 0) WriteDeadEcal();
3427 <  for(std::vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){
3427 >  for(vector<DeadEcal>::const_iterator ecal = DeadEcalVec.begin(); ecal != DeadEcalVec.end(); ++ecal){
3428      double eta = ecal->etaEcal;
3429      double phi = ecal->phiEcal;
3430      double deltaRtemp = deltaR(eta, track1->eta, phi, track1->phi);
# Line 3316 | Line 3435 | OSUAnalysis::getTrkIsMatchedDeadEcal (co
3435    return value;
3436   }
3437  
3438 < // Returns the smallest DeltaR between the object and any generated true particle in the event.  
3438 > // Returns the smallest DeltaR between the object and any generated true particle in the event.
3439   template <class InputObject>
3440   double OSUAnalysis::getGenDeltaRLowest(InputObject object){
3441    double genDeltaRLowest = 999.;
# Line 3336 | Line 3455 | OSUAnalysis::applyFunction(string functi
3455    else if(function == "log") value = log10(value);
3456  
3457    else if(function == "") value = value;
3458 <  else{std::cout << "WARNING: invalid function '" << function << "'\n";}
3458 >  else{cout << "WARNING: invalid function '" << function << "'\n";}
3459  
3460    return value;
3461  
# Line 3345 | Line 3464 | OSUAnalysis::applyFunction(string functi
3464  
3465   template <class InputCollection>
3466   void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
3467 <
3468 <  if (currentCut.inputCollection.find("pair")!=std::string::npos)  {
3469 <    string obj1, obj2;
3467 >
3468 >  if (currentCut.inputCollection.find("pair")!=string::npos)  {
3469 >    string obj1, obj2;
3470      getTwoObjs(currentCut.inputCollection, obj1, obj2);
3471      if (inputType==obj1 ||
3472 <        inputType==obj2) {
3472 >          inputType==obj2) {
3473        // Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection,
3474 <      // and the inputType is a member of the pair.  
3475 <      // The cut will instead be applied when the setObjectFlags() is called for the paired collection.  
3476 <      // For example, if currentCut.inputCollection==electron-muon pairs,
3477 <      // then the flags should not be set here when inputType==muons or inputType==electrons.  
3478 <      return;
3479 <    }  
3480 <  }    
3474 >      // and the inputType is a member of the pair.
3475 >      // The cut will instead be applied when the setObjectFlags() is called for the paired collection.
3476 >      // For example, if currentCut.inputCollection==electron-muon pairs,
3477 >      // then the flags should not be set here when inputType==muons or inputType==electrons.
3478 >      return;
3479 >    }
3480 >  }
3481  
3482    for (uint object = 0; object != inputCollection->size(); object++){
3483  
# Line 3368 | Line 3487 | void OSUAnalysis::setObjectFlags(cut &cu
3487  
3488        vector<bool> subcutDecisions;
3489        for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){
3490 <        double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex));
3491 <        subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
3490 >        string stringValue = "";
3491 >        double value = valueLookup(&inputCollection->at(object), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue);
3492 >        if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
3493 >        else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex)));
3494  
3495        }
3496        if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0);
# Line 3408 | Line 3529 | void OSUAnalysis::setObjectFlags(cut &cu
3529    bool sameObjects = false;
3530    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3531  
3532 <  // Get the strings for the two objects that make up the pair.  
3533 <  string obj1Type, obj2Type;
3532 >  // Get the strings for the two objects that make up the pair.
3533 >  string obj1Type, obj2Type;
3534    getTwoObjs(inputType, obj1Type, obj2Type);
3535    bool isTwoTypesOfObject = true;
3536 <  if (obj1Type==obj2Type) isTwoTypesOfObject = false;  
3536 >  if (obj1Type==obj2Type) isTwoTypesOfObject = false;
3537  
3538 <  // Initialize the flags for individual objects to all be false, if the cut is on the pair.  
3539 <  // Set them to true later, if any paired object passes (in which case both of its constituents should pass).  
3540 <  if (currentCut.inputCollection == inputType) {    
3538 >  // Initialize the flags for individual objects to all be false, if the cut is on the pair.
3539 >  // Set them to true later, if any paired object passes (in which case both of its constituents should pass).
3540 >  if (currentCut.inputCollection == inputType) {
3541      for (uint object1 = 0; object1 != inputCollection1->size(); object1++) {
3542 <      individualFlags.at(obj1Type).at(currentCutIndex).push_back(false);
3542 >      individualFlags.at(obj1Type).at(currentCutIndex).push_back(false);
3543        cumulativeFlags.at(obj1Type).at(currentCutIndex).push_back(false);
3544      }
3545 <    if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first.  
3545 >    if (isTwoTypesOfObject) { // Only initialize the second object if it is different from the first.
3546        for (uint object2 = 0; object2 != inputCollection2->size(); object2++)  {
3547 <        individualFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3548 <        cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3547 >        individualFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3548 >        cumulativeFlags.at(obj2Type).at(currentCutIndex).push_back(false);
3549        }
3550      }
3551    }
3552 <  
3552 >
3553    int counter = 0;
3554  
3555    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
# Line 3443 | Line 3564 | void OSUAnalysis::setObjectFlags(cut &cu
3564  
3565          vector<bool> subcutDecisions;
3566          for( int subcutIndex = 0; subcutIndex != currentCut.numSubcuts; subcutIndex++){
3567 <          double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex));
3568 <          subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
3567 >          string stringValue = "";
3568 >          double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), currentCut.variables.at(subcutIndex), currentCut.functions.at(subcutIndex), stringValue);
3569 >          if (stringValue == "") subcutDecisions.push_back(evaluateComparison(value,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutValues.at(subcutIndex)));
3570 >          else subcutDecisions.push_back(evaluateComparison(stringValue,currentCut.comparativeOperators.at(subcutIndex),currentCut.cutStringValues.at(subcutIndex)));
3571          }
3572  
3573          if(currentCut.numSubcuts == 1) decision = subcutDecisions.at(0);
# Line 3459 | Line 3582 | void OSUAnalysis::setObjectFlags(cut &cu
3582            decision = tempDecision;
3583          }
3584        }
3585 <      // if (decision) isPassObj1.at(object1) = true;
3586 <      // if (decision) isPassObj2.at(object2) = true;
3587 <      individualFlags.at(inputType).at(currentCutIndex).push_back(decision);  
3588 <      if (decision && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on  
3589 <        individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true;  
3590 <        individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true;  
3591 <      }  
3585 >      // if (decision) isPassObj1.at(object1) = true;
3586 >      // if (decision) isPassObj2.at(object2) = true;
3587 >      individualFlags.at(inputType).at(currentCutIndex).push_back(decision);
3588 >      if (decision && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on
3589 >        individualFlags.at(obj1Type).at(currentCutIndex).at(object1) = true;
3590 >        individualFlags.at(obj2Type).at(currentCutIndex).at(object2) = true;
3591 >      }
3592  
3593        //set flags for objects that pass each cut AND all the previous cuts
3594        bool previousCumulativeFlag = true;
# Line 3480 | Line 3603 | void OSUAnalysis::setObjectFlags(cut &cu
3603        else if(flags2.size() == 0) currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1);
3604        else currentCumulativeFlag = previousCumulativeFlag && decision && flags1.at(object1) && flags2.at(object2);
3605        cumulativeFlags.at(inputType).at(currentCutIndex).push_back(currentCumulativeFlag);
3606 <      if (currentCumulativeFlag && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on  
3607 <        cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1);  
3608 <        cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2);  
3606 >      if (currentCumulativeFlag && currentCut.inputCollection == inputType) {  // only set the flags for the individual objects if the pair object is being cut on
3607 >        cumulativeFlags.at(obj1Type).at(currentCutIndex).at(object1) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj1Type, object1);
3608 >        cumulativeFlags.at(obj2Type).at(currentCutIndex).at(object2) = true && getPreviousCumulativeFlags(currentCutIndex, individualFlags, obj2Type, object2);
3609        }
3610        counter++;
3611  
# Line 3493 | Line 3616 | void OSUAnalysis::setObjectFlags(cut &cu
3616  
3617  
3618   bool OSUAnalysis::getPreviousCumulativeFlags(uint currentCutIndex, flagMap &individualFlags, string obj1Type, uint object1) {
3619 <  // Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for
3620 <  // all cuts up to currentCutIndex  
3621 <  bool previousCumulativeFlag = true;  
3622 <  for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) {  
3619 >  // Return true iff for the collection obj1Type, the element with index object1 has individal flags set to true for
3620 >  // all cuts up to currentCutIndex
3621 >  bool previousCumulativeFlag = true;
3622 >  for (uint previousCutIndex = 0; previousCutIndex < currentCutIndex; previousCutIndex++) {
3623      if (previousCumulativeFlag && individualFlags.at(obj1Type).at(previousCutIndex).at(object1)) previousCumulativeFlag = true;
3624 <    else {  
3625 <      previousCumulativeFlag = false; break;  
3624 >    else {
3625 >      previousCumulativeFlag = false; break;
3626      }
3627    }
3628 <  return previousCumulativeFlag;  
3629 < }  
3628 >  return previousCumulativeFlag;
3629 > }
3630  
3631  
3632   template <class InputCollection>
# Line 3516 | Line 3639 | void OSUAnalysis::fill1DHistogram(TH1* h
3639      string currentString = parameters.inputVariables.at(0);
3640      string inputVariable = "";
3641      string function = "";
3642 <    if(currentString.find("(")==std::string::npos){
3642 >    if(currentString.find("(")==string::npos){
3643        inputVariable = currentString;// variable to cut on
3644      }
3645      else{
# Line 3525 | Line 3648 | void OSUAnalysis::fill1DHistogram(TH1* h
3648        inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3649      }
3650  
3651 <    double value = valueLookup(&inputCollection->at(object), inputVariable, function);
3651 >    string stringValue = "";
3652 >    double value = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue);
3653      histo->Fill(value,scaleFactor);
3654  
3655      if (printEventInfo_) {
3656 <      // Write information about event to screen, for testing purposes.  
3657 <      cout << "  Info for event:  value for histogram " << histo->GetName() << ":  " << value << endl;  
3656 >      // Write information about event to screen, for testing purposes.
3657 >      cout << "  Info for event:  value for histogram " << histo->GetName() << ":  " << value << endl;
3658      }
3659 <    
3659 >
3660    }
3661   }
3662  
# Line 3557 | Line 3681 | void OSUAnalysis::fill1DHistogram(TH1* h
3681        string currentString = parameters.inputVariables.at(0);
3682        string inputVariable = "";
3683        string function = "";
3684 <      if(currentString.find("(")==std::string::npos){
3684 >      if(currentString.find("(")==string::npos){
3685          inputVariable = currentString;// variable to cut on
3686        }
3687        else{
# Line 3566 | Line 3690 | void OSUAnalysis::fill1DHistogram(TH1* h
3690          inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3691        }
3692  
3693 <      double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
3693 >      string stringValue = "";
3694 >      double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue);
3695        histo->Fill(value,scaleFactor);
3696  
3697      }
# Line 3582 | Line 3707 | void OSUAnalysis::fill2DHistogram(TH2* h
3707  
3708      if(!plotAllObjectsInPassingEvents_ && !flags.at(object)) continue;
3709  
3710 +    string stringValue = "";
3711      string currentString = parameters.inputVariables.at(0);
3712      string inputVariable = "";
3713      string function = "";
3714 <    if(currentString.find("(")==std::string::npos){
3714 >    if(currentString.find("(")==string::npos){
3715        inputVariable = currentString;// variable to cut on
3716      }
3717      else{
# Line 3593 | Line 3719 | void OSUAnalysis::fill2DHistogram(TH2* h
3719        inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
3720        inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3721      }
3722 <    double valueX = valueLookup(&inputCollection->at(object), inputVariable, function);
3722 >    double valueX = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue);
3723  
3724      currentString = parameters.inputVariables.at(1);
3725      inputVariable = "";
3726      function = "";
3727 <    if(currentString.find("(")==std::string::npos){
3727 >    if(currentString.find("(")==string::npos){
3728        inputVariable = currentString;// variable to cut on
3729      }
3730      else{
# Line 3607 | Line 3733 | void OSUAnalysis::fill2DHistogram(TH2* h
3733        inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3734      }
3735  
3736 <    double valueY = valueLookup(&inputCollection->at(object), inputVariable, function);
3736 >    double valueY = valueLookup(&inputCollection->at(object), inputVariable, function, stringValue);
3737  
3738      histo->Fill(valueX,valueY,scaleFactor);
3739  
# Line 3634 | Line 3760 | void OSUAnalysis::fill2DHistogram(TH2* h
3760        if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
3761        if(!plotAllObjectsInPassingEvents_ && !pairFlags.at(pairCounter)) continue;
3762  
3763 +      string stringValue = "";
3764        string currentString = parameters.inputVariables.at(0);
3765        string inputVariable = "";
3766        string function = "";
3767 <      if(currentString.find("(")==std::string::npos){
3767 >      if(currentString.find("(")==string::npos){
3768          inputVariable = currentString;// variable to cut on
3769        }
3770        else{
# Line 3645 | Line 3772 | void OSUAnalysis::fill2DHistogram(TH2* h
3772          inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
3773          inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3774        }
3775 <      double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
3775 >      double valueX = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue);
3776  
3777        currentString = parameters.inputVariables.at(1);
3778        inputVariable = "";
3779        function = "";
3780 <      if(currentString.find("(")==std::string::npos){
3780 >      if(currentString.find("(")==string::npos){
3781          inputVariable = currentString;// variable to cut on
3782        }
3783        else{
# Line 3658 | Line 3785 | void OSUAnalysis::fill2DHistogram(TH2* h
3785          inputVariable = currentString.substr(currentString.find("(")+1);//get rest of string
3786          inputVariable = inputVariable.substr(0,inputVariable.size()-1);//remove trailing ")"
3787        }
3788 <      double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
3788 >      double valueY = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function, stringValue);
3789  
3790  
3791        histo->Fill(valueX,valueY,scaleFactor);
# Line 3679 | Line 3806 | int OSUAnalysis::getGenMatchedParticleIn
3806  
3807      double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi);
3808      if(currentDeltaR > 0.05) continue;
3809 <    //     cout << std::setprecision(3) << std::setw(20)
3809 >    //     cout << setprecision(3) << setw(20)
3810      //          << "\tcurrentParticle:  eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta
3811 <    //          << std::setw(20)
3811 >    //          << setw(20)
3812      //          << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi
3813 <    //          << std::setw(20)
3813 >    //          << setw(20)
3814      //          << "\tdeltaR = " << currentDeltaR
3815 <    //          << std::setprecision(1)
3816 <    //          << std::setw(20)
3815 >    //          << setprecision(1)
3816 >    //          << setw(20)
3817      //          << "\tid = " << mcparticles->at(mcparticle - mcparticles->begin()).id
3818 <    //          << std::setw(20)
3818 >    //          << setw(20)
3819      //          << "\tmotherId = " << mcparticles->at(mcparticle - mcparticles->begin()).motherId
3820 <    //          << std::setw(20)
3820 >    //          << setw(20)
3821      //          << "\tstatus = " << mcparticles->at(mcparticle - mcparticles->begin()).status<< endl;
3822      if(currentDeltaR < bestMatchDeltaR && mcparticles->at(mcparticle - mcparticles->begin()).id != mcparticles->at(mcparticle - mcparticles->begin()).motherId){
3823        bestMatchIndex = mcparticle - mcparticles->begin();
# Line 3788 | Line 3915 | const BNprimaryvertex *
3915   OSUAnalysis::chosenVertex ()
3916   {
3917    const BNprimaryvertex *chosenVertex = 0;
3918 <  if(std::find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) {
3918 >  if(find(objectsToCut.begin(), objectsToCut.end(), "primaryvertexs") != objectsToCut.end()) {
3919      vector<bool> vertexFlags;
3920      for (int i = cumulativeFlags.at("primaryvertexs").size() - 1; i >= 0; i--){
3921        if (cumulativeFlags.at("primaryvertexs").at(i).size()){
# Line 3813 | Line 3940 | const BNmet *
3940   OSUAnalysis::chosenMET ()
3941   {
3942    const BNmet *chosenMET = 0;
3943 <  if(std::find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) {
3943 >  if(find(objectsToCut.begin(), objectsToCut.end(), "mets") != objectsToCut.end()) {
3944      vector<bool> metFlags;
3945      for (int i = cumulativeFlags.at("mets").size() - 1; i >= 0; i--){
3946        if (cumulativeFlags.at("mets").at(i).size()){
# Line 3838 | Line 3965 | const BNelectron *
3965   OSUAnalysis::chosenElectron ()
3966   {
3967    const BNelectron *chosenElectron = 0;
3968 <  if(std::find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) {
3968 >  if(find(objectsToCut.begin(), objectsToCut.end(), "electrons") != objectsToCut.end()) {
3969      vector<bool> electronFlags;
3970      for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){
3971        if (cumulativeFlags.at("electrons").at(i).size()){
# Line 3863 | Line 3990 | const BNmuon *
3990   OSUAnalysis::chosenMuon ()
3991   {
3992    const BNmuon *chosenMuon = 0;
3993 <  if(std::find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) {
3993 >  if(find(objectsToCut.begin(), objectsToCut.end(), "muons") != objectsToCut.end()) {
3994      vector<bool> muonFlags;
3995      for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){
3996        if (cumulativeFlags.at("muons").at(i).size()){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines