File indexing completed on 2023-10-25 09:55:36
0001 #ifndef L1T_OmtfP1_MUONSTUBMAKERBASE_H
0002 #define L1T_OmtfP1_MUONSTUBMAKERBASE_H
0003
0004 #include "DataFormats/Common/interface/Handle.h"
0005 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0006 #include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h"
0007 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0008 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0009 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0010 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0011 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0012 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Utilities/interface/EDGetToken.h"
0015 #include "L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h"
0016 #include "L1Trigger/L1TMuonOverlapPhase1/interface/RpcClusterization.h"
0017 #include <cstdint>
0018 #include <memory>
0019 #include <vector>
0020
0021 class ProcConfigurationBase;
0022
0023 namespace edm {
0024 class EventSetup;
0025 }
0026
0027 struct MuStubsInputTokens {
0028 edm::EDGetTokenT<L1MuDTChambPhContainer> inputTokenDtPh;
0029 edm::EDGetTokenT<L1MuDTChambThContainer> inputTokenDtTh;
0030 edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> inputTokenCSC;
0031 edm::EDGetTokenT<RPCDigiCollection> inputTokenRPC;
0032 };
0033
0034 class DigiToStubsConverterBase {
0035 public:
0036 virtual ~DigiToStubsConverterBase(){};
0037
0038 virtual void loadDigis(const edm::Event& event) = 0;
0039
0040 virtual void makeStubs(
0041 MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) = 0;
0042 };
0043
0044 class DtDigiToStubsConverter : public DigiToStubsConverterBase {
0045 public:
0046 DtDigiToStubsConverter(edm::EDGetTokenT<L1MuDTChambPhContainer> inputTokenDtPh,
0047 edm::EDGetTokenT<L1MuDTChambThContainer> inputTokenDtTh)
0048 : inputTokenDtPh(inputTokenDtPh), inputTokenDtTh(inputTokenDtTh){};
0049
0050 ~DtDigiToStubsConverter() override{};
0051
0052
0053
0054 void loadDigis(const edm::Event& event) override;
0055
0056 void makeStubs(
0057 MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override;
0058
0059
0060 virtual void addDTphiDigi(MuonStubPtrs2D& muonStubsInLayers,
0061 const L1MuDTChambPhDigi& digi,
0062 const L1MuDTChambThContainer* dtThDigis,
0063 unsigned int iProcessor,
0064 l1t::tftype procTyp) = 0;
0065
0066 virtual void addDTetaStubs(MuonStubPtrs2D& muonStubsInLayers,
0067 const L1MuDTChambThDigi& thetaDigi,
0068 unsigned int iProcessor,
0069 l1t::tftype procTyp) = 0;
0070
0071 virtual bool acceptDigi(const DTChamberId& dTChamberId, unsigned int iProcessor, l1t::tftype procType) {
0072 return true;
0073 }
0074
0075 protected:
0076 bool mergePhiAndTheta = true;
0077
0078 edm::EDGetTokenT<L1MuDTChambPhContainer> inputTokenDtPh;
0079 edm::EDGetTokenT<L1MuDTChambThContainer> inputTokenDtTh;
0080
0081 edm::Handle<L1MuDTChambPhContainer> dtPhDigis;
0082 edm::Handle<L1MuDTChambThContainer> dtThDigis;
0083 };
0084
0085 class CscDigiToStubsConverter : public DigiToStubsConverterBase {
0086 public:
0087 CscDigiToStubsConverter(const ProcConfigurationBase* config,
0088 edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> inputTokenCsc)
0089 : config(config), inputTokenCsc(inputTokenCsc){};
0090
0091 ~CscDigiToStubsConverter() override{};
0092
0093
0094
0095 void loadDigis(const edm::Event& event) override { event.getByToken(inputTokenCsc, cscDigis); }
0096
0097 void makeStubs(
0098 MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override;
0099
0100
0101 virtual void addCSCstubs(MuonStubPtrs2D& muonStubsInLayers,
0102 unsigned int rawid,
0103 const CSCCorrelatedLCTDigi& digi,
0104 unsigned int iProcessor,
0105 l1t::tftype procTyp) = 0;
0106
0107 virtual bool acceptDigi(const CSCDetId& cscDetId, unsigned int iProcessor, l1t::tftype procType) { return true; }
0108
0109 protected:
0110 const ProcConfigurationBase* config;
0111
0112 bool mergePhiAndTheta = true;
0113
0114 edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> inputTokenCsc;
0115 edm::Handle<CSCCorrelatedLCTDigiCollection> cscDigis;
0116 };
0117
0118 class RpcDigiToStubsConverter : public DigiToStubsConverterBase {
0119 public:
0120 RpcDigiToStubsConverter(const ProcConfigurationBase* config,
0121 edm::EDGetTokenT<RPCDigiCollection> inputTokenRpc,
0122 const RpcClusterization* rpcClusterization)
0123 : config(config), inputTokenRpc(inputTokenRpc), rpcClusterization(rpcClusterization){};
0124
0125 ~RpcDigiToStubsConverter() override{};
0126
0127
0128
0129 void loadDigis(const edm::Event& event) override { event.getByToken(inputTokenRpc, rpcDigis); }
0130
0131 void makeStubs(
0132 MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom, int bxTo) override;
0133
0134 virtual void addRPCstub(MuonStubPtrs2D& muonStubsInLayers,
0135 const RPCDetId& roll,
0136 const RpcCluster& cluster,
0137 unsigned int iProcessor,
0138 l1t::tftype procTyp) = 0;
0139
0140 virtual bool acceptDigi(const RPCDetId& rpcDetId, unsigned int iProcessor, l1t::tftype procType) { return true; }
0141
0142 protected:
0143 const ProcConfigurationBase* config;
0144
0145 bool mergePhiAndTheta = true;
0146
0147 edm::EDGetTokenT<RPCDigiCollection> inputTokenRpc;
0148 edm::Handle<RPCDigiCollection> rpcDigis;
0149
0150 const RpcClusterization* rpcClusterization;
0151 };
0152
0153
0154 struct MuonGeometryTokens;
0155
0156 class MuonStubMakerBase {
0157 public:
0158 MuonStubMakerBase(const ProcConfigurationBase* procConf);
0159
0160 virtual ~MuonStubMakerBase();
0161
0162 virtual void initialize(const edm::ParameterSet& edmCfg,
0163 const edm::EventSetup& es,
0164 const MuonGeometryTokens& muonGeometryTokens);
0165
0166 void loadAndFilterDigis(const edm::Event& event);
0167
0168
0169 void buildInputForProcessor(
0170 MuonStubPtrs2D& muonStubsInLayers, unsigned int iProcessor, l1t::tftype procTyp, int bxFrom = 0, int bxTo = 0);
0171
0172 protected:
0173 const ProcConfigurationBase* config = nullptr;
0174
0175 std::vector<std::unique_ptr<DigiToStubsConverterBase> > digiToStubsConverters;
0176
0177 RpcClusterization rpcClusterization;
0178 };
0179
0180 #endif