Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/RPCTrigger/interface/RPCBasicTrigConfig.h"
0002 #include "L1Trigger/RPCTrigger/interface/RPCException.h"
0003 
0004 /// Ctor
0005 RPCBasicTrigConfig::RPCBasicTrigConfig(RPCPacManager<RPCPacData>* pacManager) { m_PacManager = pacManager; }
0006 
0007 /// Ctor
0008 RPCBasicTrigConfig::RPCBasicTrigConfig() { m_PacManager = nullptr; }
0009 
0010 /** Converts TC GB-Sorter output m_tower address <0...31> ("m_tower number continous")
0011 * to m_tower number 2'complement*/
0012 int RPCBasicTrigConfig::towNum2TowNum2Comp(int towNum) {
0013   if (towNum >= 0)
0014     return towNum;
0015   else
0016     return 0x3F + towNum + 1;
0017 }
0018 
0019 //#############################################################################################
0020 //
0021 //  Simple getters and setters
0022 //
0023 //#############################################################################################
0024 /**
0025  *
0026  *  returns count of Trigger Crates in system.
0027  *
0028 */
0029 int RPCBasicTrigConfig::getTCsCnt() { return m_TRIGGER_CRATES_CNT; }
0030 
0031 /**
0032  *
0033  * returns number og Trigger Boards in one Trigger Crate.
0034  *
0035 */
0036 int RPCBasicTrigConfig::getTBsInTC() { return m_TB_IN_TC_CNT; }
0037 
0038 /**
0039  *
0040  * Returns the index of TC that should run given LogCone.
0041  *
0042  *
0043 */
0044 int RPCBasicTrigConfig::getTCNum(const RPCConst::l1RpcConeCrdnts& coneCrdnts) { return coneCrdnts.m_LogSector; }
0045 /**
0046  *
0047  * Returns the count of Towers (3 or 4), that are covered by given TB.
0048  *
0049 */
0050 int RPCBasicTrigConfig::getTowsCntOnTB(int tbNum) { return m_TOWERS_CNT_ON_TB[tbNum]; }
0051 /** Converts TC GB-Sorter input m_tower address <0...35> ("m_tower number natural")
0052  * to m_tower number <-16...0...16>
0053  * TC GB-Sorter input m_tower address is 8 bits: [7...2] TB num, [1...0] m_tower num on TB.*/
0054 int RPCBasicTrigConfig::towAddr2TowNum(int towAddr) {
0055   if (m_TOW_ADDR_2_TOW_NUM[towAddr] == -99 || towAddr < 0 || towAddr > 35) {
0056     throw RPCException("RPCBasicTrigConfig::towAddr2TowNum - wrong towAddr");
0057     //edm::LogError("RPC")<< "RPCBasicTrigConfig::towAddr2TowNum - wrong towAddr";
0058   }
0059 
0060   return m_TOW_ADDR_2_TOW_NUM[towAddr];
0061 }
0062 
0063 int RPCBasicTrigConfig::getTowerNumOnTb(const RPCConst::l1RpcConeCrdnts& coneCrdnts) {
0064   return m_TOWER_ON_TB[RPCConst::ITOW_MAX + coneCrdnts.m_Tower];
0065 }
0066 
0067 const RPCPacData* RPCBasicTrigConfig::getPac(const RPCConst::l1RpcConeCrdnts& coneCrdnts) const {
0068   return m_PacManager->getPac(coneCrdnts.m_Tower, coneCrdnts.m_LogSector, coneCrdnts.m_LogSegment);
0069 }
0070 
0071 int RPCBasicTrigConfig::getTBNum(const RPCConst::l1RpcConeCrdnts& coneCrdnts) {
0072   return m_TB_NUM_FOR_TOWER[RPCConst::ITOW_MAX + coneCrdnts.m_Tower];
0073 }
0074 //#############################################################################################
0075 //
0076 //  Constants
0077 //
0078 //#############################################################################################
0079 const int RPCBasicTrigConfig::m_TRIGGER_CRATES_CNT = 12;
0080 
0081 const int RPCBasicTrigConfig::m_TOWER_ON_TB[2 * RPCConst::ITOW_MAX + 1 + 1] = {
0082     //-16 -15 -14  -13
0083     0,
0084     1,
0085     2,
0086     3,  //tbn4
0087         //-12 -11 -10   -9
0088     0,
0089     1,
0090     2,
0091     3,  //tbn3
0092         //-8  -7   -6   -5
0093     0,
0094     1,
0095     2,
0096     3,  //tbn2
0097         //-4  -3   -2
0098     0,
0099     1,
0100     2,  //tbn1
0101         //-1   0    1
0102     0,
0103     1,
0104     2,  //tb0
0105         //2    3    4
0106     0,
0107     1,
0108     2,  //tbp1
0109         //5    6    7    8
0110     0,
0111     1,
0112     2,
0113     3,  //tbp2
0114         //9   10   11   12
0115     0,
0116     1,
0117     2,
0118     3,  //tbp3
0119         //13  14   15   16
0120     0,
0121     1,
0122     2,
0123     3,  //tbp4
0124     0   //one more extra
0125 };
0126 
0127 const int RPCBasicTrigConfig::m_TOWERS_CNT_ON_TB[m_TB_IN_TC_CNT] = {4, 4, 4, 3, 3, 3, 4, 4, 4};
0128 
0129 const int RPCBasicTrigConfig::m_TB_NUM_FOR_TOWER[2 * RPCConst::ITOW_MAX + 1] = {
0130     //-16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0131     0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8};
0132 
0133 const int RPCBasicTrigConfig::m_TOW_ADDR_2_TOW_NUM[36] = {
0134     //0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17
0135     -16,
0136     -15,
0137     -14,
0138     -13,
0139     -12,
0140     -11,
0141     -10,
0142     -9,
0143     -8,
0144     -7,
0145     -6,
0146     -5,
0147     -4,
0148     -3,
0149     -2,
0150     -99,
0151     -1,
0152     0,
0153     //18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35
0154     1,
0155     -99,
0156     2,
0157     3,
0158     4,
0159     -99,
0160     5,
0161     6,
0162     7,
0163     8,
0164     9,
0165     10,
0166     11,
0167     12,
0168     13,
0169     14,
0170     15,
0171     16};