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  private:
25 
26 
27 
28 };
29 
31  m_input = parameterSet.getParameter<edm::InputTag>("input");
32  m_minTrkHits = parameterSet.getParameter<int>("minTrkHits");
33  m_minMuonHits = parameterSet.getParameter<int>("minMuonHits");
34  m_maxNormalizedChi2 = parameterSet.getParameter<double>("maxNormalizedChi2");
35  inputToken_ = consumes<reco::TrackCollection>(m_input);
36 
37  produces<reco::TrackCollection>();
38 }
39 
42  event.getByToken(inputToken_,tracks);
43  auto outTracks = std::make_unique<reco::TrackCollection>();
44  for ( reco::TrackCollection::const_iterator trk=tracks->begin(); trk!=tracks->end(); ++trk ){
45  if (trk->normalizedChi2()>m_maxNormalizedChi2) continue;
46  if (trk->hitPattern().numberOfValidTrackerHits()<m_minTrkHits) continue;
47  if (trk->hitPattern().numberOfValidMuonHits()<m_minMuonHits) continue;
48  outTracks->push_back(*trk);
49  }
50  event.put(std::move(outTracks));
51 }
T getParameter(std::string const &) const
double m_maxNormalizedChi2
edm::InputTag m_input
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
L3MuonCleaner(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
~L3MuonCleaner() override
edm::EDGetTokenT< reco::TrackCollection > inputToken_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1