ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DTDPGAnalysis/src/DTMuonSelection.cc
Revision: 1.10
Committed: Wed Jan 30 14:42:51 2013 UTC (12 years, 3 months ago) by pellicci
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
Error occurred while calculating annotation data.
Log Message:
fixing errors for 6_2_X

File Contents

# Content
1 //
2 // Original Author: Mario Pelliccioni
3 // Created: Tue May 4 15:56:24 CEST 2010
4
5 // user include files
6 #include "UserCode/DTDPGAnalysis/interface/DTMuonSelection.h"
7
8 #include "FWCore/Framework/interface/Event.h"
9 #include "FWCore/ParameterSet/interface/ParameterSet.h"
10
11 #include "DataFormats/MuonReco/interface/Muon.h"
12 #include "DataFormats/MuonReco/interface/MuonFwd.h"
13
14 #include "DataFormats/TrackReco/interface/Track.h"
15
16 DTMuonSelection::DTMuonSelection(const edm::ParameterSet& iConfig)
17 {
18 muonList = iConfig.getParameter<edm::InputTag>("src");
19 etaMin = iConfig.getParameter<double>("etaMin");
20 etaMax = iConfig.getParameter<double>("etaMax");
21 ptMin = iConfig.getParameter<double>("ptMin");
22
23 rng = new TRandom3(0);
24 }
25
26
27 DTMuonSelection::~DTMuonSelection() { }
28
29
30 bool DTMuonSelection::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
31 {
32 bool result = false;
33
34 //Retrieve the muons list
35 edm::Handle<reco::MuonCollection> MuHandle;
36 iEvent.getByLabel(muonList,MuHandle);
37
38 for (reco::MuonCollection::const_iterator nmuon = MuHandle->begin(); nmuon != MuHandle->end(); ++nmuon){
39
40 double ptMuon(0.);
41 double etaMuon(-999.);
42
43 if(!(nmuon->isGlobalMuon())) continue;
44
45 ptMuon = nmuon->globalTrack()->pt();
46 etaMuon = nmuon->globalTrack()->eta();
47
48 if(ptMuon > ptMin && etaMuon > etaMin && etaMuon < etaMax){
49 result = true;
50 break;
51 }
52
53 }
54
55 //too many events in the dataset, throw away half of them
56 //const Double_t rng_choice = rng->Uniform();
57 //if(rng_choice < 0.5) return false;
58
59 return result;
60 }
61
62
63
64 // ------------ method called once each job just before starting event loop ------------
65 void DTMuonSelection::beginJob() {
66 }
67
68
69
70 // ------------ method called once each job just after ending the event loop ------------
71 void DTMuonSelection::endJob() {
72 }