00001 // 00002 // Original Author: Marco Zanetti 00003 // Created: Tue Sep 9 15:56:24 CEST 2008 00004 00005 00006 00007 // user include files 00008 #include "CalibMuon/DTCalibration/interface/DTCalibMuonSelection.h" 00009 00010 #include "FWCore/Framework/interface/Event.h" 00011 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00012 00013 #include "DataFormats/MuonReco/interface/Muon.h" 00014 #include "DataFormats/MuonReco/interface/MuonFwd.h" 00015 00016 #include "DataFormats/TrackReco/interface/Track.h" 00017 #include "DataFormats/TrackReco/interface/TrackFwd.h" 00018 00019 using namespace edm; 00020 using namespace reco; 00021 00022 DTCalibMuonSelection::DTCalibMuonSelection(const edm::ParameterSet& iConfig) 00023 { 00024 muonList = iConfig.getParameter<edm::InputTag>("src"); 00025 etaMin = iConfig.getParameter<double>("etaMin"); 00026 etaMax = iConfig.getParameter<double>("etaMax"); 00027 ptMin = iConfig.getParameter<double>("ptMin"); 00028 } 00029 00030 00031 DTCalibMuonSelection::~DTCalibMuonSelection() { } 00032 00033 00034 bool DTCalibMuonSelection::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) 00035 { 00036 bool result = false; 00037 00038 //Retrieve the muons list 00039 Handle<MuonCollection> MuHandle; 00040 iEvent.getByLabel(muonList,MuHandle); 00041 00042 for (MuonCollection::const_iterator nmuon = MuHandle->begin(); nmuon != MuHandle->end(); ++nmuon) { 00043 00044 double ptMuon(0.); 00045 double etaMuon(-999.); 00046 00047 if(nmuon->isGlobalMuon()){ 00048 ptMuon = nmuon->globalTrack()->pt(); 00049 etaMuon = nmuon->globalTrack()->eta(); 00050 } 00051 else continue; 00052 00053 if(ptMuon > ptMin &&etaMuon > etaMin && etaMuon < etaMax){ 00054 result = true; 00055 break; 00056 } 00057 00058 } 00059 00060 return result; 00061 } 00062 00063 00064 00065 // ------------ method called once each job just before starting event loop ------------ 00066 void DTCalibMuonSelection::beginJob() { 00067 } 00068 00069 00070 00071 // ------------ method called once each job just after ending the event loop ------------ 00072 void DTCalibMuonSelection::endJob() { 00073 } 00074