Main Page
Namespaces
Classes
Package Documentation
DataFormats
HGCDigi
interface
HGCSample.h
Go to the documentation of this file.
1
#ifndef DIGIHGCAL_HGCSAMPLE_H
2
#define DIGIHGCAL_HGCSAMPLE_H
3
4
#include <iostream>
5
#include <ostream>
6
#include <boost/cstdint.hpp>
7
13
class
HGCSample
{
14
15
public
:
16
17
enum
HGCSampleMasks
{
kThreshMask
= 0x1,
kModeMask
= 0x1,
kToAMask
= 0x3ff,
kDataMask
= 0xfff};
18
enum
HGCSampleShifts
{
kThreshShift
= 31,
kModeShift
= 30,
kToAShift
= 13,
kDataShift
= 0};
19
23
HGCSample
() :
value_
(0) { }
24
HGCSample
(uint32_t
value
) :
value_
(value) { }
25
HGCSample
(
const
HGCSample
&
o
) :
value_
(o.
value_
) { }
26
30
void
setThreshold
(
bool
thr) {
setWord
(thr,
kThreshMask
,
kThreshShift
); }
31
void
setMode
(
bool
mode
) {
setWord
(mode,
kModeMask
,
kModeShift
); }
32
void
setToA
(uint16_t
toa
) {
setWord
(toa,
kToAMask
,
kToAShift
); }
33
void
setData
(uint16_t
data
) {
setWord
(data,
kDataMask
,
kDataShift
); }
34
void
set
(
bool
thr,
bool
mode
,uint16_t
toa
, uint16_t
data
)
35
{
36
toa = ( toa >
kToAMask
?
kToAMask
:
toa
);
37
data
= (
data
>
kDataMask
?
kDataMask
:
data
);
38
39
value_
= ( ( (uint32_t)thr &
kThreshMask
) <<
kThreshShift
|
40
( (uint32_t)mode &
kModeMask
) <<
kModeShift
|
41
( (uint32_t)toa &
kToAMask
) <<
kToAShift
|
42
( (uint32_t)
data
&
kDataMask
) <<
kDataShift
);
43
}
44
void
print
(std::ostream &
out
=
std::cout
)
45
{
46
out
<<
"THR: "
<<
threshold
()
47
<<
" Mode: "
<<
mode
()
48
<<
" ToA: "
<<
toa
()
49
<<
" Data: "
<<
data
()
50
<<
" Raw=0x"
<< std::hex <<
raw
() <<
std::dec
<< std::endl;
51
}
52
56
uint32_t
raw
()
const
{
return
value_
; }
57
bool
threshold
()
const
{
return
( (
value_
>>
kThreshShift
) &
kThreshMask
); }
58
bool
mode
()
const
{
return
( (
value_
>>
kModeShift
) &
kModeMask
); }
59
uint32_t
toa
()
const
{
return
( (
value_
>>
kToAShift
) &
kToAMask
); }
60
uint32_t
data
()
const
{
return
( (
value_
>>
kDataShift
) &
kDataMask
); }
61
uint32_t
operator()
() {
return
value_
; }
62
63
private
:
64
68
void
setWord
(uint32_t word, uint32_t
mask
, uint32_t
pos
)
69
{
70
if
( word > mask ) word =
mask
;
// deal with saturation
71
//clear required bits
72
const
uint32_t masked_word = (word &
mask
) << pos;
73
value_
&= ~(masked_word);
74
//now set the new value
75
value_
|= (masked_word);
76
}
77
78
// a 32-bit word
79
uint32_t
value_
;
80
};
81
82
83
#endif
HGCSample::data
uint32_t data() const
Definition:
HGCSample.h:60
HGCSample::mode
bool mode() const
Definition:
HGCSample.h:58
HGCSample::HGCSample
HGCSample(const HGCSample &o)
Definition:
HGCSample.h:25
HGCSample::print
void print(std::ostream &out=std::cout)
Definition:
HGCSample.h:44
HGCSample::value_
uint32_t value_
Definition:
HGCSample.h:79
HGCSample::setMode
void setMode(bool mode)
Definition:
HGCSample.h:31
HGCSample
wrapper for a data word
Definition:
HGCSample.h:13
HGCSample::HGCSample
HGCSample()
CTOR.
Definition:
HGCSample.h:23
HGCSample::kDataMask
Definition:
HGCSample.h:17
HGCSample::HGCSample
HGCSample(uint32_t value)
Definition:
HGCSample.h:24
HGCSample::setThreshold
void setThreshold(bool thr)
setters
Definition:
HGCSample.h:30
HGCSample::kThreshShift
Definition:
HGCSample.h:18
HGCSample::kThreshMask
Definition:
HGCSample.h:17
HGCSample::kToAMask
Definition:
HGCSample.h:17
HGCSample::threshold
bool threshold() const
Definition:
HGCSample.h:57
HGCSample::HGCSampleShifts
HGCSampleShifts
Definition:
HGCSample.h:18
HGCSample::HGCSampleMasks
HGCSampleMasks
Definition:
HGCSample.h:17
HGCSample::setToA
void setToA(uint16_t toa)
Definition:
HGCSample.h:32
RecoTauDiscriminantConfiguration.mask
mask
Definition:
RecoTauDiscriminantConfiguration.py:72
HGCSample::setWord
void setWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition:
HGCSample.h:68
value
Definition:
value.py:1
HGCSample::raw
uint32_t raw() const
getters
Definition:
HGCSample.h:56
pos
Definition:
PixelAliasList.h:14
HGCSample::kModeShift
Definition:
HGCSample.h:18
HGCSample::kToAShift
Definition:
HGCSample.h:18
connectstrParser.o
o
Definition:
connectstrParser.py:70
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
HGCSample::kDataShift
Definition:
HGCSample.h:18
HGCSample::toa
uint32_t toa() const
Definition:
HGCSample.h:59
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:141
gather_cfg.cout
cout
Definition:
gather_cfg.py:145
HGCSample::kModeMask
Definition:
HGCSample.h:17
HGCSample::operator()
uint32_t operator()()
Definition:
HGCSample.h:61
HGCSample::setData
void setData(uint16_t data)
Definition:
HGCSample.h:33
Generated for CMSSW Reference Manual by
1.8.11