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.111 by wulsin, Thu Jul 25 12:24:27 2013 UTC vs.
Revision 1.122 by jbrinson, Fri Aug 9 11:12:33 2013 UTC

# Line 3 | Line 3 | OSUAnalysis::OSUAnalysis (const edm::Par
3    // Retrieve parameters from the configuration file.
4    jets_ (cfg.getParameter<edm::InputTag> ("jets")),
5    muons_ (cfg.getParameter<edm::InputTag> ("muons")),
6 +  secMuons_ (cfg.getParameter<edm::InputTag> ("secMuons")),
7    electrons_ (cfg.getParameter<edm::InputTag> ("electrons")),
8    events_ (cfg.getParameter<edm::InputTag> ("events")),
9    taus_ (cfg.getParameter<edm::InputTag> ("taus")),
# Line 126 | Line 127 | OSUAnalysis::OSUAnalysis (const edm::Par
127      if(tempInputCollection == "trigobj-muon pairs")   tempInputCollection = "muon-trigobj pairs";
128      if(tempInputCollection.find("pairs")==string::npos){ //just a single object
129        if(tempInputCollection.find("secondary")!=string::npos){//secondary object
130 <        int spaceIndex = tempInputCollection.find(" ");
131 <        int secondWordLength = tempInputCollection.size() - spaceIndex;
132 <        objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
133 <      }
134 <      else{
130 >        if(tempInputCollection.find("secondary muons")!=string::npos){//treat secondary muons differently; allow for a different input collection
131 >          objectsToGet.push_back("secondary muons");  
132 >        } else {
133 >          int spaceIndex = tempInputCollection.find(" ");
134 >          int secondWordLength = tempInputCollection.size() - spaceIndex;
135 >          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
136 >        }
137 >      } else{
138          objectsToGet.push_back(tempInputCollection);
139        }
140        objectsToPlot.push_back(tempInputCollection);
# Line 170 | Line 174 | OSUAnalysis::OSUAnalysis (const edm::Par
174        tempHistogram.variableBinsY = histogramList_.at(currentHistogram).getUntrackedParameter<vector<double> >("variableBinsY", defaultValue);
175        tempHistogram.inputVariables = histogramList_.at(currentHistogram).getParameter<vector<string> >("inputVariables");
176  
177 <      histograms.push_back(tempHistogram);
177 >      bool histExists = false;
178 >      for (uint i=0; i<histograms.size(); i++) {
179 >        if (histograms.at(i).name == tempHistogram.name) { histExists = true; break; }
180 >      }  
181 >      if (histExists) {
182 >        clog << "Warning:  histogram " << tempHistogram.name << " already exists; will not book an additional instance." << endl;  
183 >      } else {
184 >        histograms.push_back(tempHistogram);
185 >      }
186  
187      }
188    } //   for(uint currentHistogramSet = 0; currentHistogramSet != histogramSets_.size(); currentHistogramSet++)
# Line 185 | Line 197 | OSUAnalysis::OSUAnalysis (const edm::Par
197    for(uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
198  
199      string currentObject = objectsToPlot.at(currentObjectIndex);
200 <    if(currentObject != "muons" && currentObject != "secondary muons" && currentObject != "secondary electrons" && currentObject != "electrons" && currentObject != "taus" && currentObject != "tracks" && currentObject != "photons" && currentObject != "secondary photons"&& currentObject != "superclusters") continue;
200 >    if(currentObject != "muons" &&
201 >       currentObject != "secondary muons" &&
202 >       currentObject != "secondary electrons" &&
203 >       currentObject != "electrons" &&
204 >       currentObject != "taus" &&
205 >       currentObject != "tracks" &&
206 >       currentObject != "photons" &&
207 >       currentObject != "secondary photons"&&
208 >       currentObject != "superclusters")
209 >      continue;
210  
211      histogram tempIdHisto;
212      histogram tempMomIdHisto;
# Line 317 | Line 338 | OSUAnalysis::OSUAnalysis (const edm::Par
338        tempCut.inputCollection = tempInputCollection;
339        if(tempInputCollection.find("pairs")==string::npos){ //just a single object
340          if(tempInputCollection.find("secondary")!=string::npos){//secondary object
341 <          int spaceIndex = tempInputCollection.find(" ");
342 <          int secondWordLength = tempInputCollection.size() - spaceIndex;
343 <          objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
341 >          if(tempInputCollection.find("secondary muons")!=string::npos){//treat secondary muons differently; allow for a different input collection
342 >            objectsToGet.push_back("secondary muons");  
343 >          } else {
344 >            int spaceIndex = tempInputCollection.find(" ");
345 >            int secondWordLength = tempInputCollection.size() - spaceIndex;
346 >            objectsToGet.push_back(tempInputCollection.substr(spaceIndex+1,secondWordLength));
347 >          }
348          }
349          else{
350            objectsToGet.push_back(tempInputCollection);
# Line 606 | Line 631 | OSUAnalysis::OSUAnalysis (const edm::Par
631          else if(currentObject == "track-event pairs")         currentObject = "trackEventPairs";
632          else if(currentObject == "electron-track pairs")      currentObject = "electronTrackPairs";
633          else if(currentObject == "muon-track pairs")          currentObject = "muonTrackPairs";
634 +        else if(currentObject == "secondary muon-track pairs") currentObject = "secondaryMuonTrackPairs";
635          else if(currentObject == "muon-tau pairs")            currentObject = "muonTauPairs";
636          else if(currentObject == "tau-tau pairs")             currentObject = "ditauPairs";
637          else if(currentObject == "tau-track pairs")           currentObject = "tauTrackPairs";
# Line 615 | Line 641 | OSUAnalysis::OSUAnalysis (const edm::Par
641          else if(currentObject == "secondary electrons")       currentObject = "secondaryElectrons";
642          else if(currentObject == "electron-trigobj pairs")    currentObject = "electronTrigobjPairs";
643          else if(currentObject == "muon-trigobj pairs")        currentObject = "muonTrigobjPairs";
644 +        else if(currentObject == "electron-mcparticle pairs")   currentObject = "electronMCparticlePairs";
645 +
646  
647          currentObject.at(0) = toupper(currentObject.at(0));
648          string histoName = "num" + currentObject;
# Line 769 | Line 797 | OSUAnalysis::produce (edm::Event &event,
797  
798    if (verbose_) clog << "Beginning OSUAnalysis::produce." << endl;  
799  
800 <  if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end())
800 >  if (find(objectsToGet.begin(), objectsToGet.end(), "triggers") != objectsToGet.end()) {
801      event.getByLabel (triggers_, triggers);
802 +    if (!triggers.product()) cout << "ERROR:  could not get triggers input collection" << endl;  
803 +  }
804  
805 <  if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end())
805 >  if (find(objectsToGet.begin(), objectsToGet.end(), "trigobjs") != objectsToGet.end()) {
806      event.getByLabel (trigobjs_, trigobjs);
807 +    if (!trigobjs.product()) cout << "ERROR:  could not get trigobjs input collection" << endl;  
808 +  }
809  
810 <  if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end())
810 >  if (find(objectsToGet.begin(), objectsToGet.end(), "jets") != objectsToGet.end()) {
811      event.getByLabel (jets_, jets);
812 +    if (!jets.product()) cout << "ERROR:  could not get jets input collection" << endl;  
813 +  }
814  
815 <  if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end())
815 >  if (find(objectsToGet.begin(), objectsToGet.end(), "muons") != objectsToGet.end()) {
816      event.getByLabel (muons_, muons);
817 +    if (!muons.product()) cout << "ERROR:  could not get muons input collection" << endl;  
818 +  }
819 +
820 +  if (find(objectsToGet.begin(), objectsToGet.end(), "secondary muons") != objectsToGet.end()) {
821 +    event.getByLabel (secMuons_, secMuons);
822 +    if (!secMuons.product()) cout << "ERROR:  could not get secMuons input collection" << endl;  
823 +  }
824  
825 <  if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end())
825 >  if (find(objectsToGet.begin(), objectsToGet.end(), "electrons") != objectsToGet.end()) {
826      event.getByLabel (electrons_, electrons);
827 +    if (!electrons.product()) cout << "ERROR:  could not get electrons input collection" << endl;  
828 +  }
829  
830 <  if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end())
830 >  if (find(objectsToGet.begin(), objectsToGet.end(), "events") != objectsToGet.end()) {
831      event.getByLabel (events_, events);
832 +    if (!events.product()) cout << "ERROR:  could not get events input collection" << endl;  
833 +  }
834  
835 <  if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end())
835 >  if (find(objectsToGet.begin(), objectsToGet.end(), "taus") != objectsToGet.end()) {
836      event.getByLabel (taus_, taus);
837 +    if (!taus.product()) cout << "ERROR:  could not get taus input collection" << endl;  
838 +  }
839  
840 <  if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end())
840 >  if (find(objectsToGet.begin(), objectsToGet.end(), "mets") != objectsToGet.end()) {
841      event.getByLabel (mets_, mets);
842 +    if (!mets.product()) cout << "ERROR:  could not get mets input collection" << endl;  
843 +  }
844  
845 <  if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end())
845 >  if (find(objectsToGet.begin(), objectsToGet.end(), "tracks") != objectsToGet.end()) {
846      event.getByLabel (tracks_, tracks);
847 +    if (!tracks.product()) cout << "ERROR:  could not get tracks input collection" << endl;  
848 +  }
849  
850 <  if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end())
850 >  if (find(objectsToGet.begin(), objectsToGet.end(), "genjets") != objectsToGet.end()) {
851      event.getByLabel (genjets_, genjets);
852 +    if (!genjets.product()) cout << "ERROR:  could not get genjets input collection" << endl;  
853 +  }
854  
855 <  if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end())
855 >  if (find(objectsToGet.begin(), objectsToGet.end(), "mcparticles") != objectsToGet.end()) {
856      event.getByLabel (mcparticles_, mcparticles);
857 +    if (!mcparticles.product()) cout << "ERROR:  could not get mcparticles input collection" << endl;  
858 +  }
859  
860 <  if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end())
860 >  if (find(objectsToGet.begin(), objectsToGet.end(), "primaryvertexs") != objectsToGet.end()) {
861      event.getByLabel (primaryvertexs_, primaryvertexs);
862 +    if (!primaryvertexs.product()) cout << "ERROR:  could not get primaryvertexs input collection" << endl;  
863 +  }
864  
865 <  if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end())
865 >  if (find(objectsToGet.begin(), objectsToGet.end(), "bxlumis") != objectsToGet.end()) {
866      event.getByLabel (bxlumis_, bxlumis);
867 +    if (!bxlumis.product()) cout << "ERROR:  could not get bxlumis input collection" << endl;  
868 +  }
869  
870 <  if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end())
870 >  if (find(objectsToGet.begin(), objectsToGet.end(), "photons") != objectsToGet.end()) {
871      event.getByLabel (photons_, photons);
872 +    if (!photons.product()) cout << "ERROR:  could not get photons input collection" << endl;  
873 +  }
874  
875 <  if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
875 >  if (find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end()) {
876      event.getByLabel (superclusters_, superclusters);
877 +    if (!superclusters.product()) cout << "ERROR:  could not get superclusters input collection" << endl;  
878 +  }
879  
880    if (datasetType_ == "signalMC"){
881 <    if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end())
881 >    if (find(objectsToGet.begin(), objectsToGet.end(), "stops") != objectsToGet.end()) {
882        event.getByLabel (stops_, stops);
883 +      if (!stops.product()) cout << "ERROR:  could not get stops input collection" << endl;  
884 +    }
885    }
886  
887    if (useTrackCaloRhoCorr_) {
# Line 825 | Line 890 | OSUAnalysis::produce (edm::Event &event,
890      // For description of rho values for different jet reconstruction algorithms, see
891      // https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms
892      event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_);
893 +    if (!rhokt6CaloJetsHandle_.product()) cout << "ERROR:  could not get kt6CaloJets input collection" << endl;  
894    }
895  
896    double masterScaleFactor = 1.0;
# Line 889 | Line 955 | OSUAnalysis::produce (edm::Event &event,
955          else if(currentObject == "secondary jets")      setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,jets.product(),"secondary jets");
956          else if(currentObject == "secondary photons")   setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,photons.product(),"secondary photons");
957          else if(currentObject == "muons")               setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"muons");
958 <        else if(currentObject == "secondary muons")     setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),"secondary muons");
958 >        else if(currentObject == "secondary muons")     setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,secMuons.product(),"secondary muons");
959          else if(currentObject == "secondary electrons") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"secondary electrons");
960          else if(currentObject == "electrons")           setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),"electrons");
961          else if(currentObject == "events")              setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,events.product(),"events");
# Line 907 | Line 973 | OSUAnalysis::produce (edm::Event &event,
973  
974          // paired object collections  
975          else if(currentObject == "muon-muon pairs")                   setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), "muon-muon pairs");
976 <        else if(currentObject == "muon-secondary muon pairs")         setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),muons.product(), "muon-secondary muon pairs");
976 >        else if(currentObject == "muon-secondary muon pairs")         setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),secMuons.product(), "muon-secondary muon pairs");
977  
978          else if(currentObject == "muon-secondary photon pairs")       setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),photons.product(), "muon-secondary photon pairs");
979          else if(currentObject == "muon-secondary jet pairs")          setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),jets.product(), "muon-secondary jet pairs");
# Line 930 | Line 996 | OSUAnalysis::produce (edm::Event &event,
996          else if(currentObject == "track-event pairs")       setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(), "track-event pairs");
997          else if(currentObject == "electron-track pairs")    setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(),"electron-track pairs");
998          else if(currentObject == "muon-track pairs")        setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(),"muon-track pairs");
999 +        else if(currentObject == "secondary muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,secMuons.product(),tracks.product(),"secondary muon-track pairs");
1000          else if(currentObject == "muon-tau pairs")          setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(),"muon-tau pairs");
1001          else if(currentObject == "tau-tau pairs")           setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus.product(),taus.product(),"tau-tau pairs");
1002          else if(currentObject == "tau-track pairs")         setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),tracks.product(),"tau-track pairs");
1003          else if(currentObject == "electron-trigobj pairs")  setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),trigobjs.product(),"electron-trigobj pairs");
1004          else if(currentObject == "muon-trigobj pairs")      setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),trigobjs.product(),"muon-trigobj pairs");
1005 +        else if(currentObject == "electron-mcparticle pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),mcparticles.product(),"electron-mcparticle pairs");
1006  
1007          if(currentObject == "stops" && datasetType_ == "signalMC") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,stops.product(),"stops");
1008        }
# Line 1098 | Line 1166 | OSUAnalysis::produce (edm::Event &event,
1166              else if(currentHistogram.inputCollection == "secondary jets")  fill1DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor);
1167              else if(currentHistogram.inputCollection == "secondary photons")  fill1DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor);
1168              else if(currentHistogram.inputCollection == "muons")           fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor);
1169 <            else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor);
1169 >            else if(currentHistogram.inputCollection == "secondary muons") fill1DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor);
1170              else if(currentHistogram.inputCollection == "secondary electrons") fill1DHistogram(histo,currentHistogram,electrons.product(),cumulativeFlags.at("secondary electrons").at(currentDir),scaleFactor);
1171              else if(currentHistogram.inputCollection == "muon-muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(),
1172                                                                                             cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor);
1173 <            else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),muons.product(),
1173 >            else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),secMuons.product(),
1174                                                                                                       cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor);
1175               else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill1DHistogram(histo,currentHistogram,muons.product(),photons.product(),
1176                                                                                                       cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor);
# Line 1145 | Line 1213 | OSUAnalysis::produce (edm::Event &event,
1213                                                                                                  cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor);
1214              else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(),
1215                                                                                              cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor);
1216 +            else if(currentHistogram.inputCollection == "secondary muon-track pairs") fill1DHistogram(histo,currentHistogram, secMuons.product(),tracks.product(),
1217 +                                                                                            cumulativeFlags.at("secondary muon-track pairs").at(currentDir),scaleFactor);
1218              else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(),
1219                                                                                            cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor);
1220              else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(),
# Line 1176 | Line 1246 | OSUAnalysis::produce (edm::Event &event,
1246              else if(currentHistogram.inputCollection == "secondary jets")  fill2DHistogram(histo,currentHistogram,jets.product(),cumulativeFlags.at("secondary jets").at(currentDir),scaleFactor);
1247              else if(currentHistogram.inputCollection == "secondary photons")  fill2DHistogram(histo,currentHistogram,photons.product(),cumulativeFlags.at("secondary photons").at(currentDir),scaleFactor);
1248              else if(currentHistogram.inputCollection == "muons")           fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("muons").at(currentDir),scaleFactor);
1249 <            else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,muons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor);
1249 >            else if(currentHistogram.inputCollection == "secondary muons") fill2DHistogram(histo,currentHistogram,secMuons.product(),cumulativeFlags.at("secondary muons").at(currentDir),scaleFactor);
1250              else if(currentHistogram.inputCollection == "muon-muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(),
1251                                                                                             cumulativeFlags.at("muon-muon pairs").at(currentDir),scaleFactor);
1252 <            else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),muons.product(),
1252 >            else if(currentHistogram.inputCollection == "muon-secondary muon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),secMuons.product(),
1253                                                                                                       cumulativeFlags.at("muon-secondary muon pairs").at(currentDir),scaleFactor);
1254              else if(currentHistogram.inputCollection == "muon-secondary photon pairs") fill2DHistogram(histo,currentHistogram,muons.product(),photons.product(),
1255                                                                                                       cumulativeFlags.at("muon-secondary photon pairs").at(currentDir),scaleFactor);
# Line 1219 | Line 1289 | OSUAnalysis::produce (edm::Event &event,
1289                                                                                                  cumulativeFlags.at("electron-track pairs").at(currentDir),scaleFactor);
1290              else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(),
1291                                                                                              cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor);
1292 +            else if(currentHistogram.inputCollection == "secondary muon-track pairs") fill2DHistogram(histo,currentHistogram,secMuons.product(),tracks.product(),
1293 +                                                                                            cumulativeFlags.at("muon-track pairs").at(currentDir),scaleFactor);
1294              else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(),
1295                                                                                            cumulativeFlags.at("muon-tau pairs").at(currentDir),scaleFactor);
1296              else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(),
# Line 1274 | Line 1346 | OSUAnalysis::produce (edm::Event &event,
1346            else if(currentObject == "secondary photons")                  objectToPlot = "secondaryPhotons";
1347            else if(currentObject == "electron-track pairs")               objectToPlot = "electronTrackPairs";
1348            else if(currentObject == "muon-track pairs")                   objectToPlot = "muonTrackPairs";
1349 +          else if(currentObject == "secondary muon-track pairs")         objectToPlot = "secondaryMuonTrackPairs";
1350            else if(currentObject == "muon-tau pairs")                     objectToPlot = "muonTauPairs";
1351            else if(currentObject == "tau-tau pairs")                      objectToPlot = "ditauPairs";
1352            else if(currentObject == "tau-track pairs")                    objectToPlot = "tauTrackPairs";
# Line 1288 | Line 1361 | OSUAnalysis::produce (edm::Event &event,
1361            else if(currentObject == "secondary electrons")                objectToPlot = "secondaryElectrons";
1362            else if(currentObject == "electron-trigobj pairs")             objectToPlot = "electronTrigobjPairs";
1363            else if(currentObject == "muon-trigobj pairs")                 objectToPlot = "muonTrigobjPairs";
1364 +          else if(currentObject == "electron-mcparticle pairs")          objectToPlot = "electronMCparticlePairs";
1365            else objectToPlot = currentObject;
1366  
1367            string tempCurrentObject = objectToPlot;
# Line 1330 | Line 1404 | OSUAnalysis::produce (edm::Event &event,
1404  
1405          if     (coll == "jets")                assignTreeBranch(brSpecs,jets.product(),          cumulativeFlags.at(coll).back());
1406          else if(coll == "secondary jets")      assignTreeBranch(brSpecs,jets.product(),          cumulativeFlags.at(coll).back());
1407 <        else if(coll == "secondary photons")      assignTreeBranch(brSpecs,photons.product(),          cumulativeFlags.at(coll).back());
1407 >        else if(coll == "secondary photons")   assignTreeBranch(brSpecs,photons.product(),       cumulativeFlags.at(coll).back());
1408          else if(coll == "muons")               assignTreeBranch(brSpecs,muons.product(),         cumulativeFlags.at(coll).back());
1409 <        else if(coll == "secondary muons")     assignTreeBranch(brSpecs,muons.product(),         cumulativeFlags.at(coll).back());
1409 >        else if(coll == "secondary muons")     assignTreeBranch(brSpecs,secMuons.product(),      cumulativeFlags.at(coll).back());
1410          else if(coll == "electrons")           assignTreeBranch(brSpecs,electrons.product(),     cumulativeFlags.at(coll).back());
1411          else if(coll == "secondary electrons") assignTreeBranch(brSpecs,electrons.product(),     cumulativeFlags.at(coll).back());
1412          else if(coll == "events")              assignTreeBranch(brSpecs,events.product(),        cumulativeFlags.at(coll).back());
# Line 1624 | Line 1698 | OSUAnalysis::valueLookup (const BNjet* o
1698    }
1699  
1700  
1701 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
1701 >  else{clog << "WARNING: invalid jet variable '" << variable << "'\n"; value = -999;}
1702  
1703    value = applyFunction(function, value);
1704  
# Line 1799 | Line 1873 | OSUAnalysis::valueLookup (const BNmuon*
1873  
1874    //user-defined variables
1875    else if(variable == "looseID") {
1876 <    value = object->pt > 10 &&
1876 >    value = object->pt > 10 &&
1877        (object->isGlobalMuon  > 0 ||
1878         object->isTrackerMuon > 0);
1879    }
1880 +
1881 +  else if(variable == "looseIDGlobalMuon") {
1882 +    value = object->pt > 10 &&
1883 +      object->isGlobalMuon  > 0;
1884 +  }
1885    else if(variable == "correctedD0VertexErr") value =  hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError));
1886    else if(variable == "correctedD0VertexSig") value =  object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError));
1887    else if(variable == "detIso") value = (object->trackIsoDR03) / object->pt;
# Line 1818 | Line 1897 | OSUAnalysis::valueLookup (const BNmuon*
1897      else
1898        value = -999;
1899    }
1900 <
1901 <
1900 >  else if(variable == "ptPlusMet") {
1901 >    // Calculate the magnitude of the vector sum of the muon pT and the Met.  
1902 >    if (const BNmet *met = chosenMET ())
1903 >      {
1904 >        TVector2 p2Met;
1905 >        TVector2 p2Muon;
1906 >        p2Met. SetMagPhi(   met->pt,    met->phi);
1907 >        p2Muon.SetMagPhi(object->pt, object->phi);  
1908 >        TVector2 p2MetElec = p2Met + p2Muon;
1909 >        value = p2MetElec.Mod();  
1910 >      }
1911 >    else
1912 >      value = -999;
1913 >  }
1914  
1915    else if(variable == "correctedD0VertexInEBPlus"){
1916      if(fabs(object->eta) < 0.8 && object->eta > 0) value = object->correctedD0Vertex;
# Line 2004 | Line 2095 | OSUAnalysis::valueLookup (const BNmuon*
2095  
2096  
2097  
2098 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2098 >  else{clog << "WARNING: invalid muon variable '" << variable << "'\n"; value = -999;}
2099  
2100    value = applyFunction(function, value);
2101  
# Line 2191 | Line 2282 | OSUAnalysis::valueLookup (const BNelectr
2282        value = -999;
2283    }
2284  
2285 +  else if(variable == "ptPlusMet") {
2286 +    // Calculate the magnitude of the vector sum of the electron pT and the Met.  
2287 +    if (const BNmet *met = chosenMET ())
2288 +      {
2289 +        TVector2 p2Met;
2290 +        TVector2 p2Elec;
2291 +        p2Met. SetMagPhi(   met->pt,    met->phi);
2292 +        p2Elec.SetMagPhi(object->pt, object->phi);  
2293 +        TVector2 p2MetElec = p2Met + p2Elec;
2294 +        value = p2MetElec.Mod();  
2295 +      }
2296 +    else
2297 +      value = -999;
2298 +  }
2299 +
2300    else if(variable == "correctedD0VertexEEPositiveChargeLowPt"){
2301      if(fabs(object->eta) > 1.479 && object->charge > 0 && object->pt > 45) value = object->correctedD0Vertex;
2302      else value = -999;
# Line 2436 | Line 2542 | OSUAnalysis::valueLookup (const BNelectr
2542  
2543  
2544  
2545 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2545 >  else{clog << "WARNING: invalid electron variable '" << variable << "'\n"; value = -999;}
2546  
2547    value = applyFunction(function, value);
2548  
# Line 2454 | Line 2560 | OSUAnalysis::valueLookup (const BNevent*
2560    else if(variable == "pthat") value = object->pthat;
2561    else if(variable == "qScale") value = object->qScale;
2562    else if(variable == "alphaQCD") value = object->alphaQCD;
2457  else if(variable == "Ht") value = getHt(jets.product());
2563    else if(variable == "alphaQED") value = object->alphaQED;
2564    else if(variable == "scalePDF") value = object->scalePDF;
2565    else if(variable == "x1") value = object->x1;
# Line 2525 | Line 2630 | OSUAnalysis::valueLookup (const BNevent*
2630    else if(variable == "electronScaleFactor") value = electronScaleFactor_;
2631    else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_;
2632    else if(variable == "bTagScaleFactor") value = bTagScaleFactor_;
2633 +
2634 +  else if(variable == "unfilteredHt") value = getHt(jets.product());
2635    else if(variable == "ht") value = chosenHT ();
2636 +
2637    else if(variable == "leadMuPairInvMass"){
2638      pair<const BNmuon *, const BNmuon *> muPair = leadMuonPair ();
2639      TLorentzVector p0 (muPair.first->px, muPair.first->py, muPair.first->pz, muPair.first->energy),
# Line 2552 | Line 2660 | OSUAnalysis::valueLookup (const BNevent*
2660      pt0 += pt1;
2661      value = pt0.Mod ();
2662    }
2663 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2663 >  else{clog << "WARNING: invalid event variable '" << variable << "'\n"; value = -999;}
2664  
2665    value = applyFunction(function, value);
2666  
# Line 2607 | Line 2715 | OSUAnalysis::valueLookup (const BNtau* o
2715    else if(variable == "leadingTrackValid") value = object->leadingTrackValid;
2716  
2717    else if (variable == "looseHadronicID") {
2718 <    value = object->pt > 10
2719 <      && object->eta < 2.3
2718 >    //criteria taken from http://cms.cern.ch/iCMS/jsp/db_notes/showNoteDetails.jsp?noteID=CMS%20AN-2011/019
2719 >    value = object->pt > 30
2720 >      && fabs(object->eta) < 2.3
2721        && object->HPSbyLooseCombinedIsolationDeltaBetaCorr > 0
2722        && object->HPSdecayModeFinding > 0
2723        && object->HPSagainstElectronLoose > 0
# Line 2660 | Line 2769 | OSUAnalysis::valueLookup (const BNtau* o
2769    }
2770  
2771  
2772 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2772 >  else{clog << "WARNING: invalid tau variable '" << variable << "'\n"; value = -999;}
2773  
2774    value = applyFunction(function, value);
2775  
# Line 2734 | Line 2843 | OSUAnalysis::valueLookup (const BNmet* o
2843    else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt;
2844    else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi;
2845  
2846 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2846 >  else{clog << "WARNING: invalid met variable '" << variable << "'\n"; value = -999;}
2847  
2848    value = applyFunction(function, value);
2849  
# Line 2779 | Line 2888 | OSUAnalysis::valueLookup (const BNtrack*
2888    else if(variable == "nHitsMissingInner")  value = object->nHitsMissingInner;
2889    else if(variable == "nHitsMissingMiddle") value = object->nHitsMissingMiddle;
2890    else if(variable == "depTrkRp3")          value = object->depTrkRp3;
2891 <  else if(variable == "trkRelIsoRp3")       value = (object->depTrkRp3 - object->pt) / object->pt;
2892 <  else if(variable == "trkRelIsoRp5")       value = (object->depTrkRp5 - object->pt) / object->pt;
2891 >  else if(variable == "trkRelIsoRp3")     { value = (object->depTrkRp3 - object->pt) / object->pt; if (value<0) value = 0; }
2892 >  else if(variable == "trkRelIsoRp5")     { value = (object->depTrkRp5 - object->pt) / object->pt; if (value<0) value = 0; }
2893    else if(variable == "depEcalRp3")         value = object->depEcalRp3;
2894    else if(variable == "depHcalRp3")         value = object->depHcalRp3;
2895    else if(variable == "depHoRp3")           value = object->depHoRp3;
# Line 2883 | Line 2992 | OSUAnalysis::valueLookup (const BNtrack*
2992      value = trkJetDeltaRMin;  
2993    }  
2994    
2995 +  else if(variable == "deltaRMinElecLooseMvaId") {
2996 +    // calculate minimum deltaR between track and any other electron passing loose mva ID, i.e., mvaNonTrigV0 > 0
2997 +    double trkElecDeltaRMin = 99.;  
2998 +    for (uint ielec = 0; ielec<electrons->size(); ielec++) {
2999 +      string empty = "";  
3000 +      double mvaNonTrigV0 = valueLookup(&electrons->at(ielec), "mvaNonTrigV0", "", empty);  
3001 +      if (mvaNonTrigV0 < 0) continue;  // only consider electrons with mvaNonTrigV0 > 0  
3002 +      double elecEta = valueLookup(&electrons->at(ielec), "eta", "", empty);
3003 +      double elecPhi = valueLookup(&electrons->at(ielec), "phi", "", empty);
3004 +      double trkElecDeltaR = deltaR(object->eta, object->phi, elecEta, elecPhi);  
3005 +      if (trkElecDeltaR < trkElecDeltaRMin) trkElecDeltaRMin = trkElecDeltaR;
3006 +    }
3007 +    value = trkElecDeltaRMin;  
3008 +  }  
3009 +
3010 +  else if(variable == "deltaRMinMuonLooseId") {
3011 +    // calculate minimum deltaR between track and any other loose-Id muon
3012 +    double trkMuonDeltaRMin = 99.;  
3013 +    //    if (!muons) cout << "ERROR:  could not find muon collection for calculation of deltaRMinMuonLooseId" << endl;  
3014 +    for (uint imuon = 0; imuon<muons->size(); imuon++) {
3015 +      string empty = "";  
3016 +      double isLooseIdMuon = valueLookup(&muons->at(imuon), "looseID", "", empty);  
3017 +      if (!isLooseIdMuon) continue;  // only consider muons that pass the looseID criteria  
3018 +      double muonEta = valueLookup(&muons->at(imuon), "eta", "", empty);
3019 +      double muonPhi = valueLookup(&muons->at(imuon), "phi", "", empty);
3020 +      double trkMuonDeltaR = deltaR(object->eta, object->phi, muonEta, muonPhi);  
3021 +      if (trkMuonDeltaR < trkMuonDeltaRMin) trkMuonDeltaRMin = trkMuonDeltaR;
3022 +    }
3023 +    value = trkMuonDeltaRMin;  
3024 +  }  
3025 +
3026 +  else if(variable == "isPassMuonLooseIDVeto") {
3027 +
3028 +    // calculate minimum deltaR between track and any other loose-Id
3029 +    double trkMuonDeltaRMin = 99.;
3030 +    //    if (!muons) cout << "ERROR:  could not find muon collection for calculation of deltaRMinMuonLooseId" <<                                                                          
3031 +    for (uint imuon = 0; imuon<muons->size(); imuon++) {
3032 +      string empty = "";
3033 +      double isLooseIdMuon = valueLookup(&muons->at(imuon), "looseID", "", empty);
3034 +      if (!isLooseIdMuon) continue;  // only consider muons that pass the looseID                                
3035 +        double muonEta = valueLookup(&muons->at(imuon), "eta", "", empty);
3036 +        double muonPhi = valueLookup(&muons->at(imuon), "phi", "", empty);
3037 +        double trkMuonDeltaR = deltaR(object->eta, object->phi, muonEta, muonPhi);
3038 +        if (trkMuonDeltaR < trkMuonDeltaRMin) trkMuonDeltaRMin = trkMuonDeltaR;
3039 +    }
3040 +    if (trkMuonDeltaRMin  < 0.15) value = 1;
3041 +    if (trkMuonDeltaRMin  > 0.15) value = 0;
3042 +  }
3043 +
3044 +
3045 +  
3046 +  else if(variable == "deltaRMinSecMuonLooseIdGlobal") {
3047 +    // calculate minimum deltaR between track and any other loose-Id muon
3048 +    double trkMuonDeltaRMin = 99.;  
3049 +    //    if (!secMuons) cout << "ERROR:  could not find secondary muon collection for calculation of deltaRMinSecMuonLooseIdGlobal" << endl;  
3050 +    for (uint imuon = 0; imuon<secMuons->size(); imuon++) {  
3051 +      string empty = "";  
3052 +      double isLooseIdMuon = valueLookup(&secMuons->at(imuon), "looseIDGlobalMuon", "", empty);  
3053 +      if (!isLooseIdMuon) continue;  // only consider muons that pass the looseIDGlobal criteria  
3054 +      double muonEta = valueLookup(&secMuons->at(imuon), "eta", "", empty);
3055 +      double muonPhi = valueLookup(&secMuons->at(imuon), "phi", "", empty);
3056 +      double trkMuonDeltaR = deltaR(object->eta, object->phi, muonEta, muonPhi);  
3057 +      if (trkMuonDeltaR < trkMuonDeltaRMin) trkMuonDeltaRMin = trkMuonDeltaR;
3058 +    }
3059 +    value = trkMuonDeltaRMin;  
3060 +  }  
3061 +  
3062 +  else if(variable == "deltaRMinTauLooseHadronicId") {
3063 +    // calculate minimum deltaR between track and any other tau passing loose hadronic ID  
3064 +    double trkTauDeltaRMin = 99.;  
3065 +    //    if (!taus) cout << "ERROR:  could not find tau collection for calculation of deltaRMinTauLooseHadronicId" << endl;  
3066 +    for (uint itau = 0; itau<taus->size(); itau++) {
3067 +      string empty = "";  
3068 +      double isIdTau = valueLookup(&taus->at(itau), "looseHadronicID", "", empty);  
3069 +      if (!isIdTau) continue;  // only consider taus that pass the loose hadronic ID criteria  
3070 +      double tauEta = valueLookup(&taus->at(itau), "eta", "", empty);
3071 +      double tauPhi = valueLookup(&taus->at(itau), "phi", "", empty);
3072 +      double trkTauDeltaR = deltaR(object->eta, object->phi, tauEta, tauPhi);  
3073 +      if (trkTauDeltaR < trkTauDeltaRMin) trkTauDeltaRMin = trkTauDeltaR;
3074 +    }
3075 +    value = trkTauDeltaRMin;  
3076 +  }  
3077 +
3078    else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
3079  
3080    else if(variable == "genMatchedPdgId"){
# Line 2930 | Line 3122 | OSUAnalysis::valueLookup (const BNtrack*
3122  
3123  
3124  
3125 <  else{clog << "WARNING: invalid variable '" << variable << "' for BNtrack collection.\n"; value = -999;}
3125 >  else{clog << "WARNING: invalid track variable '" << variable << "'\n"; value = -999;}
3126  
3127    value = applyFunction(function, value);
3128  
# Line 2960 | Line 3152 | OSUAnalysis::valueLookup (const BNgenjet
3152    else if(variable == "charge") value = object->charge;
3153  
3154  
3155 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3155 >  else{clog << "WARNING: invalid genjet variable '" << variable << "'\n"; value = -999;}
3156  
3157    value = applyFunction(function, value);
3158  
# Line 3094 | Line 3286 | OSUAnalysis::valueLookup (const BNmcpart
3286    }
3287  
3288  
3289 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3289 >  else{clog << "WARNING: invalid mcparticle variable '" << variable << "'\n"; value = -999;}
3290  
3291    value = applyFunction(function, value);
3292  
# Line 3123 | Line 3315 | OSUAnalysis::valueLookup (const BNprimar
3315    else if(variable == "isGood") value = object->isGood;
3316  
3317  
3318 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3318 >  else{clog << "WARNING: invalid primaryvertex variable '" << variable << "'\n"; value = -999;}
3319  
3320    value = applyFunction(function, value);
3321  
# Line 3141 | Line 3333 | OSUAnalysis::valueLookup (const BNbxlumi
3333    else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now;
3334  
3335  
3336 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3336 >  else{clog << "WARNING: invalid bxlumi variable '" << variable << "'\n"; value = -999;}
3337  
3338    value = applyFunction(function, value);
3339  
# Line 3274 | Line 3466 | OSUAnalysis::valueLookup (const BNphoton
3466    }
3467  
3468  
3469 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3469 >  else{clog << "WARNING: invalid photon variable '" << variable << "'\n"; value = -999;}
3470  
3471    value = applyFunction(function, value);
3472  
# Line 3298 | Line 3490 | OSUAnalysis::valueLookup (const BNsuperc
3490    else if(variable == "theta") value = object->theta;
3491  
3492  
3493 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3493 >  else{clog << "WARNING: invalid supercluster variable '" << variable << "'\n"; value = -999;}
3494  
3495    value = applyFunction(function, value);
3496  
# Line 3332 | Line 3524 | OSUAnalysis::valueLookup (const BNtrigob
3524        stringValue = "none";  // stringValue should only be empty if value is filled
3525    }
3526  
3527 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3527 >  else{clog << "WARNING: invalid trigobj variable '" << variable << "'\n"; value = -999;}
3528  
3529    value = applyFunction(function, value);
3530  
# Line 3403 | Line 3595 | OSUAnalysis::valueLookup (const BNmuon*
3595        value = object2->correctedD0;
3596      }
3597  
3598 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3598 >  else{clog << "WARNING: invalid muon-muon pair variable '" << variable << "'\n"; value = -999;}
3599  
3600    value = applyFunction(function, value);
3601  
# Line 3450 | Line 3642 | OSUAnalysis::valueLookup (const BNmuon*
3642        TVector3 threeVector2(object2->px, object2->py, object2->pz);
3643        value = (pi-threeVector1.Angle(threeVector2));
3644      }
3645 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3645 >  else{clog << "WARNING: invalid muon-photon pair variable '" << variable << "'\n"; value = -999;}
3646  
3647    value = applyFunction(function, value);
3648  
3649    return value;
3650 < }
3650 > } // end muon-photon pair valueLookup
3651 >
3652  
3653   //!electron-photon pair valueLookup
3654   double
# Line 3496 | Line 3689 | OSUAnalysis::valueLookup (const BNelectr
3689        TVector3 threeVector2(object2->px, object2->py, object2->pz);
3690        value = (pi-threeVector1.Angle(threeVector2));
3691      }
3692 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3692 >  else{clog << "WARNING: invalid electron-photon pair variable '" << variable << "'\n"; value = -999;}
3693  
3694    value = applyFunction(function, value);
3695  
3696    return value;
3697 < }
3697 > } // end electron-photon pair valueLookup
3698 >
3699  
3700   //!electron-electron pair valueLookup
3701   double
# Line 3552 | Line 3746 | OSUAnalysis::valueLookup (const BNelectr
3746      value = object2->correctedD0;
3747    }
3748  
3749 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3749 >  else{clog << "WARNING: invalid electron-electron pair variable '" << variable << "'\n"; value = -999;}
3750  
3751    value = applyFunction(function, value);
3752  
3753    return value;
3754 < }
3754 > } // end electron-electron pair valueLookup
3755 >
3756  
3757   //!electron-muon pair valueLookup
3758   double
# Line 3619 | Line 3814 | OSUAnalysis::valueLookup (const BNelectr
3814    else if(variable == "muonRelPFdBetaIso"){
3815      value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt;
3816    }
3817 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3817 >  else{clog << "WARNING: invalid electron-muon pair variable '" << variable << "'\n"; value = -999;}
3818    value = applyFunction(function, value);
3819  
3820    return value;
3821   } // end electron-muon pair valueLookup
3822  
3823 <
3823 >
3824   //!electron-jet pair valueLookup
3825   double
3826   OSUAnalysis::valueLookup (const BNelectron* object1, const BNjet* object2, string variable, string function, string &stringValue){
# Line 3659 | Line 3854 | OSUAnalysis::valueLookup (const BNelectr
3854      value = object1->charge*object2->charge;
3855    }
3856  
3857 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3857 >  else{clog << "WARNING: invalid electron-jet pair variable '" << variable << "'\n"; value = -999;}
3858    value = applyFunction(function, value);
3859  
3860    return value;
3861   }
3862  
3863 + //!electron-mcparticle pair valueLookup
3864 + double
3865 + OSUAnalysis::valueLookup (const BNelectron* object1, const BNmcparticle* object2, string variable, string function, string &stringValue){
3866 +
3867 +  double value = 0.0;
3868 +
3869 +  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3870 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
3871 +  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3872 +  else if(variable == "threeDAngle")
3873 +    {
3874 +      TVector3 threeVector1(object1->px, object1->py, object1->pz);
3875 +      TVector3 threeVector2(object2->px, object2->py, object2->pz);
3876 +      value = (threeVector1.Angle(threeVector2));
3877 +    }
3878 +  else if(variable == "chargeProduct"){
3879 +    value = object1->charge*object2->charge;
3880 +  }
3881 +
3882 +  else{clog << "WARNING: invalid electron-mcparticle variable '" << variable << "'\n"; value = -999;}
3883 +  value = applyFunction(function, value);
3884 +
3885 +  return value;
3886 + }
3887 +
3888 +
3889   //!photon-jet pair valueLookup
3890   double
3891   OSUAnalysis::valueLookup (const BNphoton* object1, const BNjet* object2, string variable, string function, string &stringValue){
# Line 3695 | Line 3916 | OSUAnalysis::valueLookup (const BNphoton
3916        TVector3 threeVector2(object2->px, object2->py, object2->pz);
3917        value = (threeVector1.Angle(threeVector2));
3918      }
3919 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3919 >  else{clog << "WARNING: invalid photon-jet pair variable '" << variable << "'\n"; value = -999;}
3920    value = applyFunction(function, value);
3921  
3922    return value;
# Line 3710 | Line 3931 | OSUAnalysis::valueLookup (const BNtrack*
3931    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3932    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
3933  
3934 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3934 >  else{clog << "WARNING: invalid track-jet pair variable '" << variable << "'\n"; value = -999;}
3935    value = applyFunction(function, value);
3936  
3937    return value;
# Line 3727 | Line 3948 | OSUAnalysis::valueLookup (const BNmet* o
3948  
3949    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
3950  
3951 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3951 >  else{clog << "WARNING: invalid met-jet pair variable '" << variable << "'\n"; value = -999;}
3952    value = applyFunction(function, value);
3953  
3954    return value;
# Line 3773 | Line 3994 | OSUAnalysis::valueLookup (const BNmuon*
3994      value = object1->charge*object2->charge;
3995    }
3996  
3997 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
3997 >  else{clog << "WARNING: invalid muon-jet pair variable '" << variable << "'\n"; value = -999;}
3998    value = applyFunction(function, value);
3999  
4000    return value;
4001 < }
4001 > } // end muon-jet pair valueLookup
4002 >
4003  
4004   //!muon-event valueLookup
4005   double
# Line 3791 | Line 4013 | OSUAnalysis::valueLookup (const BNmuon*
4013    else if(variable == "Ht") value = getHt(jets.product());
4014    else if(variable == "pthat")   value = object2->pthat;
4015    else if(variable == "relPFdBetaIso") value = (object1->pfIsoR04SumChargedHadronPt + max(0.0, object1->pfIsoR04SumNeutralHadronEt + object1->pfIsoR04SumPhotonEt - 0.5*object1->pfIsoR04SumPUPt)) / object1->pt;
4016 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4016 >  else{clog << "WARNING: invalid muon-event pair variable '" << variable << "'\n"; value = -999;}
4017    value = applyFunction(function, value);
4018  
4019    return value;
# Line 3826 | Line 4048 | OSUAnalysis::valueLookup (const BNjet* o
4048      value = object1->charge*object2->charge;
4049    }
4050  
4051 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4051 >  else{clog << "WARNING: invalid jet-jet pair variable '" << variable << "'\n"; value = -999;}
4052    value = applyFunction(function, value);
4053  
4054    return value;
# Line 3842 | Line 4064 | OSUAnalysis::valueLookup (const BNelectr
4064    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
4065    else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
4066    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4067 +  else if(variable == "deltaRLooseMvaId") {
4068 +    // only consider electrons that pass "loose MVA id", i.e., mvaNonTrigV0 > 0;
4069 +    // otherwise return very large value (99)  
4070 +    if (object1->mvaNonTrigV0>0) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4071 +    else                         value = 99.;  
4072 +  }
4073    else if(variable == "invMass"){
4074      fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);
4075      fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass );
# Line 3851 | Line 4079 | OSUAnalysis::valueLookup (const BNelectr
4079    else if(variable == "chargeProduct"){
4080      value = object1->charge*object2->charge;
4081    }
4082 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4082 >  else{clog << "WARNING: invalid electron-track pair variable '" << variable << "'\n"; value = -999;}
4083    value = applyFunction(function, value);
4084    return value;
4085  
# Line 3861 | Line 4089 | OSUAnalysis::valueLookup (const BNelectr
4089   //!muon-track pair valueLookup
4090   double
4091   OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function, string &stringValue){
3864  double pionMass = 0.140;
3865  double muonMass = 0.106;
4092    double value = 0.0;
3867  TLorentzVector fourVector1(0, 0, 0, 0);
3868  TLorentzVector fourVector2(0, 0, 0, 0);
4093    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
4094    else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
4095    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4096 +  else if(variable == "deltaRLooseID") {
4097 +    // only consider muons that pass looseId criteria; otherwise return very large value (99.)  
4098 +    string empty = "";  
4099 +    double isLooseId = valueLookup(object1, "looseID", "", empty);    
4100 +    if (isLooseId) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4101 +    else           value = 99.;  
4102 +  }
4103 +  else if(variable == "deltaRGlobalMuon") {
4104 +    // only consider muons that pass looseId criteria; otherwise return very large value (99.)  
4105 +    if (object1->isGlobalMuon) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4106 +    else                       value = 99.;  
4107 +  }
4108    else if(variable == "invMass"){
4109 +    double pionMass = 0.140;
4110 +    double muonMass = 0.106;
4111 +    TLorentzVector fourVector1(0, 0, 0, 0);
4112 +    TLorentzVector fourVector2(0, 0, 0, 0);
4113      fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass);
4114      fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass );
3875
4115      value = (fourVector1 + fourVector2).M();
4116    }
4117    else if(variable == "chargeProduct"){
4118      value = object1->charge*object2->charge;
4119    }
4120  
4121 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4121 >  else{clog << "WARNING: invalid muon-track pair variable '" << variable << "'\n"; value = -999;}
4122    value = applyFunction(function, value);
4123    return value;
4124   }
# Line 3901 | Line 4140 | OSUAnalysis::valueLookup (const BNtau* o
4140      value = object1->charge*object2->charge;
4141    }
4142  
4143 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4143 >  else{clog << "WARNING: invalid tau-tau pair variable '" << variable << "'\n"; value = -999;}
4144    value = applyFunction(function, value);
4145    return value;
4146   }
# Line 3923 | Line 4162 | OSUAnalysis::valueLookup (const BNmuon*
4162      value = object1->charge*object2->charge;
4163    }
4164  
4165 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4165 >  else{clog << "WARNING: invalid muon-tau pair variable '" << variable << "'\n"; value = -999;}
4166    value = applyFunction(function, value);
4167    return value;
4168   }
# Line 3934 | Line 4173 | OSUAnalysis::valueLookup (const BNtau* o
4173    double value = 0.0;
4174    if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
4175    else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4176 +  else if(variable == "deltaRLooseHadronicID") {
4177 +    // only consider tau's that pass the loose hadronic ID criteria; otherwise return very large value (99)  
4178 +    string empty = "";  
4179 +    double isLooseHadronicID = valueLookup(object1, "looseHadronicID", "", empty);    
4180 +  
4181 +    if (isLooseHadronicID) value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4182 +    else                   value = 99.;  
4183 +  }
4184 +  else if(variable == "deltaEta") value = fabs(object1->eta - object2->eta);
4185 +  else if(variable == "invMass"){
4186 +    double tauMass = 1.777;  // PDG 2010
4187 +    double pionMass = 0.140; // PDG 2010  
4188 +    TLorentzVector fourVector1(0, 0, 0, 0);
4189 +    TLorentzVector fourVector2(0, 0, 0, 0);
4190 +    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, tauMass);
4191 +    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass );
4192 +    value = (fourVector1 + fourVector2).M();
4193 +  }
4194    else if(variable == "chargeProduct"){
4195      value = object1->charge*object2->charge;
4196    }
4197  
4198 <  else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
4198 >  else{clog << "WARNING: invalid tau-track pair variable '" << variable << "'\n"; value = -999;}
4199    value = applyFunction(function, value);
4200    return value;
4201   }
# Line 3958 | Line 4215 | OSUAnalysis::valueLookup (const BNtrack*
4215    else if (variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object1);
4216    else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag;
4217  
4218 <  else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
4218 >  else { clog << "WARNING: invalid track-event pair variable '" << variable << "'\n"; value = -999; }
4219  
4220    value = applyFunction(function, value);
4221  
# Line 3980 | Line 4237 | OSUAnalysis::valueLookup (const BNelectr
4237        stringValue = "none";
4238    }
4239  
4240 <  else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
4240 >  else { clog << "WARNING: invalid electron-trigobj variable '" << variable << "'\n"; value = -999; }
4241  
4242    value = applyFunction(function, value);
4243  
# Line 3996 | Line 4253 | OSUAnalysis::valueLookup (const BNmuon*
4253  
4254    if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
4255  
4256 <  else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
4256 >  else { clog << "WARNING: invalid muon-trigobj variable '" << variable << "'\n"; value = -999; }
4257  
4258    value = applyFunction(function, value);
4259  
# Line 4116 | Line 4373 | OSUAnalysis::valueLookup (const BNstop*
4373  
4374  
4375  
4376 <  else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
4376 >  else { clog << "WARNING: invalid stop variable '" << variable << "'\n"; value = -999; }
4377  
4378    value = applyFunction(function, value);
4379  
# Line 4313 | Line 4570 | void OSUAnalysis::setObjectFlags(cut &cu
4570    if (currentCut.inputCollection.find("pair")!=string::npos)  {
4571      string obj1, obj2;
4572      getTwoObjs(currentCut.inputCollection, obj1, obj2);
4573 +    if (verbose_>2) clog << "  Two object types:  " << obj1 << ", " << obj2 << endl;
4574      if (inputType==obj1 ||
4575          inputType==obj2) {
4576        // Do not add a cut to individualFlags or cumulativeFlags, if the cut is on a paired collection,
# Line 4324 | Line 4582 | void OSUAnalysis::setObjectFlags(cut &cu
4582      }
4583    }
4584  
4585 +  if (!inputCollection) cout << "ERROR:  invalid input collection for inputType=" << inputType << endl;  
4586 +
4587 +  if (verbose_>3) clog << "   Collection size:  " << inputCollection->size() << endl;
4588 +
4589    for (uint object = 0; object != inputCollection->size(); object++){
4590  
4591 +    if (verbose_>4) clog << "    Setting flags for object " << object << endl;
4592 +
4593      bool cutDecision = true;//object passes if this cut doesn't cut on that type of object
4594      bool plotDecision = true;
4595  
# Line 4373 | Line 4637 | void OSUAnalysis::setObjectFlags(cut &cu
4637  
4638      cumulativeFlags.at(inputType).at(currentCutIndex).push_back(make_pair(previousCumulativeCutFlag,previousCumulativePlotFlag));
4639  
4640 <  }
4640 >  }  //   for (uint object = 0; object != inputCollection->size(); object++){
4641  
4642   } // end void OSUAnalysis::setObjectFlags
4643  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines