CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FEDHeader.cc
Go to the documentation of this file.
1 
9 #include "fed_header.h"
10 
11 FEDHeader::FEDHeader(const unsigned char* header) :
12  theHeader(reinterpret_cast<const fedh_t*>(header)) {}
13 
14 
16 
17 
20 }
21 
23  return (theHeader->eventid & FED_LVL1_MASK);
24 }
25 
28 }
29 
32 }
33 
36 }
37 
39  return ((theHeader->sourceid & FED_MORE_HEADERS)!=0);
40 }
41 
42 void FEDHeader::set(unsigned char* header,
43  int evt_ty,
44  int lvl1_ID,
45  int bx_ID,
46  int source_ID,
47  int version,
48  bool H){
49 
50  // FIXME: should check that input ranges are OK!!!
51  fedh_t* h = reinterpret_cast<fedh_t*>(header);
52  h->eventid =
54  ( ( evt_ty << FED_EVTY_SHIFT) & FED_EVTY_MASK ) |
55  ( ( lvl1_ID << FED_LVL1_SHIFT) & FED_LVL1_MASK );
56 
57  h->sourceid =
58  ( ( bx_ID << FED_BXID_SHIFT) & FED_BXID_MASK ) |
59  ( ( source_ID << FED_SOID_SHIFT) & FED_SOID_MASK ) |
60  ( ( version << FED_VERSION_SHIFT) & FED_VERSION_MASK );
61 
62  if (H) h->sourceid |= FED_MORE_HEADERS;
63 
64 }
65 
67  // ...may report with finer detail
68  bool result = true;
69  result &= ((theHeader->eventid & FED_HCTRLID_MASK) == FED_HCTRLID);
70 
71  return result;
72 }
int version()
Version identifier of the FED data format.
Definition: FEDHeader.cc:34
FEDHeader(const unsigned char *header)
Constructor.
Definition: FEDHeader.cc:11
unsigned int sourceid
Definition: fed_header.h:32
#define FED_SOID_SHIFT
Definition: fed_header.h:55
const fedh_struct * theHeader
Definition: FEDHeader.h:56
int sourceID()
Identifier of the FED.
Definition: FEDHeader.cc:30
bool moreHeaders()
Definition: FEDHeader.cc:38
#define FED_EVTY_SHIFT
Definition: fed_header.h:51
static void set(unsigned char *header, int evt_ty, int lvl1_ID, int bx_ID, int source_ID, int version=0, bool H=false)
Set all fields in the header.
Definition: FEDHeader.cc:42
tuple result
Definition: query.py:137
#define FED_BXID_MASK
Definition: fed_header.h:41
#define FED_VERSION_MASK
Definition: fed_header.h:43
#define FED_BXID_SHIFT
Definition: fed_header.h:54
#define FED_SOID_MASK
Definition: fed_header.h:42
bool check()
Check that the header is OK.
Definition: FEDHeader.cc:66
#define FED_LVL1_MASK
Definition: fed_header.h:39
#define FED_VERSION_SHIFT
Definition: fed_header.h:56
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define FED_HCTRLID
Definition: fed_header.h:47
int bxID()
The bunch crossing number.
Definition: FEDHeader.cc:26
string const
Definition: compareJSON.py:14
#define FED_LVL1_SHIFT
Definition: fed_header.h:52
unsigned int eventid
Definition: fed_header.h:33
#define FED_MORE_HEADERS
Definition: fed_header.h:44
#define FED_HCTRLID_MASK
Definition: fed_header.h:37
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:22
#define FED_EVTY_MASK
Definition: fed_header.h:38
int triggerType()
Event Trigger type identifier.
Definition: FEDHeader.cc:18
~FEDHeader()
Destructor.
Definition: FEDHeader.cc:15