Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:00:00

0001 #ifndef _rctDATABASE_h
0002 #define _rctDATABASE_h
0003 
0004 #include <iostream>
0005 #include <stdexcept>
0006 #include <vector>
0007 #include <cstdint>
0008 
0009 namespace l1t {
0010   class rctDataBase {
0011   public:
0012     enum rctObjectType { RCEt, RCTau, RCOf, HFEt, HFFg, IEEt, IEReg, IECard, NEEt, NEReg, NECard, RCHad, nObjects };
0013 
0014   private:
0015     int RCEt_start[7][2];   //card, region
0016     int RCTau_start[7][2];  //card, region
0017     int RCOf_start[7][2];   //card, region
0018     int HFEt_start[8];      //region
0019     int HFFg_start[8];      //region
0020     int IEEt_start[4];      //candidate
0021     int IEReg_start[4];     //candidate
0022     int IECard_start[4];    //candidate
0023     int NEEt_start[4];      //candidate
0024     int NEReg_start[4];     //candidate
0025     int NECard_start[4];    //candidate
0026     int RCHad_start[7][2];  //card, region
0027 
0028     int length[nObjects];
0029 
0030     int link[nObjects];
0031     int indexfromMP7toRCT[36];
0032     int indexfromoRSCtoMP7[36];
0033 
0034   public:
0035     rctDataBase();
0036     ~rctDataBase(){};
0037 
0038     int GetLength(rctObjectType t) { return length[t]; }
0039 
0040     int GetLink(rctObjectType t) { return link[t]; }
0041 
0042     void GetLinkRCT(int linkMP7, unsigned int &RCTcrate, bool &RCTeven) {
0043       int oRSClink = indexfromMP7toRCT[linkMP7];
0044       RCTcrate = (int)(oRSClink / 2);
0045       if (oRSClink % 2 == 0)
0046         RCTeven = true;
0047       else
0048         RCTeven = false;
0049     }
0050     void GetLinkMP7(unsigned int RCTcrate, bool RCTeven, int &linkMP7) {
0051       linkMP7 = indexfromoRSCtoMP7[RCTcrate * 2 + (1 - (int)RCTeven)];
0052     }
0053 
0054     int GetIndices(rctObjectType t, int firstindex, int secondindex = -1) {
0055       switch (t) {
0056         case RCEt:
0057           return RCEt_start[firstindex][secondindex];
0058         case RCTau:
0059           return RCTau_start[firstindex][secondindex];
0060         case RCOf:
0061           return RCOf_start[firstindex][secondindex];
0062         case HFEt:
0063           return HFEt_start[firstindex];
0064         case HFFg:
0065           return HFFg_start[firstindex];
0066         case IEEt:
0067           return IEEt_start[firstindex];
0068         case IEReg:
0069           return IEReg_start[firstindex];
0070         case IECard:
0071           return IECard_start[firstindex];
0072         case NEEt:
0073           return NEEt_start[firstindex];
0074         case NEReg:
0075           return NEReg_start[firstindex];
0076         case NECard:
0077           return NECard_start[firstindex];
0078         case RCHad:
0079           return RCHad_start[firstindex][secondindex];
0080         default:
0081           return -1;
0082       }
0083     }
0084   };
0085 }  // namespace l1t
0086 #endif