DataFormats
HcalRecHit
interface
HFQIE10Info.h
Go to the documentation of this file.
1
#ifndef DATAFORMATS_HCALRECHIT_HFQIE10INFO_H
2
#define DATAFORMATS_HCALRECHIT_HFQIE10INFO_H
3
4
#include <limits>
5
6
#include "
DataFormats/HcalDetId/interface/HcalDetId.h
"
7
#include "
DataFormats/HcalDigi/interface/QIE10DataFrame.h
"
8
15
class
HFQIE10Info
{
16
public
:
17
typedef
HcalDetId
key_type
;
18
typedef
QIE10DataFrame::Sample::wide_type
raw_type
;
19
20
static
const
unsigned
N_RAW_MAX
= 5;
21
static
const
raw_type
INVALID_RAW
=
std::numeric_limits<raw_type>::max
();
22
23
constexpr
HFQIE10Info
()
24
:
charge_
(0.
f
),
25
energy_
(0.
f
),
26
timeRising_
(0.
f
),
27
timeFalling_
(-1.
f
),
28
raw_
{
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
},
29
nRaw_
(0),
30
soi_
(0) {}
31
32
// Argument "soi" provides the index of the sample of interest
33
// in the "rawData" array
34
constexpr
HFQIE10Info
(
const
HcalDetId
&
id
,
35
float
charge
,
36
float
energy
,
37
float
timeRising
,
38
float
timeFalling
,
39
const
raw_type
*
rawData
,
40
unsigned
nData,
41
unsigned
soi
)
42
:
id_
(
id
),
43
charge_
(
charge
),
44
energy_
(
energy
),
45
timeRising_
(
timeRising
),
46
timeFalling_
(
timeFalling
),
47
raw_
{
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
,
INVALID_RAW
},
48
nRaw_
(
std::min
(nData,
N_RAW_MAX
)),
49
soi_
(0) {
50
if
(nData) {
51
unsigned
tbegin = 0;
52
if
(
soi
>= nData) {
53
// No SOI in the data. This situation is not normal
54
// but can not be addressed in this code.
55
if
(nData >
nRaw_
)
56
tbegin = nData -
nRaw_
;
57
soi_
=
nRaw_
;
58
}
else
{
59
if
(nData >
nRaw_
) {
60
// Want to keep at least 2 presamples
61
if
(
soi
> 2
U
) {
62
tbegin =
soi
- 2
U
;
63
if
(tbegin +
nRaw_
> nData)
64
tbegin = nData -
nRaw_
;
65
}
66
}
67
soi_
=
soi
- tbegin;
68
}
69
70
raw_type
*
to
= &
raw_
[0];
71
const
raw_type
* from =
rawData
+ tbegin;
72
for
(
unsigned
i
= 0;
i
<
nRaw_
; ++
i
)
73
*
to
++ = *from++;
74
}
75
}
76
77
constexpr
HcalDetId
id
()
const
{
return
id_
; }
78
79
constexpr
float
charge
()
const
{
return
charge_
; }
80
constexpr
float
energy
()
const
{
return
energy_
; }
81
constexpr
float
timeRising
()
const
{
return
timeRising_
; }
82
constexpr
float
timeFalling
()
const
{
return
timeFalling_
; }
83
constexpr
unsigned
nRaw
()
const
{
return
nRaw_
; }
84
constexpr
unsigned
soi
()
const
{
return
soi_
; }
85
constexpr
raw_type
getRaw
(
const
unsigned
which
)
const
{
return
which
>=
nRaw_
?
INVALID_RAW
:
raw_
[
which
]; }
86
87
// Check whether the "ok" flag is set in the dataframe.
88
//
89
// If "checkAllTimeSlices" is "true" or if the raw data
90
// does not contain the "sample of interest" time slice,
91
// we are going to check all time slices. Otherwise only
92
// the "sample of interest" time slice is checked.
93
//
94
bool
isDataframeOK
(
bool
checkAllTimeSlices =
false
)
const
{
95
bool
hardwareOK =
true
;
96
if
(
soi_
>=
nRaw_
|| checkAllTimeSlices)
97
for
(
unsigned
i
= 0;
i
<
nRaw_
&& hardwareOK; ++
i
) {
98
const
QIE10DataFrame::Sample
s
(
raw_
[
i
]);
99
hardwareOK =
s
.ok();
100
}
101
else
{
102
const
QIE10DataFrame::Sample
s
(
raw_
[
soi_
]);
103
hardwareOK =
s
.ok();
104
}
105
return
hardwareOK;
106
}
107
108
private
:
109
HcalDetId
id_
;
110
111
float
charge_
;
112
float
energy_
;
113
float
timeRising_
;
114
float
timeFalling_
;
115
raw_type
raw_
[
N_RAW_MAX
];
116
uint8_t
nRaw_
;
117
uint8_t
soi_
;
118
};
119
120
#endif // DATAFORMATS_HCALRECHIT_HFQIE10INFO_H
HFQIE10Info::charge_
float charge_
Definition:
HFQIE10Info.h:111
HFQIE10Info::energy_
float energy_
Definition:
HFQIE10Info.h:112
mps_fire.i
i
Definition:
mps_fire.py:355
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
HFQIE10Info::INVALID_RAW
static const raw_type INVALID_RAW
Definition:
HFQIE10Info.h:21
HFQIE10Info
Definition:
HFQIE10Info.h:15
min
T min(T a, T b)
Definition:
MathUtil.h:58
HFQIE10Info::energy
constexpr float energy() const
Definition:
HFQIE10Info.h:80
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition:
l1tstage2_dqm_sourceclient-live_cfg.py:162
to
HFQIE10Info::charge
constexpr float charge() const
Definition:
HFQIE10Info.h:79
HFQIE10Info::id_
HcalDetId id_
Definition:
HFQIE10Info.h:109
HFQIE10Info::timeFalling_
float timeFalling_
Definition:
HFQIE10Info.h:114
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
HFQIE10Info::timeRising
constexpr float timeRising() const
Definition:
HFQIE10Info.h:81
QIE10DataFrame::Sample::wide_type
uint32_t wide_type
Definition:
QIE10DataFrame.h:22
HFQIE10Info::timeRising_
float timeRising_
Definition:
HFQIE10Info.h:113
HFQIE10Info::getRaw
constexpr raw_type getRaw(const unsigned which) const
Definition:
HFQIE10Info.h:85
HFQIE10Info::nRaw
constexpr unsigned nRaw() const
Definition:
HFQIE10Info.h:83
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
HFQIE10Info::id
constexpr HcalDetId id() const
Definition:
HFQIE10Info.h:77
HFQIE10Info::HFQIE10Info
constexpr HFQIE10Info(const HcalDetId &id, float charge, float energy, float timeRising, float timeFalling, const raw_type *rawData, unsigned nData, unsigned soi)
Definition:
HFQIE10Info.h:34
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:169
HcalDetId.h
QIE10DataFrame.h
HcalDetId
Definition:
HcalDetId.h:12
HFQIE10Info::soi_
uint8_t soi_
Definition:
HFQIE10Info.h:117
HFQIE10Info::timeFalling
constexpr float timeFalling() const
Definition:
HFQIE10Info.h:82
HFQIE10Info::N_RAW_MAX
static const unsigned N_RAW_MAX
Definition:
HFQIE10Info.h:20
HFQIE10Info::raw_type
QIE10DataFrame::Sample::wide_type raw_type
Definition:
HFQIE10Info.h:18
HFQIE10Info::raw_
raw_type raw_[N_RAW_MAX]
Definition:
HFQIE10Info.h:115
HFQIE10Info::nRaw_
uint8_t nRaw_
Definition:
HFQIE10Info.h:116
QIE10DataFrame::Sample
Definition:
QIE10DataFrame.h:20
HFQIE10Info::isDataframeOK
bool isDataframeOK(bool checkAllTimeSlices=false) const
Definition:
HFQIE10Info.h:94
HFQIE10Info::key_type
HcalDetId key_type
Definition:
HFQIE10Info.h:17
HFQIE10Info::HFQIE10Info
constexpr HFQIE10Info()
Definition:
HFQIE10Info.h:23
eostools.which
def which(cmd)
Definition:
eostools.py:336
HFQIE10Info::soi
constexpr unsigned soi() const
Definition:
HFQIE10Info.h:84
Generated for CMSSW Reference Manual by
1.8.16