CMS 3D CMS Logo

ME0MuonConverter.cc
Go to the documentation of this file.
1 
9 
13 
15 
16 
17 
23 
24 #include "TLorentzVector.h"
25 
28 
30 
31 
34 
48 
49 
52 
53 
56 
58 
59 
60 
63 
64 
65 
67 public:
69  explicit ME0MuonConverter(const edm::ParameterSet&);
71  ~ME0MuonConverter() override;
73  void produce(edm::Event&, const edm::EventSetup&) override;
74 
75 
76 
77 private:
78 
79  //edm::EDGetTokenT<std::vector<reco::ME0Muon>> OurMuonsToken_;
81 };
82 
83 
85 
86  produces<std::vector<reco::RecoChargedCandidate> >();
87  edm::InputTag OurMuonsTag ("me0SegmentMatching");
88  OurMuonsToken_ = consumes<ME0MuonCollection>(OurMuonsTag);
89 
90 }
91 
93 
95 
96  using namespace edm;
97 
98  using namespace reco;
99 
100  // Handle <std::vector<ME0Muon> > OurMuons;
101  // ev.getByToken <std::vector<ME0Muon> > (OurMuonsToken_, OurMuons);
102 
103 
105  ev.getByToken(OurMuonsToken_, OurMuons);
106 
107  auto oc = std::make_unique<RecoChargedCandidateCollection>();
108 
109  for (std::vector<ME0Muon>::const_iterator thisMuon = OurMuons->begin();
110  thisMuon != OurMuons->end(); ++thisMuon){
111  TrackRef tkRef = thisMuon->innerTrack();
112 
113  Particle::Charge q = tkRef->charge();
114  Particle::LorentzVector p4(tkRef->px(), tkRef->py(), tkRef->pz(), tkRef->p());
115  Particle::Point vtx(tkRef->vx(),tkRef->vy(), tkRef->vz());
116 
117  int pid = 0;
118  if(abs(q)==1) pid = q < 0 ? 13 : -13;
120  cand.setTrack(thisMuon->innerTrack());
121  oc->push_back(cand);
122  }
123 
124  ev.put(std::move(oc));
125 }
126 
127 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool ev
std::pair< double, double > Point
Definition: CaloEllipse.h:18
~ME0MuonConverter() override
Destructor.
double p4[4]
Definition: TauolaWrapper.h:92
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:510
math::PtEtaPhiELorentzVectorF LorentzVector