Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:01

0001 #include "FWCore/Framework/interface/Event.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 
0007 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0008 #include "L1Trigger/L1TMuonEndCapPhase2/interface/TrackFinder.h"
0009 
0010 #include "L1TMuonEndCapPhase2TrackProducer.h"
0011 
0012 L1TMuonEndCapPhase2TrackProducer::L1TMuonEndCapPhase2TrackProducer(const edm::ParameterSet& pset)
0013     : track_finder_(std::make_unique<emtf::phase2::TrackFinder>(pset, consumesCollector())),
0014       hit_token_(produces<emtf::phase2::EMTFHitCollection>()),
0015       trk_token_(produces<emtf::phase2::EMTFTrackCollection>()),
0016       in_token_(produces<emtf::phase2::EMTFInputCollection>()) {}
0017 
0018 void L1TMuonEndCapPhase2TrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0019   edm::ParameterSetDescription desc;
0020 
0021   // Neural Network Models
0022   desc.add<std::string>("PromptGraphPath", "L1Trigger/L1TMuonEndCapPhase2/data/prompt_model.pb");
0023   desc.add<std::string>("DisplacedGraphPath", "L1Trigger/L1TMuonEndCapPhase2/data/displaced_model.pb");
0024 
0025   // Input Collections
0026   desc.add<edm::InputTag>("CSCInput", edm::InputTag("simCscTriggerPrimitiveDigisForEMTF"));
0027   desc.add<edm::InputTag>("RPCInput", edm::InputTag("rpcRecHitsForEMTF"));
0028   desc.add<edm::InputTag>("GEMInput", edm::InputTag("simMuonGEMPadDigiClusters"));
0029   desc.add<edm::InputTag>("ME0Input", edm::InputTag("me0TriggerConvertedPseudoDigis"));
0030   desc.add<edm::InputTag>("GE0Input", edm::InputTag("ge0TriggerConvertedPseudoDigis"));
0031 
0032   // Enable Subdetectors
0033   desc.add<bool>("CSCEnabled", true);
0034   desc.add<bool>("RPCEnabled", true);
0035   desc.add<bool>("GEMEnabled", true);
0036   desc.add<bool>("ME0Enabled", true);
0037   desc.add<bool>("GE0Enabled", false);
0038 
0039   // Bunch-Crossing Settings
0040   desc.add<int>("MinBX", -2);
0041   desc.add<int>("MaxBX", 2);
0042   desc.add<int>("BXWindow", 1);
0043 
0044   desc.add<int>("CSCInputBXShift", -8);
0045   desc.add<int>("RPCInputBXShift", 0);
0046   desc.add<int>("GEMInputBXShift", 0);
0047   desc.add<int>("ME0InputBXShift", -8);
0048 
0049   // Primitive Settings
0050   desc.add<bool>("IncludeNeighborEnabled", true);
0051 
0052   // Debug Utils
0053   desc.addUntracked<int>("Verbosity", 3);
0054   desc.add<std::string>("ValidationDirectory", "L1Trigger/L1TMuonEndCapPhase2/data/validation");
0055 
0056   // Register
0057   descriptions.add("L1TMuonEndCapPhase2TrackProducer", desc);
0058 }
0059 
0060 void L1TMuonEndCapPhase2TrackProducer::produce(edm::Event& event, const edm::EventSetup& event_setup) {
0061   emtf::phase2::EMTFHitCollection out_hits;
0062   emtf::phase2::EMTFTrackCollection out_tracks;
0063   emtf::phase2::EMTFInputCollection out_inputs;
0064 
0065   // Forward event to track finder
0066   track_finder_->process(event, event_setup, out_hits, out_tracks, out_inputs);
0067 
0068   // Output
0069   event.emplace(hit_token_, std::move(out_hits));
0070   event.emplace(trk_token_, std::move(out_tracks));
0071   event.emplace(in_token_, std::move(out_inputs));
0072 }
0073 
0074 void L1TMuonEndCapPhase2TrackProducer::beginStream(edm::StreamID stream_id) { track_finder_->onJobBegin(); }
0075 
0076 void L1TMuonEndCapPhase2TrackProducer::endStream() { track_finder_->onJobEnd(); }
0077 
0078 //define this as a plug-in
0079 DEFINE_FWK_MODULE(L1TMuonEndCapPhase2TrackProducer);