CMS 3D CMS Logo

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