CMS 3D CMS Logo

ME0MuonTrackCollProducer.cc
Go to the documentation of this file.
1 
15 
16 #include <sstream>
17 
18 #include <memory>
28 
30 public:
32  //std::vector<double> findSimVtx(edm::Event& iEvent);
33  ~ME0MuonTrackCollProducer() override;
34 
35 private:
36  void produce(edm::Event&, const edm::EventSetup&) override;
38  //edm::Handle<reco::ME0MuonCollection> muonCollectionH;
40  std::vector<std::string> selectionTags;
43 };
44 
45 
48 
50 
51 
53  OurMuonsTag(parset.getParameter<edm::InputTag>("me0MuonTag")),
54  selectionTags(parset.getParameter< std::vector<std::string> >("selectionTags")),
55  parset_(parset)
56 {
57  produces<reco::TrackCollection>();
58  OurMuonsToken_ = consumes<ME0MuonCollection>(OurMuonsTag);
59 }
60 
62 }
63 
65 {
66  using namespace reco;
67  using namespace edm;
69  iEvent.getByToken(OurMuonsToken_,OurMuons);
70 
71 
72  std::unique_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
73 
75 
76 
77 
78  for(std::vector<reco::ME0Muon>::const_iterator thismuon = OurMuons->begin();
79  thismuon != OurMuons->end(); ++thismuon) {
80 
81  if (!muon::isGoodMuon(*thismuon, muon::Tight)) continue;
82  reco::TrackRef trackref;
83 
84  if (thismuon->innerTrack().isNonnull()) trackref = thismuon->innerTrack();
85 
86  const reco::Track* trk = &(*trackref);
87  // pointer to old track:
88  //reco::Track* newTrk = new reco::Track(*trk);
89 
90  selectedTracks->push_back( *trk );
91  //selectedTrackExtras->push_back( *newExtra );
92  }
93  iEvent.put(std::move(selectedTracks));
94 
95 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::Handle< std::vector< reco::ME0Muon > > OurMuons
const edm::ParameterSet parset_
int iEvent
Definition: GenABIO.cc:230
ME0MuonTrackCollProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< std::string > selectionTags
RefProd< PROD > getRefBeforePut()
Definition: Event.h:156
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
fixed size matrix
HLT enums.
edm::EDGetTokenT< ME0MuonCollection > OurMuonsToken_
def move(src, dest)
Definition: eostools.py:510