test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalUpgradeDataFrame.cc
Go to the documentation of this file.
2 
4  electronicsId_(0),
5  capId_(0),
6  size_(0),
7  presamples_(0)
8 {
9 }
10 
12  electronicsId_(0),
13  capId_(0),
14  size_(0),
15  presamples_(0)
16 {
17 }
18 
19 HcalUpgradeDataFrame::HcalUpgradeDataFrame(HcalDetId id, int capId, int samples, int presamples)
20  : id_(id),
21  electronicsId_(0),
22  capId_(capId)
23 {
24  setSize(samples) ;
25  setPresamples(presamples) ;
26 }
27 
29  if (size>MAXSAMPLES) size_=MAXSAMPLES;
30  else if (size<=0) size_=0;
31  else size_=size;
32 }
33 
35  if (presamples>MAXSAMPLES) presamples_|=MAXSAMPLES&0xF;
36  else if (presamples<=0) presamples_=0;
37  else presamples_|=presamples&0xF;
38 }
39 
41  electronicsId_=eid;
42 }
43 
45  return HcalUpgradeQIESample(adc(i), (capId_+i)%4, 0, 0);
46 }
47 
49  uint16_t adc,
50  uint16_t tdc,
51  bool dv) {
52  if ( iSample < MAXSAMPLES && iSample>=0) {
53  adc_[iSample] = adc&0xFF ;
54  tdc_[iSample] = tdc&0xFFFF ;
55  dv_[iSample] = dv ;
56  }
57 }
58 
59 void HcalUpgradeDataFrame::setZSInfo(bool unsuppressed, bool markAndPass,
60  uint32_t crossingMask) {
61  presamples_&=0x7FC00F0F; // preserve actual presamples and fiber idle offset
62  if (markAndPass) presamples_|=0x10;
63  if (unsuppressed) presamples_|=0x20;
64  presamples_|=(crossingMask&0x3FF)<<12;
65 }
66 
67 
68 
69 std::ostream& operator<<(std::ostream& s, const HcalUpgradeDataFrame& digi) {
70  s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples ";
71  if (digi.zsUnsuppressed()) s << " zsUS";
72  if (digi.zsMarkAndPass()) s << " zsM&P";
73  s << std::endl;
74  for (int i=0; i<digi.size(); i++) {
75  if ( i < digi.presamples() ) s << " (PRE) " ;
76  else s << " " ;
77  s << int(digi.capId(i)) << " (capId) ";
78  s << int(digi.adc(i)) << " (adc) " ;
79  s << int(digi.tdc(i)) << " (tdc) " ;
80  if ( digi.valid(i) ) s << " (DV) " ;
81  s << std::endl ;
82  }
83  return s;
84 }
85 
86 
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int MAXSAMPLES
void setPresamples(int presamples)
int capId(int iSample=0) const
bool valid(int iSample=0) const
uint16_t tdc(int iSample=0) const
void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask=0)
uint16_t tdc_[MAXSAMPLES]
void setSample(int iSample, uint16_t adc, uint16_t tdc, bool dv)
uint16_t adc_[MAXSAMPLES]
void setReadoutIds(const HcalElectronicsId &eid)
const HcalDetId & id() const
HcalUpgradeQIESample operator[](int iSample) const
HcalElectronicsId electronicsId_
uint16_t adc(int iSample=0) const
size_(0)
Definition: OwnArray.h:181
Readout chain identification for Hcal.
tuple size
Write out results.