src
DataFormats
FTLDigi
interface
FTLSample.h
Go to the documentation of this file.
1
#ifndef DIGIFTL_FTLSAMPLE_H
2
#define DIGIFTL_FTLSAMPLE_H
3
4
#include <iostream>
5
#include <ostream>
6
#include <cstdint>
7
13
class
FTLSample
{
14
public
:
15
enum
FTLSampleMasks
{
kThreshMask
= 0x1,
kModeMask
= 0x1,
kToAMask
= 0xfff,
kDataMask
= 0xfff };
16
enum
FTLSampleShifts
{
kThreshShift
= 31,
kModeShift
= 30,
kToAShift
= 13,
kDataShift
= 0 };
17
21
FTLSample
() :
value_
(0) {}
22
FTLSample
(uint32_t
value
) :
value_
(
value
) {}
23
FTLSample
(
const
FTLSample
&
o
) :
value_
(
o
.
value_
) {}
24
28
void
setThreshold
(
bool
thr) {
setWord
(thr,
kThreshMask
,
kThreshShift
); }
29
void
setMode
(
bool
mode
) {
setWord
(
mode
,
kModeMask
,
kModeShift
); }
30
void
setToA
(uint16_t
toa
) {
setWord
(
toa
,
kToAMask
,
kToAShift
); }
31
void
setData
(uint16_t
data
) {
setWord
(
data
,
kDataMask
,
kDataShift
); }
32
void
set
(
bool
thr,
bool
mode
, uint16_t
toa
, uint16_t
data
) {
33
value_
= (((uint32_t)thr &
kThreshMask
) <<
kThreshShift
| ((uint32_t)
mode
&
kModeMask
) <<
kModeShift
|
34
((uint32_t)
toa
&
kToAMask
) <<
kToAShift
| ((uint32_t)
data
&
kDataMask
) <<
kDataShift
);
35
}
36
void
print
(std::ostream&
out
=
std::cout
) {
37
out
<<
"THR: "
<<
threshold
() <<
" Mode: "
<<
mode
() <<
" ToA: "
<<
toa
() <<
" Data: "
<<
data
() <<
" Raw=0x"
38
<< std::hex <<
raw
() <<
std::dec
<< std::endl;
39
}
40
44
uint32_t
raw
()
const
{
return
value_
; }
45
bool
threshold
()
const
{
return
((
value_
>>
kThreshShift
) &
kThreshMask
); }
46
bool
mode
()
const
{
return
((
value_
>>
kModeShift
) &
kModeMask
); }
47
uint32_t
toa
()
const
{
return
((
value_
>>
kToAShift
) &
kToAMask
); }
48
uint32_t
data
()
const
{
return
((
value_
>>
kDataShift
) &
kDataMask
); }
49
uint32_t
operator()
() {
return
value_
; }
50
51
private
:
55
void
setWord
(uint32_t
word
, uint32_t
mask
, uint32_t
pos
) {
56
//clear required bits
57
const
uint32_t masked_word = (
word
&
mask
) <<
pos
;
58
value_
&= ~(masked_word);
59
//now set the new value
60
value_
|= (masked_word);
61
}
62
63
// a 32-bit word
64
uint32_t
value_
;
65
};
66
67
#endif
FTLSample::kDataMask
Definition:
FTLSample.h:15
FTLSample::data
uint32_t data() const
Definition:
FTLSample.h:48
FTLSample::FTLSample
FTLSample(uint32_t value)
Definition:
FTLSample.h:22
FTLSample::FTLSampleMasks
FTLSampleMasks
Definition:
FTLSample.h:15
FTLSample::setMode
void setMode(bool mode)
Definition:
FTLSample.h:29
FTLSample::value_
uint32_t value_
Definition:
FTLSample.h:64
FTLSample::kThreshShift
Definition:
FTLSample.h:16
FTLSample::operator()
uint32_t operator()()
Definition:
FTLSample.h:49
FTLSample::FTLSampleShifts
FTLSampleShifts
Definition:
FTLSample.h:16
FTLSample::FTLSample
FTLSample()
CTOR.
Definition:
FTLSample.h:21
FTLSample::setToA
void setToA(uint16_t toa)
Definition:
FTLSample.h:30
FTLSample
wrapper for a data word
Definition:
FTLSample.h:13
FTLSample::kModeShift
Definition:
FTLSample.h:16
gpuClustering::pixelStatus::mask
constexpr uint32_t mask
Definition:
gpuClustering.h:26
word
uint64_t word
Definition:
CTPPSTotemDataFormatter.cc:29
FTLSample::kToAMask
Definition:
FTLSample.h:15
EcalTangentSkim_cfg.o
o
Definition:
EcalTangentSkim_cfg.py:42
FTLSample::setData
void setData(uint16_t data)
Definition:
FTLSample.h:31
FTLSample::kThreshMask
Definition:
FTLSample.h:15
FTLSample::kModeMask
Definition:
FTLSample.h:15
FTLSample::setThreshold
void setThreshold(bool thr)
setters
Definition:
FTLSample.h:28
FTLSample::FTLSample
FTLSample(const FTLSample &o)
Definition:
FTLSample.h:23
value
Definition:
value.py:1
FTLSample::print
void print(std::ostream &out=std::cout)
Definition:
FTLSample.h:36
FTLSample::toa
uint32_t toa() const
Definition:
FTLSample.h:47
pos
Definition:
PixelCalibBase.h:13
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
FTLSample::kToAShift
Definition:
FTLSample.h:16
FTLSample::threshold
bool threshold() const
Definition:
FTLSample.h:45
FTLSample::mode
bool mode() const
Definition:
FTLSample.h:46
FTLSample::raw
uint32_t raw() const
getters
Definition:
FTLSample.h:44
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:142
FTLSample::kDataShift
Definition:
FTLSample.h:16
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
FTLSample::setWord
void setWord(uint32_t word, uint32_t mask, uint32_t pos)
wrapper to reset words at a given position
Definition:
FTLSample.h:55
Generated for CMSSW Reference Manual by
1.8.14