Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1T_OmtfP1_ANGLECONVERTER_H
0002 #define L1T_OmtfP1_ANGLECONVERTER_H
0003 
0004 #include "L1Trigger/L1TMuonOverlapPhase1/interface/ProcConfigurationBase.h"
0005 
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0008 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0009 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0010 #include "FWCore/Framework/interface/ESWatcher.h"
0011 
0012 #include <memory>
0013 
0014 namespace edm {
0015   class EventSetup;
0016 }
0017 
0018 class RPCGeometry;
0019 class CSCGeometry;
0020 class CSCLayer;
0021 class DTGeometry;
0022 
0023 class L1MuDTChambPhDigi;
0024 class L1MuDTChambThDigi;
0025 class L1MuDTChambThContainer;
0026 class CSCCorrelatedLCTDigi;
0027 class RPCDigi;
0028 
0029 class DTChamberId;
0030 class CSCDetId;
0031 class RPCDetId;
0032 
0033 struct EtaValue {
0034   int eta = 0;
0035   ///error of the eta measurement
0036   int etaSigma = 0;
0037   int quality = 0;
0038 
0039   int bx = 0;
0040   int timing = 0;  //sub-bx timing, should be already in scale common for all muon subsystems
0041 };
0042 
0043 struct MuonGeometryTokens {
0044   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeometryEsToken;
0045   edm::ESGetToken<CSCGeometry, MuonGeometryRecord> cscGeometryEsToken;
0046   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeometryEsToken;
0047 };
0048 
0049 class AngleConverterBase {
0050 public:
0051   AngleConverterBase();
0052   virtual ~AngleConverterBase();
0053 
0054   ///Update the Geometry with current Event Setup
0055   virtual void checkAndUpdateGeometry(const edm::EventSetup&,
0056                                       const ProcConfigurationBase* config,
0057                                       const MuonGeometryTokens& muonGeometryTokens);
0058 
0059   /// get phi of DT,CSC and RPC azimutal angle digi in processor scale, used by OMTF algorithm.
0060   /// in case of wrong phi returns OMTFConfiguration::instance()->nPhiBins
0061   /// phiZero - desired phi where the scale should start, should be in the desired scale, use getProcessorPhiZero to obtain it
0062   virtual int getProcessorPhi(int phiZero, l1t::tftype part, int dtScNum, int dtPhi) const;
0063 
0064   virtual int getProcessorPhi(
0065       int phiZero, l1t::tftype part, const CSCDetId& csc, const CSCCorrelatedLCTDigi& digi, unsigned int iInput) const;
0066 
0067   virtual int getProcessorPhi(unsigned int iProcessor,
0068                               l1t::tftype part,
0069                               const RPCDetId& rollId,
0070                               const unsigned int& digi) const;
0071   virtual int getProcessorPhi(int phiZero,
0072                               l1t::tftype part,
0073                               const RPCDetId& rollId,
0074                               const unsigned int& digi1,
0075                               const unsigned int& digi2) const;
0076 
0077   ///returns the eta position of the DT chamber
0078   ///(n.b. in the DT phi and eta segments are independent)
0079   virtual EtaValue getGlobalEtaDt(const DTChamberId& detId) const;
0080 
0081   //adds the eta segments from the thetaDigi to etaSegments
0082   virtual void getGlobalEta(const L1MuDTChambThDigi& thetaDigi, std::vector<EtaValue>& etaSegments) const;
0083   virtual std::vector<EtaValue> getGlobalEta(const L1MuDTChambThContainer* dtThDigis, int bxFrom, int bxTo) const;
0084 
0085   ///Convert local eta coordinate to global digital microGMT scale.
0086   virtual EtaValue getGlobalEta(const CSCDetId& detId, const CSCCorrelatedLCTDigi& aDigi) const;
0087 
0088   ///returns the eta position of the CSC chamber
0089   virtual EtaValue getGlobalEtaCsc(const CSCDetId& detId) const;
0090 
0091   ///Convert local eta coordinate to global digital microGMT scale.
0092   ///EtaValue::etaSigma is half of the strip
0093   virtual EtaValue getGlobalEta(unsigned int rawid, const unsigned int& aDigi) const;
0094 
0095   float cscChamberEtaSize(const CSCDetId& id) const;
0096 
0097 protected:
0098   ///Check orientation of strips in given CSC chamber
0099   virtual bool isCSCCounterClockwise(const CSCLayer* layer) const;
0100 
0101   ///Find BTI group
0102   virtual const int findBTIgroup(const L1MuDTChambPhDigi& aDigi, const L1MuDTChambThContainer* dtThDigis);
0103 
0104   // pointers to the current geometry records
0105   unsigned long long _geom_cache_id = 0;
0106   edm::ESHandle<RPCGeometry> _georpc;
0107   edm::ESHandle<CSCGeometry> _geocsc;
0108   edm::ESHandle<DTGeometry> _geodt;
0109 
0110   edm::ESWatcher<MuonGeometryRecord> muonGeometryRecordWatcher;
0111 
0112   const ProcConfigurationBase* config = nullptr;
0113   ///Number of phi bins along 2Pi.
0114   unsigned int nPhiBins = 0;
0115 };
0116 
0117 #endif