CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalEventNumber.cc
Go to the documentation of this file.
1 #include "EventFilter/FEDInterface/interface/GlobalEventNumber.icc"
2 
3 namespace evf{
4  namespace evtn{
5 
6 
7  bool evm_board_sense(const unsigned char *p, size_t size)
8  {
9  switch(size){
10  case BST32_3BX:
11  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
12  EVM_FDL_NOBX = 3;
13  break;
14  case BST32_5BX:
15  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
16  EVM_FDL_NOBX = 5;
17  break;
18  case BST52_3BX:
19  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
20  EVM_FDL_NOBX = 3;
21  break;
22  case BST52_5BX:
23  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
24  EVM_FDL_NOBX = 5;
25  break;
26  default:
27  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
28  EVM_FDL_NOBX = 3;
29  }
30  return (*(const unsigned int*)(p + sizeof(fedh_t) + EVM_BOARDID_OFFSET * SLINK_WORD_SIZE / 2) >> EVM_BOARDID_SHIFT) == EVM_BOARDID_VALUE;
31  }
32  bool evm_tcs_board_sense(const unsigned char *p){
33  return (*(const unsigned int*)(p + sizeof(fedh_t) +
34  (EVM_GTFE_BLOCK*2 + EVM_TCS_BOARDID_OFFSET)
35  * SLINK_WORD_SIZE / 2)
37 
38  }
39 
41  {
42  switch(size){
43  case BST32_3BX:
44  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
45  EVM_FDL_NOBX = 3;
46  break;
47  case BST32_5BX:
48  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
49  EVM_FDL_NOBX = 5;
50  break;
51  case BST52_3BX:
52  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
53  EVM_FDL_NOBX = 3;
54  break;
55  case BST52_5BX:
56  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
57  EVM_FDL_NOBX = 5;
58  break;
59  default:
60  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
61  EVM_FDL_NOBX = 3;
62  }
63  }
64 
65 
66  unsigned int offset(bool evm)
67  {
68  if(evm)
69  return sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_TRIGNR_OFFSET) * SLINK_WORD_SIZE / 2;
70  else
71  return sizeof(fedh_t) + DAQ_TOTTRG_OFFSET * SLINK_WORD_SIZE / 2;
72  }
73  unsigned int get(const unsigned char *p, bool evm)
74  {
75  if(evm && evm_tcs_board_sense(p))
76  return *(const unsigned int*)( p+offset(true));
77  else
78  return *(const unsigned int*)( p+offset(false)); // cover case of evm but invalid tcs info
79  }
80  unsigned int gtpe_get(const unsigned char *p)
81  {
82  return *(const unsigned int*)( p + GTPE_TRIGNR_OFFSET*SLINK_HALFWORD_SIZE );
83  }
84  unsigned int getlbn(const unsigned char *p)
85  {
86  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
88  }
89  unsigned int gtpe_getlbn(const unsigned char *p)
90  {
91  return gtpe_getorbit(p)/0x00100000;
92  }
93  unsigned int getgpslow(const unsigned char *p)
94  {
95  return (*(const unsigned int*)( p+sizeof(fedh_t) + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2));
96  }
97  unsigned int getgpshigh(const unsigned char *p)
98  {
99  return (*(const unsigned int*)( p+sizeof(fedh_t) + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2 + SLINK_HALFWORD_SIZE));
100  }
101  unsigned int getorbit(const unsigned char *p)
102  {
103  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_ORBTNR_OFFSET) * SLINK_WORD_SIZE / 2));
104  }
105  unsigned int getevtyp(const unsigned char *p)
106  {
107  return (((*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
109  }
110  unsigned int gtpe_getorbit(const unsigned char *p)
111  {
112  return (*(const unsigned int*)( p + GTPE_ORBTNR_OFFSET * SLINK_HALFWORD_SIZE));
113  }
114  unsigned int getfdlbx(const unsigned char *p)
115  {
116  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
117  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2) ) * SLINK_WORD_SIZE +
119  }
120  unsigned int gtpe_getbx(const unsigned char *p)
121  {
122  return (*(const unsigned int*)( p + GTPE_BCNRIN_OFFSET * SLINK_HALFWORD_SIZE)) & GTPE_BCNRIN_MASK;
123  }
124  unsigned int getfdlpsc(const unsigned char *p)
125  {
126  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
127  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
129  }
130  unsigned long long getfdlttr(const unsigned char *p)
131  {
132  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
133  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
135  }
136  unsigned long long getfdlta1(const unsigned char *p)
137  {
138  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
139  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
141  }
142  unsigned long long getfdlta2(const unsigned char *p)
143  {
144  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
145  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
147  }
148  }
149 }
const unsigned int EVM_GTFE_BLOCK_V0000
unsigned long long getfdlttr(const unsigned char *)
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
struct fedh_struct fedh_t
const unsigned int DAQ_TOTTRG_OFFSET
const unsigned int EVM_BOARDID_VALUE
const unsigned int EVM_TCS_BOARDID_VALUE
unsigned int getfdlpsc(const unsigned char *)
const unsigned int SLINK_HALFWORD_SIZE
Definition: FEDConstants.h:7
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
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
Definition: FEDConstants.h:6
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
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
tuple size
Write out results.
const unsigned int EVM_TCS_BOARDID_OFFSET
const unsigned int EVM_TCS_BCNRIN_MASK
const unsigned int GTPE_ORBTNR_OFFSET