RecoMuon
L3MuonProducer
src
L3MuonCleaner.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// Framework
3
#include "
FWCore/Framework/interface/global/EDProducer.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
7
#include "
DataFormats/Common/interface/Handle.h
"
8
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
9
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
10
#include "
FWCore/Framework/interface/MakerMacros.h
"
11
#include "
DataFormats/TrackReco/interface/Track.h
"
12
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
13
14
class
L3MuonCleaner
:
public
edm::global::EDProducer
<> {
15
public
:
16
L3MuonCleaner
(
const
edm::ParameterSet
&);
17
~L3MuonCleaner
()
override
{}
18
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
19
20
private
:
21
edm::InputTag
m_input
;
22
int
m_minTrkHits
;
23
int
m_minMuonHits
;
24
double
m_maxNormalizedChi2
;
25
edm::EDGetTokenT<reco::TrackCollection>
inputToken_
;
26
};
27
28
L3MuonCleaner::L3MuonCleaner
(
const
edm::ParameterSet
&
parameterSet
) {
29
m_input
=
parameterSet
.
getParameter
<
edm::InputTag
>(
"input"
);
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
38
void
L3MuonCleaner::produce
(
edm::StreamID
,
edm::Event
&
event
,
const
edm::EventSetup
&)
const
{
39
edm::Handle<reco::TrackCollection>
tracks
;
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
}
53
DEFINE_FWK_MODULE
(
L3MuonCleaner
);
edm::StreamID
Definition:
StreamID.h:30
Handle.h
MessageLogger.h
edm::EDGetTokenT< reco::TrackCollection >
L3MuonCleaner::L3MuonCleaner
L3MuonCleaner(const edm::ParameterSet &)
Definition:
L3MuonCleaner.cc:28
edm::Handle< reco::TrackCollection >
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
L3MuonCleaner::m_minMuonHits
int m_minMuonHits
Definition:
L3MuonCleaner.cc:23
L3MuonCleaner::inputToken_
edm::EDGetTokenT< reco::TrackCollection > inputToken_
Definition:
L3MuonCleaner.cc:25
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
L3MuonCleaner::m_input
edm::InputTag m_input
Definition:
L3MuonCleaner.cc:21
L3MuonCleaner::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
L3MuonCleaner.cc:38
edm::global::EDProducer
Definition:
EDProducer.h:32
L3MuonCleaner::~L3MuonCleaner
~L3MuonCleaner() override
Definition:
L3MuonCleaner.cc:17
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition:
CAHitNtupletGeneratorKernelsImpl.h:176
ModuleDef.h
edm::EventSetup
Definition:
EventSetup.h:58
eostools.move
def move(src, dest)
Definition:
eostools.py:511
L3MuonCleaner::m_maxNormalizedChi2
double m_maxNormalizedChi2
Definition:
L3MuonCleaner.cc:24
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
ParameterSet.h
EDProducer.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
L3MuonCleaner
Definition:
L3MuonCleaner.cc:14
L3MuonCleaner::m_minTrkHits
int m_minTrkHits
Definition:
L3MuonCleaner.cc:22
Generated for CMSSW Reference Manual by
1.8.16