Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-08 06:28:04

0001 #ifndef MuonRawDigiTranslator_h
0002 #define MuonRawDigiTranslator_h
0003 
0004 #include "DataFormats/L1Trigger/interface/Muon.h"
0005 #include "DataFormats/L1Trigger/interface/MuonShower.h"
0006 
0007 #include <array>
0008 
0009 namespace l1t {
0010   class MuonRawDigiTranslator {
0011   public:
0012     static void fillMuon(Muon& mu,
0013                          uint32_t raw_data_spare,
0014                          uint32_t raw_data_00_31,
0015                          uint32_t raw_data_32_63,
0016                          int fed,
0017                          unsigned int fw,
0018                          int muInBx);
0019     static void fillMuon(Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, unsigned int fw, int muInBx);
0020     static void fillIntermediateMuon(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, unsigned int fw);
0021     static bool showerFired(uint32_t shower_word, int fedId, unsigned int fwId);
0022     static void generatePackedMuonDataWords(const Muon& mu,
0023                                             uint32_t& raw_data_spare,
0024                                             uint32_t& raw_data_00_31,
0025                                             uint32_t& raw_data_32_63,
0026                                             int fedId,
0027                                             int fwId,
0028                                             int muInBx);
0029     static void generate64bitDataWord(
0030         const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx);
0031     static std::array<uint32_t, 4> getPackedShowerDataWords(const MuonShower& shower, int fedId, unsigned int fwId);
0032     static int calcHwEta(const uint32_t& raw, unsigned absEtaShift, unsigned etaSignShift);
0033 
0034     static constexpr unsigned ptMask_ = 0x1FF;
0035     static constexpr unsigned ptShift_ = 10;
0036     static constexpr unsigned qualMask_ = 0xF;
0037     static constexpr unsigned qualShift_ = 19;
0038     static constexpr unsigned absEtaMask_ = 0xFF;
0039     static constexpr unsigned absEtaShift_ = 21;
0040     static constexpr unsigned absEtaAtVtxShift_ = 23;
0041     static constexpr unsigned etaSignShift_ = 29;
0042     static constexpr unsigned etaAtVtxSignShift_ = 31;
0043     static constexpr unsigned phiMask_ = 0x3FF;
0044     static constexpr unsigned phiShift_ = 11;
0045     static constexpr unsigned phiAtVtxShift_ = 0;
0046     static constexpr unsigned chargeShift_ = 2;
0047     static constexpr unsigned chargeValidShift_ = 3;
0048     static constexpr unsigned tfMuonIndexMask_ = 0x7F;
0049     static constexpr unsigned tfMuonIndexShift_ = 4;
0050     static constexpr unsigned isoMask_ = 0x3;
0051     static constexpr unsigned isoShift_ = 0;
0052     static constexpr unsigned dxyMask_ = 0x3;
0053     static constexpr unsigned dxyShift_ = 30;
0054     static constexpr unsigned ptUnconstrainedMask_ = 0xFF;
0055     static constexpr unsigned ptUnconstrainedShift_ = 21;
0056     static constexpr unsigned ptUnconstrainedIntermedidateShift_ = 0;
0057     static constexpr unsigned showerShift_ = 29;      // For Run-3
0058     static constexpr unsigned absEtaMu1Shift_ = 13;   // For Run-3
0059     static constexpr unsigned etaMu1SignShift_ = 21;  // For Run-3
0060     static constexpr unsigned absEtaMu2Shift_ = 22;   // For Run-3
0061     static constexpr unsigned etaMu2SignShift_ = 30;  // For Run-3
0062 
0063   private:
0064     static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0065     static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0066     static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0067     static void fillMuonQuantitiesRun3(Muon& mu,
0068                                        uint32_t raw_data_spare,
0069                                        uint32_t raw_data_00_31,
0070                                        uint32_t raw_data_32_63,
0071                                        int muInBx,
0072                                        bool wasSpecialMWGR = false);
0073     static void fillIntermediateMuonQuantitiesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0074     static void generatePackedMuonDataWordsRun3(const Muon& mu,
0075                                                 int abs_eta,
0076                                                 int abs_eta_at_vtx,
0077                                                 uint32_t& raw_data_spare,
0078                                                 uint32_t& raw_data_00_31,
0079                                                 uint32_t& raw_data_32_63,
0080                                                 int muInBx,
0081                                                 bool wasSpecialMWGR = false);
0082   };
0083 }  // namespace l1t
0084 
0085 #endif