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
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
Definition:
AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
edm::Ref< TrackCollection >
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
Point
math::XYZPoint Point
Definition:
TrackerDpgAnalysis.cc:106
L2MuonCandidateProducer::~L2MuonCandidateProducer
~L2MuonCandidateProducer() override
destructor
Definition:
L2MuonCandidateProducer.cc:48
L2MuonCandidateProducer.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition:
CAHitNtupletGeneratorKernelsImpl.h:159
cand
Definition:
decayParser.h:32
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
submitPVResolutionJobs.q
q
Definition:
submitPVResolutionJobs.py:84
edm::EventSetup
Definition:
EventSetup.h:58
L2MuonCandidateProducer::L2MuonCandidateProducer
L2MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
Definition:
L2MuonCandidateProducer.cc:38
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
HLT_FULL_cff.candidates
candidates
Definition:
HLT_FULL_cff.py:54996
PixelTestBeamValidation_cfi.Charge
Charge
Definition:
PixelTestBeamValidation_cfi.py:91
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
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
metname
const std::string metname
Definition:
MuonSeedOrcaPatternRecognition.cc:40
Generated for CMSSW Reference Manual by
1.8.16