CMS 3D CMS Logo

GlobalEventNumber.cc
Go to the documentation of this file.
1 #include "EventFilter/Utilities/interface/GlobalEventNumber.icc"
2 
3 namespace evf {
4  namespace evtn {
5 
6  bool daq_board_sense(const unsigned char *p) {
7  return (*(unsigned int *)(p + FEDHeader::length + DAQ_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >>
9  }
10 
11  bool gtpe_board_sense(const unsigned char *p) {
12  return (*(unsigned int *)(p + GTPE_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> GTPE_BOARDID_SHIFT) != 0;
13  }
14 
15  bool evm_board_sense(const unsigned char *p, size_t size) {
16  switch (size) {
17  case BST32_3BX:
18  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
19  EVM_FDL_NOBX = 3;
20  break;
21  case BST32_5BX:
22  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
23  EVM_FDL_NOBX = 5;
24  break;
25  case BST52_3BX:
26  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
27  EVM_FDL_NOBX = 3;
28  break;
29  case BST52_5BX:
30  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
31  EVM_FDL_NOBX = 5;
32  break;
33  default:
34  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
35  EVM_FDL_NOBX = 3;
36  }
37  return (*(const unsigned int *)(p + FEDHeader::length + EVM_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >>
39  }
40 
41  bool evm_tcs_board_sense(const unsigned char *p) {
42  return (*(const unsigned int *)(p + FEDHeader::length +
43  (EVM_GTFE_BLOCK * 2 + EVM_TCS_BOARDID_OFFSET) * SLINK_WORD_SIZE / 2) >>
45  }
46 
47  void evm_board_setformat(size_t size) {
48  switch (size) {
49  case BST32_3BX:
50  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
51  EVM_FDL_NOBX = 3;
52  break;
53  case BST32_5BX:
54  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
55  EVM_FDL_NOBX = 5;
56  break;
57  case BST52_3BX:
58  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
59  EVM_FDL_NOBX = 3;
60  break;
61  case BST52_5BX:
62  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
63  EVM_FDL_NOBX = 5;
64  break;
65  default:
66  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
67  EVM_FDL_NOBX = 3;
68  }
69  }
70 
71  unsigned int offset(bool evm) {
72  if (evm)
73  return FEDHeader::length + (EVM_GTFE_BLOCK * 2 + EVM_TCS_TRIGNR_OFFSET) * SLINK_WORD_SIZE / 2;
74  else
76  }
77  unsigned int get(const unsigned char *p, bool evm) {
78  if (evm && evm_tcs_board_sense(p))
79  return *(const unsigned int *)(p + offset(true));
80  else
81  return *(const unsigned int *)(p + offset(false)); // cover case of evm but invalid tcs info
82  }
83  unsigned int gtpe_get(const unsigned char *p) {
84  return *(const unsigned int *)(p + GTPE_TRIGNR_OFFSET * SLINK_HALFWORD_SIZE);
85  }
86  unsigned int getlbn(const unsigned char *p) {
87  return (*(const unsigned int *)(p + FEDHeader::length +
88  (EVM_GTFE_BLOCK * 2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2)) &
90  }
91  unsigned int gtpe_getlbn(const unsigned char *p) { return gtpe_getorbit(p) / 0x00100000; }
92  unsigned int getgpslow(const unsigned char *p) {
93  return (*(const unsigned int *)(p + FEDHeader::length + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2));
94  }
95  unsigned int getgpshigh(const unsigned char *p) {
96  return (*(const unsigned int *)(p + FEDHeader::length + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2 +
98  }
99  unsigned int getorbit(const unsigned char *p) {
100  return (*(const unsigned int *)(p + FEDHeader::length +
101  (EVM_GTFE_BLOCK * 2 + EVM_TCS_ORBTNR_OFFSET) * SLINK_WORD_SIZE / 2));
102  }
103  unsigned int getevtyp(const unsigned char *p) {
104  return (((*(const unsigned int *)(p + FEDHeader::length +
105  (EVM_GTFE_BLOCK * 2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2)) &
108  }
109  unsigned int gtpe_getorbit(const unsigned char *p) {
110  return (*(const unsigned int *)(p + GTPE_ORBTNR_OFFSET * SLINK_HALFWORD_SIZE));
111  }
112  unsigned int getfdlbx(const unsigned char *p) {
113  return (*(const unsigned int *)(p + FEDHeader::length +
114  (EVM_GTFE_BLOCK + EVM_TCS_BLOCK + EVM_FDL_BLOCK * (EVM_FDL_NOBX / 2)) *
118  }
119  unsigned int gtpe_getbx(const unsigned char *p) {
120  return (*(const unsigned int *)(p + GTPE_BCNRIN_OFFSET * SLINK_HALFWORD_SIZE)) & GTPE_BCNRIN_MASK;
121  }
122  unsigned int getfdlpsc(const unsigned char *p) {
123  return (*(const unsigned int *)(p + FEDHeader::length +
124  (EVM_GTFE_BLOCK + EVM_TCS_BLOCK + EVM_FDL_BLOCK * (EVM_FDL_NOBX / 2)) *
127  }
128  unsigned long long getfdlttr(const unsigned char *p) {
129  return (*(const unsigned long long *)(p + FEDHeader::length +
130  (EVM_GTFE_BLOCK + EVM_TCS_BLOCK + EVM_FDL_BLOCK * (EVM_FDL_NOBX / 2)) *
133  }
134  unsigned long long getfdlta1(const unsigned char *p) {
135  return (*(const unsigned long long *)(p + FEDHeader::length +
136  (EVM_GTFE_BLOCK + EVM_TCS_BLOCK + EVM_FDL_BLOCK * (EVM_FDL_NOBX / 2)) *
139  }
140  unsigned long long getfdlta2(const unsigned char *p) {
141  return (*(const unsigned long long *)(p + FEDHeader::length +
142  (EVM_GTFE_BLOCK + EVM_TCS_BLOCK + EVM_FDL_BLOCK * (EVM_FDL_NOBX / 2)) *
145  }
146  } // namespace evtn
147 } // namespace evf
const unsigned int GTPE_BOARDID_OFFSET
const unsigned int EVM_GTFE_BLOCK_V0000
unsigned long long getfdlttr(const unsigned char *)
Definition: fillJson.h:27
const unsigned int EVM_TCS_LSBLNR_OFFSET
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
static const uint32_t length
Definition: FEDHeader.h:54
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 SLINK_HALFWORD_SIZE
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
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
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