CMS 3D CMS Logo

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