CMS 3D CMS Logo

HFQIE10Info.cc
Go to the documentation of this file.
1 #include <algorithm>
3 
4 const unsigned HFQIE10Info::N_RAW_MAX;
6 
7 
9  : charge_(0.f),
10  energy_(0.f),
11  timeRising_(0.f),
12  timeFalling_(-1.f),
13  raw_{INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW},
14  nRaw_(0),
15  soi_(0)
16 {
17 }
18 
20  const float i_charge, const float i_energy,
21  const float i_timeRising, const float i_timeFalling,
22  const raw_type* rawData, const unsigned nData,
23  const unsigned i_soi)
24  : id_(id),
25  charge_(i_charge),
26  energy_(i_energy),
27  timeRising_(i_timeRising),
28  timeFalling_(i_timeFalling),
30  nRaw_(std::min(nData, N_RAW_MAX)),
31  soi_(0)
32 {
33  if (nData)
34  {
35  unsigned tbegin = 0;
36  if (i_soi >= nData)
37  {
38  // No SOI in the data. This situation is not normal
39  // but can not be addressed in this code.
40  if (nData > nRaw_)
41  tbegin = nData - nRaw_;
42  soi_ = nRaw_;
43  }
44  else
45  {
46  if (nData > nRaw_)
47  {
48  // Want to keep at least 2 presamples
49  if (i_soi > 2U)
50  {
51  tbegin = i_soi - 2U;
52  if (tbegin + nRaw_ > nData)
53  tbegin = nData - nRaw_;
54  }
55  }
56  soi_ = i_soi - tbegin;
57  }
58 
59  raw_type* to = &raw_[0];
60  const raw_type* from = rawData + tbegin;
61  for (unsigned i=0; i<nRaw_; ++i)
62  *to++ = *from++;
63  }
64 }
65 
66 bool HFQIE10Info::isDataframeOK(const bool checkAllTimeSlices) const
67 {
68  bool hardwareOK = true;
69  if (soi_ >= nRaw_ || checkAllTimeSlices)
70  for (unsigned i=0; i<nRaw_ && hardwareOK; ++i)
71  {
73  hardwareOK = s.ok();
74  }
75  else
76  {
78  hardwareOK = s.ok();
79  }
80  return hardwareOK;
81 }
float timeFalling_
Definition: HFQIE10Info.h:58
bool isDataframeOK(bool checkAllTimeSlices=false) const
Definition: HFQIE10Info.cc:66
HcalDetId id_
Definition: HFQIE10Info.h:53
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
QIE10DataFrame::Sample::wide_type raw_type
Definition: HFQIE10Info.h:19
float timeRising_
Definition: HFQIE10Info.h:57
raw_type raw_[N_RAW_MAX]
Definition: HFQIE10Info.h:59
uint8_t soi_
Definition: HFQIE10Info.h:61
static const unsigned N_RAW_MAX
Definition: HFQIE10Info.h:21
float charge_
Definition: HFQIE10Info.h:55
static const raw_type INVALID_RAW
Definition: HFQIE10Info.h:22
uint8_t nRaw_
Definition: HFQIE10Info.h:60
float energy_
Definition: HFQIE10Info.h:56