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