CMS 3D CMS Logo

ME0MuonConverter.cc
Go to the documentation of this file.
1 
8 
12 
14 
20 
21 #include "TLorentzVector.h"
22 
25 
27 
30 
44 
47 
50 
52 
55 
57 public:
59  explicit ME0MuonConverter(const edm::ParameterSet&);
61  ~ME0MuonConverter() override;
63  void produce(edm::Event&, const edm::EventSetup&) override;
64 
65 private:
66  //edm::EDGetTokenT<std::vector<reco::ME0Muon>> OurMuonsToken_;
68 };
69 
71  produces<std::vector<reco::RecoChargedCandidate> >();
72  edm::InputTag OurMuonsTag("me0SegmentMatching");
73  OurMuonsToken_ = consumes<ME0MuonCollection>(OurMuonsTag);
74 }
75 
77 
79  using namespace edm;
80 
81  using namespace reco;
82 
83  // Handle <std::vector<ME0Muon> > OurMuons;
84  // ev.getByToken <std::vector<ME0Muon> > (OurMuonsToken_, OurMuons);
85 
87  ev.getByToken(OurMuonsToken_, OurMuons);
88 
89  auto oc = std::make_unique<RecoChargedCandidateCollection>();
90 
91  for (std::vector<ME0Muon>::const_iterator thisMuon = OurMuons->begin(); thisMuon != OurMuons->end(); ++thisMuon) {
92  TrackRef tkRef = thisMuon->innerTrack();
93 
94  Particle::Charge q = tkRef->charge();
95  Particle::LorentzVector p4(tkRef->px(), tkRef->py(), tkRef->pz(), tkRef->p());
96  Particle::Point vtx(tkRef->vx(), tkRef->vy(), tkRef->vz());
97 
98  int pid = 0;
99  if (abs(q) == 1)
100  pid = q < 0 ? 13 : -13;
102  cand.setTrack(thisMuon->innerTrack());
103  oc->push_back(cand);
104  }
105 
106  ev.put(std::move(oc));
107 }
108 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool ev
~ME0MuonConverter() override
Destructor.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void produce(edm::Event &, const edm::EventSetup &) override
Produce the converted collection.
edm::EDGetTokenT< ME0MuonCollection > OurMuonsToken_
ME0MuonConverter(const edm::ParameterSet &)
Constructor.
fixed size matrix
HLT enums.
void setTrack(const reco::TrackRef &r)
set reference to track
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector