RecoMuon
L2MuonProducer
src
L2MuonCandidateProducer.cc
Go to the documentation of this file.
1
18
// Framework
19
#include "
FWCore/Framework/interface/Event.h
"
20
#include "
FWCore/Framework/interface/EventSetup.h
"
21
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
22
#include "
DataFormats/Common/interface/Handle.h
"
23
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
24
25
#include "
RecoMuon/L2MuonProducer/src/L2MuonCandidateProducer.h
"
26
27
// Input and output collections
28
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidate.h
"
29
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h
"
30
31
#include <string>
32
33
using namespace
edm
;
34
using namespace
std
;
35
using namespace
reco
;
36
38
L2MuonCandidateProducer::L2MuonCandidateProducer
(
const
ParameterSet
&
parameterSet
) {
39
LogTrace
(
"Muon|RecoMuon|L2MuonCandidateProducer"
) <<
" constructor called"
;
40
41
// StandAlone Collection Label
42
theSACollectionLabel =
parameterSet
.
getParameter
<
InputTag
>(
"InputObjects"
);
43
tracksToken = consumes<reco::TrackCollection>(theSACollectionLabel);
44
produces<RecoChargedCandidateCollection>();
45
}
46
48
L2MuonCandidateProducer::~L2MuonCandidateProducer
() {
49
LogTrace
(
"Muon|RecoMuon|L2MuonCandidateProducer"
) <<
" L2MuonCandidateProducer destructor called"
;
50
}
51
53
void
L2MuonCandidateProducer::produce
(
edm::StreamID
sid,
Event
&
event
,
const
EventSetup
& eventSetup)
const
{
54
const
string
metname
=
"Muon|RecoMuon|L2MuonCandidateProducer"
;
55
56
// Take the SA container
57
LogTrace
(
metname
) <<
" Taking the StandAlone muons: "
<< theSACollectionLabel;
58
Handle<TrackCollection>
tracks
;
59
event
.getByToken(tracksToken,
tracks
);
60
61
// Create a RecoChargedCandidate collection
62
LogTrace
(
metname
) <<
" Creating the RecoChargedCandidate collection"
;
63
auto
candidates
= std::make_unique<RecoChargedCandidateCollection>();
64
65
for
(
unsigned
int
i
= 0;
i
<
tracks
->size();
i
++) {
66
TrackRef
tkref(
tracks
,
i
);
67
Particle::Charge
q
= tkref->charge();
68
Particle::LorentzVector
p4
(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
69
Particle::Point
vtx
(tkref->vx(), tkref->vy(), tkref->vz());
70
int
pid = 13;
71
if
(
abs
(
q
) == 1)
72
pid =
q
< 0 ? 13 : -13;
73
else
74
LogWarning
(
metname
) <<
"L2MuonCandidate has charge = "
<<
q
;
75
RecoChargedCandidate
cand
(
q
,
p4
,
vtx
, pid);
76
cand
.setTrack(tkref);
77
candidates
->push_back(
cand
);
78
}
79
80
event
.put(
std::move
(
candidates
));
81
82
LogTrace
(
metname
) <<
" Event loaded"
83
<<
"================================"
;
84
}
edm::StreamID
Definition:
StreamID.h:30
Handle.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition:
PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition:
mps_fire.py:355
MessageLogger.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
data-class-funcs.q
q
Definition:
data-class-funcs.py:169
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
edm::Handle
Definition:
AssociativeIterator.h:50
edm::Ref< TrackCollection >
Point
math::XYZPoint Point
Definition:
TrackerDpgAnalysis.cc:107
L2MuonCandidateProducer::~L2MuonCandidateProducer
~L2MuonCandidateProducer() override
destructor
Definition:
L2MuonCandidateProducer.cc:48
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition:
badGlobalMuonTaggersAOD_cff.py:5
edm::LogWarning
Definition:
MessageLogger.h:141
L2MuonCandidateProducer.h
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
cand
Definition:
decayParser.h:34
L2MuonCandidateProducer::produce
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &) const override
produce candidates
Definition:
L2MuonCandidateProducer.cc:53
p4
double p4[4]
Definition:
TauolaWrapper.h:92
reco::RecoChargedCandidate
Definition:
RecoChargedCandidate.h:15
edm::EventSetup
Definition:
EventSetup.h:57
L2MuonCandidateProducer::L2MuonCandidateProducer
L2MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
Definition:
L2MuonCandidateProducer.cc:38
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition:
JetExtendedAssociation.h:25
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
RecoChargedCandidate.h
HLT_2018_cff.candidates
candidates
Definition:
HLT_2018_cff.py:53513
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
PixelTestBeamValidation_cfi.Charge
Charge
Definition:
PixelTestBeamValidation_cfi.py:78
EventSetup.h
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:671
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
RecoChargedCandidateFwd.h
edm::InputTag
Definition:
InputTag.h:15
metname
const std::string metname
Definition:
MuonSeedOrcaPatternRecognition.cc:43
Generated for CMSSW Reference Manual by
1.8.16