Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:23:19

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