CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QIE11DataFrame.cc
Go to the documentation of this file.
3 
4 void QIE11DataFrame::setCapid0(int cap0) {
5  m_data[0]&=0xFCFF; // inversion of the capid0 mask
7 }
8 
9 void QIE11DataFrame::setFlags(uint16_t v) {
10  m_data[size()-1]=v;
11 }
12 
14  for (edm::DataFrame::size_type i=0; i<size() && i<digi.size();i++){
15  Sample sam = digi[i];
16  setSample(i,sam.adc(),sam.tdc(),sam.soi());
17  }
18 }
19 
21  for (int i=0; i<samples(); i++) {
22  if ((*this)[i].soi()) return i;
23  }
24  return -1;
25 }
26 
27 void QIE11DataFrame::setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi) {
28  if (isample>=size()) return;
29  m_data[isample+1]=(adc&Sample::MASK_ADC)|(soi?(Sample::MASK_SOI):(0))|((tdc&Sample::MASK_TDC)<<Sample::OFFSET_TDC);
30 }
31 
32 std::ostream& operator<<(std::ostream& s, const QIE11DataFrame& digi) {
33  if (digi.detid().det()==DetId::Hcal) {
34  s << HcalGenericDetId(digi.detid());
35  } else {
36  s << "DetId(" << digi.detid().rawId() << ")";
37  }
38  s << " " << digi.samples() << " samples";
39  if (digi.linkError()) s << " LinkError ";
40  if (digi.capidError()) s << " CapIdError ";
41  if (digi.zsMarkAndPass()) s << " M&P ";
42  s << std::endl;
43  for (int i=0; i<digi.samples(); i++) {
44  QIE11DataFrame::Sample sam = digi[i];
45  s << " ADC=" << sam.adc() << " TDC=" << sam.tdc() << " CAPID=" << sam.capid();
46  if (sam.soi()) s << " SOI ";
47  s << std::endl;
48  }
49  return s;
50 }
int adc(sample_type sample)
get the ADC sample (12 bits)
DetId detid() const
Get the detector id.
void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
int i
Definition: DBlmapReader.cc:9
edm::DataFrame::size_type size() const
more accessors
static const int OFFSET_CAPID
void setCapid0(int cap0)
static const int MASK_CAPID
void copyContent(const QIE11DataFrame &)
static const int MASK_ADC
void setFlags(uint16_t v)
set the flag word
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
unsigned int size_type
Definition: DataFrame.h:18
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int MASK_TDC
bool linkError() const
bool zsMarkAndPass() const
was this a mark-and-pass ZS event?
bool capidError() const
edm::DataFrame m_data
static const int OFFSET_TDC
static const int MASK_SOI
int presamples() const
for backward compatibility
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
int samples() const
total number of samples in the digi