Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:55

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