src
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
{
16
DAQ_EVENT_TYPE_PHYSICS
= 0x1,
17
DAQ_EVENT_TYPE_CALIBRATION
= 0x2,
18
DAQ_EVENT_TYPE_TEST
= 0x3,
19
DAQ_EVENT_TYPE_TECHNICAL
= 0x4,
20
DAQ_EVENT_TYPE_SIMULATED
= 0x5,
21
DAQ_EVENT_TYPE_TRACED
= 0x6,
22
DAQ_EVENT_TYPE_ERROR
= 0xF,
23
DAQ_EVENT_TYPE_INVALID
=
INVALID
24
};
25
26
//to make enums printable
27
inline
std::ostream&
operator<<
(std::ostream&
os
,
const
FEDDAQEventType
&
value
);
28
29
//see http://cmsdoc.cern.ch/cms/TRIDAS/horizontal/RUWG/DAQ_IF_guide/DAQ_IF_guide.html
30
class
FEDDAQHeader
{
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
,
58
const
uint16_t
bxID
,
59
const
uint16_t
sourceID
,
60
const
FEDDAQEventType
evtType =
DAQ_EVENT_TYPE_PHYSICS
);
61
62
private
:
63
uint8_t
header_
[8];
64
};
// end of FEDDAQHeader class
65
66
//FEDDAQHeader
67
68
inline
FEDDAQHeader::FEDDAQHeader
(
const
uint8_t*
header
) { memcpy(
header_
,
header
, 8); }
69
70
inline
uint8_t
FEDDAQHeader::boeNibble
()
const
{
return
((
header_
[7] & 0xF0) >> 4); }
71
72
inline
uint8_t
FEDDAQHeader::eventTypeNibble
()
const
{
return
(
header_
[7] & 0x0F); }
73
74
inline
uint32_t
FEDDAQHeader::l1ID
()
const
{
return
(
header_
[4] | (
header_
[5] << 8) | (
header_
[6] << 16)); }
75
76
inline
uint16_t
FEDDAQHeader::bxID
()
const
{
return
((
header_
[3] << 4) | ((
header_
[2] & 0xF0) >> 4)); }
77
78
inline
uint16_t
FEDDAQHeader::sourceID
()
const
{
return
(((
header_
[2] & 0x0F) << 8) |
header_
[1]); }
79
80
inline
uint8_t
FEDDAQHeader::version
()
const
{
return
((
header_
[0] & 0xF0) >> 4); }
81
82
inline
bool
FEDDAQHeader::hBit
()
const
{
return
(
header_
[0] & 0x8); }
83
84
inline
bool
FEDDAQHeader::lastHeader
()
const
{
return
!
hBit
(); }
85
86
inline
const
uint8_t*
FEDDAQHeader::data
()
const
{
return
header_
; }
87
88
inline
void
FEDDAQHeader::print
(std::ostream&
os
)
const
{
printHex
(
header_
, 8,
os
); }
89
90
}
// namespace Phase2Tracker
91
92
#endif // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerFEDDAQHeader_H
Phase2Tracker::FEDDAQHeader::print
void print(std::ostream &os) const
Definition:
Phase2TrackerFEDDAQHeader.h:88
Phase2Tracker::FEDDAQHeader::eventTypeNibble
uint8_t eventTypeNibble() const
Definition:
Phase2TrackerFEDDAQHeader.h:72
Phase2Tracker::DAQ_EVENT_TYPE_TECHNICAL
Definition:
Phase2TrackerFEDDAQHeader.h:19
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:66
Phase2Tracker::FEDDAQHeader::hBit
bool hBit() const
Definition:
Phase2TrackerFEDDAQHeader.h:82
Phase2Tracker::FEDDAQHeader::boeNibble
uint8_t boeNibble() const
Definition:
Phase2TrackerFEDDAQHeader.h:70
Phase2Tracker::DAQ_EVENT_TYPE_CALIBRATION
Definition:
Phase2TrackerFEDDAQHeader.h:17
Phase2Tracker::INVALID
static const uint8_t INVALID
Definition:
utils.h:33
Phase2Tracker::DAQ_EVENT_TYPE_TRACED
Definition:
Phase2TrackerFEDDAQHeader.h:21
utils.h
Phase2Tracker::DAQ_EVENT_TYPE_TEST
Definition:
Phase2TrackerFEDDAQHeader.h:18
Phase2Tracker::DAQ_EVENT_TYPE_ERROR
Definition:
Phase2TrackerFEDDAQHeader.h:22
Phase2Tracker::FEDDAQHeader::setSourceID
void setSourceID(const uint16_t sourceID)
Definition:
Phase2TrackerFEDDAQHeader.cc:71
Phase2Tracker::FEDDAQHeader::eventType
FEDDAQEventType eventType() const
Definition:
Phase2TrackerFEDDAQHeader.cc:43
Phase2Tracker::DAQ_EVENT_TYPE_PHYSICS
Definition:
Phase2TrackerFEDDAQHeader.h:16
RecoTauValidation_cfi.header
header
Definition:
RecoTauValidation_cfi.py:291
Phase2Tracker
Definition:
Phase2TrackerFEDBuffer.h:12
Phase2Tracker::FEDDAQHeader::l1ID
uint32_t l1ID() const
Definition:
Phase2TrackerFEDDAQHeader.h:74
l1tGTMenu_BTagSeeds_cff.os
os
Definition:
l1tGTMenu_BTagSeeds_cff.py:34
value
Definition:
value.py:1
Phase2Tracker::FEDDAQHeader::sourceID
uint16_t sourceID() const
Definition:
Phase2TrackerFEDDAQHeader.h:78
Phase2Tracker::DAQ_EVENT_TYPE_INVALID
Definition:
Phase2TrackerFEDDAQHeader.h:23
Phase2Tracker::FEDDAQEventType
FEDDAQEventType
Definition:
Phase2TrackerFEDDAQHeader.h:15
Phase2Tracker::FEDDAQHeader::version
uint8_t version() const
Definition:
Phase2TrackerFEDDAQHeader.h:80
Phase2Tracker::FEDDAQHeader::setEventType
void setEventType(const FEDDAQEventType evtType)
Definition:
Phase2TrackerFEDDAQHeader.cc:58
Phase2Tracker::DAQ_EVENT_TYPE_SIMULATED
Definition:
Phase2TrackerFEDDAQHeader.h:20
Phase2Tracker::printHex
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition:
utils.h:59
Phase2Tracker::FEDDAQHeader::FEDDAQHeader
FEDDAQHeader()
Definition:
Phase2TrackerFEDDAQHeader.h:32
Phase2Tracker::FEDDAQHeader::data
const uint8_t * data() const
Definition:
Phase2TrackerFEDDAQHeader.h:86
Phase2Tracker::FEDDAQHeader::bxID
uint16_t bxID() const
Definition:
Phase2TrackerFEDDAQHeader.h:76
Phase2Tracker::FEDDAQHeader
Definition:
Phase2TrackerFEDDAQHeader.h:30
Phase2Tracker::FEDDAQHeader::setL1ID
void setL1ID(const uint32_t l1ID)
Definition:
Phase2TrackerFEDDAQHeader.cc:60
Phase2Tracker::FEDDAQHeader::header_
uint8_t header_[8]
Definition:
Phase2TrackerFEDDAQHeader.h:63
Phase2Tracker::FEDDAQHeader::lastHeader
bool lastHeader() const
Definition:
Phase2TrackerFEDDAQHeader.h:84
Generated for CMSSW Reference Manual by
1.8.14