Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
);
EDProducer.h
mps_fire.i
i
Definition:
mps_fire.py:428
edmPickEvents.event
tuple event
Definition:
edmPickEvents.py:273
MessageLogger.h
RecoChargedCandidate.h
metname
const std::string metname
Definition:
MuonSeedOrcaPatternRecognition.cc:40
edm::Ref< TrackCollection >
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::StreamID
Definition:
StreamID.h:30
Event.h
MakerMacros.h
edm::Handle< reco::TrackCollection >
EventSetup.h
L2MuonCandidateProducer::tracksToken
edm::EDGetTokenT< reco::TrackCollection > tracksToken
Definition:
L2MuonCandidateProducer.cc:46
tracks
auto const & tracks
cannot be loose
Definition:
CAHitNtupletGeneratorKernelsImpl.h:148
TrackFwd.h
reco::Particle::Charge
int Charge
electric charge type
Definition:
Particle.h:19
edm::EDGetTokenT< reco::TrackCollection >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:234
ParameterSet.h
submitPVResolutionJobs.q
tuple q
Definition:
submitPVResolutionJobs.py:84
L2MuonCandidateProducer::produce
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &) const override
produce candidates
Definition:
L2MuonCandidateProducer.cc:65
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition:
Provenance.cc:11
eostools.move
def move
Definition:
eostools.py:511
reco::RecoChargedCandidate
Definition:
RecoChargedCandidate.h:15
HLT_FULL_cff.candidates
tuple candidates
Definition:
HLT_FULL_cff.py:39063
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
edm::EventSetup
Definition:
EventSetup.h:59
edm::global::EDProducer
Definition:
EDProducer.h:32
L2MuonCandidateProducer::~L2MuonCandidateProducer
~L2MuonCandidateProducer() override
destructor
Definition:
L2MuonCandidateProducer.cc:60
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
RecoChargedCandidateFwd.h
edm::InputTag
Definition:
InputTag.h:15
InputTag.h
Track.h
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
edm::Event
Definition:
Event.h:73
reco::RecoChargedCandidate::setTrack
void setTrack(const reco::TrackRef &r)
set reference to track
Definition:
RecoChargedCandidate.h:32
L2MuonCandidateProducer
Definition:
L2MuonCandidateProducer.cc:32
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
L2MuonCandidateProducer::theSACollectionLabel
edm::InputTag theSACollectionLabel
Definition:
L2MuonCandidateProducer.cc:45
Handle.h
Generated for CMSSW Reference Manual by
1.8.5