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 
33 
35  {
36  switch(size){
37  case BST32_3BX:
38  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
39  EVM_FDL_NOBX = 3;
40  break;
41  case BST32_5BX:
42  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
43  EVM_FDL_NOBX = 5;
44  break;
45  case BST52_3BX:
46  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
47  EVM_FDL_NOBX = 3;
48  break;
49  case BST52_5BX:
50  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0011;
51  EVM_FDL_NOBX = 5;
52  break;
53  default:
54  EVM_GTFE_BLOCK = EVM_GTFE_BLOCK_V0000;
55  EVM_FDL_NOBX = 3;
56  }
57  }
58 
59 
60  unsigned int offset(bool evm)
61  {
62  if(evm)
63  return sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_TRIGNR_OFFSET) * SLINK_WORD_SIZE / 2;
64  else
65  return sizeof(fedh_t) + DAQ_TOTTRG_OFFSET * SLINK_WORD_SIZE / 2;
66  }
67  unsigned int get(const unsigned char *p, bool evm)
68  {
69  return *(const unsigned int*)( p+offset(evm) );
70  }
71  unsigned int gtpe_get(const unsigned char *p)
72  {
73  return *(const unsigned int*)( p + GTPE_TRIGNR_OFFSET*SLINK_HALFWORD_SIZE );
74  }
75  unsigned int getlbn(const unsigned char *p)
76  {
77  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
79  }
80  unsigned int gtpe_getlbn(const unsigned char *p)
81  {
82  return gtpe_getorbit(p)/0x00100000;
83  }
84  unsigned int getgpslow(const unsigned char *p)
85  {
86  return (*(const unsigned int*)( p+sizeof(fedh_t) + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2));
87  }
88  unsigned int getgpshigh(const unsigned char *p)
89  {
90  return (*(const unsigned int*)( p+sizeof(fedh_t) + EVM_GTFE_BSTGPS_OFFSET * SLINK_WORD_SIZE / 2 + SLINK_HALFWORD_SIZE));
91  }
92  unsigned int getorbit(const unsigned char *p)
93  {
94  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_ORBTNR_OFFSET) * SLINK_WORD_SIZE / 2));
95  }
96  unsigned int getevtyp(const unsigned char *p)
97  {
98  return (((*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK*2 + EVM_TCS_LSBLNR_OFFSET) * SLINK_WORD_SIZE / 2))
100  }
101  unsigned int gtpe_getorbit(const unsigned char *p)
102  {
103  return (*(const unsigned int*)( p + GTPE_ORBTNR_OFFSET * SLINK_HALFWORD_SIZE));
104  }
105  unsigned int getfdlbx(const unsigned char *p)
106  {
107  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
108  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2) ) * SLINK_WORD_SIZE +
110  }
111  unsigned int gtpe_getbx(const unsigned char *p)
112  {
113  return (*(const unsigned int*)( p + GTPE_BCNRIN_OFFSET * SLINK_HALFWORD_SIZE)) & GTPE_BCNRIN_MASK;
114  }
115  unsigned int getfdlpsc(const unsigned char *p)
116  {
117  return (*(const unsigned int*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
118  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
120  }
121  unsigned long long getfdlttr(const unsigned char *p)
122  {
123  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
124  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
126  }
127  unsigned long long getfdlta1(const unsigned char *p)
128  {
129  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
130  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
132  }
133  unsigned long long getfdlta2(const unsigned char *p)
134  {
135  return (*(const unsigned long long*)( p+sizeof(fedh_t) + (EVM_GTFE_BLOCK + EVM_TCS_BLOCK
136  + EVM_FDL_BLOCK * (EVM_FDL_NOBX/2)) * SLINK_WORD_SIZE +
138  }
139  }
140 }
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
const unsigned int DAQ_TOTTRG_OFFSET
const unsigned int EVM_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 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)
struct fedh_struct fedh_t
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_BCNRIN_MASK
const unsigned int GTPE_ORBTNR_OFFSET