EventFilter
Phase2TrackerRawToDigi
src
Phase2TrackerFEDDAQHeader.cc
Go to the documentation of this file.
1
#include <iomanip>
2
#include <ostream>
3
#include "
EventFilter/Phase2TrackerRawToDigi/interface/Phase2TrackerFEDDAQHeader.h
"
4
5
namespace
Phase2Tracker
{
6
7
std::ostream&
operator<<
(std::ostream& os,
const
FEDDAQEventType
&
value
) {
8
switch
(
value
) {
9
case
DAQ_EVENT_TYPE_PHYSICS
:
10
os <<
"Physics trigger"
;
11
break
;
12
case
DAQ_EVENT_TYPE_CALIBRATION
:
13
os <<
"Calibration trigger"
;
14
break
;
15
case
DAQ_EVENT_TYPE_TEST
:
16
os <<
"Test trigger"
;
17
break
;
18
case
DAQ_EVENT_TYPE_TECHNICAL
:
19
os <<
"Technical trigger"
;
20
break
;
21
case
DAQ_EVENT_TYPE_SIMULATED
:
22
os <<
"Simulated event"
;
23
break
;
24
case
DAQ_EVENT_TYPE_TRACED
:
25
os <<
"Traced event"
;
26
break
;
27
case
DAQ_EVENT_TYPE_ERROR
:
28
os <<
"Error"
;
29
break
;
30
case
DAQ_EVENT_TYPE_INVALID
:
31
os <<
"Unknown"
;
32
break
;
33
default
:
34
os <<
"Unrecognized"
;
35
os <<
" ("
;
36
printHexValue
(
value
, os);
37
os <<
")"
;
38
break
;
39
}
40
return
os;
41
}
42
43
FEDDAQEventType
FEDDAQHeader::eventType
()
const
{
44
switch
(
eventTypeNibble
()) {
45
case
DAQ_EVENT_TYPE_PHYSICS
:
46
case
DAQ_EVENT_TYPE_CALIBRATION
:
47
case
DAQ_EVENT_TYPE_TEST
:
48
case
DAQ_EVENT_TYPE_TECHNICAL
:
49
case
DAQ_EVENT_TYPE_SIMULATED
:
50
case
DAQ_EVENT_TYPE_TRACED
:
51
case
DAQ_EVENT_TYPE_ERROR
:
52
return
FEDDAQEventType
(
eventTypeNibble
());
53
default
:
54
return
DAQ_EVENT_TYPE_INVALID
;
55
}
56
}
57
58
void
FEDDAQHeader::setEventType
(
const
FEDDAQEventType
evtType) {
header_
[7] = ((
header_
[7] & 0xF0) | evtType); }
59
60
void
FEDDAQHeader::setL1ID
(
const
uint32_t l1ID) {
61
header_
[4] = (
l1ID
& 0x000000FF);
62
header_
[5] = ((
l1ID
& 0x0000FF00) >> 8);
63
header_
[6] = ((
l1ID
& 0x00FF0000) >> 16);
64
}
65
66
void
FEDDAQHeader::setBXID
(
const
uint16_t bxID) {
67
header_
[3] = ((
bxID
& 0x0FF0) >> 4);
68
header_
[2] = ((
header_
[2] & 0x0F) | ((
bxID
& 0x000F) << 4));
69
}
70
71
void
FEDDAQHeader::setSourceID
(
const
uint16_t sourceID) {
72
header_
[2] = ((
header_
[2] & 0xF0) | ((
sourceID
& 0x0F00) >> 8));
73
header_
[1] = (
sourceID
& 0x00FF);
74
}
75
76
FEDDAQHeader::FEDDAQHeader
(
const
uint32_t l1ID,
77
const
uint16_t bxID,
78
const
uint16_t sourceID,
79
const
FEDDAQEventType
evtType) {
80
//clear everything (FOV,H,x,$ all set to 0)
81
memset(
header_
, 0x0, 8);
82
//set the BoE nibble to indicate this is the last fragment
83
header_
[7] = 0x50;
84
//set variable fields vith values supplied
85
setEventType
(evtType);
86
setL1ID
(
l1ID
);
87
setBXID
(
bxID
);
88
setSourceID
(
sourceID
);
89
}
90
91
}
// namespace Phase2Tracker
Phase2TrackerFEDDAQHeader.h
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::DAQ_EVENT_TYPE_CALIBRATION
Definition:
Phase2TrackerFEDDAQHeader.h:17
Phase2Tracker::DAQ_EVENT_TYPE_TRACED
Definition:
Phase2TrackerFEDDAQHeader.h:21
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
Phase2Tracker
Definition:
Phase2TrackerFEDBuffer.h:12
Phase2Tracker::FEDDAQHeader::l1ID
uint32_t l1ID() const
Definition:
Phase2TrackerFEDDAQHeader.h:74
value
Definition:
value.py:1
Phase2Tracker::FEDDAQHeader::sourceID
uint16_t sourceID() const
Definition:
Phase2TrackerFEDDAQHeader.h:78
Phase2Tracker::printHexValue
void printHexValue(const uint8_t value, std::ostream &os)
Definition:
utils.h:42
Phase2Tracker::DAQ_EVENT_TYPE_INVALID
Definition:
Phase2TrackerFEDDAQHeader.h:23
Phase2Tracker::FEDDAQEventType
FEDDAQEventType
Definition:
Phase2TrackerFEDDAQHeader.h:15
Phase2Tracker::FEDDAQHeader::setEventType
void setEventType(const FEDDAQEventType evtType)
Definition:
Phase2TrackerFEDDAQHeader.cc:58
Phase2Tracker::DAQ_EVENT_TYPE_SIMULATED
Definition:
Phase2TrackerFEDDAQHeader.h:20
Phase2Tracker::FEDDAQHeader::FEDDAQHeader
FEDDAQHeader()
Definition:
Phase2TrackerFEDDAQHeader.h:32
Phase2Tracker::FEDDAQHeader::bxID
uint16_t bxID() const
Definition:
Phase2TrackerFEDDAQHeader.h:76
Phase2Tracker::FEDDAQHeader::setL1ID
void setL1ID(const uint32_t l1ID)
Definition:
Phase2TrackerFEDDAQHeader.cc:60
Phase2Tracker::FEDDAQHeader::header_
uint8_t header_[8]
Definition:
Phase2TrackerFEDDAQHeader.h:63
Generated for CMSSW Reference Manual by
1.8.14