CMS 3D CMS Logo

GlobalEventNumber.h
Go to the documentation of this file.
1 #ifndef EVF_FEDINTERFACE_GLOBALEVENTNUMBER_H
2 #define EVF_FEDINTERFACE_GLOBALEVENTNUMBER_H
3 
4 
5 #include <cstddef>
7 
9 
10 namespace evf{
11  namespace evtn{
12 
13  const unsigned int DAQ_TOTTRG_OFFSET = 2; //offset in 32-bit words
14  const unsigned int DAQ_BOARDID_OFFSET = 1;
15  const unsigned int DAQ_BOARDID_MASK = 0xffff0000;
16  const unsigned int DAQ_BOARDID_SHIFT = 24;
17  const unsigned int DAQ_BOARDID_VALUE = 0x11;
18 
24  }; // EvmRecordsize
25 
26  const unsigned int EVM_BOARDID_OFFSET = 1;
27  const unsigned int EVM_BOARDID_MASK = 0xffff0000;
28  const unsigned int EVM_BOARDID_SHIFT = 24;
29  const unsigned int EVM_BOARDID_VALUE = 0x11;
30 
31  const unsigned int EVM_GTFE_BLOCK_V0000 = 6; //size in 64-bit words
32  const unsigned int EVM_GTFE_BLOCK_V0011 = 9; //size in 64-bit words, new format
33  const unsigned int EVM_GTFE_BSTGPS_OFFSET = 4; //offset in 32-bit words
34 
35  const unsigned int EVM_TCS_BOARDID_VALUE = 0xcc07;
36  const unsigned int EVM_TCS_BLOCK = 5; //size in 64-bit words
37  const unsigned int EVM_TCS_TRIGNR_OFFSET = 5; //offset in 32-bit words
38  const unsigned int EVM_TCS_LSBLNR_OFFSET = 0; //offset in 32-bit words
39  const unsigned int EVM_TCS_BOARDID_OFFSET = 1; //offset in 32-bit words
40  const unsigned int EVM_TCS_ORBTNR_OFFSET = 6; //offset in 32-bit words
41  const unsigned int EVM_TCS_LSBLNR_MASK = 0x0000ffff; // 16 LSB
42  const unsigned int EVM_TCS_BOARDID_MASK = 0xffff0000; // 16 MSB
43  const unsigned int EVM_TCS_BOARDID_SHIFT = 16; // 16 MSB
44  const unsigned int EVM_TCS_EVNTYP_MASK = 0x00f00000; // 4 bits
45  const unsigned int EVM_TCS_EVNTYP_SHIFT = 20;
46  const unsigned int EVM_TCS_BCNRIN_MASK = 0x00000fff; // 12 LSB
47 
48  const unsigned int EVM_FDL_BLOCK = 7; //size in 64-bit words
49  const unsigned int EVM_FDL_BCNRIN_OFFSET = 1; //offset in 32-bit words
50  const unsigned int EVM_FDL_TECTRG_OFFSET = 2; //offset in 32-bit words
51  const unsigned int EVM_FDL_ALGOB1_OFFSET = 4; //offset in 32-bit words
52  const unsigned int EVM_FDL_ALGOB2_OFFSET = 6; //offset in 32-bit words
53  const unsigned int EVM_FDL_PSCVSN_OFFSET = 11; //offset in 32-bit words
54 
55 
56 
57  const unsigned int GTPE_BOARDID_OFFSET = 16;
58  const unsigned int GTPE_BOARDID_MASK = 0x000000ff;
59  const unsigned int GTPE_BOARDID_SHIFT = 0;
60  const unsigned int GTPE_BOARDID_VALUE = 0x1;
61  const unsigned int GTPE_TRIGNR_OFFSET = 14; //offset in 32-bit words
62  const unsigned int GTPE_ORBTNR_OFFSET = 18; //offset in 32-bit words
63  const unsigned int GTPE_BCNRIN_OFFSET = 3; //offset in 32-bit words
64  const unsigned int GTPE_BCNRIN_MASK = 0x00000fff; // 12 LSB
65 
66  unsigned int offset(bool);
67  inline bool daq_board_sense(const unsigned char *p)
68  {
69  return (*(unsigned int*)(p + sizeof(fedh_t) + DAQ_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> DAQ_BOARDID_SHIFT) == DAQ_BOARDID_VALUE;
70  }
71  bool evm_board_sense(const unsigned char *p, size_t size);
72  bool evm_tcs_board_sense(const unsigned char *p);
73  void evm_board_setformat(size_t size);
74 
75  inline bool gtpe_board_sense(const unsigned char *p)
76  {
77  return (*(unsigned int*)(p + GTPE_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> GTPE_BOARDID_SHIFT) != 0;
78  }
79  unsigned int get(const unsigned char *, bool);
80  unsigned int gtpe_get(const unsigned char *);
81  unsigned int getlbn(const unsigned char *);
82  unsigned int gtpe_getlbn(const unsigned char *);
83  unsigned int getgpslow(const unsigned char *);
84  unsigned int getgpshigh(const unsigned char *);
85  unsigned int getorbit(const unsigned char *);
86  unsigned int getevtyp(const unsigned char *);
87  unsigned int gtpe_getorbit(const unsigned char *);
88  unsigned int getfdlbx(const unsigned char *);
89  unsigned int gtpe_getbx(const unsigned char *);
90  unsigned int getfdlpsc(const unsigned char *);
91  unsigned long long getfdlttr(const unsigned char *);
92  unsigned long long getfdlta1(const unsigned char *);
93  unsigned long long getfdlta2(const unsigned char *);
94  }
95 }
96 #endif
const unsigned int DAQ_BOARDID_MASK
size
Write out results.
const unsigned int GTPE_BOARDID_OFFSET
const unsigned int EVM_GTFE_BLOCK_V0000
unsigned long long getfdlttr(const unsigned char *)
const unsigned int EVM_TCS_LSBLNR_OFFSET
const unsigned int GTPE_BOARDID_VALUE
unsigned int getgpshigh(const unsigned char *)
unsigned int getfdlbx(const unsigned char *)
const unsigned int EVM_TCS_TRIGNR_OFFSET
bool gtpe_board_sense(const unsigned char *p)
const unsigned int DAQ_BOARDID_SHIFT
const unsigned int DAQ_TOTTRG_OFFSET
const unsigned int EVM_BOARDID_VALUE
const unsigned int DAQ_BOARDID_OFFSET
const unsigned int EVM_TCS_BOARDID_VALUE
unsigned int getfdlpsc(const unsigned char *)
const unsigned int EVM_TCS_BOARDID_MASK
const unsigned int EVM_FDL_BLOCK
void evm_board_setformat(size_t size)
unsigned int getlbn(const unsigned char *)
const unsigned int EVM_TCS_BOARDID_SHIFT
const unsigned int GTPE_BCNRIN_MASK
const unsigned int EVM_GTFE_BLOCK_V0011
const unsigned int EVM_TCS_BLOCK
const unsigned int EVM_FDL_ALGOB2_OFFSET
const unsigned int GTPE_BOARDID_SHIFT
unsigned int offset(bool)
bool evm_tcs_board_sense(const unsigned char *p)
bool evm_board_sense(const unsigned char *p, size_t size)
const unsigned int EVM_TCS_EVNTYP_SHIFT
const unsigned int GTPE_TRIGNR_OFFSET
const unsigned int GTPE_BOARDID_MASK
unsigned int getorbit(const unsigned char *)
unsigned int gtpe_getorbit(const unsigned char *)
const unsigned int EVM_FDL_PSCVSN_OFFSET
const unsigned int EVM_TCS_ORBTNR_OFFSET
unsigned int getevtyp(const unsigned char *)
unsigned long long getfdlta1(const unsigned char *)
const unsigned int SLINK_WORD_SIZE
Definition: FEDConstants.h:6
const unsigned int EVM_BOARDID_MASK
const unsigned int EVM_BOARDID_OFFSET
unsigned int gtpe_getbx(const unsigned char *)
const unsigned int EVM_FDL_TECTRG_OFFSET
const unsigned int EVM_GTFE_BSTGPS_OFFSET
unsigned long long getfdlta2(const unsigned char *)
unsigned int gtpe_get(const unsigned char *)
const unsigned int EVM_BOARDID_SHIFT
const unsigned int GTPE_BCNRIN_OFFSET
const unsigned int EVM_TCS_EVNTYP_MASK
bool daq_board_sense(const unsigned char *p)
unsigned int gtpe_getlbn(const unsigned char *)
const unsigned int EVM_FDL_ALGOB1_OFFSET
const unsigned int EVM_TCS_LSBLNR_MASK
unsigned int getgpslow(const unsigned char *)
const unsigned int EVM_FDL_BCNRIN_OFFSET
const unsigned int EVM_TCS_BOARDID_OFFSET
const unsigned int EVM_TCS_BCNRIN_MASK
const unsigned int GTPE_ORBTNR_OFFSET
const unsigned int DAQ_BOARDID_VALUE