Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <utility>
0002 
0003 #include "L1Trigger/L1TMuonEndCapPhase2/interface/Data/TimeZoneLut.h"
0004 
0005 using namespace emtf::phase2::data;
0006 
0007 // Static
0008 bool TimeZoneLut::in_range(const std::pair<int, int>& range, const int& bx) const {
0009   return range.first <= bx && bx <= range.second;
0010 }
0011 
0012 // Member
0013 TimeZoneLut::TimeZoneLut() {
0014   lut_[0] = {-1, 0};   // ME1/1
0015   lut_[1] = {-1, 0};   // ME1/2
0016   lut_[2] = {-1, 0};   // ME1/3
0017   lut_[3] = {-1, 0};   // ME2/1
0018   lut_[4] = {-1, 0};   // ME2/2
0019   lut_[5] = {-1, 0};   // ME3/1
0020   lut_[6] = {-1, 0};   // ME3/2
0021   lut_[7] = {-1, 0};   // ME4/1
0022   lut_[8] = {-1, 0};   // ME4/2
0023   lut_[9] = {-1, 0};   // GE1/1
0024   lut_[10] = {0, 0};   // RE1/2
0025   lut_[11] = {0, 0};   // RE1/3
0026   lut_[12] = {-1, 0};  // GE2/1
0027   lut_[13] = {0, 0};   // RE2/2
0028   lut_[14] = {0, 0};   // RE3/1
0029   lut_[15] = {0, 0};   // RE3/2
0030   lut_[16] = {0, 0};   // RE4/1
0031   lut_[17] = {0, 0};   // RE4/2
0032   lut_[18] = {0, 0};   // ME0
0033 }
0034 
0035 TimeZoneLut::~TimeZoneLut() {
0036   // Do Nothing
0037 }
0038 
0039 void TimeZoneLut::update(const edm::Event&, const edm::EventSetup&) {
0040   // Do Nothing
0041 }
0042 
0043 int TimeZoneLut::getTimezones(const int& host, const int& bx) const {
0044   auto found = lut_.find(host);
0045 
0046   // Short-Circuit: Host doesn't exist
0047   if (found == lut_.end())
0048     return 0x0;
0049 
0050   // Build word
0051   int word = 0x0;
0052 
0053   word |= in_range(found->second, bx) ? 0b001 : 0;
0054   word |= in_range(found->second, bx + 1) ? 0b010 : 0;  // +1 BX delay
0055   word |= in_range(found->second, bx + 2) ? 0b100 : 0;  // +2 BX delay
0056 
0057   return word;
0058 }