test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
6 
7 // user include files
9 
13 
15 
18 
19 using namespace edm;
20 using namespace reco;
21 
23 {
24  muonList = consumes<MuonCollection>(iConfig.getParameter<edm::InputTag>("src"));
25  etaMin = iConfig.getParameter<double>("etaMin");
26  etaMax = iConfig.getParameter<double>("etaMax");
27  ptMin = iConfig.getParameter<double>("ptMin");
28 }
29 
30 
32 
33 
35 {
36  bool result = false;
37 
38  //Retrieve the muons list
39  Handle<MuonCollection> MuHandle;
40  iEvent.getByToken(muonList,MuHandle);
41 
42  for (MuonCollection::const_iterator nmuon = MuHandle->begin(); nmuon != MuHandle->end(); ++nmuon) {
43 
44  double ptMuon(0.);
45  double etaMuon(-999.);
46 
47  if(nmuon->isGlobalMuon()){
48  ptMuon = nmuon->globalTrack()->pt();
49  etaMuon = nmuon->globalTrack()->eta();
50  }
51  else continue;
52 
53  if(ptMuon > ptMin &&etaMuon > etaMin && etaMuon < etaMax){
54  result = true;
55  break;
56  }
57 
58  }
59 
60  return result;
61 }
62 
63 
64 
65 // ------------ method called once each job just before starting event loop ------------
67 }
68 
69 
70 
71 // ------------ method called once each job just after ending the event loop ------------
73 }
74 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
virtual bool filter(edm::Event &, const edm::EventSetup &)
DTCalibMuonSelection(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:230
tuple result
Definition: query.py:137