Main Page
Namespaces
Classes
Package Documentation
EventFilter
Phase2TrackerRawToDigi
interface
Phase2TrackerFEDDAQHeader.h
Go to the documentation of this file.
1
#ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerFEDDAQHeader_H // {
2
#define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerFEDDAQHeader_H
3
4
#include <cstring>
5
#include "
EventFilter/Phase2TrackerRawToDigi/interface/utils.h
"
6
7
namespace
Phase2Tracker
{
8
9
//
10
// Constants
11
//
12
13
//enum values are values which appear in buffer. DO NOT CHANGE!
14
//see http://cmsdoc.cern.ch/cms/TRIDAS/horizontal/RUWG/DAQ_IF_guide/DAQ_IF_guide.html
15
enum
FEDDAQEventType
{
DAQ_EVENT_TYPE_PHYSICS
=0x1,
16
DAQ_EVENT_TYPE_CALIBRATION
=0x2,
17
DAQ_EVENT_TYPE_TEST
=0x3,
18
DAQ_EVENT_TYPE_TECHNICAL
=0x4,
19
DAQ_EVENT_TYPE_SIMULATED
=0x5,
20
DAQ_EVENT_TYPE_TRACED
=0x6,
21
DAQ_EVENT_TYPE_ERROR
=0xF,
22
DAQ_EVENT_TYPE_INVALID
=
INVALID
23
};
24
25
//to make enums printable
26
inline
std::ostream&
operator<<
(std::ostream& os,
const
FEDDAQEventType
&
value
);
27
28
//see http://cmsdoc.cern.ch/cms/TRIDAS/horizontal/RUWG/DAQ_IF_guide/DAQ_IF_guide.html
29
class
FEDDAQHeader
30
{
31
public
:
32
FEDDAQHeader
() { }
33
explicit
FEDDAQHeader
(
const
uint8_t*
header
);
34
35
// getters
36
//0x5 in first fragment
37
uint8_t
boeNibble
()
const
;
38
uint8_t
eventTypeNibble
()
const
;
39
FEDDAQEventType
eventType
()
const
;
40
uint32_t
l1ID
()
const
;
41
uint16_t
bxID
()
const
;
42
uint16_t
sourceID
()
const
;
43
uint8_t
version
()
const
;
44
//0 if current header word is last, 1 otherwise
45
bool
hBit
()
const
;
46
bool
lastHeader
()
const
;
47
void
print
(std::ostream& os)
const
;
48
49
//used by digi2Raw
50
const
uint8_t*
data
()
const
;
51
52
// setters
53
void
setEventType
(
const
FEDDAQEventType
evtType);
54
void
setL1ID
(
const
uint32_t l1ID);
55
void
setBXID
(
const
uint16_t bxID);
56
void
setSourceID
(
const
uint16_t sourceID);
57
FEDDAQHeader
(
const
uint32_t l1ID,
const
uint16_t bxID,
58
const
uint16_t sourceID,
59
const
FEDDAQEventType
evtType =
DAQ_EVENT_TYPE_PHYSICS
);
60
private
:
61
uint8_t
header_
[8];
62
};
// end of FEDDAQHeader class
63
64
65
//FEDDAQHeader
66
67
inline
FEDDAQHeader::FEDDAQHeader
(
const
uint8_t*
header
)
68
{ memcpy(
header_
,header,8); }
69
70
inline
uint8_t
FEDDAQHeader::boeNibble
()
const
71
{
return
( (
header_
[7] & 0xF0) >> 4 ); }
72
73
inline
uint8_t
FEDDAQHeader::eventTypeNibble
()
const
74
{
return
(
header_
[7] & 0x0F); }
75
76
inline
uint32_t
FEDDAQHeader::l1ID
()
const
77
{
return
(
header_
[4] | (
header_
[5]<<8) | (
header_
[6]<<16) ); }
78
79
inline
uint16_t
FEDDAQHeader::bxID
()
const
80
{
return
( (
header_
[3]<<4) | ((
header_
[2]&0xF0)>>4) ); }
81
82
inline
uint16_t
FEDDAQHeader::sourceID
()
const
83
{
return
( ((
header_
[2]&0x0F)<<8) |
header_
[1] ); }
84
85
inline
uint8_t
FEDDAQHeader::version
()
const
86
{
return
( (
header_
[0] & 0xF0) >> 4 ); }
87
88
inline
bool
FEDDAQHeader::hBit
()
const
89
{
return
(
header_
[0] & 0x8); }
90
91
inline
bool
FEDDAQHeader::lastHeader
()
const
92
{
return
!
hBit
(); }
93
94
inline
const
uint8_t*
FEDDAQHeader::data
()
const
95
{
return
header_
; }
96
97
inline
void
FEDDAQHeader::print
(std::ostream& os)
const
98
{
printHex
(
header_
,8,os); }
99
100
}
// end of Phase2Tracker namespace
101
102
#endif // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerFEDDAQHeader_H
103
104
Phase2Tracker::FEDDAQHeader::data
const uint8_t * data() const
Definition:
Phase2TrackerFEDDAQHeader.h:94
Phase2Tracker::DAQ_EVENT_TYPE_TECHNICAL
Definition:
Phase2TrackerFEDDAQHeader.h:18
Phase2Tracker::operator<<
std::ostream & operator<<(std::ostream &os, const FEDDAQEventType &value)
Definition:
Phase2TrackerFEDDAQHeader.cc:7
Phase2Tracker::FEDDAQHeader::setBXID
void setBXID(const uint16_t bxID)
Definition:
Phase2TrackerFEDDAQHeader.cc:72
Phase2Tracker::FEDDAQHeader::boeNibble
uint8_t boeNibble() const
Definition:
Phase2TrackerFEDDAQHeader.h:70
Phase2Tracker::DAQ_EVENT_TYPE_CALIBRATION
Definition:
Phase2TrackerFEDDAQHeader.h:16
Phase2Tracker::FEDDAQHeader::lastHeader
bool lastHeader() const
Definition:
Phase2TrackerFEDDAQHeader.h:91
Phase2Tracker::INVALID
static const uint8_t INVALID
Definition:
utils.h:32
Phase2Tracker::DAQ_EVENT_TYPE_TRACED
Definition:
Phase2TrackerFEDDAQHeader.h:20
utils.h
Phase2Tracker::DAQ_EVENT_TYPE_TEST
Definition:
Phase2TrackerFEDDAQHeader.h:17
Phase2Tracker::DAQ_EVENT_TYPE_ERROR
Definition:
Phase2TrackerFEDDAQHeader.h:21
Phase2Tracker::FEDDAQHeader::setSourceID
void setSourceID(const uint16_t sourceID)
Definition:
Phase2TrackerFEDDAQHeader.cc:78
Phase2Tracker::FEDDAQHeader::version
uint8_t version() const
Definition:
Phase2TrackerFEDDAQHeader.h:85
Phase2Tracker::FEDDAQHeader::bxID
uint16_t bxID() const
Definition:
Phase2TrackerFEDDAQHeader.h:79
Phase2Tracker::DAQ_EVENT_TYPE_PHYSICS
Definition:
Phase2TrackerFEDDAQHeader.h:15
RecoTauValidation_cfi.header
header
Definition:
RecoTauValidation_cfi.py:299
Phase2Tracker
Definition:
Phase2TrackerFEDBuffer.h:12
Phase2Tracker::FEDDAQHeader::sourceID
uint16_t sourceID() const
Definition:
Phase2TrackerFEDDAQHeader.h:82
Phase2Tracker::FEDDAQHeader::print
void print(std::ostream &os) const
Definition:
Phase2TrackerFEDDAQHeader.h:97
value
Definition:
value.py:1
Phase2Tracker::FEDDAQHeader::eventTypeNibble
uint8_t eventTypeNibble() const
Definition:
Phase2TrackerFEDDAQHeader.h:73
Phase2Tracker::FEDDAQHeader::eventType
FEDDAQEventType eventType() const
Definition:
Phase2TrackerFEDDAQHeader.cc:44
Phase2Tracker::DAQ_EVENT_TYPE_INVALID
Definition:
Phase2TrackerFEDDAQHeader.h:22
Phase2Tracker::FEDDAQEventType
FEDDAQEventType
Definition:
Phase2TrackerFEDDAQHeader.h:15
Phase2Tracker::FEDDAQHeader::setEventType
void setEventType(const FEDDAQEventType evtType)
Definition:
Phase2TrackerFEDDAQHeader.cc:60
Phase2Tracker::FEDDAQHeader::l1ID
uint32_t l1ID() const
Definition:
Phase2TrackerFEDDAQHeader.h:76
Phase2Tracker::FEDDAQHeader::hBit
bool hBit() const
Definition:
Phase2TrackerFEDDAQHeader.h:88
Phase2Tracker::DAQ_EVENT_TYPE_SIMULATED
Definition:
Phase2TrackerFEDDAQHeader.h:19
Phase2Tracker::printHex
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition:
utils.h:60
Phase2Tracker::FEDDAQHeader::FEDDAQHeader
FEDDAQHeader()
Definition:
Phase2TrackerFEDDAQHeader.h:32
Phase2Tracker::FEDDAQHeader
Definition:
Phase2TrackerFEDDAQHeader.h:29
Phase2Tracker::FEDDAQHeader::setL1ID
void setL1ID(const uint32_t l1ID)
Definition:
Phase2TrackerFEDDAQHeader.cc:65
Phase2Tracker::FEDDAQHeader::header_
uint8_t header_[8]
Definition:
Phase2TrackerFEDDAQHeader.h:61
Generated for CMSSW Reference Manual by
1.8.11