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.43 by wulsin, Thu Mar 28 10:17:32 2013 UTC vs.
Revision 1.48 by lantonel, Tue Apr 16 16:30:19 2013 UTC

# Line 11 | Line 11 | OSUAnalysis::OSUAnalysis (const edm::Par
11    tracks_ (cfg.getParameter<edm::InputTag> ("tracks")),
12    genjets_ (cfg.getParameter<edm::InputTag> ("genjets")),
13    mcparticles_ (cfg.getParameter<edm::InputTag> ("mcparticles")),
14 +  stops_ (cfg.getParameter<edm::InputTag> ("stops")),
15    primaryvertexs_ (cfg.getParameter<edm::InputTag> ("primaryvertexs")),
16    bxlumis_ (cfg.getParameter<edm::InputTag> ("bxlumis")),
17    photons_ (cfg.getParameter<edm::InputTag> ("photons")),
# Line 29 | Line 30 | OSUAnalysis::OSUAnalysis (const edm::Par
30    plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")),
31    doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")),
32    printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")),
33 <  useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr"))
33 >  useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr")),
34 >  stopCTau_ (cfg.getParameter<vector<double> > ("stopCTau"))
35  
36   {
37  
# Line 41 | Line 43 | OSUAnalysis::OSUAnalysis (const edm::Par
43      //    muonSFWeight_ = new MuonSFWeight (muonSFFile_, muonSF_);
44      //    electronSFWeight_ = new ElectronSFWeight ("53X", electronSFID_);
45    }
46 + #ifdef DISPLACED_SUSY
47 +  if (datasetType_ == "signalMC")
48 +    cTauWeight_ = new CTauWeight (stopCTau_.at (0), stopCTau_.at (1), stops_);
49 + #endif
50  
51  
52    // Construct Cutflow Objects. These store the results of cut decisions and
# Line 51 | Line 57 | OSUAnalysis::OSUAnalysis (const edm::Par
57    //always get vertex collection so we can assign the primary vertex in the event
58    objectsToGet.push_back("primaryvertexs");
59  
60 <  //always make the plot of number of primary verticex (to check pile-up reweighting)
60 >  //always make the plot of number of primary vertices (to check pile-up reweighting)
61    objectsToPlot.push_back("primaryvertexs");
62  
63    //always get the MC particles to do GEN-matching
# Line 66 | Line 72 | OSUAnalysis::OSUAnalysis (const edm::Par
72      string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection");
73      if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs";
74      if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
75 +    if(tempInputCollection == "secondary muon-muon pairs")   tempInputCollection = "muon-secondary muon pairs";
76      if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
77 <      objectsToGet.push_back(tempInputCollection);
77 >      if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
78 >        int spaceIndex = tempInputCollection.find(" ");
79 >        int secondWordLength = tempInputCollection.size() - spaceIndex;
80 >        objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
81 >      }
82 >      else{
83 >        objectsToGet.push_back(tempInputCollection);
84 >      }
85        objectsToPlot.push_back(tempInputCollection);
86        objectsToCut.push_back(tempInputCollection);
87      }
88 <    else{//pair of objects, need to add them both to the things to objectsToGet
88 >    else{//pair of objects, need to add the pair and the individual objects to the lists of things to Get/Plot/Cut
89        int dashIndex = tempInputCollection.find("-");
90 <      int spaceIndex = tempInputCollection.find(" ");
90 >      int spaceIndex = tempInputCollection.find_last_of(" ");
91        int secondWordLength = spaceIndex - dashIndex;
92        objectsToGet.push_back(tempInputCollection);
93        objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
94 <      objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
94 >      if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
95 >        int firstSpaceIndex = tempInputCollection.find_first_of(" ");
96 >        int splitWordLength = spaceIndex - firstSpaceIndex;
97 >        objectsToGet.push_back(tempInputCollection.substr(firstSpaceIndex,splitWordLength-1)+"s");
98 >      }
99 >      else{
100 >        objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
101 >      }
102        objectsToPlot.push_back(tempInputCollection);
103        objectsToPlot.push_back(tempInputCollection.substr(0,dashIndex)+"s");
104        objectsToPlot.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
# Line 112 | Line 133 | OSUAnalysis::OSUAnalysis (const edm::Par
133    for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
134  
135      string currentObject = objectsToPlot.at(currentObjectIndex);
136 <    if(currentObject != "muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue;
136 >    if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "superclusters") continue;
137  
138      histogram tempIdHisto;
139      histogram tempMomIdHisto;
# Line 124 | Line 145 | OSUAnalysis::OSUAnalysis (const edm::Par
145      tempGmaIdHisto.inputCollection = currentObject;
146      tempIdVsMomIdHisto.inputCollection = currentObject;
147  
148 +    if(currentObject == "secondary muons") currentObject = "secondaryMuons";
149 +
150      currentObject = currentObject.substr(0, currentObject.size()-1);
151      tempIdHisto.name = currentObject+"GenMatchId";
152      tempMomIdHisto.name = currentObject+"GenMatchMotherId";
# Line 300 | Line 323 | OSUAnalysis::OSUAnalysis (const edm::Par
323        int maxNum = 10;
324        if(currentObject == "mcparticles") maxNum = 50;
325        else if(currentObject == "primaryvertexs") maxNum = 50;
326 <      else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs";
327 <      else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs";
328 <      else if(currentObject == "electron-muon pairs")     currentObject = "electronMuonPairs";
329 <      else if(currentObject == "track-event pairs")       currentObject = "trackEventPairs";
330 <      else if(currentObject == "electron-track pairs")    currentObject = "electronTrackPairs";  
331 <      else if(currentObject == "muon-track pairs")        currentObject = "muonTrackPairs";      
332 <      else if(currentObject == "muon-tau pairs")          currentObject = "muonTauPairs";        
333 <      else if(currentObject == "tau-tau pairs")           currentObject = "ditauPairs";
326 >
327 >      if(currentObject == "muon-muon pairs")                currentObject = "dimuonPairs";
328 >      else if(currentObject == "electron-electron pairs")   currentObject = "dielectronPairs";
329 >      else if(currentObject == "electron-muon pairs")       currentObject = "electronMuonPairs";
330 >      else if(currentObject == "track-event pairs")         currentObject = "trackEventPairs";
331 >      else if(currentObject == "electron-track pairs")      currentObject = "electronTrackPairs";        
332 >      else if(currentObject == "muon-track pairs")          currentObject = "muonTrackPairs";    
333 >      else if(currentObject == "muon-tau pairs")            currentObject = "muonTauPairs";      
334 >      else if(currentObject == "tau-tau pairs")             currentObject = "ditauPairs";
335 >      else if(currentObject == "tau-track pairs")           currentObject = "tauTrackPairs";
336 >      else if(currentObject == "muon-secondary muon pairs") currentObject = "muonSecondaryMuonPairs";
337 >      else if(currentObject == "secondary muons")           currentObject = "secondaryMuons";
338 >
339        currentObject.at(0) = toupper(currentObject.at(0));  
340        string histoName = "num" + currentObject;
341  
# Line 334 | Line 362 | OSUAnalysis::OSUAnalysis (const edm::Par
362        string tempInputCollection = cuts_.at(currentCut).getParameter<string> ("inputCollection");
363        tempCut.inputCollection = tempInputCollection;
364        if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
365 <        objectsToGet.push_back(tempInputCollection);
366 <        objectsToCut.push_back(tempInputCollection);
365 >        if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
366 >          int spaceIndex = tempInputCollection.find(" ");
367 >          int secondWordLength = tempInputCollection.size() - spaceIndex;
368 >          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
369 >        }
370 >        else{
371 >          objectsToGet.push_back(tempInputCollection);
372 >        }
373 >        objectsToCut.push_back(tempInputCollection);
374        }
375        else{//pair of objects, need to add them both to the things to objectsToGet
376          int dashIndex = tempInputCollection.find("-");
377 <        int spaceIndex = tempInputCollection.find(" ");
377 >        int spaceIndex = tempInputCollection.find_last_of(" ");
378          int secondWordLength = spaceIndex - dashIndex;
379          objectsToGet.push_back(tempInputCollection);
380          objectsToGet.push_back(tempInputCollection.substr(0,dashIndex)+"s");
381 <        objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
381 >        if(tempInputCollection.find("secondary")!=std::string::npos){//secondary object
382 >          int firstSpaceIndex = tempInputCollection.find_first_of(" ");
383 >          int splitWordLength = spaceIndex - firstSpaceIndex;
384 >          objectsToGet.push_back(tempInputCollection.substr(firstSpaceIndex+1,splitWordLength-1)+"s");
385 >        }
386 >        else{
387 >          objectsToGet.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
388 >        }
389          objectsToCut.push_back(tempInputCollection);
390          objectsToCut.push_back(tempInputCollection.substr(0,dashIndex)+"s");
391          objectsToCut.push_back(tempInputCollection.substr(dashIndex+1,secondWordLength-1)+"s");
# Line 403 | Line 445 | OSUAnalysis::OSUAnalysis (const edm::Par
445        }
446        tempCut.name = tempCutName;
447  
406
448        tempChannel.cuts.push_back(tempCut);
449  
450  
410
451      }//end loop over cuts
452  
453      channels.push_back(tempChannel);
# Line 497 | Line 537 | OSUAnalysis::analyze (const edm::Event &
537    if(doPileupReweighting_ && datasetType_ != "data")
538      scaleFactor = puWeight_->at (events->at (0).numTruePV);
539  
540 +  cTauScaleFactor_ = 1.0;
541 + #ifdef DISPLACED_SUSY
542 +  if (datasetType_ == "signalMC")
543 +    cTauScaleFactor_ = cTauWeight_->at (event);
544 + #endif
545 +  scaleFactor *= cTauScaleFactor_;
546  
547    //loop over all channels
548  
# Line 535 | Line 581 | OSUAnalysis::analyze (const edm::Event &
581  
582  
583          if(currentObject == "jets") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"jets");
584 +
585          else if(currentObject == "muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
586 +
587 +        else if(currentObject == "secondary muons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons");
588          else if(currentObject == "electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
589          else if(currentObject == "events") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
590          else if(currentObject == "taus") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),"taus");
# Line 553 | Line 602 | OSUAnalysis::analyze (const edm::Event &
602                                                                     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
603                                                                     cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
604                                                                     "muon-muon pairs");
605 +
606 +        else if(currentObject == "muon-secondary muon pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), \
607 +                                                                   cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
608 +                                                                   cumulativeFlags.at("secondary muons").at(flagsForPairCutsIndex), \
609 +                                                                   "muon-secondary muon pairs");
610 +
611          else if(currentObject == "electron-electron pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),electrons.product(), \
612                                                                             cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
613                                                                             cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
# Line 577 | Line 632 | OSUAnalysis::analyze (const edm::Event &
632                                                                    cumulativeFlags.at("muons").at(flagsForPairCutsIndex),
633                                                                    cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
634                                                                    "muon-tau pairs");
635 <        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),taus.product(),
635 >        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),
636                                                                   cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
637                                                                   cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
638                                                                   "tau-tau pairs");
639 +        else if(currentObject == "tau-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),
640 +                                                                 cumulativeFlags.at("taus").at(flagsForPairCutsIndex),
641 +                                                                 cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
642 +                                                                 "tau-track pairs");
643          
644          
645        }
# Line 598 | Line 657 | OSUAnalysis::analyze (const edm::Event &
657      eventPassedAllCuts = eventPassedAllCuts && triggerDecision;
658  
659  
601
660      for(uint currentCutIndex = 0; currentCutIndex != currentChannel.cuts.size(); currentCutIndex++){
661  
662        //loop over all objects and count how many passed the cumulative selection up to this point
# Line 608 | Line 666 | OSUAnalysis::analyze (const edm::Event &
666        for (uint object = 0; object != cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).size() ; object++){
667          if(cumulativeFlags.at(currentCut.inputCollection).at(currentCutIndex).at(object)) numberPassing++;
668        }
611
669        bool cutDecision = evaluateComparison(numberPassing,currentCut.eventComparativeOperator,currentCut.numberRequired);
670        cutFlows_.at(currentChannelIndex)->at (currentCut.name) = cutDecision;
614
671        eventPassedAllCuts = eventPassedAllCuts && cutDecision;
616
672      }
673  
674 +    //     if(datasetType_ != "data") {
675 +    //       scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta);
676 +    //       scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
677 +    //     }
678 +
679      cutFlows_.at(currentChannelIndex)->fillCutFlow(scaleFactor);
680  
681  
# Line 632 | Line 692 | OSUAnalysis::analyze (const edm::Event &
692      }
693  
694  
635    //     if(datasetType_ != "data") {
636    //       scaleFactor *= muonSFWeight_->at (chosenMuon ()->eta);
637    //       scaleFactor *= electronSFWeight_->at (chosenElectron ()->eta, chosenElectron ()->pt);
638    //     }
639
695      //filling histograms
696      for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){
697        histogram currentHistogram = histograms.at(histogramIndex);
# Line 645 | Line 700 | OSUAnalysis::analyze (const edm::Event &
700          TH1D* histo;
701          histo = oneDHists_.at(currentChannelIndex).at(currentHistogram.name);
702  
648
649
703          if(currentHistogram.inputCollection == "jets") fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor);
704          else if(currentHistogram.inputCollection == "muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
705 +        else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
706          else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
707                                                                                         cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
708                                                                                         cumulativeFlags.at("muon-muon pairs").back(),scaleFactor);
709 +        else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
710 +                                                                                       cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \
711 +                                                                                       cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor);
712          else if(currentHistogram.inputCollection == "electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor);
713          else if(currentHistogram.inputCollection == "electron-electron pairs") fill1DHistogram(histo,currentHistogram,electrons.product(),electrons.product(),\
714                                                                                                 cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(),\
# Line 671 | Line 728 | OSUAnalysis::analyze (const edm::Event &
728          else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(),      
729                                                                                       cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
730                                                                                       cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
731 +        else if(currentHistogram.inputCollection == "tau-track pairs") fill1DHistogram(histo,currentHistogram, taus.product(),tracks.product(),
732 +                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
733 +                                                                                     cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
734 +
735          else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
736          else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
737          else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
# Line 686 | Line 747 | OSUAnalysis::analyze (const edm::Event &
747          TH2D* histo;
748          histo = twoDHists_.at(currentChannelIndex).at(currentHistogram.name);
749  
689
690
750          if(currentHistogram.inputCollection == "jets") fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("jets").back(),scaleFactor);
751          else if(currentHistogram.inputCollection == "muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").back(),scaleFactor);
752 +        else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").back(),scaleFactor);
753          else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
754                                                                                         cumulativeFlags.at("muons").back(),cumulativeFlags.at("muons").back(), \
755                                                                                         cumulativeFlags.at("muon-muon pairs").back(),scaleFactor);
756 +        else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(), \
757 +                                                                                       cumulativeFlags.at("muons").back(),cumulativeFlags.at("secondary muons").back(), \
758 +                                                                                       cumulativeFlags.at("muon-secondary muon pairs").back(),scaleFactor);
759          else if(currentHistogram.inputCollection == "electrons") fill2DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("electrons").back(),scaleFactor);
760          else if(currentHistogram.inputCollection == "electron-electron pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),electrons.product(), \
761                                                                                                 cumulativeFlags.at("electrons").back(),cumulativeFlags.at("electrons").back(), \
# Line 712 | Line 775 | OSUAnalysis::analyze (const edm::Event &
775          else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(),      
776                                                                                       cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),        
777                                                                                       cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);    
778 +        else if(currentHistogram.inputCollection == "tau-track pairs") fill2DHistogram(histo,currentHistogram,taus.product(),tracks.product(),
779 +                                                                                     cumulativeFlags.at("taus").back(),cumulativeFlags.at("tracks").back(),
780 +                                                                                     cumulativeFlags.at("tau-track pairs").back(),scaleFactor);
781          else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
782          else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
783          else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
# Line 728 | Line 794 | OSUAnalysis::analyze (const edm::Event &
794        }
795      }
796  
797 +
798 +
799      //fills histograms with the sizes of collections
800      for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
801  
# Line 743 | Line 811 | OSUAnalysis::analyze (const edm::Event &
811        else if(currentObject == "muon-track pairs")        objectToPlot = "muonTrackPairs";      
812        else if(currentObject == "muon-tau pairs")          objectToPlot = "muonTauPairs";        
813        else if(currentObject == "tau-tau pairs")           objectToPlot = "ditauPairs";
814 +      else if(currentObject == "tau-track pairs")         objectToPlot = "tauTrackPairs";
815        else if(currentObject == "track-event pairs")       objectToPlot = "trackEventPairs";  
816 +      else if(currentObject == "muon-secondary muon pairs")       objectToPlot = "muonSecondaryMuonPairs";  
817 +      else if(currentObject == "secondary muons")         objectToPlot = "secondaryMuons";  
818        else objectToPlot = currentObject;
819 +
820        string tempCurrentObject = objectToPlot;
821        tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));  
822        string histoName = "num" + tempCurrentObject;
823  
752
824        //set position of primary vertex in event, in order to calculate quantities relative to it
825        if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
826          vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back();
827 <        int numToPlot = 0;
827 >        int numToPlot = 0;
828          for (uint currentFlag = 0; currentFlag != lastCutFlags.size(); currentFlag++){
829            if(lastCutFlags.at(currentFlag)) numToPlot++;
830          }
# Line 767 | Line 838 | OSUAnalysis::analyze (const edm::Event &
838        }
839        else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor);
840        else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
841 +      else if(objectToPlot == "secondaryMuons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
842        else if(objectToPlot == "dimuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor);
843 +      else if(objectToPlot == "muonSecondaryMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size()*(muons->size()-1)/2,scaleFactor);
844        else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor);
845        else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor);
846        else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor);
# Line 1789 | Line 1862 | OSUAnalysis::valueLookup (const BNevent*
1862      else
1863        value = 1.0;
1864    }
1865 +  else if(variable == "cTauScaleFactor")
1866 +    value = cTauScaleFactor_;
1867  
1868    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1869  
# Line 2002 | Line 2077 | OSUAnalysis::valueLookup (const BNtrack*
2077    else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz;
2078    else if(variable == "caloTotDeltaRp5")            value =  (object->caloHadDeltaRp5 + object->caloEMDeltaRp5);
2079    else if(variable == "caloTotDeltaRp5ByP")         value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag);
2080 <  else if(variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object);  
2081 <  else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag;  
2080 >  else if(variable == "caloTotDeltaRp5RhoCorr")     value = getTrkCaloTotRhoCorr(object);  
2081 >  else if(variable == "caloTotDeltaRp5ByPRhoCorr")  value = getTrkCaloTotRhoCorr(object) / pMag;  
2082    else if(variable == "isIso")                      value = getTrkIsIso(object, tracks.product());
2083    else if(variable == "isMatchedDeadEcal")          value = getTrkIsMatchedDeadEcal(object);
2084    else if(variable == "ptErrorByPt")                value = (object->ptError/object->pt);
# Line 2427 | Line 2502 | OSUAnalysis::valueLookup (const BNmuon*
2502    double value = 0.0;
2503  
2504    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2505 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2506    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2507    else if(variable == "invMass"){
2508      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2496 | Line 2572 | OSUAnalysis::valueLookup (const BNelectr
2572    double value = 0.0;
2573  
2574    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2575 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2576    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2577    else if(variable == "invMass"){
2578      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2550 | Line 2627 | OSUAnalysis::valueLookup (const BNelectr
2627    double value = 0.0;
2628  
2629    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2630 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2631    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2632    else if(variable == "invMass"){
2633      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2596 | Line 2674 | OSUAnalysis::valueLookup (const BNelectr
2674    else if(variable == "muonDetIso"){
2675      value = (object2->trackIsoDR03) / object2->pt;
2676    }
2677 <
2677 >  else if(variable == "electronRelPFrhoIso"){
2678 >    value = ( object1->chargedHadronIsoDR03 + max(0.0, object1->neutralHadronIsoDR03 + object1->photonIsoDR03 - object1->AEffDr03*object1->rhoPrime) ) / object1->pt;
2679 >  }
2680 >  else if(variable == "muonRelPFdBetaIso"){
2681 >    value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt;
2682 >  }
2683  
2684    else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2685  
# Line 2613 | Line 2696 | OSUAnalysis::valueLookup (const BNelectr
2696    TLorentzVector fourVector1(0, 0, 0, 0);        
2697    TLorentzVector fourVector2(0, 0, 0, 0);        
2698    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));  
2699 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2700    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);    
2701    else if(variable == "invMass"){        
2702      fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);    
# Line 2635 | Line 2719 | OSUAnalysis::valueLookup (const BNmuon*
2719    TLorentzVector fourVector1(0, 0, 0, 0);
2720    TLorentzVector fourVector2(0, 0, 0, 0);
2721    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2722 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2723    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2724    else if(variable == "invMass"){
2725      fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass);
# Line 2653 | Line 2738 | double
2738   OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){
2739    double value = 0.0;
2740    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2741 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2742    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2743    else if(variable == "invMass"){
2744      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2670 | Line 2756 | double
2756   OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){
2757    double value = 0.0;
2758    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2759 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
2760    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2761    else if(variable == "invMass"){
2762      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
# Line 2682 | Line 2769 | OSUAnalysis::valueLookup (const BNmuon*
2769    return value;
2770   }
2771  
2772 + double
2773 + OSUAnalysis::valueLookup (const BNtau* object1, const BNtrack* object2, string variable, string function){
2774 +  double value = 0.0;
2775 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2776 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2777 +
2778 +  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2779 +  value = applyFunction(function, value);
2780 +  return value;
2781 + }
2782 +
2783 +
2784  
2785   double
2786   OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){
# Line 2840 | Line 2939 | OSUAnalysis::applyFunction(string functi
2939  
2940   template <class InputCollection>
2941   void OSUAnalysis::setObjectFlags(cut &currentCut, uint currentCutIndex, flagMap &individualFlags, flagMap &cumulativeFlags, InputCollection inputCollection, string inputType){
2942 <
2844 <
2942 >
2943    for (uint object = 0; object != inputCollection->size(); object++){
2944  
2945  
2946      bool decision = true;//object passes if this cut doesn't cut on that type of object
2947  
2850
2948      if(currentCut.inputCollection == inputType){
2949  
2950        vector<bool> subcutDecisions;
# Line 2983 | Line 3080 | void OSUAnalysis::fill1DHistogram(TH1* h
3080    bool sameObjects = false;
3081    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3082  
3083 <  int pairCounter = 0;
3083 >  int pairCounter = -1;
3084    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3085      for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3086  
3087        if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
3088  
3089 +      pairCounter++;
3090        //only take objects which have passed all cuts and pairs which have passed all cuts
3091        if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
3092        if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
# Line 3009 | Line 3107 | void OSUAnalysis::fill1DHistogram(TH1* h
3107        double value = valueLookup(&inputCollection1->at(object1), &inputCollection2->at(object2), inputVariable, function);
3108        histo->Fill(value,scaleFactor);
3109  
3110 <      pairCounter++;
3110 >
3111      }
3112    }
3113  
# Line 3062 | Line 3160 | void OSUAnalysis::fill2DHistogram(TH2* h
3160    bool sameObjects = false;
3161    if(typeid(InputCollection1).name() == typeid(InputCollection2).name()) sameObjects = true;
3162  
3163 <  int pairCounter = 0;
3163 >  int pairCounter = -1;
3164    for (uint object1 = 0; object1 != inputCollection1->size(); object1++){
3165      for (uint object2 = 0; object2 != inputCollection2->size(); object2++){
3166  
3167        if(sameObjects && object1 >= object2) continue;//account for duplicate pairs if both collections are the same
3168  
3169 +      pairCounter++;
3170 +
3171        //only take objects which have passed all cuts and pairs which have passed all cuts
3172        if(!plotAllObjectsInPassingEvents_ && !flags1.at(object1)) continue;
3173        if(!plotAllObjectsInPassingEvents_ && !flags2.at(object2)) continue;
# Line 3102 | Line 3202 | void OSUAnalysis::fill2DHistogram(TH2* h
3202  
3203        histo->Fill(valueX,valueY,scaleFactor);
3204  
3105      pairCounter++;
3106
3205      }
3206    }
3207  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines