CMS 3D CMS Logo

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 
28  if(markAndPass) m_data[0] |= (markAndPass&MASK_FLAVOR)<<OFFSET_FLAVOR;
29 }
30 
31 void QIE11DataFrame::setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi) {
32  if (isample>=size()) return;
33  m_data[isample+1]=(adc&Sample::MASK_ADC)|(soi?(Sample::MASK_SOI):(0))|((tdc&Sample::MASK_TDC)<<Sample::OFFSET_TDC);
34 }
35 
36 std::ostream& operator<<(std::ostream& s, const QIE11DataFrame& digi) {
37  if (digi.detid().det()==DetId::Hcal) {
38  s << HcalGenericDetId(digi.detid());
39  } else {
40  s << "DetId(" << digi.detid().rawId() << ")";
41  }
42  s << " " << digi.samples() << " samples";
43  if (digi.linkError()) s << " LinkError ";
44  if (digi.capidError()) s << " CapIdError ";
45  if (digi.zsMarkAndPass()) s << " M&P ";
46  s << std::endl;
47  for (int i=0; i<digi.samples(); i++) {
48  QIE11DataFrame::Sample sam = digi[i];
49  s << " ADC=" << sam.adc() << " TDC=" << sam.tdc() << " CAPID=" << sam.capid();
50  if (sam.soi()) s << " SOI ";
51  s << std::endl;
52  }
53  return s;
54 }
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
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
static const int MASK_FLAVOR
void setFlags(uint16_t v)
set the flag word
unsigned int size_type
Definition: DataFrame.h:18
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::ostream & operator<<(std::ostream &s, const QIE11DataFrame &digi)
void setZSInfo(bool markAndPass)
set ZS params
static const int MASK_TDC
bool linkError() const
bool zsMarkAndPass() const
was this a mark-and-pass ZS event?
static const int OFFSET_FLAVOR
get the flavor of the frame
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