CMS 3D CMS Logo

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