CMS 3D CMS Logo

DTCalibMuonSelection.cc
Go to the documentation of this file.
1 //
2 // Original Author: Marco Zanetti
3 // Created: Tue Sep 9 15:56:24 CEST 2008
4 
5 // user include files
7 
11 
13 
16 
17 using namespace edm;
18 using namespace reco;
19 
21  muonList = consumes<MuonCollection>(iConfig.getParameter<edm::InputTag>("src"));
22  etaMin = iConfig.getParameter<double>("etaMin");
23  etaMax = iConfig.getParameter<double>("etaMax");
24  ptMin = iConfig.getParameter<double>("ptMin");
25 }
26 
28 
30  bool result = false;
31 
32  //Retrieve the muons list
33  Handle<MuonCollection> MuHandle;
34  iEvent.getByToken(muonList, MuHandle);
35 
36  for (MuonCollection::const_iterator nmuon = MuHandle->begin(); nmuon != MuHandle->end(); ++nmuon) {
37  double ptMuon(0.);
38  double etaMuon(-999.);
39 
40  if (nmuon->isGlobalMuon()) {
41  ptMuon = nmuon->globalTrack()->pt();
42  etaMuon = nmuon->globalTrack()->eta();
43  } else
44  continue;
45 
46  if (ptMuon > ptMin && etaMuon > etaMin && etaMuon < etaMax) {
47  result = true;
48  break;
49  }
50  }
51 
52  return result;
53 }
54 
55 // ------------ method called once each job just before starting event loop ------------
57 
58 // ------------ method called once each job just after ending the event loop ------------
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
constexpr float ptMin
DTCalibMuonSelection(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
bool filter(edm::Event &, const edm::EventSetup &) override
fixed size matrix
HLT enums.
void beginStream(edm::StreamID) override