Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:51

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(int phiZero,
0065                               l1t::tftype part,
0066                               const CSCDetId& csc,
0067                               const CSCCorrelatedLCTDigi& digi) const;
0068 
0069   virtual int getProcessorPhi(unsigned int iProcessor,
0070                               l1t::tftype part,
0071                               const RPCDetId& rollId,
0072                               const unsigned int& digi) const;
0073   virtual int getProcessorPhi(int phiZero,
0074                               l1t::tftype part,
0075                               const RPCDetId& rollId,
0076                               const unsigned int& digi1,
0077                               const unsigned int& digi2) const;
0078 
0079   ///returns the eta position of the DT chamber
0080   ///(n.b. in the DT phi and eta segments are independent)
0081   virtual EtaValue getGlobalEtaDt(const DTChamberId& detId) const;
0082 
0083   //adds the eta segments from the thetaDigi to etaSegments
0084   virtual void getGlobalEta(const L1MuDTChambThDigi& thetaDigi, std::vector<EtaValue>& etaSegments) const;
0085   virtual std::vector<EtaValue> getGlobalEta(const L1MuDTChambThContainer* dtThDigis, int bxFrom, int bxTo) const;
0086 
0087   ///Convert local eta coordinate to global digital microGMT scale.
0088   virtual EtaValue getGlobalEta(const CSCDetId& detId, const CSCCorrelatedLCTDigi& aDigi) const;
0089 
0090   ///returns the eta position of the CSC chamber
0091   virtual EtaValue getGlobalEtaCsc(const CSCDetId& detId) const;
0092 
0093   ///Convert local eta coordinate to global digital microGMT scale.
0094   ///EtaValue::etaSigma is half of the strip
0095   virtual EtaValue getGlobalEta(unsigned int rawid, const unsigned int& aDigi) const;
0096 
0097   float cscChamberEtaSize(const CSCDetId& id) const;
0098 
0099 protected:
0100   ///Check orientation of strips in given CSC chamber
0101   virtual bool isCSCCounterClockwise(const CSCLayer* layer) const;
0102 
0103   ///Find BTI group
0104   virtual const int findBTIgroup(const L1MuDTChambPhDigi& aDigi, const L1MuDTChambThContainer* dtThDigis);
0105 
0106   // pointers to the current geometry records
0107   unsigned long long _geom_cache_id = 0;
0108   edm::ESHandle<RPCGeometry> _georpc;
0109   edm::ESHandle<CSCGeometry> _geocsc;
0110   edm::ESHandle<DTGeometry> _geodt;
0111 
0112   edm::ESWatcher<MuonGeometryRecord> muonGeometryRecordWatcher;
0113 
0114   const ProcConfigurationBase* config = nullptr;
0115   ///Number of phi bins along 2Pi.
0116   unsigned int nPhiBins = 0;
0117 };
0118 
0119 #endif