L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTStubProducer.cc
// ------------ method called to produce the data  ------------
method called to produce the data
method called to produce the data
void Phase2L1TGMTStubProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
  using namespace edm;
  translator_->checkAndUpdateGeometry(iSetup);
  Handle<MuonDigiCollection<CSCDetId, CSCCorrelatedLCTDigi>> cscDigis;
  iEvent.getByToken(srcCSC_, cscDigis);
  Handle<RPCDigiCollection> rpcDigis;
  iEvent.getByToken(srcRPC_, rpcDigis);
  Handle<L1Phase2MuDTPhContainer> dtDigis;
  iEvent.getByToken(srcDT_, dtDigis);
  Handle<L1MuDTChambThContainer> dtThetaDigis;
  iEvent.getByToken(srcDTTheta_, dtThetaDigis);
  l1t::MuonStubCollection stubs;
  uint count0 = 0;
  uint count1 = 0;
  uint count2 = 0;
  uint count3 = 0;
  uint count4 = 0;
  l1t::MuonStubCollection stubsEndcap = procEndcap_->makeStubs(*cscDigis, *rpcDigis, translator_, iSetup);
  for (auto& stub : stubsEndcap) {
    if (stub.tfLayer() == 0) {
      stub.setID(count0);
      count0++;
    } else if (stub.tfLayer() == 1) {
      stub.setID(count1);
      count1++;
    } else if (stub.tfLayer() == 2) {
      stub.setID(count2);
      count2++;
    } else if (stub.tfLayer() == 3) {
      stub.setID(count3);
      count3++;
    } else {
      stub.setID(count4);
      count4++;
    }
    stubs.push_back(stub);
  }
  l1t::MuonStubCollection stubsBarrel = procBarrel_->makeStubs(dtDigis.product(), dtThetaDigis.product());
  for (auto& stub : stubsBarrel) {
    if (stub.tfLayer() == 0) {
      stub.setID(count0);
      count0++;
    } else if (stub.tfLayer() == 1) {
      stub.setID(count1);
      count1++;
    } else if (stub.tfLayer() == 2) {
      stub.setID(count2);
      count2++;
    } else if (stub.tfLayer() == 3) {
      stub.setID(count3);
      count3++;
    } else {
      stub.setID(count4);
      count4++;
    }
    stubs.push_back(stub);
  }
  iEvent.put(std::make_unique<l1t::MuonStubCollection>(stubs));
}
void Phase2L1TGMTStubProducer :: produce ( edm :: Event & iEvent , const edm :: EventSetup & iSetup ) { using namespace edm ; translator_ -> checkAndUpdateGeometry ( iSetup ) ; Handle < MuonDigiCollection < CSCDetId , CSCCorrelatedLCTDigi > > cscDigis ; iEvent . getByToken ( srcCSC_ , cscDigis ) ; Handle < RPCDigiCollection > rpcDigis ; iEvent . getByToken ( srcRPC_ , rpcDigis ) ; Handle < L1Phase2MuDTPhContainer > dtDigis ; iEvent . getByToken ( srcDT_ , dtDigis ) ; Handle < L1MuDTChambThContainer > dtThetaDigis ; iEvent . getByToken ( srcDTTheta_ , dtThetaDigis ) ; l1t :: MuonStubCollection stubs ; uint count0 = 0 ; uint count1 = 0 ; uint count2 = 0 ; uint count3 = 0 ; uint count4 = 0 ; l1t :: MuonStubCollection stubsEndcap = procEndcap_ -> makeStubs ( * cscDigis , * rpcDigis , translator_ , iSetup ) ; for ( auto & stub : stubsEndcap ) { if ( stub . tfLayer ( ) == 0 ) { stub . setID ( count0 ) ; count0 ++ ; } else if ( stub . tfLayer ( ) == 1 ) { stub . setID ( count1 ) ; count1 ++ ; } else if ( stub . tfLayer ( ) == 2 ) { stub . setID ( count2 ) ; count2 ++ ; } else if ( stub . tfLayer ( ) == 3 ) { stub . setID ( count3 ) ; count3 ++ ; } else { stub . setID ( count4 ) ; count4 ++ ; } stubs . push_back ( stub ) ; } l1t :: MuonStubCollection stubsBarrel = procBarrel_ -> makeStubs ( dtDigis . product ( ) , dtThetaDigis . product ( ) ) ; for ( auto & stub : stubsBarrel ) { if ( stub . tfLayer ( ) == 0 ) { stub . setID ( count0 ) ; count0 ++ ; } else if ( stub . tfLayer ( ) == 1 ) { stub . setID ( count1 ) ; count1 ++ ; } else if ( stub . tfLayer ( ) == 2 ) { stub . setID ( count2 ) ; count2 ++ ; } else if ( stub . tfLayer ( ) == 3 ) { stub . setID ( count3 ) ; count3 ++ ; } else { stub . setID ( count4 ) ; count4 ++ ; } stubs . push_back ( stub ) ; } iEvent . put ( std :: make_unique < l1t :: MuonStubCollection > ( stubs ) ) ; }
method called to produce the data
method called to produce the data
//Generate a unique stub ID