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  {
9  }
10 
11  bool gtpe_board_sense(const unsigned char *p)
12  {
13  return (*(unsigned int*)(p + GTPE_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> GTPE_BOARDID_SHIFT) != 0;
14  }
15 
16  bool evm_board_sense(const unsigned char *p, size_t size)
17  {
18  switch(size){
19  case BST32_3BX:
20  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
21  EVM_FDL_NOBX = 3;
22  break;
23  case BST32_5BX:
24  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
25  EVM_FDL_NOBX = 5;
26  break;
27  case BST52_3BX:
28  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
29  EVM_FDL_NOBX = 3;
30  break;
31  case BST52_5BX:
32  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
33  EVM_FDL_NOBX = 5;
34  break;
35  default:
36  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
37  EVM_FDL_NOBX = 3;
38  }
39  return (*(const unsigned int*)(p + FEDHeader::length + EVM_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> EVM_BOARDID_SHIFT) == EVM_BOARDID_VALUE;
40  }
41 
42  bool evm_tcs_board_sense(const unsigned char *p){
43  return (*(const unsigned int*)(p + FEDHeader::length +
44  (EVM_GTFE_BLOCK*2 + EVM_TCS_BOARDID_OFFSET)
45  * SLINK_WORD_SIZE / 2)
47 
48  }
49 
51  {
52  switch(size){
53  case BST32_3BX:
54  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
55  EVM_FDL_NOBX = 3;
56  break;
57  case BST32_5BX:
58  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
59  EVM_FDL_NOBX = 5;
60  break;
61  case BST52_3BX:
62  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
63  EVM_FDL_NOBX = 3;
64  break;
65  case BST52_5BX:
66  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
67  EVM_FDL_NOBX = 5;
68  break;
69  default:
70  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
71  EVM_FDL_NOBX = 3;
72  }
73  }
74 
75 
76  unsigned int offset(bool evm)
77  {
78  if(evm)
79  return FEDHeader::length + (EVM_GTFE_BLOCK*2 + EVM_TCS_TRIGNR_OFFSET) * SLINK_WORD_SIZE / 2;
80  else
82  }
83  unsigned int get(const unsigned char *p, bool evm)
84  {
85  if(evm && evm_tcs_board_sense(p))
86  return *(const unsigned int*)( p+offset(true));
87  else
88  return *(const unsigned int*)( p+offset(false)); // cover case of evm but invalid tcs info
89  }
90  unsigned int gtpe_get(const unsigned char *p)
91  {
92  return *(const unsigned int*)( p + GTPE_TRIGNR_OFFSET*SLINK_HALFWORD_SIZE );
93  }
94  unsigned int getlbn(const unsigned char *p)
95  {
96  return (*(const unsigned int*)( p+FEDHeader::length + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
98  }
99  unsigned int gtpe_getlbn(const unsigned char *p)
100  {
101  return gtpe_getorbit(p)/0x00100000;
102  }
103  unsigned int getgpslow(const unsigned char *p)
104  {
105  return (*(const unsigned int*)( p+FEDHeader::length + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2));
106  }
107  unsigned int getgpshigh(const unsigned char *p)
108  {
109  return (*(const unsigned int*)( p+FEDHeader::length + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2 + SLINK_HALFWORD_SIZE));
110  }
111  unsigned int getorbit(const unsigned char *p)
112  {
113  return (*(const unsigned int*)( p+FEDHeader::length + (EVM_GTFE_BLOCK*2 + EVM_TCS_ORBTNR_OFFSET) * SLINK_WORD_SIZE / 2));
114  }
115  unsigned int getevtyp(const unsigned char *p)
116  {
117  return (((*(const unsigned int*)( p+FEDHeader::length + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
119  }
120  unsigned int gtpe_getorbit(const unsigned char *p)
121  {
122  return (*(const unsigned int*)( p + GTPE_ORBTNR_OFFSET * SLINK_HALFWORD_SIZE));
123  }
124  unsigned int getfdlbx(const unsigned char *p)
125  {
126  return (*(const unsigned int*)( p+FEDHeader::length + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
127  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2) ) * SLINK_WORD_SIZE +
129  }
130  unsigned int gtpe_getbx(const unsigned char *p)
131  {
132  return (*(const unsigned int*)( p + GTPE_BCNRIN_OFFSET * SLINK_HALFWORD_SIZE)) & GTPE_BCNRIN_MASK;
133  }
134  unsigned int getfdlpsc(const unsigned char *p)
135  {
136  return (*(const unsigned int*)( p+FEDHeader::length + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
137  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
139  }
140  unsigned long long getfdlttr(const unsigned char *p)
141  {
142  return (*(const unsigned long long*)( p+FEDHeader::length + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
143  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
145  }
146  unsigned long long getfdlta1(const unsigned char *p)
147  {
148  return (*(const unsigned long long*)( p+FEDHeader::length + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
149  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
151  }
152  unsigned long long getfdlta2(const unsigned char *p)
153  {
154  return (*(const unsigned long long*)( p+FEDHeader::length + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
155  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
157  }
158  }
159 }
size
Write out results.
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