Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
EventFilter
CSCRawToDigi
src
CSCDDUHeader.cc
Go to the documentation of this file.
1
#include "
EventFilter/CSCRawToDigi/interface/CSCDDUHeader.h
"
2
#include <string.h>
// for bzero
3
#include <iostream>
4
5
CSCDDUHeader::CSCDDUHeader
()
6
{
7
bzero(
this
,
sizeInWords
()*2);
8
init
();
9
}
10
11
12
CSCDDUHeader::CSCDDUHeader
(
unsigned
bx,
unsigned
l1num,
unsigned
sourceId)
13
: source_id_(sourceId), bxnum_(bx), lvl1num_(l1num)
14
{
15
bzero(
this
,
sizeInWords
()*2);
16
source_id_
= sourceId;
17
bxnum_
= bx;
18
lvl1num_
= l1num;
19
init
();
20
}
21
22
23
void
CSCDDUHeader::init
()
24
{
25
bit64_
= 5;
26
header2_2_
= 0x0001;
27
header2_1_
=
header2_3_
= 0x8000;
28
}
29
30
31
void
CSCDDUHeader::setDMBDAV
(
int
dduInput)
32
{
33
// Set appropriate bit in dmb_dav_
34
35
dmb_dav_
|= (1 << dduInput);
// dduInput is 0-14
36
37
// Count bits set in dmb_dav_... for the trick used see
38
// http://en.wikipedia.org/wiki/Hamming_weight or http://graphics.stanford.edu/~seander/bithacks.html
39
40
ncsc_
= 0;
41
unsigned
short
dmbdav =
dmb_dav_
;
42
for
( ; dmbdav; ++
ncsc_
)
43
{
44
dmbdav &= dmbdav - 1;
45
}
46
}
47
48
bool
CSCDDUHeader::check
()
const
49
{
50
//std::cout <<"SANDRIK"<<std::hex <<header2_1_<<" "<<header2_2_ <<" "<<header2_3_<<std::endl;
51
return
bit64_
== 5 &&
header2_1_
== 0x8000 &&
header2_3_
== 0x8000
52
&&
header2_2_
== 0x0001;
53
}
54
CSCDDUHeader::source_id_
unsigned source_id_
Definition:
CSCDDUHeader.h:44
CSCDDUHeader::dmb_dav_
unsigned dmb_dav_
Definition:
CSCDDUHeader.h:62
CSCDDUHeader::lvl1num_
unsigned lvl1num_
Definition:
CSCDDUHeader.h:47
CSCDDUHeader::check
bool check() const
Definition:
CSCDDUHeader.cc:48
CSCDDUHeader.h
CSCDDUHeader::setDMBDAV
void setDMBDAV(int dduInput)
Definition:
CSCDDUHeader.cc:31
CSCDDUHeader::CSCDDUHeader
CSCDDUHeader()
Definition:
CSCDDUHeader.cc:5
CSCDDUHeader::header2_3_
unsigned header2_3_
Definition:
CSCDDUHeader.h:56
CSCDDUHeader::header2_2_
unsigned header2_2_
Definition:
CSCDDUHeader.h:55
CSCDDUHeader::ncsc_
unsigned ncsc_
Definition:
CSCDDUHeader.h:59
CSCDDUHeader::header2_1_
unsigned header2_1_
Definition:
CSCDDUHeader.h:54
CSCDDUHeader::bit64_
unsigned bit64_
should always be 5
Definition:
CSCDDUHeader.h:50
CSCDDUHeader::init
void init()
initializes constants
Definition:
CSCDDUHeader.cc:23
CSCDDUHeader::sizeInWords
static unsigned sizeInWords()
Definition:
CSCDDUHeader.h:31
CSCDDUHeader::bxnum_
unsigned bxnum_
Definition:
CSCDDUHeader.h:45
Generated for CMSSW Reference Manual by
1.8.5