CMS 3D CMS Logo

L2MuonCandidateProducer.cc
Go to the documentation of this file.
1 
18 #include <string>
19 
31 
33 public:
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
47 };
48 
51  LogTrace("Muon|RecoMuon|L2MuonCandidateProducer") << " constructor called";
52 
53  // StandAlone Collection Label
55  tracksToken = consumes<reco::TrackCollection>(theSACollectionLabel);
56  produces<reco::RecoChargedCandidateCollection>();
57 }
58 
61  LogTrace("Muon|RecoMuon|L2MuonCandidateProducer") << " L2MuonCandidateProducer destructor called";
62 }
63 
66  const std::string metname = "Muon|RecoMuon|L2MuonCandidateProducer";
67 
68  // Take the SA container
69  LogTrace(metname) << " Taking the StandAlone muons: " << theSACollectionLabel;
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;
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
edm::StreamID
Definition: StreamID.h:30
L2MuonCandidateProducer
Definition: L2MuonCandidateProducer.cc:32
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
L2MuonCandidateProducer::tracksToken
edm::EDGetTokenT< reco::TrackCollection > tracksToken
Definition: L2MuonCandidateProducer.cc:46
edm::EDGetTokenT< reco::TrackCollection >
edm::Handle< reco::TrackCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
edm::Ref< TrackCollection >
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
L2MuonCandidateProducer::~L2MuonCandidateProducer
~L2MuonCandidateProducer() override
destructor
Definition: L2MuonCandidateProducer.cc:60
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
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:65
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:50
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
RecoChargedCandidate.h
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:55017
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
L2MuonCandidateProducer::theSACollectionLabel
edm::InputTag theSACollectionLabel
Definition: L2MuonCandidateProducer.cc:45
EDProducer.h
reco::Particle::Charge
int Charge
electric charge type
Definition: Particle.h:19
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