Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:05

0001 #ifndef EVF_UTILITIES_GLOBALEVENTNUMBER_H
0002 #define EVF_UTILITIES_GLOBALEVENTNUMBER_H
0003 
0004 #include <cstddef>
0005 
0006 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0007 
0008 namespace evf {
0009   namespace evtn {
0010 
0011     const unsigned int SLINK_WORD_SIZE = 8;
0012     const unsigned int SLINK_HALFWORD_SIZE = 4;
0013     const unsigned int FED_HEADER_SIZE = SLINK_WORD_SIZE;
0014     const unsigned int FED_TRAILER_SIZE = SLINK_WORD_SIZE;
0015 
0016     const unsigned int DAQ_TOTTRG_OFFSET = 2;  //offset in 32-bit words
0017     const unsigned int DAQ_BOARDID_OFFSET = 1;
0018     const unsigned int DAQ_BOARDID_MASK = 0xffff0000;
0019     const unsigned int DAQ_BOARDID_SHIFT = 24;
0020     const unsigned int DAQ_BOARDID_VALUE = 0x11;
0021 
0022     enum EvmRecordScheme {
0023       BST32_3BX = 34 * SLINK_WORD_SIZE,
0024       BST32_5BX = 48 * SLINK_WORD_SIZE,
0025       BST52_3BX = 37 * SLINK_WORD_SIZE,
0026       BST52_5BX = 51 * SLINK_WORD_SIZE
0027     };  // EvmRecordsize
0028 
0029     const unsigned int EVM_BOARDID_OFFSET = 1;
0030     const unsigned int EVM_BOARDID_MASK = 0xffff0000;
0031     const unsigned int EVM_BOARDID_SHIFT = 24;
0032     const unsigned int EVM_BOARDID_VALUE = 0x11;
0033 
0034     const unsigned int EVM_GTFE_BLOCK_V0000 = 6;    //size in 64-bit words
0035     const unsigned int EVM_GTFE_BLOCK_V0011 = 9;    //size in 64-bit words, new format
0036     const unsigned int EVM_GTFE_BSTGPS_OFFSET = 4;  //offset in 32-bit words
0037 
0038     const unsigned int EVM_TCS_BOARDID_VALUE = 0xcc07;
0039     const unsigned int EVM_TCS_BLOCK = 5;                  //size in 64-bit words
0040     const unsigned int EVM_TCS_TRIGNR_OFFSET = 5;          //offset in 32-bit words
0041     const unsigned int EVM_TCS_LSBLNR_OFFSET = 0;          //offset in 32-bit words
0042     const unsigned int EVM_TCS_BOARDID_OFFSET = 1;         //offset in 32-bit words
0043     const unsigned int EVM_TCS_ORBTNR_OFFSET = 6;          //offset in 32-bit words
0044     const unsigned int EVM_TCS_LSBLNR_MASK = 0x0000ffff;   // 16 LSB
0045     const unsigned int EVM_TCS_BOARDID_MASK = 0xffff0000;  // 16 MSB
0046     const unsigned int EVM_TCS_BOARDID_SHIFT = 16;         // 16 MSB
0047     const unsigned int EVM_TCS_EVNTYP_MASK = 0x00f00000;   // 4 bits
0048     const unsigned int EVM_TCS_EVNTYP_SHIFT = 20;
0049     const unsigned int EVM_TCS_BCNRIN_MASK = 0x00000fff;  // 12 LSB
0050 
0051     const unsigned int EVM_FDL_BLOCK = 7;           //size in 64-bit words
0052     const unsigned int EVM_FDL_BCNRIN_OFFSET = 1;   //offset in 32-bit words
0053     const unsigned int EVM_FDL_TECTRG_OFFSET = 2;   //offset in 32-bit words
0054     const unsigned int EVM_FDL_ALGOB1_OFFSET = 4;   //offset in 32-bit words
0055     const unsigned int EVM_FDL_ALGOB2_OFFSET = 6;   //offset in 32-bit words
0056     const unsigned int EVM_FDL_PSCVSN_OFFSET = 11;  //offset in 32-bit words
0057 
0058     const unsigned int GTPE_BOARDID_OFFSET = 16;
0059     const unsigned int GTPE_BOARDID_MASK = 0x000000ff;
0060     const unsigned int GTPE_BOARDID_SHIFT = 0;
0061     const unsigned int GTPE_BOARDID_VALUE = 0x1;
0062     const unsigned int GTPE_TRIGNR_OFFSET = 14;        //offset in 32-bit words
0063     const unsigned int GTPE_ORBTNR_OFFSET = 18;        //offset in 32-bit words
0064     const unsigned int GTPE_BCNRIN_OFFSET = 3;         //offset in 32-bit words
0065     const unsigned int GTPE_BCNRIN_MASK = 0x00000fff;  // 12 LSB
0066 
0067     unsigned int offset(bool);
0068     bool daq_board_sense(const unsigned char *p);
0069     bool gtpe_board_sense(const unsigned char *p);
0070     bool evm_board_sense(const unsigned char *p, size_t size);
0071     bool evm_tcs_board_sense(const unsigned char *p);
0072     void evm_board_setformat(size_t size);
0073 
0074     unsigned int get(const unsigned char *, bool);
0075     unsigned int gtpe_get(const unsigned char *);
0076     unsigned int getlbn(const unsigned char *);
0077     unsigned int gtpe_getlbn(const unsigned char *);
0078     unsigned int getgpslow(const unsigned char *);
0079     unsigned int getgpshigh(const unsigned char *);
0080     unsigned int getorbit(const unsigned char *);
0081     unsigned int getevtyp(const unsigned char *);
0082     unsigned int gtpe_getorbit(const unsigned char *);
0083     unsigned int getfdlbx(const unsigned char *);
0084     unsigned int gtpe_getbx(const unsigned char *);
0085     unsigned int getfdlpsc(const unsigned char *);
0086     unsigned long long getfdlttr(const unsigned char *);
0087     unsigned long long getfdlta1(const unsigned char *);
0088     unsigned long long getfdlta2(const unsigned char *);
0089   }  // namespace evtn
0090 }  // namespace evf
0091 #endif