CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalCalibDataFrame.cc
Go to the documentation of this file.
2 
3 HcalCalibDataFrame::HcalCalibDataFrame() : id_(0), size_(0), hcalPresamples_(0) {}
4 
5 HcalCalibDataFrame::HcalCalibDataFrame(const HcalCalibDetId& id) : id_(id), size_(0), hcalPresamples_(0) {
6  // TODO : test id for HcalForward
7 }
8 
10  if (size > MAXSAMPLES)
11  size_ = MAXSAMPLES;
12  else if (size <= 0)
13  size_ = 0;
14  else
15  size_ = size;
16 }
19 
21  int capid = -1;
22  bool ok = true;
23  for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) {
24  if (data_[i + firstSample].er() || !data_[i + firstSample].dv())
25  ok = false;
26  if (i == 0)
27  capid = data_[i + firstSample].capid();
28  if (capid != data_[i + firstSample].capid())
29  ok = false;
30  capid = (capid + 1) % 4;
31  }
32  return ok;
33 }
34 
35 void HcalCalibDataFrame::setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask) {
36  hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset
37  if (markAndPass)
38  hcalPresamples_ |= 0x10;
39  if (unsuppressed)
40  hcalPresamples_ |= 0x20;
41  hcalPresamples_ |= (crossingMask & 0x3FF) << 12;
42 }
43 
45  int val = (hcalPresamples_ & 0xF00) >> 8;
46  return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7));
47 }
48 
50  hcalPresamples_ &= 0x7FFFF0FF;
51  if (offset >= 7)
52  hcalPresamples_ |= 0xF00;
53  else if (offset >= 0)
54  hcalPresamples_ |= (0x800) | (offset << 8);
55  else if (offset >= -7)
56  hcalPresamples_ |= ((-offset) << 8);
57  else
58  hcalPresamples_ |= 0x700;
59 }
60 
61 std::ostream& operator<<(std::ostream& s, const HcalCalibDataFrame& digi) {
62  s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples ";
63  if (digi.zsUnsuppressed())
64  s << " zsUS ";
65  if (digi.zsMarkAndPass())
66  s << " zsM&P ";
67  if (digi.fiberIdleOffset() != 0) {
68  if (digi.fiberIdleOffset() == -1000)
69  s << " nofiberOffset";
70  else
71  s << " fiberOffset=" << digi.fiberIdleOffset();
72  }
73  s << std::endl;
74  for (int i = 0; i < digi.size(); i++)
75  s << " " << digi.sample(i) << std::endl;
76  return s;
77 }
void setPresamples(int ps)
int fiberIdleOffset() const
offset of bunch number for this channel relative to nominal set in the unpacker (range is +7-&gt;-7...
void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask=0)
bool zsUnsuppressed() const
was ZS unsuppressed?
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
bool validate(int firstSample=0, int nSamples=100) const
validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is a...
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
HcalQIESample data_[MAXSAMPLES]
int size() const
total number of samples in the digi
void setSize(int size)
const HcalQIESample & sample(int i) const
access a sample
const HcalCalibDetId & id() const
void setFiberIdleOffset(int offset)
constexpr size_t nSamples
void setReadoutIds(const HcalElectronicsId &eid)
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
static const int MAXSAMPLES
HcalElectronicsId electronicsId_
bool zsMarkAndPass() const
was ZS MarkAndPass?
Readout chain identification for Hcal.
tuple size
Write out results.