CMS 3D CMS Logo

L2MuonCandidateProducer.cc
Go to the documentation of this file.
1 
18 // Framework
24 
26 
27 // Input and output collections
30 
31 #include <string>
32 
33 using namespace edm;
34 using namespace std;
35 using namespace reco;
36 
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 
49  LogTrace("Muon|RecoMuon|L2MuonCandidateProducer") << " L2MuonCandidateProducer destructor called";
50 }
51 
54  const string metname = "Muon|RecoMuon|L2MuonCandidateProducer";
55 
56  // Take the SA container
57  LogTrace(metname) << " Taking the StandAlone muons: " << theSACollectionLabel;
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;
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: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 >
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
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:57
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:54985
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
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:224
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