CMS 3D CMS Logo

ZDCDataFrame.cc
Go to the documentation of this file.
2 
3 ZDCDataFrame::ZDCDataFrame() : id_(0), size_(0), hcalPresamples_(0) {}
4 
5 ZDCDataFrame::ZDCDataFrame(const HcalZDCDetId& id) : id_(id), size_(0), hcalPresamples_(0) {
6  // TODO : test id for ZDC
7 }
8 
10  if (size > MAXSAMPLES)
11  size_ = MAXSAMPLES;
12  else if (size <= 0)
13  size_ = 0;
14  else
15  size_ = size;
16 }
17 void ZDCDataFrame::setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; }
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 ZDCDataFrame::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 ZDCDataFrame& 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 }
mps_fire.i
i
Definition: mps_fire.py:428
ZDCDataFrame::electronicsId_
HcalElectronicsId electronicsId_
Definition: ZDCDataFrame.h:58
ZDCDataFrame::hcalPresamples_
int hcalPresamples_
Definition: ZDCDataFrame.h:60
ZDCDataFrame::MAXSAMPLES
static const int MAXSAMPLES
Definition: ZDCDataFrame.h:54
ZDCDataFrame::setSize
void setSize(int size)
Definition: ZDCDataFrame.cc:9
ZDCDataFrame::setZSInfo
void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask=0)
Definition: ZDCDataFrame.cc:35
operator<<
std::ostream & operator<<(std::ostream &s, const ZDCDataFrame &digi)
Definition: ZDCDataFrame.cc:61
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
ZDCDataFrame::data_
HcalQIESample data_[MAXSAMPLES]
Definition: ZDCDataFrame.h:61
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
HcalZDCDetId
Definition: HcalZDCDetId.h:16
alignCSCRings.s
s
Definition: alignCSCRings.py:92
ZDCDataFrame::id
const HcalZDCDetId & id() const
Definition: ZDCDataFrame.h:22
ZDCDataFrame::setReadoutIds
void setReadoutIds(const HcalElectronicsId &eid)
Definition: ZDCDataFrame.cc:18
ZDCDataFrame::size
int size() const
total number of samples in the digi
Definition: ZDCDataFrame.h:26
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
DigiNZS_cff.markAndPass
markAndPass
Definition: DigiNZS_cff.py:6
ZDCDataFrame
Definition: ZDCDataFrame.h:15
ZDCDataFrame::sample
const HcalQIESample & sample(int i) const
access a sample
Definition: ZDCDataFrame.h:39
ZDCDataFrame::validate
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...
Definition: ZDCDataFrame.cc:20
castor_dqm_sourceclient-live_cfg.firstSample
firstSample
Definition: castor_dqm_sourceclient-live_cfg.py:64
ZDCDataFrame::setFiberIdleOffset
void setFiberIdleOffset(int offset)
Definition: ZDCDataFrame.cc:49
ZDCDataFrame::presamples
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware)
Definition: ZDCDataFrame.h:28
ZDCDataFrame.h
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalQIESample::capid
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
ZDCDataFrame::zsMarkAndPass
bool zsMarkAndPass() const
was ZS MarkAndPass?
Definition: ZDCDataFrame.h:30
ZDCDataFrame::fiberIdleOffset
int fiberIdleOffset() const
offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7....
Definition: ZDCDataFrame.cc:44
ZDCDataFrame::ZDCDataFrame
ZDCDataFrame()
Definition: ZDCDataFrame.cc:3
heppy_batch.val
val
Definition: heppy_batch.py:351
ZDCDataFrame::zsUnsuppressed
bool zsUnsuppressed() const
was ZS unsuppressed?
Definition: ZDCDataFrame.h:32
ZDCDataFrame::setPresamples
void setPresamples(int ps)
Definition: ZDCDataFrame.cc:17
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ZDCDataFrame::size_
int size_
Definition: ZDCDataFrame.h:59
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443