RecoMuon
L3MuonProducer
src
L3MuonCandidateProducerFromMuons.cc
Go to the documentation of this file.
1
8
// Framework
9
#include "
FWCore/Framework/interface/Event.h
"
10
#include "
FWCore/Framework/interface/EventSetup.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
DataFormats/Common/interface/Handle.h
"
13
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
14
15
#include "
RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.h
"
16
17
// Input and output collections
18
#include "
DataFormats/TrackReco/interface/Track.h
"
19
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
20
21
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidate.h
"
22
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h
"
23
24
#include <string>
25
26
using namespace
edm
;
27
using namespace
std
;
28
using namespace
reco
;
29
30
static
const
std::string
category
(
"Muon|RecoMuon|L3MuonCandidateProducerFromMuons"
);
31
33
L3MuonCandidateProducerFromMuons::L3MuonCandidateProducerFromMuons
(
const
ParameterSet
&
parameterSet
)
34
: m_L3CollectionLabel(
parameterSet
.getParameter<
InputTag
>(
"InputObjects"
))
// standAlone Collection Label
35
{
36
muonToken_
= consumes<reco::MuonCollection>(
m_L3CollectionLabel
);
37
LogTrace
(
category
) <<
" constructor called"
;
38
produces<RecoChargedCandidateCollection>();
39
}
40
42
L3MuonCandidateProducerFromMuons::~L3MuonCandidateProducerFromMuons
() {
43
LogTrace
(
category
) <<
" L3MuonCandidateProducerFromMuons destructor called"
;
44
}
45
47
void
L3MuonCandidateProducerFromMuons::produce
(
StreamID
,
Event
&
event
,
const
EventSetup
& eventSetup)
const
{
48
// Create a RecoChargedCandidate collection
49
LogTrace
(
category
) <<
" Creating the RecoChargedCandidate collection"
;
50
auto
candidates
= std::make_unique<RecoChargedCandidateCollection>();
51
52
// Take the L3 container
53
LogTrace
(
category
) <<
" Taking the L3/GLB muons: "
<<
m_L3CollectionLabel
.
label
();
54
Handle<reco::MuonCollection>
muons
;
55
event
.getByToken(
muonToken_
,
muons
);
56
57
if
(not
muons
.isValid()) {
58
LogError
(
category
) <<
muons
.whyFailed()->what();
59
}
else
{
60
for
(
unsigned
int
i
= 0;
i
<
muons
->size();
i
++) {
61
// avoids crashing in case the muon is SA only.
62
TrackRef
tkref = ((*muons)[
i
].innerTrack().isNonnull()) ? (*
muons
)[
i
].innerTrack() : (*muons)[
i
].muonBestTrack();
63
64
Particle::Charge
q
= tkref->charge();
65
Particle::LorentzVector
p4
(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
66
Particle::Point
vtx
(tkref->vx(), tkref->vy(), tkref->vz());
67
68
int
pid = 13;
69
if
(
abs
(
q
) == 1)
70
pid =
q
< 0 ? 13 : -13;
71
else
72
LogWarning
(
category
) <<
"L3MuonCandidate has charge = "
<<
q
;
73
RecoChargedCandidate
cand
(
q
,
p4
,
vtx
, pid);
74
75
cand
.setTrack(tkref);
76
candidates
->push_back(
cand
);
77
}
78
}
79
event
.put(
std::move
(
candidates
));
80
}
L3MuonCandidateProducerFromMuons::~L3MuonCandidateProducerFromMuons
~L3MuonCandidateProducerFromMuons() override
destructor
Definition:
L3MuonCandidateProducerFromMuons.cc:42
edm::StreamID
Definition:
StreamID.h:30
PDWG_BPHSkim_cff.muons
muons
Definition:
PDWG_BPHSkim_cff.py:47
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
MessageLogger.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
edm::Handle< reco::MuonCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
edm::Ref< TrackCollection >
L3MuonCandidateProducerFromMuons.h
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
edm::InputTag::label
std::string const & label() const
Definition:
InputTag.h:36
Point
math::XYZPoint Point
Definition:
TrackerDpgAnalysis.cc:106
category
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
Track.h
TrackFwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
L3MuonCandidateProducerFromMuons::L3MuonCandidateProducerFromMuons
L3MuonCandidateProducerFromMuons(const edm::ParameterSet &)
constructor with config
Definition:
L3MuonCandidateProducerFromMuons.cc:33
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
cand
Definition:
decayParser.h:32
p4
double p4[4]
Definition:
TauolaWrapper.h:92
reco::RecoChargedCandidate
Definition:
RecoChargedCandidate.h:15
submitPVResolutionJobs.q
q
Definition:
submitPVResolutionJobs.py:84
edm::EventSetup
Definition:
EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition:
JetExtendedAssociation.h:25
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
extraflags_cff.vtx
vtx
Definition:
extraflags_cff.py:18
RecoChargedCandidate.h
L3MuonCandidateProducerFromMuons::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
produce candidates
Definition:
L3MuonCandidateProducerFromMuons.cc:47
HLT_FULL_cff.candidates
candidates
Definition:
HLT_FULL_cff.py:54992
PixelTestBeamValidation_cfi.Charge
Charge
Definition:
PixelTestBeamValidation_cfi.py:91
L3MuonCandidateProducerFromMuons::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition:
L3MuonCandidateProducerFromMuons.h:38
EventSetup.h
L3MuonCandidateProducerFromMuons::m_L3CollectionLabel
edm::InputTag m_L3CollectionLabel
Definition:
L3MuonCandidateProducerFromMuons.h:37
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:234
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
RecoChargedCandidateFwd.h
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16