Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:46

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                          int fw,
0018                          int muInBx);
0019     static void fillMuon(Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, int fw, int muInBx);
0020     static void fillIntermediateMuon(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int fw);
0021     static bool showerFired(uint32_t shower_word, int fedId, 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<std::array<uint32_t, 4>, 2> getPackedShowerDataWords(const MuonShower& shower,
0032                                                                            int fedId,
0033                                                                            int fwId);
0034     static int calcHwEta(const uint32_t& raw, unsigned absEtaShift, unsigned etaSignShift);
0035 
0036     static constexpr unsigned ptMask_ = 0x1FF;
0037     static constexpr unsigned ptShift_ = 10;
0038     static constexpr unsigned qualMask_ = 0xF;
0039     static constexpr unsigned qualShift_ = 19;
0040     static constexpr unsigned absEtaMask_ = 0xFF;
0041     static constexpr unsigned absEtaShift_ = 21;
0042     static constexpr unsigned absEtaAtVtxShift_ = 23;
0043     static constexpr unsigned etaSignShift_ = 29;
0044     static constexpr unsigned etaAtVtxSignShift_ = 31;
0045     static constexpr unsigned phiMask_ = 0x3FF;
0046     static constexpr unsigned phiShift_ = 11;
0047     static constexpr unsigned phiAtVtxShift_ = 0;
0048     static constexpr unsigned chargeShift_ = 2;
0049     static constexpr unsigned chargeValidShift_ = 3;
0050     static constexpr unsigned tfMuonIndexMask_ = 0x7F;
0051     static constexpr unsigned tfMuonIndexShift_ = 4;
0052     static constexpr unsigned isoMask_ = 0x3;
0053     static constexpr unsigned isoShift_ = 0;
0054     static constexpr unsigned dxyMask_ = 0x3;
0055     static constexpr unsigned dxyShift_ = 30;
0056     static constexpr unsigned ptUnconstrainedMask_ = 0xFF;
0057     static constexpr unsigned ptUnconstrainedShift_ = 21;
0058     static constexpr unsigned ptUnconstrainedIntermedidateShift_ = 0;
0059     static constexpr unsigned showerShift_ = 29;      // For Run-3
0060     static constexpr unsigned absEtaMu1Shift_ = 13;   // For Run-3
0061     static constexpr unsigned etaMu1SignShift_ = 21;  // For Run-3
0062     static constexpr unsigned absEtaMu2Shift_ = 22;   // For Run-3
0063     static constexpr unsigned etaMu2SignShift_ = 30;  // For Run-3
0064     static constexpr int kUgmtFedId = 1402;
0065     static constexpr int kUgtFedId = 1404;
0066     static constexpr int kUgmtFwVersionUntil2016 = 0x4010000;
0067     static constexpr int kUgtFwVersionUntil2016 = 0x10A6;
0068     static constexpr int kUgmtFwVersionUntil2017 = 0x6000000;
0069     static constexpr int kUgtFwVersionUntil2017 = 0x1120;
0070     static constexpr int kUgmtFwVersionRun3Start = 0x6000001;
0071     static constexpr int kUgtFwVersionUntilRun3Start = 0x1130;
0072     static constexpr int kUgmtFwVersionFirstWithShowers = 0x7000000;
0073     static constexpr int kUgtFwVersionFirstWithShowers = 0x113B;
0074     static constexpr int kUgmtFwVersionShowersFrom2023 = 0x8000000;
0075     static constexpr int kUgmtFwVersionShowersFrom2023_patched =
0076         0x8000001;  // This fixed a miscommunication wrt the link used for the two loose shower bit
0077     static constexpr int kUgtFwVersionShowersFrom2023 = 0x1150;
0078 
0079   private:
0080     static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0081     static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0082     static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0083     static void fillMuonQuantitiesRun3(Muon& mu,
0084                                        uint32_t raw_data_spare,
0085                                        uint32_t raw_data_00_31,
0086                                        uint32_t raw_data_32_63,
0087                                        int muInBx,
0088                                        bool wasSpecialMWGR = false);
0089     static void fillIntermediateMuonQuantitiesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63);
0090     static void generatePackedMuonDataWordsRun3(const Muon& mu,
0091                                                 int abs_eta,
0092                                                 int abs_eta_at_vtx,
0093                                                 uint32_t& raw_data_spare,
0094                                                 uint32_t& raw_data_00_31,
0095                                                 uint32_t& raw_data_32_63,
0096                                                 int muInBx,
0097                                                 bool wasSpecialMWGR = false);
0098   };
0099 }  // namespace l1t
0100 
0101 #endif