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 ------------
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
Muon.h
DTCalibMuonSelection::beginJob
void beginJob() override
Definition: DTCalibMuonSelection.cc:56
edm
HLT enums.
Definition: AlignableModifier.h:19
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
Track.h
TrackFwd.h
DTCalibMuonSelection::~DTCalibMuonSelection
~DTCalibMuonSelection() override
Definition: DTCalibMuonSelection.cc:27
DTCalibMuonSelection.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
DTCalibMuonSelection::endJob
void endJob() override
Definition: DTCalibMuonSelection.cc:59
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
DTCalibMuonSelection::DTCalibMuonSelection
DTCalibMuonSelection(const edm::ParameterSet &)
Definition: DTCalibMuonSelection.cc:20
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
mps_fire.result
result
Definition: mps_fire.py:303
ParameterSet.h
edm::Event
Definition: Event.h:73
DTCalibMuonSelection::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: DTCalibMuonSelection.cc:29
edm::InputTag
Definition: InputTag.h:15