EventFilter
CSCRawToDigi
interface
CSCALCTHeader.h
Go to the documentation of this file.
1
#ifndef EventFilter_CSCRawToDigi_CSCALCTHeader_h
2
#define EventFilter_CSCRawToDigi_CSCALCTHeader_h
3
7
#include <bitset>
8
#include <vector>
9
#include <iosfwd>
10
#ifndef LOCAL_UNPACK
11
#include <atomic>
12
#endif
13
#include "
DataFormats/CSCDigi/interface/CSCALCTDigi.h
"
14
#include "
DataFormats/CSCDigi/interface/CSCALCTStatusDigi.h
"
15
#include "
EventFilter/CSCRawToDigi/interface/CSCALCTHeader2006.h
"
16
#include "
EventFilter/CSCRawToDigi/interface/CSCALCTHeader2007.h
"
17
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
18
#include "
FWCore/Utilities/interface/Exception.h
"
19
#include <boost/dynamic_bitset.hpp>
20
21
class
CSCALCTHeader
{
22
public
:
23
explicit
CSCALCTHeader
(
int
chamberType);
24
25
explicit
CSCALCTHeader
(
const
unsigned
short
*
buf
);
26
27
CSCALCTHeader
(
const
CSCALCTStatusDigi
&digi);
28
30
static
void
setDebug
(
bool
value
) {
debug
=
value
; };
31
32
void
setEventInformation
(
const
CSCDMBHeader
&);
33
unsigned
short
int
nLCTChipRead
()
const
;
34
35
std::vector<CSCALCTDigi>
ALCTDigis
()
const
;
36
39
40
enum
FIFO_MODE
{
NO_DUMP
,
FULL_DUMP
,
LOCAL_DUMP
};
41
unsigned
short
int
FIFOMode
()
const
{
return
header2006
.
fifoMode
; }
42
unsigned
short
int
NTBins
()
const
{
43
#ifdef LOCAL_UNPACK
44
switch
(
firmwareVersion
) {
45
#else
46
switch
(
firmwareVersion
.load()) {
47
#endif
48
case
2006:
49
return
header2006
.
nTBins
;
50
case
2007:
51
return
header2007
.
rawBins
;
52
default
:
53
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
)
54
<<
"trying to access NTBINs: ALCT firmware version is bad/not defined!"
;
55
return
0;
56
}
57
}
58
unsigned
short
int
BoardID
()
const
{
return
header2006
.
boardID
; }
59
unsigned
short
int
ExtTrig
()
const
{
return
header2006
.
extTrig
; }
60
unsigned
short
int
CSCID
()
const
{
return
header2006
.
cscID
; }
61
unsigned
short
int
BXNCount
()
const
{
62
#ifdef LOCAL_UNPACK
63
switch
(
firmwareVersion
) {
64
#else
65
switch
(
firmwareVersion
.load()) {
66
#endif
67
case
2006:
68
return
header2006
.
bxnCount
;
69
case
2007:
70
return
header2007
.
bxnCount
;
71
default
:
72
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
)
73
<<
"trying to access BXNcount: ALCT firmware version is bad/not defined!"
;
74
return
0;
75
}
76
}
77
78
void
setBXNCount
(
unsigned
int
bxn) {
79
#ifdef LOCAL_UNPACK
80
switch
(
firmwareVersion
) {
81
#else
82
switch
(
firmwareVersion
.load()) {
83
#endif
84
case
2006:
85
header2006
.
bxnCount
= bxn % 0xFFF;
86
break
;
87
case
2007:
88
header2007
.
bxnCount
= bxn % 0xFFF;
89
break
;
90
default
:
91
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
)
92
<<
"trying to set BXNcount: ALCT firmware version is bad/not defined!"
;
93
break
;
94
}
95
}
96
97
unsigned
short
int
L1Acc
()
const
{
98
#ifdef LOCAL_UNPACK
99
switch
(
firmwareVersion
) {
100
#else
101
switch
(
firmwareVersion
.load()) {
102
#endif
103
case
2006:
104
return
header2006
.
l1Acc
;
105
case
2007:
106
return
header2007
.
l1aCounter
;
107
default
:
108
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
)
109
<<
"trying to access L1Acc: ALCT firmware version is bad/not defined!"
;
110
return
0;
111
}
112
}
113
114
void
setL1Acc
(
unsigned
int
l1a) {
115
#ifdef LOCAL_UNPACK
116
switch
(
firmwareVersion
) {
117
#else
118
switch
(
firmwareVersion
.load()) {
119
#endif
120
case
2006:
121
header2006
.
l1Acc
= l1a % 0xF;
122
break
;
123
case
2007:
124
header2007
.
l1aCounter
= l1a % 0xFFF;
125
break
;
126
default
:
127
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
) <<
"trying to set L1Acc: ALCT firmware version is bad/not defined!"
;
128
break
;
129
}
130
}
131
132
unsigned
short
int
L1AMatch
()
const
{
return
header2006
.
l1aMatch
; }
133
unsigned
short
int
ActiveFEBs
()
const
{
return
header2006
.
activeFEBs
; }
134
unsigned
short
int
Promote1
()
const
{
return
header2006
.
promote1
; }
135
unsigned
short
int
Promote2
()
const
{
return
header2006
.
promote2
; }
136
unsigned
short
int
LCTChipRead
()
const
{
return
header2006
.
lctChipRead
; }
137
unsigned
short
int
alctFirmwareVersion
()
const
{
return
firmwareVersion
; }
138
void
setDAVForChannel
(
int
wireGroup) {
139
if
(
firmwareVersion
== 2006) {
140
header2006
.
setDAV
((wireGroup - 1) / 16);
141
}
142
}
143
CSCALCTHeader2007
alctHeader2007
()
const
{
return
header2007
; }
144
CSCALCTHeader2006
alctHeader2006
()
const
{
return
header2006
; }
145
146
unsigned
short
int
*
data
() {
return
theOriginalBuffer
; }
147
149
int
sizeInWords
() {
150
#ifdef LOCAL_UNPACK
151
switch
(
firmwareVersion
) {
152
#else
153
switch
(
firmwareVersion
.load()) {
154
#endif
155
case
2006:
156
return
8;
157
case
2007:
158
return
sizeInWords2007_
;
159
default
:
160
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
) <<
"SizeInWords(): ALCT firmware version is bad/not defined!"
;
161
return
0;
162
}
163
}
164
165
bool
check
()
const
{
166
#ifdef LOCAL_UNPACK
167
switch
(
firmwareVersion
) {
168
#else
169
switch
(
firmwareVersion
.load()) {
170
#endif
171
case
2006:
172
return
header2006
.
flag_0
== 0xC;
173
case
2007:
174
return
header2007
.
flag1
== 0xDB0A;
175
default
:
176
edm::LogError
(
"CSCALCTHeader|CSCRawToDigi"
) <<
"check(): ALCT firmware version is bad/not defined!"
;
177
return
false
;
178
}
179
}
180
181
void
add
(
const
std::vector<CSCALCTDigi> &digis);
182
183
boost::dynamic_bitset<>
pack
();
184
186
static
void
selfTest
(
int
firmware
);
187
188
private
:
189
CSCALCTHeader2006
header2006
;
190
CSCALCTHeader2007
header2007
;
191
std::vector<CSCALCT>
theALCTs
;
192
CSCALCTs2006
alcts2006
;
193
CSCVirtexID
virtexID
;
194
CSCConfigurationRegister
configRegister
;
195
std::vector<CSCCollisionMask>
collisionMasks
;
196
std::vector<CSCHotChannelMask>
hotChannelMasks
;
197
198
//raw data also stored in this buffer
199
//maximum header size is 116 words
200
unsigned
short
int
theOriginalBuffer
[116];
201
202
#ifdef LOCAL_UNPACK
203
static
bool
debug
;
204
static
unsigned
short
int
firmwareVersion
;
205
#else
206
static
std::atomic<bool>
debug
;
207
static
std::atomic<unsigned short int>
firmwareVersion
;
208
#endif
209
211
unsigned
short
int
sizeInWords2007_
,
bxn0
,
bxn1
;
212
};
213
214
std::ostream &
operator<<
(std::ostream &os,
const
CSCALCTHeader
&
header
);
215
216
#endif
CSCALCTHeader2006::promote1
unsigned promote1
promotion bit for 1st LCT pattern
Definition:
CSCALCTHeader2006.h:52
CSCALCTHeader::header2007
CSCALCTHeader2007 header2007
Definition:
CSCALCTHeader.h:190
CSCALCTHeader::FULL_DUMP
Definition:
CSCALCTHeader.h:40
CSCALCTHeader2007::flag1
unsigned flag1
Definition:
CSCALCTHeader2007.h:45
CSCALCTHeader::FIFO_MODE
FIFO_MODE
Definition:
CSCALCTHeader.h:40
CSCALCTHeader::check
bool check() const
Definition:
CSCALCTHeader.h:165
CSCALCTHeader::data
unsigned short int * data()
Definition:
CSCALCTHeader.h:146
CSCALCTHeader2006::cscID
unsigned cscID
chamber ID number
Definition:
CSCALCTHeader2006.h:37
MessageLogger.h
CSCALCTs2006
Definition:
CSCALCTHeader2006.h:75
CSCALCTHeader::theOriginalBuffer
unsigned short int theOriginalBuffer[116]
Definition:
CSCALCTHeader.h:200
CSCALCTHeader::header2006
CSCALCTHeader2006 header2006
Definition:
CSCALCTHeader.h:189
CSCALCTHeader::NTBins
unsigned short int NTBins() const
Definition:
CSCALCTHeader.h:42
CSCALCTHeader2006::fifoMode
unsigned fifoMode
see the FIFO_MODE enum
Definition:
CSCALCTHeader2006.h:44
CSCALCTHeader::sizeInWords2007_
unsigned short int sizeInWords2007_
size of the 2007 header in words
Definition:
CSCALCTHeader.h:211
operator<<
std::ostream & operator<<(std::ostream &os, const CSCALCTHeader &header)
Definition:
CSCALCTHeader.cc:277
CSCALCTHeader::sizeInWords
int sizeInWords()
in 16-bit words
Definition:
CSCALCTHeader.h:149
CSCALCTStatusDigi.h
CSCALCTHeader::L1Acc
unsigned short int L1Acc() const
Definition:
CSCALCTHeader.h:97
CSCALCTHeader2006::lctChipRead
unsigned lctChipRead
LCT chips read out in raw hit dump.
Definition:
CSCALCTHeader2006.h:68
CSCALCTHeader::Promote1
unsigned short int Promote1() const
Definition:
CSCALCTHeader.h:134
CSCALCTHeader2006::extTrig
unsigned extTrig
trigger source was external
Definition:
CSCALCTHeader2006.h:50
CSCALCTHeader2007::rawBins
unsigned rawBins
Definition:
CSCALCTHeader2007.h:76
CSCALCTHeader::setDebug
static void setDebug(bool value)
to access data by via status digis
Definition:
CSCALCTHeader.h:30
CSCALCTHeader::add
void add(const std::vector< CSCALCTDigi > &digis)
Definition:
CSCALCTHeader.cc:189
CSCVirtexID
Definition:
CSCALCTHeader2007.h:82
CSCALCTHeader2006::l1Acc
unsigned l1Acc
l1 accept counter
Definition:
CSCALCTHeader2006.h:35
CSCALCTHeader2006::bxnCount
unsigned bxnCount
full bunch crossing number
Definition:
CSCALCTHeader2006.h:61
CSCALCTHeader2006::activeFEBs
unsigned activeFEBs
LCT chips with ADB hits.
Definition:
CSCALCTHeader2006.h:70
CSCALCTHeader::alctHeader2006
CSCALCTHeader2006 alctHeader2006() const
Definition:
CSCALCTHeader.h:144
CSCALCTHeader2006::flag_0
unsigned flag_0
should be '01100', so it'll be a 6xxx in the ASCII dump
Definition:
CSCALCTHeader2006.h:41
CSCConfigurationRegister
Definition:
CSCALCTHeader2007.h:105
CSCALCTHeader
Definition:
CSCALCTHeader.h:21
CSCALCTHeader::BXNCount
unsigned short int BXNCount() const
Definition:
CSCALCTHeader.h:61
CSCALCTDigi.h
CSCALCTHeader::alctHeader2007
CSCALCTHeader2007 alctHeader2007() const
Definition:
CSCALCTHeader.h:143
CSCALCTHeader::BoardID
unsigned short int BoardID() const
Definition:
CSCALCTHeader.h:58
simCaloStage2Digis_cfi.firmware
firmware
Definition:
simCaloStage2Digis_cfi.py:6
CSCALCTHeader::setL1Acc
void setL1Acc(unsigned int l1a)
Definition:
CSCALCTHeader.h:114
CSCALCTHeader2006.h
CSCALCTHeader2006::setDAV
void setDAV(int afebBoard)
for packing
Definition:
CSCALCTHeader2006.h:32
CSCALCTHeader::nLCTChipRead
unsigned short int nLCTChipRead() const
for packing
Definition:
CSCALCTHeader.cc:140
CSCALCTHeader::ActiveFEBs
unsigned short int ActiveFEBs() const
Definition:
CSCALCTHeader.h:133
CSCALCTStatusDigi
Definition:
CSCALCTStatusDigi.h:15
CSCALCTHeader2006::promote2
unsigned promote2
promotion bit for 2nd LCT pattern
Definition:
CSCALCTHeader2006.h:54
CSCALCTHeader::ExtTrig
unsigned short int ExtTrig() const
Definition:
CSCALCTHeader.h:59
CSCALCTHeader::LCTChipRead
unsigned short int LCTChipRead() const
Definition:
CSCALCTHeader.h:136
CSCALCTHeader2007::bxnCount
unsigned bxnCount
Definition:
CSCALCTHeader2007.h:56
CSCALCTHeader2007
Definition:
CSCALCTHeader2007.h:33
CSCALCTHeader::theALCTs
std::vector< CSCALCT > theALCTs
Definition:
CSCALCTHeader.h:191
CSCALCTHeader::selfTest
static void selfTest(int firmware)
tests that we unpack what we packed
Definition:
CSCALCTHeader.cc:247
CSCALCTHeader::setDAVForChannel
void setDAVForChannel(int wireGroup)
Definition:
CSCALCTHeader.h:138
CSCALCTHeader::CSCID
unsigned short int CSCID() const
Definition:
CSCALCTHeader.h:60
value
Definition:
value.py:1
CSCALCTHeader::debug
static std::atomic< bool > debug
Definition:
CSCALCTHeader.h:206
CSCALCTHeader::ALCTDigis
std::vector< CSCALCTDigi > ALCTDigis() const
Definition:
CSCALCTHeader.cc:152
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
visDQMUpload.buf
buf
Definition:
visDQMUpload.py:160
CSCALCTHeader2006::nTBins
unsigned nTBins
Definition:
CSCALCTHeader2006.h:46
CSCALCTHeader2007.h
CSCALCTHeader::NO_DUMP
Definition:
CSCALCTHeader.h:40
CSCDMBHeader
Definition:
CSCDMBHeader.h:15
CSCALCTHeader::configRegister
CSCConfigurationRegister configRegister
Definition:
CSCALCTHeader.h:194
CSCALCTHeader2007::l1aCounter
unsigned l1aCounter
Definition:
CSCALCTHeader2007.h:50
CSCALCTHeader2006::l1aMatch
unsigned l1aMatch
exteran L1A arrived in L1A window
Definition:
CSCALCTHeader2006.h:48
CSCALCTHeader::setBXNCount
void setBXNCount(unsigned int bxn)
Definition:
CSCALCTHeader.h:78
CSCALCTHeader::alcts2006
CSCALCTs2006 alcts2006
Definition:
CSCALCTHeader.h:192
CSCALCTHeader::Promote2
unsigned short int Promote2() const
Definition:
CSCALCTHeader.h:135
CSCALCTHeader::setEventInformation
void setEventInformation(const CSCDMBHeader &)
Definition:
CSCALCTHeader.cc:119
CSCALCTHeader::firmwareVersion
static std::atomic< unsigned short int > firmwareVersion
Definition:
CSCALCTHeader.h:207
CSCALCTHeader::CSCALCTHeader
CSCALCTHeader(int chamberType)
Definition:
CSCALCTHeader.cc:22
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
CSCALCTHeader::virtexID
CSCVirtexID virtexID
Definition:
CSCALCTHeader.h:193
CSCALCTHeader::collisionMasks
std::vector< CSCCollisionMask > collisionMasks
Definition:
CSCALCTHeader.h:195
CSCALCTHeader::bxn1
unsigned short int bxn1
Definition:
CSCALCTHeader.h:211
CSCALCTHeader::bxn0
unsigned short int bxn0
Definition:
CSCALCTHeader.h:211
Exception.h
CSCALCTHeader2006::boardID
unsigned boardID
ALCT2000 board ID.
Definition:
CSCALCTHeader2006.h:39
CSCALCTHeader::pack
boost::dynamic_bitset pack()
Definition:
CSCALCTHeader.cc:221
RecoTauValidation_cfi.header
header
Definition:
RecoTauValidation_cfi.py:291
CSCALCTHeader::FIFOMode
unsigned short int FIFOMode() const
Definition:
CSCALCTHeader.h:41
CSCALCTHeader::LOCAL_DUMP
Definition:
CSCALCTHeader.h:40
CSCALCTHeader2006
ALCT Header consists of several modular units that are defined as structs below.
Definition:
CSCALCTHeader2006.h:11
CSCALCTHeader::hotChannelMasks
std::vector< CSCHotChannelMask > hotChannelMasks
Definition:
CSCALCTHeader.h:196
CSCALCTHeader::L1AMatch
unsigned short int L1AMatch() const
Definition:
CSCALCTHeader.h:132
CSCALCTHeader::alctFirmwareVersion
unsigned short int alctFirmwareVersion() const
Definition:
CSCALCTHeader.h:137
Generated for CMSSW Reference Manual by
1.8.16