Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:00

0001 #ifndef L1T_OmtfP1_OMTFinputMaker_H
0002 #define L1T_OmtfP1_OMTFinputMaker_H
0003 
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 
0006 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0007 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0008 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0009 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0010 
0011 #include "L1Trigger/L1TMuonOverlapPhase1/interface/MuonStubMakerBase.h"
0012 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OmtfAngleConverter.h"
0013 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFinput.h"
0014 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
0015 #include "L1Trigger/L1TMuonOverlapPhase1/interface/RpcClusterization.h"
0016 
0017 #include <vector>
0018 #include <cstdint>
0019 #include <memory>
0020 
0021 class DtDigiToStubsConverterOmtf : public DtDigiToStubsConverter {
0022 public:
0023   DtDigiToStubsConverterOmtf(const OMTFConfiguration* config,
0024                              const OmtfAngleConverter* angleConverter,
0025                              edm::EDGetTokenT<L1MuDTChambPhContainer> inputTokenDtPh,
0026                              edm::EDGetTokenT<L1MuDTChambThContainer> inputTokenDtTh)
0027       : DtDigiToStubsConverter(inputTokenDtPh, inputTokenDtTh), config(config), angleConverter(angleConverter) {}
0028 
0029   ~DtDigiToStubsConverterOmtf() override {}
0030 
0031   //dtThDigis is provided as argument, because in the OMTF implementation the phi and eta digis are merged (even thought it is artificial)
0032   void addDTphiDigi(MuonStubPtrs2D& muonStubsInLayers,
0033                     const L1MuDTChambPhDigi& digi,
0034                     const L1MuDTChambThContainer* dtThDigis,
0035                     unsigned int iProcessor,
0036                     l1t::tftype procTyp) override;
0037 
0038   void addDTetaStubs(MuonStubPtrs2D& muonStubsInLayers,
0039                      const L1MuDTChambThDigi& thetaDigi,
0040                      unsigned int iProcessor,
0041                      l1t::tftype procTyp) override;
0042 
0043   bool acceptDigi(const DTChamberId& dTChamberId, unsigned int iProcessor, l1t::tftype procType) override;
0044 
0045 private:
0046   const OMTFConfiguration* config = nullptr;
0047   const OmtfAngleConverter* angleConverter = nullptr;
0048 };
0049 
0050 class CscDigiToStubsConverterOmtf : public CscDigiToStubsConverter {
0051 public:
0052   CscDigiToStubsConverterOmtf(const OMTFConfiguration* config,
0053                               const OmtfAngleConverter* angleConverter,
0054                               edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> inputTokenCsc)
0055       : CscDigiToStubsConverter(config, inputTokenCsc), config(config), angleConverter(angleConverter) {}
0056 
0057   ~CscDigiToStubsConverterOmtf() override {}
0058 
0059   //can add both phi and eta stubs
0060   void addCSCstubs(MuonStubPtrs2D& muonStubsInLayers,
0061                    unsigned int rawid,
0062                    const CSCCorrelatedLCTDigi& digi,
0063                    unsigned int iProcessor,
0064                    l1t::tftype procTyp) override;
0065 
0066   bool acceptDigi(const CSCDetId& cscDetId, unsigned int iProcessor, l1t::tftype procType) override;
0067 
0068 private:
0069   const OMTFConfiguration* config = nullptr;
0070   const OmtfAngleConverter* angleConverter = nullptr;
0071 };
0072 
0073 class RpcDigiToStubsConverterOmtf : public RpcDigiToStubsConverter {
0074 public:
0075   RpcDigiToStubsConverterOmtf(const OMTFConfiguration* config,
0076                               const OmtfAngleConverter* angleConverter,
0077                               const RpcClusterization* rpcClusterization,
0078                               edm::EDGetTokenT<RPCDigiCollection> inputTokenRpc)
0079       : RpcDigiToStubsConverter(config, inputTokenRpc, rpcClusterization),
0080         config(config),
0081         angleConverter(angleConverter) {}
0082 
0083   ~RpcDigiToStubsConverterOmtf() override {}
0084 
0085   void addRPCstub(MuonStubPtrs2D& muonStubsInLayers,
0086                   const RPCDetId& roll,
0087                   const RpcCluster& cluster,
0088                   unsigned int iProcessor,
0089                   l1t::tftype procTyp) override;
0090 
0091   bool acceptDigi(const RPCDetId& rpcDetId, unsigned int iProcessor, l1t::tftype procType) override;
0092 
0093 private:
0094   const OMTFConfiguration* config = nullptr;
0095   const OmtfAngleConverter* angleConverter = nullptr;
0096 };
0097 
0098 class OMTFinputMaker : public MuonStubMakerBase {
0099 public:
0100   OMTFinputMaker(const edm::ParameterSet& edmParameterSet,
0101                  MuStubsInputTokens& muStubsInputTokens,
0102                  const OMTFConfiguration* config,
0103                  std::unique_ptr<OmtfAngleConverter> angleConverter);
0104 
0105   ~OMTFinputMaker() override;
0106 
0107   void initialize(const edm::ParameterSet& edmCfg,
0108                   const edm::EventSetup& es,
0109                   const MuonGeometryTokens& muonGeometryTokens) override;
0110 
0111   ///iProcessor - from 0 to 5
0112   ///returns the global phi in hardware scale (myOmtfConfig->nPhiBins() ) at which the scale starts for give processor
0113   static int getProcessorPhiZero(const OMTFConfiguration* config, unsigned int iProcessor);
0114 
0115   static void addStub(const OMTFConfiguration* config,
0116                       MuonStubPtrs2D& muonStubsInLayers,
0117                       unsigned int iLayer,
0118                       unsigned int iInput,
0119                       MuonStub& stub);
0120 
0121   ///Give input number for given processor, using
0122   ///the chamber sector number.
0123   ///Result is modulo allowed number of hits per chamber
0124   static unsigned int getInputNumber(const OMTFConfiguration* config,
0125                                      unsigned int rawId,
0126                                      unsigned int iProcessor,
0127                                      l1t::tftype type);
0128 
0129   //is in the OMTFinputMakerand not in the DtDigiToStubsConverterOmtf because is also used for the phase2 DT stubs
0130   //it is here, because this function is needed both for the DtDigiToStubsConverterOmtf and DtPhase2DigiToStubsConverter
0131   static bool acceptDtDigi(const OMTFConfiguration* config,
0132                            const DTChamberId& dTChamberId,
0133                            unsigned int iProcessor,
0134                            l1t::tftype procType);
0135 
0136 protected:
0137   const OMTFConfiguration* config = nullptr;
0138   std::unique_ptr<OmtfAngleConverter> angleConverter;
0139 };
0140 
0141 #endif