Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:55:28

0001 #include "L1TMuonEndCapTrackProducer.h"
0002 
0003 L1TMuonEndCapTrackProducer::L1TMuonEndCapTrackProducer(const edm::ParameterSet& iConfig)
0004     : track_finder_(new TrackFinder(iConfig, consumesCollector())), uGMT_converter_(new MicroGMTConverter()) {
0005   // Make output products
0006   produces<EMTFHitCollection>("");                      // All CSC LCTs and RPC clusters received by EMTF
0007   produces<EMTFTrackCollection>("");                    // All output EMTF tracks, in same format as unpacked data
0008   produces<l1t::RegionalMuonCandBxCollection>("EMTF");  // EMTF tracks output to uGMT
0009 }
0010 
0011 L1TMuonEndCapTrackProducer::~L1TMuonEndCapTrackProducer() {}
0012 
0013 void L1TMuonEndCapTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0014   // Create pointers to output products
0015   auto out_hits_tmp = std::make_unique<EMTFHitCollection>();  // before zero suppression
0016   auto out_hits = std::make_unique<EMTFHitCollection>();      // after zero suppression
0017   auto out_tracks = std::make_unique<EMTFTrackCollection>();
0018   auto out_cands = std::make_unique<l1t::RegionalMuonCandBxCollection>();
0019 
0020   // Main EMTF emulator process, produces tracks from hits in each sector in each event
0021   track_finder_->process(iEvent, iSetup, *out_hits_tmp, *out_tracks);
0022 
0023   // Apply zero suppression: only sectors with at least one CSC LCT are read out
0024   // In Run 2, it means RPC hits are only saved if there is at least one CSC LCT in the sector
0025   emtf::sector_array<bool> good_sectors;
0026   good_sectors.fill(false);
0027 
0028   for (const auto& h : *out_hits_tmp) {
0029     if (h.Is_CSC()) {
0030       good_sectors.at(h.Sector_idx()) = true;
0031     }
0032   }
0033 
0034   for (const auto& h : *out_hits_tmp) {
0035     if (good_sectors.at(h.Sector_idx())) {
0036       out_hits->push_back(h);
0037     }
0038   }
0039 
0040   // Convert into uGMT format
0041   uGMT_converter_->convert_all(iEvent, *out_tracks, *out_cands);
0042 
0043   // Fill the output products
0044   iEvent.put(std::move(out_hits), "");
0045   iEvent.put(std::move(out_tracks), "");
0046   iEvent.put(std::move(out_cands), "EMTF");
0047 }
0048 
0049 // Fill 'descriptions' with the allowed parameters
0050 void L1TMuonEndCapTrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0051   // The following says we do not know what parameters are allowed so do no validation
0052   // Please change this to state exactly what you do use, even if it is no parameters
0053   edm::ParameterSetDescription desc;
0054   desc.setUnknown();
0055   descriptions.addDefault(desc);
0056 }
0057 
0058 // Define this as a plug-in
0059 DEFINE_FWK_MODULE(L1TMuonEndCapTrackProducer);