src
RecoMuon
L2MuonProducer
plugins
L2MuonCandidateProducer.cc
Go to the documentation of this file.
1
18
#include <string>
19
20
#include "
DataFormats/Common/interface/Handle.h
"
21
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidate.h
"
22
#include "
DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h
"
23
#include "
DataFormats/TrackReco/interface/Track.h
"
24
#include "
DataFormats/TrackReco/interface/TrackFwd.h
"
25
#include "
FWCore/Framework/interface/Event.h
"
26
#include "
FWCore/Framework/interface/EventSetup.h
"
27
#include "
FWCore/Framework/interface/global/EDProducer.h
"
28
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
29
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
30
#include "
FWCore/Utilities/interface/InputTag.h
"
31
32
class
L2MuonCandidateProducer
:
public
edm::global::EDProducer
<> {
33
public
:
35
L2MuonCandidateProducer
(
const
edm::ParameterSet
&);
36
38
~L2MuonCandidateProducer
()
override
;
39
41
void
produce
(
edm::StreamID
sid,
edm::Event
&
event
,
const
edm::EventSetup
&)
const override
;
42
43
private
:
44
// StandAlone Collection Label
45
edm::InputTag
theSACollectionLabel
;
46
edm::EDGetTokenT<reco::TrackCollection>
tracksToken
;
47
};
48
50
L2MuonCandidateProducer::L2MuonCandidateProducer
(
const
edm::ParameterSet
&
parameterSet
) {
51
LogTrace
(
"Muon|RecoMuon|L2MuonCandidateProducer"
) <<
" constructor called"
;
52
53
// StandAlone Collection Label
54
theSACollectionLabel
=
parameterSet
.
getParameter
<
edm::InputTag
>(
"InputObjects"
);
55
tracksToken
= consumes<reco::TrackCollection>(
theSACollectionLabel
);
56
produces<reco::RecoChargedCandidateCollection>();
57
}
58
60
L2MuonCandidateProducer::~L2MuonCandidateProducer
() {
61
LogTrace
(
"Muon|RecoMuon|L2MuonCandidateProducer"
) <<
" L2MuonCandidateProducer destructor called"
;
62
}
63
65
void
L2MuonCandidateProducer::produce
(
edm::StreamID
sid,
edm::Event
&
event
,
const
edm::EventSetup
&
eventSetup
)
const
{
66
const
std::string
metname
=
"Muon|RecoMuon|L2MuonCandidateProducer"
;
67
68
// Take the SA container
69
LogTrace
(
metname
) <<
" Taking the StandAlone muons: "
<<
theSACollectionLabel
;
70
edm::Handle<reco::TrackCollection>
tracks
;
71
event
.getByToken(
tracksToken
,
tracks
);
72
73
// Create a RecoChargedCandidate collection
74
LogTrace
(
metname
) <<
" Creating the RecoChargedCandidate collection"
;
75
auto
candidates
= std::make_unique<reco::RecoChargedCandidateCollection>();
76
77
for
(
unsigned
int
i
= 0;
i
<
tracks
->size();
i
++) {
78
reco::TrackRef
tkref(
tracks
,
i
);
79
reco::Particle::Charge
q
= tkref->charge();
80
reco::Particle::LorentzVector
p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
81
reco::Particle::Point
vtx
(tkref->vx(), tkref->vy(), tkref->vz());
82
int
pid = 13;
83
if
(
abs
(
q
) == 1)
84
pid =
q
< 0 ? 13 : -13;
85
else
86
edm::LogWarning
(
metname
) <<
"L2MuonCandidate has charge = "
<<
q
;
87
reco::RecoChargedCandidate
cand
(
q
, p4,
vtx
, pid);
88
cand
.setTrack(tkref);
89
candidates
->push_back(
cand
);
90
}
91
92
event
.put(
std::move
(
candidates
));
93
94
LogTrace
(
metname
) <<
" Event loaded"
95
<<
"================================"
;
96
}
97
98
// declare as a framework plugin
99
#include "
FWCore/Framework/interface/MakerMacros.h
"
100
DEFINE_FWK_MODULE
(
L2MuonCandidateProducer
);
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:307
mps_fire.i
i
Definition:
mps_fire.py:429
MessageLogger.h
RecoChargedCandidate.h
metname
const std::string metname
Definition:
MuonSeedOrcaPatternRecognition.cc:40
edm::Ref< TrackCollection >
edm::StreamID
Definition:
StreamID.h:30
Event.h
edm::Handle< reco::TrackCollection >
EventSetup.h
L1BJetProducer_cff.vtx
vtx
Definition:
L1BJetProducer_cff.py:10
L2MuonCandidateProducer::tracksToken
edm::EDGetTokenT< reco::TrackCollection > tracksToken
Definition:
L2MuonCandidateProducer.cc:46
TrackFwd.h
reco::Particle::Charge
int Charge
electric charge type
Definition:
Particle.h:19
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
edm::EDGetTokenT< reco::TrackCollection >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:242
ParameterSet.h
DiMuonV_cfg.tracks
tracks
Definition:
DiMuonV_cfg.py:215
L2MuonCandidateProducer::produce
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &) const override
produce candidates
Definition:
L2MuonCandidateProducer.cc:65
reco::RecoChargedCandidate
Definition:
RecoChargedCandidate.h:15
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition:
Particle.h:25
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
L2MuonCandidateProducer::L2MuonCandidateProducer
L2MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
Definition:
L2MuonCandidateProducer.cc:50
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::EventSetup
Definition:
EventSetup.h:56
edm::global::EDProducer
Definition:
EDProducer.h:32
L2MuonCandidateProducer::~L2MuonCandidateProducer
~L2MuonCandidateProducer() override
destructor
Definition:
L2MuonCandidateProducer.cc:60
submitPVResolutionJobs.q
q
Definition:
submitPVResolutionJobs.py:83
EDProducer.h
HLT_2024v14_cff.candidates
candidates
Definition:
HLT_2024v14_cff.py:38869
RecoChargedCandidateFwd.h
edm::InputTag
Definition:
InputTag.h:15
InputTag.h
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:48
cand
Definition:
decayParser.h:32
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:128
edm::Event
Definition:
Event.h:73
options_cfi.eventSetup
eventSetup
Definition:
options_cfi.py:11
L2MuonCandidateProducer
Definition:
L2MuonCandidateProducer.cc:32
MakerMacros.h
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
L2MuonCandidateProducer::theSACollectionLabel
edm::InputTag theSACollectionLabel
Definition:
L2MuonCandidateProducer.cc:45
eostools.move
def move(src, dest)
Definition:
eostools.py:511
event
Definition:
event.py:1
Handle.h
Generated for CMSSW Reference Manual by
1.8.14