File indexing completed on 2024-04-06 12:20:59
0001 #include "L1Trigger/L1TMuonEndCap/interface/TrackFinder.h"
0002
0003 #include <iostream>
0004 #include <sstream>
0005
0006 TrackFinder::TrackFinder(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iConsumes)
0007 : setup_(iConfig, iConsumes),
0008 sector_processors_(),
0009 tokenDTPhi_(iConsumes.consumes<emtf::DTTag::digi_collection>(iConfig.getParameter<edm::InputTag>("DTPhiInput"))),
0010 tokenDTTheta_(
0011 iConsumes.consumes<emtf::DTTag::theta_digi_collection>(iConfig.getParameter<edm::InputTag>("DTThetaInput"))),
0012 tokenCSC_(iConsumes.consumes<emtf::CSCTag::digi_collection>(iConfig.getParameter<edm::InputTag>("CSCInput"))),
0013 tokenCSCComparator_(iConsumes.consumes<emtf::CSCTag::comparator_digi_collection>(
0014 iConfig.getParameter<edm::InputTag>("CSCComparatorInput"))),
0015 tokenRPC_(iConsumes.consumes<emtf::RPCTag::digi_collection>(iConfig.getParameter<edm::InputTag>("RPCInput"))),
0016 tokenCPPF_(iConsumes.consumes<emtf::CPPFTag::digi_collection>(iConfig.getParameter<edm::InputTag>("CPPFInput"))),
0017 tokenGEM_(iConsumes.consumes<emtf::GEMTag::digi_collection>(iConfig.getParameter<edm::InputTag>("GEMInput"))),
0018 tokenME0_(iConsumes.consumes<emtf::ME0Tag::digi_collection>(iConfig.getParameter<edm::InputTag>("ME0Input"))),
0019 verbose_(iConfig.getUntrackedParameter<int>("verbosity")) {}
0020
0021 TrackFinder::~TrackFinder() {}
0022
0023 void TrackFinder::process(const edm::Event& iEvent,
0024 const edm::EventSetup& iSetup,
0025 EMTFHitCollection& out_hits,
0026 EMTFTrackCollection& out_tracks) {
0027
0028 out_hits.clear();
0029 out_tracks.clear();
0030
0031
0032 setup_.reload(iEvent, iSetup);
0033
0034 auto tp_geom_ = &(setup_.getGeometryTranslator());
0035
0036
0037 if (verbose_ > 0) {
0038 std::cout << "Event: " << iEvent.id() << " isData: " << iEvent.isRealData() << " useO2O: " << setup_.useO2O()
0039 << " era: " << setup_.era() << " fw_ver: " << setup_.get_fw_version()
0040 << " pt_lut_ver: " << setup_.get_pt_lut_version()
0041 << " pt_lut_ver in engine: " << setup_.getPtAssignmentEngine()->get_pt_lut_version()
0042 << " pc_lut_ver: " << setup_.get_pc_lut_version()
0043 << " pc_lut_ver in cond (i): " << setup_.getConditionHelper().get_pc_lut_version()
0044 << " pc_lut_ver in cond (ii): " << setup_.getConditionHelper().get_pc_lut_version_unchecked()
0045 << std::endl;
0046 }
0047
0048
0049
0050
0051 TriggerPrimitiveCollection muon_primitives;
0052
0053 EMTFSubsystemCollector collector;
0054
0055 auto iConfig = setup_.getConfig();
0056 auto useDT = iConfig.getParameter<bool>("DTEnable");
0057 auto useCSC = iConfig.getParameter<bool>("CSCEnable");
0058 auto useRPC = iConfig.getParameter<bool>("RPCEnable");
0059 auto useIRPC = iConfig.getParameter<bool>("IRPCEnable");
0060 auto useCPPF = iConfig.getParameter<bool>("CPPFEnable");
0061 auto useGEM = iConfig.getParameter<bool>("GEMEnable");
0062 auto useME0 = iConfig.getParameter<bool>("ME0Enable");
0063
0064 if (useCSC) {
0065 collector.extractPrimitives(emtf::CSCTag(), tp_geom_, iEvent, tokenCSC_, muon_primitives);
0066
0067 }
0068 if (useRPC && useCPPF) {
0069 collector.extractPrimitives(emtf::CPPFTag(), tp_geom_, iEvent, tokenCPPF_, muon_primitives);
0070 } else if (useRPC) {
0071 collector.extractPrimitives(emtf::RPCTag(), tp_geom_, iEvent, tokenRPC_, muon_primitives);
0072 }
0073 if (useIRPC) {
0074 collector.extractPrimitives(emtf::IRPCTag(), tp_geom_, iEvent, tokenRPC_, muon_primitives);
0075 }
0076 if (useGEM) {
0077 collector.extractPrimitives(emtf::GEMTag(), tp_geom_, iEvent, tokenGEM_, muon_primitives);
0078 }
0079 if (useME0) {
0080 collector.extractPrimitives(emtf::ME0Tag(), tp_geom_, iEvent, tokenME0_, muon_primitives);
0081 }
0082 if (useDT) {
0083 collector.extractPrimitives(emtf::DTTag(), tp_geom_, iEvent, tokenDTPhi_, tokenDTTheta_, muon_primitives);
0084 }
0085
0086
0087 if (verbose_ > 2) {
0088 std::cout << "Num of TriggerPrimitive: " << muon_primitives.size() << std::endl;
0089 for (const auto& p : muon_primitives) {
0090 p.print(std::cout);
0091 }
0092 }
0093
0094
0095
0096
0097 for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) {
0098 for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) {
0099 const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) +
0100 (sector - emtf::MIN_TRIGSECTOR);
0101
0102 sector_processors_.at(es).configure(&setup_, verbose_, endcap, sector);
0103 sector_processors_.at(es).process(iEvent.id(), muon_primitives, out_hits, out_tracks);
0104 }
0105 }
0106
0107
0108
0109
0110 if (verbose_ > 1) {
0111 emtf::dump_fw_raw_input(out_hits, out_tracks);
0112 }
0113
0114 return;
0115 }