CMS 3D CMS Logo

L3MuonCleaner.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Framework
13 
15 public:
17  ~L3MuonCleaner() override {}
18  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
19 
20 private:
26 };
27 
30  m_minTrkHits = parameterSet.getParameter<int>("minTrkHits");
31  m_minMuonHits = parameterSet.getParameter<int>("minMuonHits");
32  m_maxNormalizedChi2 = parameterSet.getParameter<double>("maxNormalizedChi2");
33  inputToken_ = consumes<reco::TrackCollection>(m_input);
34 
35  produces<reco::TrackCollection>();
36 }
37 
40  event.getByToken(inputToken_, tracks);
41  auto outTracks = std::make_unique<reco::TrackCollection>();
42  for (reco::TrackCollection::const_iterator trk = tracks->begin(); trk != tracks->end(); ++trk) {
43  if (trk->normalizedChi2() > m_maxNormalizedChi2)
44  continue;
45  if (trk->hitPattern().numberOfValidTrackerHits() < m_minTrkHits)
46  continue;
47  if (trk->hitPattern().numberOfValidMuonHits() < m_minMuonHits)
48  continue;
49  outTracks->push_back(*trk);
50  }
51  event.put(std::move(outTracks));
52 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double m_maxNormalizedChi2
edm::InputTag m_input
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
L3MuonCleaner(const edm::ParameterSet &)
auto const & tracks
cannot be loose
~L3MuonCleaner() override
edm::EDGetTokenT< reco::TrackCollection > inputToken_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1