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.39 by jbrinson, Wed Mar 27 16:52:25 2013 UTC vs.
Revision 1.42 by wulsin, Wed Mar 27 22:38:08 2013 UTC

# Line 18 | Line 18 | OSUAnalysis::OSUAnalysis (const edm::Par
18    triggers_ (cfg.getParameter<edm::InputTag> ("triggers")),
19    puFile_ (cfg.getParameter<std::string> ("puFile")),
20    deadEcalFile_ (cfg.getParameter<std::string> ("deadEcalFile")),
21 <  
22 < muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")),
21 >  muonSFFile_ (cfg.getParameter<std::string> ("muonSFFile")),
22    dataPU_ (cfg.getParameter<std::string> ("dataPU")),
23    electronSFID_ (cfg.getParameter<std::string> ("electronSFID")),
24    muonSF_ (cfg.getParameter<std::string> ("muonSF")),
# Line 29 | Line 28 | muonSFFile_ (cfg.getParameter<std::strin
28    histogramSets_ (cfg.getParameter<vector<edm::ParameterSet> >("histogramSets")),
29    plotAllObjectsInPassingEvents_ (cfg.getParameter<bool> ("plotAllObjectsInPassingEvents")),
30    doPileupReweighting_ (cfg.getParameter<bool> ("doPileupReweighting")),
31 <  printEventInfo_ (cfg.getParameter<bool> ("printEventInfo"))
31 >  printEventInfo_ (cfg.getParameter<bool> ("printEventInfo")),
32 >  useTrackCaloRhoCorr_ (cfg.getParameter<bool> ("useTrackCaloRhoCorr"))
33 >
34   {
35  
36    TH1::SetDefaultSumw2 ();
# Line 64 | Line 65 | muonSFFile_ (cfg.getParameter<std::strin
65  
66      string tempInputCollection = histogramSets_.at(currentHistogramSet).getParameter<string> ("inputCollection");
67      if(tempInputCollection == "muon-electron pairs") tempInputCollection = "electron-muon pairs";
68 +    if(tempInputCollection == "event-track pairs")   tempInputCollection = "track-event pairs";
69      if(tempInputCollection.find("pairs")==std::string::npos){ //just a single object
70        objectsToGet.push_back(tempInputCollection);
71        objectsToPlot.push_back(tempInputCollection);
# Line 291 | Line 293 | muonSFFile_ (cfg.getParameter<std::strin
293  
294      }
295  
296 <    //book a histogram for the number of each object type to be plotted
297 <
296 >    // Book a histogram for the number of each object type to be plotted.  
297 >    // Name of objectToPlot here must match the name specified in OSUAnalysis::analyze().  
298      for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
299        string currentObject = objectsToPlot.at(currentObjectIndex);
300        int maxNum = 10;
# Line 300 | Line 302 | muonSFFile_ (cfg.getParameter<std::strin
302        else if(currentObject == "primaryvertexs") maxNum = 50;
303        else if(currentObject == "muon-muon pairs") currentObject = "dimuonPairs";
304        else if(currentObject == "electron-electron pairs") currentObject = "dielectronPairs";
305 <      else if(currentObject == "electron-muon pairs") currentObject = "electronMuonPairs";
306 <
305 <      else if(currentObject == "electron-track pairs") currentObject = "electronTrackPairs";
306 <      else if(currentObject == "muon-track pairs") currentObject = "muonTrackPairs";
307 <      else if(currentObject == "muon-tau pairs") currentObject = "muonTauPairs";
308 <      else if(currentObject == "tau-tau pairs") currentObject = "ditauPairs";
305 >      else if(currentObject == "electron-muon pairs")     currentObject = "electronMuonPairs";
306 >      else if(currentObject == "track-event pairs")       currentObject = "trackEventPairs";
307  
308        currentObject.at(0) = toupper(currentObject.at(0));
309        string histoName = "num" + currentObject;
# Line 482 | Line 480 | OSUAnalysis::analyze (const edm::Event &
480    if (std::find(objectsToGet.begin(), objectsToGet.end(), "superclusters") != objectsToGet.end())
481      event.getByLabel (superclusters_, superclusters);
482  
483 +  if (useTrackCaloRhoCorr_) {  
484 +    // Used only for pile-up correction of by-hand calculation of isolation energy.  
485 +    // This rho collection is not available in all BEANs.  
486 +    // For description of rho values for different jet reconstruction algorithms, see
487 +    // https://twiki.cern.ch/twiki/bin/view/CMS/JetAlgorithms#Algorithms  
488 +    event.getByLabel ("kt6CaloJets","rho", rhokt6CaloJetsHandle_);
489 +  }
490 +
491 +
492    //get pile-up event weight
493    double scaleFactor = 1.00;
494    if(doPileupReweighting_ && datasetType_ != "data")
# Line 551 | Line 558 | OSUAnalysis::analyze (const edm::Event &
558                                                                         cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
559                                                                         cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
560                                                                         "electron-muon pairs");
561 <        else if(currentObject == "electron-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,electrons.product(),tracks.product(), \
562 <                                                                       cumulativeFlags.at("electrons").at(flagsForPairCutsIndex), \
563 <                                                                       cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), \
564 <                                                                       "electron-track pairs");
565 <        else if(currentObject == "muon-track pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),tracks.product(), \
559 <                                                                        cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
560 <                                                                        cumulativeFlags.at("tracks").at(flagsForPairCutsIndex), \
561 <                                                                        "muon-track pairs");
562 <        else if(currentObject == "muon-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,muons.product(),taus.product(), \
563 <                                                                    cumulativeFlags.at("muons").at(flagsForPairCutsIndex), \
564 <                                                                    cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \
565 <                                                                    "muon-tau pairs");
566 <
567 <        else if(currentObject == "tau-tau pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,taus .product(),taus.product(), \
568 <                                                                        cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \
569 <                                                                        cumulativeFlags.at("taus").at(flagsForPairCutsIndex), \
570 <                                                                        "tau-tau pairs");
571 <
561 >        else if(currentObject == "track-event pairs") setObjectFlags(currentCut,currentCutIndex,individualFlags,cumulativeFlags,tracks.product(),events.product(),
562 >                                                                     cumulativeFlags.at("tracks").at(flagsForPairCutsIndex),
563 >                                                                     cumulativeFlags.at("events").at(flagsForPairCutsIndex),
564 >                                                                     "track-event pairs");
565 >        
566  
567        }
568  
# Line 646 | Line 640 | OSUAnalysis::analyze (const edm::Event &
640          else if(currentHistogram.inputCollection == "electron-muon pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),muons.product(), \
641                                                                                                cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(),
642                                                                                                cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
649        else if(currentHistogram.inputCollection == "electron-track pairs") fill1DHistogram(histo,currentHistogram, electrons.product(),tracks.product(), \
650                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(),
651                                                                                           cumulativeFlags.at("electron-track pairs").back(),scaleFactor);
652        else if(currentHistogram.inputCollection == "muon-track pairs") fill1DHistogram(histo,currentHistogram, muons.product(),tracks.product(), \
653                                                                                            cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(),
654                                                                                            cumulativeFlags.at("muon-track pairs").back(),scaleFactor);
655        else if(currentHistogram.inputCollection == "muon-tau pairs") fill1DHistogram(histo,currentHistogram, muons.product(),taus.product(), \
656                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(),
657                                                                                        cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);
658
659        else if(currentHistogram.inputCollection == "tau-tau pairs") fill1DHistogram(histo,currentHistogram, taus.product(),taus.product(), \
660                                                                                            cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(),
661                                                                                            cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);
643          else if(currentHistogram.inputCollection == "events") fill1DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
644          else if(currentHistogram.inputCollection == "taus") fill1DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
645          else if(currentHistogram.inputCollection == "mets") fill1DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
# Line 688 | Line 669 | OSUAnalysis::analyze (const edm::Event &
669          else if(currentHistogram.inputCollection == "electron-muon pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),muons.product(), \
670                                                                                                 cumulativeFlags.at("electrons").back(),cumulativeFlags.at("muons").back(), \
671                                                                                                 cumulativeFlags.at("electron-muon pairs").back(),scaleFactor);
691        else if(currentHistogram.inputCollection == "electron-track pairs") fill2DHistogram(histo,currentHistogram,electrons.product(),tracks.product(), \
692                                                                                           cumulativeFlags.at("electrons").back(),cumulativeFlags.at("tracks").back(), \
693                                                                                           cumulativeFlags.at("electron-track pairs").back(),scaleFactor);
694        else if(currentHistogram.inputCollection == "muon-track pairs") fill2DHistogram(histo,currentHistogram,muons.product(),tracks.product(), \
695                                                                                            cumulativeFlags.at("muons").back(),cumulativeFlags.at("tracks").back(), \
696                                                                                            cumulativeFlags.at("muon-track pairs").back(),scaleFactor);
697        else if(currentHistogram.inputCollection == "muon-tau pairs") fill2DHistogram(histo,currentHistogram,muons.product(),taus.product(), \
698                                                                                        cumulativeFlags.at("muons").back(),cumulativeFlags.at("taus").back(), \
699                                                                                        cumulativeFlags.at("muon-tau pairs").back(),scaleFactor);
700        else if(currentHistogram.inputCollection == "tau-tau pairs") fill2DHistogram(histo,currentHistogram,taus.product(),taus.product(), \
701                                                                                            cumulativeFlags.at("taus").back(),cumulativeFlags.at("taus").back(), \
702                                                                                            cumulativeFlags.at("tau-tau pairs").back(),scaleFactor);
672          else if(currentHistogram.inputCollection == "events") fill2DHistogram(histo,currentHistogram,events.product(),cumulativeFlags.at("events").back(),scaleFactor);
673          else if(currentHistogram.inputCollection == "taus") fill2DHistogram(histo,currentHistogram,taus.product(),cumulativeFlags.at("taus").back(),scaleFactor);
674          else if(currentHistogram.inputCollection == "mets") fill2DHistogram(histo,currentHistogram,mets.product(),cumulativeFlags.at("mets").back(),scaleFactor);
675          else if(currentHistogram.inputCollection == "tracks") fill2DHistogram(histo,currentHistogram,tracks.product(),cumulativeFlags.at("tracks").back(),scaleFactor);
676 +        else if(currentHistogram.inputCollection == "track-event pairs") fill2DHistogram(histo,currentHistogram,tracks.product(),events.product(),
677 +                                                                                         cumulativeFlags.at("tracks").back(),cumulativeFlags.at("events").back(),
678 +                                                                                         cumulativeFlags.at("track-event pairs").back(),scaleFactor);  
679          else if(currentHistogram.inputCollection == "genjets") fill2DHistogram(histo,currentHistogram,genjets.product(),cumulativeFlags.at("genjets").back(),scaleFactor);
680          else if(currentHistogram.inputCollection == "mcparticles") fill2DHistogram(histo,currentHistogram,mcparticles.product(),cumulativeFlags.at("mcparticles").back(),scaleFactor);
681          else if(currentHistogram.inputCollection == "primaryvertexs") fill2DHistogram(histo,currentHistogram,primaryvertexs.product(),cumulativeFlags.at("primaryvertexs").back(),scaleFactor);
# Line 715 | Line 687 | OSUAnalysis::analyze (const edm::Event &
687  
688      //fills histograms with the sizes of collections
689      for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
690 +
691        string currentObject = objectsToPlot.at(currentObjectIndex);
692  
693 <      string objectToPlot = "";
693 >      string objectToPlot = "";  
694  
695 +      // Name of objectToPlot here must match the name specified in OSUAnalysis::OSUAnalysis().  
696        if(currentObject == "muon-muon pairs") objectToPlot = "dimuonPairs";
697        else if(currentObject == "electron-electron pairs") objectToPlot = "dielectronPairs";
698 <      else if(currentObject == "electron-muon pairs") objectToPlot = "electronMuonPairs";
699 <      else if(currentObject == "electron-track pairs") objectToPlot = "electronTrackPairs";
726 <      else if(currentObject == "muon-track pairs") objectToPlot = "muonTrackPairs";
727 <      else if(currentObject == "muon-tau pairs") objectToPlot = "muonTauPairs";
728 <      else if(currentObject == "tau-tau pairs") objectToPlot = "ditauPairs";
698 >      else if(currentObject == "electron-muon pairs")     objectToPlot = "electronMuonPairs";
699 >      else if(currentObject == "track-event pairs")       objectToPlot = "trackEventPairs";  
700        else objectToPlot = currentObject;
701        string tempCurrentObject = objectToPlot;
702 <      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));
702 >      tempCurrentObject.at(0) = toupper(tempCurrentObject.at(0));  // Capitalize the first letter.  
703        string histoName = "num" + tempCurrentObject;
704  
705  
735
736
706        //set position of primary vertex in event, in order to calculate quantities relative to it
707        if(std::find(objectsToCut.begin(), objectsToCut.end(), currentObject) != objectsToCut.end()) {
708          vector<bool> lastCutFlags = cumulativeFlags.at(currentObject).back();
# Line 745 | Line 714 | OSUAnalysis::analyze (const edm::Event &
714            oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
715            oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor);
716          }
717 <        else
717 >        else {
718            oneDHists_.at(currentChannelIndex).at(histoName)->Fill(numToPlot,scaleFactor);
719 +        }
720        }
721        else if(objectToPlot == "jets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(jets->size(),scaleFactor);
722        else if(objectToPlot == "muons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(muons->size(),scaleFactor);
# Line 754 | Line 724 | OSUAnalysis::analyze (const edm::Event &
724        else if(objectToPlot == "electrons") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size(),scaleFactor);
725        else if(objectToPlot == "dielectronPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*(electrons->size()-1)/2,scaleFactor);
726        else if(objectToPlot == "electronMuonPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*muons->size(),scaleFactor);
757      else if(objectToPlot == "electronTrackPairs") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(electrons->size()*tracks->size(),scaleFactor);
727        else if(objectToPlot == "events") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(events->size(),scaleFactor);
728        else if(objectToPlot == "taus") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(taus->size(),scaleFactor);
729        else if(objectToPlot == "mets") oneDHists_.at(currentChannelIndex).at(histoName)->Fill(mets->size(),scaleFactor);
# Line 767 | Line 736 | OSUAnalysis::analyze (const edm::Event &
736        else if(objectToPlot == "primaryvertexs"){
737          oneDHists_.at(currentChannelIndex).at(histoName+"BeforePileupCorrection")->Fill(primaryvertexs->size());
738          oneDHists_.at(currentChannelIndex).at(histoName+"AfterPileupCorrection")->Fill(primaryvertexs->size(),scaleFactor);
739 <      }
771 <
772 <    }
773 <
774 <
739 >      }
740  
741 +    } // end for (uint currentObjectIndex = 0; currentObjectIndex != objectsToPlot.size(); currentObjectIndex++){
742  
743    } //end loop over channel
744  
745    masterCutFlow_->fillCutFlow(scaleFactor);
746  
747 + } // end void OSUAnalysis::analyze (const edm::Event &event, const edm::EventSetup &setup)
748  
749  
783 }
784
750  
751   bool
752   OSUAnalysis::evaluateComparison (double testValue, string comparison, double cutValue){
# Line 1950 | Line 1915 | OSUAnalysis::valueLookup (const BNtrack*
1915  
1916    double value = 0.0;
1917    double pMag = sqrt(object->pt * object->pt +
1918 <                         object->pz * object->pz);
1919 <
1918 >                     object->pz * object->pz);
1919 >  
1920    if(variable == "pt") value = object->pt;
1921    else if(variable == "px") value = object->px;
1922    else if(variable == "py") value = object->py;
# Line 1987 | Line 1952 | OSUAnalysis::valueLookup (const BNtrack*
1952    //user defined variables
1953    else if(variable == "d0wrtBS") value = (object->vx-events->at(0).BSx)*object->py/object->pt - (object->vy-events->at(0).BSy)*object->px/object->pt;
1954    else if(variable == "dZwrtBS") value = object->dZ - events->at(0).BSz;
1955 <  else if(variable == "caloTotDeltaRp5") value =(object->caloHadDeltaRp5 + object->caloEMDeltaRp5);
1956 <  else if(variable == "caloTotDeltaRp5ByP") value =( (object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag);
1957 <  else if(variable == "isIso") value = getTrkIsIso(object, tracks.product());
1958 <  else if(variable == "isMatchedDeadEcal") value = getTrkIsMatchedDeadEcal(object);
1959 <  else if(variable == "ptErrorByPt") value = (object->ptError/object->pt);
1960 <  else if(variable == "ptError") value = object->ptError;
1961 <  else if(variable == "ptRes") value = getTrkPtRes(object);
1962 <
1963 <  else if (variable == "d0wrtPV"){
1999 <    double vx = object->vx - chosenVertex ()->x,
2000 <      vy = object->vy - chosenVertex ()->y,
2001 <      px = object->px,
2002 <      py = object->py,
2003 <      pt = object->pt;
2004 <    value = (-vx * py + vy * px) / pt;
2005 <  }
2006 <  else if (variable == "dZwrtPV"){
2007 <    double vx = object->vx - chosenVertex ()->x,
2008 <      vy = object->vy - chosenVertex ()->y,
2009 <      vz = object->vz - chosenVertex ()->z,
2010 <      px = object->px,
2011 <      py = object->py,
2012 <      pz = object->pz,
2013 <      pt = object->pt;
2014 <    value = vz - (vx * px + vy * py)/pt * (pz/pt);
2015 <  }
2016 <
2017 <
1955 >  else if(variable == "caloTotDeltaRp5")            value =  (object->caloHadDeltaRp5 + object->caloEMDeltaRp5);
1956 >  else if(variable == "caloTotDeltaRp5ByP")         value = ((object->caloHadDeltaRp5 + object->caloEMDeltaRp5)/pMag);
1957 >  else if(variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object);  
1958 >  else if(variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object) / pMag;  
1959 >  else if(variable == "isIso")                      value = getTrkIsIso(object, tracks.product());
1960 >  else if(variable == "isMatchedDeadEcal")          value = getTrkIsMatchedDeadEcal(object);
1961 >  else if(variable == "ptErrorByPt")                value = (object->ptError/object->pt);
1962 >  else if(variable == "ptError")                    value = object->ptError;
1963 >  else if(variable == "ptRes")                      value = getTrkPtRes(object);
1964  
1965    else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
1966  
# Line 2024 | Line 1970 | OSUAnalysis::valueLookup (const BNtrack*
1970      else value = mcparticles->at(index).id;
1971    }
1972  
1973 +
1974    else if(variable == "genMatchedId"){
1975      int index = getGenMatchedParticleIndex(object);
1976      if(index == -1) value = 0;
# Line 2338 | Line 2285 | OSUAnalysis::valueLookup (const BNphoton
2285    else if(variable == "isEEGap") value = object->isEEGap;
2286    else if(variable == "hasPixelSeed") value = object->hasPixelSeed;
2287    else if(variable == "seedRecoFlag") value = object->seedRecoFlag;
2288 +
2289 +
2290  
2291  
2292    else if(variable == "genDeltaRLowest") value = getGenDeltaRLowest(object);
# Line 2347 | Line 2296 | OSUAnalysis::valueLookup (const BNphoton
2296      if(index == -1) value = 0;
2297      else value = mcparticles->at(index).id;
2298    }
2299 +
2300 +
2301 +
2302    else if(variable == "genMatchedId"){
2303      int index = getGenMatchedParticleIndex(object);
2304      if(index == -1) value = 0;
# Line 2419 | Line 2371 | OSUAnalysis::valueLookup (const BNmuon*
2371    else if(variable == "pt"){
2372      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2373      TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2374 <    value = (fourVector1 + fourVector2).Et();
2374 >    value = (fourVector1 + fourVector2).Pt();
2375    }
2376    else if(variable == "threeDAngle")
2377      {
# Line 2488 | Line 2440 | OSUAnalysis::valueLookup (const BNelectr
2440    else if(variable == "pt"){
2441      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2442      TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2443 <    value = (fourVector1 + fourVector2).Et();
2443 >    value = (fourVector1 + fourVector2).Pt();
2444    }
2445    else if(variable == "threeDAngle")
2446      {
# Line 2542 | Line 2494 | OSUAnalysis::valueLookup (const BNelectr
2494    else if(variable == "pt"){
2495      TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2496      TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2497 <    value = (fourVector1 + fourVector2).Et();
2497 >    value = (fourVector1 + fourVector2).Pt();
2498    }
2499    else if(variable == "threeDAngle")
2500      {
# Line 2589 | Line 2541 | OSUAnalysis::valueLookup (const BNelectr
2541   }
2542  
2543  
2592 double
2593 OSUAnalysis::valueLookup (const BNelectron* object1, const BNtrack* object2, string variable, string function){
2594  double electronMass = 0.000511;
2595  double value = 0.0;
2596  TLorentzVector fourVector1(0, 0, 0, 0);  
2597  TLorentzVector fourVector2(0, 0, 0, 0);  
2598  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2599  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2600  else if(variable == "invMass"){
2601    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, electronMass);
2602    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, electronMass );
2603    
2604    value = (fourVector1 + fourVector2).M();
2605  }
2606  
2607  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2608  value = applyFunction(function, value);
2609  return value;
2610 }
2611
2612 double
2613 OSUAnalysis::valueLookup (const BNmuon* object1, const BNtrack* object2, string variable, string function){
2614  double pionMass = 0.140;
2615  double muonMass = 0.106;
2616  double value = 0.0;
2617  TLorentzVector fourVector1(0, 0, 0, 0);
2618  TLorentzVector fourVector2(0, 0, 0, 0);
2619  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2620  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2621  else if(variable == "invMass"){
2622    fourVector1.SetPtEtaPhiM(object1->pt, object1->eta, object1->phi, muonMass);
2623    fourVector2.SetPtEtaPhiM(object2->pt, object2->eta, object2->phi, pionMass );
2624
2625    value = (fourVector1 + fourVector2).M();
2626  }
2627
2628  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2629  value = applyFunction(function, value);
2630  return value;
2631 }
2544  
2545  
2546   double
2547 < OSUAnalysis::valueLookup (const BNtau* object1, const BNtau* object2, string variable, string function){
2547 > OSUAnalysis::valueLookup (const BNtrack* object1, const BNevent* object2, string variable, string function){
2548 >
2549    double value = 0.0;
2550 <  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2551 <  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2639 <  else if(variable == "invMass"){
2640 <  TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2641 <  TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2642 <     value = (fourVector1 + fourVector2).M();
2643 <  }
2550 >  double pMag = sqrt(object1->pt * object1->pt +
2551 >                     object1->pz * object1->pz);  
2552  
2553 <  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2554 <  value = applyFunction(function, value);
2555 <  return value;
2556 < }
2553 >  if      (variable == "numPV")                      value = object2->numPV;
2554 >  else if (variable == "caloTotDeltaRp5")            value =  (object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5);
2555 >  else if (variable == "caloTotDeltaRp5ByP")         value = ((object1->caloHadDeltaRp5 + object1->caloEMDeltaRp5)/pMag);
2556 >  else if (variable == "caloTotDeltaRp5_RhoCorr")    value = getTrkCaloTotRhoCorr(object1);  
2557 >  else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag;  
2558  
2559 < double
2651 < OSUAnalysis::valueLookup (const BNmuon* object1, const BNtau* object2, string variable, string function){
2652 <  double value = 0.0;
2653 <  if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi));
2654 <  else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi);
2655 <  else if(variable == "invMass"){
2656 <    TLorentzVector fourVector1(object1->px, object1->py, object1->pz, object1->energy);
2657 <    TLorentzVector fourVector2(object2->px, object2->py, object2->pz, object2->energy);
2658 <    value = (fourVector1 + fourVector2).M();
2659 <  }
2559 >  else { std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; }
2560  
2661  else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;}
2561    value = applyFunction(function, value);
2663  return value;
2664 }
2562  
2563 +  return value;
2564  
2565 + }  
2566  
2567   // Calculate the number of tracks in cone of DeltaR<0.5 around track1.
2568   // Return true iff no other tracks are found in this cone.
# Line 2710 | Line 2609 | OSUAnalysis::getTrkPtTrue (const BNtrack
2609  
2610   }
2611  
2612 + double
2613 + OSUAnalysis::getTrkCaloTotRhoCorr(const BNtrack* track) {
2614 +  // Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track.  
2615 +  if (!useTrackCaloRhoCorr_) return -99;  
2616 +  // if (!rhokt6CaloJetsHandle_) {
2617 +  //   cout << "ERROR [getTrkCaloTotRhoCorr]:  The collection rhokt6CaloJetsHandle is not available!" << endl;  
2618 +  //   return -99;  
2619 +  // }
2620 +  double radDeltaRCone = 0.5;  
2621 +  double rhoCorr_kt6CaloJets = *rhokt6CaloJetsHandle_ * TMath::Pi() * pow(radDeltaRCone, 2);  // Define effective area as pi*r^2, where r is radius of DeltaR cone.  
2622 +  double rawCaloTot = track->caloHadDeltaRp5 + track->caloEMDeltaRp5;  
2623 +  double caloTotRhoCorrCalo = TMath::Max(0., rawCaloTot - rhoCorr_kt6CaloJets);  
2624 +  return caloTotRhoCorrCalo;  
2625 +
2626 + }
2627 +
2628 +
2629 +
2630 +
2631   //creates a map of the dead Ecal channels in the barrel and endcap
2632   //to see how the map of dead Ecal channels is created look at function getChannelStatusMaps() here:
2633   //http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/jbrinson/DisappTrk/OSUT3Analysis/AnaTools/src/OSUAnalysis.cc?revision=1.88&view=markup
# Line 2753 | Line 2671 | OSUAnalysis::getTrkIsMatchedDeadEcal (co
2671    return value;
2672   }
2673  
2756
2674   // Returns the smallest DeltaR between the object and any generated true particle in the event.  
2675   template <class InputObject>
2676   double OSUAnalysis::getGenDeltaRLowest(InputObject object){
# Line 2765 | Line 2682 | double OSUAnalysis::getGenDeltaRLowest(I
2682    return genDeltaRLowest;
2683   }
2684  
2768
2685   double
2686   OSUAnalysis::applyFunction(string function, double value){
2687  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines