CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoMuon/MuonIsolation/src/MuIsoByTrackPt.cc

Go to the documentation of this file.
00001 #include "RecoMuon/MuonIsolation/interface/MuIsoByTrackPt.h"
00002 
00003 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h"
00004 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractorFactory.h"
00005 #include "RecoMuon/MuonIsolation/interface/IsolatorByDeposit.h"
00006 
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 
00010 #include "DataFormats/TrackReco/interface/Track.h"
00011 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00012 
00013 #include <vector>
00014 #include <iostream>
00015 
00016 using std::vector;
00017 using std::string;
00018 using reco::IsoDeposit;
00019 using namespace muonisolation;
00020 
00021 
00022 MuIsoByTrackPt::MuIsoByTrackPt(const edm::ParameterSet& conf) 
00023   : theExtractor(0), theIsolator(0)
00024 {
00025   edm::ParameterSet extractorPSet = conf.getParameter<edm::ParameterSet>("ExtractorPSet");
00026   string extractorName = extractorPSet.getParameter<string>("ComponentName"); 
00027   theExtractor = IsoDepositExtractorFactory::get()->create(extractorName, extractorPSet);
00028 
00029   theCut = conf.getUntrackedParameter<double>("Threshold", 0.);
00030   float coneSize =  conf.getUntrackedParameter<double>("ConeSize", 0.);
00031   vector<double> weights(1,1.);
00032   theIsolator = new IsolatorByDeposit(coneSize, weights); 
00033 }
00034 
00035 MuIsoByTrackPt::~MuIsoByTrackPt()
00036 {
00037   delete theExtractor;
00038   delete theIsolator;
00039 }
00040 
00041 void MuIsoByTrackPt::setConeSize(float dr)
00042 {
00043   theIsolator->setConeSize(dr);
00044 }
00045 
00046 float MuIsoByTrackPt::isolation(const edm::Event& ev, const edm::EventSetup& es, const reco::Track & muon)
00047 {
00048   IsoDeposit dep = extractor()->deposit(ev,es,muon); 
00049   MuIsoBaseIsolator::DepositContainer deposits;
00050   deposits.push_back(&dep);
00051   if (isolator()->resultType() == MuIsoBaseIsolator::ISOL_FLOAT_TYPE){
00052     return isolator()->result(deposits).valFloat; 
00053   }
00054 
00055   return -999.;
00056 }
00057 
00058 bool MuIsoByTrackPt::isIsolated(const edm::Event& ev, const edm::EventSetup& es, const reco::Track& muon)
00059 {
00060   return (isolation(ev,es,muon) > theCut);
00061 }