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  capId_(0),
5  size_(0),
6  presamples_(0)
7 {
8 }
9 
11  capId_(0),
12  size_(0),
13  presamples_(0)
14 {
15 }
16 
17 HcalUpgradeDataFrame::HcalUpgradeDataFrame(HcalDetId id, int capId, int samples, int presamples)
18 : id_(id),
19  capId_(capId)
20 {
21  setSize(samples) ;
22  setPresamples(presamples) ;
23 }
24 
26  if (size>MAXSAMPLES) size_=MAXSAMPLES;
27  else if (size<=0) size_=0;
28  else size_=size;
29 }
30 
32  if (presamples>MAXSAMPLES) presamples_=MAXSAMPLES;
33  else if (presamples<=0) presamples_=0;
35 }
36 
38  return HcalUpgradeQIESample(adc(i), (capId_+i)%4, 0, 0);
39 }
40 
42  uint16_t adc,
43  uint16_t tdc,
44  bool dv) {
45 
46  if ( iSample < MAXSAMPLES && iSample>=0) {
47  adc_[iSample] = adc&0xFF ;
48  tdc_[iSample] = tdc&0xFFFF ;
49  dv_[iSample] = dv ;
50  }
51 }
52 
53 
54 std::ostream& operator<<(std::ostream& s, const HcalUpgradeDataFrame& digi) {
55  s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples \n";
56  for (int i=0; i<digi.size(); i++) {
57  if ( i < digi.presamples() ) s << " (PRE) " ;
58  else s << " " ;
59  s << int(digi.capId(i)) << " (capId) ";
60  s << int(digi.adc(i)) << " (adc) " ;
61  s << int(digi.tdc(i)) << " (tdc) " ;
62  if ( digi.valid(i) ) s << " (DV) " ;
63  s << std::endl ;
64  }
65  return s;
66 }
67 
68 
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
uint16_t tdc_[MAXSAMPLES]
void setSample(int iSample, uint16_t adc, uint16_t tdc, bool dv)
uint16_t adc_[MAXSAMPLES]
const HcalDetId & id() const
HcalUpgradeQIESample operator[](int iSample) const
uint16_t adc(int iSample=0) const
size_(0)
Definition: OwnArray.h:181
tuple size
Write out results.