CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc

Go to the documentation of this file.
00001 #include "ExtractorFromDeposits.h"
00002 
00003 #include "DataFormats/Common/interface/Handle.h"
00004 #include "DataFormats/TrackReco/interface/Track.h"
00005 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00006 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
00009 
00010 using namespace edm;
00011 using namespace std;
00012 using namespace reco;
00013 using namespace muonisolation;
00014 using reco::isodeposit::Direction;
00015 
00016 ExtractorFromDeposits::ExtractorFromDeposits( const ParameterSet& par ) :
00017   theCollectionTag(par.getParameter<edm::InputTag>("IsolationCollectionTag"))
00018 { }
00019 
00020 void ExtractorFromDeposits::fillVetos (const edm::Event & ev, 
00021     const edm::EventSetup & evSetup, const reco::TrackCollection & muons) 
00022 { }
00023 
00024 IsoDeposit ExtractorFromDeposits::deposit(const Event & event, 
00025     const EventSetup & eventSetup, const Track & muon) const
00026 { 
00027   static std::string metname = "RecoMuon|ExtractorFromDeposits";
00028   Handle<reco::IsoDepositMap> depMap;
00029   event.getByLabel(theCollectionTag, depMap);
00030 
00031   LogWarning(metname)<<"Call this method only if the original muon track collection is lost";
00032 
00033   // double vtx_z = muon.vz();
00034   reco::isodeposit::Direction muonDir(muon.eta(), muon.phi());
00035 
00036   typedef reco::IsoDepositMap::const_iterator iterator_i;
00037   typedef reco::IsoDepositMap::container::const_iterator iterator_ii;
00038   iterator_i depI = depMap->begin();
00039   iterator_i depIEnd = depMap->end();
00040   for (; depI != depIEnd; ++depI){
00041     iterator_ii depII = depI.begin();
00042     iterator_ii depIIEnd = depI.end();
00043     for (; depII != depIIEnd; ++depII){
00044       reco::isodeposit::Direction depDir(depII->direction());
00045       if (muonDir.deltaR(depDir) < 1.e-6) return *depII;
00046     }
00047   }
00048 
00049   return IsoDeposit();
00050 }
00051 
00052 IsoDeposit ExtractorFromDeposits::deposit(const Event & event, 
00053     const EventSetup & eventSetup, const TrackRef & muon) const
00054 { 
00055   static std::string metname = "RecoMuon|ExtractorFromDeposits";
00056   Handle<reco::IsoDepositMap> depMap;
00057   event.getByLabel(theCollectionTag, depMap);
00058 
00059   return (*depMap)[muon];
00060 }