CMS 3D CMS Logo

CastorDataFrame.cc
Go to the documentation of this file.
2 
3 CastorDataFrame::CastorDataFrame() : id_(0), size_(0), hcalPresamples_(0) {}
4 
5 CastorDataFrame::CastorDataFrame(const HcalCastorDetId& id) : id_(id), size_(0), hcalPresamples_(0) {
6  // TODO : test id for CASTOR
7 }
8 
10  if (size > MAXSAMPLES)
11  size_ = MAXSAMPLES;
12  else if (size <= 0)
13  size_ = 0;
14  else
15  size_ = size;
16 }
17 
18 void CastorDataFrame::setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; }
19 //void CastorDataFrame::setReadoutIds(const HcalElectronicsId& eid) {
20 // electronicsId_=eid;
21 //}
22 
24  int capid = -1;
25  bool ok = true;
26  for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) {
27  if (data_[i + firstSample].er() || !data_[i + firstSample].dv())
28  ok = false;
29  if (i == 0)
30  capid = data_[i + firstSample].capid();
31  if (capid != data_[i + firstSample].capid())
32  ok = false;
33  capid = (capid + 1) % 4;
34  }
35  return ok;
36 }
37 
38 void CastorDataFrame::setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask) {
39  hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset
40  if (markAndPass)
41  hcalPresamples_ |= 0x10;
42  if (unsuppressed)
43  hcalPresamples_ |= 0x20;
44  hcalPresamples_ |= (crossingMask & 0x3FF) << 12;
45 }
46 
48  int val = (hcalPresamples_ & 0xF00) >> 8;
49  return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7));
50 }
51 
53  hcalPresamples_ &= 0x7FFFF0FF;
54  if (offset >= 7)
55  hcalPresamples_ |= 0xF00;
56  else if (offset >= 0)
57  hcalPresamples_ |= (0x800) | (offset << 8);
58  else if (offset >= -7)
59  hcalPresamples_ |= ((-offset) << 8);
60  else
61  hcalPresamples_ |= 0x700;
62 }
63 std::ostream& operator<<(std::ostream& s, const CastorDataFrame& digi) {
64  s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples " << std::endl;
65  if (digi.fiberIdleOffset() != 0) {
66  if (digi.fiberIdleOffset() == -1000)
67  s << " nofiberOffset";
68  else
69  s << " fiberOffset=" << digi.fiberIdleOffset();
70  }
71  for (int i = 0; i < digi.size(); i++)
72  s << " " << digi.sample(i) << std::endl;
73  return s;
74 }
mps_fire.i
i
Definition: mps_fire.py:428
CastorDataFrame::data_
HcalQIESample data_[MAXSAMPLES]
Definition: CastorDataFrame.h:61
CastorDataFrame.h
CastorDataFrame::id
const HcalCastorDetId & id() const
Definition: CastorDataFrame.h:22
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
CastorDataFrame::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: CastorDataFrame.cc:23
CastorDataFrame::setZSInfo
void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask=0)
Definition: CastorDataFrame.cc:38
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CastorDataFrame::size_
int size_
Definition: CastorDataFrame.h:59
DigiNZS_cff.markAndPass
markAndPass
Definition: DigiNZS_cff.py:6
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorDataFrame::sample
const HcalQIESample & sample(int i) const
access a sample
Definition: CastorDataFrame.h:39
CastorDataFrame
Definition: CastorDataFrame.h:15
CastorDataFrame::size
int size() const
total number of samples in the digi
Definition: CastorDataFrame.h:26
CastorDataFrame::fiberIdleOffset
int fiberIdleOffset() const
offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7....
Definition: CastorDataFrame.cc:47
castor_dqm_sourceclient-live_cfg.firstSample
firstSample
Definition: castor_dqm_sourceclient-live_cfg.py:64
CastorDataFrame::presamples
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware)
Definition: CastorDataFrame.h:28
CastorDataFrame::setSize
void setSize(int size)
Definition: CastorDataFrame.cc:9
HcalQIESample::capid
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
operator<<
std::ostream & operator<<(std::ostream &s, const CastorDataFrame &digi)
Definition: CastorDataFrame.cc:63
CastorDataFrame::hcalPresamples_
int hcalPresamples_
Definition: CastorDataFrame.h:60
heppy_batch.val
val
Definition: heppy_batch.py:351
CastorDataFrame::setPresamples
void setPresamples(int ps)
Definition: CastorDataFrame.cc:18
CastorDataFrame::CastorDataFrame
CastorDataFrame()
Definition: CastorDataFrame.cc:3
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CastorDataFrame::setFiberIdleOffset
void setFiberIdleOffset(int offset)
Definition: CastorDataFrame.cc:52
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CastorDataFrame::MAXSAMPLES
static const int MAXSAMPLES
Definition: CastorDataFrame.h:54
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443