L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTProducer.cc
// ------------ method called to produce the data  ------------
method called to produce the data
method called to produce the data
void Phase2L1TGMTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
  using namespace edm;
  Handle<l1t::TrackerMuon::L1TTTrackCollection> trackHandle;
  iEvent.getByToken(srcTracks_, trackHandle);
  std::vector<edm::Ptr<l1t::TrackerMuon::L1TTTrackType> > tracks;
  for (uint i = 0; i < trackHandle->size(); ++i) {
    edm::Ptr<l1t::TrackerMuon::L1TTTrackType> track(trackHandle, i);
    if (track->momentum().transverse() < 2.0)
      continue;
    if (track->getStubRefs().size() >= (unsigned int)(minTrackStubs_))
      tracks.push_back(track);
  }
  Handle<std::vector<l1t::MuonStub> > stubHandle;
  iEvent.getByToken(srcStubs_, stubHandle);
  l1t::MuonStubRefVector stubs;
  for (uint i = 0; i < stubHandle->size(); ++i) {
    l1t::MuonStubRef stub(stubHandle, i);
    if (stub->bxNum() >= bxMin_ && stub->bxNum() <= bxMax_)
      stubs.push_back(stub);
  }
  ObjectRefBxCollection<RegionalMuonCand> muonTracks;
  Handle<BXVector<RegionalMuonCand> > bmtfHandle;
  iEvent.getByToken(bmtfTracks_, bmtfHandle);
  Handle<BXVector<RegionalMuonCand> > emtfHandle;
  iEvent.getByToken(emtfTracks_, emtfHandle);
  Handle<BXVector<RegionalMuonCand> > omtfHandle;
  iEvent.getByToken(omtfTracks_, omtfHandle);
  for (int bx = bxMin_; bx <= bxMax_; ++bx) {
    if (bx >= bmtfHandle->getFirstBX() && bx <= bmtfHandle->getLastBX())
      for (size_t i = 0; i < bmtfHandle->size(bx); ++i) {
        RegionalMuonCandRef muon(bmtfHandle, i);
        muonTracks.push_back(bx, muon);
      }
    if (bx >= omtfHandle->getFirstBX() && bx <= omtfHandle->getLastBX())
      for (size_t i = 0; i < omtfHandle->size(bx); ++i) {
        RegionalMuonCandRef muon(omtfHandle, i);
        muonTracks.push_back(bx, muon);
      }
    if (bx >= emtfHandle->getFirstBX() && bx <= emtfHandle->getLastBX())
      for (size_t i = 0; i < emtfHandle->size(bx); ++i) {
        RegionalMuonCandRef muon(emtfHandle, i);
        muonTracks.push_back(bx, muon);
      }
  }
  std::vector<l1t::TrackerMuon> out = node_->processEvent(tracks, muonTracks, stubs);
  std::unique_ptr<std::vector<l1t::TrackerMuon> > out1 = std::make_unique<std::vector<l1t::TrackerMuon> >(out);
  iEvent.put(std::move(out1));
}
void Phase2L1TGMTProducer :: produce ( edm :: Event & iEvent , const edm :: EventSetup & iSetup ) { using namespace edm ; Handle < l1t :: TrackerMuon :: L1TTTrackCollection > trackHandle ; iEvent . getByToken ( srcTracks_ , trackHandle ) ; std :: vector < edm :: Ptr < l1t :: TrackerMuon :: L1TTTrackType > > tracks ; for ( uint i = 0 ; i < trackHandle -> size ( ) ; ++ i ) { edm :: Ptr < l1t :: TrackerMuon :: L1TTTrackType > track ( trackHandle , i ) ; if ( track -> momentum ( ) . transverse ( ) < 2.0 ) continue ; if ( track -> getStubRefs ( ) . size ( ) >= ( unsigned int ) ( minTrackStubs_ ) ) tracks . push_back ( track ) ; } Handle < std :: vector < l1t :: MuonStub > > stubHandle ; iEvent . getByToken ( srcStubs_ , stubHandle ) ; l1t :: MuonStubRefVector stubs ; for ( uint i = 0 ; i < stubHandle -> size ( ) ; ++ i ) { l1t :: MuonStubRef stub ( stubHandle , i ) ; if ( stub -> bxNum ( ) >= bxMin_ && stub -> bxNum ( ) <= bxMax_ ) stubs . push_back ( stub ) ; } ObjectRefBxCollection < RegionalMuonCand > muonTracks ; Handle < BXVector < RegionalMuonCand > > bmtfHandle ; iEvent . getByToken ( bmtfTracks_ , bmtfHandle ) ; Handle < BXVector < RegionalMuonCand > > emtfHandle ; iEvent . getByToken ( emtfTracks_ , emtfHandle ) ; Handle < BXVector < RegionalMuonCand > > omtfHandle ; iEvent . getByToken ( omtfTracks_ , omtfHandle ) ; for ( int bx = bxMin_ ; bx <= bxMax_ ; ++ bx ) { if ( bx >= bmtfHandle -> getFirstBX ( ) && bx <= bmtfHandle -> getLastBX ( ) ) for ( size_t i = 0 ; i < bmtfHandle -> size ( bx ) ; ++ i ) { RegionalMuonCandRef muon ( bmtfHandle , i ) ; muonTracks . push_back ( bx , muon ) ; } if ( bx >= omtfHandle -> getFirstBX ( ) && bx <= omtfHandle -> getLastBX ( ) ) for ( size_t i = 0 ; i < omtfHandle -> size ( bx ) ; ++ i ) { RegionalMuonCandRef muon ( omtfHandle , i ) ; muonTracks . push_back ( bx , muon ) ; } if ( bx >= emtfHandle -> getFirstBX ( ) && bx <= emtfHandle -> getLastBX ( ) ) for ( size_t i = 0 ; i < emtfHandle -> size ( bx ) ; ++ i ) { RegionalMuonCandRef muon ( emtfHandle , i ) ; muonTracks . push_back ( bx , muon ) ; } } std :: vector < l1t :: TrackerMuon > out = node_ -> processEvent ( tracks , muonTracks , stubs ) ; std :: unique_ptr < std :: vector < l1t :: TrackerMuon > > out1 = std :: make_unique < std :: vector < l1t :: TrackerMuon > > ( out ) ; iEvent . put ( std :: move ( out1 ) ) ; }
method called to produce the data
method called to produce the data
//   BXVector<RegionalMuonCand> muonTracks;