Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-30 05:19:59

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